Re: [PATCH V2] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-07 Thread Ming Lei
Hi James, On Tue, Nov 07, 2017 at 07:04:23PM -0800, James Bottomley wrote: > On Wed, 2017-11-08 at 09:15 +0800, Ming Lei wrote: > > On Wed, Nov 08, 2017 at 01:06:44AM +, Bart Van Assche wrote: > > > > > > On Wed, 2017-11-08 at 08:59 +0800, Ming Lei wrote: > > > > > > > > On Tue, Nov 07, 2017

Re: [PATCH V2] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-07 Thread James Bottomley
On Wed, 2017-11-08 at 09:15 +0800, Ming Lei wrote: > On Wed, Nov 08, 2017 at 01:06:44AM +, Bart Van Assche wrote: > > > > On Wed, 2017-11-08 at 08:59 +0800, Ming Lei wrote: > > > > > > On Tue, Nov 07, 2017 at 04:13:48PM +, Bart Van Assche wrote: > > > > > > > > On Tue, 2017-11-07 at 23:2

Re: [PATCH V2] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-07 Thread Ming Lei
On Wed, Nov 08, 2017 at 01:06:44AM +, Bart Van Assche wrote: > On Wed, 2017-11-08 at 08:59 +0800, Ming Lei wrote: > > On Tue, Nov 07, 2017 at 04:13:48PM +, Bart Van Assche wrote: > > > On Tue, 2017-11-07 at 23:21 +0800, Ming Lei wrote: > > > > diff --git a/drivers/scsi/scsi_debugfs.c b/driv

Re: [PATCH V2] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-07 Thread Bart Van Assche
On Wed, 2017-11-08 at 08:59 +0800, Ming Lei wrote: > On Tue, Nov 07, 2017 at 04:13:48PM +, Bart Van Assche wrote: > > On Tue, 2017-11-07 at 23:21 +0800, Ming Lei wrote: > > > diff --git a/drivers/scsi/scsi_debugfs.c b/drivers/scsi/scsi_debugfs.c > > > index 5e9755008aed..7a50878446b4 100644 > >

Re: [PATCH V2] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-07 Thread Ming Lei
On Tue, Nov 07, 2017 at 04:13:48PM +, Bart Van Assche wrote: > On Tue, 2017-11-07 at 23:21 +0800, Ming Lei wrote: > > cmd->cmnd can be allocated/freed dynamically in case of > > T10_PI_TYPE2_PROTECTION, > > so we can't access it in scsi_show_rq() if 'SCpnt->cmnd != > > scsi_req(rq)->cmd', > >

Re: [PATCH V2] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-07 Thread Bart Van Assche
On Tue, 2017-11-07 at 23:21 +0800, Ming Lei wrote: > cmd->cmnd can be allocated/freed dynamically in case of > T10_PI_TYPE2_PROTECTION, > so we can't access it in scsi_show_rq() if 'SCpnt->cmnd != scsi_req(rq)->cmd', > because this request can be freed any time. That description is inaccurate. It

[PATCH V2] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-07 Thread Ming Lei
cmd->cmnd can be allocated/freed dynamically in case of T10_PI_TYPE2_PROTECTION, so we can't access it in scsi_show_rq() if 'SCpnt->cmnd != scsi_req(rq)->cmd', because this request can be freed any time. This patch trys to fix the following kernel crash when dumping request via block's debugfs int