From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org,
"Alan Stern" <stern@rowland.harvard.edu>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Johan Hovold" <johan@kernel.org>
Subject: [PATCH 3.2 020/106] USB: hub: fix non-SS hub-descriptor handling
Date: Sat, 09 Sep 2017 22:47:39 +0100 [thread overview]
Message-ID: <lsq.1504993659.632051479@decadent.org.uk> (raw)
In-Reply-To: <lsq.1504993659.376385113@decadent.org.uk>
3.2.93-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit bec444cd1c94c48df409a35ad4e5b143c245c3f7 upstream.
Add missing sanity check on the non-SuperSpeed hub-descriptor length in
order to avoid parsing and leaking two bytes of uninitialised slab data
through sysfs removable-attributes (or a compound-device debug
statement).
Note that we only make sure that the DeviceRemovable field is always
present (and specifically ignore the unused PortPwrCtrlMask field) in
order to continue support any hubs with non-compliant descriptors. As a
further safeguard, the descriptor buffer is also cleared.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/usb/core/hub.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -177,7 +177,8 @@ static struct usb_hub *hdev_to_hub(struc
}
/* USB 2.0 spec Section 11.24.4.5 */
-static int get_hub_descriptor(struct usb_device *hdev, void *data)
+static int get_hub_descriptor(struct usb_device *hdev,
+ struct usb_hub_descriptor *desc)
{
int i, ret, size;
unsigned dtype;
@@ -193,12 +194,16 @@ static int get_hub_descriptor(struct usb
for (i = 0; i < 3; i++) {
ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB,
- dtype << 8, 0, data, size,
+ dtype << 8, 0, desc, size,
USB_CTRL_GET_TIMEOUT);
if (hub_is_superspeed(hdev)) {
if (ret == size)
return ret;
- } else if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2)) {
+ } else if (ret >= USB_DT_HUB_NONVAR_SIZE + 2) {
+ /* Make sure we have the DeviceRemovable field. */
+ size = USB_DT_HUB_NONVAR_SIZE + desc->bNbrPorts / 8 + 1;
+ if (ret < size)
+ return -EMSGSIZE;
return ret;
}
}
@@ -1117,7 +1122,7 @@ static int hub_configure(struct usb_hub
}
mutex_init(&hub->status_mutex);
- hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL);
+ hub->descriptor = kzalloc(sizeof(*hub->descriptor), GFP_KERNEL);
if (!hub->descriptor) {
ret = -ENOMEM;
goto fail;
next prev parent reply other threads:[~2017-09-09 22:36 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-09 21:47 [PATCH 3.2 000/106] 3.2.93-rc1 review Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 079/106] KVM: async_pf: avoid async pf injection when in guest mode Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 053/106] net: phy: fix marvell phy status reading Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 073/106] KVM: cpuid: Fix read/write out-of-bounds vulnerability in cpuid emulation Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 032/106] drivers: char: mem: Check for address space wraparound with mmap() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 052/106] ext4: fix fdatasync(2) after extent manipulation operations Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 024/106] tracing/kprobes: Enforce kprobes teardown after testing Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 078/106] excessive checks in ufs_write_failed() and ufs_evict_inode() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 075/106] KEYS: fix dereferencing NULL payload with nonzero length Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 004/106] net: irda: irda-usb: fix firmware name on big-endian hosts Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 021/106] USB: hub: fix SS max number of ports Ben Hutchings
2017-09-09 21:47 ` Ben Hutchings [this message]
2017-09-09 21:47 ` [PATCH 3.2 055/106] ipv6: xfrm: Handle errors reported by xfrm6_find_1stfragopt() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 081/106] usb: xhci: ASMedia ASM1042A chipset need shorts TX quirk Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 028/106] usb: host: xhci-mem: allocate zeroed Scratchpad Buffer Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 019/106] USB: hub: fix SS hub-descriptor handling Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 022/106] mac80211: strictly check mesh address extension mode Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 011/106] USB: ene_usb6250: fix DMA to the stack Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 025/106] xhci: workaround for hosts missing CAS bit Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 006/106] USB: serial: ir-usb: fix big-endian baud-rate debug printk Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 049/106] scsi: qla2xxx: don't disable a not previously enabled PCI device Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 087/106] signal: Only reschedule timers on signals timers have sent Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 027/106] xhci: apply PME_STUCK_QUIRK and MISSING_CAS quirk for Denverton Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 033/106] watchdog: pcwd_usb: fix NULL-deref at probe Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 013/106] uwb: fix device quirk on big-endian hosts Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 042/106] ALSA: hda - apply STAC_9200_DELL_M22 quirk for Dell Latitude D430 Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 054/106] usb: gadget: f_mass_storage: Serialize wake and sleep execution Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 012/106] USB: core: replace %p with %pK Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 016/106] usb: r8a66597-hcd: select a different endpoint on timeout Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 015/106] usb: r8a66597-hcd: decrease timeout Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 017/106] USB: gadget: dummy_hcd: fix hub-descriptor removable fields Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 039/106] ext4: keep existing extra fields when inode expands Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 065/106] net: ethoc: enable NAPI before poll may be scheduled Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 068/106] perf script: Fix outdated comment for perf-trace-python Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 062/106] net: ping: do not abuse udp_poll() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 037/106] KVM: x86: zero base3 of unusable segments Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 044/106] libceph: NULL deref on crush_decode() error path Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 085/106] powerpc/kprobes: Pause function_graph tracing during jprobes handling Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 089/106] drm/radeon: add a quirk for Toshiba Satellite L20-183 Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 071/106] perf script python: Updated trace_unhandled() signature Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 035/106] KVM: X86: Fix read out-of-bounds vulnerability in kvm pio emulation Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 076/106] fix ufs_isblockset() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 003/106] tcp: avoid fragmenting peculiar skbs in SACK Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 007/106] USB: serial: mct_u232: fix big-endian baud-rate handling Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 091/106] ipv6: avoid unregistering inet6_dev for loopback Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 043/106] block: fix an error code in add_partition() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 064/106] [media] vb2: Fix an off by one error in 'vb2_plane_vaddr' Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 063/106] [media] vb2: fix plane index sanity check in vb2_plane_cookie() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 029/106] usb: host: xhci: simplify irq handler return Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 058/106] alarmtimer: Rate limit periodic intervals Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 088/106] Input: i8042 - add Fujitsu Lifebook AH544 to notimeout list Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 018/106] USB: usbip: fix nonconforming hub descriptor Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 083/106] xfrm: Oops on error in pfkey_msg2xfrm_state() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 031/106] usb: musb: tusb6010_omap: Do not reset the other direction's packet size Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 051/106] ext4: fix data corruption for mmap writes Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 056/106] drivers: char: mem: Fix wraparound check to allow mappings up to the end Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 082/106] selinux: fix double free in selinux_parse_opts_str() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 005/106] USB: serial: ftdi_sio: fix setting latency for unprivileged users Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 026/106] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 009/106] ahci: Acer SA5-271 SSD Not Detected Fix Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 060/106] net: add kfree_skb_list() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 002/106] af_key: Fix slab-out-of-bounds in pfkey_compile_policy Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 077/106] ufs: set correct ->s_maxsize Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 050/106] net: ethernet: ax88796: don't call free_irq without request_irq first Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 036/106] KVM: x86: fix use of uninitialized memory as segment descriptor in emulator Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 046/106] dmaengine: ep93xx: Always start from BASE0 Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 072/106] perf script python: Remove dups in documentation examples Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 090/106] rtnetlink: add IFLA_GROUP to ifla_policy Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 067/106] perf probe: Fix examples section of documentation Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 069/106] perf script: Fix documentation errors Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 041/106] crypto: gcm - wait for crypto op not signal safe Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 008/106] USB: serial: io_ti: fix div-by-zero in set_termios Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 074/106] MIPS: kprobes: flush_insn_slot should flush only if probe initialised Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 010/106] tcp: eliminate negative reordering in tcp_clean_rtx_queue Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 084/106] xfrm: NULL dereference on allocation failure Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 057/106] alarmtimer: Prevent overflow of relative timers Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 047/106] netfilter: ctnetlink: fix incorrect nf_ct_put during hash resize Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 059/106] [media] rc-core: race condition during ir_raw_event_register() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 048/106] ASoC: Fix use-after-free at card unregistration Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 061/106] ipv6: Fix leak in ipv6_gso_segment() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 014/106] USB: iowarrior: fix info ioctl on big-endian hosts Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 045/106] drm/gma500/psb: Actually use VBT mode when it is found Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 034/106] powerpc/mm: Fix virt_addr_valid() etc. on 64-bit hash Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 080/106] configfs: Fix race between create_link and configfs_rmdir Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 040/106] i2c: i2c-tiny-usb: fix buffer not being DMA capable Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 066/106] drm/vmwgfx: Handle vmalloc() failure in vmw_local_fifo_reserve() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 030/106] USB: xhci: fix lock-inversion problem Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 001/106] xfrm: fix stack access out of bounds with CONFIG_XFRM_SUB_POLICY Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 070/106] perf script python: Fix wrong code snippets in documentation Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 023/106] of: fdt: add missing allocation-failure check Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 086/106] swap: cond_resched in swap_cgroup_prepare() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 038/106] osf_wait4(): fix infoleak Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 103/106] mm: fix NULL ptr dereference in migrate_pages Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 097/106] tracing/kprobes: Allow to create probe with a module name starting with a digit Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 096/106] MIPS: Fix IRQ tracing & lockdep when rescheduling Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 092/106] powerpc/64: Initialise thread_info for emergency stacks Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 104/106] mm: fix NULL ptr dereference in move_pages Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 102/106] mm: fix move/migrate_pages() race on task struct Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 095/106] net: prevent sign extension in dev_get_stats() Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 099/106] xfrm: policy: check policy direction value Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 101/106] ptrace: use fsuid, fsgid, effective creds for fs access checks Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 094/106] lib/cmdline.c: fix get_options() overflow while parsing ranges Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 093/106] autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 105/106] Sanitize 'move_pages()' permission checks Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 098/106] tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0 Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 100/106] xen: fix bio vec merging Ben Hutchings
2017-09-09 21:47 ` [PATCH 3.2 106/106] net: phy: marvell: Limit errata to 88m1101 Ben Hutchings
2017-09-10 14:31 ` [PATCH 3.2 000/106] 3.2.93-rc1 review Guenter Roeck
2017-09-10 18:46 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=lsq.1504993659.632051479@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome