2004-06-09 23:10:40

by Robert T. Johnson

[permalink] [raw]
Subject: PATCH: 2.6.7-rc3 drivers/scsi/megaraid.c: user/kernel pointer bugs

Since arg is a user pointer, so are uioc_mimd and uiocp, and hence umc is
a user pointer. Thus reading umc->xferaddr requires dereferencing a user
pointer, which isn't safe. Let me know if you have any questions or I've
made an error.

Best,
Rob

--- linux-2.6.7-rc3-full/drivers/scsi/megaraid.c.orig Wed Jun 9 12:43:49 2004
+++ linux-2.6.7-rc3-full/drivers/scsi/megaraid.c Wed Jun 9 12:43:10 2004
@@ -3815,7 +3815,8 @@ mega_n_to_m(void *arg, megacmd_t *mc)

umc = MBOX_P(uiocp);

- upthru = (mega_passthru *)umc->xferaddr;
+ if (get_user(upthru, (mega_passthru **)&umc->xferaddr))
+ return (-EFAULT);

if( put_user(mc->status, (u8 *)&upthru->scsistatus) )
return (-EFAULT);
@@ -3831,7 +3832,8 @@ mega_n_to_m(void *arg, megacmd_t *mc)

umc = (megacmd_t *)uioc_mimd->mbox;

- upthru = (mega_passthru *)umc->xferaddr;
+ if (get_user(upthru, (mega_passthru **)&umc->xferaddr))
+ return (-EFAULT);

if( put_user(mc->status, (u8 *)&upthru->scsistatus) )
return (-EFAULT);




2004-06-10 01:52:19

by Al Viro

[permalink] [raw]
Subject: Re: PATCH: 2.6.7-rc3 drivers/scsi/megaraid.c: user/kernel pointer bugs

On Wed, Jun 09, 2004 at 04:10:32PM -0700, Robert T. Johnson wrote:
> Since arg is a user pointer, so are uioc_mimd and uiocp, and hence umc is
> a user pointer. Thus reading umc->xferaddr requires dereferencing a user
> pointer, which isn't safe. Let me know if you have any questions or I've
> made an error.

ACK.