diff options
author | Damien Le Moal <[email protected]> | 2022-06-01 15:25:44 +0900 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2022-06-01 22:36:44 -0400 |
commit | 30c4fdc3dcdd1f08876300711778d8b680d54b36 (patch) | |
tree | 1075a97cfb29ba2d2b3de28577adcde8d00a82dd /net/lapb/lapb_in.c | |
parent | 05fbde3a77a4f1d62e4c4428f384288c1f1a0be5 (diff) |
scsi: sd_zbc: Prevent zone information memory leak
Make sure to always free a scsi disk zone information, even for regular
disks. This ensures that there is no memory leak, even in the case of a
zoned disk changing type to a regular disk (e.g. with a reformat using the
FORMAT WITH PRESET command or other vendor proprietary command).
To do this, rename sd_zbc_clear_zone_info() to sd_zbc_free_zone_info() and
remove sd_zbc_release_disk(). A call to sd_zbc_free_zone_info() is added to
sd_zbc_read_zones() for drives for which sd_is_zoned() returns
false. Furthermore, sd_zbc_free_zone_info() code make s sure that the sdkp
rev_mutex is never used while not being initialized by gating the cleanup
code with a a check on the zone_wp_update_buf field as it is never NULL
when rev_mutex has been initialized.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Johannes Thumshirn <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Damien Le Moal <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'net/lapb/lapb_in.c')
0 files changed, 0 insertions, 0 deletions