4.9.210-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.9.210-stable review
This is the start of the stable review cycle for the 4.9.210 release. There are 31 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 Thu, 16 Jan 2020 09:41:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.210-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.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.210-rc1
Florian Westphal <[email protected]>
netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present
Florian Westphal <[email protected]>
netfilter: arp_tables: init netns pointer in xt_tgchk_param struct
Alan Stern <[email protected]>
USB: Fix: Don't skip endpoint descriptors with maxpacket=0
Navid Emamdoost <[email protected]>
rtl8xxxu: prevent leaking urb
Navid Emamdoost <[email protected]>
scsi: bfa: release allocated memory in case of error
Navid Emamdoost <[email protected]>
mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf
Ganapathi Bhat <[email protected]>
mwifiex: fix possible heap overflow in mwifiex_process_country_ie()
Sudip Mukherjee <[email protected]>
tty: always relink the port
Sudip Mukherjee <[email protected]>
tty: link tty and port before configuring it as console
Michael Straube <[email protected]>
staging: rtl8188eu: Add device code for TP-Link TL-WN727N v5.21
Ian Abbott <[email protected]>
staging: comedi: adv_pci1710: fix AI channels 16-31 for PCI-1713
Paul Cercueil <[email protected]>
usb: musb: dma: Correct parameter passed to IRQ handler
Paul Cercueil <[email protected]>
usb: musb: Disable pullup at init
Tony Lindgren <[email protected]>
usb: musb: fix idling for suspend after disconnect interrupt
Daniele Palmas <[email protected]>
USB: serial: option: add ZLP support for 0x1bc7/0x9010
Malcolm Priestley <[email protected]>
staging: vt6656: set usb_set_intfdata on driver fail.
Oliver Hartkopp <[email protected]>
can: can_dropped_invalid_skb(): ensure an initialized headroom in outgoing CAN sk_buffs
Florian Faber <[email protected]>
can: mscan: mscan_rx_poll(): fix rx path lockup when returning from polling to irq mode
Johan Hovold <[email protected]>
can: gs_usb: gs_usb_probe(): use descriptors of current altsetting
Wayne Lin <[email protected]>
drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ
Dmitry Torokhov <[email protected]>
Input: add safety guards to input_set_keycode()
Dmitry Torokhov <[email protected]>
HID: hid-input: clear unmapped usages
Marcel Holtmann <[email protected]>
HID: uhid: Fix returning EPOLLOUT from uhid_char_poll
Alan Stern <[email protected]>
HID: Fix slab-out-of-bounds read in hid_field_extract
Steven Rostedt (VMware) <[email protected]>
tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined
Kaitao Cheng <[email protected]>
kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail
Marcelo Ricardo Leitner <[email protected]>
tcp: minimize false-positives on TCP/GRO check
Takashi Iwai <[email protected]>
ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5
Guenter Roeck <[email protected]>
usb: chipidea: host: Disable port power only if previously enabled
Will Deacon <[email protected]>
chardev: Avoid potential use-after-free in 'chrdev_open()'
Jan Kara <[email protected]>
kobject: Export kobject_get_unless_zero()
-------------
Diffstat:
Makefile | 4 +-- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- drivers/hid/hid-core.c | 6 ++++ drivers/hid/hid-input.c | 16 +++++++--- drivers/hid/uhid.c | 3 +- drivers/input/input.c | 26 ++++++++++------- drivers/net/can/mscan/mscan.c | 21 +++++++------ drivers/net/can/usb/gs_usb.c | 4 +-- drivers/net/wireless/marvell/mwifiex/pcie.c | 4 ++- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 13 +++++++-- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + drivers/scsi/bfa/bfad_attr.c | 4 ++- drivers/staging/comedi/drivers/adv_pci1710.c | 4 +-- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + drivers/staging/vt6656/device.h | 1 + drivers/staging/vt6656/main_usb.c | 1 + drivers/staging/vt6656/wcmd.c | 1 + drivers/tty/serial/serial_core.c | 1 + drivers/usb/chipidea/host.c | 4 ++- drivers/usb/core/config.c | 12 +++++--- drivers/usb/musb/musb_core.c | 11 +++++++ drivers/usb/musb/musbhsdma.c | 2 +- drivers/usb/serial/option.c | 8 +++++ drivers/usb/serial/usb-wwan.h | 1 + drivers/usb/serial/usb_wwan.c | 4 +++ fs/char_dev.c | 2 +- include/linux/can/dev.h | 34 ++++++++++++++++++++++ include/linux/kobject.h | 2 ++ kernel/trace/trace_sched_wakeup.c | 4 ++- kernel/trace/trace_stack.c | 5 ++++ lib/kobject.c | 5 +++- net/ipv4/netfilter/arp_tables.c | 27 ++++++++++------- net/ipv4/tcp_input.c | 14 +++++---- net/netfilter/ipset/ip_set_core.c | 3 +- sound/usb/quirks.c | 1 + 35 files changed, 189 insertions(+), 63 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/31 kobject: Export kobject_get_unless_zero()
From: Jan Kara <[email protected]>
commit c70c176ff8c3ff0ac6ef9a831cd591ea9a66bd1a upstream.
Make the function available for outside use and fortify it against NULL kobject.
--- include/linux/kobject.h | 2 ++ lib/kobject.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/kobject.h +2 -0
@@ -108,6 +108,8 @@ extern int __must_check kobject_rename(sextern int __must_check kobject_move (struct kobject *,struct kobject *);extern struct kobject *kobject_get (struct kobject *kobj); +extern struct kobject *__must_check kobject_get_unless_zero ( +struct kobject *kobj);extern void kobject_put (struct kobject *kobj);extern const void *kobject_namespace (struct kobject *kobj);
lib/kobject.c +4 -1
@@ -599,12 +599,15 @@ struct kobject *kobject_get(struct kobje }EXPORT_SYMBOL (kobject_get); -static struct kobject *__must_check kobject_get_unless_zero (struct kobject *kobj) +struct kobject *__must_check kobject_get_unless_zero (struct kobject *kobj) { +if (!kobj) +return NULL ;if (!kref_get_unless_zero (&kobj->kref)) kobj =NULL ;return kobj; } +EXPORT_SYMBOL (kobject_get_unless_zero);/* * kobject_cleanup - free kobject resources.
Greg Kroah-Hartman
maintainerPATCH 2/31 chardev: Avoid potential use-after-free in chrdev_open()
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 68faa679b8be1a74e6663c21c3a9d25d32f1c079 upstream.
'chrdev_open()' calls 'cdev_get()' to obtain a reference to the 'struct cdev *' stashed in the 'i_cdev' field of the target inode structure. If the pointer is NULL, then it is initialised lazily by looking up the kobject in the 'cdev_map' and so the whole procedure is protected by the 'cdev_lock' spinlock to serialise initialisation of the shared pointer.
Unfortunately, it is possible for the initialising thread to fail *after* installing the new pointer, for example if the subsequent '->open()' call on the file fails. In this case, 'cdev_put()' is called, the reference count on the kobject is dropped and, if nobody else has taken a reference, the release function is called which finally clears 'inode->i_cdev' from 'cdev_purge()' before potentially freeing the object. The problem here is that a racing thread can happily take the 'cdev_lock' and see the non-NULL pointer in the inode, which can result in a refcount increment from zero and a warning:
| ------------[ cut here ]------------ | refcount_t: addition on 0; use-after-free. | WARNING: CPU: 2 PID: 6385 at lib/refcount.c:25 refcount_warn_saturate+0x6d/0xf0 | Modules linked in: | CPU: 2 PID: 6385 Comm: repro Not tainted 5.5.0-rc2+ #22 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 | RIP: 0010:refcount_warn_saturate+0x6d/0xf0 | Code: 05 55 9a 15 01 01 e8 9d aa c8 ff 0f 0b c3 80 3d 45 9a 15 01 00 75 ce 48 c7 c7 00 9c 62 b3 c6 08 | RSP: 0018:ffffb524c1b9bc70 EFLAGS: 00010282 | RAX: 0000000000000000 RBX: ffff9e9da1f71390 RCX: 0000000000000000 | RDX: ffff9e9dbbd27618 RSI: ffff9e9dbbd18798 RDI: ffff9e9dbbd18798 | RBP: 0000000000000000 R08: 000000000000095f R09: 0000000000000039 | R10: 0000000000000000 R11: ffffb524c1b9bb20 R12: ffff9e9da1e8c700 | R13: ffffffffb25ee8b0 R14: 0000000000000000 R15: ffff9e9da1e8c700 | FS: 00007f3b87d26700(0000) GS:ffff9e9dbbd00000(0000) knlGS:0000000000000000 | CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 | CR2: 00007fc16909c000 CR3: 000000012df9c000 CR4: 00000000000006e0 | DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 | DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 | Call Trace: | kobject_get+0x5c/0x60 | cdev_get+0x2b/0x60 | chrdev_open+0x55/0x220 | ? cdev_put.part.3+0x20/0x20 | do_dentry_open+0x13a/0x390 | path_openat+0x2c8/0x1470 | do_filp_open+0x93/0x100 | ? selinux_file_ioctl+0x17f/0x220 | do_sys_open+0x186/0x220 | do_syscall_64+0x48/0x150 | entry_SYSCALL_64_after_hwframe+0x44/0xa9 | RIP: 0033:0x7f3b87efcd0e | Code: 89 54 24 08 e8 a3 f4 ff ff 8b 74 24 0c 48 8b 3c 24 41 89 c0 44 8b 54 24 08 b8 01 01 00 00 89 f4 | RSP: 002b:00007f3b87d259f0 EFLAGS: 00000293 ORIG_RAX: 0000000000000101 | RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3b87efcd0e | RDX: 0000000000000000 RSI: 00007f3b87d25a80 RDI: 00000000ffffff9c | RBP: 00007f3b87d25e90 R08: 0000000000000000 R09: 0000000000000000 | R10: 0000000000000000 R11: 0000000000000293 R12: 00007ffe188f504e | R13: 00007ffe188f504f R14: 00007f3b87d26700 R15: 0000000000000000 | ---[ end trace 24f53ca58db8180a ]---
Since 'cdev_get()' can already fail to obtain a reference, simply move it over to use 'kobject_get_unless_zero()' instead of 'kobject_get()', which will cause the racing thread to return -ENXIO if the initialising thread fails unexpectedly.
--- fs/char_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/char_dev.c +1 -1
@@ -336,7 +336,7 @@ static struct kobject *cdev_get(struct cif (owner && !try_module_get (owner))return NULL ; - kobj =kobject_get (&p->kobj); + kobj =kobject_get_unless_zero (&p->kobj);if (!kobj)module_put (owner);return kobj;
Greg Kroah-Hartman
maintainerPATCH 3/31 usb: chipidea: host: Disable port power only if previously enabled
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
commit c1ffba305dbcf3fb9ca969c20a97acbddc38f8e9 upstream.
On shutdown, ehci_power_off() is called unconditionally to power off each port, even if it was never called to power on the port. For chipidea, this results in a call to ehci_ci_portpower() with a request to power off ports even if the port was never powered on.
This results in the following warning from the regulator code.
WARNING: CPU: 0 PID: 182 at drivers/regulator/core.c:2596 _regulator_disable+0x1a8/0x210 unbalanced disables for usb_otg2_vbus Modules linked in: CPU: 0 PID: 182 Comm: init Not tainted 5.4.6 #1 Hardware name: Freescale i.MX7 Dual (Device Tree) [<c0313658>] (unwind_backtrace) from [<c030d698>] (show_stack+0x10/0x14) [<c030d698>] (show_stack) from [<c1133afc>] (dump_stack+0xe0/0x10c) [<c1133afc>] (dump_stack) from [<c0349098>] (__warn+0xf4/0x10c) [<c0349098>] (__warn) from [<c0349128>] (warn_slowpath_fmt+0x78/0xbc) [<c0349128>] (warn_slowpath_fmt) from [<c09f36ac>] (_regulator_disable+0x1a8/0x210) [<c09f36ac>] (_regulator_disable) from [<c09f374c>] (regulator_disable+0x38/0xe8) [<c09f374c>] (regulator_disable) from [<c0df7bac>] (ehci_ci_portpower+0x38/0xdc) [<c0df7bac>] (ehci_ci_portpower) from [<c0db4fa4>] (ehci_port_power+0x50/0xa4) [<c0db4fa4>] (ehci_port_power) from [<c0db5420>] (ehci_silence_controller+0x5c/0xc4) [<c0db5420>] (ehci_silence_controller) from [<c0db7644>] (ehci_stop+0x3c/0xcc) [<c0db7644>] (ehci_stop) from [<c0d5bdc4>] (usb_remove_hcd+0xe0/0x19c) [<c0d5bdc4>] (usb_remove_hcd) from [<c0df7638>] (host_stop+0x38/0xa8) [<c0df7638>] (host_stop) from [<c0df2f34>] (ci_hdrc_remove+0x44/0xe4)
...
Keeping track of the power enable state avoids the warning and traceback.
--- drivers/usb/chipidea/host.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/chipidea/host.c +3 -1
@@ -37,6 +37,7 @@ static int (*orig_bus_suspend)(struct usstruct ehci_ci_priv {struct regulator *reg_vbus; +bool enabled; };static int ehci_ci_portpower (struct usb_hcd *hcd,int portnum,bool enable)
@@ -48,7 +49,7 @@ static int ehci_ci_portpower(struct usb_int ret =0 ;int port =HCS_N_PORTS (ehci->hcs_params); -if (priv->reg_vbus) { +if (priv->reg_vbus && enable != priv->enabled) {if (port >1 ) {dev_warn (dev,"Not support multi-port regulator control\n" );
@@ -64,6 +65,7 @@ static int ehci_ci_portpower(struct usb_ enable ? "enable" : "disable", ret);return ret; } + priv->enabled = enable; }if (enable && (ci->platdata->phy_mode ==USBPHY_INTERFACE_MODE_HSIC )) {
Greg Kroah-Hartman
maintainerPATCH 4/31 ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 51d4efab7865e6ea6a4ebcd25b3f03c019515c4c upstream.
Bose Companion 5 (with USB ID 05a7:1020) doesn't seem supporting reading back the sample rate, so the existing quirk is needed.
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1141,6 +1141,7 @@ bool snd_usb_get_sample_rate_quirk(struccase USB_ID (0x04D8 ,0xFEEA ):/* Benchmark DAC1 Pre */ case USB_ID (0x0556 ,0x0014 ):/* Phoenix Audio TMX320VC */ case USB_ID (0x05A3 ,0x9420 ):/* ELP HD USB Camera */ +case USB_ID (0x05a7 ,0x1020 ):/* Bose Companion 5 */ case USB_ID (0x074D ,0x3553 ):/* Outlaw RR2150 (Micronas UAC3553B) */ case USB_ID (0x1395 ,0x740a ):/* Sennheiser DECT */ case USB_ID (0x1901 ,0x0191 ):/* GE B850V3 CP2114 audio interface */
Greg Kroah-Hartman
maintainerPATCH 5/31 tcp: minimize false-positives on TCP/GRO check
In reply to Greg Kroah-HartmanFrom: Marcelo Ricardo Leitner <[email protected]>
commit 0b9aefea860063bb39e36bd7fe6c7087fed0ba87 upstream.
Markus Trippelsdorf reported that after commit dcb17d22e1c2 ("tcp: warn on bogus MSS and try to amend it") the kernel started logging the warning for a NIC driver that doesn't even support GRO.
It was diagnosed that it was possibly caused on connections that were using TCP Timestamps but some packets lacked the Timestamps option. As we reduce rcv_mss when timestamps are used, the lack of them would cause the packets to be bigger than expected, although this is a valid case.
As this warning is more as a hint, getting a clean-cut on the threshold is probably not worth the execution time spent on it. This patch thus alleviates the false-positives with 2 quick checks: by accounting for the entire TCP option space and also checking against the interface MTU if it's available.
These changes, specially the MTU one, might mask some real positives, though if they are really happening, it's possible that sooner or later it will be triggered anyway.
--- net/ipv4/tcp_input.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
net/ipv4/tcp_input.c +9 -5
@@ -129,7 +129,8 @@ int sysctl_tcp_invalid_ratelimit __read_#define REXMIT_LOST 1/* retransmit packets marked lost */ #define REXMIT_NEW 2/* FRTO-style transmit of unsent/new packets */ -static void tcp_gro_dev_warn (struct sock *sk,const struct sk_buff *skb) +static void tcp_gro_dev_warn (struct sock *sk,const struct sk_buff *skb, +unsigned int len) {static bool __once__read_mostly ;
@@ -140,8 +141,9 @@ static void tcp_gro_dev_warn(struct sockrcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk), skb->skb_iif); -pr_warn ("%s: Driver has suspect GRO implementation, TCP performance may be compromised.\n" , - dev ? dev->name :"Unknown driver" ); +if (!dev || len >= dev->mtu) +pr_warn ("%s: Driver has suspect GRO implementation, TCP performance may be compromised.\n" , + dev ? dev->name :"Unknown driver" );rcu_read_unlock (); } }
@@ -164,8 +166,10 @@ static void tcp_measure_rcv_mss(struct sif (len >= icsk->icsk_ack.rcv_mss) { icsk->icsk_ack.rcv_mss = min_t(unsigned int, len,tcp_sk (sk)->advmss); -if (unlikely (icsk->icsk_ack.rcv_mss != len)) -tcp_gro_dev_warn (sk, skb); +/* Account for possibly-removed options */ +if (unlikely (len > icsk->icsk_ack.rcv_mss + +MAX_TCP_OPTION_SPACE )) +tcp_gro_dev_warn (sk, skb, len); }else {/* Otherwise, we make more careful check taking into account, * that SACKs block is variable.
Greg Kroah-Hartman
maintainerPATCH 6/31 kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail
In reply to Greg Kroah-HartmanFrom: Kaitao Cheng <[email protected]>
commit 50f9ad607ea891a9308e67b81f774c71736d1098 upstream.
In the function, if register_trace_sched_migrate_task() returns error, sched_switch/sched_wakeup_new/sched_wakeup won't unregister. That is why fail_deprobe_sched_switch was added.
--- kernel/trace/trace_sched_wakeup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_sched_wakeup.c +3 -1
@@ -625,7 +625,7 @@ static void start_wakeup_tracer(struct tif (ret) {pr_info ("wakeup trace: Couldn't activate tracepoint" " probe to kernel_sched_migrate_task\n" ); -return ; + goto fail_deprobe_sched_switch; }wakeup_reset (tr);
@@ -643,6 +643,8 @@ static void start_wakeup_tracer(struct tprintk (KERN_ERR "failed to start wakeup tracer\n" );return ; +fail_deprobe_sched_switch: +unregister_trace_sched_switch (probe_wakeup_sched_switch,NULL ); fail_deprobe_wake_new:unregister_trace_sched_wakeup_new (probe_wakeup,NULL ); fail_deprobe:
Greg Kroah-Hartman
maintainerPATCH 7/31 tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit b8299d362d0837ae39e87e9019ebe6b736e0f035 upstream.
On some archs with some configurations, MCOUNT_INSN_SIZE is not defined, and this makes the stack tracer fail to compile. Just define it to zero in this case.
--- kernel/trace/trace_stack.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/trace/trace_stack.c +5 -0
@@ -201,6 +201,11 @@ check_stack(unsigned long ip, unsigned llocal_irq_restore (flags); } +/* Some archs may not define MCOUNT_INSN_SIZE */ +#ifndef MCOUNT_INSN_SIZE +# define MCOUNT_INSN_SIZE 0 +#endif +static void stack_trace_call (unsigned long ip,unsigned long parent_ip,struct ftrace_ops *op,struct pt_regs *pt_regs)
Greg Kroah-Hartman
maintainerPATCH 8/31 HID: Fix slab-out-of-bounds read in hid_field_extract
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 8ec321e96e056de84022c032ffea253431a83c3c upstream.
The syzbot fuzzer found a slab-out-of-bounds bug in the HID report handler. The bug was caused by a report descriptor which included a field with size 12 bits and count 4899, for a total size of 7349 bytes.
The usbhid driver uses at most a single-page 4-KB buffer for reports. In the test there wasn't any problem about overflowing the buffer, since only one byte was received from the device. Rather, the bug occurred when the HID core tried to extract the data from the report fields, which caused it to try reading data beyond the end of the allocated buffer.
This patch fixes the problem by rejecting any report whose total length exceeds the HID_MAX_BUFFER_SIZE limit (minus one byte to allow for a possible report index). In theory a device could have a report longer than that, but if there was such a thing we wouldn't handle it correctly anyway.
--- drivers/hid/hid-core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hid/hid-core.c +6 -0
@@ -269,6 +269,12 @@ static int hid_add_field(struct hid_pars offset = report->size; report->size += parser->global.report_size * parser->global.report_count; +/* Total size check: Allow for possible report index byte */ +if (report->size > (HID_MAX_BUFFER_SIZE -1 ) <<3 ) { +hid_err (parser->device,"report is too long\n" ); +return -1 ; + } +if (!parser->local.usage_index)/* Ignore padding fields */ return 0 ;
Greg Kroah-Hartman
maintainerPATCH 9/31 HID: uhid: Fix returning EPOLLOUT from uhid_char_poll
In reply to Greg Kroah-HartmanFrom: Marcel Holtmann <[email protected]>
commit be54e7461ffdc5809b67d2aeefc1ddc9a91470c7 upstream.
Always return EPOLLOUT from uhid_char_poll to allow polling /dev/uhid for writable state.
--- drivers/hid/uhid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/uhid.c +2 -1
@@ -26,6 +26,7 @@#include <linux/uhid.h> #include <linux/wait.h> #include <linux/uaccess.h> +#include <linux/eventpoll.h> #define UHID_NAME "uhid"#define UHID_BUFSIZE 32
@@ -774,7 +775,7 @@ static unsigned int uhid_char_poll(strucif (uhid->head != uhid->tail)return POLLIN |POLLRDNORM ; -return 0 ; +return EPOLLOUT |EPOLLWRNORM ; }static const struct file_operations uhid_fops = {
Greg Kroah-Hartman
maintainerPATCH 10/31 HID: hid-input: clear unmapped usages
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
commit 4f3882177240a1f55e45a3d241d3121341bead78 upstream.
We should not be leaving half-mapped usages with potentially invalid keycodes, as that may confuse hidinput_find_key() when the key is located by index, which may end up feeding way too large keycode into the VT keyboard handler and cause OOB write there:
BUG: KASAN: global-out-of-bounds in clear_bit include/asm-generic/bitops-instrumented.h:56 [inline] BUG: KASAN: global-out-of-bounds in kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline] BUG: KASAN: global-out-of-bounds in kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495 Write of size 8 at addr ffffffff89a1b2d8 by task syz-executor108/1722 ... kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline] kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495 input_to_handler+0x3b6/0x4c0 drivers/input/input.c:118 input_pass_values.part.0+0x2e3/0x720 drivers/input/input.c:145 input_pass_values drivers/input/input.c:949 [inline] input_set_keycode+0x290/0x320 drivers/input/input.c:954 evdev_handle_set_keycode_v2+0xc4/0x120 drivers/input/evdev.c:882 evdev_do_ioctl drivers/input/evdev.c:1150 [inline]
--- drivers/hid/hid-input.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/hid/hid-input.c +12 -4
@@ -1026,9 +1026,15 @@ static void hidinput_configure_usage(str } mapped: -if (device->driver->input_mapped && device->driver->input_mapped (device, - hidinput, field, usage, &bit, &max) <0 ) - goto ignore; +if (device->driver->input_mapped && + device->driver->input_mapped (device, hidinput, field, usage, + &bit, &max) <0 ) { +/* +* The driver indicated that no further generic handling +* of the usage is desired. +*/ +return ; + }set_bit (usage->type, input->evbit);
@@ -1087,9 +1093,11 @@ mapped:set_bit (MSC_SCAN , input->mscbit); } -ignore:return ; +ignore: + usage->type =0 ; + usage->code =0 ; }void hidinput_hid_event (struct hid_device *hid,struct hid_field *field,struct hid_usage *usage,__s32 value)
Greg Kroah-Hartman
maintainerPATCH 11/31 Input: add safety guards to input_set_keycode()
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
commit cb222aed03d798fc074be55e59d9a112338ee784 upstream.
If we happen to have a garbage in input device's keycode table with values too big we'll end up doing clear_bit() with offset way outside of our bitmaps, damaging other objects within an input device or even outside of it. Let's add sanity checks to the returned old keycodes.
--- drivers/input/input.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/input/input.c +16 -10
@@ -850,16 +850,18 @@ static int input_default_setkeycode(stru } } -__clear_bit (*old_keycode, dev->keybit); -__set_bit (ke->keycode, dev->keybit); - -for (i =0 ; i < dev->keycodemax; i++) { -if (input_fetch_keycode (dev, i) == *old_keycode) { -__set_bit (*old_keycode, dev->keybit); -break ;/* Setting the bit twice is useless, so break */ +if (*old_keycode <=KEY_MAX ) { +__clear_bit (*old_keycode, dev->keybit); +for (i =0 ; i < dev->keycodemax; i++) { +if (input_fetch_keycode (dev, i) == *old_keycode) { +__set_bit (*old_keycode, dev->keybit); +/* Setting the bit twice is useless, so break */ +break ; + } } } +__set_bit (ke->keycode, dev->keybit);return 0 ; }
@@ -915,9 +917,13 @@ int input_set_keycode(struct input_dev ** Simulate keyup event if keycode is not present * in the keymap anymore */ -if (test_bit (EV_KEY , dev->evbit) && - !is_event_supported (old_keycode, dev->keybit,KEY_MAX ) && -__test_and_clear_bit (old_keycode, dev->key)) { +if (old_keycode >KEY_MAX ) { +dev_warn (dev->dev.parent ?: &dev->dev, +"%s: got too big old keycode %#x\n" , + __func__, old_keycode); + }else if (test_bit (EV_KEY , dev->evbit) && + !is_event_supported (old_keycode, dev->keybit,KEY_MAX ) && +__test_and_clear_bit (old_keycode, dev->key)) {struct input_value vals[] = { {EV_KEY , old_keycode,0 }, input_value_sync
Greg Kroah-Hartman
maintainerPATCH 12/31 drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ
In reply to Greg Kroah-HartmanFrom: Wayne Lin <[email protected]>
commit c4e4fccc5d52d881afaac11d3353265ef4eccb8b upstream.
[Why]
According to DP spec, it should shift left 4 digits for NO_STOP_BIT in REMOTE_I2C_READ message. Not 5 digits.
In current code, NO_STOP_BIT is always set to zero which means I2C master is always generating a I2C stop at the end of each I2C write transaction while handling REMOTE_I2C_READ sideband message. This issue might have the generated I2C signal not meeting the requirement. Take random read in I2C for instance, I2C master should generate a repeat start to start to read data after writing the read address. This issue will cause the I2C master to generate a stop-start rather than a re-start which is not expected in I2C random read.
[How]
Correct the shifting value of NO_STOP_BIT for DP_REMOTE_I2C_READ case in drm_dp_encode_sideband_req().
Changes since v1:(https://patchwork.kernel.org/patch/11312667/)
* Add more descriptions in commit and cc to stable
--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -272,7 +272,7 @@ static void drm_dp_encode_sideband_req(smemcpy (&buf[idx], req->u.i2c_read.transactions[i].bytes, req->u.i2c_read.transactions[i].num_bytes); idx += req->u.i2c_read.transactions[i].num_bytes; - buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit &0x1 ) <<5 ; + buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit &0x1 ) <<4 ; buf[idx] |= (req->u.i2c_read.transactions[i].i2c_transaction_delay &0xf ); idx++; }
Greg Kroah-Hartman
maintainerPATCH 13/31 can: gs_usb: gs_usb_probe(): use descriptors of current altsetting
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 2f361cd9474ab2c4ab9ac8db20faf81e66c6279b upstream.
Make sure to always use the descriptors of the current alternate setting to avoid future issues when accessing fields that may differ between settings.
--- drivers/net/can/usb/gs_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/usb/gs_usb.c +2 -2
@@ -927,7 +927,7 @@ static int gs_usb_probe(struct usb_interGS_USB_BREQ_HOST_FORMAT ,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_INTERFACE ,1 , - intf->altsetting[0 ].desc.bInterfaceNumber, + intf->cur_altsetting->desc.bInterfaceNumber, hconf,sizeof (*hconf), 1000);
@@ -950,7 +950,7 @@ static int gs_usb_probe(struct usb_interGS_USB_BREQ_DEVICE_CONFIG ,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_INTERFACE ,1 , - intf->altsetting[0 ].desc.bInterfaceNumber, + intf->cur_altsetting->desc.bInterfaceNumber, dconf,sizeof (*dconf), 1000);
Greg Kroah-Hartman
maintainerPATCH 14/31 can: mscan: mscan_rx_poll(): fix rx path lockup when returning from polling to irq mode
In reply to Greg Kroah-HartmanFrom: Florian Faber <[email protected]>
commit 2d77bd61a2927be8f4e00d9478fe6996c47e8d45 upstream.
Under load, the RX side of the mscan driver can get stuck while TX still works. Restarting the interface locks up the system. This behaviour could be reproduced reliably on a MPC5121e based system.
The patch fixes the return value of the NAPI polling function (should be the number of processed packets, not constant 1) and the condition under which IRQs are enabled again after polling is finished.
With this patch, no more lockups were observed over a test period of ten days.
--- drivers/net/can/mscan/mscan.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/net/can/mscan/mscan.c +10 -11
@@ -392,13 +392,12 @@ static int mscan_rx_poll(struct napi_strstruct net_device *dev = napi->dev;struct mscan_regs __iomem *regs = priv->reg_base;struct net_device_stats *stats = &dev->stats; -int npackets =0 ; -int ret =1 ; +int work_done =0 ;struct sk_buff *skb;struct can_frame *frame;u8 canrflg; -while (npackets < quota) { +while (work_done < quota) { canrflg =in_8 (®s->canrflg);if (!(canrflg & (MSCAN_RXF |MSCAN_ERR_IF )))break ;
@@ -419,18 +418,18 @@ static int mscan_rx_poll(struct napi_str stats->rx_packets++; stats->rx_bytes += frame->can_dlc; - npackets++; + work_done++;netif_receive_skb (skb); } -if (!(in_8 (®s->canrflg) & (MSCAN_RXF |MSCAN_ERR_IF ))) { -napi_complete (&priv->napi); -clear_bit (F_RX_PROGRESS , &priv->flags); -if (priv->can.state <CAN_STATE_BUS_OFF ) -out_8 (®s->canrier, priv->shadow_canrier); - ret =0 ; +if (work_done < quota) { +if (likely (napi_complete_done (&priv->napi, work_done))) { +clear_bit (F_RX_PROGRESS , &priv->flags); +if (priv->can.state <CAN_STATE_BUS_OFF ) +out_8 (®s->canrier, priv->shadow_canrier); + } } -return ret; +return work_done; }static irqreturn_t mscan_isr (int irq,void *dev_id)
Greg Kroah-Hartman
maintainerPATCH 15/31 can: can_dropped_invalid_skb(): ensure an initialized headroom in outgoing CAN sk_buffs
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
commit e7153bf70c3496bac00e7e4f395bb8d8394ac0ea upstream.
KMSAN sysbot detected a read access to an untinitialized value in the headroom of an outgoing CAN related sk_buff. When using CAN sockets this area is filled appropriately - but when using a packet socket this initialization is missing.
The problematic read access occurs in the CAN receive path which can only be triggered when the sk_buff is sent through a (virtual) CAN interface. So we check in the sending path whether we need to perform the missing initializations.
--- include/linux/can/dev.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
include/linux/can/dev.h +34 -0
@@ -17,6 +17,7 @@#include <linux/can/error.h> #include <linux/can/led.h> #include <linux/can/netlink.h> +#include <linux/can/skb.h> #include <linux/netdevice.h> /*
@@ -81,6 +82,36 @@ struct can_priv {#define get_can_dlc (i) (min_t(__u8, (i), CAN_MAX_DLC))#define get_canfd_dlc (i) (min_t(__u8, (i), CANFD_MAX_DLC)) +/* Check for outgoing skbs that have not been created by the CAN subsystem */ +static inline bool can_skb_headroom_valid (struct net_device *dev, +struct sk_buff *skb) +{ +/* af_packet creates a headroom of HH_DATA_MOD bytes which is fine */ +if (WARN_ON_ONCE (skb_headroom (skb) <sizeof (struct can_skb_priv ))) +return false; + +/* af_packet does not apply CAN skb specific settings */ +if (skb->ip_summed ==CHECKSUM_NONE ) { +/* init headroom */ +can_skb_prv (skb)->ifindex = dev->ifindex; +can_skb_prv (skb)->skbcnt =0 ; + + skb->ip_summed =CHECKSUM_UNNECESSARY ; + +/* preform proper loopback on capable devices */ +if (dev->flags &IFF_ECHO ) + skb->pkt_type =PACKET_LOOPBACK ; +else + skb->pkt_type =PACKET_HOST ; + +skb_reset_mac_header (skb); +skb_reset_network_header (skb); +skb_reset_transport_header (skb); + } + +return true; +} +/* Drop a given socketbuffer if it does not contain a valid CAN frame. */ static inline bool can_dropped_invalid_skb (struct net_device *dev,struct sk_buff *skb)
@@ -98,6 +129,9 @@ static inline bool can_dropped_invalid_s }else goto inval_skb; +if (!can_skb_headroom_valid (dev, skb)) + goto inval_skb; +return false; inval_skb:
Greg Kroah-Hartman
maintainerPATCH 16/31 staging: vt6656: set usb_set_intfdata on driver fail.
In reply to Greg Kroah-HartmanFrom: Malcolm Priestley <[email protected]>
commit c0bcf9f3f5b661d4ace2a64a79ef661edd2a4dc8 upstream.
intfdata will contain stale pointer when the device is detached after failed initialization when referenced in vt6656_disconnect
Provide driver access to it here and NULL it.
--- drivers/staging/vt6656/device.h | 1 + drivers/staging/vt6656/main_usb.c | 1 + drivers/staging/vt6656/wcmd.c | 1 + 3 files changed, 3 insertions(+)
drivers/staging/vt6656/device.h +1 -0
@@ -269,6 +269,7 @@ struct vnt_private {u8 mac_hw;/* netdev */ struct usb_device *usb; +struct usb_interface *intf;u64 tsf_time;u8 rx_rate;
drivers/staging/vt6656/main_usb.c +1 -0
@@ -972,6 +972,7 @@ vt6656_probe(struct usb_interface *intf, priv = hw->priv; priv->hw = hw; priv->usb = udev; + priv->intf = intf;vnt_set_options (priv);
drivers/staging/vt6656/wcmd.c +1 -0
@@ -110,6 +110,7 @@ void vnt_run_command(struct work_structif (vnt_init (priv)) {/* If fail all ends TODO retry */ dev_err (&priv->usb->dev,"failed to start\n" ); +usb_set_intfdata (priv->intf,NULL );ieee80211_free_hw (priv->hw);return ; }
Greg Kroah-Hartman
maintainerPATCH 17/31 USB: serial: option: add ZLP support for 0x1bc7/0x9010
In reply to Greg Kroah-HartmanFrom: Daniele Palmas <[email protected]>
commit 2438c3a19dec5e98905fd3ffcc2f24716aceda6b upstream.
Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet to be sent if out data size is is equal to the endpoint max size.
--- drivers/usb/serial/option.c | 8 ++++++++ drivers/usb/serial/usb-wwan.h | 1 + drivers/usb/serial/usb_wwan.c | 4 ++++ 3 files changed, 13 insertions(+)
drivers/usb/serial/option.c +8 -0
@@ -566,6 +566,9 @@ static void option_instat_callback(struc/* Interface is reserved */ #define RSVD (ifnum) ((BIT(ifnum) & 0xff) << 0) +/* Device needs ZLP */ +#define ZLP BIT(17) +static const struct usb_device_id option_ids[] = { {USB_DEVICE (OPTION_VENDOR_ID ,OPTION_PRODUCT_COLT ) },
@@ -1193,6 +1196,8 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */ .driver_info = NCTRL(0) }, + { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ + .driver_info = NCTRL(0) | ZLP }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), .driver_info = RSVD(1) },
@@ -2097,6 +2102,9 @@ static int option_attach(struct usb_seriif (!(device_flags &NCTRL (iface_desc->bInterfaceNumber))) data->use_send_setup =1 ; +if (device_flags &ZLP ) + data->use_zlp =1 ; +spin_lock_init (&data->susp_lock);usb_set_serial_data (serial, data);
drivers/usb/serial/usb-wwan.h +1 -0
@@ -35,6 +35,7 @@ struct usb_wwan_intf_private {spinlock_t susp_lock; unsigned int suspended:1; unsigned int use_send_setup:1; + unsigned int use_zlp:1;int in_flight;unsigned int open_ports;void *private;
drivers/usb/serial/usb_wwan.c +4 -0
@@ -495,6 +495,7 @@ static struct urb *usb_wwan_setup_urb(st void (*callback) (struct urb *)) {struct usb_serial *serial = port->serial; +struct usb_wwan_intf_private *intfdata =usb_get_serial_data (serial);struct urb *urb; urb =usb_alloc_urb (0 ,GFP_KERNEL );/* No ISO */
@@ -505,6 +506,9 @@ static struct urb *usb_wwan_setup_urb(stusb_sndbulkpipe (serial->dev, endpoint) | dir, buf, len, callback, ctx); +if (intfdata->use_zlp && dir ==USB_DIR_OUT ) + urb->transfer_flags |=URB_ZERO_PACKET ; +return urb; }
Greg Kroah-Hartman
maintainerPATCH 18/31 usb: musb: fix idling for suspend after disconnect interrupt
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
commit 5fbf7a2534703fd71159d3d71504b0ad01b43394 upstream.
When disconnected as USB B-device, suspend interrupt should come before diconnect interrupt, because the DP/DM pins are shorter than the VBUS/GND pins on the USB connectors. But we sometimes get a suspend interrupt after disconnect interrupt. In that case we have devctl set to 99 with VBUS still valid and musb_pm_runtime_check_session() wrongly thinks we have an active session. We have no other interrupts after disconnect coming in this case at least with the omap2430 glue.
Let's fix the issue by checking the interrupt status again with delayed work for the devctl 99 case. In the suspend after disconnect case the devctl session bit has cleared by then and musb can idle. For a typical USB B-device connect case we just continue with normal interrupts.
--- drivers/usb/musb/musb_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/musb/musb_core.c +8 -0
@@ -1832,6 +1832,9 @@ static const struct attribute_group musb#define MUSB_QUIRK_B_INVALID_VBUS_91 (MUSB_DEVCTL_BDEVICE | \ (2 << MUSB_DEVCTL_VBUS_SHIFT) | \ MUSB_DEVCTL_SESSION) +#define MUSB_QUIRK_B_DISCONNECT_99 (MUSB_DEVCTL_BDEVICE | \ + (3 << MUSB_DEVCTL_VBUS_SHIFT) | \ + MUSB_DEVCTL_SESSION)#define MUSB_QUIRK_A_DISCONNECT_19 ((3 << MUSB_DEVCTL_VBUS_SHIFT) | \ MUSB_DEVCTL_SESSION)
@@ -1854,6 +1857,11 @@ static void musb_pm_runtime_check_sessio s =MUSB_DEVCTL_FSDEV |MUSB_DEVCTL_LSDEV |MUSB_DEVCTL_HR ;switch (devctl & ~s) { +case MUSB_QUIRK_B_DISCONNECT_99 : +musb_dbg (musb,"Poll devctl in case of suspend after disconnect\n" ); +schedule_delayed_work (&musb->irq_work, +msecs_to_jiffies (1000 )); +break ;case MUSB_QUIRK_B_INVALID_VBUS_91 :if (musb->quirk_retries--) { musb_dbg(musb,
Greg Kroah-Hartman
maintainerPATCH 19/31 usb: musb: Disable pullup at init
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit 96a0c12843109e5c4d5eb1e09d915fdd0ce31d25 upstream.
The pullup may be already enabled before the driver is initialized. This happens for instance on JZ4740.
It has to be disabled at init time, as we cannot guarantee that a gadget driver will be bound to the UDC.
--- drivers/usb/musb/musb_core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/musb/musb_core.c +3 -0
@@ -2317,6 +2317,9 @@ musb_init_controller(struct device *dev,musb_platform_disable (musb);musb_generic_disable (musb); +/* MUSB_POWER_SOFTCONN might be already set, JZ4740 does this. */ +musb_writeb (musb->mregs,MUSB_POWER ,0 ); +/* Init IRQ workqueue before request_irq */ INIT_DELAYED_WORK (&musb->irq_work, musb_irq_work);INIT_DELAYED_WORK (&musb->deassert_reset_work, musb_deassert_reset);
Greg Kroah-Hartman
maintainerPATCH 20/31 usb: musb: dma: Correct parameter passed to IRQ handler
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit c80d0f4426c7fdc7efd6ae8d8b021dcfc89b4254 upstream.
The IRQ handler was passed a pointer to a struct dma_controller, but the argument was then casted to a pointer to a struct musb_dma_controller.
--- drivers/usb/musb/musbhsdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/musbhsdma.c +1 -1
@@ -399,7 +399,7 @@ struct dma_controller *musbhs_dma_contro controller->controller.channel_abort = dma_channel_abort;if (request_irq (irq, dma_controller_irq,0 , -dev_name (musb->controller), &controller->controller)) { +dev_name (musb->controller), controller)) {dev_err (dev,"request_irq %d failed!\n" , irq);musb_dma_controller_destroy (&controller->controller);
Greg Kroah-Hartman
maintainerPATCH 21/31 staging: comedi: adv_pci1710: fix AI channels 16-31 for PCI-1713
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit a9d3a9cedc1330c720e0ddde1978a8e7771da5ab upstream.
The Advantech PCI-1713 has 32 analog input channels, but an incorrect bit-mask in the definition of the PCI171X_MUX_CHANH(x) and PCI171X_MUX_CHANL(x)` macros is causing channels 16 to 31 to be aliases of channels 0 to 15. Change the bit-mask value from 0xf to 0xff to fix it. Note that the channel numbers will have been range checked already, so the bit-mask isn't really needed.
--- drivers/staging/comedi/drivers/adv_pci1710.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/adv_pci1710.c +2 -2
@@ -45,8 +45,8 @@#define PCI171X_RANGE_UNI BIT(4)#define PCI171X_RANGE_GAIN (x) (((x) & 0x7) << 0)#define PCI171X_MUX_REG 0x04/* W: A/D multiplexor control */ -#define PCI171X_MUX_CHANH (x) (((x) & 0xf) << 8) -#define PCI171X_MUX_CHANL (x) (((x) & 0xf) << 0) +#define PCI171X_MUX_CHANH (x) (((x) & 0xff) << 8) +#define PCI171X_MUX_CHANL (x) (((x) & 0xff) << 0)#define PCI171X_MUX_CHAN (x) (PCI171X_MUX_CHANH(x) | PCI171X_MUX_CHANL(x))#define PCI171X_STATUS_REG 0x06/* R: status register */ #define PCI171X_STATUS_IRQ BIT(11)/* 1=IRQ occurred */
Greg Kroah-Hartman
maintainerPATCH 22/31 staging: rtl8188eu: Add device code for TP-Link TL-WN727N v5.21
In reply to Greg Kroah-HartmanFrom: Michael Straube <[email protected]>
commit 58dcc5bf4030cab548d5c98cd4cd3632a5444d5a upstream.
This device was added to the stand-alone driver on github. Add it to the staging driver as well.
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -0
@@ -45,6 +45,7 @@ static struct usb_device_id rtw_usb_id_t {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ + {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ {} /* Terminating entry */
Greg Kroah-Hartman
maintainerPATCH 23/31 tty: link tty and port before configuring it as console
In reply to Greg Kroah-HartmanFrom: Sudip Mukherjee <[email protected]>
commit fb2b90014d782d80d7ebf663e50f96d8c507a73c upstream.
There seems to be a race condition in tty drivers and I could see on many boot cycles a NULL pointer dereference as tty_init_dev() tries to do 'tty->port->itty = tty' even though tty->port is NULL. 'tty->port' will be set by the driver and if the driver has not yet done it before we open the tty device we can get to this situation. By adding some extra debug prints, I noticed that:
6.650130: uart_add_one_port
6.663849: register_console
6.664846: tty_open
6.674391: tty_init_dev
6.675456: tty_port_link_device
uart_add_one_port() registers the console, as soon as it registers, the userspace tries to use it and that leads to tty_open() but uart_add_one_port() has not yet done tty_port_link_device() and so tty->port is not yet configured when control reaches tty_init_dev().
Further look into the code and tty_port_link_device() is done by uart_add_one_port(). After registering the console uart_add_one_port() will call tty_port_register_device_attr_serdev() and tty_port_link_device() is called from this.
Call add tty_port_link_device() before uart_configure_port() is done and add a check in tty_port_link_device() so that it only links the port if it has not been done yet.
--- drivers/tty/serial/serial_core.c | 1 + drivers/tty/tty_port.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/serial_core.c +1 -0
@@ -2795,6 +2795,7 @@ int uart_add_one_port(struct uart_driverif (uport->cons && uport->dev)of_console_check (uport->dev->of_node, uport->cons->name, uport->line); +tty_port_link_device (port, drv->tty_driver, uport->line);uart_configure_port (drv, state, uport); port->console =uart_console (uport);
drivers/tty/tty_port.c +2 -1
@@ -48,7 +48,8 @@ void tty_port_link_device(struct tty_por {if (WARN_ON (index >= driver->num))return ; - driver->ports[index] = port; +if (!driver->ports[index]) + driver->ports[index] = port; }EXPORT_SYMBOL_GPL (tty_port_link_device);
Greg Kroah-Hartman
maintainerPATCH 24/31 tty: always relink the port
In reply to Greg Kroah-HartmanFrom: Sudip Mukherjee <[email protected]>
commit 273f632912f1b24b642ba5b7eb5022e43a72f3b5 upstream.
If the serial device is disconnected and reconnected, it re-enumerates properly but does not link it. fwiw, linking means just saving the port index, so allow it always as there is no harm in saving the same value again even if it tries to relink with the same port.
--- drivers/tty/tty_port.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/tty_port.c +1 -2
@@ -48,8 +48,7 @@ void tty_port_link_device(struct tty_por {if (WARN_ON (index >= driver->num))return ; -if (!driver->ports[index]) - driver->ports[index] = port; + driver->ports[index] = port; }EXPORT_SYMBOL_GPL (tty_port_link_device);
Greg Kroah-Hartman
maintainerPATCH 25/31 mwifiex: fix possible heap overflow in mwifiex_process_country_ie()
In reply to Greg Kroah-HartmanFrom: Ganapathi Bhat <[email protected]>
commit 3d94a4a8373bf5f45cf5f939e88b8354dbf2311b upstream.
mwifiex_process_country_ie() function parse elements of bss descriptor in beacon packet. When processing WLAN_EID_COUNTRY element, there is no upper limit check for country_ie_len before calling memcpy. The destination buffer domain_info->triplet is an array of length MWIFIEX_MAX_TRIPLET_802_11D(83). The remote attacker can build a fake AP with the same ssid as real AP, and send malicous beacon packet with long WLAN_EID_COUNTRY elemen (country_ie_len > 83). Attacker can force STA connect to fake AP on a different channel. When the victim STA connects to fake AP, will trigger the heap buffer overflow. Fix this by checking for length and if found invalid, don not connect to the AP.
This fix addresses CVE-2019-14895.
--- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +11 -2
@@ -271,6 +271,14 @@ static int mwifiex_process_country_ie(st "11D: skip setting domain info in FW\n");return 0 ; } + +if (country_ie_len > + (IEEE80211_COUNTRY_STRING_LEN +MWIFIEX_MAX_TRIPLET_802_11D )) { +mwifiex_dbg (priv->adapter,ERROR , +"11D: country_ie_len overflow!, deauth AP\n" ); +return -EINVAL ; + } +memcpy (priv->adapter->country_code, &country_ie[2 ],2 ); domain_info->country_code[0 ] = country_ie[2 ];
@@ -314,8 +322,9 @@ int mwifiex_bss_start(struct mwifiex_pri priv->scan_block = false;if (bss) { -if (adapter->region_code ==0x00 ) -mwifiex_process_country_ie (priv, bss); +if (adapter->region_code ==0x00 && +mwifiex_process_country_ie (priv, bss)) +return -EINVAL ;/* Allocate and fill new bss descriptor */ bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
Greg Kroah-Hartman
maintainerPATCH 26/31 mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit db8fd2cde93227e566a412cf53173ffa227998bc upstream.
In mwifiex_pcie_alloc_cmdrsp_buf, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release is added.
--- drivers/net/wireless/marvell/mwifiex/pcie.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +3 -1
@@ -976,8 +976,10 @@ static int mwifiex_pcie_alloc_cmdrsp_buf }skb_put (skb,MWIFIEX_UPLD_SIZE );if (mwifiex_map_pci_memory (adapter, skb,MWIFIEX_UPLD_SIZE , -PCI_DMA_FROMDEVICE )) +PCI_DMA_FROMDEVICE )) { +kfree_skb (skb);return -1 ; + } card->cmdrsp_buf = skb;
Greg Kroah-Hartman
maintainerPATCH 27/31 scsi: bfa: release allocated memory in case of error
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit 0e62395da2bd5166d7c9e14cbc7503b256a34cb0 upstream.
In bfad_im_get_stats if bfa_port_get_stats fails, allocated memory needs to be released.
--- drivers/scsi/bfa/bfad_attr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/bfa/bfad_attr.c +3 -1
@@ -283,8 +283,10 @@ bfad_im_get_stats(struct Scsi_Host *shos rc =bfa_port_get_stats (BFA_FCPORT (&bfad->bfa), fcstats, bfad_hcb_comp, &fcomp);spin_unlock_irqrestore (&bfad->bfad_lock, flags); -if (rc !=BFA_STATUS_OK ) +if (rc !=BFA_STATUS_OK ) { +kfree (fcstats);return NULL ; + }wait_for_completion (&fcomp.comp);
Greg Kroah-Hartman
maintainerPATCH 28/31 rtl8xxxu: prevent leaking urb
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit a2cdd07488e666aa93a49a3fc9c9b1299e27ef3c upstream.
In rtl8xxxu_submit_int_urb if usb_submit_urb fails the allocated urb should be released.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +1 -0
@@ -5422,6 +5422,7 @@ static int rtl8xxxu_submit_int_urb(struc ret =usb_submit_urb (urb,GFP_KERNEL );if (ret) {usb_unanchor_urb (urb); +usb_free_urb (urb); goto error; }
Greg Kroah-Hartman
maintainerPATCH 29/31 USB: Fix: Dont skip endpoint descriptors with maxpacket=0
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 2548288b4fb059b2da9ceada172ef763077e8a59 upstream.
It turns out that even though endpoints with a maxpacket length of 0 aren't useful for data transfer, the descriptors do serve other purposes. In particular, skipping them will also skip over other class-specific descriptors for classes such as UVC. This unexpected side effect has caused some UVC cameras to stop working.
In addition, the USB spec requires that when isochronous endpoint descriptors are present in an interface's altsetting 0 (which is true on some devices), the maxpacket size _must_ be set to 0. Warning about such things seems like a bad idea.
This patch updates an earlier commit which would log a warning and skip these endpoint descriptors. Now we only log a warning, and we don't even do that for isochronous endpoints in altsetting 0.
We don't need to worry about preventing endpoints with maxpacket = 0 from ever being used for data transfers; usb_submit_urb() already checks for this.
--- drivers/usb/core/config.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/usb/core/config.c +8 -4
@@ -387,12 +387,16 @@ static int usb_parse_endpoint(struct dev endpoint->desc.wMaxPacketSize =cpu_to_le16 (8 ); } -/* Validate the wMaxPacketSize field */ +/* +* Validate the wMaxPacketSize field. +* Some devices have isochronous endpoints in altsetting 0; +* the USB-2 spec requires such endpoints to have wMaxPacketSize = 0 +* (see the end of section 5.6.3), so don't warn about them. +*/ maxp =usb_endpoint_maxp (&endpoint->desc); -if (maxp ==0 ) { -dev_warn (ddev,"config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n" , +if (maxp ==0 && !(usb_endpoint_xfer_isoc (d) && asnum ==0 )) { +dev_warn (ddev,"config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n" , cfgno, inum, asnum, d->bEndpointAddress); - goto skip_to_next_endpoint_or_interface_descriptor; }/* Find the highest legal maxpacket size for this endpoint */
Greg Kroah-Hartman
maintainerPATCH 30/31 netfilter: arp_tables: init netns pointer in xt_tgchk_param struct
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit 1b789577f655060d98d20ed0c6f9fbd469d6ba63 upstream.
We get crash when the targets checkentry function tries to make use of the network namespace pointer for arptables.
When the net pointer got added back in 2010, only ip/ip6/ebtables were changed to initialize it, so arptables has this set to NULL.
This isn't a problem for normal arptables because no existing arptables target has a checkentry function that makes use of par->net.
However, direct users of the setsockopt interface can provide any target they want as long as its registered for ARP or UNPSEC protocols.
syzkaller managed to send a semi-valid arptables rule for RATEEST target which is enough to trigger NULL deref:
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN RIP: xt_rateest_tg_checkentry+0x11d/0xb40 net/netfilter/xt_RATEEST.c:109 [..] xt_check_target+0x283/0x690 net/netfilter/x_tables.c:1019 check_target net/ipv4/netfilter/arp_tables.c:399 [inline] find_check_entry net/ipv4/netfilter/arp_tables.c:422 [inline] translate_table+0x1005/0x1d70 net/ipv4/netfilter/arp_tables.c:572 do_replace net/ipv4/netfilter/arp_tables.c:977 [inline] do_arpt_set_ctl+0x310/0x640 net/ipv4/netfilter/arp_tables.c:1456
--- net/ipv4/netfilter/arp_tables.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
net/ipv4/netfilter/arp_tables.c +16 -11
@@ -403,10 +403,11 @@ next: ;return 1 ; } -static inline int check_target (struct arpt_entry *e,const char *name) +static int check_target (struct arpt_entry *e,struct net *net,const char *name) {struct xt_entry_target *t =arpt_get_target (e);struct xt_tgchk_param par = { + .net = net, .table = name, .entryinfo = e, .target = t->u.kernel.target,
@@ -418,8 +419,9 @@ static inline int check_target(struct arreturn xt_check_target (&par, t->u.target_size -sizeof (*t),0 , false); } -static inline int -find_check_entry (struct arpt_entry *e,const char *name,unsigned int size, +static int +find_check_entry (struct arpt_entry *e,struct net *net,const char *name, +unsigned int size,struct xt_percpu_counter_alloc_state *alloc_state) {struct xt_entry_target *t;
@@ -438,7 +440,7 @@ find_check_entry(struct arpt_entry *e, c } t->u.kernel.target = target; - ret =check_target (e, name); + ret =check_target (e, net, name);if (ret) goto err;return 0 ;
@@ -531,7 +533,9 @@ static inline void cleanup_entry(struct/* Checks and translates the user-supplied table segment (held in * newinfo). */ -static int translate_table (struct xt_table_info *newinfo,void *entry0, +static int translate_table (struct net *net, +struct xt_table_info *newinfo, +void *entry0,const struct arpt_replace *repl) {struct xt_percpu_counter_alloc_state alloc_state = {0 };
@@ -597,7 +601,7 @@ static int translate_table(struct xt_tab/* Finally, each sanity check must pass */ i =0 ; xt_entry_foreach(iter, entry0, newinfo->size) { - ret =find_check_entry (iter, repl->name, repl->size, + ret =find_check_entry (iter, net, repl->name, repl->size, &alloc_state);if (ret !=0 )break ;
@@ -987,7 +991,7 @@ static int do_replace(struct net *net, c goto free_newinfo; } - ret =translate_table (newinfo, loc_cpu_entry, &tmp); + ret =translate_table (net, newinfo, loc_cpu_entry, &tmp);if (ret !=0 ) goto free_newinfo;
@@ -1164,7 +1168,8 @@ compat_copy_entry_from_user(struct compa } } -static int translate_compat_table (struct xt_table_info **pinfo, +static int translate_compat_table (struct net *net, +struct xt_table_info **pinfo,void **pentry0,const struct compat_arpt_replace *compatr) {
@@ -1230,7 +1235,7 @@ static int translate_compat_table(struct repl.num_counters =0 ; repl.counters =NULL ; repl.size = newinfo->size; - ret =translate_table (newinfo, entry1, &repl); + ret =translate_table (net, newinfo, entry1, &repl);if (ret) goto free_newinfo;
@@ -1283,7 +1288,7 @@ static int compat_do_replace(struct net goto free_newinfo; } - ret =translate_compat_table (&newinfo, &loc_cpu_entry, &tmp); + ret =translate_compat_table (net, &newinfo, &loc_cpu_entry, &tmp);if (ret !=0 ) goto free_newinfo;
@@ -1559,7 +1564,7 @@ int arpt_register_table(struct net *net, loc_cpu_entry = newinfo->entries;memcpy (loc_cpu_entry, repl->entries, repl->size); - ret =translate_table (newinfo, loc_cpu_entry, repl); + ret =translate_table (net, newinfo, loc_cpu_entry, repl);if (ret !=0 ) goto out_free;
Greg Kroah-Hartman
maintainerPATCH 31/31 netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit 22dad713b8a5ff488e07b821195270672f486eb2 upstream.
The set uadt functions assume lineno is never NULL, but it is in case of ip_set_utest().
syzkaller managed to generate a netlink message that calls this with LINENO attr present:
general protection fault: 0000 [#1] PREEMPT SMP KASAN RIP: 0010:hash_mac4_uadt+0x1bc/0x470 net/netfilter/ipset/ip_set_hash_mac.c:104 Call Trace: ip_set_utest+0x55b/0x890 net/netfilter/ipset/ip_set_core.c:1867 nfnetlink_rcv_msg+0xcf2/0xfb0 net/netfilter/nfnetlink.c:229 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477 nfnetlink_rcv+0x1ba/0x460 net/netfilter/nfnetlink.c:563
pass a dummy lineno storage, its easier than patching all set implementations.
This seems to be a day-0 bug.
--- net/netfilter/ipset/ip_set_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/ipset/ip_set_core.c +2 -1
@@ -1634,6 +1634,7 @@ static int ip_set_utest(struct net *net,struct ip_set *set;struct nlattr *tb[IPSET_ATTR_ADT_MAX +1 ] = {};int ret =0 ; +u32 lineno; if (unlikely(protocol_failed(attr) || !attr[IPSET_ATTR_SETNAME] ||
@@ -1650,7 +1651,7 @@ static int ip_set_utest(struct net *net,return -IPSET_ERR_PROTOCOL ;rcu_read_lock_bh (); - ret = set->variant->uadt (set, tb,IPSET_TEST ,NULL ,0 ,0 ); + ret = set->variant->uadt (set, tb,IPSET_TEST , &lineno,0 ,0 );rcu_read_unlock_bh ();/* Userspace can't trigger element to be re-added */ if (ret == -EAGAIN )
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.210 release. There are 31 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 Thu, 16 Jan 2020 09:41:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.210-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v4.9:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 failLinux version: 4.9.210-rc1-gc5dc66fe8ddb
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.210 release. There are 31 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 Thu, 16 Jan 2020 09:41:58 +0000. Anything received after that time might be too late.
Build results:
total: 172 pass: 172 fail: 0 Qemu test results: total: 358 pass: 358 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.210 release. There are 31 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 Thu, 16 Jan 2020 09:41:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.210-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.210 release. There are 31 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 Thu, 16 Jan 2020 09:41:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.210-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.9.210-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: c5dc66fe8ddb90fc0eeeeb75880cf7caa26b6cf3
git describe: v4.9.209-32-gc5dc66fe8ddb
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.209-32-gc5dc66fe8ddb
No regressions (compared to build v4.9.209)
No fixes (compared to build v4.9.209)
Ran 20684 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fs-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* network-basic-tests
* perf
* prep-tmp-disk
* spectre-meltdown-checker-test
* ssuite
* v4l2-compliance
Greetings!
Daniel Díaz
[email protected]
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org