4.4.44-stable review
Greg Kroah-Hartman
maintainercover 4.4.44-stable review
This is the start of the stable review cycle for the 4.4.44 release. There are 48 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Jan 20 10:46:08 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.44-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.44-rc1
Niklas Söderlund <[email protected]>
pinctrl: sh-pfc: Do not unconditionally support PIN_CONFIG_BIAS_DISABLE
Johan Hovold <[email protected]>
powerpc/ibmebus: Fix device reference leaks in sysfs interface
Johan Hovold <[email protected]>
powerpc/ibmebus: Fix further device reference leaks
Johan Hovold <[email protected]>
bus: vexpress-config: fix device reference leak
Gabriel Krisman Bertazi <[email protected]>
blk-mq: Always schedule hctx->next_cpu
Prarit Bhargava <[email protected]>
ACPI / APEI: Fix NMI notification handling
Tejun Heo <[email protected]>
block: cfq_cpd_alloc() should use @gfp
Denis Kirjanov <[email protected]>
cpufreq: powernv: Disable preemption while checking CPU throttling state
NeilBrown <[email protected]>
NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success.
Trond Myklebust <[email protected]>
NFS: Fix a performance regression in readdir
Trond Myklebust <[email protected]>
pNFS: Fix race in pnfs_wait_on_layoutreturn
Neil Armstrong <[email protected]>
pinctrl: meson: fix gpio request disabling other modes
Jeff Mahoney <[email protected]>
btrfs: fix error handling when run_delayed_extent_op fails
Jeff Mahoney <[email protected]>
btrfs: fix locking when we put back a delayed ref that's too new
Lukasz Odzioba <[email protected]>
x86/cpu: Fix bootup crashes by sanitizing the argument of the 'clearcpuid=' command-line option
Johan Hovold <[email protected]>
USB: serial: ch341: fix modem-control and B0 handling
Johan Hovold <[email protected]>
USB: serial: ch341: fix resume after reset
Alex Deucher <[email protected]>
drm/radeon: drop verde dpm quirks
Zhou Chengming <[email protected]>
sysctl: Drop reference added by grab_header in proc_sys_readdir
Akinobu Mita <[email protected]>
sysrq: attach sysrq handler correctly for 32-bit kernel
Richard Genoud <[email protected]>
tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx
Eric W. Biederman <[email protected]>
mnt: Protect the mountpoint hashtable with mount_lock
Augusto Mecking Caringi <[email protected]>
vme: Fix wrong pointer utilization in ca91cx42_slave_get
Mathias Nyman <[email protected]>
xhci: fix deadlock at host remove by running watchdog correctly
Vlad Tsyrklevich <[email protected]>
i2c: fix kernel memory disclosure in dev interface
John Garry <[email protected]>
i2c: print correct device invalid address
Guenter Roeck <[email protected]>
Input: elants_i2c - avoid divide by 0 errors on bad touchscreen data
Johan Hovold <[email protected]>
USB: serial: ch341: fix open and resume after B0
Johan Hovold <[email protected]>
USB: serial: ch341: fix control-message error handling
Johan Hovold <[email protected]>
USB: serial: ch341: fix open error handling
Johan Hovold <[email protected]>
USB: serial: ch341: fix initial modem-control state
Johan Hovold <[email protected]>
USB: serial: kl5kusb105: fix line-state error handling
Johannes Berg <[email protected]>
nl80211: fix sched scan netlink socket owner destruction
Steve Rutherford <[email protected]>
KVM: x86: Introduce segmented_write_std
Radim Krčmář <[email protected]>
KVM: x86: emulate FXSAVE and FXRSTOR
Radim Krčmář <[email protected]>
KVM: x86: add asm_safe wrapper
Radim Krčmář <[email protected]>
KVM: x86: add Align16 instruction flag
David Matlack <[email protected]>
KVM: x86: flush pending lapic jump label updates on module unload
David Matlack <[email protected]>
jump_labels: API for flushing deferred jump label updates
Wanpeng Li <[email protected]>
KVM: eventfd: fix NULL deref irqbypass consumer
Paolo Bonzini <[email protected]>
KVM: x86: fix emulation of "MOV SS, null selector"
Mike Kravetz <[email protected]>
mm/hugetlb.c: fix reservation race when freeing surplus pages
Eric Ren <[email protected]>
ocfs2: fix crash caused by stale lvb with fsdlm plugin
Dan Williams <[email protected]>
mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done}Rolf Eike Beer <[email protected]>
selftests: do not require bash for the generated test
Rolf Eike Beer <[email protected]>
selftests: do not require bash to run netsocktests testcase
Marcos Paulo de Souza <[email protected]>
Input: i8042 - add Pegatron touchpad to noloop table
Pavel Rojtberg <[email protected]>
Input: xpad - use correct product id for x360w controllers
-------------
Diffstat:
Makefile | 4 +- arch/powerpc/kernel/ibmebus.c | 16 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kvm/emulate.c | 249 +++++++++++++++++++++++---- arch/x86/kvm/lapic.c | 6 + arch/x86/kvm/lapic.h | 1 + arch/x86/kvm/x86.c | 1 + block/blk-mq.c | 4 +- block/cfq-iosched.c | 2 +- drivers/acpi/apei/ghes.c | 7 +- drivers/bus/vexpress-config.c | 7 +- drivers/cpufreq/powernv-cpufreq.c | 8 +- drivers/gpu/drm/radeon/si_dpm.c | 13 -- drivers/i2c/i2c-core.c | 2 +- drivers/i2c/i2c-dev.c | 2 +- drivers/input/joystick/xpad.c | 6 + drivers/input/serio/i8042-x86ia64io.h | 6 + drivers/input/touchscreen/elants_i2c.c | 4 +- drivers/pinctrl/meson/pinctrl-meson.c | 2 +- drivers/pinctrl/sh-pfc/pinctrl.c | 3 +- drivers/tty/serial/atmel_serial.c | 11 ++ drivers/tty/sysrq.c | 4 +- drivers/usb/host/xhci-ring.c | 11 -- drivers/usb/host/xhci.c | 13 -- drivers/usb/serial/ch341.c | 84 +++++---- drivers/usb/serial/kl5kusb105.c | 9 +- drivers/vme/bridges/vme_ca91cx42.c | 2 +- fs/btrfs/extent-tree.c | 5 +- fs/dcache.c | 7 +- fs/namespace.c | 64 +++++-- fs/nfs/dir.c | 15 +- fs/nfs/filelayout/filelayoutdev.c | 3 +- fs/nfs/pnfs.c | 8 +- fs/ocfs2/dlmglue.c | 10 ++ fs/ocfs2/stackglue.c | 6 + fs/ocfs2/stackglue.h | 3 + fs/proc/proc_sysctl.c | 3 +- include/linux/jump_label_ratelimit.h | 5 + kernel/jump_label.c | 7 + kernel/memremap.c | 4 + mm/hugetlb.c | 37 +++- net/wireless/nl80211.c | 16 +- tools/testing/selftests/Makefile | 2 +- tools/testing/selftests/net/run_netsocktests | 2 +- virt/lib/irqbypass.c | 4 +- 45 files changed, 488 insertions(+), 192 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/48 Input: xpad - use correct product id for x360w controllers
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Rojtberg <[email protected]>
commit b6fc513da50c5dbc457a8ad6b58b046a6a68fd9d upstream.
currently the controllers get the same product id as the wireless receiver. However the controllers actually have their own product id.
The patch makes the driver expose the same product id as the windows driver.
This improves compatibility when running applications with WINE.
see https://github.com/paroj/xpad/issues/54
--- drivers/input/joystick/xpad.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/joystick/xpad.c +6 -0
@@ -1238,6 +1238,12 @@ static int xpad_init_input(struct usb_xp input_dev->name = xpad->name; input_dev->phys = xpad->phys;usb_to_input_id (xpad->udev, &input_dev->id); + +if (xpad->xtype ==XTYPE_XBOX360W ) { +/* x360w controllers and the receiver have different ids */ + input_dev->id.product =0x02a1 ; + } + input_dev->dev.parent = &xpad->intf->dev;input_set_drvdata (input_dev, xpad);
Greg Kroah-Hartman
maintainerPATCH 2/48 Input: i8042 - add Pegatron touchpad to noloop table
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcos Paulo de Souza <[email protected]>
commit 41c567a5d7d1a986763e58c3394782813c3bcb03 upstream.
Avoid AUX loopback in Pegatron C15B touchpad, so input subsystem is able to recognize a Synaptics touchpad in the AUX port.
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=93791
(Touchpad is not detected on DNS 0801480 notebook (PEGATRON C15B))
--- drivers/input/serio/i8042-x86ia64io.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +6 -0
@@ -211,6 +211,12 @@ static const struct dmi_system_id __init DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"), }, }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"), + DMI_MATCH(DMI_PRODUCT_NAME, "C15B"), + }, + }, { } };
Greg Kroah-Hartman
maintainerPATCH 3/48 selftests: do not require bash to run netsocktests testcase
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rolf Eike Beer <[email protected]>
commit 3659f98b5375d195f1870c3e508fe51e52206839 upstream.
Nothing in this minimal script seems to require bash. We often run these tests on embedded devices where the only shell available is the busybox ash. Use sh instead.
--- tools/testing/selftests/net/run_netsocktests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/run_netsocktests +1 -1
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh echo "--------------------" echo "running socket test"
Greg Kroah-Hartman
maintainerPATCH 4/48 selftests: do not require bash for the generated test
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rolf Eike Beer <[email protected]>
commit a2b1e8a20c992b01eeb76de00d4f534cbe9f3822 upstream.
Nothing in this minimal script seems to require bash. We often run these tests on embedded devices where the only shell available is the busybox ash. Use sh instead.
--- tools/testing/selftests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/Makefile +1 -1
@@ -83,7 +83,7 @@ ifdef INSTALL_PATH done; @# Ask all targets to emit their test scripts - echo "#!/bin/bash" > $(ALL_SCRIPT) + echo "#!/bin/sh" > $(ALL_SCRIPT) echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT) echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
Greg Kroah-Hartman
maintainerPATCH 5/48 mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done}
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit f931ab479dd24cf7a2c6e2df19778406892591fb upstream.
Both arch_add_memory() and arch_remove_memory() expect a single threaded context.
For example, arch/x86/mm/init_64.c::kernel_physical_mapping_init() does not hold any locks over this check and branch:
if (pgd_val(*pgd)) {
pud = (pud_t *)pgd_page_vaddr(*pgd);
paddr_last = phys_pud_init(pud, __pa(vaddr),
__pa(vaddr_end),
page_size_mask);
continue;
}
pud = alloc_low_page();
paddr_last = phys_pud_init(pud, __pa(vaddr), __pa(vaddr_end),
page_size_mask);The result is that two threads calling devm_memremap_pages() simultaneously can end up colliding on pgd initialization. This leads to crash signatures like the following where the loser of the race initializes the wrong pgd entry:
BUG: unable to handle kernel paging request at ffff888ebfff0000
IP: memcpy_erms+0x6/0x10
PGD 2f8e8fc067 PUD 0 /* <---- Invalid PUD */
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
CPU: 54 PID: 3818 Comm: systemd-udevd Not tainted 4.6.7+ #13
task: ffff882fac290040 ti: ffff882f887a4000 task.ti: ffff882f887a4000
RIP: memcpy_erms+0x6/0x10
[..]
Call Trace:
? pmem_do_bvec+0x205/0x370 [nd_pmem]
? blk_queue_enter+0x3a/0x280
pmem_rw_page+0x38/0x80 [nd_pmem]
bdev_read_page+0x84/0xb0Hold the standard memory hotplug mutex over calls to arch_{add,remove}_memory().
--- kernel/memremap.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/memremap.c +4 -0
@@ -159,7 +159,9 @@ static void devm_memremap_pages_release(struct page_map *page_map = res;/* pages are dead and unused, undo the arch mapping */ +mem_hotplug_begin ();arch_remove_memory (page_map->res.start,resource_size (&page_map->res)); +mem_hotplug_done (); }void *devm_memremap_pages (struct device *dev,struct resource *res)
@@ -189,7 +191,9 @@ void *devm_memremap_pages(struct deviceif (nid <0 ) nid =numa_mem_id (); +mem_hotplug_begin (); error =arch_add_memory (nid, res->start,resource_size (res), true); +mem_hotplug_done ();if (error) {devres_free (page_map);return ERR_PTR (error);
Re: [PATCH 4.4 05/48] mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done}
Quoted 10 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit
f931ab479dd24cf7a2c6e2df19778406892591fbupstream.Both
arch_add_memory()andarch_remove_memory()expect a single threaded context.
[...]
Quoted 4 lines
The result is that two threads calling
devm_memremap_pages()simultaneously can end up colliding on pgd initialization. This leads to crash signatures like the following where the loser of the race initializes the wrong pgd entry:
[...]
Quoted 2 lines
Hold the standard memory hotplug mutex over calls to arch_{add,remove}_memory().
[...]
This is not a sufficient fix, because memory_hotplug.c still assumes there's only one 'writer':
void put_online_mems(void)
{
...
if (!--mem_hotplug.refcount && unlikely(mem_hotplug.active_writer))
wake_up_process(mem_hotplug.active_writer);
...
}void mem_hotplug_begin(void)
{
mem_hotplug.active_writer = current;
memhp_lock_acquire();
for (;;) {
mutex_lock(&mem_hotplug.lock);
if (likely(!mem_hotplug.refcount))
break;
__set_current_state(TASK_UNINTERRUPTIBLE);
mutex_unlock(&mem_hotplug.lock);
schedule();
}
}With multiple writers, one or more of them may hang or {get,put}_online_mems() may mess up the hotplug reference count.
Is there a good reason that memory_hotplug.c isn't using an rwsem?
Ben.
Signature · 3 lines
Ben Hutchings All the simple programs have been written, and all the good names taken.
Re: [PATCH 4.4 05/48] mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done}
Quoted 47 lines · Ben Hutchings
Quoted 10 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit
f931ab479dd24cf7a2c6e2df19778406892591fbupstream.Both
arch_add_memory()andarch_remove_memory()expect a single threaded context.[...]
Quoted 4 lines
The result is that two threads calling
devm_memremap_pages()simultaneously can end up colliding on pgd initialization. This leads to crash signatures like the following where the loser of the race initializes the wrong pgd entry:[...]
Quoted 2 lines
Hold the standard memory hotplug mutex over calls to arch_{add,remove}_memory().
[...]
This is not a sufficient fix, because
memory_hotplug.cstill assumes there's only one 'writer':void
put_online_mems(void){ ... if (!--mem_hotplug.refcount && unlikely(mem_hotplug.active_writer)) wake_up_process(mem_hotplug.active_writer); ... }void
mem_hotplug_begin(void){ mem_hotplug.active_writer = current; memhp_lock_acquire(); for (;;) { mutex_lock(&mem_hotplug.lock); if (likely(!mem_hotplug.refcount)) break; __set_current_state(TASK_UNINTERRUPTIBLE); mutex_unlock(&mem_hotplug.lock); schedule(); } }
Quoted 2 lines
With multiple writers, one or more of them may hang or {get,put}_online_mems() may mess up the hotplug reference count.
You're right. We need to hold lock_device_hotplug_sysfs() before calling mem_hotplug_begin(). I'll take a look at a follow-on fix and also add an assert_held_device_hotplug() helper to catch this in the future.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerPATCH 6/48 ocfs2: fix crash caused by stale lvb with fsdlm plugin
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Ren <[email protected]>
commit e7ee2c089e94067d68475990bdeed211c8852917 upstream.
The crash happens rather often when we reset some cluster nodes while nodes contend fiercely to do truncate and append.
The crash backtrace is below:
dlm: C21CBDA5E0774F4BA5A9D4F317717495: dlm_recover_grant 1 locks on 971 resources
dlm: C21CBDA5E0774F4BA5A9D4F317717495: dlm_recover 9 generation 5 done: 4 ms
ocfs2: Begin replay journal (node 318952601, slot 2) on device (253,18)
ocfs2: End replay journal (node 318952601, slot 2) on device (253,18)
ocfs2: Beginning quota recovery on device (253,18) for slot 2
ocfs2: Finishing quota recovery on device (253,18) for slot 2 (truncate,30154,1):ocfs2_truncate_file:470 ERROR: bug expression: le64_to_cpu(fe->i_size) != i_size_read(inode) (truncate,30154,1):ocfs2_truncate_file:470 ERROR: Inode 290321, inode i_size = 732 != di i_size = 937, i_flags = 0x1
------------[ cut here ]------------
kernel BUG at /usr/src/linux/fs/ocfs2/file.c:470!
invalid opcode: 0000 [#1] SMP
Modules linked in: ocfs2_stack_user(OEN) ocfs2(OEN) ocfs2_nodemanager ocfs2_stackglue(OEN) quota_tree dlm(OEN) configfs fuse sd_mod iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi af_packet iscsi_ibft iscsi_boot_sysfs softdog xfs libcrc32c ppdev parport_pc pcspkr parport joydev virtio_balloon virtio_net i2c_piix4 acpi_cpufreq button processor ext4 crc16 jbd2 mbcache ata_generic cirrus virtio_blk ata_piix drm_kms_helper ahci syscopyarea libahci sysfillrect sysimgblt fb_sys_fops ttm floppy libata drm virtio_pci virtio_ring uhci_hcd virtio ehci_hcd usbcore serio_raw usb_common sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua scsi_mod autofs4
Supported: No, Unsupported modules are loaded
CPU: 1 PID: 30154 Comm: truncate Tainted: G OE N 4.4.21-69-default #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20151112_172657-sheep25 04/01/2014
task: ffff88004ff6d240 ti: ffff880074e68000 task.ti: ffff880074e68000
RIP: 0010:[<ffffffffa05c8c30>] [<ffffffffa05c8c30>] ocfs2_truncate_file+0x640/0x6c0 [ocfs2]
RSP: 0018:ffff880074e6bd50 EFLAGS: 00010282
RAX: 0000000000000074 RBX: 000000000000029e RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000246 RDI: 0000000000000246
RBP: ffff880074e6bda8 R08: 000000003675dc7a R09: ffffffff82013414
R10: 0000000000034c50 R11: 0000000000000000 R12: ffff88003aab3448
R13: 00000000000002dc R14: 0000000000046e11 R15: 0000000000000020
FS: 00007f839f965700(0000) GS:ffff88007fc80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f839f97e000 CR3: 0000000036723000 CR4: 00000000000006e0
Call Trace:
ocfs2_setattr+0x698/0xa90 [ocfs2]
notify_change+0x1ae/0x380
do_truncate+0x5e/0x90
do_sys_ftruncate.constprop.11+0x108/0x160
entry_SYSCALL_64_fastpath+0x12/0x6d
Code: 24 28 ba d6 01 00 00 48 c7 c6 30 43 62 a0 8b 41 2c 89 44 24 08 48 8b 41 20 48 c7 c1 78 a3 62 a0 48 89 04 24 31 c0 e8 a0 97 f9 ff <0f> 0b 3d 00 fe ff ff 0f 84 ab fd ff ff 83 f8 fc 0f 84 a2 fd ff
RIP [<ffffffffa05c8c30>] ocfs2_truncate_file+0x640/0x6c0 [ocfs2]It's because ocfs2_inode_lock() get us stale LVB in which the i_size is not equal to the disk i_size. We mistakenly trust the LVB because the underlaying fsdlm dlm_lock() doesn't set lkb_sbflags with DLM_SBF_VALNOTVALID properly for us. But, why?
The current code tries to downconvert lock without DLM_LKF_VALBLK flag to tell o2cb don't update RSB's LVB if it's a PR->NULL conversion, even if the lock resource type needs LVB. This is not the right way for fsdlm.
The fsdlm plugin behaves different on DLM_LKF_VALBLK, it depends on DLM_LKF_VALBLK to decide if we care about the LVB in the LKB. If DLM_LKF_VALBLK is not set, fsdlm will skip recovering RSB's LVB from this lkb and set the right DLM_SBF_VALNOTVALID appropriately when node failure happens.
The following diagram briefly illustrates how this crash happens:
RSB1 is inode metadata lock resource with LOCK_TYPE_USES_LVB;
The 1st round:
Node1 Node2
RSB1: PR
RSB1(master): NULL->EX
ocfs2_downconvert_lock(PR->NULL, set_lvb==0)
ocfs2_dlm_lock(no DLM_LKF_VALBLK)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dlm_lock(no DLM_LKF_VALBLK)
convert_lock(overwrite lkb->lkb_exflags
with no DLM_LKF_VALBLK)
RSB1: NULL RSB1: EX
reset Node2dlm_recover_rsbs()
recover_lvb()
/* The LVB is not trustable if the node with EX fails and
* no lock >= PR is left. We should set RSB_VALNOTVALID for RSB1. */
if(!(kb_exflags & DLM_LKF_VALBLK)) /* This means we miss the chance to
return; * to invalid the LVB here.
*/
The 2nd round:
Node 1 Node2
RSB1(become master from recovery)
ocfs2_setattr()
ocfs2_inode_lock(NULL->EX)
/* dlm_lock() return the stale lvb without setting DLM_SBF_VALNOTVALID */ ocfs2_meta_lvb_is_trustable() return 1 /* so we don't refresh inode from disk */
ocfs2_truncate_file()
mlog_bug_on_msg(disk isize != i_size_read(inode)) /* crash! */
The fix is quite straightforward. We keep to set DLM_LKF_VALBLK flag for dlm_lock() if the lock resource type needs LVB and the fsdlm plugin is uesed.
--- fs/ocfs2/dlmglue.c | 10 ++++++++++ fs/ocfs2/stackglue.c | 6 ++++++ fs/ocfs2/stackglue.h | 3 +++ 3 files changed, 19 insertions(+)
fs/ocfs2/dlmglue.c +10 -0
@@ -3321,6 +3321,16 @@ static int ocfs2_downconvert_lock(structmlog (ML_BASTS ,"lockres %s, level %d => %d\n" , lockres->l_name, lockres->l_level, new_level); +/* +* On DLM_LKF_VALBLK, fsdlm behaves differently with o2cb. It always +* expects DLM_LKF_VALBLK being set if the LKB has LVB, so that +* we can recover correctly from node failure. Otherwise, we may get +* invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set. +*/ +if (!ocfs2_is_o2cb_active () && + lockres->l_ops->flags &LOCK_TYPE_USES_LVB ) + lvb =1 ; +if (lvb) dlm_flags |=DLM_LKF_VALBLK ;
fs/ocfs2/stackglue.c +6 -0
@@ -48,6 +48,12 @@ static char ocfs2_hb_ctl_path[OCFS2_MAX_*/ static struct ocfs2_stack_plugin *active_stack; +inline int ocfs2_is_o2cb_active (void ) +{ +return !strcmp (active_stack->sp_name,OCFS2_STACK_PLUGIN_O2CB ); +} +EXPORT_SYMBOL_GPL (ocfs2_is_o2cb_active); +static struct ocfs2_stack_plugin *ocfs2_stack_lookup (const char *name) {struct ocfs2_stack_plugin *p;
fs/ocfs2/stackglue.h +3 -0
@@ -298,4 +298,7 @@ void ocfs2_stack_glue_set_max_proto_versint ocfs2_stack_glue_register (struct ocfs2_stack_plugin *plugin);void ocfs2_stack_glue_unregister (struct ocfs2_stack_plugin *plugin); +/* In ocfs2_downconvert_lock(), we need to know which stack we are using */ +int ocfs2_is_o2cb_active (void ); +#endif /* STACKGLUE_H */
Greg Kroah-Hartman
maintainerPATCH 7/48 mm/hugetlb.c: fix reservation race when freeing surplus pages
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Kravetz <[email protected]>
commit e5bbc8a6c992901058bc09e2ce01d16c111ff047 upstream.
return_unused_surplus_pages() decrements the global reservation count, and frees any unused surplus pages that were backing the reservation.
Commit 7848a4bf51b3 ("mm/hugetlb.c: add cond_resched_lock() in return_unused_surplus_pages()") added a call to cond_resched_lock in the loop freeing the pages.
As a result, the hugetlb_lock could be dropped, and someone else could use the pages that will be freed in subsequent iterations of the loop. This could result in inconsistent global hugetlb page state, application api failures (such as mmap) failures or application crashes.
When dropping the lock in return_unused_surplus_pages, make sure that the global reservation count (resv_huge_pages) remains sufficiently large to prevent someone else from claiming pages about to be freed.
Analyzed by Paul Cassella.
--- mm/hugetlb.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)
mm/hugetlb.c +28 -9
@@ -1723,23 +1723,32 @@ free: }/* -* When releasing a hugetlb pool reservation, any surplus pages that were -* allocated to satisfy the reservation must be explicitly freed if they were -* never used. -* Called with hugetlb_lock held. +* This routine has two main purposes: +* 1) Decrement the reservation count (resv_huge_pages) by the value passed +* in unused_resv_pages. This corresponds to the prior adjustments made +* to the associated reservation map. +* 2) Free any unused surplus pages that may have been allocated to satisfy +* the reservation. As many as unused_resv_pages may be freed. +* +* Called with hugetlb_lock held. However, the lock could be dropped (and +* reacquired) during calls to cond_resched_lock. Whenever dropping the lock, +* we must make sure nobody else can claim pages we are in the process of +* freeing. Do this by ensuring resv_huge_page always is greater than the +* number of huge pages we plan to free when dropping the lock. */ static void return_unused_surplus_pages (struct hstate *h,unsigned long unused_resv_pages) {unsigned long nr_pages; -/* Uncommit the reservation */ - h->resv_huge_pages -= unused_resv_pages; -/* Cannot return gigantic pages currently */ if (hstate_is_gigantic (h)) -return ; + goto out; +/* +* Part (or even all) of the reservation could have been backed +* by pre-allocated pages. Only free surplus pages. +*/ nr_pages =min (unused_resv_pages, h->surplus_huge_pages);/*
@@ -1749,12 +1758,22 @@ static void return_unused_surplus_pages(* when the nodes with surplus pages have no free pages. * free_pool_huge_page() will balance the the freed pages across the * on-line nodes with memory and will handle the hstate accounting. +* +* Note that we decrement resv_huge_pages as we free the pages. If +* we drop the lock, resv_huge_pages will still be sufficiently large +* to cover subsequent pages we may free. */ while (nr_pages--) { + h->resv_huge_pages--; + unused_resv_pages--;if (!free_pool_huge_page (h, &node_states[N_MEMORY ],1 )) -break ; + goto out;cond_resched_lock (&hugetlb_lock); } + +out: +/* Fully uncommit the reservation */ + h->resv_huge_pages -= unused_resv_pages; }
Greg Kroah-Hartman
maintainerPATCH 8/48 KVM: x86: fix emulation of "MOV SS, null selector"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 33ab91103b3415e12457e3104f0e4517ce12d0f3 upstream.
This is CVE-2017-2583. On Intel this causes a failed vmentry because SS's type is neither 3 nor 7 (even though the manual says this check is only done for usable SS, and the dmesg splat says that SS is unusable!). On AMD it's worse: svm.c is confused and sets CPL to 0 in the vmcb.
The fix fabricates a data segment descriptor when SS is set to a null selector, so that CPL and SS.DPL are set correctly in the VMCS/vmcb. Furthermore, only allow setting SS to a NULL selector if SS.RPL < 3; this in turn ensures CPL < 3 because RPL must be equal to CPL.
Thanks to Andy Lutomirski and Willy Tarreau for help in analyzing the bug and deciphering the manuals.
--- arch/x86/kvm/emulate.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-)
arch/x86/kvm/emulate.c +38 -10
@@ -1532,7 +1532,6 @@ static int write_segment_descriptor(stru &ctxt->exception); } -/* Does not support long mode */ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, u16 selector, int seg, u8 cpl, enum x86_transfer_type transfer,
@@ -1569,20 +1568,34 @@ static int __load_segment_descriptor(str rpl = selector &3 ; -/* NULL selector is not valid for TR, CS and SS (except for long mode) */ -if ((seg ==VCPU_SREG_CS - || (seg ==VCPU_SREG_SS - && (ctxt->mode !=X86EMUL_MODE_PROT64 || rpl != cpl)) - || seg ==VCPU_SREG_TR ) - && null_selector) - goto exception; -/* TR should be in GDT only */ if (seg ==VCPU_SREG_TR && (selector & (1 <<2 ))) goto exception; -if (null_selector)/* for NULL selector skip all following checks */ +/* NULL selector is not valid for TR, CS and (except for long mode) SS */ +if (null_selector) { +if (seg ==VCPU_SREG_CS || seg ==VCPU_SREG_TR ) + goto exception; + +if (seg ==VCPU_SREG_SS ) { +if (ctxt->mode !=X86EMUL_MODE_PROT64 || rpl != cpl) + goto exception; + +/* +* ctxt->ops->set_segment expects the CPL to be in +* SS.DPL, so fake an expand-up 32-bit data segment. +*/ + seg_desc.type =3 ; + seg_desc.p =1 ; + seg_desc.s =1 ; + seg_desc.dpl = cpl; + seg_desc.d =1 ; + seg_desc.g =1 ; + } + +/* Skip all following checks */ goto load; + } ret =read_segment_descriptor (ctxt, selector, &seg_desc, &desc_addr);if (ret !=X86EMUL_CONTINUE )
@@ -1698,6 +1711,21 @@ static int load_segment_descriptor(struc u16 selector, int seg) {u8 cpl = ctxt->ops->cpl (ctxt); + +/* +* None of MOV, POP and LSS can load a NULL selector in CPL=3, but +* they can load it at CPL<3 (Intel's manual says only LSS can, +* but it's wrong). +* +* However, the Intel manual says that putting IST=1/DPL=3 in +* an interrupt gate will result in SS=3 (the AMD manual instead +* says it doesn't), so allow SS=3 in __load_segment_descriptor +* and only forbid it here. +*/ +if (seg ==VCPU_SREG_SS && selector ==3 && + ctxt->mode ==X86EMUL_MODE_PROT64 ) +return emulate_exception (ctxt,GP_VECTOR ,0 , true); +return __load_segment_descriptor (ctxt, selector, seg, cpl,X86_TRANSFER_NONE ,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 10/48 jump_labels: API for flushing deferred jump label updates
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Matlack <[email protected]>
commit b6416e61012429e0277bd15a229222fd17afc1c1 upstream.
Modules that use static_key_deferred need a way to synchronize with any delayed work that is still pending when the module is unloaded. Introduce static_key_deferred_flush() which flushes any pending jump label updates.
--- include/linux/jump_label_ratelimit.h | 5 +++++ kernel/jump_label.c | 7 +++++++ 2 files changed, 12 insertions(+)
include/linux/jump_label_ratelimit.h +5 -0
@@ -14,6 +14,7 @@ struct static_key_deferred {#ifdef HAVE_JUMP_LABEL extern void static_key_slow_dec_deferred (struct static_key_deferred *key); +extern void static_key_deferred_flush (struct static_key_deferred *key);extern void jump_label_rate_limit (struct static_key_deferred *key,unsigned long rl);
@@ -26,6 +27,10 @@ static inline void static_key_slow_dec_dSTATIC_KEY_CHECK_USE ();static_key_slow_dec (&key->key); } +static inline void static_key_deferred_flush (struct static_key_deferred *key) +{ +STATIC_KEY_CHECK_USE (); +}static inline void jump_label_rate_limit (struct static_key_deferred *key,unsigned long rl)
kernel/jump_label.c +7 -0
@@ -138,6 +138,13 @@ void static_key_slow_dec_deferred(struct }EXPORT_SYMBOL_GPL (static_key_slow_dec_deferred); +void static_key_deferred_flush (struct static_key_deferred *key) +{ +STATIC_KEY_CHECK_USE (); +flush_delayed_work (&key->work); +} +EXPORT_SYMBOL_GPL (static_key_deferred_flush); +void jump_label_rate_limit (struct static_key_deferred *key,unsigned long rl) {
Greg Kroah-Hartman
maintainerPATCH 11/48 KVM: x86: flush pending lapic jump label updates on module unload
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Matlack <[email protected]>
commit cef84c302fe051744b983a92764d3fcca933415d upstream.
KVM's lapic emulation uses static_key_deferred (apic_{hw,sw}_disabled). These are implemented with delayed_work structs which can still be pending when the KVM module is unloaded. We've seen this cause kernel panics when the kvm_intel module is quickly reloaded.
Use the new static_key_deferred_flush() API to flush pending updates on module unload.
--- arch/x86/kvm/lapic.c | 6 ++++++ arch/x86/kvm/lapic.h | 1 + arch/x86/kvm/x86.c | 1 + 3 files changed, 8 insertions(+)
arch/x86/kvm/lapic.c +6 -0
@@ -2187,3 +2187,9 @@ void kvm_lapic_init(void)jump_label_rate_limit (&apic_hw_disabled,HZ );jump_label_rate_limit (&apic_sw_disabled,HZ ); } + +void kvm_lapic_exit (void ) +{ +static_key_deferred_flush (&apic_hw_disabled); +static_key_deferred_flush (&apic_sw_disabled); +}
arch/x86/kvm/lapic.h +1 -0
@@ -95,6 +95,7 @@ static inline bool kvm_hv_vapic_assist_pint kvm_lapic_enable_pv_eoi (struct kvm_vcpu *vcpu,u64 data);void kvm_lapic_init (void ); +void kvm_lapic_exit (void );static inline u32 kvm_apic_get_reg (struct kvm_lapic *apic,int reg_off) {
arch/x86/kvm/x86.c +1 -0
@@ -5842,6 +5842,7 @@ out:void kvm_arch_exit (void ) { +kvm_lapic_exit ();perf_unregister_guest_info_callbacks (&kvm_guest_cbs);if (!boot_cpu_has (X86_FEATURE_CONSTANT_TSC ))
Greg Kroah-Hartman
maintainerPATCH 15/48 KVM: x86: Introduce segmented_write_std
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Rutherford <[email protected]>
commit 129a72a0d3c8e139a04512325384fe5ac119e74d upstream.
Introduces segemented_write_std.
Switches from emulated reads/writes to standard read/writes in fxsave, fxrstor, sgdt, and sidt. This fixes CVE-2017-2584, a longstanding kernel memory leak.
Since commit 283c95d0e389 ("KVM: x86: emulate FXSAVE and FXRSTOR", 2016-11-09), which is luckily not yet in any final release, this would also be an exploitable kernel memory *write*!
--- arch/x86/kvm/emulate.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
arch/x86/kvm/emulate.c +18 -4
@@ -803,6 +803,20 @@ static int segmented_read_std(struct x86return ctxt->ops->read_std (ctxt, linear, data, size, &ctxt->exception); } +static int segmented_write_std (struct x86_emulate_ctxt *ctxt, +struct segmented_address addr, +void *data, +unsigned int size) +{ +int rc; +ulong linear; + + rc =linearize (ctxt, addr, size, true, &linear); +if (rc !=X86EMUL_CONTINUE ) +return rc; +return ctxt->ops->write_std (ctxt, linear, data, size, &ctxt->exception); +} +/* * Prefetch the remaining bytes of the instruction without crossing page * boundary if they are not in fetch_cache yet.
@@ -3698,8 +3712,8 @@ static int emulate_store_desc_ptr(struct }/* Disable writeback. */ ctxt->dst.type =OP_NONE ; -return segmented_write (ctxt, ctxt->dst.addr.mem, - &desc_ptr,2 + ctxt->op_bytes); +return segmented_write_std (ctxt, ctxt->dst.addr.mem, + &desc_ptr,2 + ctxt->op_bytes); }static int em_sgdt (struct x86_emulate_ctxt *ctxt)
@@ -3945,7 +3959,7 @@ static int em_fxsave(struct x86_emulate_else size = offsetof(struct fxregs_state, xmm_space[0]); -return segmented_write (ctxt, ctxt->memop.addr.mem, &fx_state, size); +return segmented_write_std (ctxt, ctxt->memop.addr.mem, &fx_state, size); } static int fxrstor_fixup(struct x86_emulate_ctxt *ctxt,
@@ -3987,7 +4001,7 @@ static int em_fxrstor(struct x86_emulateif (rc !=X86EMUL_CONTINUE )return rc; - rc =segmented_read (ctxt, ctxt->memop.addr.mem, &fx_state,512 ); + rc =segmented_read_std (ctxt, ctxt->memop.addr.mem, &fx_state,512 );if (rc !=X86EMUL_CONTINUE )return rc;
Greg Kroah-Hartman
maintainerPATCH 16/48 nl80211: fix sched scan netlink socket owner destruction
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 753aacfd2e95df6a0caf23c03dc309020765bea9 upstream.
A single netlink socket might own multiple interfaces *and* a scheduled scan request (which might belong to another interface), so when it goes away both may need to be destroyed.
Remove the schedule_scan_stop indirection to fix this - it's only needed for interface destruction because of the way this works right now, with a single work taking care of all interfaces.
--- net/wireless/nl80211.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
net/wireless/nl80211.c +7 -9
@@ -13168,13 +13168,17 @@ static int nl80211_netlink_notify(structlist_for_each_entry_rcu (rdev, &cfg80211_rdev_list, list) {bool schedule_destroy_work = false; -bool schedule_scan_stop = false;struct cfg80211_sched_scan_request *sched_scan_req =rcu_dereference (rdev->sched_scan_req);if (sched_scan_req && notify->portid && - sched_scan_req->owner_nlportid == notify->portid) - schedule_scan_stop = true; + sched_scan_req->owner_nlportid == notify->portid) { + sched_scan_req->owner_nlportid =0 ; + +if (rdev->ops->sched_scan_stop && + rdev->wiphy.flags &WIPHY_FLAG_SUPPORTS_SCHED_SCAN ) +schedule_work (&rdev->sched_scan_stop_wk); + }list_for_each_entry_rcu (wdev, &rdev->wdev_list, list) {cfg80211_mlme_unregister_socket (wdev, notify->portid);
@@ -13205,12 +13209,6 @@ static int nl80211_netlink_notify(structspin_unlock (&rdev->destroy_list_lock);schedule_work (&rdev->destroy_work); } - }else if (schedule_scan_stop) { - sched_scan_req->owner_nlportid =0 ; - -if (rdev->ops->sched_scan_stop && - rdev->wiphy.flags &WIPHY_FLAG_SUPPORTS_SCHED_SCAN ) -schedule_work (&rdev->sched_scan_stop_wk); } }
Greg Kroah-Hartman
maintainerPATCH 17/48 USB: serial: kl5kusb105: fix line-state error handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 146cc8a17a3b4996f6805ee5c080e7101277c410 upstream.
The current implementation failed to detect short transfers when attempting to read the line state, and also, to make things worse, logged the content of the uninitialised heap transfer buffer.
--- drivers/usb/serial/kl5kusb105.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/serial/kl5kusb105.c +5 -4
@@ -192,10 +192,11 @@ static int klsi_105_get_line_state(struc status_buf,KLSI_STATUSBUF_LEN ,10000 ); -if (rc <0 ) -dev_err (&port->dev,"Reading line status failed (error = %d)\n" , - rc); -else { +if (rc !=KLSI_STATUSBUF_LEN ) { +dev_err (&port->dev,"reading line status failed: %d\n" , rc); +if (rc >=0 ) + rc = -EIO ; + }else { status =get_unaligned_le16 (status_buf); dev_info(&port->serial->dev->dev, "read status %x %x\n",
Greg Kroah-Hartman
maintainerPATCH 18/48 USB: serial: ch341: fix initial modem-control state
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 4e2da44691cffbfffb1535f478d19bc2dca3e62b upstream.
DTR and RTS will be asserted by the tty-layer when the port is opened and deasserted on close (if HUPCL is set). Make sure the initial state is not-asserted before the port is first opened as well.
--- drivers/usb/serial/ch341.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/serial/ch341.c +0 -1
@@ -253,7 +253,6 @@ static int ch341_port_probe(struct usb_sspin_lock_init (&priv->lock); priv->baud_rate =DEFAULT_BAUD_RATE ; - priv->line_control =CH341_BIT_RTS |CH341_BIT_DTR ; r =ch341_configure (port->serial->dev, priv);if (r <0 )
Greg Kroah-Hartman
maintainerPATCH 19/48 USB: serial: ch341: fix open error handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit f2950b78547ffb8475297ada6b92bc2d774d5461 upstream.
Make sure to stop the interrupt URB before returning on errors during open.
--- drivers/usb/serial/ch341.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/serial/ch341.c +10 -3
@@ -314,7 +314,7 @@ static int ch341_open(struct tty_struct r =ch341_configure (serial->dev, priv);if (r) - goto out; +return r;if (tty)ch341_set_termios (tty, port,NULL );
@@ -324,12 +324,19 @@ static int ch341_open(struct tty_structif (r) {dev_err (&port->dev,"%s - failed to submit interrupt urb: %d\n" , __func__, r); - goto out; +return r; } r =usb_serial_generic_open (tty, port); +if (r) + goto err_kill_interrupt_urb; + +return 0 ; + +err_kill_interrupt_urb: +usb_kill_urb (port->interrupt_in_urb); -out:return r; +return r; }/* Old_termios contains the original termios settings and
Greg Kroah-Hartman
maintainerPATCH 20/48 USB: serial: ch341: fix control-message error handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 2d5a9c72d0c4ac73cf97f4b7814ed6c44b1e49ae upstream.
A short control transfer would currently fail to be detected, something which could lead to stale buffer data being used as valid input.
Check for short transfers, and make sure to log any transfer errors.
Note that this also avoids leaking heap data to user space (TIOCMGET) and the remote device (break control).
--- drivers/usb/serial/ch341.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/usb/serial/ch341.c +21 -11
@@ -99,6 +99,8 @@ static int ch341_control_out(struct usb_ r =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ), request,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_OUT , value, index,NULL ,0 ,DEFAULT_TIMEOUT ); +if (r <0 ) +dev_err (&dev->dev,"failed to send control message: %d\n" , r);return r; }
@@ -116,7 +118,20 @@ static int ch341_control_in(struct usb_d r =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ), request,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN , value, index, buf, bufsize,DEFAULT_TIMEOUT ); -return r; +if (r < bufsize) { +if (r >=0 ) { +dev_err (&dev->dev, +"short control message received (%d < %u)\n" , + r, bufsize); + r = -EIO ; + } + +dev_err (&dev->dev,"failed to receive control message: %d\n" , + r); +return r; + } + +return 0 ; } static int ch341_set_baudrate(struct usb_device *dev,
@@ -158,9 +173,9 @@ static int ch341_set_handshake(struct usstatic int ch341_get_status (struct usb_device *dev,struct ch341_private *priv) { +const unsigned int size =2 ;char *buffer;int r; -const unsigned size =8 ;unsigned long flags; buffer =kmalloc (size,GFP_KERNEL );
@@ -171,14 +186,9 @@ static int ch341_get_status(struct usb_dif (r <0 ) goto out; -/* setup the private status if available */ -if (r ==2 ) { - r =0 ; -spin_lock_irqsave (&priv->lock, flags); - priv->line_status = (~(*buffer)) &CH341_BITS_MODEM_STAT ; -spin_unlock_irqrestore (&priv->lock, flags); - }else - r = -EPROTO ; +spin_lock_irqsave (&priv->lock, flags); + priv->line_status = (~(*buffer)) &CH341_BITS_MODEM_STAT ; +spin_unlock_irqrestore (&priv->lock, flags); out:kfree (buffer);return r;
@@ -188,9 +198,9 @@ out: kfree(buffer);static int ch341_configure (struct usb_device *dev,struct ch341_private *priv) { +const unsigned int size =2 ;char *buffer;int r; -const unsigned size =8 ; buffer =kmalloc (size,GFP_KERNEL );if (!buffer)
Greg Kroah-Hartman
maintainerPATCH 21/48 USB: serial: ch341: fix open and resume after B0
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit a20047f36e2f6a1eea4f1fd261aaa55882369868 upstream.
The private baud_rate variable is used to configure the port at open and reset-resume and must never be set to (and left at) zero or reset-resume and all further open attempts will fail.
--- drivers/usb/serial/ch341.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/serial/ch341.c +1 -2
@@ -361,12 +361,11 @@ static void ch341_set_termios(struct tty baud_rate =tty_get_baud_rate (tty); - priv->baud_rate = baud_rate; -if (baud_rate) {spin_lock_irqsave (&priv->lock, flags); priv->line_control |= (CH341_BIT_DTR |CH341_BIT_RTS );spin_unlock_irqrestore (&priv->lock, flags); + priv->baud_rate = baud_rate;ch341_set_baudrate (port->serial->dev, priv); }else {spin_lock_irqsave (&priv->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 22/48 Input: elants_i2c - avoid divide by 0 errors on bad touchscreen data
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 1c3415a06b1016a596bfe59e0cfee56c773aa958 upstream.
The following crash may be seen if bad data is received from the touchscreen.
[ 2189.425150] elants_i2c i2c-ELAN0001:00: unknown packet ff ff ff ff [ 2189.430738] divide error: 0000 [#1] PREEMPT SMP [ 2189.434679] gsmi: Log Shutdown Reason 0x03 [ 2189.434689] Modules linked in: ip6t_REJECT nf_reject_ipv6 rfcomm evdi
uinput uvcvideo cmac videobuf2_vmalloc videobuf2_memops snd_hda_codec_hdmi i2c_dev videobuf2_core snd_soc_sst_cht_bsw_rt5645 snd_hda_intel snd_intel_sst_acpi btusb btrtl btbcm btintel bluetooth snd_soc_sst_acpi snd_hda_codec snd_intel_sst_core snd_hwdep snd_soc_sst_mfld_platform snd_hda_core snd_soc_rt5645 memconsole_x86_legacy memconsole zram snd_soc_rl6231 fuse ip6table_filter iwlmvm iwlwifi iwl7000_mac80211 cfg80211 iio_trig_sysfs joydev cros_ec_sensors cros_ec_sensors_core industrialio_triggered_buffer kfifo_buf industrialio snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device ppp_async ppp_generic slhc tun
[ 2189.434866] CPU: 0 PID: 106 Comm: irq/184-ELAN000 Tainted: G W 3.18.0-13101-g57e8190 #1 [ 2189.434883] Hardware name: GOOGLE Ultima, BIOS Google_Ultima.7287.131.43 07/20/2016 [ 2189.434898] task: ffff88017a0b6d80 ti: ffff88017a2bc000 task.ti: ffff88017a2bc000 [ 2189.434913] RIP: 0010:[<ffffffffbecc48d5>] [<ffffffffbecc48d5>] elants_i2c_irq+0x190/0x200 [ 2189.434937] RSP: 0018:ffff88017a2bfd98 EFLAGS: 00010293 [ 2189.434948] RAX: 0000000000000000 RBX: ffff88017a967828 RCX: ffff88017a9678e8 [ 2189.434962] RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000000 [ 2189.434975] RBP: ffff88017a2bfdd8 R08: 00000000000003e8 R09: 0000000000000000 [ 2189.434989] R10: 0000000000000000 R11: 000000000044a2bd R12: ffff88017a991800 [ 2189.435001] R13: ffffffffbe8a2a53 R14: ffff88017a0b6d80 R15: ffff88017a0b6d80 [ 2189.435011] FS: 0000000000000000(0000) GS:ffff88017fc00000(0000) knlGS:0000000000000000 [ 2189.435022] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2189.435030] CR2: 00007f678d94b000 CR3: 000000003f41a000 CR4: 00000000001007f0 [ 2189.435039] Stack: [ 2189.435044] ffff88017a2bfda8 ffff88017a9678e8 646464647a2bfdd8 0000000006e09574 [ 2189.435060] 0000000000000000 ffff88017a088b80 ffff88017a921000 ffffffffbe8a2a53 [ 2189.435074] ffff88017a2bfe08 ffffffffbe8a2a73 ffff88017a0b6d80 0000000006e09574 [ 2189.435089] Call Trace: [ 2189.435101] [<ffffffffbe8a2a53>] ? irq_thread_dtor+0xa9/0xa9 [ 2189.435112] [<ffffffffbe8a2a73>] irq_thread_fn+0x20/0x40 [ 2189.435123] [<ffffffffbe8a2be1>] irq_thread+0x14e/0x222 [ 2189.435135] [<ffffffffbee8cbeb>] ? __schedule+0x3b3/0x57a [ 2189.435145] [<ffffffffbe8a29aa>] ? wake_threads_waitq+0x2d/0x2d [ 2189.435156] [<ffffffffbe8a2a93>] ? irq_thread_fn+0x40/0x40 [ 2189.435168] [<ffffffffbe87c385>] kthread+0x10e/0x116 [ 2189.435178] [<ffffffffbe87c277>] ? __kthread_parkme+0x67/0x67 [ 2189.435189] [<ffffffffbee900ac>] ret_from_fork+0x7c/0xb0 [ 2189.435199] [<ffffffffbe87c277>] ? __kthread_parkme+0x67/0x67 [ 2189.435208] Code: ff ff eb 73 0f b6 bb c1 00 00 00 83 ff 03 7e 13 49 8d 7c 24 20 ba 04 00 00 00 48 c7 c6 8a cd 21 bf eb 4d 0f b6 83 c2 00 00 00 99 <f7> ff 83 f8 37 75 15 48 6b f7 37 4c 8d a3 c4 00 00 00 4c 8d ac [ 2189.435312] RIP [<ffffffffbecc48d5>] elants_i2c_irq+0x190/0x200 [ 2189.435323] RSP <ffff88017a2bfd98> [ 2189.435350] ---[ end trace f4945345a75d96dd ]--- [ 2189.443841] Kernel panic - not syncing: Fatal exception [ 2189.444307] Kernel Offset: 0x3d800000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) [ 2189.444519] gsmi: Log Shutdown Reason 0x02
The problem was seen with a 3.18 based kernel, but there is no reason to believe that the upstream code is safe.
--- drivers/input/touchscreen/elants_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/elants_i2c.c +2 -2
@@ -905,9 +905,9 @@ static irqreturn_t elants_i2c_irq(int ircase QUEUE_HEADER_NORMAL : report_count = ts->buf[FW_HDR_COUNT ]; -if (report_count >3 ) { +if (report_count ==0 || report_count >3 ) {dev_err (&client->dev, -"too large report count: %*ph\n" , +"bad report count: %*ph\n" ,HEADER_SIZE , ts->buf);break ; }
Greg Kroah-Hartman
maintainerPATCH 23/48 i2c: print correct device invalid address
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
commit 6f724fb3039522486fce2e32e4c0fbe238a6ab02 upstream.
In of_i2c_register_device(), when the check for device address validity fails we print the info.addr, which has not been assigned properly.
Fix this by printing the actual invalid address.
--- drivers/i2c/i2c-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core.c +1 -1
@@ -1400,7 +1400,7 @@ static struct i2c_client *of_i2c_registeif (i2c_check_addr_validity (addr, info.flags)) {dev_err (&adap->dev,"of_i2c: invalid addr=%x on %s\n" , - info.addr, node->full_name); + addr, node->full_name);return ERR_PTR (-EINVAL ); }
Greg Kroah-Hartman
maintainerPATCH 24/48 i2c: fix kernel memory disclosure in dev interface
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Tsyrklevich <[email protected]>
commit 30f939feaeee23e21391cfc7b484f012eb189c3c upstream.
i2c_smbus_xfer() does not always fill an entire block, allowing kernel stack memory disclosure through the temp variable. Clear it before it's read to.
--- drivers/i2c/i2c-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-dev.c +1 -1
@@ -329,7 +329,7 @@ static noinline int i2cdev_ioctl_smbus(s unsigned long arg) {struct i2c_smbus_ioctl_data data_arg; -union i2c_smbus_data temp; +union i2c_smbus_data temp = {};int datasize, res; if (copy_from_user(&data_arg,
Greg Kroah-Hartman
maintainerPATCH 25/48 xhci: fix deadlock at host remove by running watchdog correctly
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit d6169d04097fd9ddf811e63eae4e5cd71e6666e2 upstream.
If a URB is killed while the host is removed we can end up in a situation where the hub thread takes the roothub device lock, and waits for the URB to be given back by xhci-hcd, blocking the host remove code.
xhci-hcd tries to stop the endpoint and give back the urb, but can't as the host is removed from PCI bus at the same time, preventing the normal way of giving back urb.
Instead we need to rely on the stop command timeout function to give back the urb. This xhci_stop_endpoint_command_watchdog() timeout function used a XHCI_STATE_DYING flag to indicate if the timeout function is already running, but later this flag has been taking into use in other places to mark that xhci is dying.
Remove checks for XHCI_STATE_DYING in xhci_urb_dequeue. We are still checking that reading from pci state does not return 0xffffffff or that host is not halted before trying to stop the endpoint.
This whole area of stopping endpoints, giving back URBs, and the wathdog timeout need rework, this fix focuses on solving a specific deadlock issue that we can then send to stable before any major rework.
--- drivers/usb/host/xhci-ring.c | 11 ----------- drivers/usb/host/xhci.c | 13 ------------- 2 files changed, 24 deletions(-)
drivers/usb/host/xhci-ring.c +0 -11
@@ -913,17 +913,6 @@ void xhci_stop_endpoint_command_watchdogspin_lock_irqsave (&xhci->lock, flags); ep->stop_cmds_pending--; -if (xhci->xhc_state &XHCI_STATE_REMOVING ) { -spin_unlock_irqrestore (&xhci->lock, flags); -return ; - } -if (xhci->xhc_state &XHCI_STATE_DYING ) { -xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, -"Stop EP timer ran, but another timer marked " -"xHCI as DYING, exiting." ); -spin_unlock_irqrestore (&xhci->lock, flags); -return ; - }if (!(ep->stop_cmds_pending ==0 && (ep->ep_state &EP_HALT_PENDING ))) {xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, "Stop EP timer ran, but no command pending, "
drivers/usb/host/xhci.c +0 -13
@@ -1569,19 +1569,6 @@ int xhci_urb_dequeue(struct usb_hcd *hcdxhci_urb_free_priv (urb_priv);return ret; } -if ((xhci->xhc_state &XHCI_STATE_DYING ) || - (xhci->xhc_state &XHCI_STATE_HALTED )) { -xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, -"Ep 0x%x: URB %p to be canceled on " -"non-responsive xHCI host." , - urb->ep->desc.bEndpointAddress, urb); -/* Let the stop endpoint command watchdog timer (which set this -* state) finish cleaning up the endpoint TD lists. We must -* have caught it in the middle of dropping a lock and giving -* back an URB. -*/ - goto done; - } ep_index =xhci_get_endpoint_index (&urb->ep->desc); ep = &xhci->devs[urb->dev->slot_id]->eps[ep_index];
Greg Kroah-Hartman
maintainerPATCH 27/48 mnt: Protect the mountpoint hashtable with mount_lock
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric W. Biederman <[email protected]>
commit 3895dbf8985f656675b5bde610723a29cbce3fa7 upstream.
Protecting the mountpoint hashtable with namespace_sem was sufficient until a call to umount_mnt was added to mntput_no_expire. At which point it became possible for multiple calls of put_mountpoint on the same hash chain to happen on the same time.
Kristen Johansen <[email protected]> reported:
Quoted 8 lines
This can cause a panic when simultaneous callers of
put_mountpointattempt to free the same mountpoint. This occurs because some callers hold themount_hash_lock, while others hold the namespace lock. Some even hold both.In this submitter's case, the panic manifested itself as a GP fault in
put_mountpoint()when it calledhlist_del()and attempted to dereference a m_hash.pprev that had been poisioned by another thread.
Al Viro observed that the simple fix is to switch from using the namespace_sem to the mount_lock to protect the mountpoint hash table.
I have taken Al's suggested patch moved put_mountpoint in pivot_root (instead of taking mount_lock an additional time), and have replaced new_mountpoint with get_mountpoint a function that does the hash table
lookup and addition under the mount_lock. The introduction of get_mounptoint
ensures that only the mount_lock is needed to manipulate the mountpoint hashtable.
d_set_mounted is modified to only set DCACHE_MOUNTED if it is not already set. This allows get_mountpoint to use the setting of DCACHE_MOUNTED to ensure adding a struct mountpoint for a dentry happens exactly once.
--- fs/dcache.c | 7 ++++-- fs/namespace.c | 64 ++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 50 insertions(+), 21 deletions(-)
fs/dcache.c +5 -2
@@ -1322,8 +1322,11 @@ int d_set_mounted(struct dentry *dentry) }spin_lock (&dentry->d_lock);if (!d_unlinked (dentry)) { - dentry->d_flags |=DCACHE_MOUNTED ; - ret =0 ; + ret = -EBUSY ; +if (!d_mountpoint (dentry)) { + dentry->d_flags |=DCACHE_MOUNTED ; + ret =0 ; + } }spin_unlock (&dentry->d_lock); out:
fs/namespace.c +45 -19
116 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 28/48 tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Genoud <[email protected]>
commit 89d8232411a85b9a6b12fd5da4d07d8a138a8e0c upstream.
If we don't disable the transmitter in atmel_stop_tx, the DMA buffer continues to send data until it is emptied.
This cause problems with the flow control (CTS is asserted and data are still sent).
So, disabling the transmitter in atmel_stop_tx is a sane thing to do.
Tested on at91sam9g35-cm(DMA)
Tested for regressions on sama5d2-xplained(Fifo) and at91sam9g20ek(PDC)
--- drivers/tty/serial/atmel_serial.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/tty/serial/atmel_serial.c +11 -0
@@ -470,6 +470,14 @@ static void atmel_stop_tx(struct uart_po/* disable PDC transmit */ atmel_uart_writel (port,ATMEL_PDC_PTCR ,ATMEL_PDC_TXTDIS ); } + +/* +* Disable the transmitter. +* This is mandatory when DMA is used, otherwise the DMA buffer +* is fully transmitted. +*/ +atmel_uart_writel (port,ATMEL_US_CR ,ATMEL_US_TXDIS ); +/* Disable interrupts */ atmel_uart_writel (port,ATMEL_US_IDR , atmel_port->tx_done_mask);
@@ -502,6 +510,9 @@ static void atmel_start_tx(struct uart_p/* Enable interrupts */ atmel_uart_writel (port,ATMEL_US_IER , atmel_port->tx_done_mask); + +/* re-enable the transmitter */ +atmel_uart_writel (port,ATMEL_US_CR ,ATMEL_US_TXEN ); }/*
Greg Kroah-Hartman
maintainerPATCH 29/48 sysrq: attach sysrq handler correctly for 32-bit kernel
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akinobu Mita <[email protected]>
commit 802c03881f29844af0252b6e22be5d2f65f93fd0 upstream.
The sysrq input handler should be attached to the input device which has a left alt key.
On 32-bit kernels, some input devices which has a left alt key cannot attach sysrq handler. Because the keybit bitmap in struct input_device_id for sysrq is not correctly initialized. KEY_LEFTALT is 56 which is greater than BITS_PER_LONG on 32-bit kernels.
I found this problem when using a matrix keypad device which defines a KEY_LEFTALT (56) but doesn't have a KEY_O (24 == 56%32).
--- drivers/tty/sysrq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/sysrq.c +2 -2
@@ -939,8 +939,8 @@ static const struct input_device_id sysr { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { BIT_MASK(KEY_LEFTALT) }, + .evbit = { [BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY) }, + .keybit = { [BIT_WORD(KEY_LEFTALT)] = BIT_MASK(KEY_LEFTALT) }, }, { }, };
Greg Kroah-Hartman
maintainerPATCH 30/48 sysctl: Drop reference added by grab_header in proc_sys_readdir
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhou Chengming <[email protected]>
commit 93362fa47fe98b62e4a34ab408c4a418432e7939 upstream.
Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. It can cause any path called unregister_sysctl_table will wait forever.
The calltrace of CVE-2016-9191:
[ 5535.960522] Call Trace: [ 5535.963265] [<ffffffff817cdaaf>] schedule+0x3f/0xa0 [ 5535.968817] [<ffffffff817d33fb>] schedule_timeout+0x3db/0x6f0 [ 5535.975346] [<ffffffff817cf055>] ? wait_for_completion+0x45/0x130 [ 5535.982256] [<ffffffff817cf0d3>] wait_for_completion+0xc3/0x130 [ 5535.988972] [<ffffffff810d1fd0>] ? wake_up_q+0x80/0x80 [ 5535.994804] [<ffffffff8130de64>] drop_sysctl_table+0xc4/0xe0 [ 5536.001227] [<ffffffff8130de17>] drop_sysctl_table+0x77/0xe0 [ 5536.007648] [<ffffffff8130decd>] unregister_sysctl_table+0x4d/0xa0 [ 5536.014654] [<ffffffff8130deff>] unregister_sysctl_table+0x7f/0xa0 [ 5536.021657] [<ffffffff810f57f5>] unregister_sched_domain_sysctl+0x15/0x40 [ 5536.029344] [<ffffffff810d7704>] partition_sched_domains+0x44/0x450 [ 5536.036447] [<ffffffff817d0761>] ? __mutex_unlock_slowpath+0x111/0x1f0 [ 5536.043844] [<ffffffff81167684>] rebuild_sched_domains_locked+0x64/0xb0 [ 5536.051336] [<ffffffff8116789d>] update_flag+0x11d/0x210 [ 5536.057373] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.064186] [<ffffffff81167acb>] ? cpuset_css_offline+0x1b/0x60 [ 5536.070899] [<ffffffff810fce3d>] ? trace_hardirqs_on+0xd/0x10 [ 5536.077420] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.084234] [<ffffffff8115a9f5>] ? css_killed_work_fn+0x25/0x220 [ 5536.091049] [<ffffffff81167ae5>] cpuset_css_offline+0x35/0x60 [ 5536.097571] [<ffffffff8115aa2c>] css_killed_work_fn+0x5c/0x220 [ 5536.104207] [<ffffffff810bc83f>] process_one_work+0x1df/0x710 [ 5536.110736] [<ffffffff810bc7c0>] ? process_one_work+0x160/0x710 [ 5536.117461] [<ffffffff810bce9b>] worker_thread+0x12b/0x4a0 [ 5536.123697] [<ffffffff810bcd70>] ? process_one_work+0x710/0x710 [ 5536.130426] [<ffffffff810c3f7e>] kthread+0xfe/0x120 [ 5536.135991] [<ffffffff817d4baf>] ret_from_fork+0x1f/0x40 [ 5536.142041] [<ffffffff810c3e80>] ? kthread_create_on_node+0x230/0x230
One cgroup maintainer mentioned that "cgroup is trying to offline a cpuset css, which takes place under cgroup_mutex. The offlining ends up trying to drain active usages of a sysctl table which apprently is not happening."
The real reason is that proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. So this cpuset offline path will wait here forever.
See here for details: http://www.openwall.com/lists/oss-security/2016/11/04/13
--- fs/proc/proc_sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/proc_sysctl.c +2 -1
@@ -703,7 +703,7 @@ static int proc_sys_readdir(struct file ctl_dir = container_of(head, struct ctl_dir, header);if (!dir_emit_dots (file, ctx)) -return 0 ; + goto out; pos =2 ;
@@ -713,6 +713,7 @@ static int proc_sys_readdir(struct filebreak ; } } +out:sysctl_head_finish (head);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 31/48 drm/radeon: drop verde dpm quirks
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 8a08403bcb39f5d0e733bcf59a8a74f16b538f6e upstream.
fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=98897
https://bugs.launchpad.net/bugs/1651981
--- drivers/gpu/drm/radeon/si_dpm.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/radeon/si_dpm.c +0 -13
@@ -3008,19 +3008,6 @@ static void si_apply_state_adjust_rules( (rdev->pdev->device == 0x6817) || (rdev->pdev->device == 0x6806)) max_mclk =120000 ; - }else if (rdev->family ==CHIP_VERDE ) { -if ((rdev->pdev->revision ==0x81 ) || - (rdev->pdev->revision ==0x83 ) || - (rdev->pdev->revision ==0x87 ) || - (rdev->pdev->device ==0x6820 ) || - (rdev->pdev->device ==0x6821 ) || - (rdev->pdev->device ==0x6822 ) || - (rdev->pdev->device ==0x6823 ) || - (rdev->pdev->device ==0x682A ) || - (rdev->pdev->device ==0x682B )) { - max_sclk =75000 ; - max_mclk =80000 ; - } }else if (rdev->family ==CHIP_OLAND ) { if ((rdev->pdev->revision == 0xC7) || (rdev->pdev->revision == 0x80) ||
Greg Kroah-Hartman
maintainerPATCH 32/48 USB: serial: ch341: fix resume after reset
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit ce5e292828117d1b71cbd3edf9e9137cf31acd30 upstream.
Fix reset-resume handling which failed to resubmit the read and interrupt URBs, thereby leaving a port that was open before suspend in a broken state until closed and reopened.
resume")
--- drivers/usb/serial/ch341.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/usb/serial/ch341.c +13 -4
@@ -554,14 +554,23 @@ static int ch341_tiocmget(struct tty_strstatic int ch341_reset_resume (struct usb_serial *serial) { -struct ch341_private *priv; - - priv =usb_get_serial_port_data (serial->port[0 ]); +struct usb_serial_port *port = serial->port[0 ]; +struct ch341_private *priv =usb_get_serial_port_data (port); +int ret;/* reconfigure ch341 serial port after bus-reset */ ch341_configure (serial->dev, priv); -return 0 ; +if (test_bit (ASYNCB_INITIALIZED , &port->port.flags)) { + ret =usb_submit_urb (port->interrupt_in_urb,GFP_NOIO ); +if (ret) { +dev_err (&port->dev,"failed to submit interrupt urb: %d\n" , + ret); +return ret; + } + } + +return usb_serial_generic_resume (serial); }static struct usb_serial_driver ch341_device = {
Greg Kroah-Hartman
maintainerPATCH 33/48 USB: serial: ch341: fix modem-control and B0 handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 030ee7ae52a46a2be52ccc8242c4a330aba8d38e upstream.
The modem-control signals are managed by the tty-layer during open and should not be asserted prematurely when set_termios is called from driver open.
Also make sure that the signals are asserted only when changing speed from B0.
--- drivers/usb/serial/ch341.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/serial/ch341.c +9 -9
@@ -362,24 +362,24 @@ static void ch341_set_termios(struct tty baud_rate =tty_get_baud_rate (tty);if (baud_rate) { -spin_lock_irqsave (&priv->lock, flags); - priv->line_control |= (CH341_BIT_DTR |CH341_BIT_RTS ); -spin_unlock_irqrestore (&priv->lock, flags); priv->baud_rate = baud_rate;ch341_set_baudrate (port->serial->dev, priv); - }else { -spin_lock_irqsave (&priv->lock, flags); - priv->line_control &= ~(CH341_BIT_DTR |CH341_BIT_RTS ); -spin_unlock_irqrestore (&priv->lock, flags); } -ch341_set_handshake (port->serial->dev, priv->line_control); -/* Unimplemented: * (cflag & CSIZE) : data bits [5, 8] * (cflag & PARENB) : parity {NONE, EVEN, ODD} * (cflag & CSTOPB) : stop bits [1, 2] */ + +spin_lock_irqsave (&priv->lock, flags); +if (C_BAUD (tty) ==B0 ) + priv->line_control &= ~(CH341_BIT_DTR |CH341_BIT_RTS ); +else if (old_termios && (old_termios->c_cflag &CBAUD ) ==B0 ) + priv->line_control |= (CH341_BIT_DTR |CH341_BIT_RTS ); +spin_unlock_irqrestore (&priv->lock, flags); + +ch341_set_handshake (port->serial->dev, priv->line_control); }static void ch341_break_ctl (struct tty_struct *tty,int break_state)
Greg Kroah-Hartman
maintainerPATCH 34/48 x86/cpu: Fix bootup crashes by sanitizing the argument of the clearcpuid= command-line option
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Odzioba <[email protected]>
commit dd853fd216d1485ed3045ff772079cc8689a9a4a upstream.
A negative number can be specified in the cmdline which will be used as setup_clear_cpu_cap() argument. With that we can clear/set some bit in memory predceeding boot_cpu_data/cpu_caps_cleared which may cause kernel to misbehave. This patch adds lower bound check to setup_disablecpuid().
Boris Petkov reproduced a crash:
[ 1.234575] BUG: unable to handle kernel paging request at ffffffff858bd540 [ 1.236535] IP: memcpy_erms+0x6/0x10
--- arch/x86/kernel/cpu/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -1129,7 +1129,7 @@ static __init int setup_disablecpuid(cha {int bit; -if (get_option (&arg, &bit) && bit <NCAPINTS *32 ) +if (get_option (&arg, &bit) && bit >=0 && bit <NCAPINTS *32 )setup_clear_cpu_cap (bit);else return 0 ;
Greg Kroah-Hartman
maintainerPATCH 35/48 btrfs: fix locking when we put back a delayed ref thats too new
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit d0280996437081dd12ed1e982ac8aeaa62835ec4 upstream.
In __btrfs_run_delayed_refs, when we put back a delayed ref that's too new, we have already dropped the lock on locked_ref when we set ->processing = 0.
This patch keeps the lock to cover that assignment.
--- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent-tree.c +1 -1
@@ -2520,11 +2520,11 @@ static noinline int __btrfs_run_delayed_if (ref && ref->seq &&btrfs_check_delayed_seq (fs_info, delayed_refs, ref->seq)) {spin_unlock (&locked_ref->lock); -btrfs_delayed_ref_unlock (locked_ref);spin_lock (&delayed_refs->lock); locked_ref->processing =0 ; delayed_refs->num_heads_ready++;spin_unlock (&delayed_refs->lock); +btrfs_delayed_ref_unlock (locked_ref); locked_ref =NULL ;cond_resched (); count++;
Greg Kroah-Hartman
maintainerPATCH 36/48 btrfs: fix error handling when run_delayed_extent_op fails
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit aa7c8da35d1905d80e840d075f07d26ec90144b5 upstream.
In __btrfs_run_delayed_refs, the error path when run_delayed_extent_op fails sets locked_ref->processing = 0 but doesn't re-increment delayed_refs->num_heads_ready. As a result, we end up triggering the WARN_ON in btrfs_select_ref_head.
--- fs/btrfs/extent-tree.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/extent-tree.c +3 -0
@@ -2570,7 +2570,10 @@ static noinline int __btrfs_run_delayed_*/ if (must_insert_reserved) locked_ref->must_insert_reserved =1 ; +spin_lock (&delayed_refs->lock); locked_ref->processing =0 ; + delayed_refs->num_heads_ready++; +spin_unlock (&delayed_refs->lock);btrfs_debug (fs_info,"run_delayed_extent_op returned %d" , ret);btrfs_delayed_ref_unlock (locked_ref);return ret;
Greg Kroah-Hartman
maintainerPATCH 37/48 pinctrl: meson: fix gpio request disabling other modes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
commit f24d311f92b516a8aadef5056424ccabb4068e7b upstream.
The pinctrl_gpio_request is called with the "full" gpio number, already containing the base, then meson_pmx_request_gpio is then called with the final pin number.
Remove the base addition when calling meson_pmx_disable_other_groups.
--- drivers/pinctrl/meson/pinctrl-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-meson.c +1 -1
@@ -246,7 +246,7 @@ static int meson_pmx_request_gpio(struct {struct meson_pinctrl *pc =pinctrl_dev_get_drvdata (pcdev); -meson_pmx_disable_other_groups (pc, range->pin_base + offset,-1 ); +meson_pmx_disable_other_groups (pc, offset,-1 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 38/48 pNFS: Fix race in pnfs_wait_on_layoutreturn
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit ee284e35d8c71bf5d4d807eaff6f67a17134b359 upstream.
We must put the task to sleep while holding the inode->i_lock in order to ensure atomicity with the test for NFS_LAYOUT_RETURN.
--- fs/nfs/pnfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
fs/nfs/pnfs.c +3 -5
@@ -1185,13 +1185,11 @@ bool pnfs_wait_on_layoutreturn(struct in* i_lock */ spin_lock (&ino->i_lock); lo = nfsi->layout; -if (lo &&test_bit (NFS_LAYOUT_RETURN , &lo->plh_flags)) +if (lo &&test_bit (NFS_LAYOUT_RETURN , &lo->plh_flags)) { +rpc_sleep_on (&NFS_SERVER (ino)->roc_rpcwaitq, task,NULL ); sleep = true; + }spin_unlock (&ino->i_lock); - -if (sleep) -rpc_sleep_on (&NFS_SERVER (ino)->roc_rpcwaitq, task,NULL ); -return sleep; }
Greg Kroah-Hartman
maintainerPATCH 39/48 NFS: Fix a performance regression in readdir
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 79f687a3de9e3ba2518b4ea33f38ca6cbe9133eb upstream.
Ben Coddington reports that commit 311324ad1713, by adding the function nfs_dir_mapping_need_revalidate() that checks page cache validity on each call to nfs_readdir() causes a performance regression when the directory is being modified.
If the directory is changing while we're iterating through the directory, POSIX does not require us to invalidate the page cache unless the user calls rewinddir(). However, we still do want to ensure that we use readdirplus in order to avoid a load of stat() calls when the user is doing an 'ls -l' workload.
The fix should be to invalidate the page cache immediately when we're setting the NFS_INO_ADVISE_RDPLUS bit.
--- fs/nfs/dir.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
fs/nfs/dir.c +2 -13
@@ -462,7 +462,7 @@ void nfs_force_use_readdirplus(struct in {if (!list_empty (&NFS_I (dir)->open_files)) {nfs_advise_use_readdirplus (dir); -nfs_zap_mapping (dir, dir->i_mapping); +invalidate_mapping_pages (dir->i_mapping,0 ,-1 ); } }
@@ -847,17 +847,6 @@ int uncached_readdir(nfs_readdir_descrip goto out; } -static bool nfs_dir_mapping_need_revalidate (struct inode *dir) -{ -struct nfs_inode *nfsi =NFS_I (dir); - -if (nfs_attribute_cache_expired (dir)) -return true; -if (nfsi->cache_validity &NFS_INO_INVALID_DATA ) -return true; -return false; -} -/* The file offset position represents the dirent entry number. A last cookie cache takes care of the common case of reading the whole directory.
@@ -890,7 +879,7 @@ static int nfs_readdir(struct file *file desc->plus =nfs_use_readdirplus (inode, ctx) ?1 :0 ;nfs_block_sillyrename (dentry); -if (ctx->pos ==0 ||nfs_dir_mapping_need_revalidate (inode)) +if (ctx->pos ==0 ||nfs_attribute_cache_expired (inode)) res =nfs_revalidate_mapping (inode, file->f_mapping);if (res <0 ) goto out;
Greg Kroah-Hartman
maintainerPATCH 40/48 NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit cfd278c280f997cf2fe4662e0acab0fe465f637b upstream.
Various places assume that if nfs4_fl_prepare_ds() turns a non-NULL 'ds', then ds->ds_clp will also be non-NULL.
This is not necessasrily true in the case when the process received a fatal signal while nfs4_pnfs_ds_connect is waiting in nfs4_wait_ds_connect().
In that case ->ds_clp may not be set, and the devid may not recently have been marked unavailable.
So add a test for ds_clp == NULL and return NULL in that case.
--- fs/nfs/filelayout/filelayoutdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/filelayout/filelayoutdev.c +2 -1
@@ -283,7 +283,8 @@ nfs4_fl_prepare_ds(struct pnfs_layout_se s->nfs_client->cl_rpcclient->cl_auth->au_flavor); out_test_devid: -if (filelayout_test_devid_unavailable (devid)) +if (ret->ds_clp ==NULL || +filelayout_test_devid_unavailable (devid)) ret =NULL ; out:return ret;
Greg Kroah-Hartman
maintainerPATCH 41/48 cpufreq: powernv: Disable preemption while checking CPU throttling state
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Kirjanov <[email protected]>
commit 8a10c06a20ec8097a68fd7a4a1c0e285095b4d2f upstream.
With preemption turned on we can read incorrect throttling state while being switched to CPU on a different chip.
BUG: using smp_processor_id() in preemptible [00000000] code: cat/7343 caller is .powernv_cpufreq_throttle_check+0x2c/0x710 CPU: 13 PID: 7343 Comm: cat Not tainted 4.8.0-rc5-dirty #1 Call Trace: [c0000007d25b75b0] [c000000000971378] .dump_stack+0xe4/0x150 (unreliable) [c0000007d25b7640] [c0000000005162e4] .check_preemption_disabled+0x134/0x150 [c0000007d25b76e0] [c0000000007b63ac] .powernv_cpufreq_throttle_check+0x2c/0x710 [c0000007d25b7790] [c0000000007b6d18] .powernv_cpufreq_target_index+0x288/0x360 [c0000007d25b7870] [c0000000007acee4] .__cpufreq_driver_target+0x394/0x8c0 [c0000007d25b7920] [c0000000007b22ac] .cpufreq_set+0x7c/0xd0 [c0000007d25b79b0] [c0000000007adf50] .store_scaling_setspeed+0x80/0xc0 [c0000007d25b7a40] [c0000000007ae270] .store+0xa0/0x100 [c0000007d25b7ae0] [c0000000003566e8] .sysfs_kf_write+0x88/0xb0 [c0000007d25b7b70] [c0000000003553b8] .kernfs_fop_write+0x178/0x260 [c0000007d25b7c10] [c0000000002ac3cc] .__vfs_write+0x3c/0x1c0 [c0000007d25b7cf0] [c0000000002ad584] .vfs_write+0xc4/0x230 [c0000007d25b7d90] [c0000000002aeef8] .SyS_write+0x58/0x100 [c0000007d25b7e30] [c00000000000bfec] system_call+0x38/0xfc
--- drivers/cpufreq/powernv-cpufreq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/cpufreq/powernv-cpufreq.c +7 -1
@@ -373,8 +373,14 @@ static int powernv_cpufreq_target_index(if (unlikely (rebooting) && new_index !=get_nominal_index ())return 0 ; -if (!throttled) +if (!throttled) { +/* we don't want to be preempted while +* checking if the CPU frequency has been throttled +*/ +preempt_disable ();powernv_cpufreq_throttle_check (NULL ); +preempt_enable (); + } freq_data.pstate_id = powernv_freqs[new_index].driver_data;
Greg Kroah-Hartman
maintainerPATCH 42/48 block: cfq_cpd_alloc() should use @gfp
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit ebc4ff661fbe76781c6b16dfb7b754a5d5073f8e upstream.
cfq_cpd_alloc() which is the cpd_alloc_fn implementation for cfq was incorrectly hard coding GFP_KERNEL instead of using the mask specified through the @gfp parameter. This currently doesn't cause any actual issues because all current callers specify GFP_KERNEL. Fix it.
--- block/cfq-iosched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/cfq-iosched.c +1 -1
@@ -1572,7 +1572,7 @@ static struct blkcg_policy_data *cfq_cpd {struct cfq_group_data *cgd; - cgd =kzalloc (sizeof (*cgd),GFP_KERNEL ); + cgd =kzalloc (sizeof (*cgd), gfp);if (!cgd)return NULL ;return &cgd->cpd;
Greg Kroah-Hartman
maintainerPATCH 43/48 ACPI / APEI: Fix NMI notification handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit a545715d2dae8d071c5b06af947b07ffa846b288 upstream.
When removing and adding cpu 0 on a system with GHES NMI the following stack trace is seen when re-adding the cpu:
WARNING: CPU: 0 PID: 0 at arch/x86/kernel/apic/apic.c:1349 setup_local_APIC+ Modules linked in: nfsv3 rpcsec_gss_krb5 nfsv4 nfs fscache coretemp intel_ra CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.0-rc6+ #2 Call Trace: dump_stack+0x63/0x8e __warn+0xd1/0xf0 warn_slowpath_null+0x1d/0x20 setup_local_APIC+0x275/0x370 apic_ap_setup+0xe/0x20 start_secondary+0x48/0x180 set_init_arg+0x55/0x55 early_idt_handler_array+0x120/0x120 x86_64_start_reservations+0x2a/0x2c x86_64_start_kernel+0x13d/0x14c
During the cpu bringup, wakeup_cpu_via_init_nmi() is called and issues an NMI on CPU 0. The GHES NMI handler, ghes_notify_nmi() runs the ghes_proc_irq_work work queue which ends up setting IRQ_WORK_VECTOR (0xf6). The "faulty" IR line set at arch/x86/kernel/apic/apic.c:1349 is also 0xf6 (specifically APIC IRR for irqs 255 to 224 is 0x400000) which confirms that something has set the IRQ_WORK_VECTOR line prior to the APIC being initialized.
Commit 2383844d4850 ("GHES: Elliminate double-loop in the NMI handler") incorrectly modified the behavior such that the handler returns NMI_HANDLED only if an error was processed, and incorrectly runs the ghes work queue for every NMI.
This patch modifies the ghes_proc_irq_work() to run as it did prior to 2383844d4850 ("GHES: Elliminate double-loop in the NMI handler") by properly returning NMI_HANDLED and only calling the work queue if NMI_HANDLED has been set.
--- drivers/acpi/apei/ghes.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/acpi/apei/ghes.c +4 -3
@@ -847,6 +847,8 @@ static int ghes_notify_nmi(unsigned intif (ghes_read_estatus (ghes,1 )) {ghes_clear_estatus (ghes);continue ; + }else { + ret =NMI_HANDLED ; } sev =ghes_severity (ghes->estatus->error_severity);
@@ -858,12 +860,11 @@ static int ghes_notify_nmi(unsigned int__process_error (ghes);ghes_clear_estatus (ghes); - - ret =NMI_HANDLED ; }#ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG -irq_work_queue (&ghes_proc_irq_work); +if (ret ==NMI_HANDLED ) +irq_work_queue (&ghes_proc_irq_work);#endif atomic_dec (&ghes_in_nmi);return ret;
Greg Kroah-Hartman
maintainerPATCH 44/48 blk-mq: Always schedule hctx->next_cpu
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Krisman Bertazi <[email protected]>
commit c02ebfdddbafa9a6a0f52fbd715e6bfa229af9d3 upstream.
Commit 0e87e58bf60e ("blk-mq: improve warning for running a queue on the wrong CPU") attempts to avoid triggering the WARN_ON in __blk_mq_run_hw_queue when the expected CPU is dead. Problem is, in the last batch execution before round robin, blk_mq_hctx_next_cpu can schedule a dead CPU and also update next_cpu to the next alive CPU in the mask, which will trigger the WARN_ON despite the previous workaround.
The following patch fixes this scenario by always scheduling the value in hctx->next_cpu. This changes the moment when we round-robin the CPU running the hctx, but it really doesn't matter, since it still executes BLK_MQ_CPU_WORK_BATCH times in a row before switching to another CPU.
--- block/blk-mq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
block/blk-mq.c +1 -3
@@ -842,7 +842,7 @@ static int blk_mq_hctx_next_cpu(struct breturn WORK_CPU_UNBOUND ;if (--hctx->next_cpu_batch <=0 ) { -int cpu = hctx->next_cpu, next_cpu; +int next_cpu; next_cpu =cpumask_next (hctx->next_cpu, hctx->cpumask);if (next_cpu >= nr_cpu_ids)
@@ -850,8 +850,6 @@ static int blk_mq_hctx_next_cpu(struct b hctx->next_cpu = next_cpu; hctx->next_cpu_batch =BLK_MQ_CPU_WORK_BATCH ; - -return cpu; }return hctx->next_cpu;
Greg Kroah-Hartman
maintainerPATCH 45/48 bus: vexpress-config: fix device reference leak
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit c090959b9dd8c87703e275079aa4b4a824ba3f8e upstream.
Make sure to drop the reference to the parent device taken by class_find_device() after populating the bus.
--- drivers/bus/vexpress-config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/bus/vexpress-config.c +6 -1
@@ -171,6 +171,7 @@ static int vexpress_config_populate(stru {struct device_node *bridge;struct device *parent; +int ret; bridge =of_parse_phandle (node,"arm,vexpress,config-bridge" ,0 );if (!bridge)
@@ -181,7 +182,11 @@ static int vexpress_config_populate(struif (WARN_ON (!parent))return -ENODEV ; -return of_platform_populate (node,NULL ,NULL , parent); + ret =of_platform_populate (node,NULL ,NULL , parent); + +put_device (parent); + +return ret; }static int __init vexpress_config_init (void )
Greg Kroah-Hartman
maintainerPATCH 46/48 powerpc/ibmebus: Fix further device reference leaks
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 815a7141c4d1b11610dccb7fcbb38633759824f2 upstream.
Make sure to drop any reference taken by bus_find_device() when creating devices during init and driver registration.
--- arch/powerpc/kernel/ibmebus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/ibmebus.c +6 -2
@@ -180,6 +180,7 @@ static int ibmebus_create_device(structstatic int ibmebus_create_devices (const struct of_device_id *matches) {struct device_node *root, *child; +struct device *dev;int ret =0 ; root =of_find_node_by_path ("/" );
@@ -188,9 +189,12 @@ static int ibmebus_create_devices(constif (!of_match_node (matches, child))continue ; -if (bus_find_device (&ibmebus_bus_type,NULL , child, - ibmebus_match_node)) + dev =bus_find_device (&ibmebus_bus_type,NULL , child, + ibmebus_match_node); +if (dev) { +put_device (dev);continue ; + } ret =ibmebus_create_device (child);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 47/48 powerpc/ibmebus: Fix device reference leaks in sysfs interface
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit fe0f3168169f7c34c29b0cf0c489f126a7f29643 upstream.
Make sure to drop any reference taken by bus_find_device() in the sysfs callbacks that are used to create and destroy devices based on device-tree entries.
--- arch/powerpc/kernel/ibmebus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/ibmebus.c +6 -2
@@ -266,6 +266,7 @@ static ssize_t ibmebus_store_probe(struc const char *buf, size_t count) {struct device_node *dn =NULL ; +struct device *dev;char *path;ssize_t rc =0 ;
@@ -273,8 +274,10 @@ static ssize_t ibmebus_store_probe(strucif (!path)return -ENOMEM ; -if (bus_find_device (&ibmebus_bus_type,NULL , path, - ibmebus_match_path)) { + dev =bus_find_device (&ibmebus_bus_type,NULL , path, + ibmebus_match_path); +if (dev) { +put_device (dev);printk (KERN_WARNING "%s: %s has already been probed\n" , __func__, path); rc = -EEXIST ;
@@ -311,6 +314,7 @@ static ssize_t ibmebus_store_remove(struif ((dev =bus_find_device (&ibmebus_bus_type,NULL , path, ibmebus_match_path))) {of_device_unregister (to_platform_device (dev)); +put_device (dev);kfree (path);return count;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.44 release. There are 48 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Jan 20 10:46:08 UTC 2017. Anything received after that time might be too late.
Build results:
total: 149 pass: 149 fail: 0 Qemu test results: total: 115 pass: 115 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.44 release. There are 48 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Jan 20 10:46:08 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.44-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America(Silicon Valley) [email protected]