Re: [PATCH v4 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-22 Thread Jörn Engel
On Sat, 20 July 2013 15:53:16 +0800, Xitao Cao wrote: > > Thanks for your comment. Do I need to update it and resend? Yes, please. Jörn -- When people work hard for you for a pat on the back, you've got to give them that pat. -- Robert Heinlein -- To unsubscribe from this list: send the line "u

Re: [PATCH v4 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-19 Thread Jörn Engel
On Wed, 17 July 2013 23:34:05 +0800, Vaughan Cao wrote: > > -static Sg_fd *sg_add_sfp(Sg_device * sdp, int dev); > +static Sg_fd *sg_add_sfp(Sg_device * sdp, int dev, int * reason); You can use ERR_PTR and friends instead of adding another parameter. > static void sg_remove_sfp(struct kref *); >

[PATCH v4 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-17 Thread Vaughan Cao
@detached is set under the protection of sg_index_lock. Without getting the lock, new sfp will be added during sg removal and there is no chance for it to be picked out. So check with sg_index_lock held in sg_add_sfp(). Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 26 ++