From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Harvey Harrison <harvey.harrison@gmail.com>,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: ses: fix VPD inquiry overrun
Date: Wed, 30 Jul 2008 09:53:04 -0500 [thread overview]
Message-ID: <1217429584.3335.0.camel@localhost.localdomain> (raw)
In-Reply-To: <48903800.7000008@panasas.com>
On Wed, 2008-07-30 at 12:44 +0300, Boaz Harrosh wrote:
> James Bottomley wrote:
> > There are a few kerneloops.org reports like this one:
> >
> > http://www.kerneloops.org/search.php?search=ses_match_to_enclosure
> >
> > That seem to imply we're running off the end of the VPD inquiry data
> > (although at 512 bytes, it should be long enough for just about
> > anything). we should be using correctly sized buffers anyway, so put
> > those in and hope this oops goes away.
> >
> > James
> >
> > ---
> >
> > diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
> > index 0fe031f..f2d89be 100644
> > --- a/drivers/scsi/ses.c
> > +++ b/drivers/scsi/ses.c
> > @@ -345,14 +345,14 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev,
> > return 0;
> > }
> >
> > -#define VPD_INQUIRY_SIZE 512
> > +#define VPD_INQUIRY_SIZE 36
> >
> > static void ses_match_to_enclosure(struct enclosure_device *edev,
> > struct scsi_device *sdev)
> > {
> > unsigned char *buf = kmalloc(VPD_INQUIRY_SIZE, GFP_KERNEL);
> > unsigned char *desc;
> > - int len;
> > + u16 vpd_len;
> > struct efd efd = {
> > .addr = 0,
> > };
> > @@ -372,9 +372,19 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
> > VPD_INQUIRY_SIZE, NULL, SES_TIMEOUT, SES_RETRIES))
> > goto free;
> >
> > - len = (buf[2] << 8) + buf[3];
> > + vpd_len = (buf[2] << 8) + buf[3];
>
> + vpd_len = get_unaligned_be16(&buf[2]);
Not at the moment. Matthew had a patch to add the necessary scsi
wrappers (including the missing 24 bit one) to replace our current u32
one.
But that goes after this, and this will be a backport.
James
next prev parent reply other threads:[~2008-07-30 14:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-29 16:38 ses: fix VPD inquiry overrun James Bottomley
2008-07-30 9:44 ` Boaz Harrosh
2008-07-30 14:53 ` James Bottomley [this message]
2008-07-30 17:35 ` Harvey Harrison
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=1217429584.3335.0.camel@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=bharrosh@panasas.com \
--cc=harvey.harrison@gmail.com \
--cc=linux-scsi@vger.kernel.org \
/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