scsi: sd: cleanup gendisk if device_add_disk() failed
PATCH 1/1 scsi: sd: cleanup gendisk if device_add_disk() failed
We forget to call blk_cleanup_disk() when device_add_disk() failed. Which would cause memory leak of gendisk and sched_tags alloced in elevator_init_mq()
Reference:https://syzkaller.appspot.com/x/log.txt?x=13b41dcb700000
Reported-and-tested-by [email protected]
Signed-off-by Wenchao Hao <[email protected]>
--- drivers/scsi/sd.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/sd.c +1 -0
@@ -3475,6 +3475,7 @@ static int sd_probe(struct device *dev) error =device_add_disk (dev, gd,NULL );if (error) {put_device (&sdkp->disk_dev); +blk_cleanup_disk (gd); goto out; }
Signature · 1 line
2.32.0