[RFC] scsi: ch: add scsi_device_put in ch_readconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux