linux/drivers/scsi/snic
Zhu Wang 1bd3a76880 scsi: snic: Fix double free in snic_tgt_create()
Commit 41320b18a0 ("scsi: snic: Fix possible memory leak if device_add()
fails") fixed the memory leak caused by dev_set_name() when device_add()
failed. However, it did not consider that 'tgt' has already been released
when put_device(&tgt->dev) is called. Remove kfree(tgt) in the error path
to avoid double free of 'tgt' and move put_device(&tgt->dev) after the
removed kfree(tgt) to avoid a use-after-free.

Fixes: 41320b18a0 ("scsi: snic: Fix possible memory leak if device_add() fails")
Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
Link: https://lore.kernel.org/r/20230819083941.164365-1-wangzhu9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-24 22:30:32 -04:00
..
cq_desc.h
cq_enet_desc.h
Makefile
snic_attrs.c
snic_ctl.c
snic_debugfs.c
snic_disc.c scsi: snic: Fix double free in snic_tgt_create() 2023-08-24 22:30:32 -04:00
snic_disc.h
snic_fwint.h
snic_io.c
snic_io.h
snic_isr.c
snic_main.c scsi: snic: Declare SCSI host template const 2023-03-24 19:19:59 -04:00
snic_res.c
snic_res.h
snic_scsi.c scsi: snic: Remove unused 'xfer_len' variable 2023-04-02 21:47:36 -04:00
snic_stats.h
snic_trc.c
snic_trc.h
snic.h
vnic_cq_fw.h
vnic_cq.c
vnic_cq.h
vnic_dev.c
vnic_dev.h
vnic_devcmd.h
vnic_intr.c
vnic_intr.h
vnic_resource.h
vnic_snic.h
vnic_stats.h
vnic_wq.c
vnic_wq.h
wq_enet_desc.h