1. 21 9月, 2019 6 次提交
    • P
      r8152: Set memory to all 0xFFs on failed reg reads · 688fdaa5
      Prashant Malani 提交于
      [ Upstream commit f53a7ad189594a112167efaf17ea8d0242b5ac00 ]
      
      get_registers() blindly copies the memory written to by the
      usb_control_msg() call even if the underlying urb failed.
      
      This could lead to junk register values being read by the driver, since
      some indirect callers of get_registers() ignore the return values. One
      example is:
        ocp_read_dword() ignores the return value of generic_ocp_read(), which
        calls get_registers().
      
      So, emulate PCI "Master Abort" behavior by setting the buffer to all
      0xFFs when usb_control_msg() fails.
      
      This patch is copied from the r8152 driver (v2.12.0) published by
      Realtek (www.realtek.com).
      Signed-off-by: NPrashant Malani <pmalani@chromium.org>
      Acked-by: NHayes Wang <hayeswang@realtek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      688fdaa5
    • W
      qed: Add cleanup in qed_slowpath_start() · b870f8af
      Wenwen Wang 提交于
      [ Upstream commit de0e4fd2f07ce3bbdb69dfb8d9426b7227451b69 ]
      
      If qed_mcp_send_drv_version() fails, no cleanup is executed, leading to
      memory leaks. To fix this issue, introduce the label 'err4' to perform the
      cleanup work before returning the error.
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Acked-by: NSudarsana Reddy Kalluru <skalluru@marvell.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b870f8af
    • Y
      ieee802154: hwsim: unregister hw while hwsim_subscribe_all_others fails · ac8f26f6
      YueHaibing 提交于
      [ Upstream commit de166bbe861738c8bc3e5dad5b03f45d7d6ef914 ]
      
      KASAN report this:
      
      kernel BUG at net/mac802154/main.c:130!
      invalid opcode: 0000 [#1] PREEMPT SMP
      CPU: 0 PID: 19932 Comm: modprobe Not tainted 5.1.0-rc6+ #22
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
      RIP: 0010:ieee802154_free_hw+0x2a/0x30 [mac802154]
      Code: 55 48 8d 57 38 48 89 e5 53 48 89 fb 48 8b 47 38 48 39 c2 75 15 48 8d 7f 48 e8 82 85 16 e1 48 8b 7b 28 e8 f9 ef 83 e2 5b 5d c3 <0f> 0b 0f 1f 40 00 55 48 89 e5 53 48 89 fb 0f b6 86 80 00 00 00 88
      RSP: 0018:ffffc90001c7b9f0 EFLAGS: 00010206
      RAX: ffff88822df3aa80 RBX: ffff88823143d5c0 RCX: 0000000000000002
      RDX: ffff88823143d5f8 RSI: ffff88822b1fabc0 RDI: ffff88823143d5c0
      RBP: ffffc90001c7b9f8 R08: 0000000000000000 R09: 0000000000000001
      R10: 0000000000000000 R11: 0000000000000000 R12: 00000000fffffff4
      R13: ffff88822dea4f50 R14: ffff88823143d7c0 R15: 00000000fffffff4
      FS: 00007ff52e999540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fdc06dba768 CR3: 000000023160a000 CR4: 00000000000006f0
      Call Trace:
       hwsim_add_one+0x2dd/0x540 [mac802154_hwsim]
       hwsim_probe+0x2f/0xb0 [mac802154_hwsim]
       platform_drv_probe+0x3a/0x90
       ? driver_sysfs_add+0x79/0xb0
       really_probe+0x1d4/0x2d0
       driver_probe_device+0x50/0xf0
       device_driver_attach+0x54/0x60
       __driver_attach+0x7e/0xd0
       ? device_driver_attach+0x60/0x60
       bus_for_each_dev+0x68/0xc0
       driver_attach+0x19/0x20
       bus_add_driver+0x15e/0x200
       driver_register+0x5b/0xf0
       __platform_driver_register+0x31/0x40
       hwsim_init_module+0x74/0x1000 [mac802154_hwsim]
       ? 0xffffffffa00e9000
       do_one_initcall+0x6c/0x3cc
       ? kmem_cache_alloc_trace+0x248/0x3b0
       do_init_module+0x5b/0x1f1
       load_module+0x1db1/0x2690
       ? m_show+0x1d0/0x1d0
       __do_sys_finit_module+0xc5/0xd0
       __x64_sys_finit_module+0x15/0x20
       do_syscall_64+0x6b/0x1d0
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x7ff52e4a2839
      Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48
      RSP: 002b:00007ffffa7b3c08 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      RAX: ffffffffffffffda RBX: 00005647560a2a00 RCX: 00007ff52e4a2839
      RDX: 0000000000000000 RSI: 00005647547f3c2e RDI: 0000000000000003
      RBP: 00005647547f3c2e R08: 0000000000000000 R09: 00005647560a2a00
      R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
      R13: 00005647560a2c10 R14: 0000000000040000 R15: 00005647560a2a00
      Modules linked in: mac802154_hwsim(+) mac802154 [last unloaded: mac802154_hwsim]
      
      In hwsim_add_one, if hwsim_subscribe_all_others fails, we
      should call ieee802154_unregister_hw to free resources.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Fixes: f25da51f ("ieee802154: hwsim: add replacement for fakelb")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Acked-by: NAlexander Aring <aring@mojatatu.com>
      Signed-off-by: NStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ac8f26f6
    • Y
      ieee802154: hwsim: Fix error handle path in hwsim_init_module · c237a050
      YueHaibing 提交于
      [ Upstream commit 1cbbbf39efab05fae67f59e6ed01bb85061c69e2 ]
      
      KASAN report this:
      
      BUG: unable to handle kernel paging request at fffffbfff834f001
      PGD 237fe8067 P4D 237fe8067 PUD 237e64067 PMD 1c968d067 PTE 0
      Oops: 0000 [#1] SMP KASAN PTI
      CPU: 1 PID: 8871 Comm: syz-executor.0 Tainted: G         C        5.0.0+ #5
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
      RIP: 0010:strcmp+0x31/0xa0 lib/string.c:328
      Code: 00 00 00 00 fc ff df 55 53 48 83 ec 08 eb 0a 84 db 48 89 ef 74 5a 4c 89 e6 48 89 f8 48 89 fa 48 8d 6f 01 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 04 84 c0 75 50 48 89 f0 48 89 f2 0f b6 5d
      RSP: 0018:ffff8881e0c57800 EFLAGS: 00010246
      RAX: 1ffffffff834f001 RBX: ffffffffc1a78000 RCX: ffffffff827b9503
      RDX: 0000000000000000 RSI: ffffffffc1a40008 RDI: ffffffffc1a78008
      RBP: ffffffffc1a78009 R08: fffffbfff6a92195 R09: fffffbfff6a92195
      R10: ffff8881e0c578b8 R11: fffffbfff6a92194 R12: ffffffffc1a40008
      R13: dffffc0000000000 R14: ffffffffc1a3e470 R15: ffffffffc1a40000
      FS:  00007fdcc02ff700(0000) GS:ffff8881f7300000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: fffffbfff834f001 CR3: 00000001b3134003 CR4: 00000000007606e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      Call Trace:
       genl_family_find_byname+0x7f/0xf0 net/netlink/genetlink.c:104
       genl_register_family+0x1e1/0x1070 net/netlink/genetlink.c:333
       ? 0xffffffffc1978000
       hwsim_init_module+0x6a/0x1000 [mac802154_hwsim]
       ? 0xffffffffc1978000
       ? 0xffffffffc1978000
       ? 0xffffffffc1978000
       do_one_initcall+0xbc/0x47d init/main.c:887
       do_init_module+0x1b5/0x547 kernel/module.c:3456
       load_module+0x6405/0x8c10 kernel/module.c:3804
       __do_sys_finit_module+0x162/0x190 kernel/module.c:3898
       do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x462e99
      Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007fdcc02fec58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99
      RDX: 0000000000000000 RSI: 0000000020000200 RDI: 0000000000000003
      RBP: 00007fdcc02fec70 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007fdcc02ff6bc
      R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004
      Modules linked in: mac802154_hwsim(+) mac802154 ieee802154 speakup(C) rc_proteus_2309 rtc_rk808 streebog_generic rds vboxguest madera_spi madera da9052_wdt mISDN_core ueagle_atm usbatm atm ir_imon_decoder scsi_transport_sas rc_dntv_live_dvb_t panel_samsung_s6d16d0 drm drm_panel_orientation_quirks lib80211 fb_agm1264k_fl(C) gspca_pac7302 gspca_main videobuf2_v4l2 soundwire_intel_init i2c_dln2 dln2 usbcore hid_gaff 88pm8607 nfnetlink axp20x_i2c axp20x uio pata_marvell pmbus_core snd_sonicvibes gameport snd_pcm snd_opl3_lib snd_timer snd_hwdep snd_mpu401_uart snd_rawmidi snd_seq_device snd soundcore rtc_ds1511 rtc_ds1742 vsock dwc_xlgmac rtc_rx8010 libphy twofish_x86_64_3way twofish_x86_64 twofish_common ad5696_i2c ad5686 lp8788_charger cxd2880_spi dvb_core videobuf2_common videodev media videobuf2_vmalloc videobuf2_memops fbtft(C) sysimgblt sysfillrect syscopyarea fb_sys_fops janz_ican3 firewire_net firewire_core crc_itu_t spi_slave_system_control i2c_matroxfb i2c_algo_bit
       matroxfb_base fb fbdev matroxfb_DAC1064 matroxfb_accel cfbcopyarea cfbimgblt cfbfillrect matroxfb_Ti3026 matroxfb_g450 g450_pll matroxfb_misc leds_blinkm ti_dac7311 intel_spi_pci intel_spi spi_nor hid_elan hid async_tx rc_cinergy_1400 rc_core intel_ishtp kxcjk_1013 industrialio_triggered_buffer kfifo_buf can_dev intel_th spi_pxa2xx_platform pata_artop vme_ca91cx42 gb_gbphy(C) greybus(C) industrialio mptbase st_drv cmac ttpci_eeprom via_wdt gpio_xra1403 mtd iptable_security iptable_raw iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter bpfilter ip6_vti ip_vti ip_gre ipip sit tunnel4 ip_tunnel hsr veth netdevsim vxcan batman_adv cfg80211 rfkill chnl_net caif nlmon dummy team bonding vcan bridge stp llc ip6_gre gre ip6_tunnel tunnel6 tun joydev mousedev ppdev kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel aes_x86_64 input_leds crypto_simd cryptd glue_helper ide_pci_generic piix psmouse
       ide_core serio_raw ata_generic i2c_piix4 pata_acpi parport_pc parport floppy rtc_cmos intel_agp intel_gtt agpgart sch_fq_codel ip_tables x_tables sha1_ssse3 sha1_generic ipv6 [last unloaded: speakup]
      Dumping ftrace buffer:
         (ftrace buffer empty)
      CR2: fffffbfff834f001
      ---[ end trace 5aa772c793e0e971 ]---
      RIP: 0010:strcmp+0x31/0xa0 lib/string.c:328
      Code: 00 00 00 00 fc ff df 55 53 48 83 ec 08 eb 0a 84 db 48 89 ef 74 5a 4c 89 e6 48 89 f8 48 89 fa 48 8d 6f 01 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 04 84 c0 75 50 48 89 f0 48 89 f2 0f b6 5d
      RSP: 0018:ffff8881e0c57800 EFLAGS: 00010246
      RAX: 1ffffffff834f001 RBX: ffffffffc1a78000 RCX: ffffffff827b9503
      RDX: 0000000000000000 RSI: ffffffffc1a40008 RDI: ffffffffc1a78008
      RBP: ffffffffc1a78009 R08: fffffbfff6a92195 R09: fffffbfff6a92195
      R10: ffff8881e0c578b8 R11: fffffbfff6a92194 R12: ffffffffc1a40008
      R13: dffffc0000000000 R14: ffffffffc1a3e470 R15: ffffffffc1a40000
      FS:  00007fdcc02ff700(0000) GS:ffff8881f7300000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: fffffbfff834f001 CR3: 00000001b3134003 CR4: 00000000007606e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      
      The error handing path misplace the cleanup in hwsim_init_module,
      switch the two cleanup functions to fix above issues.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Fixes: f25da51f ("ieee802154: hwsim: add replacement for fakelb")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Acked-by: NAlexander Aring <aring@mojatatu.com>
      Signed-off-by: NStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c237a050
    • W
      mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings · 941431c4
      Wen Huang 提交于
      commit 7caac62ed598a196d6ddf8d9c121e12e082cac3a upstream.
      
      mwifiex_update_vs_ie(),mwifiex_set_uap_rates() and
      mwifiex_set_wmm_params() call memcpy() without checking
      the destination size.Since the source is given from
      user-space, this may trigger a heap buffer overflow.
      
      Fix them by putting the length check before performing memcpy().
      
      This fix addresses CVE-2019-14814,CVE-2019-14815,CVE-2019-14816.
      Signed-off-by: NWen Huang <huangwenabc@gmail.com>
      Acked-by: NGanapathi Bhat <gbhat@marvell.comg>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      941431c4
    • D
      xen-netfront: do not assume sk_buff_head list is empty in error handling · 47288968
      Dongli Zhang 提交于
      [ Upstream commit 00b368502d18f790ab715e055869fd4bb7484a9b ]
      
      When skb_shinfo(skb) is not able to cache extra fragment (that is,
      skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS), xennet_fill_frags() assumes
      the sk_buff_head list is already empty. As a result, cons is increased only
      by 1 and returns to error handling path in xennet_poll().
      
      However, if the sk_buff_head list is not empty, queue->rx.rsp_cons may be
      set incorrectly. That is, queue->rx.rsp_cons would point to the rx ring
      buffer entries whose queue->rx_skbs[i] and queue->grant_rx_ref[i] are
      already cleared to NULL. This leads to NULL pointer access in the next
      iteration to process rx ring buffer entries.
      
      Below is how xennet_poll() does error handling. All remaining entries in
      tmpq are accounted to queue->rx.rsp_cons without assuming how many
      outstanding skbs are remained in the list.
      
       985 static int xennet_poll(struct napi_struct *napi, int budget)
      ... ...
      1032           if (unlikely(xennet_set_skb_gso(skb, gso))) {
      1033                   __skb_queue_head(&tmpq, skb);
      1034                   queue->rx.rsp_cons += skb_queue_len(&tmpq);
      1035                   goto err;
      1036           }
      
      It is better to always have the error handling in the same way.
      
      Fixes: ad4f15dc ("xen/netfront: don't bug in case of too many frags")
      Signed-off-by: NDongli Zhang <dongli.zhang@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      47288968
  2. 19 9月, 2019 6 次提交
    • H
      rsi: fix a double free bug in rsi_91x_deinit() · 3622d621
      Hui Peng 提交于
      commit 8b51dc7291473093c821195c4b6af85fadedbc2f upstream.
      
      `dev` (struct rsi_91x_usbdev *) field of adapter
      (struct rsi_91x_usbdev *) is allocated  and initialized in
      `rsi_init_usb_interface`. If any error is detected in information
      read from the device side,  `rsi_init_usb_interface` will be
      freed. However, in the higher level error handling code in
      `rsi_probe`, if error is detected, `rsi_91x_deinit` is called
      again, in which `dev` will be freed again, resulting double free.
      
      This patch fixes the double free by removing the free operation on
      `dev` in `rsi_init_usb_interface`, because `rsi_91x_deinit` is also
      used in `rsi_disconnect`, in that code path, the `dev` field is not
       (and thus needs to be) freed.
      
      This bug was found in v4.19, but is also present in the latest version
      of kernel. Fixes CVE-2019-15504.
      Reported-by: NHui Peng <benquike@gmail.com>
      Reported-by: NMathias Payer <mathias.payer@nebelwelt.net>
      Signed-off-by: NHui Peng <benquike@gmail.com>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3622d621
    • A
      ixgbe: Prevent u8 wrapping of ITR value to something less than 10us · 5b5f1460
      Alexander Duyck 提交于
      commit 377228accbbb8b9738f615d791aa803f41c067e0 upstream.
      
      There were a couple cases where the ITR value generated via the adaptive
      ITR scheme could exceed 126. This resulted in the value becoming either 0
      or something less than 10. Switching back and forth between a value less
      than 10 and a value greater than 10 can cause issues as certain hardware
      features such as RSC to not function well when the ITR value has dropped
      that low.
      
      CC: stable@vger.kernel.org
      Fixes: b4ded832 ("ixgbe: Update adaptive ITR algorithm")
      Reported-by: NGregg Leventhal <gleventhal@janestreet.com>
      Signed-off-by: NAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b5f1460
    • Y
      tun: fix use-after-free when register netdev failed · 0f4ceb25
      Yang Yingliang 提交于
      [ Upstream commit 77f22f92dff8e7b45c7786a430626d38071d4670 ]
      
      I got a UAF repport in tun driver when doing fuzzy test:
      
      [  466.269490] ==================================================================
      [  466.271792] BUG: KASAN: use-after-free in tun_chr_read_iter+0x2ca/0x2d0
      [  466.271806] Read of size 8 at addr ffff888372139250 by task tun-test/2699
      [  466.271810]
      [  466.271824] CPU: 1 PID: 2699 Comm: tun-test Not tainted 5.3.0-rc1-00001-g5a9433db2614-dirty #427
      [  466.271833] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
      [  466.271838] Call Trace:
      [  466.271858]  dump_stack+0xca/0x13e
      [  466.271871]  ? tun_chr_read_iter+0x2ca/0x2d0
      [  466.271890]  print_address_description+0x79/0x440
      [  466.271906]  ? vprintk_func+0x5e/0xf0
      [  466.271920]  ? tun_chr_read_iter+0x2ca/0x2d0
      [  466.271935]  __kasan_report+0x15c/0x1df
      [  466.271958]  ? tun_chr_read_iter+0x2ca/0x2d0
      [  466.271976]  kasan_report+0xe/0x20
      [  466.271987]  tun_chr_read_iter+0x2ca/0x2d0
      [  466.272013]  do_iter_readv_writev+0x4b7/0x740
      [  466.272032]  ? default_llseek+0x2d0/0x2d0
      [  466.272072]  do_iter_read+0x1c5/0x5e0
      [  466.272110]  vfs_readv+0x108/0x180
      [  466.299007]  ? compat_rw_copy_check_uvector+0x440/0x440
      [  466.299020]  ? fsnotify+0x888/0xd50
      [  466.299040]  ? __fsnotify_parent+0xd0/0x350
      [  466.299064]  ? fsnotify_first_mark+0x1e0/0x1e0
      [  466.304548]  ? vfs_write+0x264/0x510
      [  466.304569]  ? ksys_write+0x101/0x210
      [  466.304591]  ? do_preadv+0x116/0x1a0
      [  466.304609]  do_preadv+0x116/0x1a0
      [  466.309829]  do_syscall_64+0xc8/0x600
      [  466.309849]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
      [  466.309861] RIP: 0033:0x4560f9
      [  466.309875] Code: 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      [  466.309889] RSP: 002b:00007ffffa5166e8 EFLAGS: 00000206 ORIG_RAX: 0000000000000127
      [  466.322992] RAX: ffffffffffffffda RBX: 0000000000400460 RCX: 00000000004560f9
      [  466.322999] RDX: 0000000000000003 RSI: 00000000200008c0 RDI: 0000000000000003
      [  466.323007] RBP: 00007ffffa516700 R08: 0000000000000004 R09: 0000000000000000
      [  466.323014] R10: 0000000000000000 R11: 0000000000000206 R12: 000000000040cb10
      [  466.323021] R13: 0000000000000000 R14: 00000000006d7018 R15: 0000000000000000
      [  466.323057]
      [  466.323064] Allocated by task 2605:
      [  466.335165]  save_stack+0x19/0x80
      [  466.336240]  __kasan_kmalloc.constprop.8+0xa0/0xd0
      [  466.337755]  kmem_cache_alloc+0xe8/0x320
      [  466.339050]  getname_flags+0xca/0x560
      [  466.340229]  user_path_at_empty+0x2c/0x50
      [  466.341508]  vfs_statx+0xe6/0x190
      [  466.342619]  __do_sys_newstat+0x81/0x100
      [  466.343908]  do_syscall_64+0xc8/0x600
      [  466.345303]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
      [  466.347034]
      [  466.347517] Freed by task 2605:
      [  466.348471]  save_stack+0x19/0x80
      [  466.349476]  __kasan_slab_free+0x12e/0x180
      [  466.350726]  kmem_cache_free+0xc8/0x430
      [  466.351874]  putname+0xe2/0x120
      [  466.352921]  filename_lookup+0x257/0x3e0
      [  466.354319]  vfs_statx+0xe6/0x190
      [  466.355498]  __do_sys_newstat+0x81/0x100
      [  466.356889]  do_syscall_64+0xc8/0x600
      [  466.358037]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
      [  466.359567]
      [  466.360050] The buggy address belongs to the object at ffff888372139100
      [  466.360050]  which belongs to the cache names_cache of size 4096
      [  466.363735] The buggy address is located 336 bytes inside of
      [  466.363735]  4096-byte region [ffff888372139100, ffff88837213a100)
      [  466.367179] The buggy address belongs to the page:
      [  466.368604] page:ffffea000dc84e00 refcount:1 mapcount:0 mapping:ffff8883df1b4f00 index:0x0 compound_mapcount: 0
      [  466.371582] flags: 0x2fffff80010200(slab|head)
      [  466.372910] raw: 002fffff80010200 dead000000000100 dead000000000122 ffff8883df1b4f00
      [  466.375209] raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
      [  466.377778] page dumped because: kasan: bad access detected
      [  466.379730]
      [  466.380288] Memory state around the buggy address:
      [  466.381844]  ffff888372139100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  466.384009]  ffff888372139180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  466.386131] >ffff888372139200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  466.388257]                                                  ^
      [  466.390234]  ffff888372139280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  466.392512]  ffff888372139300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  466.394667] ==================================================================
      
      tun_chr_read_iter() accessed the memory which freed by free_netdev()
      called by tun_set_iff():
      
              CPUA                                           CPUB
        tun_set_iff()
          alloc_netdev_mqs()
          tun_attach()
                                                        tun_chr_read_iter()
                                                          tun_get()
                                                          tun_do_read()
                                                            tun_ring_recv()
          register_netdevice() <-- inject error
          goto err_detach
          tun_detach_all() <-- set RCV_SHUTDOWN
          free_netdev() <-- called from
                           err_free_dev path
            netdev_freemem() <-- free the memory
                              without check refcount
            (In this path, the refcount cannot prevent
             freeing the memory of dev, and the memory
             will be used by dev_put() called by
             tun_chr_read_iter() on CPUB.)
                                                           (Break from tun_ring_recv(),
                                                           because RCV_SHUTDOWN is set)
                                                         tun_put()
                                                           dev_put() <-- use the memory
                                                                         freed by netdev_freemem()
      
      Put the publishing of tfile->tun after register_netdevice(),
      so tun_get() won't get the tun pointer that freed by
      err_detach path if register_netdevice() failed.
      
      Fixes: eb0fb363 ("tuntap: attach queue 0 before registering netdevice")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Suggested-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f4ceb25
    • S
      net: phylink: Fix flow control resolution · 3600a311
      Stefan Chulski 提交于
      [ Upstream commit 63b2ed4e10b2e6c913e1d8cdd728e7fba4115a3d ]
      
      Regarding to IEEE 802.3-2015 standard section 2
      28B.3 Priority resolution - Table 28-3 - Pause resolution
      
      In case of Local device Pause=1 AsymDir=0, Link partner
      Pause=1 AsymDir=1, Local device resolution should be enable PAUSE
      transmit, disable PAUSE receive.
      And in case of Local device Pause=1 AsymDir=1, Link partner
      Pause=1 AsymDir=0, Local device resolution should be enable PAUSE
      receive, disable PAUSE transmit.
      
      Fixes: 9525ae83 ("phylink: add phylink infrastructure")
      Signed-off-by: NStefan Chulski <stefanc@marvell.com>
      Reported-by: NShaul Ben-Mayor <shaulb@marvell.com>
      Acked-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3600a311
    • S
      ixgbe: Fix secpath usage for IPsec TX offload. · b26f4892
      Steffen Klassert 提交于
      [ Upstream commit f39b683d35dfa93a58f1b400a8ec0ff81296b37c ]
      
      The ixgbe driver currently does IPsec TX offloading
      based on an existing secpath. However, the secpath
      can also come from the RX side, in this case it is
      misinterpreted for TX offload and the packets are
      dropped with a "bad sa_idx" error. Fix this by using
      the xfrm_offload() function to test for TX offload.
      
      Fixes: 59259470 ("ixgbe: process the Tx ipsec offload")
      Reported-by: NMichael Marley <michael@michaelmarley.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b26f4892
    • B
      cdc_ether: fix rndis support for Mediatek based smartphones · a20c8e4a
      Bjørn Mork 提交于
      [ Upstream commit 4d7ffcf3bf1be98d876c570cab8fc31d9fa92725 ]
      
      A Mediatek based smartphone owner reports problems with USB
      tethering in Linux.  The verbose USB listing shows a rndis_host
      interface pair (e0/01/03 + 10/00/00), but the driver fails to
      bind with
      
      [  355.960428] usb 1-4: bad CDC descriptors
      
      The problem is a failsafe test intended to filter out ACM serial
      functions using the same 02/02/ff class/subclass/protocol as RNDIS.
      The serial functions are recognized by their non-zero bmCapabilities.
      
      No RNDIS function with non-zero bmCapabilities were known at the time
      this failsafe was added. But it turns out that some Wireless class
      RNDIS functions are using the bmCapabilities field. These functions
      are uniquely identified as RNDIS by their class/subclass/protocol, so
      the failing test can safely be disabled.  The same applies to the two
      types of Misc class RNDIS functions.
      
      Applying the failsafe to Communication class functions only retains
      the original functionality, and fixes the problem for the Mediatek based
      smartphone.
      
      Tow examples of CDC functional descriptors with non-zero bmCapabilities
      from Wireless class RNDIS functions are:
      
      0e8d:000a  Mediatek Crosscall Spider X5 3G Phone
      
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x0f
                connection notifications
                sends break
                line coding and serial state
                get/set/clear comm features
            CDC Union:
              bMasterInterface        0
              bSlaveInterface         1
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          1
      
      and
      
      19d2:1023  ZTE K4201-z
      
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x02
                line coding and serial state
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          1
            CDC Union:
              bMasterInterface        0
              bSlaveInterface         1
      
      The Mediatek example is believed to apply to most smartphones with
      Mediatek firmware.  The ZTE example is most likely also part of a larger
      family of devices/firmwares.
      Suggested-by: NLars Melin <larsm17@gmail.com>
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a20c8e4a
  3. 16 9月, 2019 3 次提交
  4. 10 9月, 2019 15 次提交
  5. 06 9月, 2019 1 次提交
    • S
      mt76: mt76x0u: do not reset radio on resume · e064466c
      Stanislaw Gruszka 提交于
      commit 8f2d163cb26da87e7d8e1677368b8ba1ba4d30b3 upstream.
      
      On some machines mt76x0u firmware can hung during resume,
      what result on messages like below:
      
      [  475.480062] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  475.990066] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  475.990075] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  476.500003] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  476.500012] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.010046] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  477.010055] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.529997] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  477.530006] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.824907] mt76x0 1-8:1.0: Error: send MCU cmd failed:-71
      [  477.824916] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.825029] usb 1-8: USB disconnect, device number 6
      
      and possible whole system freeze.
      
      This can be avoided, if we do not perform mt76x0_chip_onoff() reset.
      
      Cc: stable@vger.kernel.org
      Fixes: 134b2d0d ("mt76x0: init files")
      Signed-off-by: NStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e064466c
  6. 29 8月, 2019 9 次提交
    • J
      net: hisilicon: Fix dma_map_single failed on arm64 · e0c03022
      Jiangfeng Xiao 提交于
      [ Upstream commit 96a50c0d907ac8f5c3d6b051031a19eb8a2b53e3 ]
      
      On the arm64 platform, executing "ifconfig eth0 up" will fail,
      returning "ifconfig: SIOCSIFFLAGS: Input/output error."
      
      ndev->dev is not initialized, dma_map_single->get_dma_ops->
      dummy_dma_ops->__dummy_map_page will return DMA_ERROR_CODE
      directly, so when we use dma_map_single, the first parameter
      is to use the device of platform_device.
      Signed-off-by: NJiangfeng Xiao <xiaojiangfeng@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e0c03022
    • J
      net: hisilicon: fix hip04-xmit never return TX_BUSY · 4ab30525
      Jiangfeng Xiao 提交于
      [ Upstream commit f2243b82785942be519016067ee6c55a063bbfe2 ]
      
      TX_DESC_NUM is 256, in tx_count, the maximum value of
      mod(TX_DESC_NUM - 1) is 254, the variable "count" in
      the hip04_mac_start_xmit function is never equal to
      (TX_DESC_NUM - 1), so hip04_mac_start_xmit never
      return NETDEV_TX_BUSY.
      
      tx_count is modified to mod(TX_DESC_NUM) so that
      the maximum value of tx_count can reach
      (TX_DESC_NUM - 1), then hip04_mac_start_xmit can reurn
      NETDEV_TX_BUSY.
      Signed-off-by: NJiangfeng Xiao <xiaojiangfeng@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      4ab30525
    • J
      net: hisilicon: make hip04_tx_reclaim non-reentrant · 09ec5bf1
      Jiangfeng Xiao 提交于
      [ Upstream commit 1a2c070ae805910a853b4a14818481ed2e17c727 ]
      
      If hip04_tx_reclaim is interrupted while it is running
      and then __napi_schedule continues to execute
      hip04_rx_poll->hip04_tx_reclaim, reentrancy occurs
      and oops is generated. So you need to mask the interrupt
      during the hip04_tx_reclaim run.
      
      The kernel oops exception stack is as follows:
      
      Unable to handle kernel NULL pointer dereference
      at virtual address 00000050
      pgd = c0003000
      [00000050] *pgd=80000000a04003, *pmd=00000000
      Internal error: Oops: 206 [#1] SMP ARM
      Modules linked in: hip04_eth mtdblock mtd_blkdevs mtd
      ohci_platform ehci_platform ohci_hcd ehci_hcd
      vfat fat sd_mod usb_storage scsi_mod usbcore usb_common
      CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O    4.4.185 #1
      Hardware name: Hisilicon A15
      task: c0a250e0 task.stack: c0a00000
      PC is at hip04_tx_reclaim+0xe0/0x17c [hip04_eth]
      LR is at hip04_tx_reclaim+0x30/0x17c [hip04_eth]
      pc : [<bf30c3a4>]    lr : [<bf30c2f4>]    psr: 600e0313
      sp : c0a01d88  ip : 00000000  fp : c0601f9c
      r10: 00000000  r9 : c3482380  r8 : 00000001
      r7 : 00000000  r6 : 000000e1  r5 : c3482000  r4 : 0000000c
      r3 : f2209800  r2 : 00000000  r1 : 00000000  r0 : 00000000
      Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      Control: 32c5387d  Table: 03d28c80  DAC: 55555555
      Process swapper/0 (pid: 0, stack limit = 0xc0a00190)
      Stack: (0xc0a01d88 to 0xc0a02000)
      [<bf30c3a4>] (hip04_tx_reclaim [hip04_eth]) from [<bf30d2e0>]
                                                      (hip04_rx_poll+0x88/0x368 [hip04_eth])
      [<bf30d2e0>] (hip04_rx_poll [hip04_eth]) from [<c04c2d9c>] (net_rx_action+0x114/0x34c)
      [<c04c2d9c>] (net_rx_action) from [<c021eed8>] (__do_softirq+0x218/0x318)
      [<c021eed8>] (__do_softirq) from [<c021f284>] (irq_exit+0x88/0xac)
      [<c021f284>] (irq_exit) from [<c0240090>] (msa_irq_exit+0x11c/0x1d4)
      [<c0240090>] (msa_irq_exit) from [<c02677e0>] (__handle_domain_irq+0x110/0x148)
      [<c02677e0>] (__handle_domain_irq) from [<c0201588>] (gic_handle_irq+0xd4/0x118)
      [<c0201588>] (gic_handle_irq) from [<c0551700>] (__irq_svc+0x40/0x58)
      Exception stack(0xc0a01f30 to 0xc0a01f78)
      1f20:                                     c0ae8b40 00000000 00000000 00000000
      1f40: 00000002 ffffe000 c0601f9c 00000000 ffffffff c0a2257c c0a22440 c0831a38
      1f60: c0a01ec4 c0a01f80 c0203714 c0203718 600e0213 ffffffff
      [<c0551700>] (__irq_svc) from [<c0203718>] (arch_cpu_idle+0x20/0x3c)
      [<c0203718>] (arch_cpu_idle) from [<c025bfd8>] (cpu_startup_entry+0x244/0x29c)
      [<c025bfd8>] (cpu_startup_entry) from [<c054b0d8>] (rest_init+0xc8/0x10c)
      [<c054b0d8>] (rest_init) from [<c0800c58>] (start_kernel+0x468/0x514)
      Code: a40599e5 016086e2 018088e2 7660efe6 (503090e5)
      ---[ end trace 1db21d6d09c49d74 ]---
      Kernel panic - not syncing: Fatal exception in interrupt
      CPU3: stopping
      CPU: 3 PID: 0 Comm: swapper/3 Tainted: G      D    O    4.4.185 #1Signed-off-by: NJiangfeng Xiao <xiaojiangfeng@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      09ec5bf1
    • J
      net: stmmac: tc: Do not return a fragment entry · b8d03c79
      Jose Abreu 提交于
      [ Upstream commit 4a6a1385a4db5f42258a40fcd497cbfd22075968 ]
      
      Do not try to return a fragment entry from TC list. Otherwise we may not
      clean properly allocated entries.
      Signed-off-by: NJose Abreu <joabreu@synopsys.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b8d03c79
    • J
      net: stmmac: Fix issues when number of Queues >= 4 · b6cd6d18
      Jose Abreu 提交于
      [ Upstream commit e8df7e8c233a18d2704e37ecff47583b494789d3 ]
      
      When queues >= 4 we use different registers but we were not subtracting
      the offset of 4. Fix this.
      
      Found out by Coverity.
      Signed-off-by: NJose Abreu <joabreu@synopsys.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b6cd6d18
    • C
      net: cxgb3_main: Fix a resource leak in a error path in 'init_one()' · 45e7e4e6
      Christophe JAILLET 提交于
      [ Upstream commit debea2cd3193ac868289e8893c3a719c265b0612 ]
      
      A call to 'kfree_skb()' is missing in the error handling path of
      'init_one()'.
      This is already present in 'remove_one()' but is missing here.
      Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      45e7e4e6
    • W
      net/ethernet/qlogic/qed: force the string buffer NULL-terminated · d1ba0b81
      Wang Xiayang 提交于
      [ Upstream commit 3690c8c9a8edff0db077a38783112d8fe12a7dd2 ]
      
      strncpy() does not ensure NULL-termination when the input string
      size equals to the destination buffer size 30.
      The output string is passed to qed_int_deassertion_aeu_bit()
      which calls DP_INFO() and relies NULL-termination.
      
      Use strlcpy instead. The other conditional branch above strncpy()
      needs no fix as snprintf() ensures NULL-termination.
      
      This issue is identified by a Coccinelle script.
      Signed-off-by: NWang Xiayang <xywang.sjtu@sjtu.edu.cn>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d1ba0b81
    • W
      can: peak_usb: force the string buffer NULL-terminated · 35d9e921
      Wang Xiayang 提交于
      [ Upstream commit e787f19373b8a5fa24087800ed78314fd17b984a ]
      
      strncpy() does not ensure NULL-termination when the input string size
      equals to the destination buffer size IFNAMSIZ. The output string is
      passed to dev_info() which relies on the NULL-termination.
      
      Use strlcpy() instead.
      
      This issue is identified by a Coccinelle script.
      Signed-off-by: NWang Xiayang <xywang.sjtu@sjtu.edu.cn>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      35d9e921
    • W
      can: sja1000: force the string buffer NULL-terminated · 895c8fcf
      Wang Xiayang 提交于
      [ Upstream commit cd28aa2e056cd1ea79fc5f24eed0ce868c6cab5c ]
      
      strncpy() does not ensure NULL-termination when the input string size
      equals to the destination buffer size IFNAMSIZ. The output string
      'name' is passed to dev_info which relies on NULL-termination.
      
      Use strlcpy() instead.
      
      This issue is identified by a Coccinelle script.
      Signed-off-by: NWang Xiayang <xywang.sjtu@sjtu.edu.cn>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      895c8fcf