Skip to content
  1. Dec 14, 2023
    • Ryusuke Konishi's avatar
      nilfs2: fix missing error check for sb_set_blocksize call · 8df769d9
      Ryusuke Konishi authored
      commit d61d0ab5
      
       upstream.
      
      When mounting a filesystem image with a block size larger than the page
      size, nilfs2 repeatedly outputs long error messages with stack traces to
      the kernel log, such as the following:
      
       getblk(): invalid block size 8192 requested
       logical block size: 512
       ...
       Call Trace:
        dump_stack_lvl+0x92/0xd4
        dump_stack+0xd/0x10
        bdev_getblk+0x33a/0x354
        __breadahead+0x11/0x80
        nilfs_search_super_root+0xe2/0x704 [nilfs2]
        load_nilfs+0x72/0x504 [nilfs2]
        nilfs_mount+0x30f/0x518 [nilfs2]
        legacy_get_tree+0x1b/0x40
        vfs_get_tree+0x18/0xc4
        path_mount+0x786/0xa88
        __ia32_sys_mount+0x147/0x1a8
        __do_fast_syscall_32+0x56/0xc8
        do_fast_syscall_32+0x29/0x58
        do_SYSENTER_32+0x15/0x18
        entry_SYSENTER_32+0x98/0xf1
       ...
      
      This overloads the system logger.  And to make matters worse, it sometimes
      crashes the kernel with a memory access violation.
      
      This is because the return value of the sb_set_blocksize() call, which
      should be checked for errors, is not checked.
      
      The latter issue is due to out-of-buffer memory being accessed based on a
      large block size that caused sb_set_blocksize() to fail for buffers read
      with the initial minimum block size that remained unupdated in the
      super_block structure.
      
      Since nilfs2 mkfs tool does not accept block sizes larger than the system
      page size, this has been overlooked.  However, it is possible to create
      this situation by intentionally modifying the tool or by passing a
      filesystem image created on a system with a large page size to a system
      with a smaller page size and mounting it.
      
      Fix this issue by inserting the expected error handling for the call to
      sb_set_blocksize().
      
      Link: https://lkml.kernel.org/r/20231129141547.4726-1-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8df769d9
    • Bin Li's avatar
      ALSA: hda/realtek: Enable headset on Lenovo M90 Gen5 · 3764b244
      Bin Li authored
      commit 6f7e4664
      
       upstream.
      
      Lenovo M90 Gen5 is equipped with ALC897, and it needs
      ALC897_FIXUP_HEADSET_MIC_PIN quirk to make its headset mic work.
      
      Signed-off-by: default avatarBin Li <bin.li@canonical.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231204100450.642783-1-bin.li@canonical.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3764b244
    • Jason Zhang's avatar
      ALSA: pcm: fix out-of-bounds in snd_pcm_state_names · 0ff1c0f5
      Jason Zhang authored
      commit 2b3a7a30
      
       upstream.
      
      The pcm state can be SNDRV_PCM_STATE_DISCONNECTED at disconnect
      callback, and there is not an entry of SNDRV_PCM_STATE_DISCONNECTED
      in snd_pcm_state_names.
      
      This patch adds the missing entry to resolve this issue.
      
      cat /proc/asound/card2/pcm0p/sub0/status
      That results in stack traces like the following:
      
      [   99.702732][ T5171] Unexpected kernel BRK exception at EL1
      [   99.702774][ T5171] Internal error: BRK handler: f2005512 [#1] PREEMPT SMP
      [   99.703858][ T5171] Modules linked in: bcmdhd(E) (...)
      [   99.747425][ T5171] CPU: 3 PID: 5171 Comm: cat Tainted: G         C OE     5.10.189-android13-4-00003-g4a17384380d8-ab11086999 #1
      [   99.748447][ T5171] Hardware name: Rockchip RK3588 CVTE V10 Board (DT)
      [   99.749024][ T5171] pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=--)
      [   99.749616][ T5171] pc : snd_pcm_substream_proc_status_read+0x264/0x2bc
      [   99.750204][ T5171] lr : snd_pcm_substream_proc_status_read+0xa4/0x2bc
      [   99.750778][ T5171] sp : ffffffc0175abae0
      [   99.751132][ T5171] x29: ffffffc0175abb80 x28: ffffffc009a2c498
      [   99.751665][ T5171] x27: 0000000000000001 x26: ffffff810cbae6e8
      [   99.752199][ T5171] x25: 0000000000400cc0 x24: ffffffc0175abc60
      [   99.752729][ T5171] x23: 0000000000000000 x22: ffffff802f558400
      [   99.753263][ T5171] x21: ffffff81d8d8ff00 x20: ffffff81020cdc00
      [   99.753795][ T5171] x19: ffffff802d110000 x18: ffffffc014fbd058
      [   99.754326][ T5171] x17: 0000000000000000 x16: 0000000000000000
      [   99.754861][ T5171] x15: 000000000000c276 x14: ffffffff9a976fda
      [   99.755392][ T5171] x13: 0000000065689089 x12: 000000000000d72e
      [   99.755923][ T5171] x11: ffffff802d110000 x10: 00000000000000e0
      [   99.756457][ T5171] x9 : 9c431600c8385d00 x8 : 0000000000000008
      [   99.756990][ T5171] x7 : 0000000000000000 x6 : 000000000000003f
      [   99.757522][ T5171] x5 : 0000000000000040 x4 : ffffffc0175abb70
      [   99.758056][ T5171] x3 : 0000000000000001 x2 : 0000000000000001
      [   99.758588][ T5171] x1 : 0000000000000000 x0 : 0000000000000000
      [   99.759123][ T5171] Call trace:
      [   99.759404][ T5171]  snd_pcm_substream_proc_status_read+0x264/0x2bc
      [   99.759958][ T5171]  snd_info_seq_show+0x54/0xa4
      [   99.760370][ T5171]  seq_read_iter+0x19c/0x7d4
      [   99.760770][ T5171]  seq_read+0xf0/0x128
      [   99.761117][ T5171]  proc_reg_read+0x100/0x1f8
      [   99.761515][ T5171]  vfs_read+0xf4/0x354
      [   99.761869][ T5171]  ksys_read+0x7c/0x148
      [   99.762226][ T5171]  __arm64_sys_read+0x20/0x30
      [   99.762625][ T5171]  el0_svc_common+0xd0/0x1e4
      [   99.763023][ T5171]  el0_svc+0x28/0x98
      [   99.763358][ T5171]  el0_sync_handler+0x8c/0xf0
      [   99.763759][ T5171]  el0_sync+0x1b8/0x1c0
      [   99.764118][ T5171] Code: d65f03c0 b9406102 17ffffae 94191565 (d42aa240)
      [   99.764715][ T5171] ---[ end trace 1eeffa3e17c58e10 ]---
      [   99.780720][ T5171] Kernel panic - not syncing: BRK handler: Fatal exception
      
      Signed-off-by: default avatarJason Zhang <jason.zhang@rock-chips.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231206013139.20506-1-jason.zhang@rock-chips.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0ff1c0f5
    • Clément Léger's avatar
      riscv: fix misaligned access handling of C.SWSP and C.SDSP · 1f1c2a34
      Clément Léger authored
      [ Upstream commit 22e0eb04 ]
      
      This is a backport of a fix that was done in OpenSBI: ec0559eb315b
      ("lib: sbi_misaligned_ldst: Fix handling of C.SWSP and C.SDSP").
      
      Unlike C.LWSP/C.LDSP, these encodings can be used with the zero
      register, so checking that the rs2 field is non-zero is unnecessary.
      
      Additionally, the previous check was incorrect since it was checking
      the immediate field of the instruction instead of the rs2 field.
      
      Fixes: 956d705d
      
       ("riscv: Unaligned load/store handling for M_MODE")
      Signed-off-by: default avatarClément Léger <cleger@rivosinc.com>
      Link: https://lore.kernel.org/r/20231103090223.702340-1-cleger@rivosinc.com
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1f1c2a34
    • Philipp Zabel's avatar
      ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt · cb3543fd
      Philipp Zabel authored
      [ Upstream commit 397caf68 ]
      
      The timer nodes declare compatibility with "fsl,imx6sx-gpt", which
      itself is compatible with "fsl,imx6dl-gpt". Switch the fallback
      compatible from "fsl,imx6sx-gpt" to "fsl,imx6dl-gpt".
      
      Fixes: 94967345
      
       ("ARM: dts: add imx7d soc dtsi file")
      Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarRoland Hieber <rhi@pengutronix.de>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cb3543fd
    • Kunwu Chan's avatar
      ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init · f337ccfa
      Kunwu Chan authored
      [ Upstream commit 1c2b1049
      
       ]
      
      devm_kasprintf() returns a pointer to dynamically allocated memory
      which can be NULL upon failure. Ensure the allocation was successful
      by checking the pointer validity.
      
      Release the id allocated in 'mmdc_pmu_init' when 'devm_kasprintf'
      return NULL
      
      Suggested-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
      Fixes: e76bdfd7
      
       ("ARM: imx: Added perf functionality to mmdc driver")
      Signed-off-by: default avatarKunwu Chan <chentao@kylinos.cn>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f337ccfa
    • Dinghao Liu's avatar
      scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle() · 04769017
      Dinghao Liu authored
      [ Upstream commit 235f2b54 ]
      
      When an error occurs in the for loop of beiscsi_init_wrb_handle(), we
      should free phwi_ctxt->be_wrbq before returning an error code to prevent
      potential memleak.
      
      Fixes: a7909b39
      
       ("[SCSI] be2iscsi: Fix dynamic CID allocation Mechanism in driver")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Link: https://lore.kernel.org/r/20231123081941.24854-1-dinghao.liu@zju.edu.cn
      Reviewed-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04769017
    • Petr Pavlu's avatar
      tracing: Fix a warning when allocating buffered events fails · a28083d4
      Petr Pavlu authored
      [ Upstream commit 34209fe8 ]
      
      Function trace_buffered_event_disable() produces an unexpected warning
      when the previous call to trace_buffered_event_enable() fails to
      allocate pages for buffered events.
      
      The situation can occur as follows:
      
      * The counter trace_buffered_event_ref is at 0.
      
      * The soft mode gets enabled for some event and
        trace_buffered_event_enable() is called. The function increments
        trace_buffered_event_ref to 1 and starts allocating event pages.
      
      * The allocation fails for some page and trace_buffered_event_disable()
        is called for cleanup.
      
      * Function trace_buffered_event_disable() decrements
        trace_buffered_event_ref back to 0, recognizes that it was the last
        use of buffered events and frees all allocated pages.
      
      * The control goes back to trace_buffered_event_enable() which returns.
        The caller of trace_buffered_event_enable() has no information that
        the function actually failed.
      
      * Some time later, the soft mode is disabled for the same event.
        Function trace_buffered_event_disable() is called. It warns on
        "WARN_ON_ONCE(!trace_buffered_event_ref)" and returns.
      
      Buffered events are just an optimization and can handle failures. Make
      trace_buffered_event_enable() exit on the first failure and left any
      cleanup later to when trace_buffered_event_disable() is called.
      
      Link: https://lore.kernel.org/all/20231127151248.7232-2-petr.pavlu@suse.com/
      Link: https://lkml.kernel.org/r/20231205161736.19663-3-petr.pavlu@suse.com
      
      Fixes: 0fc1b09f
      
       ("tracing: Use temp buffer when filtering events")
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a28083d4
    • Dinghao Liu's avatar
      ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate · 888580bf
      Dinghao Liu authored
      [ Upstream commit 29046a78 ]
      
      When wm_adsp_buffer_read() fails, we should free buf->regions.
      Otherwise, the callers of wm_adsp_buffer_populate() will
      directly free buf on failure, which makes buf->regions a leaked
      memory.
      
      Fixes: a792af69
      
       ("ASoC: wm_adsp: Refactor compress stream initialisation")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20231204074158.12026-1-dinghao.liu@zju.edu.cn
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      888580bf
    • Armin Wolf's avatar
      hwmon: (acpi_power_meter) Fix 4.29 MW bug · 9dfd8624
      Armin Wolf authored
      [ Upstream commit 1fefca6c
      
       ]
      
      The ACPI specification says:
      
      "If an error occurs while obtaining the meter reading or if the value
      is not available then an Integer with all bits set is returned"
      
      Since the "integer" is 32 bits in case of the ACPI power meter,
      userspace will get a power reading of 2^32 * 1000 miliwatts (~4.29 MW)
      in case of such an error. This was discovered due to a lm_sensors
      bugreport (https://github.com/lm-sensors/lm-sensors/issues/460).
      Fix this by returning -ENODATA instead.
      
      Tested-by: default avatar <urbinek@gmail.com>
      Fixes: de584afa
      
       ("hwmon driver for ACPI 4.0 power meters")
      Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
      Link: https://lore.kernel.org/r/20231124182747.13956-1-W_Armin@gmx.de
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9dfd8624
    • Kalesh AP's avatar
      RDMA/bnxt_re: Correct module description string · c0a42824
      Kalesh AP authored
      [ Upstream commit 422b19f7 ]
      
      The word "Driver" is repeated twice in the "modinfo bnxt_re"
      output description. Fix it.
      
      Fixes: 1ac5a404
      
       ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
      Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Link: https://lore.kernel.org/r/1700555387-6277-1-git-send-email-selvin.xavier@broadcom.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c0a42824
    • Jack Wang's avatar
      RDMA/rtrs-clt: Remove the warnings for req in_use check · 58a7281f
      Jack Wang authored
      [ Upstream commit 0c8bb6eb ]
      
      As we chain the WR during write request: memory registration,
      rdma write, local invalidate, if only the last WR fail to send due
      to send queue overrun, the server can send back the reply, while
      client mark the req->in_use to false in case of error in rtrs_clt_req
      when error out from rtrs_post_rdma_write_sg.
      
      Fixes: 6a98d71d
      
       ("RDMA/rtrs: client: main functionality")
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Reviewed-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
      Signed-off-by: default avatarGrzegorz Prajsner <grzegorz.prajsner@ionos.com>
      Link: https://lore.kernel.org/r/20231120154146.920486-8-haris.iqbal@ionos.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      58a7281f
    • Alex Bee's avatar
      arm64: dts: rockchip: Expand reg size of vdec node for RK3399 · 02916f39
      Alex Bee authored
      [ Upstream commit 35938c18 ]
      
      Expand the reg size for the vdec node to include cache/performance
      registers the rkvdec driver writes to. Also add missing clocks to the
      related power-domain.
      
      Fixes: cbd72144
      
       ("arm64: dts: rockchip: Define the rockchip Video Decoder node on rk3399")
      Signed-off-by: default avatarAlex Bee <knaerzche@gmail.com>
      Signed-off-by: default avatarJonas Karlman <jonas@kwiboo.se>
      Link: https://lore.kernel.org/r/20231105233630.3927502-10-jonas@kwiboo.se
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      02916f39
    • Sumit Garg's avatar
      tee: optee: Fix supplicant based device enumeration · a953e45e
      Sumit Garg authored
      [ Upstream commit 7269cba5
      
       ]
      
      Currently supplicant dependent optee device enumeration only registers
      devices whenever tee-supplicant is invoked for the first time. But it
      forgets to remove devices when tee-supplicant daemon stops running and
      closes its context gracefully. This leads to following error for fTPM
      driver during reboot/shutdown:
      
      [   73.466791] tpm tpm0: ftpm_tee_tpm_op_send: SUBMIT_COMMAND invoke error: 0xffff3024
      
      Fix this by adding an attribute for supplicant dependent devices so that
      the user-space service can detect and detach supplicant devices before
      closing the supplicant:
      
      $ for dev in /sys/bus/tee/devices/*; do if [[ -f "$dev/need_supplicant" && -f "$dev/driver/unbind" ]]; \
            then echo $(basename "$dev") > $dev/driver/unbind; fi done
      
      Reported-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Closes: https://github.com/OP-TEE/optee_os/issues/6094
      Fixes: 5f178bb7
      
       ("optee: enable support for multi-stage bus enumeration")
      Signed-off-by: default avatarSumit Garg <sumit.garg@linaro.org>
      Reviewed-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Acked-by: default avatarJerome Forissier <jerome.forissier@linaro.org>
      [jw: fixed up Date documentation]
      Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a953e45e
    • John Fastabend's avatar
      bpf: sockmap, updating the sg structure should also update curr · 3c852b26
      John Fastabend authored
      [ Upstream commit bb9aefde ]
      
      Curr pointer should be updated when the sg structure is shifted.
      
      Fixes: 7246d8ed
      
       ("bpf: helper to pop data from messages")
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/r/20231206232706.374377-3-john.fastabend@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3c852b26
    • Eric Dumazet's avatar
      tcp: do not accept ACK of bytes we never sent · b17a886e
      Eric Dumazet authored
      [ Upstream commit 3d501dd3 ]
      
      This patch is based on a detailed report and ideas from Yepeng Pan
      and Christian Rossow.
      
      ACK seq validation is currently following RFC 5961 5.2 guidelines:
      
         The ACK value is considered acceptable only if
         it is in the range of ((SND.UNA - MAX.SND.WND) <= SEG.ACK <=
         SND.NXT).  All incoming segments whose ACK value doesn't satisfy the
         above condition MUST be discarded and an ACK sent back.  It needs to
         be noted that RFC 793 on page 72 (fifth check) says: "If the ACK is a
         duplicate (SEG.ACK < SND.UNA), it can be ignored.  If the ACK
         acknowledges something not yet sent (SEG.ACK > SND.NXT) then send an
         ACK, drop the segment, and return".  The "ignored" above implies that
         the processing of the incoming data segment continues, which means
         the ACK value is treated as acceptable.  This mitigation makes the
         ACK check more stringent since any ACK < SND.UNA wouldn't be
         accepted, instead only ACKs that are in the range ((SND.UNA -
         MAX.SND.WND) <= SEG.ACK <= SND.NXT) get through.
      
      This can be refined for new (and possibly spoofed) flows,
      by not accepting ACK for bytes that were never sent.
      
      This greatly improves TCP security at a little cost.
      
      I added a Fixes: tag to make sure this patch will reach stable trees,
      even if the 'blamed' patch was adhering to the RFC.
      
      tp->bytes_acked was added in linux-4.2
      
      Following packetdrill test (courtesy of Yepeng Pan) shows
      the issue at hand:
      
      0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
      +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
      +0 bind(3, ..., ...) = 0
      +0 listen(3, 1024) = 0
      
      // ---------------- Handshake ------------------- //
      
      // when window scale is set to 14 the window size can be extended to
      // 65535 * (2^14) = 1073725440. Linux would accept an ACK packet
      // with ack number in (Server_ISN+1-1073725440. Server_ISN+1)
      // ,though this ack number acknowledges some data never
      // sent by the server.
      
      +0 < S 0:0(0) win 65535 <mss 1400,nop,wscale 14>
      +0 > S. 0:0(0) ack 1 <...>
      +0 < . 1:1(0) ack 1 win 65535
      +0 accept(3, ..., ...) = 4
      
      // For the established connection, we send an ACK packet,
      // the ack packet uses ack number 1 - 1073725300 + 2^32,
      // where 2^32 is used to wrap around.
      // Note: we used 1073725300 instead of 1073725440 to avoid possible
      // edge cases.
      // 1 - 1073725300 + 2^32 = 3221241997
      
      // Oops, old kernels happily accept this packet.
      +0 < . 1:1001(1000) ack 3221241997 win 65535
      
      // After the kernel fix the following will be replaced by a challenge ACK,
      // and prior malicious frame would be dropped.
      +0 > . 1:1(0) ack 1001
      
      Fixes: 354e4aa3
      
       ("tcp: RFC 5961 5.2 Blind Data Injection Attack Mitigation")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarYepeng Pan <yepeng.pan@cispa.de>
      Reported-by: default avatarChristian Rossow <rossow@cispa.de>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Link: https://lore.kernel.org/r/20231205161841.2702925-1-edumazet@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b17a886e
    • Phil Sutter's avatar
      netfilter: xt_owner: Fix for unsafe access of sk->sk_socket · f1a6a949
      Phil Sutter authored
      [ Upstream commit 7ae836a3 ]
      
      A concurrently running sock_orphan() may NULL the sk_socket pointer in
      between check and deref. Follow other users (like nft_meta.c for
      instance) and acquire sk_callback_lock before dereferencing sk_socket.
      
      Fixes: 0265ab44
      
       ("[NETFILTER]: merge ipt_owner/ip6t_owner in xt_owner")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f1a6a949
    • Yonglong Liu's avatar
      net: hns: fix fake link up on xge port · e94b6e96
      Yonglong Liu authored
      [ Upstream commit f708aba4 ]
      
      If a xge port just connect with an optical module and no fiber,
      it may have a fake link up because there may be interference on
      the hardware. This patch adds an anti-shake to avoid the problem.
      And the time of anti-shake is base on tests.
      
      Fixes: b917078c
      
       ("net: hns: Add ACPI support to check SFP present")
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
      Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e94b6e96
    • Shigeru Yoshida's avatar
      ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit() · f2535683
      Shigeru Yoshida authored
      [ Upstream commit 80d875cf ]
      
      In ipgre_xmit(), skb_pull() may fail even if pskb_inet_may_pull() returns
      true. For example, applications can use PF_PACKET to create a malformed
      packet with no IP header. This type of packet causes a problem such as
      uninit-value access.
      
      This patch ensures that skb_pull() can pull the required size by checking
      the skb with pskb_network_may_pull() before skb_pull().
      
      Fixes: c5441932
      
       ("GRE: Refactor GRE tunneling code.")
      Signed-off-by: default avatarShigeru Yoshida <syoshida@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarSuman Ghosh <sumang@marvell.com>
      Link: https://lore.kernel.org/r/20231202161441.221135-1-syoshida@redhat.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f2535683
    • Brett Creeley's avatar
      ionic: Fix dim work handling in split interrupt mode · 860d53a3
      Brett Creeley authored
      [ Upstream commit 4115ba67 ]
      
      Currently ionic_dim_work() is incorrect when in
      split interrupt mode. This is because the interrupt
      rate is only being changed for the Rx side even for
      dim running on Tx. Fix this by using the qcq from
      the container_of macro. Also, introduce some local
      variables for a bit of cleanup.
      
      Fixes: a6ff85e0
      
       ("ionic: remove intr coalesce update from napi")
      Signed-off-by: default avatarBrett Creeley <brett.creeley@amd.com>
      Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Link: https://lore.kernel.org/r/20231204192234.21017-3-shannon.nelson@amd.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      860d53a3
    • Shannon Nelson's avatar
      ionic: fix snprintf format length warning · b41bf6ac
      Shannon Nelson authored
      [ Upstream commit 0ceb3860 ]
      
      Our friendly kernel test robot has reminded us that with a new
      check we have a warning about a potential string truncation.
      In this case it really doesn't hurt anything, but it is worth
      addressing especially since there really is no reason to reserve
      so many bytes for our queue names.  It seems that cutting the
      queue name buffer length in half stops the complaint.
      
      Fixes: c06107ca
      
       ("ionic: more ionic name tweaks")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202311300201.lO8v7mKU-lkp@intel.com/
      Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
      Reviewed-by: default avatarBrett Creeley <brett.creeley@amd.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Link: https://lore.kernel.org/r/20231204192234.21017-2-shannon.nelson@amd.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b41bf6ac
    • Dinghao Liu's avatar
      net: bnxt: fix a potential use-after-free in bnxt_init_tc · 49809af8
      Dinghao Liu authored
      [ Upstream commit d007caaa ]
      
      When flow_indr_dev_register() fails, bnxt_init_tc will free
      bp->tc_info through kfree(). However, the caller function
      bnxt_init_one() will ignore this failure and call
      bnxt_shutdown_tc() on failure of bnxt_dl_register(), where
      a use-after-free happens. Fix this issue by setting
      bp->tc_info to NULL after kfree().
      
      Fixes: 627c89d0
      
       ("bnxt_en: flow_offload: offload tunnel decap rules via indirect callbacks")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Link: https://lore.kernel.org/r/20231204024004.8245-1-dinghao.liu@zju.edu.cn
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      49809af8
    • Ivan Vecera's avatar
      i40e: Fix unexpected MFS warning message · 2093072e
      Ivan Vecera authored
      [ Upstream commit 7d9f22b3 ]
      
      Commit 3a2c6ced ("i40e: Add a check to see if MFS is set") added
      a warning message that reports unexpected size of port's MFS (max
      frame size) value. This message use for the port number local
      variable 'i' that is wrong.
      In i40e_probe() this 'i' variable is used only to iterate VSIs
      to find FDIR VSI:
      
      <code>
      ...
      /* if FDIR VSI was set up, start it now */
              for (i = 0; i < pf->num_alloc_vsi; i++) {
                      if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
                              i40e_vsi_open(pf->vsi[i]);
                              break;
                      }
              }
      ...
      </code>
      
      So the warning message use for the port number index of FDIR VSI
      if this exists or pf->num_alloc_vsi if not.
      
      Fix the message by using 'pf->hw.port' for the port number.
      
      Fixes: 3a2c6ced
      
       ("i40e: Add a check to see if MFS is set")
      Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2093072e
    • Thomas Reichinger's avatar
      arcnet: restoring support for multiple Sohard Arcnet cards · d54f5a5b
      Thomas Reichinger authored
      [ Upstream commit 6b17a597 ]
      
      Probe of Sohard Arcnet cards fails,
      if 2 or more cards are installed in a system.
      See kernel log:
      [    2.759203] arcnet: arcnet loaded
      [    2.763648] arcnet:com20020: COM20020 chipset support (by David Woodhouse et al.)
      [    2.770585] arcnet:com20020_pci: COM20020 PCI support
      [    2.772295] com20020 0000:02:00.0: enabling device (0000 -> 0003)
      [    2.772354] (unnamed net_device) (uninitialized): PLX-PCI Controls
      ...
      [    3.071301] com20020 0000:02:00.0 arc0-0 (uninitialized): PCI COM20020: station FFh found at F080h, IRQ 101.
      [    3.071305] com20020 0000:02:00.0 arc0-0 (uninitialized): Using CKP 64 - data rate 2.5 Mb/s
      [    3.071534] com20020 0000:07:00.0: enabling device (0000 -> 0003)
      [    3.071581] (unnamed net_device) (uninitialized): PLX-PCI Controls
      ...
      [    3.369501] com20020 0000:07:00.0: Led pci:green:tx:0-0 renamed to pci:green:tx:0-0_1 due to name collision
      [    3.369535] com20020 0000:07:00.0: Led pci:red:recon:0-0 renamed to pci:red:recon:0-0_1 due to name collision
      [    3.370586] com20020 0000:07:00.0 arc0-0 (uninitialized): PCI COM20020: station E1h found at C000h, IRQ 35.
      [    3.370589] com20020 0000:07:00.0 arc0-0 (uninitialized): Using CKP 64 - data rate 2.5 Mb/s
      [    3.370608] com20020: probe of 0000:07:00.0 failed with error -5
      
      commit 5ef216c1
      
       ("arcnet: com20020-pci: add rotary index support")
      changes the device name of all COM20020 based PCI cards,
      even if only some cards support this:
      	snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i);
      
      The error happens because all Sohard Arcnet cards would be called arc0-0,
      since the Sohard Arcnet cards don't have a PLX rotary coder.
      I.e. EAE Arcnet cards have a PLX rotary coder,
      which sets the first decimal, ensuring unique devices names.
      
      This patch adds two new card feature flags to indicate
      which cards support LEDs and the PLX rotary coder.
      For EAE based cards the names still depend on the PLX rotary coder
      (untested, since missing EAE hardware).
      For Sohard based cards, this patch will result in devices
      being called arc0, arc1, ... (tested).
      
      Signed-off-by: default avatarThomas Reichinger <thomas.reichinger@sohard.de>
      Fixes: 5ef216c1
      
       ("arcnet: com20020-pci: add rotary index support")
      Link: https://lore.kernel.org/r/20231130113503.6812-1-thomas.reichinger@sohard.de
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d54f5a5b
    • Tong Zhang's avatar
      net: arcnet: com20020 fix error handling · effb9ad0
      Tong Zhang authored
      [ Upstream commit 6577b9a5
      
       ]
      
      There are two issues when handling error case in com20020pci_probe()
      
      1. priv might be not initialized yet when calling com20020pci_remove()
      from com20020pci_probe(), since the priv is set at the very last but it
      can jump to error handling in the middle and priv remains NULL.
      2. memory leak - the net device is allocated in alloc_arcdev but not
      properly released if error happens in the middle of the big for loop
      
      [    1.529110] BUG: kernel NULL pointer dereference, address: 0000000000000008
      [    1.531447] RIP: 0010:com20020pci_remove+0x15/0x60 [com20020_pci]
      [    1.536805] Call Trace:
      [    1.536939]  com20020pci_probe+0x3f2/0x48c [com20020_pci]
      [    1.537226]  local_pci_probe+0x48/0x80
      [    1.539918]  com20020pci_init+0x3f/0x1000 [com20020_pci]
      
      Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 6b17a597
      
       ("arcnet: restoring support for multiple Sohard Arcnet cards")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      effb9ad0
    • David Thompson's avatar
      mlxbf-bootctl: correctly identify secure boot with development keys · a657bddf
      David Thompson authored
      [ Upstream commit d4eef752 ]
      
      The secure boot state of the BlueField SoC is represented by two bits:
                      0 = production state
                      1 = secure boot enabled
                      2 = non-secure (secure boot disabled)
                      3 = RMA state
      There is also a single bit to indicate whether production keys or
      development keys are being used when secure boot is enabled.
      This single bit (specified by MLXBF_BOOTCTL_SB_DEV_MASK) only has
      meaning if secure boot state equals 1 (secure boot enabled).
      
      The secure boot states are as follows:
      - “GA secured” is when secure boot is enabled with official production keys.
      - “Secured (development)” is when secure boot is enabled with development keys.
      
      Without this fix “GA Secured” is displayed on development cards which is
      misleading. This patch updates the logic in "lifecycle_state_show()" to
      handle the case where the SoC is configured for secure boot and is using
      development keys.
      
      Fixes: 79e29cb8
      
       ("platform/mellanox: Add bootctl driver for Mellanox BlueField Soc")
      Reviewed-by: default avatarKhalil Blaiech <kblaiech@nvidia.com>
      Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Link: https://lore.kernel.org/r/20231130183515.17214-1-davthompson@nvidia.com
      Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a657bddf
    • Randy Dunlap's avatar
      hv_netvsc: rndis_filter needs to select NLS · d3f47928
      Randy Dunlap authored
      [ Upstream commit 6c89f499 ]
      
      rndis_filter uses utf8s_to_utf16s() which is provided by setting
      NLS, so select NLS to fix the build error:
      
      ERROR: modpost: "utf8s_to_utf16s" [drivers/net/hyperv/hv_netvsc.ko] undefined!
      
      Fixes: 1ce09e89
      
       ("hyperv: Add support for setting MAC from within guests")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Dexuan Cui <decui@microsoft.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Tested-by: Simon Horman <horms@kernel.org> # build-tested
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Link: https://lore.kernel.org/r/20231130055853.19069-1-rdunlap@infradead.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d3f47928
    • Subbaraya Sundeep's avatar
      octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam · 909de622
      Subbaraya Sundeep authored
      [ Upstream commit 9572c949 ]
      
      All the mailbox messages sent to AF needs to be guarded
      by mutex lock. Add the missing lock in otx2_get_pauseparam
      function.
      
      Fixes: 75f36270
      
       ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
      Signed-off-by: default avatarSubbaraya Sundeep <sbhatta@marvell.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      909de622
    • Eric Dumazet's avatar
      ipv6: fix potential NULL deref in fib6_add() · 7827c180
      Eric Dumazet authored
      [ Upstream commit 75475bb5 ]
      
      If fib6_find_prefix() returns NULL, we should silently fallback
      using fib6_null_entry regardless of RT6_DEBUG value.
      
      syzbot reported:
      
      WARNING: CPU: 0 PID: 5477 at net/ipv6/ip6_fib.c:1516 fib6_add+0x310d/0x3fa0 net/ipv6/ip6_fib.c:1516
      Modules linked in:
      CPU: 0 PID: 5477 Comm: syz-executor.0 Not tainted 6.7.0-rc2-syzkaller-00029-g9b6de136b5f0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
      RIP: 0010:fib6_add+0x310d/0x3fa0 net/ipv6/ip6_fib.c:1516
      Code: 00 48 8b 54 24 68 e8 42 22 00 00 48 85 c0 74 14 49 89 c6 e8 d5 d3 c2 f7 eb 5d e8 ce d3 c2 f7 e9 ca 00 00 00 e8 c4 d3 c2 f7 90 <0f> 0b 90 48 b8 00 00 00 00 00 fc ff df 48 8b 4c 24 38 80 3c 01 00
      RSP: 0018:ffffc90005067740 EFLAGS: 00010293
      RAX: ffffffff89cba5bc RBX: ffffc90005067ab0 RCX: ffff88801a2e9dc0
      RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
      RBP: ffffc90005067980 R08: ffffffff89cbca85 R09: 1ffff110040d4b85
      R10: dffffc0000000000 R11: ffffed10040d4b86 R12: 00000000ffffffff
      R13: 1ffff110051c3904 R14: ffff8880206a5c00 R15: ffff888028e1c820
      FS: 00007f763783c6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f763783bff8 CR3: 000000007f74d000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <TASK>
      __ip6_ins_rt net/ipv6/route.c:1303 [inline]
      ip6_route_add+0x88/0x120 net/ipv6/route.c:3847
      ipv6_route_ioctl+0x525/0x7b0 net/ipv6/route.c:4467
      inet6_ioctl+0x21a/0x270 net/ipv6/af_inet6.c:575
      sock_do_ioctl+0x152/0x460 net/socket.c:1220
      sock_ioctl+0x615/0x8c0 net/socket.c:1339
      vfs_ioctl fs/ioctl.c:51 [inline]
      __do_sys_ioctl fs/ioctl.c:871 [inline]
      __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:857
      do_syscall_x64 arch/x86/entry/common.c:51 [inline]
      do_syscall_64+0x45/0x110 arch/x86/entry/common.c:82
      
      Fixes: 7bbfe00e
      
       ("ipv6: fix general protection fault in fib6_add()")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Wei Wang <weiwan@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20231129160630.3509216-1-edumazet@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7827c180
    • Luca Ceresoli's avatar
      of: dynamic: Fix of_reconfig_get_state_change() return value documentation · ba6dc2f5
      Luca Ceresoli authored
      [ Upstream commit d7997278 ]
      
      The documented numeric return values do not match the actual returned
      values. Fix them by using the enum names instead of raw numbers.
      
      Fixes: b53a2340
      
       ("of/reconfig: Add of_reconfig_get_state_change() of notifier helper.")
      Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Link: https://lore.kernel.org/r/20231123-fix-of_reconfig_get_state_change-docs-v1-1-f51892050ff9@bootlin.com
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba6dc2f5
    • Rob Herring's avatar
      of: Add missing 'Return' section in kerneldoc comments · 08dbdacb
      Rob Herring authored
      [ Upstream commit 8c8239c2
      
       ]
      
      Many of the DT kerneldoc comments are lacking a 'Return' section. Let's
      add the section in cases we have a description of return values. There's
      still some cases where the return values are not documented.
      
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Link: https://lore.kernel.org/r/20210325164713.1296407-8-robh@kernel.org
      Stable-dep-of: d7997278
      
       ("of: dynamic: Fix of_reconfig_get_state_change() return value documentation")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      08dbdacb
    • Rob Herring's avatar
      of: Fix kerneldoc output formatting · f58e3b36
      Rob Herring authored
      [ Upstream commit 62f026f0
      
       ]
      
      The indentation of the kerneldoc comments affects the output formatting.
      Leading tabs in particular don't work, sections need to be indented
      under the section header, and several code blocks are reformatted.
      
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Link: https://lore.kernel.org/r/20210326192606.3702739-1-robh@kernel.org
      Stable-dep-of: d7997278
      
       ("of: dynamic: Fix of_reconfig_get_state_change() return value documentation")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f58e3b36
    • Lee Jones's avatar
      of: base: Fix some formatting issues and provide missing descriptions · 58ccdcc9
      Lee Jones authored
      [ Upstream commit 3637d49e
      
       ]
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/of/base.c:315: warning: Function parameter or member 'cpun' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: Function parameter or member 'prop_name' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: Function parameter or member 'cpu' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: Function parameter or member 'thread' not described in '__of_find_n_match_cpu_property'
       drivers/of/base.c:315: warning: expecting prototype for property holds the physical id of the(). Prototype was for __of_find_n_match_cpu_property() instead
       drivers/of/base.c:1139: warning: Function parameter or member 'match' not described in 'of_find_matching_node_and_match'
       drivers/of/base.c:1779: warning: Function parameter or member 'np' not described in '__of_add_property'
       drivers/of/base.c:1779: warning: Function parameter or member 'prop' not described in '__of_add_property'
       drivers/of/base.c:1800: warning: Function parameter or member 'np' not described in 'of_add_property'
       drivers/of/base.c:1800: warning: Function parameter or member 'prop' not described in 'of_add_property'
       drivers/of/base.c:1849: warning: Function parameter or member 'np' not described in 'of_remove_property'
       drivers/of/base.c:1849: warning: Function parameter or member 'prop' not described in 'of_remove_property'
       drivers/of/base.c:2137: warning: Function parameter or member 'dn' not described in 'of_console_check'
       drivers/of/base.c:2137: warning: Function parameter or member 'name' not described in 'of_console_check'
       drivers/of/base.c:2137: warning: Function parameter or member 'index' not described in 'of_console_check'
      
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: devicetree@vger.kernel.org
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Link: https://lore.kernel.org/r/20210318104036.3175910-5-lee.jones@linaro.org
      Stable-dep-of: d7997278
      
       ("of: dynamic: Fix of_reconfig_get_state_change() return value documentation")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      58ccdcc9
    • Hans de Goede's avatar
      platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code · 7db515e8
      Hans de Goede authored
      [ Upstream commit b52cbca2 ]
      
      asus-nb-wmi calls i8042_install_filter() in some cases, but it never
      calls i8042_remove_filter(). This means that a dangling pointer to
      the filter function is left after rmmod leading to crashes.
      
      Fix this by moving the i8042-filter installation to the shared
      asus-wmi code and also remove it from the shared code on driver unbind.
      
      Fixes: b5643539
      
       ("platform/x86: asus-wmi: Filter buggy scan codes on ASUS Q500A")
      Cc: Oleksij Rempel <linux@rempel-privat.de>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20231120154235.610808-2-hdegoede@redhat.com
      Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7db515e8
    • Hans de Goede's avatar
      platform/x86: asus-wmi: Simplify tablet-mode-switch handling · 5fe052b8
      Hans de Goede authored
      [ Upstream commit 1ea0d3b4
      
       ]
      
      Simplify tablet-mode-switch handling:
      1. The code is the same for all variants, the only difference is the
         dev_id and notify event code. Store the dev_id + code in struct asus_wmi
         and unify the handling
      2. Make the new unified asus_wmi_tablet_mode_get_state() check dev_id has
         been set and make it a no-op when not set. This allows calling it
         unconditionally at resume/restore time
      3. Simplify the tablet_mode_sw module-param handling, this also allows
         selecting the new lid-flip-rog type through the module-param.
      
      Cc: Luke D. Jones <luke@ljones.dev>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20220824151145.1448010-2-hdegoede@redhat.com
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5fe052b8
    • Hans de Goede's avatar
      platform/x86: asus-wmi: Simplify tablet-mode-switch probing · a113da75
      Hans de Goede authored
      [ Upstream commit c98dc61e
      
       ]
      
      The 3 different tablet-mode-switch initialization paths repeat a lot
      of the same code. Add a helper function for this.
      
      This also makes the error-handling for the kbd_dock_devid case consistent
      with the other 2 cases.
      
      Cc: Luke D. Jones <luke@ljones.dev>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20220824151145.1448010-1-hdegoede@redhat.com
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a113da75
    • Luke D. Jones's avatar
      platform/x86: asus-wmi: Add support for ROG X13 tablet mode · 68b795d0
      Luke D. Jones authored
      [ Upstream commit e397c3c4
      
       ]
      
      Add quirk for ASUS ROG X13 Flow 2-in-1 to enable tablet mode with
      lid flip (all screen rotations).
      
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20220813092753.6635-2-luke@ljones.dev
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      68b795d0
    • Luke D. Jones's avatar
      platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum · 97620a08
      Luke D. Jones authored
      [ Upstream commit 00aa8469
      
       ]
      
      Due to multiple types of tablet/lidflip, the existing code for
      handling these events is refactored to use an enum for each type.
      
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20220813092753.6635-1-luke@ljones.dev
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      97620a08
    • Luke D. Jones's avatar
      asus-wmi: Add dgpu disable method · ada7c5cc
      Luke D. Jones authored
      [ Upstream commit 98829e84
      
       ]
      
      In Windows the ASUS Armory Crate program can enable or disable the
      dGPU via a WMI call. This functions much the same as various Linux
      methods in software where the dGPU is removed from the device tree.
      
      However the WMI call saves the state of dGPU (enabled or not) and
      this then changes the dGPU visibility in Linux with no way for
      Linux users to re-enable it. We expose the WMI method so users can
      see and change the dGPU ACPI state.
      
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20210807023656.25020-3-luke@ljones.dev
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ada7c5cc
    • Hans de Goede's avatar
      platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s · 3a8fc16d
      Hans de Goede authored
      [ Upstream commit 411f48bb
      
       ]
      
      The Asus TP200s / E205SA 360 degree hinges 2-in-1 supports reporting
      SW_TABLET_MODE info through the ASUS_WMI_DEVID_LID_FLIP WMI device-id.
      Add a quirk to enable this.
      
      BugLink: https://gitlab.freedesktop.org/libinput/libinput/-/issues/639
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210812145513.39117-2-hdegoede@redhat.com
      Stable-dep-of: b52cbca2
      
       ("platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3a8fc16d