mbox series

[v3,0/2] sd_zbc fixes

Message ID 20220601062544.905141-1-damien.lemoal@opensource.wdc.com
Headers show
Series sd_zbc fixes | expand

Message

Damien Le Moal June 1, 2022, 6:25 a.m. UTC
A couple of patches to fix 2 issues with the zbc code:
* A potential NULL pointer dereference in sd_is_zoned(), if that
  function is called when sdkp->device is not yet set (e.g. if an error
  happen early in sd_probe()).
* Make sure that sdkp zone information memory is never leaked.

Changes from v2:
* Simplified patch 1 fix as suggested by Christoph.

Changes from v1:
* Added reviewed-by and tested-by tags in patch 1
* Changed patch 2 to rename sd_zbc_clear_zone_info() to
  sd_zbc_free_zone_info() and remove sd_zbc_release_disk().

Damien Le Moal (2):
  scsi: sd: Fix potential NULL pointer dereference
  scsi: sd_zbc: prevent zone information memory leak

 drivers/scsi/sd.c     |  3 +--
 drivers/scsi/sd.h     |  4 ++--
 drivers/scsi/sd_zbc.c | 26 +++++++++++++-------------
 3 files changed, 16 insertions(+), 17 deletions(-)

Comments

Martin K. Petersen June 2, 2022, 2:37 a.m. UTC | #1
Damien,

> A couple of patches to fix 2 issues with the zbc code:
> * A potential NULL pointer dereference in sd_is_zoned(), if that
>   function is called when sdkp->device is not yet set (e.g. if an error
>   happen early in sd_probe()).
> * Make sure that sdkp zone information memory is never leaked.

Applied to 5.19/scsi-staging, thanks!