Skip to content
  1. Sep 15, 2022
    • Thierry GUIBERT's avatar
      USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) · cb9ec6ce
      Thierry GUIBERT authored
      commit a10bc717
      
       upstream.
      
      Supports for ICOM F3400 and ICOM F4400 PMR radios in CDC-ACM driver
      enabling the AT serial port.
      The Vendor Id is 0x0C26
      The Product ID is 0x0020
      
      Output of lsusb :
      Bus 001 Device 009: ID 0c26:0020 Prolific Technology Inc. ICOM Radio
      Couldn't open device, some information will be missing
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            2 Communications
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0c26 Prolific Technology Inc.
        idProduct          0x0020
        bcdDevice            0.00
        iManufacturer           1 ICOM Inc.
        iProduct                2 ICOM Radio
        iSerial                 3 *obfuscated*
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength       0x0030
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0xc0
            Self Powered
          MaxPower                0mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval              12
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      
      Signed-off-by: default avatarThierry GUIBERT <thierry.guibert@croix-rouge.fr>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20220819081702.84118-1-thierry.guibert@croix-rouge.fr
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb9ec6ce
    • Heiner Kallweit's avatar
      usb: dwc2: fix wrong order of phy_power_on and phy_init · 4650c860
      Heiner Kallweit authored
      commit f9b995b4 upstream.
      
      Since 1599069a ("phy: core: Warn when phy_power_on is called before
      phy_init") the driver complains. In my case (Amlogic SoC) the warning
      is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init
      So change the order of the two calls. The same change has to be done
      to the order of phy_exit() and phy_power_off().
      
      Fixes: 09a75e85
      
       ("usb: dwc2: refactor common low-level hw code to platform.c")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Acked-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Link: https://lore.kernel.org/r/dfcc6b40-2274-4e86-e73c-5c5e6aa3e046@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4650c860
    • Pablo Sun's avatar
      usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles · da8cee28
      Pablo Sun authored
      commit c1e5c2f0 upstream.
      
      Fix incorrect pin assignment values when connecting to a monitor with
      Type-C receptacle instead of a plug.
      
      According to specification, an UFP_D receptacle's pin assignment
      should came from the UFP_D pin assignments field (bit 23:16), while
      an UFP_D plug's assignments are described in the DFP_D pin assignments
      (bit 15:8) during Mode Discovery.
      
      For example the LG 27 UL850-W is a monitor with Type-C receptacle.
      The monitor responds to MODE DISCOVERY command with following
      DisplayPort Capability flag:
      
              dp->alt->vdo=0x140045
      
      The existing logic only take cares of UPF_D plug case,
      and would take the bit 15:8 for this 0x140045 case.
      
      This results in an non-existing pin assignment 0x0 in
      dp_altmode_configure.
      
      To fix this problem a new set of macros are introduced
      to take plug/receptacle differences into consideration.
      
      Fixes: 0e3bb7d6
      
       ("usb: typec: Add driver for DisplayPort alternate mode")
      Cc: stable@vger.kernel.org
      Co-developed-by: default avatarPablo Sun <pablo.sun@mediatek.com>
      Co-developed-by: default avatarMacpaul Lin <macpaul.lin@mediatek.com>
      Reviewed-by: default avatarGuillaume Ranquet <granquet@baylibre.com>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarPablo Sun <pablo.sun@mediatek.com>
      Signed-off-by: default avatarMacpaul Lin <macpaul.lin@mediatek.com>
      Link: https://lore.kernel.org/r/20220804034803.19486-1-macpaul.lin@mediatek.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da8cee28
    • Slark Xiao's avatar
      USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode · 26cb4253
      Slark Xiao authored
      commit 8ffe20d0
      
       upstream.
      
      We added PIDs for MV32-WA/WB MBIM mode before, now we need to add
      support for RmNet mode.
      
      Test evidence as below:
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#=  3 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00f3 Rev=05.04
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00F3 USB Mobile Broadband
      S:  SerialNumber=d7b4be8d
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#= 10 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00f4 Rev=05.04
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00F4 USB Mobile Broadband
      S:  SerialNumber=d095087d
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      [ johan: sort entries ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      26cb4253
    • Yonglin Tan's avatar
      USB: serial: option: add Quectel EM060K modem · ac4e740d
      Yonglin Tan authored
      commit f766f3ab
      
       upstream.
      
      Add usb product id entry for the Quectel EM060K module.
      
      "MBIM mode": DIAG + NMEA + AT + MODEM + MBIM + QDSS
      
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=030b Rev= 5.04
      S:  Manufacturer=Quectel
      S:  Product=EM060K-GL
      S:  SerialNumber=89fb57db
      C:* #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 8 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 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= 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=ff Prot=40 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#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 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#= 8 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 9 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 9 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#=12 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarYonglin Tan <yonglin.tan@outlook.com>
      [ johan: mention QDSS port and sort entries ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac4e740d
    • Yan Xinyu's avatar
      USB: serial: option: add support for OPPO R11 diag port · 4570b941
      Yan Xinyu authored
      commit 8d5fc280
      
       upstream.
      
      Add support for OPPO R11 USB diag serial port to option driver. This
      phone uses Qualcomm Snapdragon 660 SoC.
      
      usb-devices output:
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 10 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=22d9 ProdID=276c Rev=04.04
      S:  Manufacturer=OPPO
      S:  Product=SDM660-MTP _SN:09C6BCA7
      S:  SerialNumber=beb2c403
      C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      I:  If#=0x1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      
      Signed-off-by: default avatarYan Xinyu <sdlyyxy@bupt.edu.cn>
      Link: https://lore.kernel.org/r/20220714102037.4113889-1-sdlyyxy@bupt.edu.cn
      Link: https://lore.kernel.org/r/Yt1WfSZk03Plpnan@hovoldconsulting.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>
      4570b941
    • Johan Hovold's avatar
      USB: serial: cp210x: add Decagon UCA device id · fdc08b98
      Johan Hovold authored
      commit ceb40384
      
       upstream.
      
      Add the device id for Decagon Devices USB Cable Adapter.
      
      Link: https://lore.kernel.org/r/trinity-819f9db2-d3e1-40e9-a669-9c245817c046-1661523546680@msvc-mesg-web108
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fdc08b98
    • Mathias Nyman's avatar
      xhci: Add grace period after xHC start to prevent premature runtime suspend. · c2f4a72d
      Mathias Nyman authored
      commit 33e32158
      
       upstream.
      
      After xHC controller is started, either in probe or resume, it can take
      a while before any of the connected usb devices are visible to the roothub
      due to link training.
      
      It's possible xhci driver loads, sees no acivity and suspends the host
      before the USB device is visible.
      
      In one testcase with a hotplugged xHC controller the host finally detected
      the connected USB device and generated a wake 500ms after host initial
      start.
      
      If hosts didn't suspend the device duringe training it probablty wouldn't
      take up to 500ms to detect it, but looking at specs reveal USB3 link
      training has a couple long timeout values, such as 120ms
      RxDetectQuietTimeout, and 360ms PollingLFPSTimeout.
      
      So Add a 500ms grace period that keeps polling the roothub for 500ms after
      start, preventing runtime suspend until USB devices are detected.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20220825150840.132216-3-mathias.nyman@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c2f4a72d
    • Mika Westerberg's avatar
      thunderbolt: Use the actual buffer in tb_async_error() · 6d7ccbb0
      Mika Westerberg authored
      commit eb100b8f upstream.
      
      The received notification packet is held in pkg->buffer and not in pkg
      itself. Fix this by using the correct buffer.
      
      Fixes: 81a54b5e
      
       ("thunderbolt: Let the connection manager handle all notifications")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6d7ccbb0
    • Armin Wolf's avatar
      hwmon: (gpio-fan) Fix array out of bounds access · c8ae6a18
      Armin Wolf authored
      [ Upstream commit f233d2be ]
      
      The driver does not check if the cooling state passed to
      gpio_fan_set_cur_state() exceeds the maximum cooling state as
      stored in fan_data->num_speeds. Since the cooling state is later
      used as an array index in set_fan_speed(), an array out of bounds
      access can occur.
      This can be exploited by setting the state of the thermal cooling device
      to arbitrary values, causing for example a kernel oops when unavailable
      memory is accessed this way.
      
      Example kernel oops:
      [  807.987276] Unable to handle kernel paging request at virtual address ffffff80d0588064
      [  807.987369] Mem abort info:
      [  807.987398]   ESR = 0x96000005
      [  807.987428]   EC = 0x25: DABT (current EL), IL = 32 bits
      [  807.987477]   SET = 0, FnV = 0
      [  807.987507]   EA = 0, S1PTW = 0
      [  807.987536]   FSC = 0x05: level 1 translation fault
      [  807.987570] Data abort info:
      [  807.987763]   ISV = 0, ISS = 0x00000005
      [  807.987801]   CM = 0, WnR = 0
      [  807.987832] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000001165000
      [  807.987872] [ffffff80d0588064] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
      [  807.987961] Internal error: Oops: 96000005 [#1] PREEMPT SMP
      [  807.987992] Modules linked in: cmac algif_hash aes_arm64 algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc 8021q garp stp llc snd_soc_hdmi_codec brcmfmac vc4 brcmutil cec drm_kms_helper snd_soc_core cfg80211 snd_compress bcm2835_codec(C) snd_pcm_dmaengine syscopyarea bcm2835_isp(C) bcm2835_v4l2(C) sysfillrect v4l2_mem2mem bcm2835_mmal_vchiq(C) raspberrypi_hwmon sysimgblt videobuf2_dma_contig videobuf2_vmalloc fb_sys_fops videobuf2_memops rfkill videobuf2_v4l2 videobuf2_common i2c_bcm2835 snd_bcm2835(C) videodev snd_pcm snd_timer snd mc vc_sm_cma(C) gpio_fan uio_pdrv_genirq uio drm fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
      [  807.988508] CPU: 0 PID: 1321 Comm: bash Tainted: G         C        5.15.56-v8+ #1575
      [  807.988548] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
      [  807.988574] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [  807.988608] pc : set_fan_speed.part.5+0x34/0x80 [gpio_fan]
      [  807.988654] lr : gpio_fan_set_cur_state+0x34/0x50 [gpio_fan]
      [  807.988691] sp : ffffffc008cf3bd0
      [  807.988710] x29: ffffffc008cf3bd0 x28: ffffff80019edac0 x27: 0000000000000000
      [  807.988762] x26: 0000000000000000 x25: 0000000000000000 x24: ffffff800747c920
      [  807.988787] x23: 000000000000000a x22: ffffff800369f000 x21: 000000001999997c
      [  807.988854] x20: ffffff800369f2e8 x19: ffffff8002ae8080 x18: 0000000000000000
      [  807.988877] x17: 0000000000000000 x16: 0000000000000000 x15: 000000559e271b70
      [  807.988938] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
      [  807.988960] x11: 0000000000000000 x10: ffffffc008cf3c20 x9 : ffffffcfb60c741c
      [  807.989018] x8 : 000000000000000a x7 : 00000000ffffffc9 x6 : 0000000000000009
      [  807.989040] x5 : 000000000000002a x4 : 0000000000000000 x3 : ffffff800369f2e8
      [  807.989062] x2 : 000000000000e780 x1 : 0000000000000001 x0 : ffffff80d0588060
      [  807.989084] Call trace:
      [  807.989091]  set_fan_speed.part.5+0x34/0x80 [gpio_fan]
      [  807.989113]  gpio_fan_set_cur_state+0x34/0x50 [gpio_fan]
      [  807.989199]  cur_state_store+0x84/0xd0
      [  807.989221]  dev_attr_store+0x20/0x38
      [  807.989262]  sysfs_kf_write+0x4c/0x60
      [  807.989282]  kernfs_fop_write_iter+0x130/0x1c0
      [  807.989298]  new_sync_write+0x10c/0x190
      [  807.989315]  vfs_write+0x254/0x378
      [  807.989362]  ksys_write+0x70/0xf8
      [  807.989379]  __arm64_sys_write+0x24/0x30
      [  807.989424]  invoke_syscall+0x4c/0x110
      [  807.989442]  el0_svc_common.constprop.3+0xfc/0x120
      [  807.989458]  do_el0_svc+0x2c/0x90
      [  807.989473]  el0_svc+0x24/0x60
      [  807.989544]  el0t_64_sync_handler+0x90/0xb8
      [  807.989558]  el0t_64_sync+0x1a0/0x1a4
      [  807.989579] Code: b9403801 f9402800 7100003f 8b35cc00 (b9400416)
      [  807.989627] ---[ end trace 8ded4c918658445b ]---
      
      Fix this by checking the cooling state and return an error if it
      exceeds the maximum cooling state.
      
      Tested on a Raspberry Pi 3.
      
      Fixes: b5cf88e4
      
       ("(gpio-fan): Add thermal control hooks")
      Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
      Link: https://lore.kernel.org/r/20220830011101.178843-1-W_Armin@gmx.de
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c8ae6a18
    • Peter Robinson's avatar
      Input: rk805-pwrkey - fix module autoloading · 1d399a78
      Peter Robinson authored
      [ Upstream commit 99077ad6 ]
      
      Add the module alias so the rk805-pwrkey driver will
      autoload when built as a module.
      
      Fixes: 5a35b85c
      
       ("Input: add power key driver for Rockchip RK805 PMIC")
      Signed-off-by: default avatarPeter Robinson <pbrobinson@gmail.com>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Link: https://lore.kernel.org/r/20220612225437.3628788-1-pbrobinson@gmail.com
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1d399a78
    • Chen-Yu Tsai's avatar
      clk: core: Fix runtime PM sequence in clk_core_unprepare() · 71f953e6
      Chen-Yu Tsai authored
      [ Upstream commit 4b592061 ]
      
      In the original commit 9a34b453 ("clk: Add support for runtime PM"),
      the commit message mentioned that pm_runtime_put_sync() would be done
      at the end of clk_core_unprepare(). This mirrors the operations in
      clk_core_prepare() in the opposite order.
      
      However, the actual code that was added wasn't in the order the commit
      message described. Move clk_pm_runtime_put() to the end of
      clk_core_unprepare() so that it is in the correct order.
      
      Fixes: 9a34b453
      
       ("clk: Add support for runtime PM")
      Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Reviewed-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
      Link: https://lore.kernel.org/r/20220822081424.1310926-3-wenst@chromium.org
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71f953e6
    • Stephen Boyd's avatar
      Revert "clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops" · 99b25ceb
      Stephen Boyd authored
      [ Upstream commit abb5f3f4 ]
      
      This reverts commit 35b0fac8
      
      . Alexander
      reports that it causes boot failures on i.MX8M Plus based boards
      (specifically imx8mp-tqma8mpql-mba8mpxl.dts).
      
      Reported-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
      Cc: Chen-Yu Tsai <wenst@chromium.org>
      Fixes: 35b0fac8
      
       ("clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops")
      Link: https://lore.kernel.org/r/12115951.O9o76ZdvQC@steina-w
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Link: https://lore.kernel.org/r/20220831175326.2523912-1-sboyd@kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      99b25ceb
    • Chen-Yu Tsai's avatar
      clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops · b8de7959
      Chen-Yu Tsai authored
      [ Upstream commit 35b0fac8 ]
      
      In the previous commits that added CLK_OPS_PARENT_ENABLE, support for
      this flag was only added to rate change operations (rate setting and
      reparent) and disabling unused subtree. It was not added to the
      clock gate related operations. Any hardware driver that needs it for
      these operations will either see bogus results, or worse, hang.
      
      This has been seen on MT8192 and MT8195, where the imp_ii2_* clk
      drivers set this, but dumping debugfs clk_summary would cause it
      to hang.
      
      Fixes: fc8726a2 ("clk: core: support clocks which requires parents enable (part 2)")
      Fixes: a4b3518d
      
       ("clk: core: support clocks which requires parents enable (part 1)")
      Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Reviewed-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
      Tested-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
      Link: https://lore.kernel.org/r/20220822081424.1310926-2-wenst@chromium.org
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b8de7959
    • Colin Ian King's avatar
      drm/i915/reg: Fix spelling mistake "Unsupport" -> "Unsupported" · 9277808b
      Colin Ian King authored
      [ Upstream commit 233f5674 ]
      
      There is a spelling mistake in a gvt_vgpu_err error message. Fix it.
      
      Fixes: 695fbc08
      
       ("drm/i915/gvt: replace the gvt_err with gvt_vgpu_err")
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20220315202449.2952845-1-colin.i.king@gmail.com
      Reviewed-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9277808b
    • Carlos Llamas's avatar
      binder: fix UAF of ref->proc caused by race condition · 06e5b43c
      Carlos Llamas authored
      commit a0e44c64
      
       upstream.
      
      A transaction of type BINDER_TYPE_WEAK_HANDLE can fail to increment the
      reference for a node. In this case, the target proc normally releases
      the failed reference upon close as expected. However, if the target is
      dying in parallel the call will race with binder_deferred_release(), so
      the target could have released all of its references by now leaving the
      cleanup of the new failed reference unhandled.
      
      The transaction then ends and the target proc gets released making the
      ref->proc now a dangling pointer. Later on, ref->node is closed and we
      attempt to take spin_lock(&ref->proc->inner_lock), which leads to the
      use-after-free bug reported below. Let's fix this by cleaning up the
      failed reference on the spot instead of relying on the target to do so.
      
        ==================================================================
        BUG: KASAN: use-after-free in _raw_spin_lock+0xa8/0x150
        Write of size 4 at addr ffff5ca207094238 by task kworker/1:0/590
      
        CPU: 1 PID: 590 Comm: kworker/1:0 Not tainted 5.19.0-rc8 #10
        Hardware name: linux,dummy-virt (DT)
        Workqueue: events binder_deferred_func
        Call trace:
         dump_backtrace.part.0+0x1d0/0x1e0
         show_stack+0x18/0x70
         dump_stack_lvl+0x68/0x84
         print_report+0x2e4/0x61c
         kasan_report+0xa4/0x110
         kasan_check_range+0xfc/0x1a4
         __kasan_check_write+0x3c/0x50
         _raw_spin_lock+0xa8/0x150
         binder_deferred_func+0x5e0/0x9b0
         process_one_work+0x38c/0x5f0
         worker_thread+0x9c/0x694
         kthread+0x188/0x190
         ret_from_fork+0x10/0x20
      
      Acked-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
      Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
      Cc: stable <stable@kernel.org> # 4.14+
      Link: https://lore.kernel.org/r/20220801182511.3371447-1-cmllamas@google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      06e5b43c
    • Niek Nooijens's avatar
      USB: serial: ftdi_sio: add Omron CS1W-CIF31 device id · a2f766e6
      Niek Nooijens authored
      commit 001047ea
      
       upstream.
      
      works perfectly with:
      modprobe ftdi_sio
      echo "0590 00b2" | tee
      /sys/module/ftdi_sio/drivers/usb-serial\:ftdi_sio/new_id > /dev/null
      
      but doing this every reboot is a pain in the ass.
      
      Signed-off-by: default avatarNiek Nooijens <niek.nooijens@omron.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>
      a2f766e6
    • Helge Deller's avatar
      vt: Clear selection before changing the font · f74b4a41
      Helge Deller authored
      commit 566f9c9f
      
       upstream.
      
      When changing the console font with ioctl(KDFONTOP) the new font size
      can be bigger than the previous font. A previous selection may thus now
      be outside of the new screen size and thus trigger out-of-bounds
      accesses to graphics memory if the selection is removed in
      vc_do_resize().
      
      Prevent such out-of-memory accesses by dropping the selection before the
      various con_font_set() console handlers are called.
      
      Reported-by: default avatar <syzbot+14b0e8f3fd1612e35350@syzkaller.appspotmail.com>
      Cc: stable <stable@kernel.org>
      Tested-by: default avatarKhalid Masum <khalid.masum.92@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Link: https://lore.kernel.org/r/YuV9apZGNmGfjcor@p100
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f74b4a41
    • Dan Carpenter's avatar
      staging: rtl8712: fix use after free bugs · 9fd6170c
      Dan Carpenter authored
      commit e230a445 upstream.
      
      _Read/Write_MACREG callbacks are NULL so the read/write_macreg_hdl()
      functions don't do anything except free the "pcmd" pointer.  It
      results in a use after free.  Delete them.
      
      Fixes: 2865d42c
      
       ("staging: r8712u: Add the new driver to the mainline kernel")
      Cc: stable <stable@kernel.org>
      Reported-by: default avatarZheng Wang <hackerzheng666@gmail.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/Yw4ASqkYcUhUfoY2@kili
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fd6170c
    • Shenwei Wang's avatar
      serial: fsl_lpuart: RS485 RTS polariy is inverse · e4979655
      Shenwei Wang authored
      commit 846651ec upstream.
      
      The setting of RS485 RTS polarity is inverse in the current driver.
      
      When the property of 'rs485-rts-active-low' is enabled in the dts node,
      the RTS signal should be LOW during sending. Otherwise, if there is no
      such a property, the RTS should be HIGH during sending.
      
      Fixes: 03895cf4
      
       ("tty: serial: fsl_lpuart: Add support for RS-485")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarNicolas Diaz <nicolas.diaz@nxp.com>
      Signed-off-by: default avatarShenwei Wang <shenwei.wang@nxp.com>
      Link: https://lore.kernel.org/r/20220805144529.604856-1-shenwei.wang@nxp.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4979655
    • Yacan Liu's avatar
      net/smc: Remove redundant refcount increase · 84120320
      Yacan Liu authored
      [ Upstream commit a8424a9b ]
      
      For passive connections, the refcount increment has been done in
      smc_clcsock_accept()-->smc_sock_alloc().
      
      Fixes: 3b2dec26
      
       ("net/smc: restructure client and server code in af_smc")
      Signed-off-by: default avatarYacan Liu <liuyacan@corp.netease.com>
      Reviewed-by: default avatarTony Lu <tonylu@linux.alibaba.com>
      Link: https://lore.kernel.org/r/20220830152314.838736-1-liuyacan@corp.netease.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      84120320
    • Jakub Kicinski's avatar
      Revert "sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb" · a5996fdc
      Jakub Kicinski authored
      [ Upstream commit 0b4f688d ]
      
      This reverts commit 90fabae8.
      
      Patch was applied hastily, revert and let the v2 be reviewed.
      
      Fixes: 90fabae8
      
       ("sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb")
      Link: https://lore.kernel.org/all/87wnao2ha3.fsf@toke.dk/
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a5996fdc
    • Eric Dumazet's avatar
      tcp: annotate data-race around challenge_timestamp · 12f99f07
      Eric Dumazet authored
      [ Upstream commit 8c705212 ]
      
      challenge_timestamp can be read an written by concurrent threads.
      
      This was expected, but we need to annotate the race to avoid potential issues.
      
      Following patch moves challenge_timestamp and challenge_count
      to per-netns storage to provide better isolation.
      
      Fixes: 354e4aa3
      
       ("tcp: RFC 5961 5.2 Blind Data Injection Attack Mitigation")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      12f99f07
    • Toke Høiland-Jørgensen's avatar
      sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb · b216cb54
      Toke Høiland-Jørgensen authored
      [ Upstream commit 90fabae8 ]
      
      When the GSO splitting feature of sch_cake is enabled, GSO superpackets
      will be broken up and the resulting segments enqueued in place of the
      original skb. In this case, CAKE calls consume_skb() on the original skb,
      but still returns NET_XMIT_SUCCESS. This can confuse parent qdiscs into
      assuming the original skb still exists, when it really has been freed. Fix
      this by adding the __NET_XMIT_STOLEN flag to the return value in this case.
      
      Fixes: 0c850344
      
       ("sch_cake: Conditionally split GSO segments")
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@toke.dk>
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-18231
      Link: https://lore.kernel.org/r/20220831092103.442868-1-toke@toke.dk
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b216cb54
    • Cong Wang's avatar
      kcm: fix strp_init() order and cleanup · a8a0c321
      Cong Wang authored
      [ Upstream commit 8fc29ff3
      
       ]
      
      strp_init() is called just a few lines above this csk->sk_user_data
      check, it also initializes strp->work etc., therefore, it is
      unnecessary to call strp_done() to cancel the freshly initialized
      work.
      
      And if sk_user_data is already used by KCM, psock->strp should not be
      touched, particularly strp->work state, so we need to move strp_init()
      after the csk->sk_user_data check.
      
      This also makes a lockdep warning reported by syzbot go away.
      
      Reported-and-tested-by: default avatar <syzbot+9fc084a4348493ef65d2@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+e696806ef96cdd2d87cd@syzkaller.appspotmail.com>
      Fixes: e5571240 ("kcm: Check if sk_user_data already set in kcm_attach")
      Fixes: dff8baa2
      
       ("kcm: Call strp_stop before strp_done in kcm_attach")
      Cc: Tom Herbert <tom@herbertland.com>
      Signed-off-by: default avatarCong Wang <cong.wang@bytedance.com>
      Link: https://lore.kernel.org/r/20220827181314.193710-1-xiyou.wangcong@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a8a0c321
    • Duoming Zhou's avatar
      ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler · 11f1e0c9
      Duoming Zhou authored
      [ Upstream commit c0955bf9 ]
      
      The function neigh_timer_handler() is a timer handler that runs in an
      atomic context. When used by rocker, neigh_timer_handler() calls
      "kzalloc(.., GFP_KERNEL)" that may sleep. As a result, the sleep in
      atomic context bug will happen. One of the processes is shown below:
      
      ofdpa_fib4_add()
       ...
       neigh_add_timer()
      
      (wait a timer)
      
      neigh_timer_handler()
       neigh_release()
        neigh_destroy()
         rocker_port_neigh_destroy()
          rocker_world_port_neigh_destroy()
           ofdpa_port_neigh_destroy()
            ofdpa_port_ipv4_neigh()
             kzalloc(sizeof(.., GFP_KERNEL) //may sleep
      
      This patch changes the gfp_t parameter of kzalloc() from GFP_KERNEL to
      GFP_ATOMIC in order to mitigate the bug.
      
      Fixes: 00fc0c51
      
       ("rocker: Change world_ops API and implementation to be switchdev independant")
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      11f1e0c9
    • Mathias Nyman's avatar
      Revert "xhci: turn off port power in shutdown" · 4f63e0c9
      Mathias Nyman authored
      [ Upstream commit 8531aa16 ]
      
      This reverts commit 83810f84.
      
      Turning off port power in shutdown did cause issues such as a laptop not
      proprly powering off, and some specific usb devies failing to enumerate the
      subsequent boot after a warm reset.
      
      So revert this.
      
      Fixes: 83810f84
      
       ("xhci: turn off port power in shutdown")
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20220825150840.132216-4-mathias.nyman@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4f63e0c9
    • Dan Carpenter's avatar
      wifi: cfg80211: debugfs: fix return type in ht40allow_map_read() · 155ab65c
      Dan Carpenter authored
      [ Upstream commit d776763f ]
      
      The return type is supposed to be ssize_t, which is signed long,
      but "r" was declared as unsigned int.  This means that on 64 bit systems
      we return positive values instead of negative error codes.
      
      Fixes: 80a3511d
      
       ("cfg80211: add debugfs HT40 allow map")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/YutvOQeJm0UjLhwU@kili
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      155ab65c
    • Lin Ma's avatar
      ieee802154/adf7242: defer destroy_workqueue call · dede80aa
      Lin Ma authored
      [ Upstream commit afe7116f ]
      
      There is a possible race condition (use-after-free) like below
      
        (FREE)                     |  (USE)
        adf7242_remove             |  adf7242_channel
         cancel_delayed_work_sync  |
          destroy_workqueue (1)    |   adf7242_cmd_rx
                                   |    mod_delayed_work (2)
                                   |
      
      The root cause for this race is that the upper layer (ieee802154) is
      unaware of this detaching event and the function adf7242_channel can
      be called without any checks.
      
      To fix this, we can add a flag write at the beginning of adf7242_remove
      and add flag check in adf7242_channel. Or we can just defer the
      destructive operation like other commit 3e0588c2 ("hamradio: defer
      ax25 kfree after unregister_netdev") which let the
      ieee802154_unregister_hw() to handle the synchronization. This patch
      takes the second option.
      
      Fixes: 58e9683d
      
       ("net: ieee802154: adf7242: Fix OCL calibration
      runs")
      Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
      Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
      Link: https://lore.kernel.org/r/20220808034224.12642-1-linma@zju.edu.cn
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dede80aa
    • Andy Shevchenko's avatar
      platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask · bb522b13
      Andy Shevchenko authored
      [ Upstream commit 0a90ed8d ]
      
      On Intel hardware the SLP_TYPx bitfield occupies bits 10-12 as per ACPI
      specification (see Table 4.13 "PM1 Control Registers Fixed Hardware
      Feature Control Bits" for the details).
      
      Fix the mask and other related definitions accordingly.
      
      Fixes: 93e5eadd
      
       ("x86/platform: New Intel Atom SOC power management controller driver")
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20220801113734.36131-1-andriy.shevchenko@linux.intel.com
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bb522b13
    • Douglas Anderson's avatar
      drm/msm/dsi: Fix number of regulators for msm8996_dsi_cfg · 8e8cdde8
      Douglas Anderson authored
      [ Upstream commit 1e00d6ac ]
      
      3 regulators are listed but the number 2 is specified. Fix it.
      
      Fixes: 3a3ff88a
      
       ("drm/msm/dsi: Add 8x96 info in dsi_cfg")
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Patchwork: https://patchwork.freedesktop.org/patch/496318/
      Link: https://lore.kernel.org/r/20220804073608.v4.1.I1056ee3f77f71287f333279efe4c85f88d403f65@changeid
      Signed-off-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8e8cdde8
    • sunliming's avatar
      drm/msm/dsi: fix the inconsistent indenting · 89baca94
      sunliming authored
      [ Upstream commit 2f25a1fb ]
      
      Fix the inconsistent indenting in function msm_dsi_dphy_timing_calc_v3().
      
      Fix the following smatch warnings:
      
      drivers/gpu/drm/msm/dsi/phy/dsi_phy.c:350 msm_dsi_dphy_timing_calc_v3() warn: inconsistent indenting
      
      Fixes: f1fa7ff4
      
       ("drm/msm/dsi: implement auto PHY timing calculator for 10nm PHY")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarsunliming <sunliming@kylinos.cn>
      Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Patchwork: https://patchwork.freedesktop.org/patch/494662/
      Link: https://lore.kernel.org/r/20220719015622.646718-1-sunliming@kylinos.cn
      Signed-off-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      89baca94
    • Enguerrand de Ribaucourt's avatar
      net: dp83822: disable false carrier interrupt · 47d42ab0
      Enguerrand de Ribaucourt authored
      commit c96614ee upstream.
      
      When unplugging an Ethernet cable, false carrier events were produced by
      the PHY at a very high rate. Once the false carrier counter full, an
      interrupt was triggered every few clock cycles until the cable was
      replugged. This resulted in approximately 10k/s interrupts.
      
      Since the false carrier counter (FCSCR) is never used, we can safely
      disable this interrupt.
      
      In addition to improving performance, this also solved MDIO read
      timeouts I was randomly encountering with an i.MX8 fec MAC because of
      the interrupt flood. The interrupt count and MDIO timeout fix were
      tested on a v5.4.110 kernel.
      
      Fixes: 87461f7a
      
       ("net: phy: DP83822 initial driver submission")
      Signed-off-by: default avatarEnguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      47d42ab0
    • Yee Lee's avatar
      Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" · aabdbd63
      Yee Lee authored
      This reverts commit 23c2d497.
      
      Commit 23c2d497 ("mm: kmemleak: take a full lowmem check in
      kmemleak_*_phys()") brought false leak alarms on some archs like arm64
      that does not init pfn boundary in early booting. The final solution
      lands on linux-6.0: commit 0c24e061
      
       ("mm: kmemleak: add rbtree and
      store physical address for objects allocated with PA").
      
      Revert this commit before linux-6.0. The original issue of invalid PA
      can be mitigated by additional check in devicetree.
      
      The false alarm report is as following: Kmemleak output: (Qemu/arm64)
      unreferenced object 0xffff0000c0170a00 (size 128):
        comm "swapper/0", pid 1, jiffies 4294892404 (age 126.208s)
        hex dump (first 32 bytes):
       62 61 73 65 00 00 00 00 00 00 00 00 00 00 00 00  base............
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<(____ptrval____)>] __kmalloc_track_caller+0x1b0/0x2e4
          [<(____ptrval____)>] kstrdup_const+0x8c/0xc4
          [<(____ptrval____)>] kvasprintf_const+0xbc/0xec
          [<(____ptrval____)>] kobject_set_name_vargs+0x58/0xe4
          [<(____ptrval____)>] kobject_add+0x84/0x100
          [<(____ptrval____)>] __of_attach_node_sysfs+0x78/0xec
          [<(____ptrval____)>] of_core_init+0x68/0x104
          [<(____ptrval____)>] driver_init+0x28/0x48
          [<(____ptrval____)>] do_basic_setup+0x14/0x28
          [<(____ptrval____)>] kernel_init_freeable+0x110/0x178
          [<(____ptrval____)>] kernel_init+0x20/0x1a0
          [<(____ptrval____)>] ret_from_fork+0x10/0x20
      
      This pacth is also applicable to linux-5.17.y/linux-5.18.y/linux-5.19.y
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarYee Lee <yee.lee@mediatek.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aabdbd63
    • Linus Torvalds's avatar
      fs: only do a memory barrier for the first set_buffer_uptodate() · 5aa8067f
      Linus Torvalds authored
      commit 2f79cdfe upstream.
      
      Commit d4252071
      
       ("add barriers to buffer_uptodate and
      set_buffer_uptodate") added proper memory barriers to the buffer head
      BH_Uptodate bit, so that anybody who tests a buffer for being up-to-date
      will be guaranteed to actually see initialized state.
      
      However, that commit didn't _just_ add the memory barrier, it also ended
      up dropping the "was it already set" logic that the BUFFER_FNS() macro
      had.
      
      That's conceptually the right thing for a generic "this is a memory
      barrier" operation, but in the case of the buffer contents, we really
      only care about the memory barrier for the _first_ time we set the bit,
      in that the only memory ordering protection we need is to avoid anybody
      seeing uninitialized memory contents.
      
      Any other access ordering wouldn't be about the BH_Uptodate bit anyway,
      and would require some other proper lock (typically BH_Lock or the folio
      lock).  A reader that races with somebody invalidating the buffer head
      isn't an issue wrt the memory ordering, it's a serialization issue.
      
      Now, you'd think that the buffer head operations don't matter in this
      day and age (and I certainly thought so), but apparently some loads
      still end up being heavy users of buffer heads.  In particular, the
      kernel test robot reported that not having this bit access optimization
      in place caused a noticeable direct IO performance regression on ext4:
      
        fxmark.ssd_ext4_no_jnl_DWTL_54_directio.works/sec -26.5% regression
      
      although you presumably need a fast disk and a lot of cores to actually
      notice.
      
      Link: https://lore.kernel.org/all/Yw8L7HTZ%2FdE2%2Fo9C@xsang-OptiPlex-9020/
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Tested-by: default avatarFengwei Yin <fengwei.yin@intel.com>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5aa8067f
    • Stanislaw Gruszka's avatar
      wifi: iwlegacy: 4965: corrected fix for potential off-by-one overflow in il4965_rs_fill_link_cmd() · 135861f9
      Stanislaw Gruszka authored
      commit 6d0ef724 upstream.
      
      This reverts commit a8eb8e6f as
      it can cause invalid link quality command sent to the firmware
      and address the off-by-one issue by fixing condition of while loop.
      
      Cc: stable@vger.kernel.org
      Fixes: a8eb8e6f
      
       ("wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd()")
      Signed-off-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220815073737.GA999388@wp.pl
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      135861f9
    • Hyunwoo Kim's avatar
      efi: capsule-loader: Fix use-after-free in efi_capsule_write · 021805af
      Hyunwoo Kim authored
      commit 9cb636b5
      
       upstream.
      
      A race condition may occur if the user calls close() on another thread
      during a write() operation on the device node of the efi capsule.
      
      This is a race condition that occurs between the efi_capsule_write() and
      efi_capsule_flush() functions of efi_capsule_fops, which ultimately
      results in UAF.
      
      So, the page freeing process is modified to be done in
      efi_capsule_release() instead of efi_capsule_flush().
      
      Cc: <stable@vger.kernel.org> # v4.9+
      Signed-off-by: default avatarHyunwoo Kim <imv4bel@gmail.com>
      Link: https://lore.kernel.org/all/20220907102920.GA88602@ubuntu/
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      021805af
    • Isaac J. Manjarres's avatar
      driver core: Don't probe devices after bus_type.match() probe deferral · ca0d26cc
      Isaac J. Manjarres authored
      commit 25e9fbf0 upstream.
      
      Both __device_attach_driver() and __driver_attach() check the return
      code of the bus_type.match() function to see if the device needs to be
      added to the deferred probe list. After adding the device to the list,
      the logic attempts to bind the device to the driver anyway, as if the
      device had matched with the driver, which is not correct.
      
      If __device_attach_driver() detects that the device in question is not
      ready to match with a driver on the bus, then it doesn't make sense for
      the device to attempt to bind with the current driver or continue
      attempting to match with any of the other drivers on the bus. So, update
      the logic in __device_attach_driver() to reflect this.
      
      If __driver_attach() detects that a driver tried to match with a device
      that is not ready to match yet, then the driver should not attempt to bind
      with the device. However, the driver can still attempt to match and bind
      with other devices on the bus, as drivers can be bound to multiple
      devices. So, update the logic in __driver_attach() to reflect this.
      
      Fixes: 656b8035
      
       ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
      Cc: stable@vger.kernel.org
      Cc: Saravana Kannan <saravanak@google.com>
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarIsaac J. Manjarres <isaacmanjarres@google.com>
      Link: https://lore.kernel.org/r/20220817184026.3468620-1-isaacmanjarres@google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ca0d26cc
  2. Sep 05, 2022