stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "scsi: sg: check length passed to SG_NEXT_CMD_LEN" has been added to the 4.9-stable tree
@ 2017-04-03 12:42 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-04-03 12:42 UTC (permalink / raw)
  To: dpf, dgilbert, gregkh, martin.petersen; +Cc: stable, stable-commits


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

    scsi: sg: check length passed to SG_NEXT_CMD_LEN

to the 4.9-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:
     scsi-sg-check-length-passed-to-sg_next_cmd_len.patch
and it can be found in the queue-4.9 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 bf33f87dd04c371ea33feb821b60d63d754e3124 Mon Sep 17 00:00:00 2001
From: peter chang <dpf@google.com>
Date: Wed, 15 Feb 2017 14:11:54 -0800
Subject: scsi: sg: check length passed to SG_NEXT_CMD_LEN

From: peter chang <dpf@google.com>

commit bf33f87dd04c371ea33feb821b60d63d754e3124 upstream.

The user can control the size of the next command passed along, but the
value passed to the ioctl isn't checked against the usable max command
size.

Signed-off-by: Peter Chang <dpf@google.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/sg.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -998,6 +998,8 @@ sg_ioctl(struct file *filp, unsigned int
 		result = get_user(val, ip);
 		if (result)
 			return result;
+		if (val > SG_MAX_CDB_SIZE)
+			return -ENOMEM;
 		sfp->next_cmd_len = (val > 0) ? val : 0;
 		return 0;
 	case SG_GET_VERSION_NUM:


Patches currently in stable-queue which might be from dpf@google.com are

queue-4.9/scsi-sg-check-length-passed-to-sg_next_cmd_len.patch

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

only message in thread, other threads:[~2017-04-03 12:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-03 12:42 Patch "scsi: sg: check length passed to SG_NEXT_CMD_LEN" has been added to the 4.9-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).