SCSI advansys: fix overrun_buf aligned bug
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 26 Feb 2008 17:06:18 +0000 (02:06 +0900)
committerChris Wright <chrisw@sous-sol.org>
Mon, 24 Mar 2008 18:47:24 +0000 (11:47 -0700)
commitdb29706ff57deba8866fb4681a1a8b99bf59c805
tree9097e3bb5d46d3c59b7221d4c6874bb601a389e0
parent3752f4024d617852b6d4758b9a7ac89a530cf98e
SCSI advansys: fix overrun_buf aligned bug

commit 7d5d408c77cee95d1380511de46b7a4c8dc2211d

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.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
FUJITA Tomonori notes:
  We thought that 2.6.24 doesn't have this bug, however it does.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/advansys.c