Skip to contentSkip to conversation

+ drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Nov 21, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Subject: + drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 21 Nov 2013 15:58:12 -0800

The patch titled
Subject: drivers/scsi/megaraid/megaraid_mm.c: missing bounds check in mimd_to_kioc()
has been added to the -mm tree. Its filename is
drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Dan Carpenter <[email protected]>
Subject: drivers/scsi/megaraid/megaraid_mm.c: missing bounds check in mimd_to_kioc()

pthru32->dataxferlen comes from the user so we need to check that it's not too large so we don't overflow the buffer.

---

 drivers/scsi/megaraid/megaraid_mm.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/megaraid/megaraid_mm.c renamed from drivers/scsi/megaraid/megaraid_mm.c~drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc +2 -0
diff -puN drivers/scsi/megaraid/megaraid_mm.c~drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc drivers/scsi/megaraid/megaraid_mm.c
@@ -486,6 +486,8 @@ mimd_to_kioc(mimd_t __user *umimd, mraid
 
 	pthru32->dataxferaddr	= kioc->buf_paddr;
 	if (kioc->data_dir & UIOC_WR) {
+		if (pthru32->dataxferlen > kioc->xferlen)
+			return -EINVAL;
 		if (copy_from_user(kioc->buf_vaddr, kioc->user_data,
 						pthru32->dataxferlen)) {
 			return (-EFAULT);

_

Patches currently in -mm which might be from [email protected] are

origin.patch framework-for-version-lvb-remove-some-impossible-checks.patch drivers-scsi-megaraid-megaraid_mmc-missing-bounds-check-in-mimd_to_kioc.patch drivers-block-paride-pgc-underflow-bug-in-pg_write.patch xfs-underflow-bug-in-xfs_attrlist_by_handle.patch linux-next.patch