diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-07 17:48:15 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-25 02:21:42 +0100 |
commit | 403dff4e2c94f275e24fd85f40b2732ffec268a1 (patch) | |
tree | 0fca85c289bfb39fa05f085b5a9655684ee57e19 /drivers/usb/class | |
parent | cdc-acm: memory leak in error case (diff) | |
download | linux-403dff4e2c94f275e24fd85f40b2732ffec268a1.tar.xz linux-403dff4e2c94f275e24fd85f40b2732ffec268a1.zip |
USB: cdc-acm: check for valid interfaces
We need to check that we have both a valid data and control inteface for both
types of headers (union and not union.)
References: https://bugzilla.kernel.org/show_bug.cgi?id=83551
Reported-by: Simon Schubert <2+kernel@0x2c.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/class')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 6c6a5c4cc68c..546a17e8ad5b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1195,10 +1195,11 @@ next_desc: } else { control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); - if (!control_interface || !data_interface) { - dev_dbg(&intf->dev, "no interfaces\n"); - return -ENODEV; - } + } + + if (!control_interface || !data_interface) { + dev_dbg(&intf->dev, "no interfaces\n"); + return -ENODEV; } if (data_interface_num != call_interface_num) |