Skip to content
  1. Jan 24, 2023
    • Ian Abbott's avatar
      comedi: adv_pci1760: Fix PWM instruction handling · a794e308
      Ian Abbott authored
      commit 2efb6edd upstream.
      
      (Actually, this is fixing the "Read the Current Status" command sent to
      the device's outgoing mailbox, but it is only currently used for the PWM
      instructions.)
      
      The PCI-1760 is operated mostly by sending commands to a set of Outgoing
      Mailbox registers, waiting for the command to complete, and reading the
      result from the Incoming Mailbox registers.  One of these commands is
      the "Read the Current Status" command.  The number of this command is
      0x07 (see the User's Manual for the PCI-1760 at
      <https://advdownload.advantech.com/productfile/Downloadfile2/1-11P6653/PCI-1760.pdf>.
      The `PCI1760_CMD_GET_STATUS` macro defined in the driver should expand
      to this command number 0x07, but unfortunately it currently expands to
      0x03.  (Command number 0x03 is not defined in the User's Manual.)
      Correct the definition of the `PCI1760_CMD_GET_STATUS` macro to fix it.
      
      This is used by all the PWM subdevice related instructions handled by
      `pci1760_pwm_insn_config()` which are probably all broken.  The effect
      of sending the undefined command number 0x03 is not known.
      
      Fixes: 14b93bb6
      
       ("staging: comedi: adv_pci_dio: separate out PCI-1760 support")
      Cc: <stable@vger.kernel.org> # v4.5+
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Link: https://lore.kernel.org/r/20230103143754.17564-1-abbotti@mev.co.uk
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a794e308
    • Flavio Suligoi's avatar
      usb: core: hub: disable autosuspend for TI TUSB8041 · 3be567d8
      Flavio Suligoi authored
      commit 7171b0e2
      
       upstream.
      
      The Texas Instruments TUSB8041 has an autosuspend problem at high
      temperature.
      
      If there is not USB traffic, after a couple of ms, the device enters in
      autosuspend mode. In this condition the external clock stops working, to
      save energy. When the USB activity turns on, ther hub exits the
      autosuspend state, the clock starts running again and all works fine.
      
      At ambient temperature all works correctly, but at high temperature,
      when the USB activity turns on, the external clock doesn't restart and
      the hub disappears from the USB bus.
      
      Disabling the autosuspend mode for this hub solves the issue.
      
      Signed-off-by: default avatarFlavio Suligoi <f.suligoi@asem.it>
      Cc: stable <stable@kernel.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20221219124759.3207032-1-f.suligoi@asem.it
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3be567d8
    • Greg Kroah-Hartman's avatar
      USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100 · 1f09d795
      Greg Kroah-Hartman authored
      commit 14ff7460 upstream.
      
      The USB_DEVICE_ID_CODEMERCS_IOW100 header size was incorrect, it should
      be 12, not 13.
      
      Cc: stable <stable@kernel.org>
      Fixes: 17a82716
      
       ("USB: iowarrior: fix up report size handling for some devices")
      Reported-by: default avatarChristoph Jung <jung@codemercs.com>
      Link: https://lore.kernel.org/r/20230120135330.3842518-1-gregkh@linuxfoundation.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f09d795
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05CN modem · 40a8d565
      Duke Xin(辛安文) authored
      commit 71dfd381
      
       upstream.
      
      The EM05CN modem has 2 USB configurations that are configurable via the AT
      command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with
      the following interfaces, respectively:
      
      "MBIM"  : AT + MBIM + DIAG + NMEA  + MODEM
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      
      The detailed description of the USB configuration for each mode as follows:
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0312 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0312 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      40a8d565
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05CN (SG) modem · b3d80364
      Duke Xin(辛安文) authored
      commit 1541dd00
      
       upstream.
      
      The EM05CN (SG) modem has 2 USB configurations that are configurable via the AT
      command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with
      the following interfaces, respectively:
      
      "MBIM"  : AT + MBIM + DIAG + NMEA  + MODEM
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      
      The detailed description of the USB configuration for each mode as follows:
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0310 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0310 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      b3d80364
    • Ali Mirghasemi's avatar
      USB: serial: option: add Quectel EC200U modem · 74302819
      Ali Mirghasemi authored
      commit d9bbb158
      
       upstream.
      
      Add support for EC200U modem
      
      0x0901: EC200U - AT + AP + CP + NMEA + DIAG + MOS
      
      usb-device output:
      T: Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
      D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
      P: Vendor=2c7c ProdID=0901 Rev= 3.18
      S: Manufacturer=Android
      S: Product=Android
      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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=83(I) Atr=03(Int.) MxPS= 512 Ivl=4096ms
      I:* If#= 3 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=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=86(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=87(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=88(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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=89(I) Atr=03(Int.) MxPS= 512 Ivl=4096ms
      I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarAli Mirghasemi <ali.mirghasemi1376@gmail.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>
      74302819
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05-G (RS) modem · 3f6319c7
      Duke Xin(辛安文) authored
      commit b72d1397
      
       upstream.
      
      The EM05-G (RS) modem has 2 USB configurations that are configurable via
      the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate
      with the following interfaces, respectively:
      
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      "MBIM"  : MBIM + AT + DIAG + NMEA + Modem
      
      The detailed description of the USB configuration for each mode as follows:
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0314 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0314 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      3f6319c7
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05-G (CS) modem · 17a8936b
      Duke Xin(辛安文) authored
      commit bb78654b
      
       upstream.
      
      The EM05-G (CS) modem has 2 USB configurations that are configurable via
      the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate
      with the following interfaces, respectively:
      
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      "MBIM"  : MBIM + AT + DIAG + NMEA + Modem
      
      The detailed description of the USB configuration for each mode as follows:
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=030C Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=030C Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      17a8936b
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05-G (GR) modem · 8a3e5037
      Duke Xin(辛安文) authored
      commit 6c331f32
      
       upstream.
      
      The EM05-G (GR) modem has 2 USB configurations that are configurable via
      the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate
      with the following interfaces, respectively:
      
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      "MBIM"  : MBIM + AT + DIAG + NMEA + Modem
      
      The detailed description of the USB configuration for each mode as follows:
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0313 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0313 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 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#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      8a3e5037
    • Greg Kroah-Hartman's avatar
      prlimit: do_prlimit needs to have a speculation check · d3ee91e5
      Greg Kroah-Hartman authored
      commit 73979060
      
       upstream.
      
      do_prlimit() adds the user-controlled resource value to a pointer that
      will subsequently be dereferenced.  In order to help prevent this
      codepath from being used as a spectre "gadget" a barrier needs to be
      added after checking the range.
      
      Reported-by: default avatarJordy Zomer <jordyzomer@google.com>
      Tested-by: default avatarJordy Zomer <jordyzomer@google.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d3ee91e5
    • Mathias Nyman's avatar
      xhci: Add a flag to disable USB3 lpm on a xhci root port level. · 30f9ad9f
      Mathias Nyman authored
      commit 0522b9a1
      
       upstream.
      
      One USB3 roothub port may support link power management, while another
      root port on the same xHC can't due to different retimers used for
      the ports.
      
      This is the case with Intel Alder Lake, and possible future platforms
      where retimers used for USB4 ports cause too long exit latecy to
      enable native USB3 lpm U1 and U2 states.
      
      Add a flag in the xhci port structure to indicate if the port is
      lpm_incapable, and check it while calculating exit latency.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-6-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30f9ad9f
    • Mathias Nyman's avatar
      xhci: Fix null pointer dereference when host dies · 6fac4b5c
      Mathias Nyman authored
      commit a2bc47c4
      
       upstream.
      
      Make sure xhci_free_dev() and xhci_kill_endpoint_urbs() do not race
      and cause null pointer dereference when host suddenly dies.
      
      Usb core may call xhci_free_dev() which frees the xhci->devs[slot_id]
      virt device at the same time that xhci_kill_endpoint_urbs() tries to
      loop through all the device's endpoints, checking if there are any
      cancelled urbs left to give back.
      
      hold the xhci spinlock while freeing the virt device
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-4-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6fac4b5c
    • Jimmy Hu's avatar
      usb: xhci: Check endpoint is valid before dereferencing it · 2d2820d5
      Jimmy Hu authored
      commit e8fb5bc7 upstream.
      
      When the host controller is not responding, all URBs queued to all
      endpoints need to be killed. This can cause a kernel panic if we
      dereference an invalid endpoint.
      
      Fix this by using xhci_get_virt_ep() helper to find the endpoint and
      checking if the endpoint is valid before dereferencing it.
      
      [233311.853271] xhci-hcd xhci-hcd.1.auto: xHCI host controller not responding, assume dead
      [233311.853393] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000e8
      
      [233311.853964] pc : xhci_hc_died+0x10c/0x270
      [233311.853971] lr : xhci_hc_died+0x1ac/0x270
      
      [233311.854077] Call trace:
      [233311.854085]  xhci_hc_died+0x10c/0x270
      [233311.854093]  xhci_stop_endpoint_command_watchdog+0x100/0x1a4
      [233311.854105]  call_timer_fn+0x50/0x2d4
      [233311.854112]  expire_timers+0xac/0x2e4
      [233311.854118]  run_timer_softirq+0x300/0xabc
      [233311.854127]  __do_softirq+0x148/0x528
      [233311.854135]  irq_exit+0x194/0x1a8
      [233311.854143]  __handle_domain_irq+0x164/0x1d0
      [233311.854149]  gic_handle_irq.22273+0x10c/0x188
      [233311.854156]  el1_irq+0xfc/0x1a8
      [233311.854175]  lpm_cpuidle_enter+0x25c/0x418 [msm_pm]
      [233311.854185]  cpuidle_enter_state+0x1f0/0x764
      [233311.854194]  do_idle+0x594/0x6ac
      [233311.854201]  cpu_startup_entry+0x7c/0x80
      [233311.854209]  secondary_start_kernel+0x170/0x198
      
      Fixes: 50e8725e
      
       ("xhci: Refactor command watchdog and fix split string.")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJimmy Hu <hhhuuu@google.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Message-ID: <0fe978ed-8269-9774-1c40-f8a98c17e838@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-3-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d2820d5
    • Ricardo Ribalda's avatar
      xhci-pci: set the dma max_seg_size · 5b13ffee
      Ricardo Ribalda authored
      commit 93915a41
      
       upstream.
      
      Allow devices to have dma operations beyond 64K, and avoid warnings such
      as:
      
      xhci_hcd 0000:00:14.0: mapping sg segment longer than device claims to support [len=98304] [max=65536]
      
      Cc: stable@vger.kernel.org
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-2-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b13ffee
    • Ryusuke Konishi's avatar
      nilfs2: fix general protection fault in nilfs_btree_insert() · d9fde9ea
      Ryusuke Konishi authored
      commit 7633355e upstream.
      
      If nilfs2 reads a corrupted disk image and tries to reads a b-tree node
      block by calling __nilfs_btree_get_block() against an invalid virtual
      block address, it returns -ENOENT because conversion of the virtual block
      address to a disk block address fails.  However, this return value is the
      same as the internal code that b-tree lookup routines return to indicate
      that the block being searched does not exist, so functions that operate on
      that b-tree may misbehave.
      
      When nilfs_btree_insert() receives this spurious 'not found' code from
      nilfs_btree_do_lookup(), it misunderstands that the 'not found' check was
      successful and continues the insert operation using incomplete lookup path
      data, causing the following crash:
      
       general protection fault, probably for non-canonical address
       0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN
       KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
       ...
       RIP: 0010:nilfs_btree_get_nonroot_node fs/nilfs2/btree.c:418 [inline]
       RIP: 0010:nilfs_btree_prepare_insert fs/nilfs2/btree.c:1077 [inline]
       RIP: 0010:nilfs_btree_insert+0x6d3/0x1c10 fs/nilfs2/btree.c:1238
       Code: bc 24 80 00 00 00 4c 89 f8 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89
       ff e8 4b 02 92 fe 4d 8b 3f 49 83 c7 28 4c 89 f8 48 c1 e8 03 <42> 80 3c
       28 00 74 08 4c 89 ff e8 2e 02 92 fe 4d 8b 3f 49 83 c7 02
       ...
       Call Trace:
       <TASK>
        nilfs_bmap_do_insert fs/nilfs2/bmap.c:121 [inline]
        nilfs_bmap_insert+0x20d/0x360 fs/nilfs2/bmap.c:147
        nilfs_get_block+0x414/0x8d0 fs/nilfs2/inode.c:101
        __block_write_begin_int+0x54c/0x1a80 fs/buffer.c:1991
        __block_write_begin fs/buffer.c:2041 [inline]
        block_write_begin+0x93/0x1e0 fs/buffer.c:2102
        nilfs_write_begin+0x9c/0x110 fs/nilfs2/inode.c:261
        generic_perform_write+0x2e4/0x5e0 mm/filemap.c:3772
        __generic_file_write_iter+0x176/0x400 mm/filemap.c:3900
        generic_file_write_iter+0xab/0x310 mm/filemap.c:3932
        call_write_iter include/linux/fs.h:2186 [inline]
        new_sync_write fs/read_write.c:491 [inline]
        vfs_write+0x7dc/0xc50 fs/read_write.c:584
        ksys_write+0x177/0x2a0 fs/read_write.c:637
        do_syscall_x64 arch/x86/entry/common.c:50 [inline]
        do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
        entry_SYSCALL_64_after_hwframe+0x63/0xcd
       ...
       </TASK>
      
      This patch fixes the root cause of this problem by replacing the error
      code that __nilfs_btree_get_block() returns on block address conversion
      failure from -ENOENT to another internal code -EINVAL which means that the
      b-tree metadata is corrupted.
      
      By returning -EINVAL, it propagates without glitches, and for all relevant
      b-tree operations, functions in the upper bmap layer output an error
      message indicating corrupted b-tree metadata via
      nilfs_bmap_convert_error(), and code -EIO will be eventually returned as
      it should be.
      
      Link: https://lkml.kernel.org/r/000000000000bd89e205f0e38355@google.com
      Link: https://lkml.kernel.org/r/20230105055356.8811-1-konishi.ryusuke@gmail.com
      
      
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+ede796cecd5296353515@syzkaller.appspotmail.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9fde9ea
    • Shawn.Shao's avatar
      Add exception protection processing for vd in axi_chan_handle_err function · f534dc43
      Shawn.Shao authored
      commit 57054fe5
      
       upstream.
      
      Since there is no protection for vd, a kernel panic will be
      triggered here in exceptional cases.
      
      You can refer to the processing of axi_chan_block_xfer_complete function
      
      The triggered kernel panic is as follows:
      
      [   67.848444] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000060
      [   67.848447] Mem abort info:
      [   67.848449]   ESR = 0x96000004
      [   67.848451]   EC = 0x25: DABT (current EL), IL = 32 bits
      [   67.848454]   SET = 0, FnV = 0
      [   67.848456]   EA = 0, S1PTW = 0
      [   67.848458] Data abort info:
      [   67.848460]   ISV = 0, ISS = 0x00000004
      [   67.848462]   CM = 0, WnR = 0
      [   67.848465] user pgtable: 4k pages, 48-bit VAs, pgdp=00000800c4c0b000
      [   67.848468] [0000000000000060] pgd=0000000000000000, p4d=0000000000000000
      [   67.848472] Internal error: Oops: 96000004 [#1] SMP
      [   67.848475] Modules linked in: dmatest
      [   67.848479] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.10.100-emu_x2rc+ #11
      [   67.848483] pstate: 62000085 (nZCv daIf -PAN -UAO +TCO BTYPE=--)
      [   67.848487] pc : axi_chan_handle_err+0xc4/0x230
      [   67.848491] lr : axi_chan_handle_err+0x30/0x230
      [   67.848493] sp : ffff0803fe55ae50
      [   67.848495] x29: ffff0803fe55ae50 x28: ffff800011212200
      [   67.848500] x27: ffff0800c42c0080 x26: ffff0800c097c080
      [   67.848504] x25: ffff800010d33880 x24: ffff80001139d850
      [   67.848508] x23: ffff0800c097c168 x22: 0000000000000000
      [   67.848512] x21: 0000000000000080 x20: 0000000000002000
      [   67.848517] x19: ffff0800c097c080 x18: 0000000000000000
      [   67.848521] x17: 0000000000000000 x16: 0000000000000000
      [   67.848525] x15: 0000000000000000 x14: 0000000000000000
      [   67.848529] x13: 0000000000000000 x12: 0000000000000040
      [   67.848533] x11: ffff0800c0400248 x10: ffff0800c040024a
      [   67.848538] x9 : ffff800010576cd4 x8 : ffff0800c0400270
      [   67.848542] x7 : 0000000000000000 x6 : ffff0800c04003e0
      [   67.848546] x5 : ffff0800c0400248 x4 : ffff0800c4294480
      [   67.848550] x3 : dead000000000100 x2 : dead000000000122
      [   67.848555] x1 : 0000000000000100 x0 : ffff0800c097c168
      [   67.848559] Call trace:
      [   67.848562]  axi_chan_handle_err+0xc4/0x230
      [   67.848566]  dw_axi_dma_interrupt+0xf4/0x590
      [   67.848569]  __handle_irq_event_percpu+0x60/0x220
      [   67.848573]  handle_irq_event+0x64/0x120
      [   67.848576]  handle_fasteoi_irq+0xc4/0x220
      [   67.848580]  __handle_domain_irq+0x80/0xe0
      [   67.848583]  gic_handle_irq+0xc0/0x138
      [   67.848585]  el1_irq+0xc8/0x180
      [   67.848588]  arch_cpu_idle+0x14/0x2c
      [   67.848591]  default_idle_call+0x40/0x16c
      [   67.848594]  do_idle+0x1f0/0x250
      [   67.848597]  cpu_startup_entry+0x2c/0x60
      [   67.848600]  rest_init+0xc0/0xcc
      [   67.848603]  arch_call_rest_init+0x14/0x1c
      [   67.848606]  start_kernel+0x4cc/0x500
      [   67.848610] Code: eb0002ff 9a9f12d6 f2fbd5a2 f2fbd5a3 (a94602c1)
      [   67.848613] ---[ end trace 585a97036f88203a ]---
      
      Signed-off-by: default avatarShawn.Shao <shawn.shao@jaguarmicro.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230112055802.1764-1-shawn.shao@jaguarmicro.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f534dc43
    • Jaegeuk Kim's avatar
      f2fs: let's avoid panic if extent_tree is not created · ff85a1db
      Jaegeuk Kim authored
      [ Upstream commit df9d44b6
      
       ]
      
      This patch avoids the below panic.
      
      pc : __lookup_extent_tree+0xd8/0x760
      lr : f2fs_do_write_data_page+0x104/0x87c
      sp : ffffffc010cbb3c0
      x29: ffffffc010cbb3e0 x28: 0000000000000000
      x27: ffffff8803e7f020 x26: ffffff8803e7ed40
      x25: ffffff8803e7f020 x24: ffffffc010cbb460
      x23: ffffffc010cbb480 x22: 0000000000000000
      x21: 0000000000000000 x20: ffffffff22e90900
      x19: 0000000000000000 x18: ffffffc010c5d080
      x17: 0000000000000000 x16: 0000000000000020
      x15: ffffffdb1acdbb88 x14: ffffff888759e2b0
      x13: 0000000000000000 x12: ffffff802da49000
      x11: 000000000a001200 x10: ffffff8803e7ed40
      x9 : ffffff8023195800 x8 : ffffff802da49078
      x7 : 0000000000000001 x6 : 0000000000000000
      x5 : 0000000000000006 x4 : ffffffc010cbba28
      x3 : 0000000000000000 x2 : ffffffc010cbb480
      x1 : 0000000000000000 x0 : ffffff8803e7ed40
      Call trace:
       __lookup_extent_tree+0xd8/0x760
       f2fs_do_write_data_page+0x104/0x87c
       f2fs_write_single_data_page+0x420/0xb60
       f2fs_write_cache_pages+0x418/0xb1c
       __f2fs_write_data_pages+0x428/0x58c
       f2fs_write_data_pages+0x30/0x40
       do_writepages+0x88/0x190
       __writeback_single_inode+0x48/0x448
       writeback_sb_inodes+0x468/0x9e8
       __writeback_inodes_wb+0xb8/0x2a4
       wb_writeback+0x33c/0x740
       wb_do_writeback+0x2b4/0x400
       wb_workfn+0xe4/0x34c
       process_one_work+0x24c/0x5bc
       worker_thread+0x3e8/0xa50
       kthread+0x150/0x1b4
      
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ff85a1db
    • Jiri Slaby (SUSE)'s avatar
      RDMA/srp: Move large values to a new enum for gcc13 · 4f79b011
      Jiri Slaby (SUSE) authored
      [ Upstream commit 56c5dab2 ]
      
      Since gcc13, each member of an enum has the same type as the enum [1]. And
      that is inherited from its members. Provided these two:
        SRP_TAG_NO_REQ        = ~0U,
        SRP_TAG_TSK_MGMT	= 1U << 31
      all other members are unsigned ints.
      
      Esp. with SRP_MAX_SGE and SRP_TSK_MGMT_SQ_SIZE and their use in min(),
      this results in the following warnings:
        include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast
        drivers/infiniband/ulp/srp/ib_srp.c:563:42: note: in expansion of macro 'min'
      
        include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast
        drivers/infiniband/ulp/srp/ib_srp.c:2369:27: note: in expansion of macro 'min'
      
      So move the large values away to a separate enum, so that they don't
      affect other members.
      
      [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113
      
      Link: https://lore.kernel.org/r/20221212120411.13750-1-jirislaby@kernel.org
      
      
      Signed-off-by: default avatarJiri Slaby (SUSE) <jirislaby@kernel.org>
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4f79b011
    • Daniil Tatianin's avatar
      net/ethtool/ioctl: return -EOPNOTSUPP if we have no phy stats · 2cf8dd47
      Daniil Tatianin authored
      [ Upstream commit 9deb1e9f
      
       ]
      
      It's not very useful to copy back an empty ethtool_stats struct and
      return 0 if we didn't actually have any stats. This also allows for
      further simplification of this function in the future commits.
      
      Signed-off-by: default avatarDaniil Tatianin <d-tatianin@yandex-team.ru>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2cf8dd47
    • Olga Kornievskaia's avatar
      pNFS/filelayout: Fix coalescing test for single DS · d22031d0
      Olga Kornievskaia authored
      [ Upstream commit a6b9d2fa
      
       ]
      
      When there is a single DS no striping constraints need to be placed on
      the IO. When such constraint is applied then buffered reads don't
      coalesce to the DS's rsize.
      
      Signed-off-by: default avatarOlga Kornievskaia <kolga@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d22031d0
  2. Jan 18, 2023