stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "misc: mic/scif: fix wrap around tests" has been added to the 4.4-stable tree
@ 2016-05-02 18:41 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-05-02 18:41 UTC (permalink / raw)
  To: dan.carpenter, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    misc: mic/scif: fix wrap around tests

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     misc-mic-scif-fix-wrap-around-tests.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 7b64dbf849abdd7e769820e25120758f956a7f13 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 19 Oct 2015 14:19:01 +0300
Subject: misc: mic/scif: fix wrap around tests

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 7b64dbf849abdd7e769820e25120758f956a7f13 upstream.

Signed integer overflow is undefined.  Also I added a check for
"(offset < 0)" in scif_unregister() because that makes it match the
other conditions and because I didn't want to subtract a negative.

Fixes: ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/misc/mic/scif/scif_rma.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/misc/mic/scif/scif_rma.c
+++ b/drivers/misc/mic/scif/scif_rma.c
@@ -1511,7 +1511,7 @@ off_t scif_register_pinned_pages(scif_ep
 	if ((map_flags & SCIF_MAP_FIXED) &&
 	    ((ALIGN(offset, PAGE_SIZE) != offset) ||
 	    (offset < 0) ||
-	    (offset + (off_t)len < offset)))
+	    (len > LONG_MAX - offset)))
 		return -EINVAL;
 
 	might_sleep();
@@ -1614,7 +1614,7 @@ off_t scif_register(scif_epd_t epd, void
 	if ((map_flags & SCIF_MAP_FIXED) &&
 	    ((ALIGN(offset, PAGE_SIZE) != offset) ||
 	    (offset < 0) ||
-	    (offset + (off_t)len < offset)))
+	    (len > LONG_MAX - offset)))
 		return -EINVAL;
 
 	/* Unsupported protection requested */
@@ -1732,7 +1732,8 @@ scif_unregister(scif_epd_t epd, off_t of
 
 	/* Offset is not page aligned or offset+len wraps around */
 	if ((ALIGN(offset, PAGE_SIZE) != offset) ||
-	    (offset + (off_t)len < offset))
+	    (offset < 0) ||
+	    (len > LONG_MAX - offset))
 		return -EINVAL;
 
 	err = scif_verify_epd(ep);


Patches currently in stable-queue which might be from dan.carpenter@oracle.com are

queue-4.4/misc-mic-scif-fix-wrap-around-tests.patch
queue-4.4/drm-amdkfd-uninitialized-variable-in-dbgdev_wave_control_set_registers.patch
queue-4.4/rtc-ds1685-passing-bogus-values-to-irq_restore.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-02 18:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-02 18:41 Patch "misc: mic/scif: fix wrap around tests" has been added to the 4.4-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).