RE: 2.4.23: possible user/kernel pointer bug in commctrl.c

"Salyzyn, Mark" <[email protected]> Tue, 13 Jan 2004 16:22:06 -0500
Newsgroups gmane.linux.drivers.aacraid.devel
Message-ID <[email protected]>
aac_send_raw_srb is called by management software, the dependency on bounds
checking is left with the (proprietary) application software. The only
management software that utilizes this ioctl command, I believe, is used to
flash new firmware on to the drives.

The 64 bit handling *is* flawed, and that code is only triggered (in
Adaptec's code base) when there is in fact more than 4GB of memory in the
system, the card is 64 bit capable *and* the kernel has been configured for
more than 4GB of access. I will fix this problem, but it will not affect the
general stability of the driver.

Thanks for pointing out the error of our ways.

Sincerely -- Mark Salyzyn

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Robert T. Johnson
Sent: Tuesday, January 13, 2004 3:50 PM
To: [email protected]
Subject: 2.4.23: possible user/kernel pointer bug in commctrl.c

This code looks very suspicious to me, but I thought I'd get a second
opionion:

In drivers/scsi/aacraid/commctrl.c:aac_send_raw_srb()

line 422:  fibsize is copied from userspace
line 428:  fibsize bytes are copied from userspace

No bounds-checking is done.  CAP_SYS_ADMIN is checked above but this
still looks bad.

Later in the same function:

line 462:  struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg;
line 494:  copy_from_user(p,psg->sg[i].addr,psg->sg[i].count)

Since psg is an sgmap64 (not a regular sgmap), psg->sg[i].addr is an
array of two elements (to hold the upper and lower halves of the
address).  So it looks like this code is just copying the address itself
(and random bytes that follow), not the data pointed to by the address. 
Is this really what was intended?  As it is, it looks like it won't work
at all.

Are these real bugs, or am I just confused?  Thanks for any help.

Best,
Rob


_______________________________________________
Linux-aacraid-devel mailing list
[email protected]
http://lists.us.dell.com/mailman/listinfo/linux-aacraid-devel
Please read the FAQ at http://lists.us.dell.com/faq or search the list
archives at http://lists.us.dell.com/htdig/

_______________________________________________
Linux-aacraid-devel mailing list
[email protected]
http://lists.us.dell.com/mailman/listinfo/linux-aacraid-devel
Please read the FAQ at http://lists.us.dell.com/faq or search the list archives at http://lists.us.dell.com/htdig/