Re: [PATCH v3] scsi: sg: Avoid race in error handling & drop bogus warn

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

 



On 04.04.24 01:24, Bart Van Assche wrote:
On 4/1/24 12:10 PM, Alexander Wetzel wrote:
@@ -301,11 +302,12 @@ sg_open(struct inode *inode, struct file *filp)
      /* This driver's module count bumped by fops_get in <linux/fs.h> */
      /* Prevent the device driver from vanishing while we sleep */
-    retval = scsi_device_get(sdp->device);
+    device = sdp->device;
+    retval = scsi_device_get(device);
      if (retval)
          goto sg_put;

Are all the sdp->device -> device changes essential? Isn't there a
preference to minimize patches that will end up in the stable trees?


Only the very last change is essential:
-       scsi_device_put(sdp->device);
-       goto sg_put;
+       kref_put(&sdp->d_ref, sg_device_destroy);
+       scsi_device_put(device);
+       return retval;

Not using a (required) local variable and de-referencing it again and looks strange for anyone reading the code. While the additional lines in the patch are trivial to review...

Alexander




[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