4.4.93-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 4/28 nl80211: Define policy for packet pattern attributes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Xu <[email protected]>
commit ad670233c9e1d5feb365d870e30083ef1b889177 upstream.
Define a policy for packet pattern attributes in order to fix a potential read over the end of the buffer during nla_get_u32() of the NL80211_PKTPAT_OFFSET attribute.
Note that the data there can always be read due to SKB allocation (with alignment and struct skb_shared_info at the end), but the data might be uninitialized. This could be used to leak some data from uninitialized vmalloc() memory, but most drivers don't allow an offset (so you'd just get -EINVAL if the data is non-zero) or just allow it with a fixed value - 100 or 128 bytes, so anything above that would get -EINVAL. With brcmfmac the limit is 1500 so (at least) one byte could be obtained.
--- net/wireless/nl80211.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
net/wireless/nl80211.c +10 -2
@@ -485,6 +485,14 @@ nl80211_plan_policy[NL80211_SCHED_SCAN_P [NL80211_SCHED_SCAN_PLAN_ITERATIONS] = { .type = NLA_U32 }, }; +/* policy for packet pattern attributes */ +static const struct nla_policy +nl80211_packet_pattern_policy[MAX_NL80211_PKTPAT +1 ] = { + [NL80211_PKTPAT_MASK ] = { .type =NLA_BINARY , }, + [NL80211_PKTPAT_PATTERN ] = { .type =NLA_BINARY , }, + [NL80211_PKTPAT_OFFSET ] = { .type =NLA_U32 }, +}; + static int nl80211_prepare_wdev_dump(struct sk_buff *skb, struct netlink_callback *cb, struct cfg80211_registered_device **rdev,
@@ -9410,7 +9418,7 @@ static int nl80211_set_wowlan(struct sk_u8 *mask_pat;nla_parse (pat_tb,MAX_NL80211_PKTPAT ,nla_data (pat), -nla_len (pat),NULL ); +nla_len (pat), nl80211_packet_pattern_policy); err = -EINVAL ;if (!pat_tb[NL80211_PKTPAT_MASK ] || !pat_tb[NL80211_PKTPAT_PATTERN ])
@@ -9660,7 +9668,7 @@ static int nl80211_parse_coalesce_rule(su8 *mask_pat;nla_parse (pat_tb,MAX_NL80211_PKTPAT ,nla_data (pat), -nla_len (pat),NULL ); +nla_len (pat), nl80211_packet_pattern_policy);if (!pat_tb[NL80211_PKTPAT_MASK ] || !pat_tb[NL80211_PKTPAT_PATTERN ])return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 20/28 usb: gadget: composite: Fix use-after-free in usb_composite_overwrite_options
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Gabbasov <[email protected]>
commit aec17e1e249567e82b26dafbb86de7d07fde8729 upstream.
KASAN enabled configuration reports an error
BUG: KASAN: use-after-free in usb_composite_overwrite_options+...
[libcomposite] at addr ...
Read of size 1 by task ...when some driver is un-bound and then bound again.
For example, this happens with FunctionFS driver when "ffs-test" test application is run several times in a row.
If the driver has empty manufacturer ID string in initial static data, it is then replaced with generated string. After driver unbinding the generated string is freed, but the driver data still keep that pointer. And if the driver is then bound again, that pointer is re-used for string emptiness check.
The fix is to clean up the driver string data upon its unbinding to drop the pointer to freed memory.
--- drivers/usb/gadget/composite.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/gadget/composite.c +5 -0
@@ -1905,6 +1905,8 @@ static DEVICE_ATTR_RO(suspended);static void __composite_unbind (struct usb_gadget *gadget,bool unbind_driver) {struct usb_composite_dev *cdev =get_gadget_data (gadget); +struct usb_gadget_strings *gstr = cdev->driver->strings[0 ]; +struct usb_string *dev_str = gstr->strings;/* composite_disconnect() must already have been called * by the underlying peripheral controller driver!
@@ -1924,6 +1926,9 @@ static void __composite_unbind(struct uscomposite_dev_cleanup (cdev); +if (dev_str[USB_GADGET_MANUFACTURER_IDX ].s == cdev->def_manufacturer) + dev_str[USB_GADGET_MANUFACTURER_IDX ].s ="" ; +kfree (cdev->def_manufacturer);kfree (cdev);set_gadget_data (gadget,NULL );
Greg Kroah-Hartman
maintainerPATCH 28/28 x86/alternatives: Fix alt_max_short macro to really be a max()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
commit 6b32c126d33d5cb379bca280ab8acedc1ca978ff upstream.
The alt_max_short() macro in asm/alternative.h does not work as intended, leading to nasty bugs. E.g. alt_max_short("1", "3") evaluates to 3, but alt_max_short("3", "1") evaluates to 1 -- not exactly the maximum of 1 and 3.
In fact, I had to learn it the hard way by crashing my kernel in not so funny ways by attempting to make use of the ALTENATIVE_2 macro with alternatives where the first one was larger than the second one.
According to [1] and commit dbe4058a6a44 ("x86/alternatives: Fix ALTERNATIVE_2 padding generation properly") the right handed side should read "-(-(a < b))" not "-(-(a - b))". Fix that, to make the macro work as intended.
While at it, fix up the comments regarding the additional "-", too. It's not about gas' usage of s32 but brain dead logic of having a "true" value of -1 for the < operator ... *sigh*
Btw., the one in asm/alternative-asm.h is correct. And, apparently, all current users of ALTERNATIVE_2() pass same sized alternatives, avoiding to hit the bug.
[1] http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
--- arch/x86/include/asm/alternative-asm.h | 4 +++- arch/x86/include/asm/alternative.h | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/x86/include/asm/alternative-asm.h +3 -1
@@ -62,8 +62,10 @@#define new_len2 145f-144f/* -* max without conditionals. Idea adapted from: +* gas compatible max based on the idea from: * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax +* +* The additional "-" is needed because gas uses a "true" value of -1. */ #define alt_max_short (a, b) ((a) ^ (((a) ^ (b)) & -(-((a) < (b)))))
arch/x86/include/asm/alternative.h +3 -3
@@ -102,12 +102,12 @@ static inline int alternatives_text_rese alt_end_marker":\n" /* -* max without conditionals. Idea adapted from: +* gas compatible max based on the idea from: * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax * -* The additional "-" is needed because gas works with s32s. +* The additional "-" is needed because gas uses a "true" value of -1. */ -#define alt_max_short (a, b) "((" a ") ^ (((" a ") ^ (" b ")) & -(-((" a ") - (" b ")))))" +#define alt_max_short (a, b) "((" a ") ^ (((" a ") ^ (" b ")) & -(-((" a ") < (" b ")))))"/* * Pad the second replacement alternative with additional NOPs if it is
Greg Kroah-Hartman
maintainerPATCH 1/28 brcmfmac: add length check in brcmf_cfg80211_escan_handler()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arend Van Spriel <[email protected]>
commit 17df6453d4be17910456e99c5a85025aa1b7a246 upstream.
Upon handling the firmware notification for scans the length was checked properly and may result in corrupting kernel heap memory due to buffer overruns. This fix addresses CVE-2017-0786.
--- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +15 -3
@@ -2903,6 +2903,7 @@ brcmf_cfg80211_escan_handler(struct brcmstruct brcmf_cfg80211_info *cfg = ifp->drvr->config;s32 status;struct brcmf_escan_result_le *escan_result_le; +u32 escan_buflen;struct brcmf_bss_info_le *bss_info_le;struct brcmf_bss_info_le *bss =NULL ;u32 bi_length;
@@ -2919,11 +2920,23 @@ brcmf_cfg80211_escan_handler(struct brcmif (status ==BRCMF_E_STATUS_PARTIAL ) {brcmf_dbg (SCAN ,"ESCAN Partial result\n" ); +if (e->datalen <sizeof (*escan_result_le)) { +brcmf_err ("invalid event data length\n" ); + goto exit; + } escan_result_le = (struct brcmf_escan_result_le *) data;if (!escan_result_le) {brcmf_err ("Invalid escan result (NULL pointer)\n" ); goto exit; } + escan_buflen =le32_to_cpu (escan_result_le->buflen); +if (escan_buflen >WL_ESCAN_BUF_SIZE || + escan_buflen > e->datalen || + escan_buflen <sizeof (*escan_result_le)) { +brcmf_err ("Invalid escan buffer length: %d\n" , + escan_buflen); + goto exit; + }if (le16_to_cpu (escan_result_le->bss_count) !=1 ) {brcmf_err ("Invalid bss_count %d: ignoring\n" , escan_result_le->bss_count);
@@ -2940,9 +2953,8 @@ brcmf_cfg80211_escan_handler(struct brcm } bi_length =le32_to_cpu (bss_info_le->length); -if (bi_length != (le32_to_cpu (escan_result_le->buflen) - -WL_ESCAN_RESULTS_FIXED_SIZE )) { -brcmf_err ("Invalid bss_info length %d: ignoring\n" , +if (bi_length != escan_buflen -WL_ESCAN_RESULTS_FIXED_SIZE ) { +brcmf_err ("Ignoring invalid bss_info length: %d\n" , bi_length); goto exit; }
Greg Kroah-Hartman
maintainerPATCH 10/28 HID: usbhid: fix out-of-bounds bug
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaejoong Kim <[email protected]>
commit f043bfc98c193c284e2cd768fefabe18ac2fed9b upstream.
The hid descriptor identifies the length and type of subordinate descriptors for a device. If the received hid descriptor is smaller than the size of the struct hid_descriptor, it is possible to cause out-of-bounds.
In addition, if bNumDescriptors of the hid descriptor have an incorrect value, this can also cause out-of-bounds while approaching hdesc->desc[n].
So check the size of hid descriptor and bNumDescriptors.
BUG: KASAN: slab-out-of-bounds in usbhid_parse+0x9b1/0xa20 Read of size 1 at addr ffff88006c5f8edf by task kworker/1:2/1261 CPU: 1 PID: 1261 Comm: kworker/1:2 Not tainted 4.14.0-rc1-42251-gebb2c2437d80 #169 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:16 dump_stack+0x292/0x395 lib/dump_stack.c:52 print_address_description+0x78/0x280 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 kasan_report+0x22f/0x340 mm/kasan/report.c:409 __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:427 usbhid_parse+0x9b1/0xa20 drivers/hid/usbhid/hid-core.c:1004 hid_add_device+0x16b/0xb30 drivers/hid/hid-core.c:2944 usbhid_probe+0xc28/0x1100 drivers/hid/usbhid/hid-core.c:1369 usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 hub_port_connect drivers/usb/core/hub.c:4903 hub_port_connect_change drivers/usb/core/hub.c:5009 port_event drivers/usb/core/hub.c:5115 hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 worker_thread+0x221/0x1850 kernel/workqueue.c:2253 kthread+0x3a1/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
--- drivers/hid/usbhid/hid-core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/hid/usbhid/hid-core.c +11 -1
@@ -971,6 +971,8 @@ static int usbhid_parse(struct hid_devicunsigned int rsize =0 ;char *rdesc;int ret, n; +int num_descriptors; +size_t offset = offsetof(struct hid_descriptor , desc); quirks =usbhid_lookup_quirk (le16_to_cpu (dev->descriptor.idVendor),le16_to_cpu (dev->descriptor.idProduct));
@@ -993,10 +995,18 @@ static int usbhid_parse(struct hid_devicreturn -ENODEV ; } +if (hdesc->bLength <sizeof (struct hid_descriptor )) { +dbg_hid ("hid descriptor is too short\n" ); +return -EINVAL ; + } + hid->version =le16_to_cpu (hdesc->bcdHID); hid->country = hdesc->bCountryCode; -for (n =0 ; n < hdesc->bNumDescriptors; n++) + num_descriptors =min_t (int, hdesc->bNumDescriptors, + (hdesc->bLength - offset) /sizeof (struct hid_class_descriptor )); + +for (n =0 ; n < num_descriptors; n++)if (hdesc->desc[n].bDescriptorType ==HID_DT_REPORT ) rsize =le16_to_cpu (hdesc->desc[n].wDescriptorLength);
Greg Kroah-Hartman
maintainerPATCH 12/28 KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haozhong Zhang <[email protected]>
commit 8eb3f87d903168bdbd1222776a6b1e281f50513e upstream.
When KVM emulates an exit from L2 to L1, it loads L1 CR4 into the guest CR4. Before this CR4 loading, the guest CR4 refers to L2 CR4. Because these two CR4's are in different levels of guest, we should vmx_set_cr4() rather than kvm_set_cr4() here. The latter, which is used to handle guest writes to its CR4, checks the guest change to CR4 and may fail if the change is invalid.
The failure may cause trouble. Consider we start
a L1 guest with non-zero L1 PCID in use,
(i.e. L1 CR4.PCIDE == 1 && L1 CR3.PCID != 0)
and
a L2 guest with L2 PCID disabled,
(i.e. L2 CR4.PCIDE == 0)and following events may happen:
1. If kvm_set_cr4() is used in load_vmcs12_host_state() to load L1 CR4 into guest CR4 (in VMCS01) for L2 to L1 exit, it will fail because of PCID check. As a result, the guest CR4 recorded in L0 KVM (i.e. vcpu->arch.cr4) is left to the value of L2 CR4.
2. Later, if L1 attempts to change its CR4, e.g., clearing VMXE bit, kvm_set_cr4() in L0 KVM will think L1 also wants to enable PCID, because the wrong L2 CR4 is used by L0 KVM as L1 CR4. As L1 CR3.PCID != 0, L0 KVM will inject GP to L1 guest.
--- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx.c +1 -1
@@ -10369,7 +10369,7 @@ static void load_vmcs12_host_state(struc* (KVM doesn't change it)- no reason to call set_cr4_guest_host_mask(); */ vcpu->arch.cr4_guest_owned_bits = ~vmcs_readl (CR4_GUEST_HOST_MASK ); -kvm_set_cr4 (vcpu, vmcs12->host_cr4); +vmx_set_cr4 (vcpu, vmcs12->host_cr4);nested_ept_uninit_mmu_context (vcpu);
Greg Kroah-Hartman
maintainerPATCH 13/28 usb: renesas_usbhs: Fix DMAC sequence for receiving zero-length packet
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kazuya Mizuguchi <[email protected]>
commit 29c7f3e68eec4ae94d85ad7b5dfdafdb8089f513 upstream.
The DREQE bit of the DnFIFOSEL should be set to 1 after the DE bit of USB-DMAC on R-Car SoCs is set to 1 after the USB-DMAC received a zero-length packet. Otherwise, a transfer completion interruption of USB-DMAC doesn't happen. Even if the driver changes the sequence, normal operations (transmit/receive without zero-length packet) will not cause any side-effects. So, this patch fixes the sequence anyway.
--- drivers/usb/renesas_usbhs/fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/renesas_usbhs/fifo.c +1 -1
@@ -858,9 +858,9 @@ static void xfer_work(struct work_struct fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero);usbhs_pipe_running (pipe,1 ); -usbhsf_dma_start (pipe, fifo);usbhs_pipe_set_trans_count_if_bulk (pipe, pkt->trans);dma_async_issue_pending (chan); +usbhsf_dma_start (pipe, fifo);usbhs_pipe_enable (pipe); xfer_work_end:
Greg Kroah-Hartman
maintainerPATCH 14/28 iommu/amd: Finish TLB flush in amd_iommu_unmap()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <[email protected]>
commit ce76353f169a6471542d999baf3d29b121dce9c0 upstream.
The function only sends the flush command to the IOMMU(s), but does not wait for its completion when it returns. Fix that.
--- drivers/iommu/amd_iommu.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/amd_iommu.c +1 -0
@@ -3096,6 +3096,7 @@ static size_t amd_iommu_unmap(struct iommutex_unlock (&domain->api_lock);domain_flush_tlb_pde (domain); +domain_flush_complete (domain);return unmap_size; }
Greg Kroah-Hartman
maintainerPATCH 15/28 ALSA: usb-audio: Kill stray URB at exiting
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 124751d5e63c823092060074bd0abaae61aaa9c4 upstream.
USB-audio driver may leave a stray URB for the mixer interrupt when it exits by some error during probe. This leads to a use-after-free error as spotted by syzkaller like:
==================================================================
BUG: KASAN: use-after-free in snd_usb_mixer_interrupt+0x604/0x6f0 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:16 dump_stack+0x292/0x395 lib/dump_stack.c:52 print_address_description+0x78/0x280 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 kasan_report+0x23d/0x350 mm/kasan/report.c:409 __asan_report_load8_noabort+0x19/0x20 mm/kasan/report.c:430 snd_usb_mixer_interrupt+0x604/0x6f0 sound/usb/mixer.c:2490 __usb_hcd_giveback_urb+0x2e0/0x650 drivers/usb/core/hcd.c:1779 .... Allocated by task 1484: save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x11e/0x2d0 mm/slub.c:2772 kmalloc ./include/linux/slab.h:493 kzalloc ./include/linux/slab.h:666 snd_usb_create_mixer+0x145/0x1010 sound/usb/mixer.c:2540 create_standard_mixer_quirk+0x58/0x80 sound/usb/quirks.c:516 snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560 create_composite_quirk+0x1c4/0x3e0 sound/usb/quirks.c:59 snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560 usb_audio_probe+0x1040/0x2c10 sound/usb/card.c:618 .... Freed by task 1484: save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:524 slab_free_hook mm/slub.c:1390 slab_free_freelist_hook mm/slub.c:1412 slab_free mm/slub.c:2988 kfree+0xf6/0x2f0 mm/slub.c:3919 snd_usb_mixer_free+0x11a/0x160 sound/usb/mixer.c:2244 snd_usb_mixer_dev_free+0x36/0x50 sound/usb/mixer.c:2250 __snd_device_free+0x1ff/0x380 sound/core/device.c:91 snd_device_free_all+0x8f/0xe0 sound/core/device.c:244 snd_card_do_free sound/core/init.c:461 release_card_device+0x47/0x170 sound/core/init.c:181 device_release+0x13f/0x210 drivers/base/core.c:814 ....
Actually such a URB is killed properly at disconnection when the device gets probed successfully, and what we need is to apply it for the error-path, too.
In this patch, we apply snd_usb_mixer_disconnect() at releasing. Also introduce a new flag, disconnected, to struct usb_mixer_interface for not performing the disconnection procedure twice.
--- sound/usb/mixer.c | 12 ++++++++++-- sound/usb/mixer.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-)
sound/usb/mixer.c +10 -2
@@ -2161,6 +2161,9 @@ static int parse_audio_unit(struct mixerstatic void snd_usb_mixer_free (struct usb_mixer_interface *mixer) { +/* kill pending URBs */ +snd_usb_mixer_disconnect (mixer); +kfree (mixer->id_elems);if (mixer->urb) {kfree (mixer->urb->transfer_buffer);
@@ -2504,8 +2507,13 @@ _error:void snd_usb_mixer_disconnect (struct usb_mixer_interface *mixer) { -usb_kill_urb (mixer->urb); -usb_kill_urb (mixer->rc_urb); +if (mixer->disconnected) +return ; +if (mixer->urb) +usb_kill_urb (mixer->urb); +if (mixer->rc_urb) +usb_kill_urb (mixer->rc_urb); + mixer->disconnected = true; }#ifdef CONFIG_PM
sound/usb/mixer.h +2 -0
@@ -22,6 +22,8 @@ struct usb_mixer_interface {struct urb *rc_urb;struct usb_ctrlrequest *rc_setup_packet;u8 rc_buffer[6 ]; + +bool disconnected; };#define MAX_CHANNELS 16/* max logical channels */
Greg Kroah-Hartman
maintainerPATCH 16/28 ALSA: seq: Fix use-after-free at creating a port
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 71105998845fb012937332fe2e806d443c09e026 upstream.
There is a potential race window opened at creating and deleting a port via ioctl, as spotted by fuzzing. snd_seq_create_port() creates a port object and returns its pointer, but it doesn't take the refcount, thus it can be deleted immediately by another thread. Meanwhile, snd_seq_ioctl_create_port() still calls the function snd_seq_system_client_ev_port_start() with the created port object that is being deleted, and this triggers use-after-free like:
BUG: KASAN: use-after-free in snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] at addr ffff8801f2241cb1 ============================================================================= BUG kmalloc-512 (Tainted: G B ): kasan: bad access detected ----------------------------------------------------------------------------- INFO: Allocated in snd_seq_create_port+0x94/0x9b0 [snd_seq] age=1 cpu=3 pid=4511 ___slab_alloc+0x425/0x460 __slab_alloc+0x20/0x40 kmem_cache_alloc_trace+0x150/0x190 snd_seq_create_port+0x94/0x9b0 [snd_seq] snd_seq_ioctl_create_port+0xd1/0x630 [snd_seq] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] snd_seq_ioctl+0x40/0x80 [snd_seq] do_vfs_ioctl+0x54b/0xda0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x16/0x75 INFO: Freed in port_delete+0x136/0x1a0 [snd_seq] age=1 cpu=2 pid=4717 __slab_free+0x204/0x310 kfree+0x15f/0x180 port_delete+0x136/0x1a0 [snd_seq] snd_seq_delete_port+0x235/0x350 [snd_seq] snd_seq_ioctl_delete_port+0xc8/0x180 [snd_seq] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] snd_seq_ioctl+0x40/0x80 [snd_seq] do_vfs_ioctl+0x54b/0xda0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x16/0x75 Call Trace: [<ffffffff81b03781>] dump_stack+0x63/0x82 [<ffffffff81531b3b>] print_trailer+0xfb/0x160 [<ffffffff81536db4>] object_err+0x34/0x40 [<ffffffff815392d3>] kasan_report.part.2+0x223/0x520 [<ffffffffa07aadf4>] ? snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] [<ffffffff815395fe>] __asan_report_load1_noabort+0x2e/0x30 [<ffffffffa07aadf4>] snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] [<ffffffffa07aa8f0>] ? snd_seq_ioctl_delete_port+0x180/0x180 [snd_seq] [<ffffffff8136be50>] ? taskstats_exit+0xbc0/0xbc0 [<ffffffffa07abc5c>] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] [<ffffffffa07abd10>] snd_seq_ioctl+0x40/0x80 [snd_seq] [<ffffffff8136d433>] ? acct_account_cputime+0x63/0x80 [<ffffffff815b515b>] do_vfs_ioctl+0x54b/0xda0 .....
We may fix this in a few different ways, and in this patch, it's fixed simply by taking the refcount properly at snd_seq_create_port() and letting the caller unref the object after use. Also, there is another potential use-after-free by sprintf() call in snd_seq_create_port(), and this is moved inside the lock.
This fix covers CVE-2017-15265.
--- sound/core/seq/seq_clientmgr.c | 6 +++++- sound/core/seq/seq_ports.c | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
sound/core/seq/seq_clientmgr.c +5 -1
@@ -1260,6 +1260,7 @@ static int snd_seq_ioctl_create_port(strstruct snd_seq_client_port *port;struct snd_seq_port_info info;struct snd_seq_port_callback *callback; +int port_idx;if (copy_from_user (&info, arg,sizeof (info)))return -EFAULT ;
@@ -1273,7 +1274,9 @@ static int snd_seq_ioctl_create_port(strreturn -ENOMEM ;if (client->type ==USER_CLIENT && info.kernel) { -snd_seq_delete_port (client, port->addr.port); + port_idx = port->addr.port; +snd_seq_port_unlock (port); +snd_seq_delete_port (client, port_idx);return -EINVAL ; }if (client->type ==KERNEL_CLIENT ) {
@@ -1294,6 +1297,7 @@ static int snd_seq_ioctl_create_port(strsnd_seq_set_port_info (port, &info);snd_seq_system_client_ev_port_start (port->addr.client, port->addr.port); +snd_seq_port_unlock (port);if (copy_to_user (arg, &info,sizeof (info)))return -EFAULT ;
sound/core/seq/seq_ports.c +5 -2
@@ -122,7 +122,9 @@ static void port_subs_info_init(struct s } -/* create a port, port number is returned (-1 on failure) */ +/* create a port, port number is returned (-1 on failure); +* the caller needs to unref the port via snd_seq_port_unlock() appropriately +*/ struct snd_seq_client_port *snd_seq_create_port (struct snd_seq_client *client,int port) {
@@ -151,6 +153,7 @@ struct snd_seq_client_port *snd_seq_creasnd_use_lock_init (&new_port->use_lock);port_subs_info_init (&new_port->c_src);port_subs_info_init (&new_port->c_dest); +snd_use_lock_use (&new_port->use_lock); num = port >=0 ? port :0 ;mutex_lock (&client->ports_mutex);
@@ -165,9 +168,9 @@ struct snd_seq_client_port *snd_seq_crealist_add_tail (&new_port->list, &p->list); client->num_ports++; new_port->addr.port = num;/* store the port number in the port */ +sprintf (new_port->name,"port-%d" , num);write_unlock_irqrestore (&client->ports_lock, flags);mutex_unlock (&client->ports_mutex); -sprintf (new_port->name,"port-%d" , num);return new_port; }
Greg Kroah-Hartman
maintainerPATCH 17/28 ALSA: seq: Fix copy_from_user() call inside lock
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 5803b023881857db32ffefa0d269c90280a67ee0 upstream.
The event handler in the virmidi sequencer code takes a read-lock for the linked list traverse, while it's calling snd_seq_dump_var_event() in the loop. The latter function may expand the user-space data depending on the event type. It eventually invokes copy_from_user(), which might be a potential dead-lock.
The sequencer core guarantees that the user-space data is passed only with atomic=0 argument, but snd_virmidi_dev_receive_event() ignores it and always takes read-lock(). For avoiding the problem above, this patch introduces rwsem for non-atomic case, while keeping rwlock for atomic case.
Also while we're at it: the superfluous irq flags is dropped in snd_virmidi_input_open().
--- include/sound/seq_virmidi.h | 1 + sound/core/seq/seq_virmidi.c | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-)
include/sound/seq_virmidi.h +1 -0
@@ -60,6 +60,7 @@ struct snd_virmidi_dev {int port;/* created/attached port */ unsigned int flags;/* SNDRV_VIRMIDI_* */ rwlock_t filelist_lock; +struct rw_semaphore filelist_sem;struct list_head filelist; };
sound/core/seq/seq_virmidi.c +19 -8
@@ -77,13 +77,17 @@ static void snd_virmidi_init_event(struc* decode input event and put to read buffer of each opened file */ static int snd_virmidi_dev_receive_event (struct snd_virmidi_dev *rdev, -struct snd_seq_event *ev) +struct snd_seq_event *ev, +bool atomic) {struct snd_virmidi *vmidi;unsigned char msg[4 ];int len; -read_lock (&rdev->filelist_lock); +if (atomic) +read_lock (&rdev->filelist_lock); +else +down_read (&rdev->filelist_sem);list_for_each_entry (vmidi, &rdev->filelist, list) {if (!vmidi->trigger)continue ;
@@ -97,7 +101,10 @@ static int snd_virmidi_dev_receive_eventsnd_rawmidi_receive (vmidi->substream, msg, len); } } -read_unlock (&rdev->filelist_lock); +if (atomic) +read_unlock (&rdev->filelist_lock); +else +up_read (&rdev->filelist_sem);return 0 ; }
@@ -115,7 +122,7 @@ int snd_virmidi_receive(struct snd_rawmistruct snd_virmidi_dev *rdev; rdev = rmidi->private_data; - return snd_virmidi_dev_receive_event(rdev, ev); + return snd_virmidi_dev_receive_event(rdev, ev, true); }#endif /* 0 */
@@ -130,7 +137,7 @@ static int snd_virmidi_event_input(struc rdev = private_data;if (!(rdev->flags &SNDRV_VIRMIDI_USE ))return 0 ;/* ignored */ -return snd_virmidi_dev_receive_event (rdev, ev); +return snd_virmidi_dev_receive_event (rdev, ev, atomic); }/*
@@ -209,7 +216,6 @@ static int snd_virmidi_input_open(structstruct snd_virmidi_dev *rdev = substream->rmidi->private_data;struct snd_rawmidi_runtime *runtime = substream->runtime;struct snd_virmidi *vmidi; -unsigned long flags; vmidi =kzalloc (sizeof (*vmidi),GFP_KERNEL );if (vmidi ==NULL )
@@ -223,9 +229,11 @@ static int snd_virmidi_input_open(struct vmidi->client = rdev->client; vmidi->port = rdev->port; runtime->private_data = vmidi; -write_lock_irqsave (&rdev->filelist_lock, flags); +down_write (&rdev->filelist_sem); +write_lock_irq (&rdev->filelist_lock);list_add_tail (&vmidi->list, &rdev->filelist); -write_unlock_irqrestore (&rdev->filelist_lock, flags); +write_unlock_irq (&rdev->filelist_lock); +up_write (&rdev->filelist_sem); vmidi->rdev = rdev;return 0 ; }
@@ -264,9 +272,11 @@ static int snd_virmidi_input_close(strucstruct snd_virmidi_dev *rdev = substream->rmidi->private_data;struct snd_virmidi *vmidi = substream->runtime->private_data; +down_write (&rdev->filelist_sem);write_lock_irq (&rdev->filelist_lock);list_del (&vmidi->list);write_unlock_irq (&rdev->filelist_lock); +up_write (&rdev->filelist_sem);snd_midi_event_free (vmidi->parser); substream->runtime->private_data =NULL ;kfree (vmidi);
@@ -520,6 +530,7 @@ int snd_virmidi_new(struct snd_card *car rdev->rmidi = rmidi; rdev->device = device; rdev->client =-1 ; +init_rwsem (&rdev->filelist_sem);rwlock_init (&rdev->filelist_lock);INIT_LIST_HEAD (&rdev->filelist); rdev->seq_mode =SNDRV_VIRMIDI_SEQ_DISPATCH ;
Greg Kroah-Hartman
maintainerPATCH 18/28 ALSA: caiaq: Fix stray URB at probe error path
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 99fee508245825765ff60155fed43f970ff83a8f upstream.
caiaq driver doesn't kill the URB properly at its error path during the probe, which may lead to a use-after-free error later. This patch addresses it.
--- sound/usb/caiaq/device.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
sound/usb/caiaq/device.c +9 -3
@@ -469,10 +469,12 @@ static int init_card(struct snd_usb_caia err =snd_usb_caiaq_send_command (cdev,EP1_CMD_GET_DEVICE_INFO ,NULL ,0 );if (err) -return err; + goto err_kill_urb; -if (!wait_event_timeout (cdev->ep1_wait_queue, cdev->spec_received,HZ )) -return -ENODEV ; +if (!wait_event_timeout (cdev->ep1_wait_queue, cdev->spec_received,HZ )) { + err = -ENODEV ; + goto err_kill_urb; + }usb_string (usb_dev, usb_dev->descriptor.iManufacturer, cdev->vendor_name,CAIAQ_USB_STR_LEN );
@@ -507,6 +509,10 @@ static int init_card(struct snd_usb_caiasetup_card (cdev);return 0 ; + + err_kill_urb: +usb_kill_urb (&cdev->ep1_in_urb); +return err; } static int snd_probe(struct usb_interface *intf,
Greg Kroah-Hartman
maintainerPATCH 19/28 ALSA: line6: Fix leftover URB at error-path during probe
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit c95072b3d88fac4be295815f2b67df366c0c297f upstream.
While line6_probe() may kick off URB for a control MIDI endpoint, the function doesn't clean up it properly at its error path. This results in a leftover URB action that is eventually triggered later and causes an Oops like:
general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 0 Comm: swapper/1 Not tainted RIP: 0010:usb_fill_bulk_urb ./include/linux/usb.h:1619 RIP: 0010:line6_start_listen+0x3fe/0x9e0 sound/usb/line6/driver.c:76 Call Trace: <IRQ> line6_data_received+0x1f7/0x470 sound/usb/line6/driver.c:326 __usb_hcd_giveback_urb+0x2e0/0x650 drivers/usb/core/hcd.c:1779 usb_hcd_giveback_urb+0x337/0x420 drivers/usb/core/hcd.c:1845 dummy_timer+0xba9/0x39f0 drivers/usb/gadget/udc/dummy_hcd.c:1965 call_timer_fn+0x2a2/0x940 kernel/time/timer.c:1281 ....
Since the whole clean-up procedure is done in line6_disconnect() callback, we can simply call it in the error path instead of open-coding the whole again. It'll fix such an issue automagically.
The bug was spotted by syzkaller.
--- sound/usb/line6/driver.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/usb/line6/driver.c +4 -3
@@ -586,9 +586,10 @@ int line6_probe(struct usb_interface *inreturn 0 ; error: -if (line6->disconnect) - line6->disconnect (line6); -snd_card_free (card); +/* we can call disconnect callback here because no close-sync is +* needed yet at this point +*/ +line6_disconnect (interface);return ret; }EXPORT_SYMBOL_GPL (line6_probe);
Greg Kroah-Hartman
maintainerPATCH 2/28 ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit 1bd8d6cd3e413d64e543ec3e69ff43e75a1cf1ea upstream.
In the ext4 implementations of SEEK_HOLE and SEEK_DATA, make sure we return -ENXIO for negative offsets instead of banging around inside the extent code and returning -EFSCORRUPTED.
--- fs/ext4/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/file.c +2 -2
@@ -559,7 +559,7 @@ static loff_t ext4_seek_data(struct filemutex_lock (&inode->i_mutex); isize =i_size_read (inode); -if (offset >= isize) { +if (offset <0 || offset >= isize) {mutex_unlock (&inode->i_mutex);return -ENXIO ; }
@@ -632,7 +632,7 @@ static loff_t ext4_seek_hole(struct filemutex_lock (&inode->i_mutex); isize =i_size_read (inode); -if (offset >= isize) { +if (offset <0 || offset >= isize) {mutex_unlock (&inode->i_mutex);return -ENXIO ; }
Greg Kroah-Hartman
maintainerPATCH 21/28 direct-io: Prevent NULL pointer access in submit_page_section
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
commit 899f0429c7d3eed886406cd72182bee3b96aa1f9 upstream.
In the code added to function submit_page_section by commit b1058b981, sdio->bio can currently be NULL when calling dio_bio_submit. This then leads to a NULL pointer access in dio_bio_submit, so check for a NULL bio in submit_page_section before trying to submit it instead.
Fixes xfstest generic/250 on gfs2.
--- fs/direct-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/direct-io.c +2 -1
@@ -823,7 +823,8 @@ out:*/ if (sdio->boundary) { ret =dio_send_cur_page (dio, sdio, map_bh); -dio_bio_submit (dio, sdio); +if (sdio->bio) +dio_bio_submit (dio, sdio);page_cache_release (sdio->cur_page); sdio->cur_page =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 22/28 fix unbalanced page refcounting in bio_map_user_iov
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Mayatskikh <[email protected]>
commit 95d78c28b5a85bacbc29b8dba7c04babb9b0d467 upstream.
bio_map_user_iov and bio_unmap_user do unbalanced pages refcounting if IO vector has small consecutive buffers belonging to the same page. bio_add_pc_page merges them into one, but the page reference is never dropped.
--- block/bio.c | 8 ++++++++ 1 file changed, 8 insertions(+)
block/bio.c +8 -0
@@ -1320,6 +1320,7 @@ struct bio *bio_map_user_iov(struct requ offset = uaddr & ~PAGE_MASK ;for (j = cur_page; j < page_limit; j++) {unsigned int bytes =PAGE_SIZE - offset; +unsigned short prev_bi_vcnt = bio->bi_vcnt;if (len <=0 )break ;
@@ -1334,6 +1335,13 @@ struct bio *bio_map_user_iov(struct requ bytes)break ; +/* +* check if vector was merged with previous +* drop page reference if needed +*/ +if (bio->bi_vcnt == prev_bi_vcnt) +put_page (pages[j]); + len -= bytes; offset =0 ; }
Greg Kroah-Hartman
maintainerPATCH 23/28 USB: serial: ftdi_sio: add id for Cypress WICED dev board
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeffrey Chu <[email protected]>
commit a6c215e21b0dc5fe9416dce90f9acc2ea53c4502 upstream.
Add CYPRESS_VID vid and CYPRESS_WICED_BT_USB and CYPRESS_WICED_WL_USB device IDs to ftdi_sio driver.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 7 +++++++ 2 files changed, 9 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -1015,6 +1015,8 @@ static const struct usb_device_id id_tab { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) }, { USB_DEVICE(TI_VID, TI_CC3200_LAUNCHPAD_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) }, + { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) }, { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +7 -0
@@ -610,6 +610,13 @@#define ADI_GNICEPLUS_PID 0xF001/* +* Cypress WICED USB UART +*/ +#define CYPRESS_VID 0x04B4 +#define CYPRESS_WICED_BT_USB_PID 0x009B +#define CYPRESS_WICED_WL_USB_PID 0xF900 + +/* * Microchip Technology, Inc. * * MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are
Greg Kroah-Hartman
maintainerPATCH 24/28 USB: serial: cp210x: add support for ELV TFD500
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Engel <[email protected]>
commit c496ad835c31ad639b6865714270b3003df031f6 upstream.
Add the USB device id for the ELV TFD500 data logger.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -170,6 +170,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ + { USB_DEVICE(0x18EF, 0xE032) }, /* ELV TFD500 Data Logger */ { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */
Greg Kroah-Hartman
maintainerPATCH 25/28 USB: serial: option: add support for TP-Link LTE module
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henryk Heisig <[email protected]>
commit 837ddc4793a69b256ac5e781a5e729b448a8d983 upstream.
This commit adds support for TP-Link LTE mPCIe module is used in in TP-Link MR200v1, MR6400v1 and v2 routers.
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -522,6 +522,7 @@ static void option_instat_callback(struc/* TP-LINK Incorporated products */ #define TPLINK_VENDOR_ID 0x2357 +#define TPLINK_PRODUCT_LTE 0x000D#define TPLINK_PRODUCT_MA180 0x0201/* Changhong products */
@@ -2011,6 +2012,7 @@ static const struct usb_device_id option { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600A) }, { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) }, + { USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, TPLINK_PRODUCT_LTE, 0xff, 0x00, 0x00) }, /* TP-Link LTE Module */ { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(TPLINK_VENDOR_ID, 0x9000), /* TP-Link MA260 */
Greg Kroah-Hartman
maintainerPATCH 3/28 CIFS: Reconnect expired SMB sessions
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Shilovsky <[email protected]>
commit 511c54a2f69195b28afb9dd119f03787b1625bb4 upstream.
According to the MS-SMB2 spec (3.2.5.1.6) once the client receives STATUS_NETWORK_SESSION_EXPIRED error code from a server it should reconnect the current SMB session. Currently the client doesn't do that. This can result in subsequent client requests failing by the server. The patch adds an additional logic to the demultiplex thread to identify expired sessions and reconnect them.
--- fs/cifs/cifsglob.h | 2 ++ fs/cifs/cifssmb.c | 7 +++++++ fs/cifs/connect.c | 7 +++++++ fs/cifs/smb2ops.c | 16 ++++++++++++++++ 4 files changed, 32 insertions(+)
fs/cifs/cifsglob.h +2 -0
@@ -351,6 +351,8 @@ struct smb_version_operations {unsigned int (*calc_smb_size)(void *);/* check for STATUS_PENDING and process it in a positive case */ bool (*is_status_pending)(char *,struct TCP_Server_Info *,int ); +/* check for STATUS_NETWORK_SESSION_EXPIRED */ +bool (*is_session_expired)(char *);/* send oplock break response */ int (*oplock_response)(struct cifs_tcon *,struct cifs_fid *,struct cifsInodeInfo *);
fs/cifs/cifssmb.c +7 -0
@@ -1460,6 +1460,13 @@ cifs_readv_receive(struct TCP_Server_Infreturn length; server->total_read += length; +if (server->ops->is_session_expired && + server->ops->is_session_expired (buf)) { +cifs_reconnect (server); +wake_up (&server->response_q); +return -1 ; + } +if (server->ops->is_status_pending && server->ops->is_status_pending (buf, server,0 )) {discard_remaining_data (server);
fs/cifs/connect.c +7 -0
@@ -850,6 +850,13 @@ standard_receive3(struct TCP_Server_Infocifs_dump_mem ("Bad SMB: " , buf, min_t(unsigned int, server->total_read, 48)); +if (server->ops->is_session_expired && + server->ops->is_session_expired (buf)) { +cifs_reconnect (server); +wake_up (&server->response_q); +return -1 ; + } +if (server->ops->is_status_pending && server->ops->is_status_pending (buf, server, length))return -1 ;
fs/cifs/smb2ops.c +16 -0
@@ -963,6 +963,18 @@ smb2_is_status_pending(char *buf, structreturn true; } +static bool +smb2_is_session_expired (char *buf) +{ +struct smb2_hdr *hdr = (struct smb2_hdr *)buf; + +if (hdr->Status !=STATUS_NETWORK_SESSION_EXPIRED ) +return false; + +cifs_dbg (FYI ,"Session expired\n" ); +return true; +} +static int smb2_oplock_response (struct cifs_tcon *tcon,struct cifs_fid *fid,struct cifsInodeInfo *cinode)
@@ -1552,6 +1564,7 @@ struct smb_version_operations smb20_oper .close_dir = smb2_close_dir, .calc_smb_size = smb2_calc_size, .is_status_pending = smb2_is_status_pending, + .is_session_expired = smb2_is_session_expired, .oplock_response = smb2_oplock_response, .queryfs = smb2_queryfs, .mand_lock = smb2_mand_lock,
@@ -1633,6 +1646,7 @@ struct smb_version_operations smb21_oper .close_dir = smb2_close_dir, .calc_smb_size = smb2_calc_size, .is_status_pending = smb2_is_status_pending, + .is_session_expired = smb2_is_session_expired, .oplock_response = smb2_oplock_response, .queryfs = smb2_queryfs, .mand_lock = smb2_mand_lock,
@@ -1715,6 +1729,7 @@ struct smb_version_operations smb30_oper .close_dir = smb2_close_dir, .calc_smb_size = smb2_calc_size, .is_status_pending = smb2_is_status_pending, + .is_session_expired = smb2_is_session_expired, .oplock_response = smb2_oplock_response, .queryfs = smb2_queryfs, .mand_lock = smb2_mand_lock,
@@ -1803,6 +1818,7 @@ struct smb_version_operations smb311_ope .close_dir = smb2_close_dir, .calc_smb_size = smb2_calc_size, .is_status_pending = smb2_is_status_pending, + .is_session_expired = smb2_is_session_expired, .oplock_response = smb2_oplock_response, .queryfs = smb2_queryfs, .mand_lock = smb2_mand_lock,
Greg Kroah-Hartman
maintainerPATCH 5/28 iwlwifi: mvm: use IWL_HCMD_NOCOPY for MCAST_FILTER_CMD
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Coelho <[email protected]>
commit 97bce57bd7f96e1218751996f549a6e61f18cc8c upstream.
The MCAST_FILTER_CMD can get quite large when we have many mcast addresses to set (we support up to 255). So the command should be send as NOCOPY to prevent a warning caused by too-long commands:
WARNING: CPU: 0 PID: 9700 at /root/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1550 iwl_pcie_enqueue_hcmd+0x8c7/0xb40 [iwlwifi]
Command MCAST_FILTER_CMD (0x1d0) is too large (328 bytes)
This fixes: https://bugzilla.kernel.org/show_bug.cgi?id=196743
--- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/mac80211.c +9 -1
@@ -1906,6 +1906,11 @@ static void iwl_mvm_mc_iface_iterator(vostruct iwl_mvm_mc_iter_data *data = _data;struct iwl_mvm *mvm = data->mvm;struct iwl_mcast_filter_cmd *cmd = mvm->mcast_filter_cmd; +struct iwl_host_cmd hcmd = { + .id =MCAST_FILTER_CMD , + .flags =CMD_ASYNC , + .dataflags[0 ] =IWL_HCMD_DFL_NOCOPY , + };int ret, len;/* if we don't have free ports, mcast frames will be dropped */
@@ -1920,7 +1925,10 @@ static void iwl_mvm_mc_iface_iterator(vomemcpy (cmd->bssid, vif->bss_conf.bssid,ETH_ALEN ); len =roundup (sizeof (*cmd) + cmd->count *ETH_ALEN ,4 ); - ret =iwl_mvm_send_cmd_pdu (mvm,MCAST_FILTER_CMD ,CMD_ASYNC , len, cmd); + hcmd.len[0 ] = len; + hcmd.data[0 ] = cmd; + + ret =iwl_mvm_send_cmd (mvm, &hcmd);if (ret)IWL_ERR (mvm,"mcast filter cmd error. ret=%d\n" , ret); }
Greg Kroah-Hartman
maintainerPATCH 6/28 rcu: Allow for page faults in NMI handlers
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul E. McKenney <[email protected]>
commit 28585a832602747cbfa88ad8934013177a3aae38 upstream.
A number of architecture invoke rcu_irq_enter() on exception entry in order to allow RCU read-side critical sections in the exception handler when the exception is from an idle or nohz_full CPU. This works, at least unless the exception happens in an NMI handler. In that case, rcu_nmi_enter() would already have exited the extended quiescent state, which would mean that rcu_irq_enter() would (incorrectly) cause RCU to think that it is again in an extended quiescent state. This will in turn result in lockdep splats in response to later RCU read-side critical sections.
This commit therefore causes rcu_irq_enter() and rcu_irq_exit() to take no action if there is an rcu_nmi_enter() in effect, thus avoiding the unscheduled return to RCU quiescent state. This in turn should make the kernel safe for on-demand RCU voyeurism.
--- kernel/rcu/tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/rcu/tree.c +12 -0
@@ -759,6 +759,12 @@ void rcu_irq_exit(void)local_irq_save (flags); rdtp =this_cpu_ptr (&rcu_dynticks); + +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ; + +RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_exit() invoked with irqs enabled!!!" ); oldval = rdtp->dynticks_nesting; rdtp->dynticks_nesting--; WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
@@ -887,6 +893,12 @@ void rcu_irq_enter(void)local_irq_save (flags); rdtp =this_cpu_ptr (&rcu_dynticks); + +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ; + +RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_enter() invoked with irqs enabled!!!" ); oldval = rdtp->dynticks_nesting; rdtp->dynticks_nesting++; WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
Greg Kroah-Hartman
maintainerPATCH 7/28 USB: dummy-hcd: Fix deadlock caused by disconnect detection
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit ab219221a5064abfff9f78c323c4a257b16cdb81 upstream.
The dummy-hcd driver calls the gadget driver's disconnect callback under the wrong conditions. It should invoke the callback when Vbus power is turned off, but instead it does so when the D+ pullup is turned off.
This can cause a deadlock in the composite core when a gadget driver is unregistered:
[ 88.361471] ============================================
[ 88.362014] WARNING: possible recursive locking detected
[ 88.362580] 4.14.0-rc2+ #9 Not tainted
[ 88.363010] --------------------------------------------
[ 88.363561] v4l_id/526 is trying to acquire lock:
[ 88.364062] (&(&cdev->lock)->rlock){....}, at: [<ffffffffa0547e03>] composite_disconnect+0x43/0x100 [libcomposite]
[ 88.365051]
[ 88.365051] but task is already holding lock:
[ 88.365826] (&(&cdev->lock)->rlock){....}, at: [<ffffffffa0547b09>] usb_function_deactivate+0x29/0x80 [libcomposite]
[ 88.366858]
[ 88.366858] other info that might help us debug this:
[ 88.368301] Possible unsafe locking scenario:
[ 88.368301]
[ 88.369304] CPU0
[ 88.369701] ----
[ 88.370101] lock(&(&cdev->lock)->rlock);
[ 88.370623] lock(&(&cdev->lock)->rlock);
[ 88.371145]
[ 88.371145] *** DEADLOCK ***
[ 88.371145]
[ 88.372211] May be due to missing lock nesting notation
[ 88.372211]
[ 88.373191] 2 locks held by v4l_id/526:
[ 88.373715] #0: (&(&cdev->lock)->rlock){....}, at: [<ffffffffa0547b09>] usb_function_deactivate+0x29/0x80 [libcomposite]
[ 88.374814] #1: (&(&dum_hcd->dum->lock)->rlock){....}, at: [<ffffffffa05bd48d>] dummy_pullup+0x7d/0xf0 [dummy_hcd]
[ 88.376289]
[ 88.376289] stack backtrace:
[ 88.377726] CPU: 0 PID: 526 Comm: v4l_id Not tainted 4.14.0-rc2+ #9
[ 88.378557] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
[ 88.379504] Call Trace:
[ 88.380019] dump_stack+0x86/0xc7
[ 88.380605] __lock_acquire+0x841/0x1120
[ 88.381252] lock_acquire+0xd5/0x1c0
[ 88.381865] ? composite_disconnect+0x43/0x100 [libcomposite]
[ 88.382668] _raw_spin_lock_irqsave+0x40/0x54
[ 88.383357] ? composite_disconnect+0x43/0x100 [libcomposite]
[ 88.384290] composite_disconnect+0x43/0x100 [libcomposite]
[ 88.385490] set_link_state+0x2d4/0x3c0 [dummy_hcd]
[ 88.386436] dummy_pullup+0xa7/0xf0 [dummy_hcd]
[ 88.387195] usb_gadget_disconnect+0xd8/0x160 [udc_core]
[ 88.387990] usb_gadget_deactivate+0xd3/0x160 [udc_core]
[ 88.388793] usb_function_deactivate+0x64/0x80 [libcomposite]
[ 88.389628] uvc_function_disconnect+0x1e/0x40 [usb_f_uvc]This patch changes the code to test the port-power status bit rather than the port-connect status bit when deciding whether to isue the callback.
--- drivers/usb/gadget/udc/dummy_hcd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/gadget/udc/dummy_hcd.c +6 -3
@@ -420,6 +420,7 @@ static void set_link_state_by_speed(strustatic void set_link_state (struct dummy_hcd *dum_hcd) {struct dummy *dum = dum_hcd->dum; +unsigned int power_bit; dum_hcd->active =0 ;if (dum->pullup)
@@ -430,17 +431,19 @@ static void set_link_state(struct dummy_return ;set_link_state_by_speed (dum_hcd); + power_bit = (dummy_hcd_to_hcd (dum_hcd)->speed ==HCD_USB3 ? +USB_SS_PORT_STAT_POWER :USB_PORT_STAT_POWER );if ((dum_hcd->port_status &USB_PORT_STAT_ENABLE ) ==0 || dum_hcd->active) dum_hcd->resuming =0 ;/* Currently !connected or in reset */ -if ((dum_hcd->port_status &USB_PORT_STAT_CONNECTION ) ==0 || +if ((dum_hcd->port_status & power_bit) ==0 || (dum_hcd->port_status &USB_PORT_STAT_RESET ) !=0 ) { -unsigned disconnect =USB_PORT_STAT_CONNECTION & +unsigned int disconnect = power_bit & dum_hcd->old_status & (~dum_hcd->port_status); -unsigned reset =USB_PORT_STAT_RESET & +unsigned int reset =USB_PORT_STAT_RESET & (~dum_hcd->old_status) & dum_hcd->port_status;/* Report reset and disconnect events to the driver */
Greg Kroah-Hartman
maintainerPATCH 8/28 MIPS: math-emu: Remove pr_err() calls from fpu_emu()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Burton <[email protected]>
commit ca8eb05b5f332a9e1ab3e2ece498d49f4d683470 upstream.
The FPU emulator includes 2 calls to pr_err() which are triggered by invalid instruction encodings for MIPSr6 cmp.cond.fmt instructions. These cases are not kernel errors, merely invalid instructions which are already handled by delivering a SIGILL which will provide notification that something failed in cases where that makes sense.
In cases where that SIGILL is somewhat expected & being handled, for example when crashme happens to generate one of the affected bad encodings, the message is printed with no useful context about what triggered it & spams the kernel log for no good reason.
Remove the pr_err() calls to make crashme run silently & treat the bad encodings the same way we do others, with a SIGILL & no further kernel log output.
Patchwork: https://patchwork.linux-mips.org/patch/17253/
--- arch/mips/math-emu/cp1emu.c | 2 -- 1 file changed, 2 deletions(-)
arch/mips/math-emu/cp1emu.c +0 -2
@@ -2360,7 +2360,6 @@ dcopuop:break ;default :/* Reserved R6 ops */ -pr_err ("Reserved MIPS R6 CMP.condn.S operation\n" );return SIGILL ; } }
@@ -2434,7 +2433,6 @@ dcopuop:break ;default :/* Reserved R6 ops */ -pr_err ("Reserved MIPS R6 CMP.condn.D operation\n" );return SIGILL ; } }
Greg Kroah-Hartman
maintainerPATCH 9/28 dmaengine: edma: Align the memcpy acnt array size with the transfer
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 87a2f622cc6446c7d09ac655b7b9b04886f16a4c upstream.
Memory to Memory transfers does not have any special alignment needs regarding to acnt array size, but if one of the areas are in memory mapped regions (like PCIe memory), we need to make sure that the acnt array size is aligned with the mem copy parameters.
Before "dmaengine: edma: Optimize memcpy operation" change the memcpy was set up in a different way: acnt == number of bytes in a word based on __ffs((src | dest | len), bcnt and ccnt for looping the necessary number of words to comlete the trasnfer.
Instead of reverting the commit we can fix it to make sure that the ACNT size is aligned to the traswnfer.
--- drivers/dma/edma.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/dma/edma.c +16 -3
@@ -1126,11 +1126,24 @@ static struct dma_async_tx_descriptor *estruct edma_desc *edesc;struct device *dev = chan->device->dev;struct edma_chan *echan =to_edma_chan (chan); -unsigned int width, pset_len; +unsigned int width, pset_len, array_size;if (unlikely (!echan || !len))return NULL ; +/* Align the array size (acnt block) with the transfer properties */ +switch (__ffs ((src | dest | len))) { +case 0 : + array_size =SZ_32K -1 ; +break ; +case 1 : + array_size =SZ_32K -2 ; +break ; +default : + array_size =SZ_32K -4 ; +break ; + } +if (len <SZ_64K ) {/* * Transfer size less than 64K can be handled with one paRAM
@@ -1152,7 +1165,7 @@ static struct dma_async_tx_descriptor *e* When the full_length is multibple of 32767 one slot can be * used to complete the transfer. */ - width =SZ_32K -1 ; + width = array_size; pset_len =rounddown (len, width);/* One slot is enough for lengths multiple of (SZ_32K -1) */ if (unlikely (pset_len == len))
@@ -1202,7 +1215,7 @@ static struct dma_async_tx_descriptor *e } dest += pset_len; src += pset_len; - pset_len = width = len % (SZ_32K -1 ); + pset_len = width = len % array_size; ret =edma_config_pset (chan, &edesc->pset[1 ], src, dest,1 , width, pset_len,DMA_MEM_TO_MEM );
Greg Kroah-Hartman
maintainercover 4.4.93-stable review
This is the start of the stable review cycle for the 4.4.93 release. There are 28 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 Wed Oct 18 16:09:10 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.93-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.93-rc1
Mathias Krause <[email protected]>
x86/alternatives: Fix alt_max_short macro to really be a max()
Johan Hovold <[email protected]>
USB: serial: console: fix use-after-free after failed setup
Shrirang Bagul <[email protected]>
USB: serial: qcserial: add Dell DW5818, DW5819
Henryk Heisig <[email protected]>
USB: serial: option: add support for TP-Link LTE module
Andreas Engel <[email protected]>
USB: serial: cp210x: add support for ELV TFD500
Jeffrey Chu <[email protected]>
USB: serial: ftdi_sio: add id for Cypress WICED dev board
Vitaly Mayatskikh <[email protected]>
fix unbalanced page refcounting in bio_map_user_iov
Andreas Gruenbacher <[email protected]>
direct-io: Prevent NULL pointer access in submit_page_section
Andrew Gabbasov <[email protected]>
usb: gadget: composite: Fix use-after-free in usb_composite_overwrite_options
Takashi Iwai <[email protected]>
ALSA: line6: Fix leftover URB at error-path during probe
Takashi Iwai <[email protected]>
ALSA: caiaq: Fix stray URB at probe error path
Takashi Iwai <[email protected]>
ALSA: seq: Fix copy_from_user() call inside lock
Takashi Iwai <[email protected]>
ALSA: seq: Fix use-after-free at creating a port
Takashi Iwai <[email protected]>
ALSA: usb-audio: Kill stray URB at exiting
Joerg Roedel <[email protected]>
iommu/amd: Finish TLB flush in amd_iommu_unmap()
Kazuya Mizuguchi <[email protected]>
usb: renesas_usbhs: Fix DMAC sequence for receiving zero-length packet
Haozhong Zhang <[email protected]>
KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit
Herbert Xu <[email protected]>
crypto: shash - Fix zero-length shash ahash digest crash
Jaejoong Kim <[email protected]>
HID: usbhid: fix out-of-bounds bug
Peter Ujfalusi <[email protected]>
dmaengine: edma: Align the memcpy acnt array size with the transfer
Paul Burton <[email protected]>
MIPS: math-emu: Remove pr_err() calls from fpu_emu()
Alan Stern <[email protected]>
USB: dummy-hcd: Fix deadlock caused by disconnect detection
Paul E. McKenney <[email protected]>
rcu: Allow for page faults in NMI handlers
Luca Coelho <[email protected]>
iwlwifi: mvm: use IWL_HCMD_NOCOPY for MCAST_FILTER_CMD
Peng Xu <[email protected]>
nl80211: Define policy for packet pattern attributes
Pavel Shilovsky <[email protected]>
CIFS: Reconnect expired SMB sessions
Darrick J. Wong <[email protected]>
ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
Arend Van Spriel <[email protected]>
brcmfmac: add length check in brcmf_cfg80211_escan_handler()
-------------
Diffstat:
Makefile | 4 ++-- arch/mips/math-emu/cp1emu.c | 2 -- arch/x86/include/asm/alternative-asm.h | 4 +++- arch/x86/include/asm/alternative.h | 6 ++--- arch/x86/kvm/vmx.c | 2 +- block/bio.c | 8 +++++++ crypto/shash.c | 8 ++++--- drivers/dma/edma.c | 19 ++++++++++++--- drivers/hid/usbhid/hid-core.c | 12 +++++++++- drivers/iommu/amd_iommu.c | 1 + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 18 ++++++++++++--- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 10 +++++++- drivers/usb/gadget/composite.c | 5 ++++ drivers/usb/gadget/udc/dummy_hcd.c | 9 +++++--- drivers/usb/renesas_usbhs/fifo.c | 2 +- drivers/usb/serial/console.c | 1 + drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 7 ++++++ drivers/usb/serial/option.c | 2 ++ drivers/usb/serial/qcserial.c | 4 ++++ fs/cifs/cifsglob.h | 2 ++ fs/cifs/cifssmb.c | 7 ++++++ fs/cifs/connect.c | 7 ++++++ fs/cifs/smb2ops.c | 16 +++++++++++++ fs/direct-io.c | 3 ++- fs/ext4/file.c | 4 ++-- include/sound/seq_virmidi.h | 1 + kernel/rcu/tree.c | 12 ++++++++++ net/wireless/nl80211.c | 12 ++++++++-- sound/core/seq/seq_clientmgr.c | 6 ++++- sound/core/seq/seq_ports.c | 7 ++++-- sound/core/seq/seq_virmidi.c | 27 +++++++++++++++------- sound/usb/caiaq/device.c | 12 +++++++--- sound/usb/line6/driver.c | 7 +++--- sound/usb/mixer.c | 12 ++++++++-- sound/usb/mixer.h | 2 ++ 37 files changed, 216 insertions(+), 48 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 27/28 USB: serial: console: fix use-after-free after failed setup
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 299d7572e46f98534033a9e65973f13ad1ce9047 upstream.
Make sure to reset the USB-console port pointer when console setup fails in order to avoid having the struct usb_serial be prematurely freed by the console code when the device is later disconnected.
--- drivers/usb/serial/console.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/console.c +1 -0
@@ -189,6 +189,7 @@ static int usb_console_setup(struct constty_kref_put (tty); reset_open_count: port->port.count =0 ; + info->port =NULL ;usb_autopm_put_interface (serial->interface); error_get_interface:usb_serial_put (serial);
Greg Kroah-Hartman
maintainerPATCH 26/28 USB: serial: qcserial: add Dell DW5818, DW5819
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrirang Bagul <[email protected]>
commit f5d9644c5fca7d8e8972268598bb516a7eae17f9 upstream.
Dell Wireless 5819/5818 devices are re-branded Sierra Wireless MC74 series which will by default boot with vid 0x413c and pid's 0x81cf, 0x81d0, 0x81d1, 0x81d2.
--- drivers/usb/serial/qcserial.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/qcserial.c +4 -0
@@ -174,6 +174,10 @@ static const struct usb_device_id id_tab {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */ {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */ + {DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */ + {DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */ + {DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */ + {DEVICE_SWI(0x413c, 0x81d2)}, /* Dell Wireless 5818 *//* Huawei devices */ {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.93 release. There are 28 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 Wed Oct 18 16:09:10 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.93-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 and kselftest regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.93 release. There are 28 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 Wed Oct 18 16:09:10 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 116 pass: 116 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Re: [4.4,06/28] rcu: Allow for page faults in NMI handlers
In reply to Greg Kroah-HartmanQuoted 41 lines · On Mon, 2017-10-16 at 18:11 +0200, [email protected] wrote:
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul E. McKenney <[email protected]>
commit
28585a832602747cbfa88ad8934013177a3aae38upstream.A number of architecture invoke
rcu_irq_enter()on exception entry in order to allow RCU read-side critical sections in the exception handler when the exception is from an idle ornohz_fullCPU. This works, at least unless the exception happens in an NMI handler. In that case,rcu_nmi_enter()would already have exited the extended quiescent state, which would mean thatrcu_irq_enter()would (incorrectly) cause RCU to think that it is again in an extended quiescent state. This will in turn result in lockdep splats in response to later RCU read-side critical sections.This commit therefore causes
rcu_irq_enter()andrcu_irq_exit()to take no action if there is anrcu_nmi_enter()in effect, thus avoiding the unscheduled return to RCU quiescent state. This in turn should make the kernel safe for on-demand RCU voyeurism.Fixes 0be964be0 ("module: Sanitize RCU usage and locking")Quoted 4 lines
Reported-by Steven Rostedt <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
kernel/rcu/tree.c | 12 ++++++++++++1 file changed, 12 insertions(+)kernel/rcu/tree.c +0
-0@@ -759,6 +759,12 @@ void rcu_irq_exit(void)
local_irq_save(flags);
rdtp =this_cpu_ptr(&rcu_dynticks);
kernel/rcu/tree.c void rcu_irq_exit(void) · line 765
Quoted 4 lines
kernel/rcu/tree.c +4
-0+ +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ;
Shouldn't there be a local_irq_restore() on this return path? Or does this condition imply that IRQs were already disabled?
kernel/rcu/tree.c void rcu_irq_exit(void) · line 767
Quoted 1 line
kernel/rcu/tree.c +1
-0+RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_exit() invoked with irqs enabled!!!" );
I don't see why you added RCU_LOCKDEP_WARN() here. Prior to 4.5 it's not an error to call this function with IRQs disabled. And after calling local_irq_save(), it's redundant to assert that IRQs are disabled.
kernel/rcu/tree.c void rcu_irq_enter(void) · line 901
Quoted 13 lines
oldval =
rdtp->dynticks_nesting; rdtp->dynticks_nesting--; WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&kernel/rcu/tree.c +0
-0@@ -887,6 +893,12 @@ void rcu_irq_enter(void)
local_irq_save(flags);
rdtp =this_cpu_ptr(&rcu_dynticks);kernel/rcu/tree.c +6
-0+ +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ; + +RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_enter() invoked with irqs enabled!!!" );
Same problems here.
Ben.
Quoted 3 lines
oldval =
rdtp->dynticks_nesting; rdtp->dynticks_nesting++; WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
Signature · 2 lines
Ben Hutchings Software Developer, Codethink Ltd.
Re: [4.4,06/28] rcu: Allow for page faults in NMI handlers
Quoted 36 lines · On Thu, 09 Nov 2017 15:17:28 +0000 Ben Hutchings…
Quoted 35 lines · On Mon, 2017-10-16 at 18:11 +0200, [email protected] wrote:
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul E. McKenney <[email protected]>
commit
28585a832602747cbfa88ad8934013177a3aae38upstream.A number of architecture invoke
rcu_irq_enter()on exception entry in order to allow RCU read-side critical sections in the exception handler when the exception is from an idle ornohz_fullCPU. This works, at least unless the exception happens in an NMI handler. In that case,rcu_nmi_enter()would already have exited the extended quiescent state, which would mean thatrcu_irq_enter()would (incorrectly) cause RCU to think that it is again in an extended quiescent state. This will in turn result in lockdep splats in response to later RCU read-side critical sections.This commit therefore causes
rcu_irq_enter()andrcu_irq_exit()to take no action if there is anrcu_nmi_enter()in effect, thus avoiding the unscheduled return to RCU quiescent state. This in turn should make the kernel safe for on-demand RCU voyeurism.Fixes 0be964be0 ("module: Sanitize RCU usage and locking")Quoted 4 lines
Reported-by Steven Rostedt <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
kernel/rcu/tree.c | 12 ++++++++++++1 file changed, 12 insertions(+)
Quoted 13 lines
kernel/rcu/tree.c void rcu_irq_exit(void) · line 765
Quoted 10 lines
kernel/rcu/tree.c +0
-0@@ -759,6 +759,12 @@ void rcu_irq_exit(void)
local_irq_save(flags);
rdtp =this_cpu_ptr(&rcu_dynticks);kernel/rcu/tree.c +4
-0+ +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ;Shouldn't there be a
local_irq_restore()on this return path? Or does this condition imply that IRQs were already disabled?
It does, but there still should be a local_irq_restore(), because it will might confuse lockdep (lockdep keeps track of these), and it just looks bad.
Quoted 7 lines
kernel/rcu/tree.c void rcu_irq_exit(void) · line 767
Quoted 2 lines
kernel/rcu/tree.c +1
-0+RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_exit() invoked with irqs enabled!!!" );I don't see why you added
RCU_LOCKDEP_WARN()here. Prior to 4.5 it's not an error to call this function with IRQs disabled. And after callinglocal_irq_save(), it's redundant to assert that IRQs are disabled.
good point.
Quoted 16 lines
Quoted 8 lines
oldval =
rdtp->dynticks_nesting; rdtp->dynticks_nesting--; WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&kernel/rcu/tree.c +0
-0@@ -887,6 +893,12 @@ void rcu_irq_enter(void)
local_irq_save(flags);
rdtp =this_cpu_ptr(&rcu_dynticks);kernel/rcu/tree.c void rcu_irq_enter(void) · line 901
Quoted 6 lines
kernel/rcu/tree.c +6
-0+ +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ; + +RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_enter() invoked with irqs enabled!!!" );Same problems here.
-- Steve
Re: [4.4,06/28] rcu: Allow for page faults in NMI handlers
In reply to Ben HutchingsQuoted 57 lines · Ben Hutchings
Quoted 41 lines · On Mon, 2017-10-16 at 18:11 +0200, [email protected] wrote:
4.4-stable review patch.��If anyone has any objections, please let me know.
------------------
From: Paul E. McKenney <[email protected]>
commit
28585a832602747cbfa88ad8934013177a3aae38upstream.A number of architecture invoke
rcu_irq_enter()on exception entry in order to allow RCU read-side critical sections in the exception handler when the exception is from an idle ornohz_fullCPU.��This works, at least unless the exception happens in an NMI handler.��In that case,rcu_nmi_enter()would already have exited the extended quiescent state, which would mean thatrcu_irq_enter()would (incorrectly) cause RCU to think that it is again in an extended quiescent state.��This will in turn result in lockdep splats in response to later RCU read-side critical sections.This commit therefore causes
rcu_irq_enter()andrcu_irq_exit()to take no action if there is anrcu_nmi_enter()in effect, thus avoiding the unscheduled return to RCU quiescent state.��This in turn should make the kernel safe for on-demand RCU voyeurism.Fixes 0be964be0 ("module: Sanitize RCU usage and locking")Quoted 4 lines
Reported-by Steven Rostedt <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
�kernel/rcu/tree.c |���12 ++++++++++++
�1 file changed, 12 insertions(+)kernel/rcu/tree.c +0
-0@@ -759,6 +759,12 @@ void rcu_irq_exit(void)�
�local_irq_save(flags);
� rdtp =this_cpu_ptr(&rcu_dynticks);kernel/rcu/tree.c void rcu_irq_exit(void) · line 765
Quoted 4 lines
kernel/rcu/tree.c +4
-0+ +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ;Shouldn't there be a
local_irq_restore()on this return path? Or does this condition imply that IRQs were already disabled?kernel/rcu/tree.c void rcu_irq_exit(void) · line 767
Quoted 1 line
kernel/rcu/tree.c +1
-0+RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_exit() invoked with irqs enabled!!!" );I don't see why you added
RCU_LOCKDEP_WARN()here. Prior to 4.5 it's not an error to call this function with IRQs disabled. And after callinglocal_irq_save(), it's redundant to assert that IRQs are disabled.
Quoted 15 lines
kernel/rcu/tree.c void rcu_irq_enter(void) · line 901
Quoted 13 lines
� oldval =
rdtp->dynticks_nesting;
� rdtp->dynticks_nesting--;
� WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&kernel/rcu/tree.c +0
-0@@ -887,6 +893,12 @@ void rcu_irq_enter(void)�
�local_irq_save(flags);
� rdtp =this_cpu_ptr(&rcu_dynticks);kernel/rcu/tree.c +6
-0+ +/* Page faults can happen in NMI handlers, so check... */ +if (READ_ONCE (rdtp->dynticks_nmi_nesting)) +return ; + +RCU_LOCKDEP_WARN (!irqs_disabled (),"rcu_irq_enter() invoked with irqs enabled!!!" );Same problems here.
Indeed, it looks like I need to rework this for 4.5 and earlier. Sorry for the noise!
Thanx, Paul