Skip to content
  1. Dec 29, 2021
    • Andrea Righi's avatar
      Input: elantech - fix stack out of bound access in elantech_change_report_id() · 676c5724
      Andrea Righi authored
      [ Upstream commit 1d72d9f9 ]
      
      The array param[] in elantech_change_report_id() must be at least 3
      bytes, because elantech_read_reg_params() is calling ps2_command() with
      PSMOUSE_CMD_GETINFO, that is going to access 3 bytes from param[], but
      it's defined in the stack as an array of 2 bytes, therefore we have a
      potential stack out-of-bounds access here, also confirmed by KASAN:
      
      [    6.512374] BUG: KASAN: stack-out-of-bounds in __ps2_command+0x372/0x7e0
      [    6.512397] Read of size 1 at addr ffff8881024d77c2 by task kworker/2:1/118
      
      [    6.512416] CPU: 2 PID: 118 Comm: kworker/2:1 Not tainted 5.13.0-22-generic #22+arighi20211110
      [    6.512428] Hardware name: LENOVO 20T8000QGE/20T8000QGE, BIOS R1AET32W (1.08 ) 08/14/2020
      [    6.512436] Workqueue: events_long serio_handle_event
      [    6.512453] Call Trace:
      [    6.512462]  show_stack+0x52/0x58
      [    6.512474]  dump_stack+0xa1/0xd3
      [    6.512487]  print_address_description.constprop.0+0x1d/0x140
      [    6.512502]  ? __ps2_command+0x372/0x7e0
      [    6.512516]  __kasan_report.cold+0x7d/0x112
      [    6.512527]  ? _raw_write_lock_irq+0x20/0xd0
      [    6.512539]  ? __ps2_command+0x372/0x7e0
      [    6.512552]  kasan_report+0x3c/0x50
      [    6.512564]  __asan_load1+0x6a/0x70
      [    6.512575]  __ps2_command+0x372/0x7e0
      [    6.512589]  ? ps2_drain+0x240/0x240
      [    6.512601]  ? dev_printk_emit+0xa2/0xd3
      [    6.512612]  ? dev_vprintk_emit+0xc5/0xc5
      [    6.512621]  ? __kasan_check_write+0x14/0x20
      [    6.512634]  ? mutex_lock+0x8f/0xe0
      [    6.512643]  ? __mutex_lock_slowpath+0x20/0x20
      [    6.512655]  ps2_command+0x52/0x90
      [    6.512670]  elantech_ps2_command+0x4f/0xc0 [psmouse]
      [    6.512734]  elantech_change_report_id+0x1e6/0x256 [psmouse]
      [    6.512799]  ? elantech_report_trackpoint.constprop.0.cold+0xd/0xd [psmouse]
      [    6.512863]  ? ps2_command+0x7f/0x90
      [    6.512877]  elantech_query_info.cold+0x6bd/0x9ed [psmouse]
      [    6.512943]  ? elantech_setup_ps2+0x460/0x460 [psmouse]
      [    6.513005]  ? psmouse_reset+0x69/0xb0 [psmouse]
      [    6.513064]  ? psmouse_attr_set_helper+0x2a0/0x2a0 [psmouse]
      [    6.513122]  ? phys_pmd_init+0x30e/0x521
      [    6.513137]  elantech_init+0x8a/0x200 [psmouse]
      [    6.513200]  ? elantech_init_ps2+0xf0/0xf0 [psmouse]
      [    6.513249]  ? elantech_query_info+0x440/0x440 [psmouse]
      [    6.513296]  ? synaptics_send_cmd+0x60/0x60 [psmouse]
      [    6.513342]  ? elantech_query_info+0x440/0x440 [psmouse]
      [    6.513388]  ? psmouse_try_protocol+0x11e/0x170 [psmouse]
      [    6.513432]  psmouse_extensions+0x65d/0x6e0 [psmouse]
      [    6.513476]  ? psmouse_try_protocol+0x170/0x170 [psmouse]
      [    6.513519]  ? mutex_unlock+0x22/0x40
      [    6.513526]  ? ps2_command+0x7f/0x90
      [    6.513536]  ? psmouse_probe+0xa3/0xf0 [psmouse]
      [    6.513580]  psmouse_switch_protocol+0x27d/0x2e0 [psmouse]
      [    6.513624]  psmouse_connect+0x272/0x530 [psmouse]
      [    6.513669]  serio_driver_probe+0x55/0x70
      [    6.513679]  really_probe+0x190/0x720
      [    6.513689]  driver_probe_device+0x160/0x1f0
      [    6.513697]  device_driver_attach+0x119/0x130
      [    6.513705]  ? device_driver_attach+0x130/0x130
      [    6.513713]  __driver_attach+0xe7/0x1a0
      [    6.513720]  ? device_driver_attach+0x130/0x130
      [    6.513728]  bus_for_each_dev+0xfb/0x150
      [    6.513738]  ? subsys_dev_iter_exit+0x10/0x10
      [    6.513748]  ? _raw_write_unlock_bh+0x30/0x30
      [    6.513757]  driver_attach+0x2d/0x40
      [    6.513764]  serio_handle_event+0x199/0x3d0
      [    6.513775]  process_one_work+0x471/0x740
      [    6.513785]  worker_thread+0x2d2/0x790
      [    6.513794]  ? process_one_work+0x740/0x740
      [    6.513802]  kthread+0x1b4/0x1e0
      [    6.513809]  ? set_kthread_struct+0x80/0x80
      [    6.513816]  ret_from_fork+0x22/0x30
      
      [    6.513832] The buggy address belongs to the page:
      [    6.513838] page:00000000bc35e189 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1024d7
      [    6.513847] flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff)
      [    6.513860] raw: 0017ffffc0000000 dead000000000100 dead000000000122 0000000000000000
      [    6.513867] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
      [    6.513872] page dumped because: kasan: bad access detected
      
      [    6.513879] addr ffff8881024d77c2 is located in stack of task kworker/2:1/118 at offset 34 in frame:
      [    6.513887]  elantech_change_report_id+0x0/0x256 [psmouse]
      
      [    6.513941] this frame has 1 object:
      [    6.513947]  [32, 34) 'param'
      
      [    6.513956] Memory state around the buggy address:
      [    6.513962]  ffff8881024d7680: f2 f2 f2 f2 f2 00 00 f3 f3 00 00 00 00 00 00 00
      [    6.513969]  ffff8881024d7700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [    6.513976] >ffff8881024d7780: 00 00 00 00 f1 f1 f1 f1 02 f3 f3 f3 00 00 00 00
      [    6.513982]                                            ^
      [    6.513988]  ffff8881024d7800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [    6.513995]  ffff8881024d7880: 00 f1 f1 f1 f1 03 f2 03 f2 03 f3 f3 f3 00 00 00
      [    6.514000] ==================================================================
      
      Define param[] in elantech_change_report_id() as an array of 3 bytes to
      prevent the out-of-bounds access in the stack.
      
      Fixes: e4c90627
      
       ("Input: elantech - fix protocol errors for some trackpoints in SMBus mode")
      BugLink: https://bugs.launchpad.net/bugs/1945590
      Signed-off-by: default avatarAndrea Righi <andrea.righi@canonical.com>
      Reviewed-by: default avatarWolfram Sang <wsa@kernel.org>
      Link: https://lore.kernel.org/r/20211116095559.24395-1-andrea.righi@canonical.com
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      676c5724
    • 蒋家盛's avatar
      sfc: falcon: Check null pointer of rx_queue->page_ring · 2792fde8
      蒋家盛 authored
      [ Upstream commit 9b8bdd1e ]
      
      Because of the possible failure of the kcalloc, it should be better to
      set rx_queue->page_ptr_mask to 0 when it happens in order to maintain
      the consistency.
      
      Fixes: 5a6681e2
      
       ("sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Link: https://lore.kernel.org/r/20211220140344.978408-1-jiasheng@iscas.ac.cn
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2792fde8
    • 蒋家盛's avatar
      sfc: Check null pointer of rx_queue->page_ring · d70b4001
      蒋家盛 authored
      [ Upstream commit bdf1b5c3 ]
      
      Because of the possible failure of the kcalloc, it should be better to
      set rx_queue->page_ptr_mask to 0 when it happens in order to maintain
      the consistency.
      
      Fixes: 5a6681e2
      
       ("sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Link: https://lore.kernel.org/r/20211220135603.954944-1-jiasheng@iscas.ac.cn
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d70b4001
    • 蒋家盛's avatar
      net: ks8851: Check for error irq · 75c962f0
      蒋家盛 authored
      [ Upstream commit 99d7fbb5 ]
      
      Because platform_get_irq() could fail and return error irq.
      Therefore, it might be better to check it if order to avoid the use of
      error irq.
      
      Fixes: 797047f8
      
       ("net: ks8851: Implement Parallel bus operations")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      75c962f0
    • 蒋家盛's avatar
      drivers: net: smc911x: Check for error irq · 9db0f8d3
      蒋家盛 authored
      [ Upstream commit cb93b3e1 ]
      
      Because platform_get_irq() could fail and return error irq.
      Therefore, it might be better to check it if order to avoid the use of
      error irq.
      
      Fixes: ae150435
      
       ("smsc: Move the SMC (SMSC) drivers")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9db0f8d3
    • 蒋家盛's avatar
      fjes: Check for error irq · ca2a1505
      蒋家盛 authored
      [ Upstream commit db6d6afe ]
      
      I find that platform_get_irq() will not always succeed.
      It will return error irq in case of the failure.
      Therefore, it might be better to check it if order to avoid the use of
      error irq.
      
      Fixes: 658d439b
      
       ("fjes: Introduce FUJITSU Extended Socket Network Device driver")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ca2a1505
    • Fernando Fernandez Mancera's avatar
      bonding: fix ad_actor_system option setting to default · c6d27540
      Fernando Fernandez Mancera authored
      [ Upstream commit 1c15b05b ]
      
      When 802.3ad bond mode is configured the ad_actor_system option is set to
      "00:00:00:00:00:00". But when trying to set the all-zeroes MAC as actors'
      system address it was failing with EINVAL.
      
      An all-zeroes ethernet address is valid, only multicast addresses are not
      valid values.
      
      Fixes: 171a42c3
      
       ("bonding: add netlink support for sys prio, actor sys mac, and port key")
      Signed-off-by: default avatarFernando Fernandez Mancera <ffmancera@riseup.net>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Link: https://lore.kernel.org/r/20211221111345.2462-1-ffmancera@riseup.net
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c6d27540
    • Wu Bo's avatar
      ipmi: Fix UAF when uninstall ipmi_si and ipmi_msghandler module · 6809da51
      Wu Bo authored
      [ Upstream commit ffb76a86 ]
      
      Hi,
      
      When testing install and uninstall of ipmi_si.ko and ipmi_msghandler.ko,
      the system crashed.
      
      The log as follows:
      [  141.087026] BUG: unable to handle kernel paging request at ffffffffc09b3a5a
      [  141.087241] PGD 8fe4c0d067 P4D 8fe4c0d067 PUD 8fe4c0f067 PMD 103ad89067 PTE 0
      [  141.087464] Oops: 0010 [#1] SMP NOPTI
      [  141.087580] CPU: 67 PID: 668 Comm: kworker/67:1 Kdump: loaded Not tainted 4.18.0.x86_64 #47
      [  141.088009] Workqueue: events 0xffffffffc09b3a40
      [  141.088009] RIP: 0010:0xffffffffc09b3a5a
      [  141.088009] Code: Bad RIP value.
      [  141.088009] RSP: 0018:ffffb9094e2c3e88 EFLAGS: 00010246
      [  141.088009] RAX: 0000000000000000 RBX: ffff9abfdb1f04a0 RCX: 0000000000000000
      [  141.088009] RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000246
      [  141.088009] RBP: 0000000000000000 R08: ffff9abfffee3cb8 R09: 00000000000002e1
      [  141.088009] R10: ffffb9094cb73d90 R11: 00000000000f4240 R12: ffff9abfffee8700
      [  141.088009] R13: 0000000000000000 R14: ffff9abfdb1f04a0 R15: ffff9abfdb1f04a8
      [  141.088009] FS:  0000000000000000(0000) GS:ffff9abfffec0000(0000) knlGS:0000000000000000
      [  141.088009] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  141.088009] CR2: ffffffffc09b3a30 CR3: 0000008fe4c0a001 CR4: 00000000007606e0
      [  141.088009] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  141.088009] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  141.088009] PKRU: 55555554
      [  141.088009] Call Trace:
      [  141.088009]  ? process_one_work+0x195/0x390
      [  141.088009]  ? worker_thread+0x30/0x390
      [  141.088009]  ? process_one_work+0x390/0x390
      [  141.088009]  ? kthread+0x10d/0x130
      [  141.088009]  ? kthread_flush_work_fn+0x10/0x10
      [  141.088009]  ? ret_from_fork+0x35/0x40] BUG: unable to handle kernel paging request at ffffffffc0b28a5a
      [  200.223240] PGD 97fe00d067 P4D 97fe00d067 PUD 97fe00f067 PMD a580cbf067 PTE 0
      [  200.223464] Oops: 0010 [#1] SMP NOPTI
      [  200.223579] CPU: 63 PID: 664 Comm: kworker/63:1 Kdump: loaded Not tainted 4.18.0.x86_64 #46
      [  200.224008] Workqueue: events 0xffffffffc0b28a40
      [  200.224008] RIP: 0010:0xffffffffc0b28a5a
      [  200.224008] Code: Bad RIP value.
      [  200.224008] RSP: 0018:ffffbf3c8e2a3e88 EFLAGS: 00010246
      [  200.224008] RAX: 0000000000000000 RBX: ffffa0799ad6bca0 RCX: 0000000000000000
      [  200.224008] RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000246
      [  200.224008] RBP: 0000000000000000 R08: ffff9fe43fde3cb8 R09: 00000000000000d5
      [  200.224008] R10: ffffbf3c8cb53d90 R11: 00000000000f4240 R12: ffff9fe43fde8700
      [  200.224008] R13: 0000000000000000 R14: ffffa0799ad6bca0 R15: ffffa0799ad6bca8
      [  200.224008] FS:  0000000000000000(0000) GS:ffff9fe43fdc0000(0000) knlGS:0000000000000000
      [  200.224008] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  200.224008] CR2: ffffffffc0b28a30 CR3: 00000097fe00a002 CR4: 00000000007606e0
      [  200.224008] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  200.224008] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  200.224008] PKRU: 55555554
      [  200.224008] Call Trace:
      [  200.224008]  ? process_one_work+0x195/0x390
      [  200.224008]  ? worker_thread+0x30/0x390
      [  200.224008]  ? process_one_work+0x390/0x390
      [  200.224008]  ? kthread+0x10d/0x130
      [  200.224008]  ? kthread_flush_work_fn+0x10/0x10
      [  200.224008]  ? ret_from_fork+0x35/0x40
      [  200.224008] kernel fault(0x1) notification starting on CPU 63
      [  200.224008] kernel fault(0x1) notification finished on CPU 63
      [  200.224008] CR2: ffffffffc0b28a5a
      [  200.224008] ---[ end trace c82a412d93f57412 ]---
      
      The reason is as follows:
      T1: rmmod ipmi_si.
          ->ipmi_unregister_smi()
              -> ipmi_bmc_unregister()
                  -> __ipmi_bmc_unregister()
                      -> kref_put(&bmc->usecount, cleanup_bmc_device);
                          -> schedule_work(&bmc->remove_work);
      
      T2: rmmod ipmi_msghandler.
          ipmi_msghander module uninstalled, and the module space
          will be freed.
      
      T3: bmc->remove_work doing cleanup the bmc resource.
          -> cleanup_bmc_work()
              -> platform_device_unregister(&bmc->pdev);
                  -> platform_device_del(pdev);
                      -> device_del(&pdev->dev);
                          -> kobject_uevent(&dev->kobj, KOBJ_REMOVE);
                              -> kobject_uevent_env()
                                  -> dev_uevent()
                                      -> if (dev->type && dev->type->name)
      
         'dev->type'(bmc_device_type) pointer space has freed when uninstall
          ipmi_msghander module, 'dev->type->name' cause the system crash.
      
      drivers/char/ipmi/ipmi_msghandler.c:
      2820 static const struct device_type bmc_device_type = {
      2821         .groups         = bmc_dev_attr_groups,
      2822 };
      
      Steps to reproduce:
      Add a time delay in cleanup_bmc_work() function,
      and uninstall ipmi_si and ipmi_msghandler module.
      
      2910 static void cleanup_bmc_work(struct work_struct *work)
      2911 {
      2912         struct bmc_device *bmc = container_of(work, struct bmc_device,
      2913                                               remove_work);
      2914         int id = bmc->pdev.id; /* Unregister overwrites id */
      2915
      2916         msleep(3000);   <---
      2917         platform_device_unregister(&bmc->pdev);
      2918         ida_simple_remove(&ipmi_bmc_ida, id);
      2919 }
      
      Use 'remove_work_wq' instead of 'system_wq' to solve this issues.
      
      Fixes: b2cfd8ab
      
       ("ipmi: Rework device id and guid handling to catch changing BMCs")
      Signed-off-by: default avatarWu Bo <wubo40@huawei.com>
      Message-Id: <1640070034-56671-1-git-send-email-wubo40@huawei.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6809da51
    • Heiner Kallweit's avatar
      igb: fix deadlock caused by taking RTNL in RPM resume path · 61e6b82e
      Heiner Kallweit authored
      [ Upstream commit ac8c58f5 ]
      
      Recent net core changes caused an issue with few Intel drivers
      (reportedly igb), where taking RTNL in RPM resume path results in a
      deadlock. See [0] for a bug report. I don't think the core changes
      are wrong, but taking RTNL in RPM resume path isn't needed.
      The Intel drivers are the only ones doing this. See [1] for a
      discussion on the issue. Following patch changes the RPM resume path
      to not take RTNL.
      
      [0] https://bugzilla.kernel.org/show_bug.cgi?id=215129
      [1] https://lore.kernel.org/netdev/20211125074949.5f897431@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/t/
      
      Fixes: bd869245 ("net: core: try to runtime-resume detached device in __dev_open")
      Fixes: f32a2137
      
       ("ethtool: runtime-resume netdev parent before ethtool ioctl ops")
      Tested-by: default avatarMartin Stolpe <martin.stolpe@gmail.com>
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20211220201844.2714498-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      61e6b82e
    • Willem de Bruijn's avatar
      net: skip virtio_net_hdr_set_proto if protocol already set · e00eace2
      Willem de Bruijn authored
      [ Upstream commit 1ed1d592 ]
      
      virtio_net_hdr_set_proto infers skb->protocol from the virtio_net_hdr
      gso_type, to avoid packets getting dropped for lack of a proto type.
      
      Its protocol choice is a guess, especially in the case of UFO, where
      the single VIRTIO_NET_HDR_GSO_UDP label covers both UFOv4 and UFOv6.
      
      Skip this best effort if the field is already initialized. Whether
      explicitly from userspace, or implicitly based on an earlier call to
      dev_parse_header_protocol (which is more robust, but was introduced
      after this patch).
      
      Fixes: 9d2f67e4
      
       ("net/packet: fix packet drop as of virtio gso")
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://lore.kernel.org/r/20211220145027.2784293-1-willemdebruijn.kernel@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e00eace2
    • Willem de Bruijn's avatar
      net: accept UFOv6 packages in virtio_net_hdr_to_skb · ed05e4dc
      Willem de Bruijn authored
      [ Upstream commit 7e5cced9 ]
      
      Skb with skb->protocol 0 at the time of virtio_net_hdr_to_skb may have
      a protocol inferred from virtio_net_hdr with virtio_net_hdr_set_proto.
      
      Unlike TCP, UDP does not have separate types for IPv4 and IPv6. Type
      VIRTIO_NET_HDR_GSO_UDP is guessed to be IPv4/UDP. As of the below
      commit, UFOv6 packets are dropped due to not matching the protocol as
      obtained from dev_parse_header_protocol.
      
      Invert the test to take that L2 protocol field as starting point and
      pass both UFOv4 and UFOv6 for VIRTIO_NET_HDR_GSO_UDP.
      
      Fixes: 924a9bc3
      
       ("net: check if protocol extracted by virtio_net_hdr_set_proto is correct")
      Link: https://lore.kernel.org/netdev/CABcq3pG9GRCYqFDBAJ48H1vpnnX=41u+MhQnayF1ztLH4WX0Fw@mail.gmail.com/
      Reported-by: default avatarAndrew Melnichenko <andrew@daynix.com>
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://lore.kernel.org/r/20211220144901.2784030-1-willemdebruijn.kernel@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ed05e4dc
    • 蒋家盛's avatar
      qlcnic: potential dereference null pointer of rx_queue->page_ring · 56b0bbba
      蒋家盛 authored
      [ Upstream commit 60ec7fcf ]
      
      The return value of kcalloc() needs to be checked.
      To avoid dereference of null pointer in case of the failure of alloc.
      Therefore, it might be better to change the return type of
      qlcnic_sriov_alloc_vlans() and return -ENOMEM when alloc fails and
      return 0 the others.
      Also, qlcnic_sriov_set_guest_vlan_mode() and __qlcnic_pci_sriov_enable()
      should deal with the return value of qlcnic_sriov_alloc_vlans().
      
      Fixes: 154d0c81
      
       ("qlcnic: VLAN enhancement for 84XX adapters")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      56b0bbba
    • Yevhen Orlov's avatar
      net: marvell: prestera: fix incorrect return of port_find · 78e49d77
      Yevhen Orlov authored
      [ Upstream commit 8b681bd7 ]
      
      In case, when some ports is in list and we don't find requested - we
      return last iterator state and not return NULL as expected.
      
      Fixes: 501ef306
      
       ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
      Signed-off-by: default avatarYevhen Orlov <yevhen.orlov@plvision.eu>
      Link: https://lore.kernel.org/r/20211216170736.8851-1-yevhen.orlov@plvision.eu
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      78e49d77
    • Martin Haaß's avatar
      ARM: dts: imx6qdl-wandboard: Fix Ethernet support · 861b4413
      Martin Haaß authored
      [ Upstream commit 39e66068 ]
      
      Currently, the imx6q-wandboard Ethernet does not transmit any
      data.
      
      This issue has been exposed by commit f5d9aa79 ("ARM: imx6q:
      remove clk-out fixup for the Atheros AR8031 and AR8035 PHYs").
      
      Fix it by describing the qca,clk-out-frequency property as suggested
      by the commit above.
      
      Fixes: 77591e42
      
       ("ARM: dts: imx6qdl-wandboard: add ethernet PHY description")
      Signed-off-by: default avatarMartin Haaß <vvvrrooomm@gmail.com>
      Tested-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      861b4413
    • Ignacy Gawędzki's avatar
      netfilter: fix regression in looped (broad|multi)cast's MAC handling · d79f5e0d
      Ignacy Gawędzki authored
      [ Upstream commit ebb966d3 ]
      
      In commit 5648b5e1 ("netfilter: nfnetlink_queue: fix OOB when mac
      header was cleared"), the test for non-empty MAC header introduced in
      commit 2c38de4c ("netfilter: fix looped (broad|multi)cast's MAC
      handling") has been replaced with a test for a set MAC header.
      
      This breaks the case when the MAC header has been reset (using
      skb_reset_mac_header), as is the case with looped-back multicast
      packets.  As a result, the packets ending up in NFQUEUE get a bogus
      hwaddr interpreted from the first bytes of the IP header.
      
      This patch adds a test for a non-empty MAC header in addition to the
      test for a set MAC header.  The same two tests are also implemented in
      nfnetlink_log.c, where the initial code of commit 2c38de4c
      ("netfilter: fix looped (broad|multi)cast's MAC handling") has not been
      touched, but where supposedly the same situation may happen.
      
      Fixes: 5648b5e1
      
       ("netfilter: nfnetlink_queue: fix OOB when mac header was cleared")
      Signed-off-by: default avatarIgnacy Gawędzki <ignacy.gawedzki@green-communications.fr>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d79f5e0d
    • Jiacheng Shi's avatar
      RDMA/hns: Replace kfree() with kvfree() · 579cefef
      Jiacheng Shi authored
      [ Upstream commit 12d3bbdd ]
      
      Variables allocated by kvmalloc_array() should not be freed by kfree.
      Because they may be allocated by vmalloc.  So we replace kfree() with
      kvfree() here.
      
      Fixes: 6fd610c5
      
       ("RDMA/hns: Support 0 hop addressing for SRQ buffer")
      Link: https://lore.kernel.org/r/20211210094234.5829-1-billsjc@sjtu.edu.cn
      Signed-off-by: default avatarJiacheng Shi <billsjc@sjtu.edu.cn>
      Acked-by: default avatarWenpeng Liang <liangwenpeng@huawei.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      579cefef
    • José Expósito's avatar
      IB/qib: Fix memory leak in qib_user_sdma_queue_pkts() · 7cf6466e
      José Expósito authored
      [ Upstream commit bee90911 ]
      
      The wrong goto label was used for the error case and missed cleanup of the
      pkt allocation.
      
      Fixes: d39bf40e
      
       ("IB/qib: Protect from buffer overflow in struct qib_user_sdma_pkt fields")
      Link: https://lore.kernel.org/r/20211208175238.29983-1-jose.exposito89@gmail.com
      Addresses-Coverity-ID: 1493352 ("Resource leak")
      Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
      Acked-by: default avatarMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7cf6466e
    • Martin Blumenstingl's avatar
      ASoC: meson: aiu: fifo: Add missing dma_coerce_mask_and_coherent() · cd9c9068
      Martin Blumenstingl authored
      [ Upstream commit 1bcd3266 ]
      
      The FIFO registers which take an DMA-able address are only 32-bit wide
      on AIU. Add dma_coerce_mask_and_coherent() to make the DMA core aware of
      this limitation.
      
      Fixes: 6ae9ca9c
      
       ("ASoC: meson: aiu: add i2s and spdif support")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Link: https://lore.kernel.org/r/20211206210804.2512999-2-martin.blumenstingl@googlemail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cd9c9068
    • Dongliang Mu's avatar
      spi: change clk_disable_unprepare to clk_unprepare · 580ecf86
      Dongliang Mu authored
      [ Upstream commit db6689b6 ]
      
      The corresponding API for clk_prepare is clk_unprepare, other than
      clk_disable_unprepare.
      
      Fix this by changing clk_disable_unprepare to clk_unprepare.
      
      Fixes: 5762ab71
      
       ("spi: Add support for Armada 3700 SPI Controller")
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Link: https://lore.kernel.org/r/20211206101931.2816597-1-mudongliangabcd@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      580ecf86
    • Robert Marko's avatar
      arm64: dts: allwinner: orangepi-zero-plus: fix PHY mode · 93a957bb
      Robert Marko authored
      [ Upstream commit 08d2061f ]
      
      Orange Pi Zero Plus uses a Realtek RTL8211E RGMII Gigabit PHY, but its
      currently set to plain RGMII mode meaning that it doesn't introduce
      delays.
      
      With this setup, TX packets are completely lost and changing the mode to
      RGMII-ID so the PHY will add delays internally fixes the issue.
      
      Fixes: a7affb13
      
       ("arm64: allwinner: H5: Add Xunlong Orange Pi Zero Plus")
      Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
      Tested-by: default avatarRon Goossens <rgoossens@gmail.com>
      Tested-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarRobert Marko <robert.marko@sartura.hr>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20211117140222.43692-1-robert.marko@sartura.hr
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      93a957bb
    • 蒋家盛's avatar
      HID: potential dereference of null pointer · ef2dce43
      蒋家盛 authored
      commit 13251ce1 upstream.
      
      The return value of devm_kzalloc() needs to be checked.
      To avoid hdev->dev->driver_data to be null in case of the failure of
      alloc.
      
      Fixes: 14c9c014
      
       ("HID: add vivaldi HID driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Link: https://lore.kernel.org/r/20211215083605.117638-1-jiasheng@iscas.ac.cn
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef2dce43
    • Benjamin Tissoires's avatar
      HID: holtek: fix mouse probing · 3110bc58
      Benjamin Tissoires authored
      commit 93a2207c upstream.
      
      An overlook from the previous commit: we don't even parse or start the
      device, meaning that the device is not presented to user space.
      
      Fixes: 93020953
      
       ("HID: check for valid USB device for many HID drivers")
      Cc: stable@vger.kernel.org
      Link: https://bugs.archlinux.org/task/73048
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=215341
      Link: https://lore.kernel.org/r/e4efbf13-bd8d-0370-629b-6c80c0044b15@leemhuis.info/
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3110bc58
    • Zhang Yi's avatar
      ext4: check for inconsistent extents between index and leaf block · 0875873b
      Zhang Yi authored
      commit 9c6e0719
      
       upstream.
      
      Now that we can check out overlapping extents in leaf block and
      out-of-order index extents in index block. But the .ee_block in the
      first extent of one leaf block should equal to the .ei_block in it's
      parent index extent entry. This patch add a check to verify such
      inconsistent between the index and leaf block.
      
      Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
      Link: https://lore.kernel.org/r/20210908120850.4012324-3-yi.zhang@huawei.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0875873b
    • Zhang Yi's avatar
      ext4: check for out-of-order index extents in ext4_valid_extent_entries() · 76366c02
      Zhang Yi authored
      commit 8dd27fec upstream.
      
      After commit 5946d089
      
       ("ext4: check for overlapping extents in
      ext4_valid_extent_entries()"), we can check out the overlapping extent
      entry in leaf extent blocks. But the out-of-order extent entry in index
      extent blocks could also trigger bad things if the filesystem is
      inconsistent. So this patch add a check to figure out the out-of-order
      index extents and return error.
      
      Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
      Reviewed-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Link: https://lore.kernel.org/r/20210908120850.4012324-2-yi.zhang@huawei.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76366c02
    • Zhang Yi's avatar
      ext4: prevent partial update of the extent blocks · 1d4b1c4e
      Zhang Yi authored
      commit 0f2f87d5
      
       upstream.
      
      In the most error path of current extents updating operations are not
      roll back partial updates properly when some bad things happens(.e.g in
      ext4_ext_insert_extent()). So we may get an inconsistent extents tree
      if journal has been aborted due to IO error, which may probability lead
      to BUGON later when we accessing these extent entries in errors=continue
      mode. This patch drop extent buffer's verify flag before updatng the
      contents in ext4_ext_get_access(), and reset it after updating in
      __ext4_ext_dirty(). After this patch we could force to check the extent
      buffer if extents tree updating was break off, make sure the extents are
      consistent.
      
      Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
      Reviewed-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Link: https://lore.kernel.org/r/20210908120850.4012324-4-yi.zhang@huawei.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d4b1c4e
    • Greg Jesionowski's avatar
      net: usb: lan78xx: add Allied Telesis AT29M2-AF · f69a47fc
      Greg Jesionowski authored
      commit ef8a0f6e
      
       upstream.
      
      This adds the vendor and product IDs for the AT29M2-AF which is a
      lan7801-based device.
      
      Signed-off-by: default avatarGreg Jesionowski <jesionowskigreg@gmail.com>
      Link: https://lore.kernel.org/r/20211214221027.305784-1-jesionowskigreg@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f69a47fc
    • Nick Desaulniers's avatar
      arm64: vdso32: require CROSS_COMPILE_COMPAT for gcc+bfd · 8c0059a2
      Nick Desaulniers authored
      commit 3e6f8d1f upstream.
      
      Similar to
      commit 231ad7f4 ("Makefile: infer --target from ARCH for CC=clang")
      There really is no point in setting --target based on
      $CROSS_COMPILE_COMPAT for clang when the integrated assembler is being
      used, since
      commit ef943405
      
       ("arm64: vdso32: drop -no-integrated-as flag").
      
      Allows COMPAT_VDSO to be selected without setting $CROSS_COMPILE_COMPAT
      when using clang and lld together.
      
      Before:
      $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 defconfig
      $ grep CONFIG_COMPAT_VDSO .config
      CONFIG_COMPAT_VDSO=y
      $ ARCH=arm64 make -j72 LLVM=1 defconfig
      $ grep CONFIG_COMPAT_VDSO .config
      $
      
      After:
      $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 defconfig
      $ grep CONFIG_COMPAT_VDSO .config
      CONFIG_COMPAT_VDSO=y
      $ ARCH=arm64 make -j72 LLVM=1 defconfig
      $ grep CONFIG_COMPAT_VDSO .config
      CONFIG_COMPAT_VDSO=y
      
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Suggested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Link: https://lore.kernel.org/r/20211019223646.1146945-5-ndesaulniers@google.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c0059a2
    • Nick Desaulniers's avatar
      arm64: vdso32: drop -no-integrated-as flag · b16b124a
      Nick Desaulniers authored
      commit ef943405
      
       upstream.
      
      Clang can assemble these files just fine; this is a relic from the top
      level Makefile conditionally adding this. We no longer need --prefix,
      --gcc-toolchain, or -Qunused-arguments flags either with this change, so
      remove those too.
      
      To test building:
      $ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
        CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make LLVM=1 LLVM_IAS=1 \
        defconfig arch/arm64/kernel/vdso32/
      
      Suggested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Tested-by: default avatarStephen Boyd <swboyd@chromium.org>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Link: https://lore.kernel.org/r/20210420174427.230228-1-ndesaulniers@google.com
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b16b124a
  2. Dec 22, 2021
    • Greg Kroah-Hartman's avatar
      Linux 5.10.88 · 856f88f2
      Greg Kroah-Hartman authored
      
      
      Link: https://lore.kernel.org/r/20211220143029.352940568@linuxfoundation.org
      Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Tested-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: default avatarSalvatore Bonaccorso <carnil@debian.org>
      Tested-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Tested-by: default avatarHulk Robot <hulkrobot@huawei.com>
      Tested-by: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      856f88f2
    • Juergen Gross's avatar
      xen/netback: don't queue unlimited number of packages · 88f20ccc
      Juergen Gross authored
      commit be81992f upstream.
      
      In case a guest isn't consuming incoming network traffic as fast as it
      is coming in, xen-netback is buffering network packages in unlimited
      numbers today. This can result in host OOM situations.
      
      Commit f48da8b1 ("xen-netback: fix unlimited guest Rx internal
      queue and carrier flapping") meant to introduce a mechanism to limit
      the amount of buffered data by stopping the Tx queue when reaching the
      data limit, but this doesn't work for cases like UDP.
      
      When hitting the limit don't queue further SKBs, but drop them instead.
      In order to be able to tell Rx packages have been dropped increment the
      rx_dropped statistics counter in this case.
      
      It should be noted that the old solution to continue queueing SKBs had
      the additional problem of an overflow of the 32-bit rx_queue_len value
      would result in intermittent Tx queue enabling.
      
      This is part of XSA-392
      
      Fixes: f48da8b1
      
       ("xen-netback: fix unlimited guest Rx internal queue and carrier flapping")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88f20ccc
    • Juergen Gross's avatar
      xen/netback: fix rx queue stall detection · 525875c4
      Juergen Gross authored
      commit 6032046e upstream.
      
      Commit 1d5d4852 ("xen-netback: require fewer guest Rx slots when
      not using GSO") introduced a security problem in netback, as an
      interface would only be regarded to be stalled if no slot is available
      in the rx queue ring page. In case the SKB at the head of the queued
      requests will need more than one rx slot and only one slot is free the
      stall detection logic will never trigger, as the test for that is only
      looking for at least one slot to be free.
      
      Fix that by testing for the needed number of slots instead of only one
      slot being available.
      
      In order to not have to take the rx queue lock that often, store the
      number of needed slots in the queue data. As all SKB dequeue operations
      happen in the rx queue kernel thread this is safe, as long as the
      number of needed slots is accessed via READ/WRITE_ONCE() only and
      updates are always done with the rx queue lock held.
      
      Add a small helper for obtaining the number of free slots.
      
      This is part of XSA-392
      
      Fixes: 1d5d4852
      
       ("xen-netback: require fewer guest Rx slots when not using GSO")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      525875c4
    • Juergen Gross's avatar
      xen/console: harden hvc_xen against event channel storms · 8fa3a370
      Juergen Gross authored
      commit fe415186
      
       upstream.
      
      The Xen console driver is still vulnerable for an attack via excessive
      number of events sent by the backend. Fix that by using a lateeoi event
      channel.
      
      For the normal domU initial console this requires the introduction of
      bind_evtchn_to_irq_lateeoi() as there is no xenbus device available
      at the time the event channel is bound to the irq.
      
      As the decision whether an interrupt was spurious or not requires to
      test for bytes having been read from the backend, move sending the
      event into the if statement, as sending an event without having found
      any bytes to be read is making no sense at all.
      
      This is part of XSA-391
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8fa3a370
    • Juergen Gross's avatar
      xen/netfront: harden netfront against event channel storms · d31b3379
      Juergen Gross authored
      commit b27d4795
      
       upstream.
      
      The Xen netfront driver is still vulnerable for an attack via excessive
      number of events sent by the backend. Fix that by using lateeoi event
      channels.
      
      For being able to detect the case of no rx responses being added while
      the carrier is down a new lock is needed in order to update and test
      rsp_cons and the number of seen unconsumed responses atomically.
      
      This is part of XSA-391
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d31b3379
    • Juergen Gross's avatar
      xen/blkfront: harden blkfront against event channel storms · 8ac3b6ee
      Juergen Gross authored
      commit 0fd08a34
      
       upstream.
      
      The Xen blkfront driver is still vulnerable for an attack via excessive
      number of events sent by the backend. Fix that by using lateeoi event
      channels.
      
      This is part of XSA-391
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ac3b6ee
    • Magnus Karlsson's avatar
      Revert "xsk: Do not sleep in poll() when need_wakeup set" · 76ec7fe2
      Magnus Karlsson authored
      commit 0706a78f upstream.
      
      This reverts commit bd0687c1.
      
      This patch causes a Tx only workload to go to sleep even when it does
      not have to, leading to misserable performance in skb mode. It fixed
      one rare problem but created a much worse one, so this need to be
      reverted while I try to craft a proper solution to the original
      problem.
      
      Fixes: bd0687c1
      
       ("xsk: Do not sleep in poll() when need_wakeup set")
      Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20211217145646.26449-1-magnus.karlsson@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76ec7fe2
    • Tony Lindgren's avatar
      bus: ti-sysc: Fix variable set but not used warning for reinit_modules · e24fc898
      Tony Lindgren authored
      commit 1b1da99b upstream.
      
      Fix drivers/bus/ti-sysc.c:2494:13: error: variable 'error' set but not
      used introduced by commit 9d881361
      
       ("bus: ti-sysc: Add quirk handling
      for reinit on context lost").
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e24fc898
    • Paul E. McKenney's avatar
      rcu: Mark accesses to rcu_state.n_force_qs · 70692b06
      Paul E. McKenney authored
      commit 2431774f
      
       upstream.
      
      This commit marks accesses to the rcu_state.n_force_qs.  These data
      races are hard to make happen, but syzkaller was equal to the task.
      
      Reported-by: default avatar <syzbot+e08a83a1940ec3846cd5@syzkaller.appspotmail.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70692b06
    • George Kennedy's avatar
      scsi: scsi_debug: Sanity check block descriptor length in resp_mode_select() · a9078e79
      George Kennedy authored
      commit e0a2c28d
      
       upstream.
      
      In resp_mode_select() sanity check the block descriptor len to avoid UAF.
      
      BUG: KASAN: use-after-free in resp_mode_select+0xa4c/0xb40 drivers/scsi/scsi_debug.c:2509
      Read of size 1 at addr ffff888026670f50 by task scsicmd/15032
      
      CPU: 1 PID: 15032 Comm: scsicmd Not tainted 5.15.0-01d0625 #15
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      Call Trace:
       <TASK>
       dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:107
       print_address_description.constprop.9+0x28/0x160 mm/kasan/report.c:257
       kasan_report.cold.14+0x7d/0x117 mm/kasan/report.c:443
       __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
       resp_mode_select+0xa4c/0xb40 drivers/scsi/scsi_debug.c:2509
       schedule_resp+0x4af/0x1a10 drivers/scsi/scsi_debug.c:5483
       scsi_debug_queuecommand+0x8c9/0x1e70 drivers/scsi/scsi_debug.c:7537
       scsi_queue_rq+0x16b4/0x2d10 drivers/scsi/scsi_lib.c:1521
       blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1640
       __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325
       blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358
       __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1762
       __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1839
       blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891
       blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474
       blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:63
       sg_common_write.isra.18+0xeb3/0x2000 drivers/scsi/sg.c:837
       sg_new_write.isra.19+0x570/0x8c0 drivers/scsi/sg.c:775
       sg_ioctl_common+0x14d6/0x2710 drivers/scsi/sg.c:941
       sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1166
       __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:52
       do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:50
       entry_SYSCALL_64_after_hwframe+0x44/0xae arch/x86/entry/entry_64.S:113
      
      Link: https://lore.kernel.org/r/1637262208-28850-1-git-send-email-george.kennedy@oracle.com
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a9078e79
    • George Kennedy's avatar
      scsi: scsi_debug: Fix type in min_t to avoid stack OOB · bdb854f1
      George Kennedy authored
      commit 36e07d7e
      
       upstream.
      
      Change min_t() to use type "u32" instead of type "int" to avoid stack out
      of bounds. With min_t() type "int" the values get sign extended and the
      larger value gets used causing stack out of bounds.
      
      BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:191 [inline]
      BUG: KASAN: stack-out-of-bounds in sg_copy_buffer+0x1de/0x240 lib/scatterlist.c:976
      Read of size 127 at addr ffff888072607128 by task syz-executor.7/18707
      
      CPU: 1 PID: 18707 Comm: syz-executor.7 Not tainted 5.15.0-syzk #1
      Hardware name: Red Hat KVM, BIOS 1.13.0-2
      Call Trace:
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:106
       print_address_description.constprop.9+0x28/0x160 mm/kasan/report.c:256
       __kasan_report mm/kasan/report.c:442 [inline]
       kasan_report.cold.14+0x7d/0x117 mm/kasan/report.c:459
       check_region_inline mm/kasan/generic.c:183 [inline]
       kasan_check_range+0x1a3/0x210 mm/kasan/generic.c:189
       memcpy+0x23/0x60 mm/kasan/shadow.c:65
       memcpy include/linux/fortify-string.h:191 [inline]
       sg_copy_buffer+0x1de/0x240 lib/scatterlist.c:976
       sg_copy_from_buffer+0x33/0x40 lib/scatterlist.c:1000
       fill_from_dev_buffer.part.34+0x82/0x130 drivers/scsi/scsi_debug.c:1162
       fill_from_dev_buffer drivers/scsi/scsi_debug.c:1888 [inline]
       resp_readcap16+0x365/0x3b0 drivers/scsi/scsi_debug.c:1887
       schedule_resp+0x4d8/0x1a70 drivers/scsi/scsi_debug.c:5478
       scsi_debug_queuecommand+0x8c9/0x1ec0 drivers/scsi/scsi_debug.c:7533
       scsi_dispatch_cmd drivers/scsi/scsi_lib.c:1520 [inline]
       scsi_queue_rq+0x16b0/0x2d40 drivers/scsi/scsi_lib.c:1699
       blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1639
       __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325
       blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358
       __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1761
       __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1838
       blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891
       blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474
       blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:62
       sg_common_write.isra.18+0xeb3/0x2000 drivers/scsi/sg.c:836
       sg_new_write.isra.19+0x570/0x8c0 drivers/scsi/sg.c:774
       sg_ioctl_common+0x14d6/0x2710 drivers/scsi/sg.c:939
       sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1165
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:874 [inline]
       __se_sys_ioctl fs/ioctl.c:860 [inline]
       __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:860
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Link: https://lore.kernel.org/r/1636484247-21254-1-git-send-email-george.kennedy@oracle.com
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bdb854f1
    • George Kennedy's avatar
      scsi: scsi_debug: Don't call kcalloc() if size arg is zero · aa1f9127
      George Kennedy authored
      commit 3344b58b
      
       upstream.
      
      If the size arg to kcalloc() is zero, it returns ZERO_SIZE_PTR.  Because of
      that, for a following NULL pointer check to work on the returned pointer,
      kcalloc() must not be called with the size arg equal to zero. Return early
      without error before the kcalloc() call if size arg is zero.
      
      BUG: KASAN: null-ptr-deref in memcpy include/linux/fortify-string.h:191 [inline]
      BUG: KASAN: null-ptr-deref in sg_copy_buffer+0x138/0x240 lib/scatterlist.c:974
      Write of size 4 at addr 0000000000000010 by task syz-executor.1/22789
      
      CPU: 1 PID: 22789 Comm: syz-executor.1 Not tainted 5.15.0-syzk #1
      Hardware name: Red Hat KVM, BIOS 1.13.0-2
      Call Trace:
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:106
       __kasan_report mm/kasan/report.c:446 [inline]
       kasan_report.cold.14+0x112/0x117 mm/kasan/report.c:459
       check_region_inline mm/kasan/generic.c:183 [inline]
       kasan_check_range+0x1a3/0x210 mm/kasan/generic.c:189
       memcpy+0x3b/0x60 mm/kasan/shadow.c:66
       memcpy include/linux/fortify-string.h:191 [inline]
       sg_copy_buffer+0x138/0x240 lib/scatterlist.c:974
       do_dout_fetch drivers/scsi/scsi_debug.c:2954 [inline]
       do_dout_fetch drivers/scsi/scsi_debug.c:2946 [inline]
       resp_verify+0x49e/0x930 drivers/scsi/scsi_debug.c:4276
       schedule_resp+0x4d8/0x1a70 drivers/scsi/scsi_debug.c:5478
       scsi_debug_queuecommand+0x8c9/0x1ec0 drivers/scsi/scsi_debug.c:7533
       scsi_dispatch_cmd drivers/scsi/scsi_lib.c:1520 [inline]
       scsi_queue_rq+0x16b0/0x2d40 drivers/scsi/scsi_lib.c:1699
       blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1639
       __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325
       blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358
       __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1761
       __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1838
       blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891
       blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474
       blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:62
       blk_execute_rq+0xdb/0x360 block/blk-exec.c:102
       sg_scsi_ioctl drivers/scsi/scsi_ioctl.c:621 [inline]
       scsi_ioctl+0x8bb/0x15c0 drivers/scsi/scsi_ioctl.c:930
       sg_ioctl_common+0x172d/0x2710 drivers/scsi/sg.c:1112
       sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1165
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:874 [inline]
       __se_sys_ioctl fs/ioctl.c:860 [inline]
       __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:860
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Link: https://lore.kernel.org/r/1636056397-13151-1-git-send-email-george.kennedy@oracle.com
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa1f9127