scsi_dh: fix use-after-free when removing scsi device
The commit 1bab0de0 ("dm-mpath, scsi_dh: don't let dm detach device handlers") removed reference counting of attached scsi device handler. As a result, handler data is freed immediately via scsi_dh->detach() in the context of scsi_remove_device() where activation request can be still in flight. This patch moves scsi_dh_handler_detach() to sdev releasing function, scsi_device_dev_release_usercontext(), at that point the device is already in quiesced state. Fixes: 1bab0de0 ("dm-mpath, scsi_dh: don't let dm detach device handlers") Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com> Acked-by: NChristoph Hellwig <hch@lst.de> Signed-off-by: NJames Bottomley <JBottomley@Odin.com>
Showing
想要评论请 注册 或 登录