All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Johan Hovold <johan@kernel.org>
Subject: [PATCH 4.9 34/44] USB: iowarrior: fix NULL-deref at probe
Date: Thu, 16 Mar 2017 23:29:59 +0900	[thread overview]
Message-ID: <20170316142927.360294177@linuxfoundation.org> (raw)
In-Reply-To: <20170316142925.994282609@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit b7321e81fc369abe353cf094d4f0dc2fe11ab95f upstream.

Make sure to check for the required interrupt-in endpoint to avoid
dereferencing a NULL-pointer should a malicious device lack such an
endpoint.

Note that a fairly recent change purported to fix this issue, but added
an insufficient test on the number of endpoints only, a test which can
now be removed.

Fixes: 4ec0ef3a8212 ("USB: iowarrior: fix oops with malicious USB descriptors")
Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/misc/iowarrior.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -781,12 +781,6 @@ static int iowarrior_probe(struct usb_in
 	iface_desc = interface->cur_altsetting;
 	dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
 
-	if (iface_desc->desc.bNumEndpoints < 1) {
-		dev_err(&interface->dev, "Invalid number of endpoints\n");
-		retval = -EINVAL;
-		goto error;
-	}
-
 	/* set up the endpoint information */
 	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
 		endpoint = &iface_desc->endpoint[i].desc;
@@ -797,6 +791,13 @@ static int iowarrior_probe(struct usb_in
 			/* this one will match for the IOWarrior56 only */
 			dev->int_out_endpoint = endpoint;
 	}
+
+	if (!dev->int_in_endpoint) {
+		dev_err(&interface->dev, "no interrupt-in endpoint found\n");
+		retval = -ENODEV;
+		goto error;
+	}
+
 	/* we have to check the report_size often, so remember it in the endianness suitable for our machine */
 	dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint);
 	if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&

  parent reply	other threads:[~2017-03-16 14:55 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 14:29 [PATCH 4.9 00/44] 4.9.16-stable review Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 01/44] USB: serial: digi_acceleport: fix OOB data sanity check Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 02/44] USB: serial: digi_acceleport: fix OOB-event processing Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 03/44] crypto: improve gcc optimization flags for serpent and wp512 Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 04/44] MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 05/44] MIPS: VDSO: avoid duplicate CAC_BASE definition Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 06/44] MIPS: ip27: Disable qlge driver in defconfig Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 07/44] MIPS: Update ip27_defconfig for SCSI_DH change Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 08/44] MIPS: ip22: Fix ip28 build for modern gcc Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 09/44] MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 10/44] mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 11/44] MIPS: ralink: Cosmetic change to prom_init() Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 12/44] MIPS: ralink: Remove unused timer functions Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 13/44] MIPS: ralink: Remove unused rt*_wdt_reset functions Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 14/44] bcm63xx_enet: avoid uninitialized variable warning Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 15/44] cpmac: remove hopeless #warning Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 16/44] tracing: Add #undef to fix compile error Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 17/44] ucount: Remove the atomicity from ucount->count Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 18/44] efi/arm: Fix boot crash with CONFIG_CPUMASK_OFFSTACK=y Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 19/44] [media] dw2102: dont do DMA on stack Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 20/44] i2c: add missing of_node_put in i2c_mux_del_adapters Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 21/44] powerpc: Emulation support for load/store instructions on LE Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 22/44] powerpc/xics: Work around limitations of OPAL XICS priority handling Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 23/44] PCI: Prevent VPD access for QLogic ISP2722 Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 24/44] usb: gadget: dummy_hcd: clear usb_gadget region before registration Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 25/44] usb: dwc3: gadget: make Set Endpoint Configuration macros safe Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 26/44] usb: dwc3-omap: Fix missing break in dwc3_omap_set_mailbox() Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 27/44] usb: ohci-at91: Do not drop unhandled USB suspend control requests Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 28/44] usb: gadget: function: f_fs: pass companion descriptor along Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 29/44] Revert "usb: gadget: uvc: Add missing call for additional setup data" Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 30/44] usb: host: xhci-dbg: HCIVERSION should be a binary number Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 31/44] usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 32/44] USB: serial: safe_serial: fix information leak in completion handler Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.9 33/44] USB: serial: omninet: fix reference leaks at open Greg Kroah-Hartman
2017-03-16 14:29 ` Greg Kroah-Hartman [this message]
2017-03-16 14:30 ` [PATCH 4.9 35/44] USB: iowarrior: fix NULL-deref in write Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 36/44] USB: serial: io_ti: fix NULL-deref in interrupt callback Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 37/44] USB: serial: io_ti: fix information leak in completion handler Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 39/44] KVM: s390: Fix guest migration for huge guests resulting in panic Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 40/44] KVM: arm/arm64: Let vcpu thread modify its own active state Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 41/44] dm: flush queued bios when process blocks to avoid deadlock Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 42/44] [media] rc: raw decoder for keymap protocol is not loaded on register Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 43/44] ext4: dont BUG when truncating encrypted inodes on the orphan list Greg Kroah-Hartman
2017-03-16 14:30 ` [PATCH 4.9 44/44] IB/mlx5: Verify that Q counters are supported Greg Kroah-Hartman
2017-03-16 19:20 ` [PATCH 4.9 00/44] 4.9.16-stable review Shuah Khan
2017-03-16 22:37 ` Guenter Roeck

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=20170316142927.360294177@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 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.