public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: skogtun.linux@gmail.com, matthew@wil.cx,
	linux-scsi@vger.kernel.org, tomof@acm.org
Subject: Re: [PATCH] advansys: fix overrun_buf aligned bug
Date: Thu, 07 Feb 2008 19:37:13 -0600	[thread overview]
Message-ID: <1202434633.3171.64.camel@localhost.localdomain> (raw)
In-Reply-To: <20080208101641R.fujita.tomonori@lab.ntt.co.jp>


On Fri, 2008-02-08 at 10:16 +0900, FUJITA Tomonori wrote:
> On Thu, 07 Feb 2008 19:01:55 -0600
> James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> 
> > 
> > On Fri, 2008-02-08 at 09:50 +0900, FUJITA Tomonori wrote:
> > > struct asc_dvc_var needs overrun buffer to be placed on an 8 byte
> > > boundary. advansys defines struct asc_dvc_var:
> > > 
> > > struct asc_dvc_var {
> > > 	...
> > > 	uchar overrun_buf[ASC_OVERRUN_BSIZE] __aligned(8);
> > > 
> > > The problem is that struct asc_dvc_var is placed on
> > > shost->hostdata. So if the hostdata is not on an 8 byte boundary, the
> > > advansys crashes. The hostdata is placed on a sizeof(unsigned long)
> > > boundary so the 8 byte boundary is not garanteed with x86_32.
> > > 
> > > With 2.6.23 and 2.6.24, the hostdata is on an 8 byte boundary by
> > > chance, but with the current git, it's not.
> > > 
> > > This patch removes overrun_buf static array and use kzalloc.
> > 
> > It's a bit of a waste of a kmallocs.  The usual way of fixing this type
> > of cockup is to float the structure until it becomes aligned, but I
> > suppose that involves changing all calls to shost_priv in the driver ...
> 
> Yeah, agreed. It's better but I'm not familiar with the driver so I
> use kmalloc. It's not so bad as a short-term solution, I think.
> 
> Any chance to push it to final SCSI updates for 2.6.24 merge window?
> Though we can push it any time since it's a bug fix.
> 
> Anyway, I'm fine with dropping it if Matthew will fix the driver in a
> better way. I'm happy unless people blame my IOMMU or sense buffer
> patch for this bug. :)

Sure, will do ...  I think it's an OK interim fix.

James



      reply	other threads:[~2008-02-08  1:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08  0:50 [PATCH] advansys: fix overrun_buf aligned bug FUJITA Tomonori
2008-02-08  1:01 ` James Bottomley
2008-02-08  1:16   ` FUJITA Tomonori
2008-02-08  1:37     ` James Bottomley [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=1202434633.3171.64.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=skogtun.linux@gmail.com \
    --cc=tomof@acm.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