Skip to content
  1. Jan 01, 2024
    • Christoffer Sandberg's avatar
      Input: soc_button_array - add mapping for airplane mode button · 4c775b4c
      Christoffer Sandberg authored
      commit ea371594
      
       upstream.
      
      This add a mapping for the airplane mode button on the TUXEDO Pulse Gen3.
      
      While it is physically a key it behaves more like a switch, sending a key
      down on first press and a key up on 2nd press. Therefor the switch event
      is used here. Besides this behaviour it uses the HID usage-id 0xc6
      (Wireless Radio Button) and not 0xc8 (Wireless Radio Slider Switch), but
      since neither 0xc6 nor 0xc8 are currently implemented at all in
      soc_button_array this not to standard behaviour is not put behind a quirk
      for the moment.
      
      Signed-off-by: default avatarChristoffer Sandberg <cs@tuxedo.de>
      Signed-off-by: default avatarWerner Sembach <wse@tuxedocomputers.com>
      Link: https://lore.kernel.org/r/20231215171718.80229-1-wse@tuxedocomputers.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c775b4c
    • Jose Ignacio Tornos Martinez's avatar
      net: usb: ax88179_178a: avoid failed operations when device is disconnected · 5df2b49e
      Jose Ignacio Tornos Martinez authored
      commit aef05e34 upstream.
      
      When the device is disconnected we get the following messages showing
      failed operations:
      Nov 28 20:22:11 localhost kernel: usb 2-3: USB disconnect, device number 2
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: unregister 'ax88179_178a' usb-0000:02:00.0-3, ASIX AX88179 USB 3.0 Gigabit Ethernet
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: Failed to read reg index 0x0002: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: Failed to write reg index 0x0002: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0002: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0001: -19
      Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0002: -19
      
      The reason is that although the device is detached, normal stop and
      unbind operations are commanded from the driver. These operations are
      not necessary in this situation, so avoid these logs when the device is
      detached if the result of the operation is -ENODEV and if the new flag
      informing about the disconnecting status is enabled.
      
      cc:  <stable@vger.kernel.org>
      Fixes: e2ca90c2
      
       ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
      Signed-off-by: default avatarJose Ignacio Tornos Martinez <jtornosm@redhat.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20231207175007.263907-1-jtornosm@redhat.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5df2b49e
    • Alex Lu's avatar
      Bluetooth: Add more enc key size check · 0f7bffd4
      Alex Lu authored
      commit 04a342cc
      
       upstream.
      
      When we are slave role and receives l2cap conn req when encryption has
      started, we should check the enc key size to avoid KNOB attack or BLUFFS
      attack.
      From SIG recommendation, implementations are advised to reject
      service-level connections on an encrypted baseband link with key
      strengths below 7 octets.
      A simple and clear way to achieve this is to place the enc key size
      check in hci_cc_read_enc_key_size()
      
      The btmon log below shows the case that lacks enc key size check.
      
      > HCI Event: Connect Request (0x04) plen 10
              Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Class: 0x480104
                Major class: Computer (desktop, notebook, PDA, organizers)
                Minor class: Desktop workstation
                Capturing (Scanner, Microphone)
                Telephony (Cordless telephony, Modem, Headset)
              Link type: ACL (0x01)
      < HCI Command: Accept Connection Request (0x01|0x0009) plen 7
              Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Role: Peripheral (0x01)
      > HCI Event: Command Status (0x0f) plen 4
            Accept Connection Request (0x01|0x0009) ncmd 2
              Status: Success (0x00)
      > HCI Event: Connect Complete (0x03) plen 11
              Status: Success (0x00)
              Handle: 1
              Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Link type: ACL (0x01)
              Encryption: Disabled (0x00)
      ...
      
      > HCI Event: Encryption Change (0x08) plen 4
              Status: Success (0x00)
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Encryption: Enabled with E0 (0x01)
      < HCI Command: Read Encryption Key Size (0x05|0x0008) plen 2
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
      > HCI Event: Command Complete (0x0e) plen 7
            Read Encryption Key Size (0x05|0x0008) ncmd 2
              Status: Success (0x00)
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Key size: 6
      // We should check the enc key size
      ...
      
      > ACL Data RX: Handle 1 flags 0x02 dlen 12
            L2CAP: Connection Request (0x02) ident 3 len 4
              PSM: 25 (0x0019)
              Source CID: 64
      < ACL Data TX: Handle 1 flags 0x00 dlen 16
            L2CAP: Connection Response (0x03) ident 3 len 8
              Destination CID: 64
              Source CID: 64
              Result: Connection pending (0x0001)
              Status: Authorization pending (0x0002)
      > HCI Event: Number of Completed Packets (0x13) plen 5
              Num handles: 1
              Handle: 1 Address: BB:22:33:44:55:99 (OUI BB-22-33)
              Count: 1
              #35: len 16 (25 Kb/s)
              Latency: 5 msec (2-7 msec ~4 msec)
      < ACL Data TX: Handle 1 flags 0x00 dlen 16
            L2CAP: Connection Response (0x03) ident 3 len 8
              Destination CID: 64
              Source CID: 64
              Result: Connection successful (0x0000)
              Status: No further information available (0x0000)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlex Lu <alex_lu@realsil.com.cn>
      Signed-off-by: default avatarMax Chou <max.chou@realtek.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f7bffd4
    • Xiao Yao's avatar
      Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE · 39347d64
      Xiao Yao authored
      commit 59b047bc
      
       upstream.
      
      If two Bluetooth devices both support BR/EDR and BLE, and also
      support Secure Connections, then they only need to pair once.
      The LTK generated during the LE pairing process may be converted
      into a BR/EDR link key for BR/EDR transport, and conversely, a
      link key generated during the BR/EDR SSP pairing process can be
      converted into an LTK for LE transport. Hence, the link type of
      the link key and LTK is not fixed, they can be either an LE LINK
      or an ACL LINK.
      
      Currently, in the mgmt_new_irk/ltk/crsk/link_key functions, the
      link type is fixed, which could lead to incorrect address types
      being reported to the application layer. Therefore, it is necessary
      to add link_type/addr_type to the smp_irk/ltk/crsk and link_key,
      to ensure the generation of the correct address type.
      
      SMP over BREDR:
      Before Fix:
      > ACL Data RX: Handle 11 flags 0x02 dlen 12
              BR/EDR SMP: Identity Address Information (0x09) len 7
              Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 00:00:00:00:00:00 (Non-Resolvable)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      
      After Fix:
      > ACL Data RX: Handle 11 flags 0x02 dlen 12
            BR/EDR SMP: Identity Address Information (0x09) len 7
              Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 00:00:00:00:00:00 (Non-Resolvable)
              BR/EDR Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              BR/EDR Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      
      SMP over LE:
      Before Fix:
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 5F:5C:07:37:47:D5 (Resolvable)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      @ MGMT Event: New Link Key (0x0009) plen 26
              BR/EDR Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated Combination key from P-256 (0x08)
      
      After Fix:
      @ MGMT Event: New Identity Resolving Key (0x0018) plen 30
              Random address: 5E:03:1C:00:38:21 (Resolvable)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
      @ MGMT Event: New Long Term Key (0x000a) plen 37
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated key from P-256 (0x03)
      @ MGMT Event: New Link Key (0x0009) plen 26
              Store hint: Yes (0x01)
              LE Address: F8:7D:76:F2:12:F3 (OUI F8-7D-76)
              Key type: Authenticated Combination key from P-256 (0x08)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarXiao Yao <xiaoyao@rock-chips.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39347d64
    • Frédéric Danis's avatar
      Bluetooth: L2CAP: Send reject on command corrupted request · e14a7eba
      Frédéric Danis authored
      commit 78b99eb1
      
       upstream.
      
      L2CAP/COS/CED/BI-02-C PTS test send a malformed L2CAP signaling packet
      with 2 commands in it (a connection request and an unknown command) and
      expect to get a connection response packet and a command reject packet.
      The second is currently not sent.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFrédéric Danis <frederic.danis@collabora.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e14a7eba
    • Hyunwoo Kim's avatar
      Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg · 37f71e2c
      Hyunwoo Kim authored
      commit 2e07e834 upstream.
      
      This can cause a race with bt_sock_ioctl() because
      bt_sock_recvmsg() gets the skb from sk->sk_receive_queue
      and then frees it without holding lock_sock.
      A use-after-free for a skb occurs with the following flow.
      ```
      bt_sock_recvmsg() -> skb_recv_datagram() -> skb_free_datagram()
      bt_sock_ioctl() -> skb_peek()
      ```
      Add lock_sock to bt_sock_recvmsg() to fix this issue.
      
      Cc: stable@vger.kernel.org
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarHyunwoo Kim <v4bel@theori.io>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37f71e2c
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent · 470896ec
      Luiz Augusto von Dentz authored
      commit 99e67d46
      
       upstream.
      
      Before setting HCI_INQUIRY bit check if HCI_OP_INQUIRY was really sent
      otherwise the controller maybe be generating invalid events or, more
      likely, it is a result of fuzzing tools attempting to test the right
      behavior of the stack when unexpected events are generated.
      
      Cc: stable@vger.kernel.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=218151
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      470896ec
    • Clément Villeret's avatar
      ALSA: hda/realtek: Add quirk for ASUS ROG GV302XA · d36d945f
      Clément Villeret authored
      commit 02a460ad
      
       upstream.
      
      Asus ROG Flowx13 (GV302XA) seems require same patch as others asus products
      
      Signed-off-by: default avatarClément Villeret <clement.villeret@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/0a27bf4b-3056-49ac-9651-ebd7f3e36328@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d36d945f
    • Reinhard Speyerer's avatar
      USB: serial: option: add Quectel RM500Q R13 firmware support · 9599a5e3
      Reinhard Speyerer authored
      commit 06f22cd6
      
       upstream.
      
      Add support for Quectel RM500Q R13 firmware which uses Prot=40 for the
      NMEA port:
      
      T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  8 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0800 Rev= 4.14
      S:  Manufacturer=Quectel
      S:  Product=RM500Q-AE
      S:  SerialNumber=xxxxxxxx
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 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=1024 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 3 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=1024 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      Signed-off-by: default avatarReinhard Speyerer <rspmn@arcor.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9599a5e3
    • Slark Xiao's avatar
      USB: serial: option: add Foxconn T99W265 with new baseline · a91fb450
      Slark Xiao authored
      commit 13fde9ac
      
       upstream.
      
      This ID was added based on latest SDX12 code base line, and we
      made some changes with previous 0489:e0db.
      
      Test evidence as below:
      T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  2
      P:  Vendor=0489 ProdID=e0da Rev=05.04
      S:  Manufacturer=Qualcomm
      S:  Product=Qualcomm Snapdragon X12
      S:  SerialNumber=2bda65fb
      C:  #Ifs= 6 Cfg#= 2 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      I:  If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      
      0&1: MBIM, 2: Modem, 3:GNSS, 4:Diag, 5:ADB
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@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>
      a91fb450
    • Alper Ak's avatar
      USB: serial: option: add Quectel EG912Y module support · 73b6b6ab
      Alper Ak authored
      commit 6d79d943
      
       upstream.
      
      Add Quectel EG912Y "DIAG, AT, MODEM"
      
      0x6001: ECM / RNDIS + DIAG + AT + MODEM
      
      T:  Bus=01 Lev=02 Prnt=02 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=6001 Rev= 3.18
      S:  Manufacturer=Android
      S:  Product=Android
      S:  SerialNumber=0000
      C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
      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=87(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
      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=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0c(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=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(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=88(I) Atr=03(Int.) MxPS=  64 Ivl=4096ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarAlper Ak <alperyasinak1@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>
      73b6b6ab
    • Mark Glover's avatar
      USB: serial: ftdi_sio: update Actisense PIDs constant names · 9b968a70
      Mark Glover authored
      commit 513d88a8
      
       upstream.
      
      Update the constant names for unused USB PIDs (product identifiers) to
      reflect the new products now using the PIDs.
      
      Signed-off-by: default avatarMark Glover <mark.glover@actisense.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>
      9b968a70
    • Johannes Berg's avatar
      wifi: cfg80211: fix certs build to not depend on file order · db57ef0d
      Johannes Berg authored
      commit 3c2a8ebe
      
       upstream.
      
      The file for the new certificate (Chen-Yu Tsai's) didn't
      end with a comma, so depending on the file order in the
      build rule, we'd end up with invalid C when concatenating
      the (now two) certificates. Fix that.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
      Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Fixes: fb768d3b
      
       ("wifi: cfg80211: Add my certificate")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db57ef0d
    • Chen-Yu Tsai's avatar
      wifi: cfg80211: Add my certificate · ec350809
      Chen-Yu Tsai authored
      commit fb768d3b
      
       upstream.
      
      As announced [1][2], I have taken over maintainership of the
      wireless-regdb project.
      
      Add my certificate so that newer releases are valid to the kernel.
      Seth's certificate should be kept around for awhile, at least until
      a few new releases by me happen.
      
      This should also be applied to stable trees so that stable kernels
      can utilize newly released database binaries.
      
      [1] https://lore.kernel.org/linux-wireless/CAGb2v657baNMPKU3QADijx7hZa=GUcSv2LEDdn6N=QQaFX8r-g@mail.gmail.com/
      [2] https://lore.kernel.org/linux-wireless/ZWmRR5ul7EDfxCan@wens.tw/
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarChen-Yu Tsai <wens@kernel.org>
      Acked-by: default avatarSeth Forshee <sforshee@kernel.org>
      Link: https://msgid.link/ZXHGsqs34qZyzZng@wens.tw
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec350809
    • Tasos Sahanidis's avatar
      usb-storage: Add quirk for incorrect WP on Kingston DT Ultimate 3.0 G3 · 228d9960
      Tasos Sahanidis authored
      commit 772685c1 upstream.
      
      This flash drive reports write protect during the first mode sense.
      
      In the past this was not an issue as the kernel called revalidate twice,
      thus asking the device for its write protect status twice, with write
      protect being disabled in the second mode sense.
      
      However, since commit 1e029397 ("scsi: sd: Reorganize DIF/DIX code to
      avoid calling revalidate twice") that is no longer the case, thus the
      device shows up read only.
      
      [490891.289495] sd 12:0:0:0: [sdl] Write Protect is on
      [490891.289497] sd 12:0:0:0: [sdl] Mode Sense: 2b 00 80 08
      
      This does not appear to be a timing issue, as enabling the usbcore quirk
      USB_QUIRK_DELAY_INIT has no effect on write protect.
      
      Fixes: 1e029397
      
       ("scsi: sd: Reorganize DIF/DIX code to avoid calling revalidate twice")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Link: https://lore.kernel.org/r/20231207134441.298131-1-tasos@tasossah.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      228d9960
    • Jeremie Knuesel's avatar
      ALSA: usb-audio: Increase delay in MOTU M quirk · 82f91372
      Jeremie Knuesel authored
      commit 48d6b917
      
       upstream.
      
      Increase the quirk delay from 2 seconds to 4 seconds. This reflects a
      change in the Windows driver in which the delay was increased to about
      3.7 seconds. The larger delay fixes an issue where the device fails to
      work unless it was powered up early during boot.
      
      Also clarify in the quirk comment that the quirk is only applied to
      older devices (USB ID 07fd:0008).
      
      Signed-off-by: default avatarJeremie Knuesel <knuesel@gmail.com>
      Suggested-by: default avatarAlexander Tsoy <alexander@tsoy.me>
      Cc: <stable@vger.kernel.org>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=211975
      Link: https://lore.kernel.org/r/20231217112243.33409-1-knuesel@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82f91372
    • David Lechner's avatar
      iio: triggered-buffer: prevent possible freeing of wrong buffer · 01bc94b5
      David Lechner authored
      commit bce61476 upstream.
      
      Commit ee708e6b ("iio: buffer: introduce support for attaching more
      IIO buffers") introduced support for multiple buffers per indio_dev but
      left indio_dev->buffer for a few legacy use cases.
      
      In the case of the triggered buffer, iio_triggered_buffer_cleanup()
      still assumes that indio_dev->buffer points to the buffer allocated by
      iio_triggered_buffer_setup_ext(). However, since
      iio_triggered_buffer_setup_ext() now calls iio_device_attach_buffer()
      to attach the buffer, indio_dev->buffer will only point to the buffer
      allocated by iio_device_attach_buffer() if it the first buffer attached.
      
      This adds a check to make sure that no other buffer has been attached
      yet to ensure that indio_dev->buffer will be assigned when
      iio_device_attach_buffer() is called.
      
      As per discussion in the review thread, we may want to deal with multiple
      triggers per device, but this is a fix for the issue in the meantime and
      any such support would be unlikely to be suitable for a backport.
      
      Fixes: ee708e6b
      
       ("iio: buffer: introduce support for attaching more IIO buffers")
      Signed-off-by: default avatarDavid Lechner <dlechner@baylibre.com>
      Acked-by: default avatarNuno Sa <nuno.sa@analog.com>
      Link: https://lore.kernel.org/r/20231031210521.1661552-1-dlechner@baylibre.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01bc94b5
    • Wadim Egorov's avatar
      iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() · c508a99f
      Wadim Egorov authored
      commit 60576e84 upstream.
      
      Fix wrong handling of a DMA request where the probing only failed
      if -EPROPE_DEFER was returned. Instead, let us fail if a non -ENODEV
      value is returned. This makes DMAs explicitly optional. Even if the
      DMA request is unsuccessfully, the ADC can still work properly.
      We do also handle the defer probe case by making use of dev_err_probe().
      
      Fixes: f438b9da
      
       ("drivers: iio: ti_am335x_adc: add dma support")
      Signed-off-by: default avatarWadim Egorov <w.egorov@phytec.de>
      Reviewed-by: default avatarBhavya Kapoor <b-kapoor@ti.com>
      Link: https://lore.kernel.org/r/20230925134427.214556-1-w.egorov@phytec.de
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c508a99f
    • Javier Carrasco's avatar
      iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table · 1b670b0e
      Javier Carrasco authored
      commit 54cf39ec upstream.
      
      The HTU21 offers 4 sampling frequencies: 20, 40, 70 and 120, which are
      associated to an index that is used to select the right measurement
      resolution and its corresponding measurement time. The current
      implementation selects the measurement resolution and the temperature
      measurement time properly, but it does not select the right humidity
      measurement time in all cases.
      
      In summary, the 40 and 70 humidity measurement times are swapped.
      
      The reason for that is probably the unusual coding for the measurement
      resolution. According to the datasheet, the bits [7,0] of the "user
      register" are used as follows to select the bit resolution:
      
      --------------------------------------------------
      | Bit 7 | Bit 0 | RH | Temp | Trh (us) | Tt (us) |
      --------------------------------------------------
      |   0   |   0   | 12 |  14  |  16000   |  50000  |
      --------------------------------------------------
      |   0   |   1   | 8  |  12  |  3000    |  13000  |
      --------------------------------------------------
      |   1   |   0   | 10 |  13  |  5000    |  25000  |
      --------------------------------------------------
      |   1   |   1   | 11 |  11  |  8000    |  7000   |
      --------------------------------------------------
      *This table is available in the official datasheet, page 13/21. I have
      just appended the times provided in the humidity/temperature tables,
      pages 3/21, 5/21. Note that always a pair of resolutions is selected.
      
      The sampling frequencies [20, 40, 70, 120] are assigned to a linear
      index [0..3] which is then coded as follows [1]:
      
      Index    [7,0]
      --------------
      idx 0     0,0
      idx 1     1,0
      idx 2     0,1
      idx 3     1,1
      
      That is done that way because the temperature measurements are being
      used as the reference for the sampling frequency (the frequencies and
      the temperature measurement times are correlated), so increasing the
      index always reduces the temperature measurement time and its
      resolution. Therefore, the temperature measurement time array is as
      simple as [50000, 25000, 13000, 7000]
      
      On the other hand, the humidity resolution cannot follow the same
      pattern because of the way it is coded in the "user register", where
      both resolutions are selected at the same time. The humidity measurement
      time array is the following: [16000, 3000, 5000, 8000], which defines
      the following assignments:
      
      Index    [7,0]    Trh
      -----------------------
      idx 0     0,0     16000  -> right, [0,0] selects 12 bits (Trh = 16000)
      idx 1     1,0     3000   -> wrong! [1,0] selects 10 bits (Trh = 5000)
      idx 2     0,1     5000   -> wrong! [0,1] selects 8 bits (Trh = 3000)
      idx 3     1,1     8000   -> right, [1,1] selects 11 bits (Trh = 8000)
      
      The times have been ordered as if idx = 1 -> [0,1] and idx = 2 -> [1,0],
      which is not the case for the reason explained above.
      
      So a simple modification is required to obtain the right humidity
      measurement time array, swapping the values in the positions 1 and 2.
      
      The right table should be the following: [16000, 5000, 3000, 8000]
      
      Fix the humidity measurement time array with the right idex/value
      coding.
      
      [1] The actual code that makes this coding and assigns it to the current
      value of the "user register" is the following:
      config_reg &= 0x7E;
      config_reg |= ((i & 1) << 7) + ((i & 2) >> 1);
      
      Fixes: d574a87c
      
       ("Add meas-spec sensors common part")
      Signed-off-by: default avatarJavier Carrasco <javier.carrasco.cruz@gmail.com>
      Link: https://lore.kernel.org/r/20231026-topic-htu21_conversion_time-v1-1-bd257dc44209@gmail.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b670b0e
    • Wei Yongjun's avatar
      scsi: bnx2fc: Fix skb double free in bnx2fc_rcv() · 1fe4c93f
      Wei Yongjun authored
      [ Upstream commit 08c94d80 ]
      
      skb_share_check() already drops the reference to the skb when returning
      NULL. Using kfree_skb() in the error handling path leads to an skb double
      free.
      
      Fix this by removing the variable tmp_skb, and return directly when
      skb_share_check() returns NULL.
      
      Fixes: 01a4cc4d
      
       ("bnx2fc: do not add shared skbs to the fcoe_rx_list")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Link: https://lore.kernel.org/r/20221114110626.526643-1-weiyongjun@huaweicloud.com
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1fe4c93f
    • Haoran Liu's avatar
      Input: ipaq-micro-keys - add error handling for devm_kmemdup · 66ccf5f7
      Haoran Liu authored
      [ Upstream commit 59b6a747
      
       ]
      
      Check the return value of i2c_add_adapter. Static analysis revealed that
      the function did not properly handle potential failures of
      i2c_add_adapter, which could lead to partial initialization of the I2C
      adapter and unstable operation.
      
      Signed-off-by: default avatarHaoran Liu <liuhaoran14@163.com>
      Link: https://lore.kernel.org/r/20231203164653.38983-1-liuhaoran14@163.com
      Fixes: d7535ffa
      
       ("Input: driver for microcontroller keys on the iPaq h3xxx")
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      66ccf5f7
    • Konrad Dybcio's avatar
      interconnect: qcom: sm8250: Enable sync_state · 3637f6bd
      Konrad Dybcio authored
      [ Upstream commit bfc7db1c ]
      
      Add the generic icc sync_state callback to ensure interconnect votes
      are taken into account, instead of being pegged at maximum values.
      
      Fixes: b95b668e
      
       ("interconnect: qcom: icc-rpmh: Add BCMs to commit list in pre_aggregate")
      Signed-off-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Link: https://lore.kernel.org/r/20231130-topic-8250icc_syncstate-v1-1-7ce78ba6e04c@linaro.org
      Signed-off-by: default avatarGeorgi Djakov <djakov@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3637f6bd
    • Su Hui's avatar
      iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw · 90aa6272
      Su Hui authored
      [ Upstream commit c3df0e29 ]
      
      inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
      true value rather than only return IIO_VAL_INT.
      
      Fixes: d5098447
      
       ("iio: imu: mpu6050: add calibration offset support")
      Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
      Link: https://lore.kernel.org/r/20231030020218.65728-1-suhui@nfschina.com
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      90aa6272
    • Mike Tipton's avatar
      interconnect: Treat xlate() returning NULL node as an error · 50d60bfc
      Mike Tipton authored
      [ Upstream commit ad2ab129 ]
      
      Currently, if provider->xlate() or provider->xlate_extended()
      "successfully" return a NULL node, then of_icc_get_from_provider() won't
      consider that an error and will successfully return the NULL node. This
      bypasses error handling in of_icc_get_by_index() and leads to NULL
      dereferences in path_find().
      
      This could be avoided by ensuring provider callbacks always return an
      error for NULL nodes, but it's better to explicitly protect against this
      in the common framework.
      
      Fixes: 87e3031b
      
       ("interconnect: Allow endpoints translation via DT")
      Signed-off-by: default avatarMike Tipton <quic_mdtipton@quicinc.com>
      Link: https://lore.kernel.org/r/20231025145829.11603-1-quic_mdtipton@quicinc.com
      Signed-off-by: default avatarGeorgi Djakov <djakov@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      50d60bfc
    • Ville Syrjälä's avatar
      drm/i915: Fix ADL+ tiled plane stride when the POT stride is smaller than the original · 900c1b3c
      Ville Syrjälä authored
      [ Upstream commit 324b70e9
      
       ]
      
      plane_view_scanout_stride() currently assumes that we had to pad the
      mapping stride with dummy pages in order to align it. But that is not
      the case if the original fb stride exceeds the aligned stride used
      to populate the remapped view, which is calculated from the user
      specified framebuffer width rather than the user specified framebuffer
      stride.
      
      Ignore the original fb stride in this case and just stick to the POT
      aligned stride. Getting this wrong will cause the plane to fetch the
      wrong data, and can lead to fault errors if the page tables at the
      bogus location aren't even populated.
      
      TODO: figure out if this is OK for CCS, or if we should instead increase
      the width of the view to cover the entire user specified fb stride
      instead...
      
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20231204202443.31247-1-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      (cherry picked from commit 01a39f1c
      
      )
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      900c1b3c
    • Clint Taylor's avatar
      drm/i915/mtl: Add MTL for remapping CCS FBs · de4349bd
      Clint Taylor authored
      [ Upstream commit 0da6bfe8
      
       ]
      
      Add support for remapping CCS FBs on MTL to remove the restriction
      of the power-of-two sized stride and the 2MB surface offset alignment
      for these FBs.
      
      Signed-off-by: default avatarClint Taylor <clinton.a.taylor@intel.com>
      Signed-off-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      Reviewed-by: default avatarRadhakrishna Sripada <radhakrishna.sripada@intel.com>
      Signed-off-by: default avatarNirmoy Das <nirmoy.das@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230505144005.23480-2-nirmoy.das@intel.com
      Stable-dep-of: 324b70e9
      
       ("drm/i915: Fix ADL+ tiled plane stride when the POT stride is smaller than the original")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      de4349bd
    • Ville Syrjälä's avatar
      drm/i915/dpt: Only do the POT stride remap when using DPT · 52c1a67d
      Ville Syrjälä authored
      [ Upstream commit ef5cb493
      
       ]
      
      If we want to test with DPT disabled on ADL the POT stride remap
      stuff needs to be disabled. Make it depend on actual DPT usage
      instead of just assuming it based on the modifier.
      
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230320090522.9909-3-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
      Stable-dep-of: 324b70e9
      
       ("drm/i915: Fix ADL+ tiled plane stride when the POT stride is smaller than the original")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      52c1a67d
    • Ville Syrjälä's avatar
      drm/i915: Fix intel_atomic_setup_scalers() plane_state handling · 7afe8109
      Ville Syrjälä authored
      [ Upstream commit c3070f08
      
       ]
      
      Since the plane_state variable is declared outside the scaler_users
      loop in intel_atomic_setup_scalers(), and it's never reset back to
      NULL inside the loop we may end up calling intel_atomic_setup_scaler()
      with a non-NULL plane state for the pipe scaling case. That is bad
      because intel_atomic_setup_scaler() determines whether we are doing
      plane scaling or pipe scaling based on plane_state!=NULL. The end
      result is that we may miscalculate the scaler mode for pipe scaling.
      
      The hardware becomes somewhat upset if we end up in this situation
      when scanning out a planar format on a SDR plane. We end up
      programming the pipe scaler into planar mode as well, and the
      result is a screenfull of garbage.
      
      Fix the situation by making sure we pass the correct plane_state==NULL
      when calculating the scaler mode for pipe scaling.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20231207193441.20206-2-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      (cherry picked from commit e8114410
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7afe8109
    • Ville Syrjälä's avatar
      drm/i915: Relocate intel_atomic_setup_scalers() · b097184f
      Ville Syrjälä authored
      [ Upstream commit 8976b182
      
       ]
      
      Move intel_atomic_setup_scalers() next to the other scaler
      code in skl_scaler.c.
      
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230418175528.13117-4-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Stable-dep-of: c3070f08
      
       ("drm/i915: Fix intel_atomic_setup_scalers() plane_state handling")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b097184f
    • Luca Coelho's avatar
      drm/i915/mtl: limit second scaler vertical scaling in ver >= 14 · 99767368
      Luca Coelho authored
      [ Upstream commit 8d4312e2
      
       ]
      
      In newer hardware versions (i.e. display version >= 14), the second
      scaler doesn't support vertical scaling.
      
      The current implementation of the scaling limits is simplified and
      only occurs when the planes are created, so we don't know which scaler
      is being used.
      
      In order to handle separate scaling limits for horizontal and vertical
      scaling, and different limits per scaler, split the checks in two
      phases.  We first do a simple check during plane creation and use the
      best-case scenario (because we don't know the scaler that may be used
      at a later point) and then do a more specific check when the scalers
      are actually being set up.
      
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Reviewed-by: default avatarStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
      Signed-off-by: default avatarRadhakrishna Sripada <radhakrishna.sripada@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221223130509.43245-2-luciano.coelho@intel.com
      Stable-dep-of: c3070f08
      
       ("drm/i915: Fix intel_atomic_setup_scalers() plane_state handling")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      99767368
    • Maurizio Lombardi's avatar
      nvme-pci: fix sleeping function called from interrupt context · 387e8077
      Maurizio Lombardi authored
      [ Upstream commit f6fe0b2d ]
      
      the nvme_handle_cqe() interrupt handler calls nvme_complete_async_event()
      but the latter may call nvme_auth_stop() which is a blocking function.
      Sleeping functions can't be called in interrupt context
      
       BUG: sleeping function called from invalid context
       in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/15
        Call Trace:
           <IRQ>
            __cancel_work_timer+0x31e/0x460
            ? nvme_change_ctrl_state+0xcf/0x3c0 [nvme_core]
            ? nvme_change_ctrl_state+0xcf/0x3c0 [nvme_core]
            nvme_complete_async_event+0x365/0x480 [nvme_core]
            nvme_poll_cq+0x262/0xe50 [nvme]
      
      Fix the bug by moving nvme_auth_stop() to fw_act_work
      (executed by the nvme_wq workqueue)
      
      Fixes: f50fff73
      
       ("nvme: implement In-Band authentication")
      Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
      Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      387e8077
    • Kent Gibson's avatar
      gpiolib: cdev: add gpio_device locking wrapper around gpio_ioctl() · b506833e
      Kent Gibson authored
      [ Upstream commit 1d656bd2 ]
      
      While the GPIO cdev gpio_ioctl() call is in progress, the kernel can
      call gpiochip_remove() which will set gdev->chip to NULL, after which
      any subsequent access will cause a crash.
      
      gpio_ioctl() was overlooked by the previous fix to protect syscalls
      (bdbbae24), so add protection for that.
      
      Fixes: bdbbae24 ("gpiolib: protect the GPIO device against being dropped while in use by user-space")
      Fixes: d7c51b47 ("gpio: userspace ABI for reading/writing GPIO lines")
      Fixes: 3c0d9c63 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
      Fixes: aad95584
      
       ("gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL")
      Signed-off-by: default avatarKent Gibson <warthog618@gmail.com>
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b506833e
    • Alexis Lothoré's avatar
      pinctrl: at91-pio4: use dedicated lock class for IRQ · 6eb51df9
      Alexis Lothoré authored
      [ Upstream commit 14694179 ]
      
      Trying to suspend to RAM on SAMA5D27 EVK leads to the following lockdep
      warning:
      
       ============================================
       WARNING: possible recursive locking detected
       6.7.0-rc5-wt+ #532 Not tainted
       --------------------------------------------
       sh/92 is trying to acquire lock:
       c3cf306c (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0xe8/0x100
      
       but task is already holding lock:
       c3d7c46c (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0xe8/0x100
      
       other info that might help us debug this:
        Possible unsafe locking scenario:
      
              CPU0
              ----
         lock(&irq_desc_lock_class);
         lock(&irq_desc_lock_class);
      
        *** DEADLOCK ***
      
        May be due to missing lock nesting notation
      
       6 locks held by sh/92:
        #0: c3aa0258 (sb_writers#6){.+.+}-{0:0}, at: ksys_write+0xd8/0x178
        #1: c4c2df44 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x138/0x284
        #2: c32684a0 (kn->active){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x148/0x284
        #3: c232b6d4 (system_transition_mutex){+.+.}-{3:3}, at: pm_suspend+0x13c/0x4e8
        #4: c387b088 (&dev->mutex){....}-{3:3}, at: __device_suspend+0x1e8/0x91c
        #5: c3d7c46c (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0xe8/0x100
      
       stack backtrace:
       CPU: 0 PID: 92 Comm: sh Not tainted 6.7.0-rc5-wt+ #532
       Hardware name: Atmel SAMA5
        unwind_backtrace from show_stack+0x18/0x1c
        show_stack from dump_stack_lvl+0x34/0x48
        dump_stack_lvl from __lock_acquire+0x19ec/0x3a0c
        __lock_acquire from lock_acquire.part.0+0x124/0x2d0
        lock_acquire.part.0 from _raw_spin_lock_irqsave+0x5c/0x78
        _raw_spin_lock_irqsave from __irq_get_desc_lock+0xe8/0x100
        __irq_get_desc_lock from irq_set_irq_wake+0xa8/0x204
        irq_set_irq_wake from atmel_gpio_irq_set_wake+0x58/0xb4
        atmel_gpio_irq_set_wake from irq_set_irq_wake+0x100/0x204
        irq_set_irq_wake from gpio_keys_suspend+0xec/0x2b8
        gpio_keys_suspend from dpm_run_callback+0xe4/0x248
        dpm_run_callback from __device_suspend+0x234/0x91c
        __device_suspend from dpm_suspend+0x224/0x43c
        dpm_suspend from dpm_suspend_start+0x9c/0xa8
        dpm_suspend_start from suspend_devices_and_enter+0x1e0/0xa84
        suspend_devices_and_enter from pm_suspend+0x460/0x4e8
        pm_suspend from state_store+0x78/0xe4
        state_store from kernfs_fop_write_iter+0x1a0/0x284
        kernfs_fop_write_iter from vfs_write+0x38c/0x6f4
        vfs_write from ksys_write+0xd8/0x178
        ksys_write from ret_fast_syscall+0x0/0x1c
       Exception stack(0xc52b3fa8 to 0xc52b3ff0)
       3fa0:                   00000004 005a0ae8 00000001 005a0ae8 00000004 00000001
       3fc0: 00000004 005a0ae8 00000001 00000004 00000004 b6c616c0 00000020 0059d190
       3fe0: 00000004 b6c61678 aec5a041 aebf1a26
      
      This warning is raised because pinctrl-at91-pio4 uses chained IRQ. Whenever
      a wake up source configures an IRQ through irq_set_irq_wake, it will
      lock the corresponding IRQ desc, and then call irq_set_irq_wake on "parent"
      IRQ which will do the same on its own IRQ desc, but since those two locks
      share the same class, lockdep reports this as an issue.
      
      Fix lockdep false positive by setting a different class for parent and
      children IRQ
      
      Fixes: 77618084
      
       ("pinctrl: introduce driver for Atmel PIO4 controller")
      Signed-off-by: default avatarAlexis Lothoré <alexis.lothore@bootlin.com>
      Link: https://lore.kernel.org/r/20231215-lockdep_warning-v1-1-8137b2510ed5@bootlin.com
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6eb51df9
    • Arnd Bergmann's avatar
      x86/xen: add CPU dependencies for 32-bit build · 903bb0c7
      Arnd Bergmann authored
      [ Upstream commit 93cd0597 ]
      
      Xen only supports modern CPUs even when running a 32-bit kernel, and it now
      requires a kernel built for a 64 byte (or larger) cache line:
      
      In file included from <command-line>:
      In function 'xen_vcpu_setup',
          inlined from 'xen_vcpu_setup_restore' at arch/x86/xen/enlighten.c:111:3,
          inlined from 'xen_vcpu_restore' at arch/x86/xen/enlighten.c:141:3:
      include/linux/compiler_types.h:435:45: error: call to '__compiletime_assert_287' declared with attribute error: BUILD_BUG_ON failed: sizeof(*vcpup) > SMP_CACHE_BYTES
      arch/x86/xen/enlighten.c:166:9: note: in expansion of macro 'BUILD_BUG_ON'
        166 |         BUILD_BUG_ON(sizeof(*vcpup) > SMP_CACHE_BYTES);
            |         ^~~~~~~~~~~~
      
      Enforce the dependency with a whitelist of CPU configurations. In normal
      distro kernels, CONFIG_X86_GENERIC is enabled, and this works fine. When this
      is not set, still allow Xen to be built on kernels that target a 64-bit
      capable CPU.
      
      Fixes: db283230
      
       ("x86/xen: fix percpu vcpu_info allocation")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-by: default avatarAlyssa Ross <hi@alyssa.is>
      Link: https://lore.kernel.org/r/20231204084722.3789473-1-arnd@kernel.org
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      903bb0c7
    • Quan Nguyen's avatar
      i2c: aspeed: Handle the coalesced stop conditions with the start conditions. · 2550d96a
      Quan Nguyen authored
      [ Upstream commit b4cc1cbb ]
      
      Some masters may drive the transfers with low enough latency between
      the nak/stop phase of the current command and the start/address phase
      of the following command that the interrupts are coalesced by the
      time we process them.
      Handle the stop conditions before processing SLAVE_MATCH to fix the
      complaints that sometimes occur below.
      
      "aspeed-i2c-bus 1e78a040.i2c-bus: irq handled != irq. Expected
      0x00000086, but was 0x00000084"
      
      Fixes: f9eb9135
      
       ("i2c: aspeed: added slave support for Aspeed I2C driver")
      Signed-off-by: default avatarQuan Nguyen <quan@os.amperecomputing.com>
      Reviewed-by: default avatarAndrew Jeffery <andrew@codeconstruct.com.au>
      Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2550d96a
    • Shengjiu Wang's avatar
      ASoC: fsl_sai: Fix channel swap issue on i.MX8MP · 5c11f637
      Shengjiu Wang authored
      [ Upstream commit 8f0f0164 ]
      
      When flag mclk_with_tere and mclk_direction_output enabled,
      The SAI transmitter or receiver will be enabled in very early
      stage, that if FSL_SAI_xMR is set by previous case,
      for example previous case is one channel, current case is
      two channels, then current case started with wrong xMR in
      the beginning, then channel swap happen.
      
      The patch is to clear xMR in hw_free() to avoid such
      channel swap issue.
      
      Fixes: 3e4a8261
      
       ("ASoC: fsl_sai: MCLK bind with TX/RX enable bit")
      Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@nxp.com>
      Reviewed-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
      Link: https://msgid.link/r/1702953057-4499-1-git-send-email-shengjiu.wang@nxp.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5c11f637
    • Jerome Brunet's avatar
      ASoC: hdmi-codec: fix missing report for jack initial status · 264d8c9b
      Jerome Brunet authored
      [ Upstream commit 025222a9 ]
      
      This fixes a problem introduced while fixing ELD reporting with no jack
      set.
      
      Most driver using the hdmi-codec will call the 'plugged_cb' callback
      directly when registered to report the initial state of the HDMI connector.
      
      With the commit mentionned, this occurs before jack is ready and the
      initial report is lost for platforms actually providing a jack for HDMI.
      
      Fix this by storing the hdmi connector status regardless of jack being set
      or not and report the last status when jack gets set.
      
      With this, the initial state is reported correctly even if it is
      disconnected. This was not done initially and is also a fix.
      
      Fixes: 15be353d
      
       ("ASoC: hdmi-codec: register hpd callback on component probe")
      Reported-by: default avatarZhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com>
      Closes: https://lore.kernel.org/alsa-devel/CADYyEwTNyY+fR9SgfDa-g6iiDwkU3MUdPVCYexs2_3wbcM8_vg@mail.gmail.com/
      Cc: Hsin-Yi Wang <hsinyi@google.com>
      Tested-by: default avatarZhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com>
      Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Link: https://msgid.link/r/20231218145655.134929-1-jbrunet@baylibre.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      264d8c9b
    • David Howells's avatar
      afs: Fix use-after-free due to get/remove race in volume tree · 9b4c95a6
      David Howells authored
      [ Upstream commit 9a6b294a ]
      
      When an afs_volume struct is put, its refcount is reduced to 0 before
      the cell->volume_lock is taken and the volume removed from the
      cell->volumes tree.
      
      Unfortunately, this means that the lookup code can race and see a volume
      with a zero ref in the tree, resulting in a use-after-free:
      
          refcount_t: addition on 0; use-after-free.
          WARNING: CPU: 3 PID: 130782 at lib/refcount.c:25 refcount_warn_saturate+0x7a/0xda
          ...
          RIP: 0010:refcount_warn_saturate+0x7a/0xda
          ...
          Call Trace:
           afs_get_volume+0x3d/0x55
           afs_create_volume+0x126/0x1de
           afs_validate_fc+0xfe/0x130
           afs_get_tree+0x20/0x2e5
           vfs_get_tree+0x1d/0xc9
           do_new_mount+0x13b/0x22e
           do_mount+0x5d/0x8a
           __do_sys_mount+0x100/0x12a
           do_syscall_64+0x3a/0x94
           entry_SYSCALL_64_after_hwframe+0x62/0x6a
      
      Fix this by:
      
       (1) When putting, use a flag to indicate if the volume has been removed
           from the tree and skip the rb_erase if it has.
      
       (2) When looking up, use a conditional ref increment and if it fails
           because the refcount is 0, replace the node in the tree and set the
           removal flag.
      
      Fixes: 20325960
      
       ("afs: Reorganise volume and server trees to be rooted on the cell")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeffrey Altman <jaltman@auristor.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9b4c95a6
    • David Howells's avatar
      afs: Fix overwriting of result of DNS query · 17605162
      David Howells authored
      [ Upstream commit a9e01ac8 ]
      
      In afs_update_cell(), ret is the result of the DNS lookup and the errors
      are to be handled by a switch - however, the value gets clobbered in
      between by setting it to -ENOMEM in case afs_alloc_vlserver_list()
      fails.
      
      Fix this by moving the setting of -ENOMEM into the error handling for
      OOM failure.  Further, only do it if we don't have an alternative error
      to return.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.  Based
      on a patch from Anastasia Belova [1].
      
      Fixes: d5c32c89
      
       ("afs: Fix cell DNS lookup")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeffrey Altman <jaltman@auristor.com>
      cc: Anastasia Belova <abelova@astralinux.ru>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      cc: lvc-project@linuxtesting.org
      Link: https://lore.kernel.org/r/20231221085849.1463-1-abelova@astralinux.ru/ [1]
      Link: https://lore.kernel.org/r/1700862.1703168632@warthog.procyon.org.uk/ # v1
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      17605162
    • David Howells's avatar
      keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry · 791d5409
      David Howells authored
      [ Upstream commit 39299bdd ]
      
      If a key has an expiration time, then when that time passes, the key is
      left around for a certain amount of time before being collected (5 mins by
      default) so that EKEYEXPIRED can be returned instead of ENOKEY.  This is a
      problem for DNS keys because we want to redo the DNS lookup immediately at
      that point.
      
      Fix this by allowing key types to be marked such that keys of that type
      don't have this extra period, but are reclaimed as soon as they expire and
      turn this on for dns_resolver-type keys.  To make this easier to handle,
      key->expiry is changed to be permanent if TIME64_MAX rather than 0.
      
      Furthermore, give such new-style negative DNS results a 1s default expiry
      if no other expiry time is set rather than allowing it to stick around
      indefinitely.  This shouldn't be zero as ls will follow a failing stat call
      immediately with a second with AT_SYMLINK_NOFOLLOW added.
      
      Fixes: 1a4240f4
      
       ("DNS: Separate out CIFS DNS Resolver code")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Tested-by: default avatarMarkus Suvanto <markus.suvanto@gmail.com>
      cc: Wang Lei <wang840925@gmail.com>
      cc: Jeff Layton <jlayton@redhat.com>
      cc: Steve French <smfrench@gmail.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: Jarkko Sakkinen <jarkko@kernel.org>
      cc: "David S. Miller" <davem@davemloft.net>
      cc: Eric Dumazet <edumazet@google.com>
      cc: Jakub Kicinski <kuba@kernel.org>
      cc: Paolo Abeni <pabeni@redhat.com>
      cc: linux-afs@lists.infradead.org
      cc: linux-cifs@vger.kernel.org
      cc: linux-nfs@vger.kernel.org
      cc: ceph-devel@vger.kernel.org
      cc: keyrings@vger.kernel.org
      cc: netdev@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      791d5409