[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220719075442.6215-1-yanghao_ht@163.com>
Date: Tue, 19 Jul 2022 15:54:42 +0800
From: Yang Hao <yanghao_ht@....com>
To: jejb@...ux.ibm.com, martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Yang Hao <yanghao_ht@....com>
Subject: [RFC] scsi: ch: add scsi_device_put in ch_readconfig
ch_probe
ch_readconfig
scsi_device_lookup
scsi_device_get
...
when the dev is found, the related refcnt of dev will increase,
and there is no 'scsi_device_put' to decrease it, which will lead
to refcnt leak.
Signed-off-by: Yang Hao <yanghao_ht@....com>
---
drivers/scsi/ch.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 27012908b..70ba5d63e 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -407,6 +407,8 @@ ch_readconfig(scsi_changer *ch)
ch->dt[elem]->vendor,
ch->dt[elem]->model,
ch->dt[elem]->rev);
+ scsi_device_put(ch->dt[elem]);
+ ch->dt[elem] = NULL;
}
}
}
--
2.25.1
Powered by blists - more mailing lists