From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f65.google.com ([209.85.215.65]:36235 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756688AbdCHCJE (ORCPT ); Tue, 7 Mar 2017 21:09:04 -0500 Received: by mail-lf0-f65.google.com with SMTP id g70so1384925lfh.3 for ; Tue, 07 Mar 2017 18:08:43 -0800 (PST) From: Johan Hovold To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Josh Boyer , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 2/2] USB: iowarrior: fix NULL-deref in write Date: Tue, 7 Mar 2017 16:11:04 +0100 Message-Id: <20170307151104.13446-3-johan@kernel.org> In-Reply-To: <20170307151104.13446-1-johan@kernel.org> References: <20170307151104.13446-1-johan@kernel.org> Sender: stable-owner@vger.kernel.org List-ID: Make sure to verify that we have the required interrupt-out endpoint for IOWarrior56 devices to avoid dereferencing a NULL-pointer in write should a malicious device lack such an endpoint. Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.") Cc: stable # 2.6.21 Signed-off-by: Johan Hovold --- drivers/usb/misc/iowarrior.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 3ad058cbe6ca..37c63cb39714 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -798,6 +798,14 @@ static int iowarrior_probe(struct usb_interface *interface, goto error; } + if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) { + if (!dev->int_out_endpoint) { + dev_err(&interface->dev, "no interrupt-out 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) && -- 2.12.0