]> git.ipfire.org Git - thirdparty/qemu.git/commit
file-posix: Clear bs->bl.zoned on error
authorHanna Czenczek <hreitz@redhat.com>
Thu, 24 Aug 2023 15:53:40 +0000 (17:53 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 2 Oct 2023 23:00:54 +0000 (02:00 +0300)
commitc2e6a00b5fb96bfb4f47b8b8fa984b1209da84d8
treea6bcde295bcf1ac5e99916613d6b17e21fcc5057
parentf59caeca76795341cd1e82575c79bb4a9218650d
file-posix: Clear bs->bl.zoned on error

bs->bl.zoned is what indicates whether the zone information is present
and valid; it is the only thing that raw_refresh_zoned_limits() sets if
CONFIG_BLKZONED is not defined, and it is also the only thing that it
sets if CONFIG_BLKZONED is defined, but there are no zones.

Make sure that it is always set to BLK_Z_NONE if there is an error
anywhere in raw_refresh_zoned_limits() so that we do not accidentally
announce zones while our information is incomplete or invalid.

This also fixes a memory leak in the last error path in
raw_refresh_zoned_limits().

Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20230824155345.109765-2-hreitz@redhat.com>
Reviewed-by: Sam Li <faithilikerun@gmail.com>
(cherry picked from commit 56d1a022a77ea2125564913665eeadf3e303a671)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
block/file-posix.c