All of lore.kernel.org
 help / color / mirror / Atom feed
From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: "Ewan D. Milne" <emilne@redhat.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: jejb@linux.ibm.com,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Junxiao Bi <junxiao.bi@oracle.com>,
	diego.gonzalez@oracle.com
Subject: Re: [BUG] scsi: ses: out of bound accessing in ses_enclosure_data_process
Date: Tue, 19 Mar 2019 10:41:58 +0800	[thread overview]
Message-ID: <92bf2380-626c-d51a-3f8b-de30462d4dd3@oracle.com> (raw)
In-Reply-To: <3b2542225e519a8cf8e329745b0ee2e2464787c7.camel@redhat.com>



On 3/18/19 11:22 PM, Ewan D. Milne wrote:
> On Mon, 2019-03-18 at 01:01 -0400, Martin K. Petersen wrote:
>> Jianchao,
>>
>>> When our customer probe the lpfc devices, they encountered odd memory
>>> corruption issues, and we get 'out of bound' access warning at
>>> following position after open KASAN
>>
>> Please provide the output of:
>>
>> # sg_ses -p 1 /dev/sgN
>> # sg_ses -p 7 /dev/sgN
>>
>> for the enclosure device in question.
>>
> 
> The ses driver is allocating kernel buffers based upon the size
> reported by RECEIVE DIAGNOSTIC commands, and is iterating through
> them based on sizes in the individual descriptors.  It appears to
> be vulnerable to incorrect data from the device causing out-of-bounds
> memory access, because the for() test does not prevent the use of
> the pointer in subsequent code, e.g.:
> 
>         for (i = 0; i < num_enclosures && type_ptr < buf + len; i++) {
>                 types += type_ptr[2];
>                 type_ptr += type_ptr[3] + 4;
>         }
> 
>         ses_dev->page1_types = type_ptr;
>         ses_dev->page1_num_types = types;
> 
> Whether or not this is the current problem, it's wrong.
> 

Yes, I definitely agree with this.
There should be some change here.

Thanks
Jianchao


      reply	other threads:[~2019-03-19  2:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14  3:19 [BUG] scsi: ses: out of bound accessing in ses_enclosure_data_process jianchao.wang
2019-03-18  3:13 ` jianchao.wang
2019-03-18  4:17   ` Junxiao Bi
2019-03-18  5:01 ` Martin K. Petersen
2019-03-18  5:01   ` Martin K. Petersen
2019-03-18  5:09   ` jianchao.wang
2019-03-18 15:22   ` Ewan D. Milne
2019-03-19  2:41     ` jianchao.wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92bf2380-626c-d51a-3f8b-de30462d4dd3@oracle.com \
    --to=jianchao.w.wang@oracle.com \
    --cc=diego.gonzalez@oracle.com \
    --cc=emilne@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=junxiao.bi@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.