* [PATCH 1/1] aacraid: prevent ZERO_SIZE_PTR dereference
@ 2013-10-31 8:31 Mahesh Rajashekhara
2013-10-31 9:44 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Mahesh Rajashekhara @ 2013-10-31 8:31 UTC (permalink / raw)
To: JBottomley, linux-scsi, dan.carpenter, torvalds
Cc: aacraid, aacraid, Achim.Leubner, Tony.Ruiz, Mahesh.Rajashekhara
It appears that driver runs into a problem here if fibsize is too small because we allocate user_srbcmd with fibsize size only but later we access it until user_srbcmd->sg.count to copy it over to srbcmd. Seems to be not correct to test (fibsize < sizeof(*user_srbcmd)) because this structure already includes one sg element and this is not needed for commands without data. So, we would recommend to add the following (instead of test for fibsize == 0).
Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
---
drivers/scsi/aacraid/commctrl.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index d85ac1a..fbcd48d 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -511,7 +511,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
goto cleanup;
}
- if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr))) {
+ if ((fibsize < (sizeof(struct user_aac_srb) - sizeof(struct user_sgentry))) ||
+ (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)))) {
rcode = -EINVAL;
goto cleanup;
}
--
1.7.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] aacraid: prevent ZERO_SIZE_PTR dereference
2013-10-31 8:31 [PATCH 1/1] aacraid: prevent ZERO_SIZE_PTR dereference Mahesh Rajashekhara
@ 2013-10-31 9:44 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2013-10-31 9:44 UTC (permalink / raw)
To: Mahesh Rajashekhara
Cc: JBottomley, linux-scsi, torvalds, aacraid, aacraid,
Achim.Leubner, Tony.Ruiz
On Thu, Oct 31, 2013 at 02:01:02PM +0530, Mahesh Rajashekhara wrote:
> It appears that driver runs into a problem here if fibsize is too small because we allocate user_srbcmd with fibsize size only but later we access it until user_srbcmd->sg.count to copy it over to srbcmd. Seems to be not correct to test (fibsize < sizeof(*user_srbcmd)) because this structure already includes one sg element and this is not needed for commands without data. So, we would recommend to add the following (instead of test for fibsize == 0).
>
Don't forget the reported by tags.
Reported-by: Nico Golde <nico@ngolde.de>
Reported-by: Fabian Yamaguchi <fabs@goesec.de>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-31 9:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-31 8:31 [PATCH 1/1] aacraid: prevent ZERO_SIZE_PTR dereference Mahesh Rajashekhara
2013-10-31 9:44 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.