From: "Chen.Yu" <chyyuu@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: levex@linux.com, fanwlexca@gmail.com, mans@mansr.com,
"Chen.Yu" <chyyuu@gmail.com>
Subject: [PATCH] scsi: integer overflow in megadev_ioctl()
Date: Sat, 14 Dec 2013 08:51:53 +0800 [thread overview]
Message-ID: <1386982313-30054-1-git-send-email-chyyuu@gmail.com> (raw)
From: "Chen.Yu" <chyyuu@gmail.com>
There is a potential integer overflow in megadev_ioctl() if
userspace passes in a large u32 variable uioc.adapno.
The int variable adapno would < 0, leading to an error
array access for hdb_soft_state[adapno], or an error
copy_to_user(uioc.uioc_uaddr, mcontroller+adapno,..).
The simple fix is to the simpler fix is to change the type
of 'adapno' to u32, which is the type of uioc.adapno to u32.
Signed-off-by: Yu Chen <chyyuu@gmail.com>
---
drivers/scsi/megaraid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 816db12..724c5a5 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -3038,7 +3038,7 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{
adapter_t *adapter;
nitioctl_t uioc;
- int adapno;
+ u32 adapno;
int rval;
mega_passthru __user *upthru; /* user address for passthru */
mega_passthru *pthru; /* copy user passthru here */
--
1.8.3.2
next reply other threads:[~2013-12-14 0:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-14 0:51 Chen.Yu [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-12-13 18:41 Chen.Yu
2013-12-13 18:59 ` Måns Rullgård
2013-12-14 0:35 ` Yu Chen
2013-12-13 16:55 Yu Chen
2013-12-13 17:01 ` Levente Kurusa
2013-12-13 17:31 ` Yu Chen
2013-12-13 17:43 ` Levente Kurusa
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=1386982313-30054-1-git-send-email-chyyuu@gmail.com \
--to=chyyuu@gmail.com \
--cc=fanwlexca@gmail.com \
--cc=levex@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mans@mansr.com \
/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
Powered by JetHome