Message ID | 20240404231840.2015678-1-kbusch@meta.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | scsi: sg: fix refcount warning | expand |
On Thu, Apr 04, 2024 at 04:18:40PM -0700, Keith Busch wrote: > This fixes the warning: > > ------------[ cut here ]------------ > WARNING: CPU: 8 PID: 394 at drivers/scsi/sg.c:2236 sg_remove_sfp_usercontext+0x1ad/0x1d0 [sg] I see the tree we're testing is a little behind the latest scsi, and a proper fix was already committed: https://lore.kernel.org/linux-scsi/81266270-42F4-48F9-9139-8F0C3F0A6553@linux.ibm.com/T/#t
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 386981c6976a5..eba8fc8c88a51 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -2233,7 +2233,7 @@ sg_remove_sfp_usercontext(struct work_struct *work) "sg_remove_sfp: sfp=0x%p\n", sfp)); kfree(sfp); - WARN_ON_ONCE(kref_read(&sdp->d_ref) != 1); + WARN_ON_ONCE(kref_read(&sdp->d_ref) < 1); kref_put(&sdp->d_ref, sg_device_destroy); scsi_device_put(device); module_put(THIS_MODULE);