Skip to content
Snippets Groups Projects
  1. May 25, 2022
  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
    • Eric Dumazet's avatar
      net: igmp: respect RCU rules in ip_mc_source() and ip_mc_msfilter() · 7815943e
      Eric Dumazet authored
      
      commit dba5bdd5 upstream.
      
      syzbot reported an UAF in ip_mc_sf_allow() [1]
      
      Whenever RCU protected list replaces an object,
      the pointer to the new object needs to be updated
      _before_ the call to kfree_rcu() or call_rcu()
      
      Because kfree_rcu(ptr, rcu) got support for NULL ptr
      only recently in commit 12edff04 ("rcu: Make kfree_rcu()
      ignore NULL pointers"), I chose to use the conditional
      to make sure stable backports won't miss this detail.
      
      if (psl)
          kfree_rcu(psl, rcu);
      
      net/ipv6/mcast.c has similar issues, addressed in a separate patch.
      
      [1]
      BUG: KASAN: use-after-free in ip_mc_sf_allow+0x6bb/0x6d0 net/ipv4/igmp.c:2655
      Read of size 4 at addr ffff88807d37b904 by task syz-executor.5/908
      
      CPU: 0 PID: 908 Comm: syz-executor.5 Not tainted 5.18.0-rc4-syzkaller-00064-g8f4dd16603ce #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313
       print_report mm/kasan/report.c:429 [inline]
       kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
       ip_mc_sf_allow+0x6bb/0x6d0 net/ipv4/igmp.c:2655
       raw_v4_input net/ipv4/raw.c:190 [inline]
       raw_local_deliver+0x4d1/0xbe0 net/ipv4/raw.c:218
       ip_protocol_deliver_rcu+0xcf/0xb30 net/ipv4/ip_input.c:193
       ip_local_deliver_finish+0x2ee/0x4c0 net/ipv4/ip_input.c:233
       NF_HOOK include/linux/netfilter.h:307 [inline]
       NF_HOOK include/linux/netfilter.h:301 [inline]
       ip_local_deliver+0x1b3/0x200 net/ipv4/ip_input.c:254
       dst_input include/net/dst.h:461 [inline]
       ip_rcv_finish+0x1cb/0x2f0 net/ipv4/ip_input.c:437
       NF_HOOK include/linux/netfilter.h:307 [inline]
       NF_HOOK include/linux/netfilter.h:301 [inline]
       ip_rcv+0xaa/0xd0 net/ipv4/ip_input.c:556
       __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5405
       __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5519
       netif_receive_skb_internal net/core/dev.c:5605 [inline]
       netif_receive_skb+0x13e/0x8e0 net/core/dev.c:5664
       tun_rx_batched.isra.0+0x460/0x720 drivers/net/tun.c:1534
       tun_get_user+0x28b7/0x3e30 drivers/net/tun.c:1985
       tun_chr_write_iter+0xdb/0x200 drivers/net/tun.c:2015
       call_write_iter include/linux/fs.h:2050 [inline]
       new_sync_write+0x38a/0x560 fs/read_write.c:504
       vfs_write+0x7c0/0xac0 fs/read_write.c:591
       ksys_write+0x127/0x250 fs/read_write.c:644
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7f3f12c3bbff
      Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 99 fd ff ff 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 cc fd ff ff 48
      RSP: 002b:00007f3f13ea9130 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 00007f3f12d9bf60 RCX: 00007f3f12c3bbff
      RDX: 0000000000000036 RSI: 0000000020002ac0 RDI: 00000000000000c8
      RBP: 00007f3f12ce308d R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000036 R11: 0000000000000293 R12: 0000000000000000
      R13: 00007fffb68dd79f R14: 00007f3f13ea9300 R15: 0000000000022000
       </TASK>
      
      Allocated by task 908:
       kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
       kasan_set_track mm/kasan/common.c:45 [inline]
       set_alloc_info mm/kasan/common.c:436 [inline]
       ____kasan_kmalloc mm/kasan/common.c:515 [inline]
       ____kasan_kmalloc mm/kasan/common.c:474 [inline]
       __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524
       kasan_kmalloc include/linux/kasan.h:234 [inline]
       __do_kmalloc mm/slab.c:3710 [inline]
       __kmalloc+0x209/0x4d0 mm/slab.c:3719
       kmalloc include/linux/slab.h:586 [inline]
       sock_kmalloc net/core/sock.c:2501 [inline]
       sock_kmalloc+0xb5/0x100 net/core/sock.c:2492
       ip_mc_source+0xba2/0x1100 net/ipv4/igmp.c:2392
       do_ip_setsockopt net/ipv4/ip_sockglue.c:1296 [inline]
       ip_setsockopt+0x2312/0x3ab0 net/ipv4/ip_sockglue.c:1432
       raw_setsockopt+0x274/0x2c0 net/ipv4/raw.c:861
       __sys_setsockopt+0x2db/0x6a0 net/socket.c:2180
       __do_sys_setsockopt net/socket.c:2191 [inline]
       __se_sys_setsockopt net/socket.c:2188 [inline]
       __x64_sys_setsockopt+0xba/0x150 net/socket.c:2188
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Freed by task 753:
       kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
       kasan_set_track+0x21/0x30 mm/kasan/common.c:45
       kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
       ____kasan_slab_free mm/kasan/common.c:366 [inline]
       ____kasan_slab_free+0x13d/0x180 mm/kasan/common.c:328
       kasan_slab_free include/linux/kasan.h:200 [inline]
       __cache_free mm/slab.c:3439 [inline]
       kmem_cache_free_bulk+0x69/0x460 mm/slab.c:3774
       kfree_bulk include/linux/slab.h:437 [inline]
       kfree_rcu_work+0x51c/0xa10 kernel/rcu/tree.c:3318
       process_one_work+0x996/0x1610 kernel/workqueue.c:2289
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2e9/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
      
      Last potentially related work creation:
       kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
       __kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348
       kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3595
       ip_mc_msfilter+0x712/0xb60 net/ipv4/igmp.c:2510
       do_ip_setsockopt net/ipv4/ip_sockglue.c:1257 [inline]
       ip_setsockopt+0x32e1/0x3ab0 net/ipv4/ip_sockglue.c:1432
       raw_setsockopt+0x274/0x2c0 net/ipv4/raw.c:861
       __sys_setsockopt+0x2db/0x6a0 net/socket.c:2180
       __do_sys_setsockopt net/socket.c:2191 [inline]
       __se_sys_setsockopt net/socket.c:2188 [inline]
       __x64_sys_setsockopt+0xba/0x150 net/socket.c:2188
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Second to last potentially related work creation:
       kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
       __kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348
       call_rcu+0x99/0x790 kernel/rcu/tree.c:3074
       mpls_dev_notify+0x552/0x8a0 net/mpls/af_mpls.c:1656
       notifier_call_chain+0xb5/0x200 kernel/notifier.c:84
       call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1938
       call_netdevice_notifiers_extack net/core/dev.c:1976 [inline]
       call_netdevice_notifiers net/core/dev.c:1990 [inline]
       unregister_netdevice_many+0x92e/0x1890 net/core/dev.c:10751
       default_device_exit_batch+0x449/0x590 net/core/dev.c:11245
       ops_exit_list+0x125/0x170 net/core/net_namespace.c:167
       cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:594
       process_one_work+0x996/0x1610 kernel/workqueue.c:2289
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2e9/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
      
      The buggy address belongs to the object at ffff88807d37b900
       which belongs to the cache kmalloc-64 of size 64
      The buggy address is located 4 bytes inside of
       64-byte region [ffff88807d37b900, ffff88807d37b940)
      
      The buggy address belongs to the physical page:
      page:ffffea0001f4dec0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807d37b180 pfn:0x7d37b
      flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
      raw: 00fff00000000200 ffff888010c41340 ffffea0001c795c8 ffff888010c40200
      raw: ffff88807d37b180 ffff88807d37b000 000000010000001f 0000000000000000
      page dumped because: kasan: bad access detected
      page_owner tracks the page as allocated
      page last allocated via order 0, migratetype Unmovable, gfp_mask 0x342040(__GFP_IO|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 2963, tgid 2963 (udevd), ts 139732238007, free_ts 139730893262
       prep_new_page mm/page_alloc.c:2441 [inline]
       get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4182
       __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408
       __alloc_pages_node include/linux/gfp.h:587 [inline]
       kmem_getpages mm/slab.c:1378 [inline]
       cache_grow_begin+0x75/0x350 mm/slab.c:2584
       cache_alloc_refill+0x27f/0x380 mm/slab.c:2957
       ____cache_alloc mm/slab.c:3040 [inline]
       ____cache_alloc mm/slab.c:3023 [inline]
       __do_cache_alloc mm/slab.c:3267 [inline]
       slab_alloc mm/slab.c:3309 [inline]
       __do_kmalloc mm/slab.c:3708 [inline]
       __kmalloc+0x3b3/0x4d0 mm/slab.c:3719
       kmalloc include/linux/slab.h:586 [inline]
       kzalloc include/linux/slab.h:714 [inline]
       tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45
       tomoyo_encode2 security/tomoyo/realpath.c:31 [inline]
       tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80
       tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288
       tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
       tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822
       security_inode_getattr+0xcf/0x140 security/security.c:1350
       vfs_getattr fs/stat.c:157 [inline]
       vfs_statx+0x16a/0x390 fs/stat.c:232
       vfs_fstatat+0x8c/0xb0 fs/stat.c:255
       __do_sys_newfstatat+0x91/0x110 fs/stat.c:425
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      page last free stack trace:
       reset_page_owner include/linux/page_owner.h:24 [inline]
       free_pages_prepare mm/page_alloc.c:1356 [inline]
       free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406
       free_unref_page_prepare mm/page_alloc.c:3328 [inline]
       free_unref_page+0x19/0x6a0 mm/page_alloc.c:3423
       __vunmap+0x85d/0xd30 mm/vmalloc.c:2667
       __vfree+0x3c/0xd0 mm/vmalloc.c:2715
       vfree+0x5a/0x90 mm/vmalloc.c:2746
       __do_replace+0x16b/0x890 net/ipv6/netfilter/ip6_tables.c:1117
       do_replace net/ipv6/netfilter/ip6_tables.c:1157 [inline]
       do_ip6t_set_ctl+0x90d/0xb90 net/ipv6/netfilter/ip6_tables.c:1639
       nf_setsockopt+0x83/0xe0 net/netfilter/nf_sockopt.c:101
       ipv6_setsockopt+0x122/0x180 net/ipv6/ipv6_sockglue.c:1026
       tcp_setsockopt+0x136/0x2520 net/ipv4/tcp.c:3696
       __sys_setsockopt+0x2db/0x6a0 net/socket.c:2180
       __do_sys_setsockopt net/socket.c:2191 [inline]
       __se_sys_setsockopt net/socket.c:2188 [inline]
       __x64_sys_setsockopt+0xba/0x150 net/socket.c:2188
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Memory state around the buggy address:
       ffff88807d37b800: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
       ffff88807d37b880: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
      >ffff88807d37b900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                         ^
       ffff88807d37b980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
       ffff88807d37ba00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
      
      Fixes: c85bb41e ("igmp: fix ip_mc_sf_allow race [v5]")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: Flavio Leitner <fbl@sysclose.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7815943e
    • Filipe Manana's avatar
      btrfs: always log symlinks in full mode · 3f0257d3
      Filipe Manana authored
      
      commit d0e64a98 upstream.
      
      On Linux, empty symlinks are invalid, and attempting to create one with
      the system call symlink(2) results in an -ENOENT error and this is
      explicitly documented in the man page.
      
      If we rename a symlink that was created in the current transaction and its
      parent directory was logged before, we actually end up logging the symlink
      without logging its content, which is stored in an inline extent. That
      means that after a power failure we can end up with an empty symlink,
      having no content and an i_size of 0 bytes.
      
      It can be easily reproduced like this:
      
        $ mkfs.btrfs -f /dev/sdc
        $ mount /dev/sdc /mnt
      
        $ mkdir /mnt/testdir
        $ sync
      
        # Create a file inside the directory and fsync the directory.
        $ touch /mnt/testdir/foo
        $ xfs_io -c "fsync" /mnt/testdir
      
        # Create a symlink inside the directory and then rename the symlink.
        $ ln -s /mnt/testdir/foo /mnt/testdir/bar
        $ mv /mnt/testdir/bar /mnt/testdir/baz
      
        # Now fsync again the directory, this persist the log tree.
        $ xfs_io -c "fsync" /mnt/testdir
      
        <power failure>
      
        $ mount /dev/sdc /mnt
        $ stat -c %s /mnt/testdir/baz
        0
        $ readlink /mnt/testdir/baz
        $
      
      Fix this by always logging symlinks in full mode (LOG_INODE_ALL), so that
      their content is also logged.
      
      A test case for fstests will follow.
      
      CC: stable@vger.kernel.org # 4.9+
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f0257d3
    • Sergey Shtylyov's avatar
      smsc911x: allow using IRQ0 · 7c392aeb
      Sergey Shtylyov authored
      
      commit 5ef9b803 upstream.
      
      The AlphaProject AP-SH4A-3A/AP-SH4AD-0A SH boards use IRQ0 for their SMSC
      LAN911x Ethernet chip, so the networking on them must have been broken by
      commit 965b2aa7 ("net/smsc911x: fix irq resource allocation failure")
      which filtered out 0 as well as the negative error codes -- it was kinda
      correct at the time, as platform_get_irq() could return 0 on of_irq_get()
      failure and on the actual 0 in an IRQ resource.  This issue was fixed by
      me (back in 2016!), so we should be able to fix this driver to allow IRQ0
      usage again...
      
      When merging this to the stable kernels, make sure you also merge commit
      e330b9a6 ("platform: don't return 0 from platform_get_irq[_byname]()
      on error") -- that's my fix to platform_get_irq() for the DT platforms...
      
      Fixes: 965b2aa7 ("net/smsc911x: fix irq resource allocation failure")
      Signed-off-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Link: https://lore.kernel.org/r/656036e4-6387-38df-b8a7-6ba683b16e63@omp.ru
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c392aeb
Loading