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

2013-07-21 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(). Changes from v4: * use ERR_PTR series instead of adding another parameter in

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

2013-07-21 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(). Changes from v4: * use ERR_PTR series instead of adding another parameter in