Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1602359

[PATCH 4.10 36/48] USB: iowarrior: fix NULL-deref at probe

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.10 36/48] USB: iowarrior: fix NULL-deref at probe
Date 2017-03-16 15:40 +0100
Message-ID <tlEJl-84L-59@gated-at.bofh.it> (permalink)
References <tlEJj-84L-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.10-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) &&

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.10 00/48] 4.10.4-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 23/48] powerpc/booke: Fix boot crash due to null hugepd Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 21/48] i2c: add missing of_node_put in i2c_mux_del_adapters Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 17/48] tracing: Add #undef to fix compile error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 41/48] KVM: s390: Fix guest migration for huge guests resulting in panic Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 36/48] USB: iowarrior: fix NULL-deref at probe Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 39/48] USB: serial: io_ti: fix information leak in completion handler Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 30/48] usb: gadget: function: f_fs: pass companion descriptor along Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 19/48] efi/arm: Fix boot crash with CONFIG_CPUMASK_OFFSTACK=y Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 04/48] USB: serial: digi_acceleport: fix OOB-event processing Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 07/48] MIPS: VDSO: avoid duplicate CAC_BASE definition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 29/48] usb: ohci-at91: Do not drop unhandled USB suspend control requests Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 15/48] MIPS: ralink: Remove unused rt*_wdt_reset functions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 47/48] ext4: dont BUG when truncating encrypted inodes on the orphan list Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:40 +0100
  [PATCH 4.10 44/48] [media] serial_ir: ensure were ready to receive interrupts Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 28/48] usb: dwc3-omap: Fix missing break in dwc3_omap_set_mailbox() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 35/48] USB: serial: omninet: fix reference leaks at open Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 38/48] USB: serial: io_ti: fix NULL-deref in interrupt callback Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 08/48] MIPS: ip27: Disable qlge driver in defconfig Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 42/48] KVM: arm/arm64: Let vcpu thread modify its own active state Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 45/48] dm: flush queued bios when process blocks to avoid deadlock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 43/48] drm/i915/gvt: Fix superfluous newline in GVT_DISPLAY_READY env var Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 06/48] MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 25/48] PCI: Prevent VPD access for QLogic ISP2722 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 05/48] crypto: improve gcc optimization flags for serpent and wp512 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 48/48] IB/mlx5: Verify that Q counters are supported Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 26/48] usb: gadget: dummy_hcd: clear usb_gadget region before registration Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 32/48] usb: host: xhci-dbg: HCIVERSION should be a binary number Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 33/48] usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 09/48] MIPS: Update ip27_defconfig for SCSI_DH change Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 37/48] USB: iowarrior: fix NULL-deref in write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 15:50 +0100
  [PATCH 4.10 11/48] MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 16:00 +0100
  [PATCH 4.10 13/48] MIPS: ralink: Cosmetic change to prom_init(). Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 16:00 +0100
  [PATCH 4.10 02/48] ARM: qcom_defconfig: Enable RPM/RPM-SMD clocks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 16:00 +0100
  [PATCH 4.10 10/48] MIPS: ip22: Fix ip28 build for modern gcc Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 16:00 +0100
  [PATCH 4.10 14/48] MIPS: ralink: Remove unused timer functions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 16:00 +0100
  [PATCH 4.10 12/48] mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 16:00 +0100
  [PATCH 4.10 01/48] iio: 104-quad-8: Fix off-by-one error when addressing flag register Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-16 16:00 +0100
  Re: [PATCH 4.10 00/48] 4.10.4-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-03-16 20:40 +0100
    Re: [PATCH 4.10 00/48] 4.10.4-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-17 02:50 +0100
  Re: [PATCH 4.10 00/48] 4.10.4-stable review Guenter Roeck <linux@roeck-us.net> - 2017-03-16 23:40 +0100
    Re: [PATCH 4.10 00/48] 4.10.4-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-17 02:50 +0100

csiph-web