]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.110/revert-usb-core-only-clean-up-what-we-allocated.patch
Linux 4.14.110
[thirdparty/kernel/stable-queue.git] / releases / 4.14.110 / revert-usb-core-only-clean-up-what-we-allocated.patch
1 From cf4df407e0d7cde60a45369c2a3414d18e2d4fdd Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Wed, 13 Dec 2017 11:59:39 +0100
4 Subject: Revert "USB: core: only clean up what we allocated"
5
6 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7
8 commit cf4df407e0d7cde60a45369c2a3414d18e2d4fdd upstream.
9
10 This reverts commit 32fd87b3bbf5f7a045546401dfe2894dbbf4d8c3.
11
12 Alan wrote a better fix for this...
13
14 Cc: Andrey Konovalov <andreyknvl@google.com>
15 Cc: stable <stable@vger.kernel.org>
16 Cc: Nathan Chancellor <natechancellor@gmail.com>
17 Cc: Arnd Bergmann <arnd@arndb.de>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 drivers/usb/core/config.c | 9 +++------
22 1 file changed, 3 insertions(+), 6 deletions(-)
23
24 --- a/drivers/usb/core/config.c
25 +++ b/drivers/usb/core/config.c
26 @@ -768,21 +768,18 @@ void usb_destroy_configuration(struct us
27 return;
28
29 if (dev->rawdescriptors) {
30 - for (i = 0; i < dev->descriptor.bNumConfigurations &&
31 - i < USB_MAXCONFIG; i++)
32 + for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
33 kfree(dev->rawdescriptors[i]);
34
35 kfree(dev->rawdescriptors);
36 dev->rawdescriptors = NULL;
37 }
38
39 - for (c = 0; c < dev->descriptor.bNumConfigurations &&
40 - c < USB_MAXCONFIG; c++) {
41 + for (c = 0; c < dev->descriptor.bNumConfigurations; c++) {
42 struct usb_host_config *cf = &dev->config[c];
43
44 kfree(cf->string);
45 - for (i = 0; i < cf->desc.bNumInterfaces &&
46 - i < USB_MAXINTERFACES; i++) {
47 + for (i = 0; i < cf->desc.bNumInterfaces; i++) {
48 if (cf->intf_cache[i])
49 kref_put(&cf->intf_cache[i]->ref,
50 usb_release_interface_cache);