Skip to content
Snippets Groups Projects
  1. May 25, 2022
    • linyujun's avatar
      ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame() · 22948c98
      linyujun authored
      
      [ Upstream commit 9be4c88b ]
      
      The following KASAN warning is detected by QEMU.
      
      ==================================================================
      BUG: KASAN: stack-out-of-bounds in unwind_frame+0x508/0x870
      Read of size 4 at addr c36bba90 by task cat/163
      
      CPU: 1 PID: 163 Comm: cat Not tainted 5.10.0-rc1 #40
      Hardware name: ARM-Versatile Express
      [<c0113fac>] (unwind_backtrace) from [<c010e71c>] (show_stack+0x10/0x14)
      [<c010e71c>] (show_stack) from [<c0b805b4>] (dump_stack+0x98/0xb0)
      [<c0b805b4>] (dump_stack) from [<c0b7d658>] (print_address_description.constprop.0+0x58/0x4bc)
      [<c0b7d658>] (print_address_description.constprop.0) from [<c031435c>] (kasan_report+0x154/0x170)
      [<c031435c>] (kasan_report) from [<c0113c44>] (unwind_frame+0x508/0x870)
      [<c0113c44>] (unwind_frame) from [<c010e298>] (__save_stack_trace+0x110/0x134)
      [<c010e298>] (__save_stack_trace) from [<c01ce0d8>] (stack_trace_save+0x8c/0xb4)
      [<c01ce0d8>] (stack_trace_save) from [<c0313520>] (kasan_set_track+0x38/0x60)
      [<c0313520>] (kasan_set_track) from [<c0314cb8>] (kasan_set_free_info+0x20/0x2c)
      [<c0314cb8>] (kasan_set_free_info) from [<c0313474>] (__kasan_slab_free+0xec/0x120)
      [<c0313474>] (__kasan_slab_free) from [<c0311e20>] (kmem_cache_free+0x7c/0x334)
      [<c0311e20>] (kmem_cache_free) from [<c01c35dc>] (rcu_core+0x390/0xccc)
      [<c01c35dc>] (rcu_core) from [<c01013a8>] (__do_softirq+0x180/0x518)
      [<c01013a8>] (__do_softirq) from [<c0135214>] (irq_exit+0x9c/0xe0)
      [<c0135214>] (irq_exit) from [<c01a40e4>] (__handle_domain_irq+0xb0/0x110)
      [<c01a40e4>] (__handle_domain_irq) from [<c0691248>] (gic_handle_irq+0xa0/0xb8)
      [<c0691248>] (gic_handle_irq) from [<c0100b0c>] (__irq_svc+0x6c/0x94)
      Exception stack(0xc36bb928 to 0xc36bb970)
      b920:                   c36bb9c0 00000000 c0126919 c0101228 c36bb9c0 b76d7730
      b940: c36b8000 c36bb9a0 c3335b00 c01ce0d8 00000003 c36bba3c c36bb940 c36bb978
      b960: c010e298 c011373c 60000013 ffffffff
      [<c0100b0c>] (__irq_svc) from [<c011373c>] (unwind_frame+0x0/0x870)
      [<c011373c>] (unwind_frame) from [<00000000>] (0x0)
      
      The buggy address belongs to the page:
      page:(ptrval) refcount:0 mapcount:0 mapping:00000000 index:0x0 pfn:0x636bb
      flags: 0x0()
      raw: 00000000 00000000 ef867764 00000000 00000000 00000000 ffffffff 00000000
      page dumped because: kasan: bad access detected
      
      addr c36bba90 is located in stack of task cat/163 at offset 48 in frame:
       stack_trace_save+0x0/0xb4
      
      this frame has 1 object:
       [32, 48) 'trace'
      
      Memory state around the buggy address:
       c36bb980: f1 f1 f1 f1 00 04 f2 f2 00 00 f3 f3 00 00 00 00
       c36bba00: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
      >c36bba80: 00 00 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
                       ^
       c36bbb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
       c36bbb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ==================================================================
      
      There is a same issue on x86 and has been resolved by the commit f7d27c35
      ("x86/mm, kasan: Silence KASAN warnings in get_wchan()").
      The solution could be applied to arm architecture too.
      
      Signed-off-by: default avatarLin Yujun <linyujun809@huawei.com>
      Reported-by: default avatarHe Ying <heying24@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      22948c98
    • Jakob Koschel's avatar
      drbd: remove usage of list iterator variable after loop · 5d0e7ff8
      Jakob Koschel authored
      [ Upstream commit 901aeda6 ]
      
      In preparation to limit the scope of a list iterator to the list
      traversal loop, use a dedicated pointer to iterate through the list [1].
      
      Since that variable should not be used past the loop iteration, a
      separate variable is used to 'remember the current location within the
      loop'.
      
      To either continue iterating from that position or skip the iteration
      (if the previous iteration was complete) list_prepare_entry() is used.
      
      Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
      
       [1]
      Signed-off-by: default avatarJakob Koschel <jakobkoschel@gmail.com>
      Link: https://lore.kernel.org/r/20220331220349.885126-1-jakobkoschel@gmail.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5d0e7ff8
    • Xiaoke Wang's avatar
      MIPS: lantiq: check the return value of kzalloc() · 2c337e8b
      Xiaoke Wang authored
      
      [ Upstream commit 34123208 ]
      
      kzalloc() is a memory allocation function which can return NULL when
      some internal memory errors happen. So it is better to check the
      return value of it to prevent potential wrong memory access or
      memory leak.
      
      Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2c337e8b
    • Jeff LaBundy's avatar
      Input: add bounds checking to input_set_capability() · 3e6fa9e4
      Jeff LaBundy authored
      
      [ Upstream commit 409353cb ]
      
      Update input_set_capability() to prevent kernel panic in case the
      event code exceeds the bitmap for the given event type.
      
      Suggested-by: default avatarTomasz Moń <tomasz.mon@camlingroup.com>
      Signed-off-by: default avatarJeff LaBundy <jeff@labundy.com>
      Reviewed-by: default avatarTomasz Moń <tomasz.mon@camlingroup.com>
      Link: https://lore.kernel.org/r/20220320032537.545250-1-jeff@labundy.com
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3e6fa9e4
    • David Gow's avatar
      um: Cleanup syscall_handler_t definition/cast, fix warning · 43554c35
      David Gow authored
      
      [ Upstream commit f4f03f29 ]
      
      The syscall_handler_t type for x86_64 was defined as 'long (*)(void)',
      but always cast to 'long (*)(long, long, long, long, long, long)' before
      use. This now triggers a warning (see below).
      
      Define syscall_handler_t as the latter instead, and remove the cast.
      This simplifies the code, and fixes the warning.
      
      Warning:
      In file included from ../arch/um/include/asm/processor-generic.h:13
                       from ../arch/x86/um/asm/processor.h:41
                       from ../include/linux/rcupdate.h:30
                       from ../include/linux/rculist.h:11
                       from ../include/linux/pid.h:5
                       from ../include/linux/sched.h:14
                       from ../include/linux/ptrace.h:6
                       from ../arch/um/kernel/skas/syscall.c:7:
      ../arch/um/kernel/skas/syscall.c: In function ‘handle_syscall’:
      ../arch/x86/um/shared/sysdep/syscalls_64.h:18:11: warning: cast between incompatible function types from ‘long int (*)(void)’ to ‘long int (*)(long int,  long int,  long int,  long int,  long int,  long int)’ [
      -Wcast-function-type]
         18 |         (((long (*)(long, long, long, long, long, long)) \
            |           ^
      ../arch/x86/um/asm/ptrace.h:36:62: note: in definition of macro ‘PT_REGS_SET_SYSCALL_RETURN’
         36 | #define PT_REGS_SET_SYSCALL_RETURN(r, res) (PT_REGS_AX(r) = (res))
            |                                                              ^~~
      ../arch/um/kernel/skas/syscall.c:46:33: note: in expansion of macro ‘EXECUTE_SYSCALL’
         46 |                                 EXECUTE_SYSCALL(syscall, regs));
            |                                 ^~~~~~~~~~~~~~~
      
      Signed-off-by: default avatarDavid Gow <davidgow@google.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43554c35
    • Willy Tarreau's avatar
      floppy: use a statically allocated error counter · 2adafe1c
      Willy Tarreau authored
      
      commit f71f0139 upstream.
      
      Interrupt handler bad_flp_intr() may cause a UAF on the recently freed
      request just to increment the error count.  There's no point keeping
      that one in the request anyway, and since the interrupt handler uses a
      static pointer to the error which cannot be kept in sync with the
      pending request, better make it use a static error counter that's reset
      for each new request.  This reset now happens when entering
      redo_fd_request() for a new request via set_next_request().
      
      One initial concern about a single error counter was that errors on one
      floppy drive could be reported on another one, but this problem is not
      real given that the driver uses a single drive at a time, as that
      PC-compatible controllers also have this limitation by using shared
      signals.  As such the error count is always for the "current" drive.
      
      Reported-by: default avatarMinh Yuan <yuanmingbuaa@gmail.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linuxfoundation.org>
      Tested-by: default avatarDenis Efremov <efremov@linux.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2adafe1c
  2. May 18, 2022
    • Greg Kroah-Hartman's avatar
    • Yang Yingliang's avatar
      tty/serial: digicolor: fix possible null-ptr-deref in digicolor_uart_probe() · d9252b82
      Yang Yingliang authored
      
      commit 447ee151 upstream.
      
      It will cause null-ptr-deref when using 'res', if platform_get_resource()
      returns NULL, so move using 'res' after devm_ioremap_resource() that
      will check it to avoid null-ptr-deref.
      And use devm_platform_get_and_ioremap_resource() to simplify code.
      
      Fixes: 5930cb35 ("serial: driver for Conexant Digicolor USART")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarBaruch Siach <baruch@tkos.co.il>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220505124621.1592697-1-yangyingliang@huawei.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9252b82
    • Nicolas Dichtel's avatar
      ping: fix address binding wrt vrf · f5f0de6f
      Nicolas Dichtel authored
      
      commit e1a7ac6f upstream.
      
      When ping_group_range is updated, 'ping' uses the DGRAM ICMP socket,
      instead of an IP raw socket. In this case, 'ping' is unable to bind its
      socket to a local address owned by a vrflite.
      
      Before the patch:
      $ sysctl -w net.ipv4.ping_group_range='0  2147483647'
      $ ip link add blue type vrf table 10
      $ ip link add foo type dummy
      $ ip link set foo master blue
      $ ip link set foo up
      $ ip addr add 192.168.1.1/24 dev foo
      $ ip addr add 2001::1/64 dev foo
      $ ip vrf exec blue ping -c1 -I 192.168.1.1 192.168.1.2
      ping: bind: Cannot assign requested address
      $ ip vrf exec blue ping6 -c1 -I 2001::1 2001::2
      ping6: bind icmp socket: Cannot assign requested address
      
      CC: stable@vger.kernel.org
      Fixes: 1b69c6d0 ("net: Introduce L3 Master device abstraction")
      Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5f0de6f
    • Sven Schwermer's avatar
      USB: serial: option: add Fibocom MA510 modem · 2e34580e
      Sven Schwermer authored
      
      commit 07989eb9 upstream.
      
      The MA510 modem has 3 USB configurations that are configurable via the AT
      command AT+GTUSBMODE={30,31,32} which make the modem enumerate with the
      following interfaces, respectively:
      
      30: Diag + QDSS + Modem + RMNET
      31: Diag + Modem + AT + ECM
      32: Modem + AT + ECM
      
      The first configuration (30) reuses u-blox R410M's VID/PID with
      identical interface configuration.
      
      A detailed description of the USB configuration for each mode follows:
      
      +GTUSBMODE: 30
      --------------
      T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=04 Dev#= 19 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=05c6 ProdID=90b2 Rev= 0.00
      S:  Manufacturer=Fibocom MA510 Modem
      S:  Product=Fibocom MA510 Modem
      S:  SerialNumber=55e2695b
      C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      +GTUSBMODE: 31
      --------------
      T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=04 Dev#= 99 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0106 Rev= 0.00
      S:  Manufacturer=Fibocom MA510 Modem
      S:  Product=Fibocom MA510 Modem
      S:  SerialNumber=55e2695b
      C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
      A:  FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
      E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
      E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      I:  If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      +GTUSBMODE: 32
      --------------
      T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=04 Dev#=100 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=010a Rev= 0.00
      S:  Manufacturer=Fibocom MA510 Modem
      S:  Product=Fibocom MA510 Modem
      S:  SerialNumber=55e2695b
      C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
      A:  FirstIf#= 2 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
      E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      I:  If#= 3 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      I:* If#= 3 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarSven Schwermer <sven.schwermer@disruptive-technologies.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e34580e
    • Sven Schwermer's avatar
      USB: serial: option: add Fibocom L610 modem · 4e2116ea
      Sven Schwermer authored
      
      commit 714adff9 upstream.
      
      The L610 modem has 3 USB configurations that are configurable via the AT
      command AT+GTUSBMODE={31,32,33} which make the modem enumerate with the
      following interfaces, respectively:
      
      31: Modem + NV + MOS + Diag + LOG + AT + AT
      32: ECM + Modem + NV + MOS + Diag + LOG + AT + AT
      33: RNDIS + Modem + NV + MOS + Diag + LOG + AT + AT
      
      A detailed description of the USB configuration for each mode follows:
      
      +GTUSBMODE: 31
      --------------
      T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=04 Dev#=124 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1782 ProdID=4d10 Rev= 0.00
      S:  Manufacturer=FIBOCOM
      S:  Product=L610
      C:* #Ifs= 7 Cfg#= 1 Atr=e0 MxPwr=400mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      +GTUSBMODE: 32
      --------------
      T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=04 Dev#=122 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1782 ProdID=4d11 Rev= 0.00
      S:  Manufacturer=FIBOCOM
      S:  Product=L610
      C:* #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=400mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      +GTUSBMODE: 33
      --------------
      T:  Bus=03 Lev=01 Prnt=01 Port=06 Cnt=04 Dev#=126 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1782 ProdID=4d11 Rev= 0.00
      S:  Manufacturer=FIBOCOM
      S:  Product=L610
      C:* #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=400mA
      A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=4096ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarSven Schwermer <sven.schwermer@disruptive-technologies.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e2116ea
    • Ethan Yang's avatar
      USB: serial: qcserial: add support for Sierra Wireless EM7590 · d9748b55
      Ethan Yang authored
      
      commit 870b1eee upstream.
      
      Add support for Sierra Wireless EM7590 0xc080/0xc081 compositions.
      
      Signed-off-by: default avatarEthan Yang <etyang@sierrawireless.com>
      Link: https://lore.kernel.org/r/20220425055840.5693-1-etyang@sierrawireless.com
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9748b55
    • Scott Chen's avatar
      USB: serial: pl2303: add device id for HP LM930 Display · 6febadb4
      Scott Chen authored
      
      commit 26a08f8b upstream.
      
      Add the device id for the HPLM930Display which is a PL2303GC based
      device.
      
      Signed-off-by: default avatarScott Chen <scott@labau.com.tw>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6febadb4
    • Sergey Ryazanov's avatar
      usb: cdc-wdm: fix reading stuck on device close · 90bcb9af
      Sergey Ryazanov authored
      
      commit 01e01f5c upstream.
      
      cdc-wdm tracks whether a response reading request is in-progress and
      blocks the next request from being sent until the previous request is
      completed. As soon as last user closes the cdc-wdm device file, the
      driver cancels any ongoing requests, resets the pending response
      counter, but leaves the response reading in-progress flag
      (WDM_RESPONDING) untouched.
      
      So if the user closes the device file during the response receive
      request is being performed, no more data will be obtained from the
      modem. The request will be cancelled, effectively preventing the
      WDM_RESPONDING flag from being reseted. Keeping the flag set will
      prevent a new response receive request from being sent, permanently
      blocking the read path. The read path will staying blocked until the
      module will be reloaded or till the modem will be re-attached.
      
      This stuck has been observed with a Huawei E3372 modem attached to an
      OpenWrt router and using the comgt utility to set up a network
      connection.
      
      Fix this issue by clearing the WDM_RESPONDING flag on the device file
      close.
      
      Without this fix, the device reading stuck can be easily reproduced in a
      few connection establishing attempts. With this fix, a load test for
      modem connection re-establishing worked for several hours without any
      issues.
      
      Fixes: 922a5ead ("usb: cdc-wdm: Fix race between autosuspend and reading from the device")
      Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: default avatarOliver Neukum <oneukum@suse.com>
      Link: https://lore.kernel.org/r/20220501175828.8185-1-ryazanov.s.a@gmail.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90bcb9af
    • Mark Brown's avatar
      ASoC: ops: Validate input values in snd_soc_put_volsw_range() · 0e47cde8
      Mark Brown authored
      
      [ Upstream commit aa22125c ]
      
      Check that values written via snd_soc_put_volsw_range() are
      within the range advertised by the control, ensuring that we
      don't write out of spec values to the hardware.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220423131239.3375261-1-broonie@kernel.org
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0e47cde8
    • Mark Brown's avatar
      ASoC: max98090: Generate notifications on changes for custom control · 0801f53e
      Mark Brown authored
      
      [ Upstream commit 13fcf676 ]
      
      The max98090 driver has some custom controls which share a put() function
      which returns 0 unconditionally, meaning that events are not generated
      when the value changes. Fix that.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220420193454.2647908-2-broonie@kernel.org
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0801f53e
    • Mark Brown's avatar
      ASoC: max98090: Reject invalid values in custom control put() · 015a9f15
      Mark Brown authored
      
      [ Upstream commit 2fbe467b ]
      
      The max98090 driver has a custom put function for some controls which can
      only be updated in certain circumstances which makes no effort to validate
      that input is suitable for the control, allowing out of spec values to be
      written to the hardware and presented to userspace. Fix this by returning
      an error when invalid values are written.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220420193454.2647908-1-broonie@kernel.org
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      015a9f15
    • Ji-Ze Hong (Peter Hong)'s avatar
      hwmon: (f71882fg) Fix negative temperature · 0457a3c3
      Ji-Ze Hong (Peter Hong) authored
      
      [ Upstream commit 4aaaaf0f ]
      
      All temperature of Fintek superio hwmonitor that using 1-byte reg will use
      2's complement.
      
      In show_temp()
      	temp = data->temp[nr] * 1000;
      
      When data->temp[nr] read as 255, it indicate -1C, but this code will report
      255C to userspace. It'll be ok when change to:
      	temp = ((s8)data->temp[nr]) * 1000;
      
      Signed-off-by: default avatarJi-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
      Link: https://lore.kernel.org/r/20220418090706.6339-1-hpeter+linux_kernel@gmail.com
      
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0457a3c3
    • Taehee Yoo's avatar
      net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe() · 095dbe58
      Taehee Yoo authored
      
      [ Upstream commit 1fa89ffb ]
      
      In the NIC ->probe() callback, ->mtd_probe() callback is called.
      If NIC has 2 ports, ->probe() is called twice and ->mtd_probe() too.
      In the ->mtd_probe(), which is efx_ef10_mtd_probe() it allocates and
      initializes mtd partiion.
      But mtd partition for sfc is shared data.
      So that allocated mtd partition data from last called
      efx_ef10_mtd_probe() will not be used.
      Therefore it must be freed.
      But it doesn't free a not used mtd partition data in efx_ef10_mtd_probe().
      
      kmemleak reports:
      unreferenced object 0xffff88811ddb0000 (size 63168):
        comm "systemd-udevd", pid 265, jiffies 4294681048 (age 348.586s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffffa3767749>] kmalloc_order_trace+0x19/0x120
          [<ffffffffa3873f0e>] __kmalloc+0x20e/0x250
          [<ffffffffc041389f>] efx_ef10_mtd_probe+0x11f/0x270 [sfc]
          [<ffffffffc0484c8a>] efx_pci_probe.cold.17+0x3df/0x53d [sfc]
          [<ffffffffa414192c>] local_pci_probe+0xdc/0x170
          [<ffffffffa4145df5>] pci_device_probe+0x235/0x680
          [<ffffffffa443dd52>] really_probe+0x1c2/0x8f0
          [<ffffffffa443e72b>] __driver_probe_device+0x2ab/0x460
          [<ffffffffa443e92a>] driver_probe_device+0x4a/0x120
          [<ffffffffa443f2ae>] __driver_attach+0x16e/0x320
          [<ffffffffa4437a90>] bus_for_each_dev+0x110/0x190
          [<ffffffffa443b75e>] bus_add_driver+0x39e/0x560
          [<ffffffffa4440b1e>] driver_register+0x18e/0x310
          [<ffffffffc02e2055>] 0xffffffffc02e2055
          [<ffffffffa3001af3>] do_one_initcall+0xc3/0x450
          [<ffffffffa33ca574>] do_init_module+0x1b4/0x700
      
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Fixes: 8127d661 ("sfc: Add support for Solarflare SFC9100 family")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Link: https://lore.kernel.org/r/20220512054709.12513-1-ap420073@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      095dbe58
    • Alexandra Winter's avatar
      s390/lcs: fix variable dereferenced before check · d3280c80
      Alexandra Winter authored
      
      [ Upstream commit 671bb35c ]
      
      smatch complains about
      drivers/s390/net/lcs.c:1741 lcs_get_control() warn: variable dereferenced before check 'card->dev' (see line 1739)
      
      Fixes: 27eb5ac8 ("[PATCH] s390: lcs driver bug fixes and improvements [1/2]")
      Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d3280c80
    • Alexandra Winter's avatar
      s390/ctcm: fix potential memory leak · 36933de5
      Alexandra Winter authored
      
      [ Upstream commit 0c0b2058 ]
      
      smatch complains about
      drivers/s390/net/ctcm_mpc.c:1210 ctcmpc_unpack_skb() warn: possible memory leak of 'mpcginfo'
      
      mpc_action_discontact() did not free mpcginfo. Consolidate the freeing in
      ctcmpc_unpack_skb().
      
      Fixes: 293d984f ("ctcm: infrastructure for replaced ctc driver")
      Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      36933de5
    • Alexandra Winter's avatar
      s390/ctcm: fix variable dereferenced before check · 958e33ec
      Alexandra Winter authored
      
      [ Upstream commit 2c50c686 ]
      
      Found by cppcheck and smatch.
      smatch complains about
      drivers/s390/net/ctcm_sysfs.c:43 ctcm_buffer_write() warn: variable dereferenced before check 'priv' (see line 42)
      
      Fixes: 3c09e264 ("ctcm: rename READ/WRITE defines to avoid redefinitions")
      Reported-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      958e33ec
    • Johannes Berg's avatar
      mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection · 11ad1a93
      Johannes Berg authored
      
      [ Upstream commit 9e2db50f ]
      
      This is needed since it might use (and pass out) pointers to
      e.g. keys protected by RCU. Can't really happen here as the
      frames aren't encrypted, but we need to still adhere to the
      rules.
      
      Fixes: cacfddf8 ("mac80211_hwsim: initialize ieee80211_tx_info at hw_scan_work")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Link: https://lore.kernel.org/r/20220505230421.5f139f9de173.I77ae111a28f7c0e9fd1ebcee7f39dbec5c606770@changeid
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      11ad1a93
    • Eric Dumazet's avatar
      netlink: do not reset transport header in netlink_recvmsg() · 98ae14ef
      Eric Dumazet authored
      
      [ Upstream commit d5076fe4 ]
      
      netlink_recvmsg() does not need to change transport header.
      
      If transport header was needed, it should have been reset
      by the producer (netlink_dump()), not the consumer(s).
      
      The following trace probably happened when multiple threads
      were using MSG_PEEK.
      
      BUG: KCSAN: data-race in netlink_recvmsg / netlink_recvmsg
      
      write to 0xffff88811e9f15b2 of 2 bytes by task 32012 on cpu 1:
       skb_reset_transport_header include/linux/skbuff.h:2760 [inline]
       netlink_recvmsg+0x1de/0x790 net/netlink/af_netlink.c:1978
       sock_recvmsg_nosec net/socket.c:948 [inline]
       sock_recvmsg net/socket.c:966 [inline]
       __sys_recvfrom+0x204/0x2c0 net/socket.c:2097
       __do_sys_recvfrom net/socket.c:2115 [inline]
       __se_sys_recvfrom net/socket.c:2111 [inline]
       __x64_sys_recvfrom+0x74/0x90 net/socket.c:2111
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      write to 0xffff88811e9f15b2 of 2 bytes by task 32005 on cpu 0:
       skb_reset_transport_header include/linux/skbuff.h:2760 [inline]
       netlink_recvmsg+0x1de/0x790 net/netlink/af_netlink.c:1978
       ____sys_recvmsg+0x162/0x2f0
       ___sys_recvmsg net/socket.c:2674 [inline]
       __sys_recvmsg+0x209/0x3f0 net/socket.c:2704
       __do_sys_recvmsg net/socket.c:2714 [inline]
       __se_sys_recvmsg net/socket.c:2711 [inline]
       __x64_sys_recvmsg+0x42/0x50 net/socket.c:2711
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      value changed: 0xffff -> 0x0000
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 32005 Comm: syz-executor.4 Not tainted 5.18.0-rc1-syzkaller-00328-ge1f700ebd6be-dirty #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20220505161946.2867638-1-eric.dumazet@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      98ae14ef
    • Lokesh Dhoundiyal's avatar
      ipv4: drop dst in multicast routing path · 5e4656b5
      Lokesh Dhoundiyal authored
      
      [ Upstream commit 9e6c6d17 ]
      
      kmemleak reports the following when routing multicast traffic over an
      ipsec tunnel.
      
      Kmemleak output:
      unreferenced object 0x8000000044bebb00 (size 256):
        comm "softirq", pid 0, jiffies 4294985356 (age 126.810s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 80 00 00 00 05 13 74 80  ..............t.
          80 00 00 00 04 9b bf f9 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<00000000f83947e0>] __kmalloc+0x1e8/0x300
          [<00000000b7ed8dca>] metadata_dst_alloc+0x24/0x58
          [<0000000081d32c20>] __ipgre_rcv+0x100/0x2b8
          [<00000000824f6cf1>] gre_rcv+0x178/0x540
          [<00000000ccd4e162>] gre_rcv+0x7c/0xd8
          [<00000000c024b148>] ip_protocol_deliver_rcu+0x124/0x350
          [<000000006a483377>] ip_local_deliver_finish+0x54/0x68
          [<00000000d9271b3a>] ip_local_deliver+0x128/0x168
          [<00000000bd4968ae>] xfrm_trans_reinject+0xb8/0xf8
          [<0000000071672a19>] tasklet_action_common.isra.16+0xc4/0x1b0
          [<0000000062e9c336>] __do_softirq+0x1fc/0x3e0
          [<00000000013d7914>] irq_exit+0xc4/0xe0
          [<00000000a4d73e90>] plat_irq_dispatch+0x7c/0x108
          [<000000000751eb8e>] handle_int+0x16c/0x178
          [<000000001668023b>] _raw_spin_unlock_irqrestore+0x1c/0x28
      
      The metadata dst is leaked when ip_route_input_mc() updates the dst for
      the skb. Commit f38a9eb1 ("dst: Metadata destinations") correctly
      handled dropping the dst in ip_route_input_slow() but missed the
      multicast case which is handled by ip_route_input_mc(). Drop the dst in
      ip_route_input_mc() avoiding the leak.
      
      Fixes: f38a9eb1 ("dst: Metadata destinations")
      Signed-off-by: default avatarLokesh Dhoundiyal <lokesh.dhoundiyal@alliedtelesis.co.nz>
      Signed-off-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220505020017.3111846-1-chris.packham@alliedtelesis.co.nz
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5e4656b5
    • Tariq Toukan's avatar
      net: Fix features skip in for_each_netdev_feature() · f574eb88
      Tariq Toukan authored
      
      [ Upstream commit 85db6352 ]
      
      The find_next_netdev_feature() macro gets the "remaining length",
      not bit index.
      Passing "bit - 1" for the following iteration is wrong as it skips
      the adjacent bit. Pass "bit" instead.
      
      Fixes: 3b89ea9c ("net: Fix for_each_netdev_feature on Big endian")
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
      Link: https://lore.kernel.org/r/20220504080914.1918-1-tariqt@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f574eb88
  3. May 15, 2022
  4. May 12, 2022
    • Greg Kroah-Hartman's avatar
    • Mike Snitzer's avatar
      dm: interlock pending dm_io and dm_wait_for_bios_completion · 7bb36909
      Mike Snitzer authored
      
      commit 9f6dc633 upstream.
      
      Commit d208b894 ("dm: fix mempool NULL pointer race when
      completing IO") didn't go far enough.
      
      When bio_end_io_acct ends the count of in-flight I/Os may reach zero
      and the DM device may be suspended. There is a possibility that the
      suspend races with dm_stats_account_io.
      
      Fix this by adding percpu "pending_io" counters to track outstanding
      dm_io. Move kicking of suspend queue to dm_io_dec_pending(). Also,
      rename md_in_flight_bios() to dm_in_flight_bios() and update it to
      iterate all pending_io counters.
      
      Fixes: d208b894 ("dm: fix mempool NULL pointer race when completing IO")
      Cc: stable@vger.kernel.org
      Co-developed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: default avatarMike Snitzer <snitzer@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7bb36909
    • Jiazi Li's avatar
      dm: fix mempool NULL pointer race when completing IO · 9fb7cd5c
      Jiazi Li authored
      
      commit d208b894 upstream.
      
      dm_io_dec_pending() calls end_io_acct() first and will then dec md
      in-flight pending count. But if a task is swapping DM table at same
      time this can result in a crash due to mempool->elements being NULL:
      
      task1                             task2
      do_resume
       ->do_suspend
        ->dm_wait_for_completion
                                        bio_endio
      				   ->clone_endio
      				    ->dm_io_dec_pending
      				     ->end_io_acct
      				      ->wakeup task1
       ->dm_swap_table
        ->__bind
         ->__bind_mempools
          ->bioset_exit
           ->mempool_exit
                                           ->free_io
      
      [ 67.330330] Unable to handle kernel NULL pointer dereference at
      virtual address 0000000000000000
      ......
      [ 67.330494] pstate: 80400085 (Nzcv daIf +PAN -UAO)
      [ 67.330510] pc : mempool_free+0x70/0xa0
      [ 67.330515] lr : mempool_free+0x4c/0xa0
      [ 67.330520] sp : ffffff8008013b20
      [ 67.330524] x29: ffffff8008013b20 x28: 0000000000000004
      [ 67.330530] x27: ffffffa8c2ff40a0 x26: 00000000ffff1cc8
      [ 67.330535] x25: 0000000000000000 x24: ffffffdada34c800
      [ 67.330541] x23: 0000000000000000 x22: ffffffdada34c800
      [ 67.330547] x21: 00000000ffff1cc8 x20: ffffffd9a1304d80
      [ 67.330552] x19: ffffffdada34c970 x18: 000000b312625d9c
      [ 67.330558] x17: 00000000002dcfbf x16: 00000000000006dd
      [ 67.330563] x15: 000000000093b41e x14: 0000000000000010
      [ 67.330569] x13: 0000000000007f7a x12: 0000000034155555
      [ 67.330574] x11: 0000000000000001 x10: 0000000000000001
      [ 67.330579] x9 : 0000000000000000 x8 : 0000000000000000
      [ 67.330585] x7 : 0000000000000000 x6 : ffffff80148b5c1a
      [ 67.330590] x5 : ffffff8008013ae0 x4 : 0000000000000001
      [ 67.330596] x3 : ffffff80080139c8 x2 : ffffff801083bab8
      [ 67.330601] x1 : 0000000000000000 x0 : ffffffdada34c970
      [ 67.330609] Call trace:
      [ 67.330616] mempool_free+0x70/0xa0
      [ 67.330627] bio_put+0xf8/0x110
      [ 67.330638] dec_pending+0x13c/0x230
      [ 67.330644] clone_endio+0x90/0x180
      [ 67.330649] bio_endio+0x198/0x1b8
      [ 67.330655] dec_pending+0x190/0x230
      [ 67.330660] clone_endio+0x90/0x180
      [ 67.330665] bio_endio+0x198/0x1b8
      [ 67.330673] blk_update_request+0x214/0x428
      [ 67.330683] scsi_end_request+0x2c/0x300
      [ 67.330688] scsi_io_completion+0xa0/0x710
      [ 67.330695] scsi_finish_command+0xd8/0x110
      [ 67.330700] scsi_softirq_done+0x114/0x148
      [ 67.330708] blk_done_softirq+0x74/0xd0
      [ 67.330716] __do_softirq+0x18c/0x374
      [ 67.330724] irq_exit+0xb4/0xb8
      [ 67.330732] __handle_domain_irq+0x84/0xc0
      [ 67.330737] gic_handle_irq+0x148/0x1b0
      [ 67.330744] el1_irq+0xe8/0x190
      [ 67.330753] lpm_cpuidle_enter+0x4f8/0x538
      [ 67.330759] cpuidle_enter_state+0x1fc/0x398
      [ 67.330764] cpuidle_enter+0x18/0x20
      [ 67.330772] do_idle+0x1b4/0x290
      [ 67.330778] cpu_startup_entry+0x20/0x28
      [ 67.330786] secondary_start_kernel+0x160/0x170
      
      Fix this by:
      1) Establishing pointers to 'struct dm_io' members in
      dm_io_dec_pending() so that they may be passed into end_io_acct()
      _after_ free_io() is called.
      2) Moving end_io_acct() after free_io().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJiazi Li <lijiazi@xiaomi.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: default avatarMike Snitzer <snitzer@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fb7cd5c
    • j.nixdorf@avm.de's avatar
      net: ipv6: ensure we call ipv6_mc_down() at most once · 9a8736b2
      j.nixdorf@avm.de authored
      
      commit 9995b408 upstream.
      
      There are two reasons for addrconf_notify() to be called with NETDEV_DOWN:
      either the network device is actually going down, or IPv6 was disabled
      on the interface.
      
      If either of them stays down while the other is toggled, we repeatedly
      call the code for NETDEV_DOWN, including ipv6_mc_down(), while never
      calling the corresponding ipv6_mc_up() in between. This will cause a
      new entry in idev->mc_tomb to be allocated for each multicast group
      the interface is subscribed to, which in turn leaks one struct ifmcaddr6
      per nontrivial multicast group the interface is subscribed to.
      
      The following reproducer will leak at least $n objects:
      
      ip addr add ff2e::4242/32 dev eth0 autojoin
      sysctl -w net.ipv6.conf.eth0.disable_ipv6=1
      for i in $(seq 1 $n); do
      	ip link set up eth0; ip link set down eth0
      done
      
      Joining groups with IPV6_ADD_MEMBERSHIP (unprivileged) or setting the
      sysctl net.ipv6.conf.eth0.forwarding to 1 (=> subscribing to ff02::2)
      can also be used to create a nontrivial idev->mc_list, which will the
      leak objects with the right up-down-sequence.
      
      Based on both sources for NETDEV_DOWN events the interface IPv6 state
      should be considered:
      
       - not ready if the network interface is not ready OR IPv6 is disabled
         for it
       - ready if the network interface is ready AND IPv6 is enabled for it
      
      The functions ipv6_mc_up() and ipv6_down() should only be run when this
      state changes.
      
      Implement this by remembering when the IPv6 state is ready, and only
      run ipv6_mc_down() if it actually changed from ready to not ready.
      
      The other direction (not ready -> ready) already works correctly, as:
      
       - the interface notification triggered codepath for NETDEV_UP /
         NETDEV_CHANGE returns early if ipv6 is disabled, and
       - the disable_ipv6=0 triggered codepath skips fully initializing the
         interface as long as addrconf_link_ready(dev) returns false
       - calling ipv6_mc_up() repeatedly does not leak anything
      
      Fixes: 3ce62a84 ("ipv6: exit early in addrconf_notify() if IPv6 is disabled")
      Signed-off-by: default avatarJohannes Nixdorf <j.nixdorf@avm.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [jnixdorf: context updated for bpo to v4.9/v4.14]
      Signed-off-by: default avatarJohannes Nixdorf <j.nixdorf@avm.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a8736b2
    • Thadeu Lima de Souza Cascardo's avatar
      net: sched: prevent UAF on tc_ctl_tfilter when temporarily dropping rtnl_lock · 2b29404f
      Thadeu Lima de Souza Cascardo authored
      
      When dropping the rtnl_lock for looking up for a module, the device may be
      removed, releasing the qdisc and class memory. Right after trying to load
      the module, cl_ops->put is called, leading to a potential use-after-free.
      
      Though commit e368fdb6 ("net: sched: use Qdisc rcu API instead of
      relying on rtnl lock") fixes this, it involves a lot of refactoring of the
      net/sched/ code, complicating its backport.
      
      This fix calls cl_ops->put before dropping rtnl_lock as it will be called
      either way, and zeroes it out so it won't be called again on the exit path.
      
      This has been shown to stop the following KASAN report with the reproducer:
      
      [  256.609111] ==================================================================
      [  256.609585] BUG: KASAN: use-after-free in cbq_put+0x20/0xd0 at addr ffff880021daaba0
      [  256.610078] Read of size 4 by task total_cbq/11184
      [  256.610380] CPU: 0 PID: 11184 Comm: total_cbq Not tainted 4.9.311 #78
      [  256.610778]  ffff8800215875a8 ffffffff96e18735 ffff880024803080 ffff880021daaa80
      [  256.611274]  ffff8800215875d0 ffffffff96334841 ffffed00043b5574 ffffed00043b5574
      [  256.611768]  ffff880024803080 ffff880021587658 ffffffff96334af8 0000000000000000
      [  256.612186] Call Trace:
      [  256.612344]  [<ffffffff96e18735>] dump_stack+0x6d/0x8b
      [  256.612632]  [<ffffffff96334841>] kasan_object_err+0x21/0x70
      [  256.612973]  [<ffffffff96334af8>] kasan_report.part.1+0x218/0x4f0
      [  256.613349]  [<ffffffff96c5a2e0>] ? cbq_put+0x20/0xd0
      [  256.613634]  [<ffffffff96333cd6>] ? kasan_unpoison_shadow+0x36/0x50
      [  256.613993]  [<ffffffff96335105>] kasan_report+0x25/0x30
      [  256.614288]  [<ffffffff96333701>] __asan_load4+0x61/0x80
      [  256.614580]  [<ffffffff96c5a2e0>] cbq_put+0x20/0xd0
      [  256.614862]  [<ffffffff96c53184>] tc_ctl_tfilter+0x4f4/0xb80
      [  256.615151]  [<ffffffff96c52c90>] ? tfilter_notify+0x140/0x140
      [  256.615478]  [<ffffffff960056ef>] ? do_syscall_64+0xef/0x190
      [  256.615799]  [<ffffffff96e28a8e>] ? entry_SYSCALL_64_after_swapgs+0x58/0xc6
      [  256.616190]  [<ffffffff96bce3f6>] ? sock_sendmsg+0x76/0x80
      [  256.616484]  [<ffffffff96bce53f>] ? sock_write_iter+0x13f/0x1f0
      [  256.616833]  [<ffffffff96367b02>] ? __vfs_write+0x262/0x3c0
      [  256.617152]  [<ffffffff96369dc9>] ? vfs_write+0xf9/0x260
      [  256.617451]  [<ffffffff9636c009>] ? SyS_write+0xc9/0x1b0
      [  256.617754]  [<ffffffff960decda>] ? ns_capable_common+0x5a/0xa0
      [  256.618067]  [<ffffffff960ded33>] ? ns_capable+0x13/0x20
      [  256.618334]  [<ffffffff96c9125d>] ? __netlink_ns_capable+0x6d/0x80
      [  256.618666]  [<ffffffff96c2750f>] rtnetlink_rcv_msg+0x1af/0x410
      [  256.618969]  [<ffffffff96c90d6b>] ? netlink_compare+0x5b/0x70
      [  256.619295]  [<ffffffff96c27360>] ? rtnl_newlink+0xc60/0xc60
      [  256.619587]  [<ffffffff96c94214>] ? __netlink_lookup+0x1a4/0x240
      [  256.619885]  [<ffffffff96c94070>] ? netlink_broadcast+0x20/0x20
      [  256.620179]  [<ffffffff96c97815>] netlink_rcv_skb+0x155/0x190
      [  256.620463]  [<ffffffff96c27360>] ? rtnl_newlink+0xc60/0xc60
      [  256.620748]  [<ffffffff96c1e758>] rtnetlink_rcv+0x28/0x30
      [  256.621015]  [<ffffffff96c96d11>] netlink_unicast+0x2f1/0x3b0
      [  256.621354]  [<ffffffff96c96a20>] ? netlink_attachskb+0x340/0x340
      [  256.621765]  [<ffffffff96c9733e>] netlink_sendmsg+0x56e/0x6f0
      [  256.622181]  [<ffffffff96c96dd0>] ? netlink_unicast+0x3b0/0x3b0
      [  256.622578]  [<ffffffff96c96dd0>] ? netlink_unicast+0x3b0/0x3b0
      [  256.622893]  [<ffffffff96bce3f6>] sock_sendmsg+0x76/0x80
      [  256.623157]  [<ffffffff96bce53f>] sock_write_iter+0x13f/0x1f0
      [  256.623440]  [<ffffffff96bce400>] ? sock_sendmsg+0x80/0x80
      [  256.623729]  [<ffffffff966a8032>] ? iov_iter_init+0x82/0xc0
      [  256.624006]  [<ffffffff96367b02>] __vfs_write+0x262/0x3c0
      [  256.624274]  [<ffffffff963678a0>] ? default_llseek+0x120/0x120
      [  256.624566]  [<ffffffff965e8c02>] ? common_file_perm+0x92/0x170
      [  256.624925]  [<ffffffff96369a58>] ? rw_verify_area+0x78/0x140
      [  256.625277]  [<ffffffff96369dc9>] vfs_write+0xf9/0x260
      [  256.625593]  [<ffffffff9636c009>] SyS_write+0xc9/0x1b0
      [  256.625891]  [<ffffffff9636bf40>] ? SyS_read+0x1b0/0x1b0
      [  256.626154]  [<ffffffff9636bf40>] ? SyS_read+0x1b0/0x1b0
      [  256.626422]  [<ffffffff960056ef>] do_syscall_64+0xef/0x190
      [  256.626697]  [<ffffffff96e28a8e>] entry_SYSCALL_64_after_swapgs+0x58/0xc6
      [  256.627033] Object at ffff880021daaa80, in cache kmalloc-512 size: 512
      [  256.627415] Allocated:
      [  256.627563] PID = 164
      [  256.627711]  save_stack_trace+0x1b/0x20
      [  256.627947]  save_stack+0x46/0xd0
      [  256.628151]  kasan_kmalloc+0xad/0xe0
      [  256.628362]  kmem_cache_alloc_trace+0xe8/0x1e0
      [  256.628637]  cbq_change_class+0x8b6/0xde0
      [  256.628896]  tc_ctl_tclass+0x56a/0x5b0
      [  256.629129]  rtnetlink_rcv_msg+0x1af/0x410
      [  256.629380]  netlink_rcv_skb+0x155/0x190
      [  256.629621]  rtnetlink_rcv+0x28/0x30
      [  256.629840]  netlink_unicast+0x2f1/0x3b0
      [  256.630066]  netlink_sendmsg+0x56e/0x6f0
      [  256.630263]  sock_sendmsg+0x76/0x80
      [  256.630456]  sock_write_iter+0x13f/0x1f0
      [  256.630698]  __vfs_write+0x262/0x3c0
      [  256.630918]  vfs_write+0xf9/0x260
      [  256.631123]  SyS_write+0xc9/0x1b0
      [  256.631327]  do_syscall_64+0xef/0x190
      [  256.631553]  entry_SYSCALL_64_after_swapgs+0x58/0xc6
      [  256.631827] Freed:
      [  256.631931] PID = 164
      [  256.632048]  save_stack_trace+0x1b/0x20
      [  256.632241]  save_stack+0x46/0xd0
      [  256.632408]  kasan_slab_free+0x71/0xb0
      [  256.632597]  kfree+0x8c/0x1a0
      [  256.632751]  cbq_destroy_class+0x85/0xa0
      [  256.632948]  cbq_destroy+0xfa/0x120
      [  256.633125]  qdisc_destroy+0xa1/0x140
      [  256.633309]  dev_shutdown+0x12d/0x190
      [  256.633497]  rollback_registered_many+0x43c/0x5b0
      [  256.633753]  unregister_netdevice_many+0x2c/0x130
      [  256.634041]  rtnl_delete_link+0xb3/0x100
      [  256.634283]  rtnl_dellink+0x19c/0x360
      [  256.634509]  rtnetlink_rcv_msg+0x1af/0x410
      [  256.634760]  netlink_rcv_skb+0x155/0x190
      [  256.635001]  rtnetlink_rcv+0x28/0x30
      [  256.635221]  netlink_unicast+0x2f1/0x3b0
      [  256.635463]  netlink_sendmsg+0x56e/0x6f0
      [  256.635700]  sock_sendmsg+0x76/0x80
      [  256.635915]  sock_write_iter+0x13f/0x1f0
      [  256.636156]  __vfs_write+0x262/0x3c0
      [  256.636376]  vfs_write+0xf9/0x260
      [  256.636580]  SyS_write+0xc9/0x1b0
      [  256.636787]  do_syscall_64+0xef/0x190
      [  256.637013]  entry_SYSCALL_64_after_swapgs+0x58/0xc6
      [  256.637316] Memory state around the buggy address:
      [  256.637610]  ffff880021daaa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  256.638047]  ffff880021daab00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  256.638487] >ffff880021daab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  256.638924]                                ^
      [  256.639186]  ffff880021daac00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  256.639624]  ffff880021daac80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      
      Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
      2b29404f
    • Sandipan Das's avatar
      kvm: x86/cpuid: Only provide CPUID leaf 0xA if host has architectural PMU · 1bb717ac
      Sandipan Das authored
      
      [ Upstream commit 5a1bde46 ]
      
      On some x86 processors, CPUID leaf 0xA provides information
      on Architectural Performance Monitoring features. It
      advertises a PMU version which Qemu uses to determine the
      availability of additional MSRs to manage the PMCs.
      
      Upon receiving a KVM_GET_SUPPORTED_CPUID ioctl request for
      the same, the kernel constructs return values based on the
      x86_pmu_capability irrespective of the vendor.
      
      This leaf and the additional MSRs are not supported on AMD
      and Hygon processors. If AMD PerfMonV2 is detected, the PMU
      version is set to 2 and guest startup breaks because of an
      attempt to access a non-existent MSR. Return zeros to avoid
      this.
      
      Fixes: a6c06ed1 ("KVM: Expose the architectural performance monitoring CPUID leaf")
      Reported-by: default avatarVasant Hegde <vasant.hegde@amd.com>
      Signed-off-by: default avatarSandipan Das <sandipan.das@amd.com>
      Message-Id: <3fef83d9c2b2f7516e8ff50d60851f29a4bcb716.1651058600.git.sandipan.das@amd.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1bb717ac
Loading