linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: zfcp: fix use-after-free in zfcp_unit_remove
@ 2020-11-20  7:48 Qinglang Miao
  2020-11-25 17:06 ` Benjamin Block
  0 siblings, 1 reply; 9+ messages in thread
From: Qinglang Miao @ 2020-11-20  7:48 UTC (permalink / raw)
  To: Steffen Maier, Benjamin Block, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger
  Cc: linux-s390, linux-kernel, Qinglang Miao

kfree(port) is called in put_device(&port->dev) so that following
use would cause use-after-free bug.

The former put_device is redundant for device_unregister contains
put_device already. So just remove it to fix this.

Fixes: 86bdf218a717 ("[SCSI] zfcp: cleanup unit sysfs attribute usage")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 drivers/s390/scsi/zfcp_unit.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c
index e67bf7388..664b77853 100644
--- a/drivers/s390/scsi/zfcp_unit.c
+++ b/drivers/s390/scsi/zfcp_unit.c
@@ -255,8 +255,6 @@ int zfcp_unit_remove(struct zfcp_port *port, u64 fcp_lun)
 		scsi_device_put(sdev);
 	}
 
-	put_device(&unit->dev);
-
 	device_unregister(&unit->dev);
 
 	return 0;
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-12-01  2:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20  7:48 [PATCH] scsi: zfcp: fix use-after-free in zfcp_unit_remove Qinglang Miao
2020-11-25 17:06 ` Benjamin Block
2020-11-26  1:27   ` Qinglang Miao
2020-11-26  8:13     ` Cornelia Huck
2020-11-26  9:42       ` Benjamin Block
2020-11-26 12:07         ` Qinglang Miao
2020-11-26 15:12           ` Benjamin Block
2020-11-27  9:21             ` Steffen Maier
2020-12-01  2:46               ` Qinglang Miao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).