linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: FUJITA Tomonori <tomof@acm.org>
Cc: lnxninja@linux.vnet.ibm.com, fujita.tomonori@lab.ntt.co.jp,
	linux-scsi@vger.kernel.org, Mark_Salyzyn@adaptec.com
Subject: Re: ips.c broken since 2.6.23 on x86_64?
Date: Sun, 17 Feb 2008 14:52:11 +0200	[thread overview]
Message-ID: <47B82DFB.8010206@panasas.com> (raw)
In-Reply-To: <20080216094127E.tomof@acm.org>

On Sat, Feb 16 2008 at 2:41 +0200, FUJITA Tomonori <tomof@acm.org> wrote:
> On Fri, 15 Feb 2008 14:50:57 -0800
> Tim Pepper <lnxninja@linux.vnet.ibm.com> wrote:
> 
>> On Sat 16 Feb at 01:09:43 +0900 tomof@acm.org said:
>>> The first one is just reverting the data buffer accessors
>>> conversion. It would be nice if we could just revert it but we
>>> can't. These changes are necessary to compile the driver against post
>>> 2.6.24.
>> Fujita-san,
>>
>> Unfortunately (and not too surprisingly given what we've tried so far) with
>> only the first of your series reverted the driver is working fine for me
>> again.
> 
> Do you mean that you applied only the following two patches against
> 2.6.24, and then it doesn't work?
> 
> 0001-ips-revert-the-changes-for-the-data-buffer-accessor.patch
> 0002-ips-kill-the-map_single-path-in-ips_scmd_buf_write.patch
> 
> If so, the second patch is broken. Did you saw BUG_ON message (I added
> some BUG_ON to the patch)?
> 
> 
>> I saw (eg: replies to http://lkml.org/lkml/2007/5/11/132) some possibly
>> similar sounding issues with other drivers.  Could there be some memory
>> uninitialised?  I did try changing all the ips.c kmalloc's to kzalloc's,
>> but that didn't help.  Also that thread ties into pci gart.  The machines
>> we've been using are liable to getting pci calgary although given my
>> .config has:
>>     CONFIG_GART_IOMMU=y
>>     CONFIG_CALGARY_IOMMU=y
>>     # CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT is not set
>> and that when booting this mainline I don't see any Calgary related
>> messages like I get from eg: Ubuntu's 2.6.22-14-server...I'm probably not
>> actually running the calgary iommu code in these repros.
> 
> Yes, probabaly, your machine doesn't use any IOMMU hardware
> (nommu_map_sg function was in your crash log).
> 
> 
>> Anyway, I greatly appreciate your efforts so far in trying to find what
>> could be wrong here!
> 
> Really sorry about the troubles and thanks for testing.
> -
Tomo hi
It looks like the same bug we had with USB's isd200 and protocol.c. An overflow
of a data buffer bigger then then the sglist. There 2 it was in the INQUIRY command.

You just need to also check for sg != NULL in the for() loop.

Tim Please test below patch. It's ontop of 2.6.24 but should also apply to
2.6.25-rcx

Boaz
-- 
>From ec20bea25c9fe2400378b19c128b15fef3c7cbb6 Mon Sep 17 00:00:00 2001
From: Boaz Harrosh <bharrosh@panasas.com>
Date: Sun, 17 Feb 2008 14:50:25 +0200
Subject: [PATCH] ips: Avoid overflow in writing scsi command data

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 drivers/scsi/ips.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 5c5a9b2..1d12253 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -3517,7 +3517,7 @@ ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
         struct scatterlist *sg = scsi_sglist(scmd);
 
         for (i = 0, xfer_cnt = 0;
-             (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) {
+             (i < scsi_sg_count(scmd)) && (xfer_cnt < count) && sg; i++) {
                 min_cnt = min(count - xfer_cnt, sg[i].length);
 
                 /* kmap_atomic() ensures addressability of the data buffer.*/
-- 
1.5.3.3


  reply	other threads:[~2008-02-17 13:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 21:43 ips.c broken since 2.6.23 on x86_64? Tim Pepper
     [not found] ` <532ABFBDAAC3A34EB12EBA6CEC2838F439964688@ADPE2K703.adaptec.com>
2008-02-14  0:04   ` Tim Pepper
2008-02-18 14:57     ` Salyzyn, Mark
2008-02-18 23:34       ` Tim Pepper
2008-02-14 11:48 ` FUJITA Tomonori
2008-02-14 23:55   ` Tim Pepper
2008-02-15  0:13     ` FUJITA Tomonori
2008-02-15  1:16       ` Tim Pepper
2008-02-15 16:09         ` FUJITA Tomonori
2008-02-15 22:50           ` Tim Pepper
2008-02-16  0:41             ` FUJITA Tomonori
2008-02-17 12:52               ` Boaz Harrosh [this message]
2008-02-17 13:09                 ` Boaz Harrosh
2008-02-17 21:16                   ` Tim Pepper
2008-02-17 21:15               ` Tim Pepper
2008-02-17 22:31                 ` FUJITA Tomonori
2008-02-17 23:29                   ` Tim Pepper
2008-02-17 23:37                   ` Tim Pepper
2008-02-18 13:32                     ` FUJITA Tomonori
2008-02-18 23:30                       ` Tim Pepper
2008-02-19  0:11                         ` FUJITA Tomonori
2008-02-19  3:48                           ` Tim Pepper
2008-02-19  8:22                             ` FUJITA Tomonori
2008-02-19  8:02                       ` FUJITA Tomonori
2008-02-19 16:06                         ` James Bottomley
2008-02-19 20:29                           ` FUJITA Tomonori

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=47B82DFB.8010206@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Mark_Salyzyn@adaptec.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lnxninja@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).