Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Mark Salyzyn <Mark_Salyzyn@adaptec.com>
Cc: Linux-Scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] aacraid: prevent copy_from_user() BUG!
Date: Thu, 05 Jun 2008 10:35:27 -0500	[thread overview]
Message-ID: <1212680127.13549.38.camel@localhost.localdomain> (raw)
In-Reply-To: <DF06F352-4C27-47D3-983A-FB2414C8D88E@adaptec.com>

On Wed, 2008-05-28 at 15:32 -0400, Mark Salyzyn wrote:
> Seen:
> 
> 	kernel BUG at arch/i386/lib/usercopy.c:872
> 
> under a 2.6.18-8.el5 kernel. Traced it to a garbage-in/garbage-out  
> ioctl condition in the aacraid driver.
> 
> Adaptec's special ioctl scb passthrough needs to check the validity of  
> the individual scatter gather count fields to the maximum the adapter  
> supports. Doing so will have the side effect of preventing  
> copy_from_user() from bugging out while populating the dma buffers.  
> This is a hardening effort, issue was triggered by an errant version  
> of the management tools and thus the BUG should not be seen in the  
> field.
> 
> This attached patch is against current scsi-misc-2.6.

But not actually compiled I see:

  CC [M]  drivers/scsi/aacraid/commctrl.o
drivers/scsi/aacraid/commctrl.c: In function 'aac_send_raw_srb':
drivers/scsi/aacraid/commctrl.c:587: error: dereferencing pointer to incomplete type
drivers/scsi/aacraid/commctrl.c:639: error: dereferencing pointer to incomplete type
drivers/scsi/aacraid/commctrl.c:689: error: dereferencing pointer to incomplete type
drivers/scsi/aacraid/commctrl.c:728: error: dereferencing pointer to incomplete type

I fixed it using the patch below.

James

---

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index ea96ddb..a735526 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -41,6 +41,7 @@
 #include <linux/kthread.h>
 #include <linux/semaphore.h>
 #include <asm/uaccess.h>
+#include <scsi/scsi_host.h>
 
 #include "aacraid.h"
 



      reply	other threads:[~2008-06-05 15:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-19  1:55 aacraid broken in git Yinghai Lu
2008-04-19 12:33 ` Mark Salyzyn
2008-04-19 20:56   ` Yinghai Lu
2008-04-22  0:42   ` Yinghai Lu
2008-04-23 12:16     ` [PATCH] aacraid: Fix down_interruptible() to check the return value take 2 (was: aacraid broken in git) Mark Salyzyn
2008-04-23 21:47       ` Yinghai Lu
2008-04-30 19:28       ` [PATCH] aacraid: Fix warning about macro side-effects Mark Salyzyn
2008-04-30 19:47         ` [PATCH] aacraid: Fix jbod operations scan issues Mark Salyzyn
2008-04-30 20:03           ` [PATCH] aacraid: Add Power Management support Mark Salyzyn
2008-05-07 19:24             ` [PATCH] aacraid: Add Power Management cards to documentation Mark Salyzyn
2008-05-28 19:32               ` [PATCH] aacraid: prevent copy_from_user() BUG! Mark Salyzyn
2008-06-05 15:35                 ` 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=1212680127.13549.38.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=Mark_Salyzyn@adaptec.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