Skip to content
Snippets Groups Projects
  1. Dec 14, 2024
    • Baoquan He's avatar
      x86/mm: Fix a kdump kernel failure on SME system when CONFIG_IMA_KEXEC=y · 5fe8bcc8
      Baoquan He authored
      
      commit 8d9ffb2f upstream.
      
      The kdump kernel is broken on SME systems with CONFIG_IMA_KEXEC=y enabled.
      Debugging traced the issue back to
      
        b69a2afd ("x86/kexec: Carry forward IMA measurement log on kexec").
      
      Testing was previously not conducted on SME systems with CONFIG_IMA_KEXEC
      enabled, which led to the oversight, with the following incarnation:
      
      ...
        ima: No TPM chip found, activating TPM-bypass!
        Loading compiled-in module X.509 certificates
        Loaded X.509 cert 'Build time autogenerated kernel key: 18ae0bc7e79b64700122bb1d6a904b070fef2656'
        ima: Allocated hash algorithm: sha256
        Oops: general protection fault, probably for non-canonical address 0xcfacfdfe6660003e: 0000 [#1] PREEMPT SMP NOPTI
        CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc2+ #14
        Hardware name: Dell Inc. PowerEdge R7425/02MJ3T, BIOS 1.20.0 05/03/2023
        RIP: 0010:ima_restore_measurement_list
        Call Trace:
         <TASK>
         ? show_trace_log_lvl
         ? show_trace_log_lvl
         ? ima_load_kexec_buffer
         ? __die_body.cold
         ? die_addr
         ? exc_general_protection
         ? asm_exc_general_protection
         ? ima_restore_measurement_list
         ? vprintk_emit
         ? ima_load_kexec_buffer
         ima_load_kexec_buffer
         ima_init
         ? __pfx_init_ima
         init_ima
         ? __pfx_init_ima
         do_one_initcall
         do_initcalls
         ? __pfx_kernel_init
         kernel_init_freeable
         kernel_init
         ret_from_fork
         ? __pfx_kernel_init
         ret_from_fork_asm
         </TASK>
        Modules linked in:
        ---[ end trace 0000000000000000 ]---
        ...
        Kernel panic - not syncing: Fatal exception
        Kernel Offset: disabled
        Rebooting in 10 seconds..
      
      Adding debug printks showed that the stored addr and size of ima_kexec buffer
      are not decrypted correctly like:
      
        ima: ima_load_kexec_buffer, buffer:0xcfacfdfe6660003e, size:0xe48066052d5df359
      
      Three types of setup_data info
      
        — SETUP_EFI,
        - SETUP_IMA, and
        - SETUP_RNG_SEED
      
      are passed to the kexec/kdump kernel. Only the ima_kexec buffer
      experienced incorrect decryption. Debugging identified a bug in
      early_memremap_is_setup_data(), where an incorrect range calculation
      occurred due to the len variable in struct setup_data ended up only
      representing the length of the data field, excluding the struct's size,
      and thus leading to miscalculation.
      
      Address a similar issue in memremap_is_setup_data() while at it.
      
        [ bp: Heavily massage. ]
      
      Fixes: b3c72fc9 ("x86/boot: Introduce setup_indirect")
      Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Acked-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Cc: <stable@kernel.org>
      Link: https://lore.kernel.org/r/20240911081615.262202-3-bhe@redhat.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5fe8bcc8
    • Dragos Tatulea's avatar
      net/mlx5e: kTLS, Fix incorrect page refcounting · ffad2ac8
      Dragos Tatulea authored
      
      [ Upstream commit dd6e972c ]
      
      The kTLS tx handling code is using a mix of get_page() and
      page_ref_inc() APIs to increment the page reference. But on the release
      path (mlx5e_ktls_tx_handle_resync_dump_comp()), only put_page() is used.
      
      This is an issue when using pages from large folios: the get_page()
      references are stored on the folio page while the page_ref_inc()
      references are stored directly in the given page. On release the folio
      page will be dereferenced too many times.
      
      This was found while doing kTLS testing with sendfile() + ZC when the
      served file was read from NFS on a kernel with NFS large folios support
      (commit 49b29a57 ("nfs: add support for large folios")).
      
      Fixes: 84d1bb2b ("net/mlx5e: kTLS, Limit DUMP wqe size")
      Signed-off-by: default avatarDragos Tatulea <dtatulea@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Link: https://patch.msgid.link/20241107183527.676877-5-tariqt@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ffad2ac8
    • Mark Bloch's avatar
      net/mlx5: fs, lock FTE when checking if active · a508c74c
      Mark Bloch authored
      
      [ Upstream commit 9ca31441 ]
      
      The referenced commits introduced a two-step process for deleting FTEs:
      
      - Lock the FTE, delete it from hardware, set the hardware deletion function
        to NULL and unlock the FTE.
      - Lock the parent flow group, delete the software copy of the FTE, and
        remove it from the xarray.
      
      However, this approach encounters a race condition if a rule with the same
      match value is added simultaneously. In this scenario, fs_core may set the
      hardware deletion function to NULL prematurely, causing a panic during
      subsequent rule deletions.
      
      To prevent this, ensure the active flag of the FTE is checked under a lock,
      which will prevent the fs_core layer from attaching a new steering rule to
      an FTE that is in the process of deletion.
      
      [  438.967589] MOSHE: 2496 mlx5_del_flow_rules del_hw_func
      [  438.968205] ------------[ cut here ]------------
      [  438.968654] refcount_t: decrement hit 0; leaking memory.
      [  438.969249] WARNING: CPU: 0 PID: 8957 at lib/refcount.c:31 refcount_warn_saturate+0xfb/0x110
      [  438.970054] Modules linked in: act_mirred cls_flower act_gact sch_ingress openvswitch nsh mlx5_vdpa vringh vhost_iotlb vdpa mlx5_ib mlx5_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm ib_ipoib iw_cm ib_cm ib_uverbs ib_core zram zsmalloc fuse [last unloaded: cls_flower]
      [  438.973288] CPU: 0 UID: 0 PID: 8957 Comm: tc Not tainted 6.12.0-rc1+ #8
      [  438.973888] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
      [  438.974874] RIP: 0010:refcount_warn_saturate+0xfb/0x110
      [  438.975363] Code: 40 66 3b 82 c6 05 16 e9 4d 01 01 e8 1f 7c a0 ff 0f 0b c3 cc cc cc cc 48 c7 c7 10 66 3b 82 c6 05 fd e8 4d 01 01 e8 05 7c a0 ff <0f> 0b c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 90
      [  438.976947] RSP: 0018:ffff888124a53610 EFLAGS: 00010286
      [  438.977446] RAX: 0000000000000000 RBX: ffff888119d56de0 RCX: 0000000000000000
      [  438.978090] RDX: ffff88852c828700 RSI: ffff88852c81b3c0 RDI: ffff88852c81b3c0
      [  438.978721] RBP: ffff888120fa0e88 R08: 0000000000000000 R09: ffff888124a534b0
      [  438.979353] R10: 0000000000000001 R11: 0000000000000001 R12: ffff888119d56de0
      [  438.979979] R13: ffff888120fa0ec0 R14: ffff888120fa0ee8 R15: ffff888119d56de0
      [  438.980607] FS:  00007fe6dcc0f800(0000) GS:ffff88852c800000(0000) knlGS:0000000000000000
      [  438.983984] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  438.984544] CR2: 00000000004275e0 CR3: 0000000186982001 CR4: 0000000000372eb0
      [  438.985205] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  438.985842] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  438.986507] Call Trace:
      [  438.986799]  <TASK>
      [  438.987070]  ? __warn+0x7d/0x110
      [  438.987426]  ? refcount_warn_saturate+0xfb/0x110
      [  438.987877]  ? report_bug+0x17d/0x190
      [  438.988261]  ? prb_read_valid+0x17/0x20
      [  438.988659]  ? handle_bug+0x53/0x90
      [  438.989054]  ? exc_invalid_op+0x14/0x70
      [  438.989458]  ? asm_exc_invalid_op+0x16/0x20
      [  438.989883]  ? refcount_warn_saturate+0xfb/0x110
      [  438.990348]  mlx5_del_flow_rules+0x2f7/0x340 [mlx5_core]
      [  438.990932]  __mlx5_eswitch_del_rule+0x49/0x170 [mlx5_core]
      [  438.991519]  ? mlx5_lag_is_sriov+0x3c/0x50 [mlx5_core]
      [  438.992054]  ? xas_load+0x9/0xb0
      [  438.992407]  mlx5e_tc_rule_unoffload+0x45/0xe0 [mlx5_core]
      [  438.993037]  mlx5e_tc_del_fdb_flow+0x2a6/0x2e0 [mlx5_core]
      [  438.993623]  mlx5e_flow_put+0x29/0x60 [mlx5_core]
      [  438.994161]  mlx5e_delete_flower+0x261/0x390 [mlx5_core]
      [  438.994728]  tc_setup_cb_destroy+0xb9/0x190
      [  438.995150]  fl_hw_destroy_filter+0x94/0xc0 [cls_flower]
      [  438.995650]  fl_change+0x11a4/0x13c0 [cls_flower]
      [  438.996105]  tc_new_tfilter+0x347/0xbc0
      [  438.996503]  ? ___slab_alloc+0x70/0x8c0
      [  438.996929]  rtnetlink_rcv_msg+0xf9/0x3e0
      [  438.997339]  ? __netlink_sendskb+0x4c/0x70
      [  438.997751]  ? netlink_unicast+0x286/0x2d0
      [  438.998171]  ? __pfx_rtnetlink_rcv_msg+0x10/0x10
      [  438.998625]  netlink_rcv_skb+0x54/0x100
      [  438.999020]  netlink_unicast+0x203/0x2d0
      [  438.999421]  netlink_sendmsg+0x1e4/0x420
      [  438.999820]  __sock_sendmsg+0xa1/0xb0
      [  439.000203]  ____sys_sendmsg+0x207/0x2a0
      [  439.000600]  ? copy_msghdr_from_user+0x6d/0xa0
      [  439.001072]  ___sys_sendmsg+0x80/0xc0
      [  439.001459]  ? ___sys_recvmsg+0x8b/0xc0
      [  439.001848]  ? generic_update_time+0x4d/0x60
      [  439.002282]  __sys_sendmsg+0x51/0x90
      [  439.002658]  do_syscall_64+0x50/0x110
      [  439.003040]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
      
      Fixes: 718ce4d6 ("net/mlx5: Consolidate update FTE for all removal changes")
      Fixes: cefc2355 ("net/mlx5: Fix FTE cleanup")
      Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Link: https://patch.msgid.link/20241107183527.676877-4-tariqt@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a508c74c
    • Jakub Kicinski's avatar
      netlink: terminate outstanding dump on socket close · 6e3f2c51
      Jakub Kicinski authored
      
      [ Upstream commit 1904fb9e ]
      
      Netlink supports iterative dumping of data. It provides the families
      the following ops:
       - start - (optional) kicks off the dumping process
       - dump  - actual dump helper, keeps getting called until it returns 0
       - done  - (optional) pairs with .start, can be used for cleanup
      The whole process is asynchronous and the repeated calls to .dump
      don't actually happen in a tight loop, but rather are triggered
      in response to recvmsg() on the socket.
      
      This gives the user full control over the dump, but also means that
      the user can close the socket without getting to the end of the dump.
      To make sure .start is always paired with .done we check if there
      is an ongoing dump before freeing the socket, and if so call .done.
      
      The complication is that sockets can get freed from BH and .done
      is allowed to sleep. So we use a workqueue to defer the call, when
      needed.
      
      Unfortunately this does not work correctly. What we defer is not
      the cleanup but rather releasing a reference on the socket.
      We have no guarantee that we own the last reference, if someone
      else holds the socket they may release it in BH and we're back
      to square one.
      
      The whole dance, however, appears to be unnecessary. Only the user
      can interact with dumps, so we can clean up when socket is closed.
      And close always happens in process context. Some async code may
      still access the socket after close, queue notification skbs to it etc.
      but no dumps can start, end or otherwise make progress.
      
      Delete the workqueue and flush the dump state directly from the release
      handler. Note that further cleanup is possible in -next, for instance
      we now always call .done before releasing the main module reference,
      so dump doesn't have to take a reference of its own.
      
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Fixes: ed5d7788 ("netlink: Do not schedule work from sk_destruct")
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241106015235.2458807-1-kuba@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6e3f2c51
    • Gabor Juhos's avatar
      clk: qcom: gcc-qcs404: fix initial rate of GPLL3 · b5214ca7
      Gabor Juhos authored
      commit 36d20224 upstream.
      
      The comment before the config of the GPLL3 PLL says that the
      PLL should run at 930 MHz. In contrary to this, calculating
      the frequency from the current configuration values by using
      19.2 MHz as input frequency defined in 'qcs404.dtsi', it gives
      921.6 MHz:
      
        $ xo=19200000; l=48; alpha=0x0; alpha_hi=0x0
        $ echo "$xo * ($((l)) + $(((alpha_hi << 32 | alpha) >> 8)) / 2^32)" | bc -l
        921600000.00000000000000000000
      
      Set 'alpha_hi' in the configuration to a value used in downstream
      kernels [1][2] in order to get the correct output rate:
      
        $ xo=19200000; l=48; alpha=0x0; alpha_hi=0x70
        $ echo "$xo * ($((l)) + $(((alpha_hi << 32 | alpha) >> 8)) / 2^32)" | bc -l
        930000000.00000000000000000000
      
      The change is based on static code analysis, compile tested only.
      
      [1] https://git.codelinaro.org/clo/la/kernel/msm-5.4/-/blob/kernel.lnx.5.4.r56-rel/drivers/clk/qcom/gcc-qcs404.c?ref_type=heads#L335
      [2} https://git.codelinaro.org/clo/la/kernel/msm-5.15/-/blob/kernel.lnx.5.15.r49-rel/drivers/clk/qcom/gcc-qcs404.c?ref_type=heads#L127
      
      
      
      Cc: stable@vger.kernel.org
      Fixes: 652f1813 ("clk: qcom: gcc: Add global clock controller driver for QCS404")
      Signed-off-by: default avatarGabor Juhos <j4g8y7@gmail.com>
      Link: https://lore.kernel.org/r/20241022-fix-gcc-qcs404-gpll3-v1-1-c4d30d634d19@gmail.com
      
      
      Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b5214ca7
    • Michal Vokáč's avatar
      leds: lp55xx: Remove redundant test for invalid channel number · 3e7f8456
      Michal Vokáč authored
      
      commit 09b1ef98 upstream.
      
      Since commit 92a81562 ("leds: lp55xx: Add multicolor framework
      support to lp55xx") there are two subsequent tests if the chan_nr
      (reg property) is in valid range. One in the lp55xx_init_led()
      function and one in the lp55xx_parse_common_child() function that
      was added with the mentioned commit.
      
      There are two issues with that.
      
      First is in the lp55xx_parse_common_child() function where the reg
      property is tested right after it is read from the device tree.
      Test for the upper range is not correct though. Valid reg values are
      0 to (max_channel - 1) so it should be >=.
      
      Second issue is that in case the parsed value is out of the range
      the probe just fails and no error message is shown as the code never
      reaches the second test that prints and error message.
      
      Remove the test form lp55xx_parse_common_child() function completely
      and keep the one in lp55xx_init_led() function to deal with it.
      
      Fixes: 92a81562 ("leds: lp55xx: Add multicolor framework support to lp55xx")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichal Vokáč <michal.vokac@ysoft.com>
      Link: https://lore.kernel.org/r/20241017150812.3563629-1-michal.vokac@ysoft.com
      
      
      Signed-off-by: default avatarLee Jones <lee@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e7f8456
    • guoweikang's avatar
      ftrace: Fix regression with module command in stack_trace_filter · 5dabb7af
      guoweikang authored
      commit 45af52e7 upstream.
      
      When executing the following command:
      
          # echo "write*:mod:ext3" > /sys/kernel/tracing/stack_trace_filter
      
      The current mod command causes a null pointer dereference. While commit
      0f179765 ("ftrace: Fix regression with module command in stack_trace_filter")
      has addressed part of the issue, it left a corner case unhandled, which still
      results in a kernel crash.
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Link: https://lore.kernel.org/20241120052750.275463-1-guoweikang.kernel@gmail.com
      
      
      Fixes: 04ec7bb6 ("tracing: Have the trace_array hold the list of registered func probes");
      Signed-off-by: default avatarguoweikang <guoweikang.kernel@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5dabb7af
    • Vasiliy Kovalev's avatar
      ovl: Filter invalid inodes with missing lookup function · 5f86e79c
      Vasiliy Kovalev authored
      
      commit c8b359dd upstream.
      
      Add a check to the ovl_dentry_weird() function to prevent the
      processing of directory inodes that lack the lookup function.
      This is important because such inodes can cause errors in overlayfs
      when passed to the lowerstack.
      
      Reported-by: default avatar <syzbot+a8c9d476508bd14a90e5@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?extid=a8c9d476508bd14a90e5
      
      
      Suggested-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
      Link: https://lore.kernel.org/linux-unionfs/CAJfpegvx-oS9XGuwpJx=Xe28_jzWx5eRo1y900_ZzWY+=gGzUg@mail.gmail.com/
      
      
      Signed-off-by: default avatarVasiliy Kovalev <kovalev@altlinux.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f86e79c
    • Ricardo Ribalda's avatar
      media: uvcvideo: Stop stream during unregister · 2cc30545
      Ricardo Ribalda authored
      
      commit c9ec6f17 upstream.
      
      uvc_unregister_video() can be called asynchronously from
      uvc_disconnect(). If the device is still streaming when that happens, a
      plethora of race conditions can occur.
      
      Make sure that the device has stopped streaming before exiting this
      function.
      
      If the user still holds handles to the driver's file descriptors, any
      ioctl will return -ENODEV from the v4l2 core.
      
      This change makes uvc more consistent with the rest of the v4l2 drivers
      using the vb2_fop_* and vb2_ioctl_* helpers.
      
      This driver (and many other usb drivers) always had this problem, but it
      wasn't possible to easily fix this until the vb2_video_unregister_device()
      helper was added. So the Fixes tag points to the creation of that helper.
      
      Reviewed-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
      Suggested-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Fixes: f729ef57 ("media: videobuf2-v4l2.c: add vb2_video_unregister_device helper function")
      Cc: stable@vger.kernel.org # 5.10.x
      [hverkuil: add note regarding Fixes version]
      Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2cc30545
    • Gaosheng Cui's avatar
      media: platform: allegro-dvt: Fix possible memory leak in allocate_buffers_internal() · 74a65313
      Gaosheng Cui authored
      
      commit 0f514068 upstream.
      
      The buffer in the loop should be released under the exception path,
      otherwise there may be a memory leak here.
      
      To mitigate this, free the buffer when allegro_alloc_buffer fails.
      
      Fixes: f20387df ("media: allegro: add Allegro DVT video IP core driver")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGaosheng Cui <cuigaosheng1@huawei.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      74a65313
    • Jinjie Ruan's avatar
      media: gspca: ov534-ov772x: Fix off-by-one error in set_frame_rate() · da56bb85
      Jinjie Ruan authored
      
      commit d2842dec upstream.
      
      In set_frame_rate(), select a rate in rate_0 or rate_1 by checking
      sd->frame_rate >= r->fps in a loop, but the loop condition terminates when
      the index reaches zero, which fails to check the last elememt in rate_0 or
      rate_1.
      
      Check for >= 0 so that the last one in rate_0 or rate_1 is also checked.
      
      Fixes: 189d92af ("V4L/DVB (13422): gspca - ov534: ov772x changes from Richard Kaswy.")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da56bb85
    • Jinjie Ruan's avatar
      media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled · 580d1e5c
      Jinjie Ruan authored
      
      commit 2a20869f upstream.
      
      It is not valid to call pm_runtime_set_suspended() for devices
      with runtime PM enabled because it returns -EAGAIN if it is enabled
      already and working. So, call pm_runtime_disable() before to fix it.
      
      Cc: stable@vger.kernel.org
      Fixes: af2c3834 ("[media] media: venus: adding core part and helper functions")
      Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
      Reviewed-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Acked-by: default avatarStanimir Varbanov <stanimir.k.varbanov@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      580d1e5c
    • Li Zetao's avatar
      media: ts2020: fix null-ptr-deref in ts2020_probe() · 5a53f97c
      Li Zetao authored
      
      commit 4a058b34 upstream.
      
      KASAN reported a null-ptr-deref issue when executing the following
      command:
      
        # echo ts2020 0x20 > /sys/bus/i2c/devices/i2c-0/new_device
          KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
          CPU: 53 UID: 0 PID: 970 Comm: systemd-udevd Not tainted 6.12.0-rc2+ #24
          Hardware name: QEMU Standard PC (Q35 + ICH9, 2009)
          RIP: 0010:ts2020_probe+0xad/0xe10 [ts2020]
          RSP: 0018:ffffc9000abbf598 EFLAGS: 00010202
          RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffffc0714809
          RDX: 0000000000000002 RSI: ffff88811550be00 RDI: 0000000000000010
          RBP: ffff888109868800 R08: 0000000000000001 R09: fffff52001577eb6
          R10: 0000000000000000 R11: ffffc9000abbff50 R12: ffffffffc0714790
          R13: 1ffff92001577eb8 R14: ffffffffc07190d0 R15: 0000000000000001
          FS:  00007f95f13b98c0(0000) GS:ffff888149280000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: 0000555d2634b000 CR3: 0000000152236000 CR4: 00000000000006f0
          DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
          DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
          Call Trace:
           <TASK>
           ts2020_probe+0xad/0xe10 [ts2020]
           i2c_device_probe+0x421/0xb40
           really_probe+0x266/0x850
          ...
      
      The cause of the problem is that when using sysfs to dynamically register
      an i2c device, there is no platform data, but the probe process of ts2020
      needs to use platform data, resulting in a null pointer being accessed.
      
      Solve this problem by adding checks to platform data.
      
      Fixes: dc245a5f ("[media] ts2020: implement I2C client bindings")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarLi Zetao <lizetao1@huawei.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a53f97c
    • Alexander Shiyan's avatar
      media: i2c: tc358743: Fix crash in the probe error path when using polling · 5c9ab34c
      Alexander Shiyan authored
      
      commit 869f38ae upstream.
      
      If an error occurs in the probe() function, we should remove the polling
      timer that was alarmed earlier, otherwise the timer is called with
      arguments that are already freed, which results in a crash.
      
      ------------[ cut here ]------------
      WARNING: CPU: 3 PID: 0 at kernel/time/timer.c:1830 __run_timers+0x244/0x268
      Modules linked in:
      CPU: 3 UID: 0 PID: 0 Comm: swapper/3 Not tainted 6.11.0 #226
      Hardware name: Diasom DS-RK3568-SOM-EVB (DT)
      pstate: 804000c9 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : __run_timers+0x244/0x268
      lr : __run_timers+0x1d4/0x268
      sp : ffffff80eff2baf0
      x29: ffffff80eff2bb50 x28: 7fffffffffffffff x27: ffffff80eff2bb00
      x26: ffffffc080f669c0 x25: ffffff80efef6bf0 x24: ffffff80eff2bb00
      x23: 0000000000000000 x22: dead000000000122 x21: 0000000000000000
      x20: ffffff80efef6b80 x19: ffffff80041c8bf8 x18: ffffffffffffffff
      x17: ffffffc06f146000 x16: ffffff80eff27dc0 x15: 000000000000003e
      x14: 0000000000000000 x13: 00000000000054da x12: 0000000000000000
      x11: 00000000000639c0 x10: 000000000000000c x9 : 0000000000000009
      x8 : ffffff80eff2cb40 x7 : ffffff80eff2cb40 x6 : ffffff8002bee480
      x5 : ffffffc080cb2220 x4 : ffffffc080cb2150 x3 : 00000000000f4240
      x2 : 0000000000000102 x1 : ffffff80eff2bb00 x0 : ffffff80041c8bf0
      Call trace:
       __run_timers+0x244/0x268
       timer_expire_remote+0x50/0x68
       tmigr_handle_remote+0x388/0x39c
       run_timer_softirq+0x38/0x44
       handle_softirqs+0x138/0x298
       __do_softirq+0x14/0x20
       ____do_softirq+0x10/0x1c
       call_on_irq_stack+0x24/0x4c
       do_softirq_own_stack+0x1c/0x2c
       irq_exit_rcu+0x9c/0xcc
       el1_interrupt+0x48/0xc0
       el1h_64_irq_handler+0x18/0x24
       el1h_64_irq+0x7c/0x80
       default_idle_call+0x34/0x68
       do_idle+0x23c/0x294
       cpu_startup_entry+0x38/0x3c
       secondary_start_kernel+0x128/0x160
       __secondary_switched+0xb8/0xbc
      ---[ end trace 0000000000000000 ]---
      
      Fixes: 4e66a52a ("[media] tc358743: Add support for platforms without IRQ line")
      Signed-off-by: default avatarAlexander Shiyan <eagle.alexander923@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5c9ab34c
    • Dragan Simic's avatar
      arm64: dts: allwinner: pinephone: Add mount matrix to accelerometer · b240a047
      Dragan Simic authored
      commit 2496b2aa upstream.
      
      The way InvenSense MPU-6050 accelerometer is mounted on the user-facing side
      of the Pine64 PinePhone mainboard, which makes it rotated 90 degrees counter-
      clockwise, [1] requires the accelerometer's x- and y-axis to be swapped, and
      the direction of the accelerometer's y-axis to be inverted.
      
      Rectify this by adding a mount-matrix to the accelerometer definition in the
      Pine64 PinePhone dtsi file.
      
      [1] https://files.pine64.org/doc/PinePhone/PinePhone%20mainboard%20bottom%20placement%20v1.1%2020191031.pdf
      
      
      
      Fixes: 91f480d4 ("arm64: dts: allwinner: Add initial support for Pine64 PinePhone")
      Cc: stable@vger.kernel.org
      Suggested-by: default avatarOndrej Jirman <megi@xff.cz>
      Suggested-by: default avatarAndrey Skvortsov <andrej.skvortzov@gmail.com>
      Signed-off-by: default avatarDragan Simic <dsimic@manjaro.org>
      Reviewed-by: default avatarAndrey Skvortsov <andrej.skvortzov@gmail.com>
      Link: https://patch.msgid.link/129f0c754d071cca1db5d207d9d4a7bd9831dff7.1726773282.git.dsimic@manjaro.org
      
      
      [wens@csie.org: Replaced Helped-by with Suggested-by]
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b240a047
  2. Nov 17, 2024
Loading