-----Original Message----- From: Mike Christie <michaelc@xxxxxxxxxxx> Date: Monday 6 May 2013 10:36 PM To: Zhao Hongjiang <zhaohongjiang@xxxxxxxxxx> Cc: "JBottomley@xxxxxxxxxxxxx" <JBottomley@xxxxxxxxxxxxx>, Ravi Anand <ravi.anand@xxxxxxxxxx>, Vikas <vikas.chaudhary@xxxxxxxxxx>, scsi <linux-scsi@xxxxxxxxxxxxxxx> Subject: Re: [PATCH] scsi: add put_device() after device_find_child() >On 05/06/2013 06:55 AM, Zhao Hongjiang wrote: >> The qla4xxx_sysfs_ddb_add() function uses device_find_child() but it >>does not drop >> the reference of the retrieved child. >> >> Signed-off-by: Zhao Hongjiang <zhaohongjiang@xxxxxxxxxx> >> --- >> drivers/scsi/qla4xxx/ql4_os.c | 1 + >> 1 files changed, 1 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/scsi/qla4xxx/ql4_os.c >>b/drivers/scsi/qla4xxx/ql4_os.c >> index a47f999..b378d9e 100644 >> --- a/drivers/scsi/qla4xxx/ql4_os.c >> +++ b/drivers/scsi/qla4xxx/ql4_os.c >> @@ -5605,6 +5605,7 @@ static int qla4xxx_sysfs_ddb_add(struct Scsi_Host >>*shost, const char *buf, >> ql4_printk(KERN_ERR, ha, >> "%s: A non-persistent entry %s found\n", >> __func__, dev->kobj.name); >> + put_device(dev); >> goto exit_ddb_add; >> } >> >> > >Thanks for catching this. I messed up when reviewing it. For some dumb >reason I thought it was not doing refcounting. > >I think there are a couple bugs from other similar functions. What about >the attached patch? It is only compile tested. If it is ok, Vikas, >please test. We have tested this patch and it looks good in our testing. I am resending this patch for inclusion with our next patch-set which I am sending in next email. Thanks for fixing this. Acked-by: Vikas Chaudhary <vikas.chaudhary@xxxxxxxxxx>
<<attachment: winmail.dat>>