Commit graph

567755 commits

Author SHA1 Message Date
Todd Kjos
77e4e5b8af resolve merge conflicts of 1c5265be54 to android-4.4
Change-Id: Idd5f2956c09b193b2a6ba02410e90b52aa2284d7
2017-03-20 08:57:38 -07:00
Mikulas Patocka
83193f99f1 dm: flush queued bios when process blocks to avoid deadlock
am: cd8ad4d9eb

Change-Id: I3348df4146daa436541af94224776d3cbc6f45b2
2017-03-18 11:25:00 +00:00
Dan Williams
14671ac721 nfit, libnvdimm: fix interleave set cookie calculation
am: 66dd58f56e

Change-Id: If1b31bbd5fe6a404d167a6b207bef928b998fba0
2017-03-18 11:24:51 +00:00
Michael Holzheu
4a44b75d1e s390/kdump: Use "LINUX" ELF note name instead of "CORE"
am: a084aeef56

Change-Id: I0bc63ef6143c3bbe7e50c89ece98ab39a93d0082
2017-03-18 11:24:41 +00:00
Janosch Frank
d73e47204a KVM: s390: Fix guest migration for huge guests resulting in panic
am: b0e85701a7

Change-Id: I12bd03d14c3bf2c1e5d2c70e1765eba1d6d202b9
2017-03-18 11:24:32 +00:00
Luis de Bethencourt
03c7b939b1 mvsas: fix misleading indentation
am: 61fbad6a28

Change-Id: I5422457ab66bd8a08f22fae79351dc7133d4f225
2017-03-18 11:24:22 +00:00
Krzysztof Kozlowski
5aac664c0c serial: samsung: Continue to work if DMA request fails
am: 72ca0ab306

Change-Id: I6b2c536ac7ea2371badb4b8080d2806a001a44d1
2017-03-18 11:24:12 +00:00
Johan Hovold
5b6244690a USB: serial: io_ti: fix information leak in completion handler
am: 72bb2b96b8

Change-Id: Ie1079bef9c43dce4ccecb52acbee12b4dd044e3f
2017-03-18 11:24:04 +00:00
Johan Hovold
946f6288ff USB: serial: io_ti: fix NULL-deref in interrupt callback
am: e71c7bad68

Change-Id: I865b297bdb9d8c9eb69e7548ceef6e640f9061e6
2017-03-18 11:23:55 +00:00
Johan Hovold
f6753981f4 USB: iowarrior: fix NULL-deref in write
am: 6498086195

Change-Id: Ib6ec11fa0bef224af9368ee4aba48d8d4663da50
2017-03-18 11:23:45 +00:00
Johan Hovold
bf259081a4 USB: iowarrior: fix NULL-deref at probe
am: 179295c38d

Change-Id: If8771741f6228ec6af891a160d5af5f6789f5409
2017-03-18 11:23:37 +00:00
Johan Hovold
c98a41cdb8 USB: serial: omninet: fix reference leaks at open
am: 54f11a9662

Change-Id: If2605f1daf506ae915776138b6268d0769a39487
2017-03-18 11:23:27 +00:00
Johan Hovold
a94cfa2ac4 USB: serial: safe_serial: fix information leak in completion handler
am: 3cdc946387

Change-Id: I2a29b5d7a753bd94d320bda52427bd62ab042787
2017-03-18 11:23:18 +00:00
Guenter Roeck
33451f0582 usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers
am: cf09c7d60c

Change-Id: I5cab1e3af61dd148ff737ba1dc68935407342983
2017-03-18 11:23:09 +00:00
Peter Chen
7badd91967 usb: host: xhci-dbg: HCIVERSION should be a binary number
am: 40c5634ffe

Change-Id: I41ed67d92ce661cb607ae65e297856b34e6a05d5
2017-03-18 11:22:59 +00:00
Felipe Balbi
5bfd45cfa0 usb: gadget: function: f_fs: pass companion descriptor along
am: 4a1a3bb70f

Change-Id: I7b29e1d8050144b745f4885566e37d2bbca122a3
2017-03-18 11:22:49 +00:00
Felipe Balbi
49e48368a6 usb: dwc3: gadget: make Set Endpoint Configuration macros safe
am: 10af248565

Change-Id: I5c852ac4d0fbe9276986df1a57e93979ec8f6cf9
2017-03-18 11:22:39 +00:00
Peter Chen
2b7b5c5f36 usb: gadget: dummy_hcd: clear usb_gadget region before registration
am: f47b97f2cd

Change-Id: Ifad25d5604ef1bc2c10cc4c5414348c23f37beb0
2017-03-18 11:22:28 +00:00
Ravi Bangoria
699ec839c0 powerpc: Emulation support for load/store instructions on LE
am: 2ca39d1300

Change-Id: I4db441c5727a8caef2b50f3a385197a1076ab55d
2017-03-18 11:22:17 +00:00
Rik van Riel
752883928d tracing: Add #undef to fix compile error
am: 074893495b

Change-Id: I20f387e74bc1cdd5c4a11d55b65e443b85606c0b
2017-03-18 11:22:06 +00:00
James Hogan
de761c12a4 MIPS: Netlogic: Fix CP0_EBASE redefinition warnings
am: 1276510585

Change-Id: Ib7ca5ebf52d798a057a0d509226b59116da302e9
2017-03-18 11:21:55 +00:00
Ralf Baechle
507638623f MIPS: DEC: Avoid la pseudo-instruction in delay slots
am: 2e4aff2405

Change-Id: Ia06f405fc818fa7f147d9ae2ac32f74451d580fa
2017-03-18 11:21:45 +00:00
Arnd Bergmann
9d92396f8a mm: memcontrol: avoid unused function warning
am: 5fad174344

Change-Id: I6734d095131126260931a16a670c66ec58ba4896
2017-03-18 11:21:33 +00:00
Arnd Bergmann
5caa0a5ddd cpmac: remove hopeless #warning
am: 5e45d834f7

Change-Id: Icfecd82f0ed400d01e16c1719451ddbdc886c5ef
2017-03-18 11:21:22 +00:00
Arnd Bergmann
285819747b MIPS: ralink: Remove unused rt*_wdt_reset functions
am: 32883383f5

Change-Id: I1c172b4be8bd694e5781d5f248ed19f8f6bb16e4
2017-03-18 11:21:11 +00:00
John Crispin
82caf1be31 MIPS: ralink: Cosmetic change to prom_init().
am: 4b91e7a2a9

Change-Id: Icd9d99ba438913cca6698b67caba94acd5416f1d
2017-03-18 11:20:59 +00:00
Arnd Bergmann
8726395744 mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy
am: 3dc8f1e3a8

Change-Id: If4374a22df01b414e950e9621d7b0a0353b0dc3d
2017-03-18 11:20:47 +00:00
Arnd Bergmann
9e383c0ed9 MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change
am: d2a8d746ae

Change-Id: I2acfec230eda26006b4730a91067e86df5ad9c7e
2017-03-18 11:20:36 +00:00
Arnd Bergmann
07658ad370 MIPS: ip22: Fix ip28 build for modern gcc
am: c018595d83

Change-Id: Ibe3c6e3b5e809d24bd298007154b29936ebfdbdb
2017-03-18 11:20:25 +00:00
Arnd Bergmann
1e9d4597be MIPS: Update ip27_defconfig for SCSI_DH change
am: 7a6a965f35

Change-Id: Ibbda685b2c909cba88f0ec18af89dc23547b719f
2017-03-18 11:20:14 +00:00
Arnd Bergmann
d4a1ce0790 MIPS: ip27: Disable qlge driver in defconfig
am: 8ed0fdcc0c

Change-Id: Ie42b6a5c3da2ae00167f31199f5c6c16de680bc0
2017-03-18 11:20:05 +00:00
Arnd Bergmann
5d2e961aa3 MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change
am: adc48c710b

Change-Id: Ib9e9d4fb9330edb63756d893ca382a9e070a2edb
2017-03-18 11:19:53 +00:00
Arnd Bergmann
bf38bfd770 crypto: improve gcc optimization flags for serpent and wp512
am: e041ad0664

Change-Id: I8ef3c2a7ccc25e521ab9bd5cd21702c695107411
2017-03-18 11:19:44 +00:00
Johan Hovold
ee51e01a82 USB: serial: digi_acceleport: fix OOB-event processing
am: a8cb5c02a2

Change-Id: I542f42e517db3d00ff3a2b5735149af2bf989c55
2017-03-18 11:19:34 +00:00
Johan Hovold
64272b3c31 USB: serial: digi_acceleport: fix OOB data sanity check
am: 4d95645f3d

Change-Id: Iabb41fdc9064da31bd16e93ecc1ed5846fca8df5
2017-03-18 11:19:21 +00:00
Greg Kroah-Hartman
28ec98bc2e Linux 4.4.55 2017-03-18 19:10:23 +08:00
Mikulas Patocka
cd8ad4d9eb dm: flush queued bios when process blocks to avoid deadlock
commit d67a5f4b5947aba4bfe9a80a2b86079c215ca755 upstream.

Commit df2cb6daa4 ("block: Avoid deadlocks with bio allocation by
stacking drivers") created a workqueue for every bio set and code
in bio_alloc_bioset() that tries to resolve some low-memory deadlocks
by redirecting bios queued on current->bio_list to the workqueue if the
system is low on memory.  However other deadlocks (see below **) may
happen, without any low memory condition, because generic_make_request
is queuing bios to current->bio_list (rather than submitting them).

** the related dm-snapshot deadlock is detailed here:
https://www.redhat.com/archives/dm-devel/2016-July/msg00065.html

Fix this deadlock by redirecting any bios on current->bio_list to the
bio_set's rescue workqueue on every schedule() call.  Consequently,
when the process blocks on a mutex, the bios queued on
current->bio_list are dispatched to independent workqueus and they can
complete without waiting for the mutex to be available.

The structure blk_plug contains an entry cb_list and this list can contain
arbitrary callback functions that are called when the process blocks.
To implement this fix DM (ab)uses the onstack plug's cb_list interface
to get its flush_current_bio_list() called at schedule() time.

This fixes the snapshot deadlock - if the map method blocks,
flush_current_bio_list() will be called and it redirects bios waiting
on current->bio_list to appropriate workqueues.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1267650
Depends-on: df2cb6daa4 ("block: Avoid deadlocks with bio allocation by stacking drivers")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Dan Williams
66dd58f56e nfit, libnvdimm: fix interleave set cookie calculation
commit 86ef58a4e35e8fa66afb5898cf6dec6a3bb29f67 upstream.

The interleave-set cookie is a sum that sanity checks the composition of
an interleave set has not changed from when the namespace was initially
created.  The checksum is calculated by sorting the DIMMs by their
location in the interleave-set. The comparison for the sort must be
64-bit wide, not byte-by-byte as performed by memcmp() in the broken
case.

Fix the implementation to accept correct cookie values in addition to
the Linux "memcmp" order cookies, but only allow correct cookies to be
generated going forward. It does mean that namespaces created by
third-party-tooling, or created by newer kernels with this fix, will not
validate on older kernels. However, there are a couple mitigating
conditions:

    1/ platforms with namespace-label capable NVDIMMs are not widely
       available.

    2/ interleave-sets with a single-dimm are by definition not affected
       (nothing to sort). This covers the QEMU-KVM NVDIMM emulation case.

The cookie stored in the namespace label will be fixed by any write the
namespace label, the most straightforward way to achieve this is to
write to the "alt_name" attribute of a namespace in sysfs.

Fixes: eaf961536e ("libnvdimm, nfit: add interleave-set state-tracking infrastructure")
Reported-by: Nicholas Moulin <nicholas.w.moulin@linux.intel.com>
Tested-by: Nicholas Moulin <nicholas.w.moulin@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Michael Holzheu
a084aeef56 s390/kdump: Use "LINUX" ELF note name instead of "CORE"
commit a4a81d8eebdc1d209d034f62a082a5131e4242b5 upstream.

In binutils/libbfd (bfd/elf.c) it is enforced that all s390 specific ELF
notes like e.g. NT_S390_PREFIX or NT_S390_CTRS have "LINUX" specified
as note name. Otherwise the notes are ignored.

For /proc/vmcore we currently use "CORE" for these notes.

Up to now this has not been a real problem because the dump analysis tool
"crash" does not check the note name. But it will break all programs that
use libbfd for processing ELF notes.

So fix this and use "LINUX" for all s390 specific notes to comply with
libbfd.

Reported-by: Philipp Rudo <prudo@linux.vnet.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Janosch Frank
b0e85701a7 KVM: s390: Fix guest migration for huge guests resulting in panic
commit 2e4d88009f57057df7672fa69a32b5224af54d37 upstream.

While we can technically not run huge page guests right now, we can
setup a guest with huge pages. Trying to migrate it will trigger a
VM_BUG_ON and, if the kernel is not configured to panic on a BUG, it
will happily try to work on non-existing page table entries.

With this patch, we always return "dirty" if we encounter a large page
when migrating. This at least fixes the immediate problem until we
have proper handling for both kind of pages.

Fixes: 15f36eb ("KVM: s390: Add proper dirty bitmap support to S390 kvm.")
Cc: <stable@vger.kernel.org> # 3.16+

Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Luis de Bethencourt
61fbad6a28 mvsas: fix misleading indentation
commit 7789cd39274c51bf475411fe22a8ee7255082809 upstream.

Fix a smatch warning:
drivers/scsi/mvsas/mv_sas.c:740 mvs_task_prep() warn: curly braces intended?

The code is correct, the indention is misleading. When the device is not
ready we want to return SAS_PHY_DOWN. But current indentation makes it
look like we only do so in the else branch of if (mvi_dev).

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Krzysztof Kozlowski
72ca0ab306 serial: samsung: Continue to work if DMA request fails
commit f98c7bce570bdbe344b74ff5daa7dfeef3f22929 upstream.

If DMA is not available (even when configured in DeviceTree), the driver
will fail the startup procedure thus making serial console not
available.

For example this causes boot failure on QEMU ARMv7 (Exynos4210, SMDKC210):
    [    1.302575] OF: amba_device_add() failed (-19) for /amba/pdma@12680000
    ...
    [   11.435732] samsung-uart 13800000.serial: DMA request failed
    [   72.963893] samsung-uart 13800000.serial: DMA request failed
    [   73.143361] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000

DMA is not necessary for serial to work, so continue with UART startup
after emitting a warning.

Fixes: 62c37eedb7 ("serial: samsung: add dma reqest/release functions")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Johan Hovold
72bb2b96b8 USB: serial: io_ti: fix information leak in completion handler
commit 654b404f2a222f918af9b0cd18ad469d0c941a8e upstream.

Add missing sanity check to the bulk-in completion handler to avoid an
integer underflow that can be triggered by a malicious device.

This avoids leaking 128 kB of memory content from after the URB transfer
buffer to user space.

Fixes: 8c209e6782 ("USB: make actual_length in struct urb field u32")
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Johan Hovold
e71c7bad68 USB: serial: io_ti: fix NULL-deref in interrupt callback
commit 0b1d250afb8eb9d65afb568bac9b9f9253a82b49 upstream.

Fix a NULL-pointer dereference in the interrupt callback should a
malicious device send data containing a bad port number by adding the
missing sanity check.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Johan Hovold
6498086195 USB: iowarrior: fix NULL-deref in write
commit de46e56653de7b3b54baa625bd582635008b8d05 upstream.

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: 946b960d13 ("USB: add driver for iowarrior devices.")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Johan Hovold
179295c38d USB: iowarrior: fix NULL-deref at probe
commit b7321e81fc369abe353cf094d4f0dc2fe11ab95f upstream.

Make sure to check for the required interrupt-in endpoint to avoid
dereferencing a NULL-pointer should a malicious device lack such an
endpoint.

Note that a fairly recent change purported to fix this issue, but added
an insufficient test on the number of endpoints only, a test which can
now be removed.

Fixes: 4ec0ef3a8212 ("USB: iowarrior: fix oops with malicious USB descriptors")
Fixes: 946b960d13 ("USB: add driver for iowarrior devices.")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Johan Hovold
54f11a9662 USB: serial: omninet: fix reference leaks at open
commit 30572418b445d85fcfe6c8fe84c947d2606767d8 upstream.

This driver needlessly took another reference to the tty on open, a
reference which was then never released on close. This lead to not just
a leak of the tty, but also a driver reference leak that prevented the
driver from being unloaded after a port had once been opened.

Fixes: 4a90f09b20 ("tty: usb-serial krefs")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Theodore Ts'o
1c5265be54 ext4: don't BUG when truncating encrypted inodes on the orphan list
commit 0d06863f903ac5f4f6efb0273079d27de3e53a28 upstream.

Fix a BUG when the kernel tries to mount a file system constructed as
follows:

echo foo > foo.txt
mke2fs -Fq -t ext4 -O encrypt foo.img 100
debugfs -w foo.img << EOF
write foo.txt a
set_inode_field a i_flags 0x80800
set_super_value s_last_orphan 12
quit
EOF

root@kvm-xfstests:~# mount -o loop foo.img /mnt
[  160.238770] ------------[ cut here ]------------
[  160.240106] kernel BUG at /usr/projects/linux/ext4/fs/ext4/inode.c:3874!
[  160.240106] invalid opcode: 0000 [#1] SMP
[  160.240106] Modules linked in:
[  160.240106] CPU: 0 PID: 2547 Comm: mount Tainted: G        W       4.10.0-rc3-00034-gcdd33b941b67 #227
[  160.240106] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.1-1 04/01/2014
[  160.240106] task: f4518000 task.stack: f47b6000
[  160.240106] EIP: ext4_block_zero_page_range+0x1a7/0x2b4
[  160.240106] EFLAGS: 00010246 CPU: 0
[  160.240106] EAX: 00000001 EBX: f7be4b50 ECX: f47b7dc0 EDX: 00000007
[  160.240106] ESI: f43b05a8 EDI: f43babec EBP: f47b7dd0 ESP: f47b7dac
[  160.240106]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  160.240106] CR0: 80050033 CR2: bfd85b08 CR3: 34a00680 CR4: 000006f0
[  160.240106] Call Trace:
[  160.240106]  ext4_truncate+0x1e9/0x3e5
[  160.240106]  ext4_fill_super+0x286f/0x2b1e
[  160.240106]  ? set_blocksize+0x2e/0x7e
[  160.240106]  mount_bdev+0x114/0x15f
[  160.240106]  ext4_mount+0x15/0x17
[  160.240106]  ? ext4_calculate_overhead+0x39d/0x39d
[  160.240106]  mount_fs+0x58/0x115
[  160.240106]  vfs_kern_mount+0x4b/0xae
[  160.240106]  do_mount+0x671/0x8c3
[  160.240106]  ? _copy_from_user+0x70/0x83
[  160.240106]  ? strndup_user+0x31/0x46
[  160.240106]  SyS_mount+0x57/0x7b
[  160.240106]  do_int80_syscall_32+0x4f/0x61
[  160.240106]  entry_INT80_32+0x2f/0x2f
[  160.240106] EIP: 0xb76b919e
[  160.240106] EFLAGS: 00000246 CPU: 0
[  160.240106] EAX: ffffffda EBX: 08053838 ECX: 08052188 EDX: 080537e8
[  160.240106] ESI: c0ed0000 EDI: 00000000 EBP: 080537e8 ESP: bfa13660
[  160.240106]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
[  160.240106] Code: 59 8b 00 a8 01 0f 84 09 01 00 00 8b 07 66 25 00 f0 66 3d 00 80 75 61 89 f8 e8 3e e2 ff ff 84 c0 74 56 83 bf 48 02 00 00 00 75 02 <0f> 0b 81 7d e8 00 10 00 00 74 02 0f 0b 8b 43 04 8b 53 08 31 c9
[  160.240106] EIP: ext4_block_zero_page_range+0x1a7/0x2b4 SS:ESP: 0068:f47b7dac
[  160.317241] ---[ end trace d6a773a375c810a5 ]---

The problem is that when the kernel tries to truncate an inode in
ext4_truncate(), it tries to clear any on-disk data beyond i_size.
Without the encryption key, it can't do that, and so it triggers a
BUG.

E2fsck does *not* provide this service, and in practice most file
systems have their orphan list processed by e2fsck, so to avoid
crashing, this patch skips this step if we don't have access to the
encryption key (which is the case when processing the orphan list; in
all other cases, we will have the encryption key, or the kernel
wouldn't have allowed the file to be opened).

An open question is whether the fact that e2fsck isn't clearing the
bytes beyond i_size causing problems --- and if we've lived with it
not doing it for so long, can we drop this from the kernel replay of
the orphan list in all cases (not just when we don't have the key for
encrypted inodes).

Addresses-Google-Bug: #35209576

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:58 +08:00
Johan Hovold
3cdc946387 USB: serial: safe_serial: fix information leak in completion handler
commit 8c76d7cd520ebffc1ea9ea0850d87a224a50c7f2 upstream.

Add missing sanity check to the bulk-in completion handler to avoid an
integer underflow that could be triggered by a malicious device.

This avoids leaking up to 56 bytes from after the URB transfer buffer to
user space.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:57 +08:00
Guenter Roeck
cf09c7d60c usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers
commit dcc7620cad5ad1326a78f4031a7bf4f0e5b42984 upstream.

Upstream commit 98d74f9ceaef ("xhci: fix 10 second timeout on removal of
PCI hotpluggable xhci controllers") fixes a problem with hot pluggable PCI
xhci controllers which can result in excessive timeouts, to the point where
the system reports a deadlock.

The same problem is seen with hot pluggable xhci controllers using the
xhci-plat driver, such as the driver used for Type-C ports on rk3399.
Similar to hot-pluggable PCI controllers, the driver for this chip
removes the xhci controller from the system when the Type-C cable is
disconnected.

The solution for PCI devices works just as well for non-PCI devices
and avoids the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-18 19:09:57 +08:00