Re: [PATCH v2] scsi: core: fix uninit-value access of variable sshdr

2019-10-11 Thread zhengbin (A)


On 2019/10/12 10:06, James Bottomley wrote:
> On Sat, 2019-10-12 at 10:03 +0800, zhengbin (A) wrote:
>> On 2019/10/12 9:58, James Bottomley wrote:
>>> On Sat, 2019-10-12 at 09:26 +0800, zhengbin wrote:
 BTW: we can't just init sshdr->response_code, sr_do_ioctl use
 sshdr->sense_key
>>> That's an actual bug, isn't it?
>> If we init sshdr in __scsi_execute, this will be ok
> No I mean it's a bug because sr_do_ioctl shouldn't be acting on sense
> that isn't valid.  So all uses of sshdr should be gated on a validity
> check.

Yes you are right, the right way is use scsi_sense_valid(&sshdr), I have 
troubleshoot callers,

this is the only wrong use(Maybe I miss some...).

>
> James
>
>
> .
>



Re: [PATCH v2] scsi: core: fix uninit-value access of variable sshdr

2019-10-11 Thread James Bottomley
On Sat, 2019-10-12 at 10:03 +0800, zhengbin (A) wrote:
> On 2019/10/12 9:58, James Bottomley wrote:
> > On Sat, 2019-10-12 at 09:26 +0800, zhengbin wrote:
> > > BTW: we can't just init sshdr->response_code, sr_do_ioctl use
> > > sshdr->sense_key
> > 
> > That's an actual bug, isn't it?
> 
> If we init sshdr in __scsi_execute, this will be ok

No I mean it's a bug because sr_do_ioctl shouldn't be acting on sense
that isn't valid.  So all uses of sshdr should be gated on a validity
check.

James



Re: [PATCH v2] scsi: core: fix uninit-value access of variable sshdr

2019-10-11 Thread zhengbin (A)


On 2019/10/12 9:58, James Bottomley wrote:
> On Sat, 2019-10-12 at 09:26 +0800, zhengbin wrote:
>> BTW: we can't just init sshdr->response_code, sr_do_ioctl use
>> sshdr->sense_key
> That's an actual bug, isn't it?
If we init sshdr in __scsi_execute, this will be ok
>
> James
>
>
> .
>



Re: [PATCH v2] scsi: core: fix uninit-value access of variable sshdr

2019-10-11 Thread James Bottomley
On Sat, 2019-10-12 at 09:26 +0800, zhengbin wrote:
> BTW: we can't just init sshdr->response_code, sr_do_ioctl use
> sshdr->sense_key

That's an actual bug, isn't it?

James