public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: "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: Mon, 18 Mar 2019 11:13:18 +0800	[thread overview]
Message-ID: <40646609-8298-2d76-2f0c-e732404a23d4@oracle.com> (raw)
In-Reply-To: <78dd3eca-7e8a-72f9-07f9-e2c7cc4569b0@oracle.com>

Would anyone please give some suggestions ?

It looks like there somethings wrong in the read-in data, 

	/* skip all the enclosure descriptors */
	for (i = 0; i < num_enclosures && type_ptr < buf + len; i++) {
		types += type_ptr[2];
		type_ptr += type_ptr[3] + 4; ----> here
	}
Then the typr_ptr got out of bound of the buffer.


Thanks
Jianchao

On 3/14/19 11:19 AM, jianchao.wang wrote:
> Dear all
> 
> 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
> 
> ses_enclosure_data_process
> 
> for (i = 0; i < types; i++, type_ptr += 4) {
>   for (j = 0; j < type_ptr[1]; j++) {
>                    ^^^^^^^^^^^
>                    out of bound
> 
> With some debug log, I got following,
> 
> page1 ffff88042d1aad20 len 32 types 5 type_ptr ffff88042d1aad64
> 
> Would anyone please give some suggestions on this ?
> 
> Thanks
> Jianchao
> 

  reply	other threads:[~2019-03-18  3:10 UTC|newest]

Thread overview: 7+ 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 [this message]
2019-03-18  4:17   ` Junxiao Bi
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

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=40646609-8298-2d76-2f0c-e732404a23d4@oracle.com \
    --to=jianchao.w.wang@oracle.com \
    --cc=diego.gonzalez@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox