Skip to contentSkip to conversation

Patch "usb: gadgetfs: restrict upper bound on device configuration size" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Jan 9, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: gadgetfs: restrict upper bound on device configuration size

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usb-gadgetfs-restrict-upper-bound-on-device-configuration-size.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 0994b0a257557e18ee8f0b7c5f0f73fe2b54eec1 Mon Sep 17 00:00:00 2001

From: Greg Kroah-Hartman <[email protected]>
Date: Tue, 6 Dec 2016 08:36:29 +0100
Subject: usb: gadgetfs: restrict upper bound on device configuration size

From: Greg Kroah-Hartman <[email protected]>

commit 0994b0a257557e18ee8f0b7c5f0f73fe2b54eec1 upstream.

Andrey Konovalov reported that we were not properly checking the upper limit before of a device configuration size before calling memdup_user(), which could cause some problems.

So set the upper limit to PAGE_SIZE * 4, which should be good enough for all devices.

---
 drivers/usb/gadget/legacy/inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/inode.c +2 -1
@@ -1783,7 +1783,8 @@ dev_config (struct file *fd, const char
 	}
 	spin_unlock_irq(&dev->lock);
 
-	if (len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4))
+	if ((len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) ||
+	    (len > PAGE_SIZE * 4))
 		return -EINVAL;
 
 	/* we might need to change message format someday */

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/kvm-mips-flush-kvm-entry-code-from-icache-globally.patch queue-4.4/usb-dummy-hcd-fix-bug-in-stop_activity-handle-ep0.patch queue-4.4/usb-dwc3-core-avoid-overflow-events.patch queue-4.4/usb-gadgetfs-fix-use-after-free-bug.patch queue-4.4/alsa-hda-fix-up-gpio-for-asus-rog-ranger.patch queue-4.4/usb-musb-dsps-implement-clear_ep_rxintr-callback.patch queue-4.4/alsa-hda-apply-asus-mode8-fixup-to-asus-x71sl.patch queue-4.4/usb-gadget-composite-test-get_alt-presence-instead-of-set_alt.patch queue-4.4/usb-xhci-fix-possible-wild-pointer.patch queue-4.4/usb-gadgetfs-restrict-upper-bound-on-device-configuration-size.patch queue-4.4/usb-gadgetfs-fix-checks-of-wtotallength-in-config-descriptors.patch queue-4.4/mac80211-initialize-fast-xmit-info-later.patch queue-4.4/arm-davinci-da850-don-t-add-emac-clock-to-lookup-table-twice.patch queue-4.4/usb-musb-core-add-clear_ep_rxintr-to-musb_platform_ops.patch queue-4.4/kvm-x86-reset-mmu-on-kvm_set_vcpu_events.patch queue-4.4/usb-fix-problems-with-duplicate-endpoint-addresses.patch queue-4.4/usb-storage-unusual_uas-add-jmicron-jms56x-to-unusual-device.patch queue-4.4/alsa-usb-audio-fix-irq-process-data-synchronization.patch queue-4.4/usb-gadgetfs-fix-unbounded-memory-allocation-bug.patch