5.4.160-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 237/355 drm/msm: Fix potential NULL dereference in DPU SSPP
In reply to Greg Kroah-HartmanFrom: Jessica Zhang <[email protected]>
[ Upstream commit 8bf71a5719b6cc5b6ba358096081e5d50ea23ab6 ]
Move initialization of sblk in _sspp_subblk_offset() after NULL check to avoid potential NULL pointer dereference.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +5 -3
@@ -137,11 +137,13 @@ static int _sspp_subblk_offset(struct dpu_hw_pipe *ctx, u32 *idx) {int rc =0 ; -const struct dpu_sspp_sub_blks *sblk = ctx->cap->sblk; +const struct dpu_sspp_sub_blks *sblk; -if (!ctx) +if (!ctx || !ctx->cap || !ctx->cap->sblk)return -EINVAL ; + sblk = ctx->cap->sblk; +switch (s_id) {case DPU_SSPP_SRC : *idx = sblk->src_blk.base;
@@ -404,7 +406,7 @@ static void _dpu_hw_sspp_setup_scaler3(struct dpu_hw_pipe *ctx, (void )pe;if (_sspp_subblk_offset (ctx,DPU_SSPP_SCALER_QSEED3 , &idx) || !sspp - || !scaler3_cfg || !ctx || !ctx->cap || !ctx->cap->sblk) + || !scaler3_cfg)return ; dpu_hw_setup_scaler3(&ctx->hw, scaler3_cfg, idx,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 226/355 net: stream: dont purge sk_error_queue in sk_stream_kill_queues()
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 24bcbe1cc69fa52dc4f7b5b2456678ed464724d8 ]
sk_stream_kill_queues() can be called on close when there are still outstanding skbs to transmit. Those skbs may try to queue notifications to the error queue (e.g. timestamps). If sk_stream_kill_queues() purges the queue without taking its lock the queue may get corrupted, and skbs leaked.
This shows up as a warning about an rmem leak:
WARNING: CPU: 24 PID: 0 at net/ipv4/af_inet.c:154 inet_sock_destruct+0x...
The leak is always a multiple of 0x300 bytes (the value is in %rax on my builds, so RAX: 0000000000000300). 0x300 is truesize of an empty sk_buff. Indeed if we dump the socket state at the time of the warning the sk_error_queue is often (but not always) corrupted. The ->next pointer points back at the list head, but not the ->prev pointer. Indeed we can find the leaked skb by scanning the kernel memory for something that looks like an skb with ->sk = socket in question, and ->truesize = 0x300. The contents of ->cb[] of the skb confirms the suspicion that it is indeed a timestamp notification (as generated in __skb_complete_tx_timestamp()).
Removing purging of sk_error_queue should be okay, since inet_sock_destruct() does it again once all socket refs are gone. Eric suggests this may cause sockets that go thru disconnect() to maintain notifications from the previous incarnations of the socket, but that should be okay since the race was there anyway, and disconnect() is not exactly dependable.
Thanks to Jonathan Lemon and Omar Sandoval for help at various stages of tracing the issue.
--- net/core/stream.c | 3 --- 1 file changed, 3 deletions(-)
net/core/stream.c +0 -3
@@ -195,9 +195,6 @@ void sk_stream_kill_queues(struct sock *sk)/* First the read buffer. */ __skb_queue_purge (&sk->sk_receive_queue); -/* Next, the error queue. */ -__skb_queue_purge (&sk->sk_error_queue); -/* Next, the write queue. */ WARN_ON (!skb_queue_empty (&sk->sk_write_queue));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 175/355 x86/hyperv: Protect set_hv_tscchange_cb() against getting preempted
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 285f68afa8b20f752b0b7194d54980b5e0e27b75 ]
The following issue is observed with CONFIG_DEBUG_PREEMPT when KVM loads:
KVM: vmx: using Hyper-V Enlightened VMCS
BUG: using smp_processor_id() in preemptible [00000000] code: systemd-udevd/488 caller is set_hv_tscchange_cb+0x16/0x80 CPU: 1 PID: 488 Comm: systemd-udevd Not tainted 5.15.0-rc5+ #396 Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.0 12/17/2019 Call Trace: dump_stack_lvl+0x6a/0x9a check_preemption_disabled+0xde/0xe0 ? kvm_gen_update_masterclock+0xd0/0xd0 [kvm] set_hv_tscchange_cb+0x16/0x80 kvm_arch_init+0x23f/0x290 [kvm] kvm_init+0x30/0x310 [kvm] vmx_init+0xaf/0x134 [kvm_intel] ...
set_hv_tscchange_cb() can get preempted in between acquiring smp_processor_id() and writing to HV_X64_MSR_REENLIGHTENMENT_CONTROL. This is not an issue by itself: HV_X64_MSR_REENLIGHTENMENT_CONTROL is a partition-wide MSR and it doesn't matter which particular CPU will be used to receive reenlightenment notifications. The only real problem can (in theory) be observed if the CPU whose id was acquired with smp_processor_id() goes offline before we manage to write to the MSR, the logic in hv_cpu_die() won't be able to reassign it correctly.
--- arch/x86/hyperv/hv_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/hyperv/hv_init.c +4 -1
@@ -155,7 +155,6 @@ void set_hv_tscchange_cb(void (*cb)(void))struct hv_reenlightenment_control re_ctrl = { .vector =HYPERV_REENLIGHTENMENT_VECTOR , .enabled =1 , - .target_vp = hv_vp_index[smp_processor_id ()] };struct hv_tsc_emulation_control emu_ctrl = {.enabled =1 };
@@ -169,8 +168,12 @@ void set_hv_tscchange_cb(void (*cb)(void))/* Make sure callback is registered before we write to MSRs */ wmb (); + re_ctrl.target_vp = hv_vp_index[get_cpu ()]; +wrmsrl (HV_X64_MSR_REENLIGHTENMENT_CONTROL , *((u64 *)&re_ctrl));wrmsrl (HV_X64_MSR_TSC_EMULATION_CONTROL , *((u64 *)&emu_ctrl)); + +put_cpu (); }EXPORT_SYMBOL_GPL (set_hv_tscchange_cb);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 177/355 task_stack: Fix end_of_stack() for architectures with upwards-growing stack
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 9cc2fa4f4a92ccc6760d764e7341be46ee8aaaa1 ]
The function end_of_stack() returns a pointer to the last entry of a stack. For architectures like parisc where the stack grows upwards return the pointer to the highest address in the stack.
Without this change I faced a crash on parisc, because the stackleak functionality wrote STACKLEAK_POISON to the lowest address and thus overwrote the first 4 bytes of the task_struct which included the TIF_FLAGS.
--- include/linux/sched/task_stack.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/sched/task_stack.h +4 -0
@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task)static inline unsigned long *end_of_stack (const struct task_struct *task) { +#ifdef CONFIG_STACK_GROWSUP +return (unsigned long *)((unsigned long )task->stack +THREAD_SIZE ) -1 ; +#else return task->stack; +#endif }#elif !defined(__HAVE_THREAD_FUNCTIONS)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 194/355 drm/amdgpu: fix warning for overflow check
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 335aea75b0d95518951cad7c4c676e6f1c02c150 ]
The overflow check in amdgpu_bo_list_create() causes a warning with clang-14 on 64-bit architectures, since the limit can never be exceeded.
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c:74:18: error: result of comparison of constant 256204778801521549 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list))
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The check remains useful for 32-bit architectures, so just avoid the warning by using size_t as the type for the count.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +1 -1
@@ -61,7 +61,7 @@ static void amdgpu_bo_list_free(struct kref *ref)int amdgpu_bo_list_create (struct amdgpu_device *adev,struct drm_file *filp,struct drm_amdgpu_bo_list_entry *info, -unsigned num_entries,struct amdgpu_bo_list **result) +size_t num_entries,struct amdgpu_bo_list **result) {unsigned last_entry =0 , first_userptr = num_entries;struct amdgpu_bo_list_entry *array;
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h +1 -1
@@ -60,7 +60,7 @@ int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in,int amdgpu_bo_list_create (struct amdgpu_device *adev,struct drm_file *filp,struct drm_amdgpu_bo_list_entry *info, -unsigned num_entries, +size_t num_entries,struct amdgpu_bo_list **list); static inline struct amdgpu_bo_list_entry *
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 236/355 clocksource/drivers/timer-ti-dm: Select TIMER_OF
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit eda9a4f7af6ee47e9e131f20e4f8a41a97379293 ]
When building OMAP_DM_TIMER without TIMER_OF, there are orphan sections due to the use of TIMER_OF_DELCARE() without CONFIG_TIMER_OF. Select CONFIG_TIMER_OF when enaling OMAP_DM_TIMER:
arm-linux-gnueabi-ld: warning: orphan section __timer_of_table' from drivers/clocksource/timer-ti-dm-systimer.o' being placed in section `__timer_of_table'
--- drivers/clocksource/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/clocksource/Kconfig +1 -0
@@ -24,6 +24,7 @@ config I8253_LOCK config OMAP_DM_TIMER bool + select TIMER_OF config CLKBLD_I8253 def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 178/355 parisc/unwind: fix unwinder when CONFIG_64BIT is enabled
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 8e0ba125c2bf1030af3267058019ba86da96863f ]
With 64 bit kernels unwind_special() is not working because it compares the pc to the address of the function descriptor. Add a helper function that compares pc with the dereferenced address. This fixes all of the backtraces on my c8000. Without this changes, a lot of backtraces are missing in kdb or the show-all-tasks command from /proc/sysrq-trigger.
--- arch/parisc/kernel/unwind.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
arch/parisc/kernel/unwind.c +14 -7
@@ -21,6 +21,8 @@#include <asm/ptrace.h> #include <asm/unwind.h> +#include <asm/switch_to.h> +#include <asm/sections.h> /* #define DEBUG 1 */ #ifdef DEBUG
@@ -203,6 +205,11 @@ int __init unwind_init(void)return 0 ; } +static bool pc_is_kernel_fn (unsigned long pc,void *fn) +{ +return (unsigned long )dereference_kernel_function_descriptor (fn) == pc; +} +static int unwind_special (struct unwind_frame_info *info,unsigned long pc,int frame_size) {/*
@@ -221,7 +228,7 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intextern void *const _call_on_stack;#endif /* CONFIG_IRQSTACKS */ -if (pc == (unsigned long ) &handle_interruption) { +if (pc_is_kernel_fn (pc, handle_interruption)) {struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size -PT_SZ_ALGN );dbg ("Unwinding through handle_interruption()\n" ); info->prev_sp = regs->gr[30 ];
@@ -229,13 +236,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &ret_from_kernel_thread || - pc == (unsigned long ) &syscall_exit) { +if (pc_is_kernel_fn (pc, ret_from_kernel_thread) || +pc_is_kernel_fn (pc, syscall_exit)) { info->prev_sp = info->prev_ip =0 ;return 1 ; } -if (pc == (unsigned long ) &intr_return) { +if (pc_is_kernel_fn (pc, intr_return)) {struct pt_regs *regs;dbg ("Found intr_return()\n" );
@@ -246,20 +253,20 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &_switch_to_ret) { +if (pc_is_kernel_fn (pc, _switch_to) || +pc_is_kernel_fn (pc, _switch_to_ret)) { info->prev_sp = info->sp -CALLEE_SAVE_FRAME_SIZE ; info->prev_ip = *(unsigned long *)(info->prev_sp -RP_OFFSET );return 1 ; }#ifdef CONFIG_IRQSTACKS -if (pc == (unsigned long ) &_call_on_stack) { +if (pc_is_kernel_fn (pc, _call_on_stack)) { info->prev_sp = *(unsigned long *)(info->sp -FRAME_SIZE -REG_SZ ); info->prev_ip = *(unsigned long *)(info->sp -FRAME_SIZE -RP_OFFSET );return 1 ; }#endif -return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 234/355 nvme-rdma: fix error code in nvme_rdma_setup_ctrl
In reply to Greg Kroah-HartmanFrom: Max Gurtovoy <[email protected]>
[ Upstream commit 09748122009aed7bfaa7acc33c10c083a4758322 ]
In case that icdoff is not zero or mandatory keyed sgls are not supported by the NVMe/RDMA target, we'll go to error flow but we'll return 0 to the caller. Fix it by returning an appropriate error code.
--- drivers/nvme/host/rdma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/rdma.c +2 -0
@@ -1019,11 +1019,13 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)return ret;if (ctrl->ctrl.icdoff) { + ret = -EOPNOTSUPP ;dev_err (ctrl->ctrl.device,"icdoff is not supported!\n" ); goto destroy_admin; }if (!(ctrl->ctrl.sgls & (1 <<2 ))) { + ret = -EOPNOTSUPP ;dev_err (ctrl->ctrl.device,"Mandatory keyed sgls are not supported!\n" ); goto destroy_admin;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 141/355 media: rcar-csi2: Add checking to rcsi2_start_receiver()
In reply to Greg Kroah-HartmanFrom: Nadezda Lutovinova <[email protected]>
[ Upstream commit fc41665498332ad394b7db37f23e9394096ddc71 ]
If rcsi2_code_to_fmt() return NULL, then null pointer dereference occurs in the next cycle. That should not be possible now but adding checking protects from future bugs.
The patch adds checking if format is NULL.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/rcar-vin/rcar-csi2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/rcar-vin/rcar-csi2.c +2 -0
@@ -488,6 +488,8 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv)/* Code is validated in set_fmt. */ format =rcsi2_code_to_fmt (priv->mf.code); +if (!format) +return -EINVAL ;/* * Enable all supported CSI-2 channels with virtual channel and
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 206/355 crypto: ecc - fix CRYPTO_DEFAULT_RNG dependency
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 38aa192a05f22f9778f9420e630f0322525ef12e ]
The ecc.c file started out as part of the ECDH algorithm but got moved out into a standalone module later. It does not build without CRYPTO_DEFAULT_RNG, so now that other modules are using it as well we can run into this link error:
aarch64-linux-ld: ecc.c:(.text+0xfc8): undefined reference to `crypto_default_rng'
aarch64-linux-ld: ecc.c:(.text+0xff4): undefined reference to `crypto_put_default_rng'
Move the 'select CRYPTO_DEFAULT_RNG' statement into the correct symbol.
--- crypto/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/Kconfig +1 -1
@@ -242,12 +242,12 @@ config CRYPTO_DH config CRYPTO_ECC tristate + select CRYPTO_RNG_DEFAULT config CRYPTO_ECDH tristate "ECDH algorithm" select CRYPTO_ECC select CRYPTO_KPP - select CRYPTO_RNG_DEFAULT help Generic implementation of the ECDH algorithm
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 170/355 ARM: 9136/1: ARMv7-M uses BE-8, not BE-32
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 345dac33f58894a56d17b92a41be10e16585ceff ]
When configuring the kernel for big-endian, we set either BE-8 or BE-32 based on the CPU architecture level. Until linux-4.4, we did not have any ARMv7-M platform allowing big-endian builds, but now i.MX/Vybrid is in that category, adn we get a build error because of this:
arch/arm/kernel/module-plts.c: In function 'get_module_plt':arch/arm/kernel/module-plts.c:60:46: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
This comes down to picking the wrong default, ARMv7-M uses BE8 like ARMv7-A does. Changing the default gets the kernel to compile and presumably works.
https://lore.kernel.org/all/[email protected]/
--- arch/arm/mm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/Kconfig +1 -1
@@ -752,7 +752,7 @@ config CPU_BIG_ENDIAN config CPU_ENDIAN_BE8 bool depends on CPU_BIG_ENDIAN - default CPU_V6 || CPU_V6K || CPU_V7 + default CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M help Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 190/355 crypto: caam - disable pkc for non-E SoCs
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit f20311cc9c58052e0b215013046cbf390937910c ]
On newer CAAM versions, not all accelerators are disabled if the SoC is a non-E variant. While the driver checks most of the modules for availability, there is one - PKHA - which sticks out. On non-E variants it is still reported as available, that is the number of instances is non-zero, but it has limited functionality. In particular it doesn't support encryption and decryption, but just signing and verifying. This is indicated by a bit in the PKHA_MISC field. Take this bit into account if we are checking for availability.
This will the following error:
[ 8.167817] caam_jr 8020000.jr: 20000b0f: CCB: desc idx 11: : Invalid CHA selected.
Tested on an NXP LS1028A (non-E) SoC.
--- drivers/crypto/caam/caampkc.c | 19 +++++++++++++++---- drivers/crypto/caam/regs.h | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/crypto/caam/caampkc.c +15 -4
@@ -1087,16 +1087,27 @@ static struct caam_akcipher_alg caam_rsa = {int caam_pkc_init (struct device *ctrldev) {struct caam_drv_private *priv =dev_get_drvdata (ctrldev); -u32 pk_inst; +u32 pk_inst, pkha;int err; init_done = false;/* Determine public key hardware accelerator presence. */ -if (priv->era <10 ) +if (priv->era <10 ) { pk_inst = (rd_reg32 (&priv->ctrl->perfmon.cha_num_ls) &CHA_ID_LS_PK_MASK ) >>CHA_ID_LS_PK_SHIFT ; -else - pk_inst =rd_reg32 (&priv->ctrl->vreg.pkha) &CHA_VER_NUM_MASK ; + }else { + pkha =rd_reg32 (&priv->ctrl->vreg.pkha); + pk_inst = pkha &CHA_VER_NUM_MASK ; + +/* +* Newer CAAMs support partially disabled functionality. If this is the +* case, the number is non-zero, but this bit is set to indicate that +* no encryption or decryption is supported. Only signing and verifying +* is supported. +*/ +if (pkha &CHA_VER_MISC_PKHA_NO_CRYPT ) + pk_inst =0 ; + }/* Do not register algorithms if PKHA is not present. */ if (!pk_inst)
drivers/crypto/caam/regs.h +3 -0
@@ -317,6 +317,9 @@ struct version_regs {/* CHA Miscellaneous Information - AESA_MISC specific */ #define CHA_VER_MISC_AES_GCM BIT(1 + CHA_VER_MISC_SHIFT) +/* CHA Miscellaneous Information - PKHA_MISC specific */ +#define CHA_VER_MISC_PKHA_NO_CRYPT BIT(7 + CHA_VER_MISC_SHIFT) +/* * caam_perfmon - Performance Monitor/Secure Memory Status/ * CAAM Global Status/Component Version IDs
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 222/355 hwmon: Fix possible memleak in __hwmon_device_register()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ada61aa0b1184a8fda1a89a340c7d6cc4e59aee5 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff888102740438 (size 8):
comm "27", pid 859, jiffies 4295031351 (age 143.992s) hex dump (first 8 bytes):
68 77 6d 6f 6e 30 00 00 hwmon0..
backtrace:
[<00000000544b5996>] __kmalloc_track_caller+0x1a6/0x300
[<00000000df0d62b9>] kvasprintf+0xad/0x140
[<00000000d3d2a3da>] kvasprintf_const+0x62/0x190
[<000000005f8f0f29>] kobject_set_name_vargs+0x56/0x140
[<00000000b739e4b9>] dev_set_name+0xb0/0xe0
[<0000000095b69c25>] __hwmon_device_register+0xf19/0x1e50 [hwmon]
[<00000000a7e65b52>] hwmon_device_register_with_info+0xcb/0x110 [hwmon]
[<000000006f181e86>] devm_hwmon_device_register_with_info+0x85/0x100 [hwmon]
[<0000000081bdc567>] tmp421_probe+0x2d2/0x465 [tmp421]
[<00000000502cc3f8>] i2c_device_probe+0x4e1/0xbb0
[<00000000f90bda3b>] really_probe+0x285/0xc30
[<000000007eac7b77>] __driver_probe_device+0x35f/0x4f0
[<000000004953d43d>] driver_probe_device+0x4f/0x140
[<000000002ada2d41>] __device_attach_driver+0x24c/0x330
[<00000000b3977977>] bus_for_each_drv+0x15d/0x1e0
[<000000005bf2a8e3>] __device_attach+0x267/0x410When device_register() returns an error, the name allocated in dev_set_name() will be leaked, the put_device() should be used instead of calling hwmon_dev_release() to give up the device reference, then the name will be freed in kobject_cleanup().
--- drivers/hwmon/hwmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hwmon/hwmon.c +4 -2
@@ -645,8 +645,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,dev_set_drvdata (hdev, drvdata);dev_set_name (hdev,HWMON_ID_FORMAT , id); err =device_register (hdev); -if (err) - goto free_hwmon; +if (err) { +put_device (hdev); + goto ida_remove; + } if (dev && dev->of_node && chip && chip->ops->read && chip->info[0]->type == hwmon_chip &&
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 196/355 media: cxd2880-spi: Fix a null pointer dereference on error handling path
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 11b982e950d2138e90bd120501df10a439006ff8 ]
Currently the null pointer check on dvb_spi->vcc_supply is inverted and this leads to only null values of the dvb_spi->vcc_supply being passed to the call of regulator_disable causing null pointer dereferences. Fix this by only calling regulator_disable if dvb_spi->vcc_supply is not null.
Addresses-Coverity: ("Dereference after null check")
--- drivers/media/spi/cxd2880-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/spi/cxd2880-spi.c +1 -1
@@ -618,7 +618,7 @@ fail_frontend: fail_attach:dvb_unregister_adapter (&dvb_spi->adapter); fail_adapter: -if (!dvb_spi->vcc_supply) +if (dvb_spi->vcc_supply)regulator_disable (dvb_spi->vcc_supply); fail_regulator:kfree (dvb_spi);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 204/355 media: cx23885: Fix snd_card_free call on null card pointer
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 7266dda2f1dfe151b12ef0c14eb4d4e622fb211c ]
Currently a call to snd_card_new that fails will set card with a NULL pointer, this causes a null pointer dereference on the error cleanup path when card it passed to snd_card_free. Fix this by adding a new error exit path that does not call snd_card_free and exiting via this new path.
Addresses-Coverity: ("Explicit null dereference")
--- drivers/media/pci/cx23885/cx23885-alsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/cx23885/cx23885-alsa.c +2 -1
@@ -550,7 +550,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 , THIS_MODULE, sizeof(struct cx23885_audio_dev), &card);if (err <0 ) - goto error; + goto error_msg; chip = (struct cx23885_audio_dev *) card->private_data; chip->dev = dev;
@@ -576,6 +576,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev) error:snd_card_free (card); +error_msg:pr_err ("%s(): Failed to register analog audio adapter\n" , __func__);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 210/355 EDAC/amd64: Handle three rank interleaving mode
In reply to Greg Kroah-HartmanFrom: Yazen Ghannam <[email protected]>
[ Upstream commit 9f4873fb6af7966de8fcbd95c36b61351c1c4b1f ]
AMD Rome systems and later support interleaving between three identical ranks within a channel.
Check for this mode by counting the number of enabled chip selects and comparing their masks. If there are exactly three enabled chip selects and their masks are identical, then three rank interleaving is enabled.
The size of a rank is determined from its mask value. However, three rank interleaving doesn't follow the method of swapping an interleave bit with the most significant bit. Rather, the interleave bit is flipped and the most significant bit remains the same. There is only a single interleave bit in this case.
Account for this when determining the chip select size by keeping the most significant bit at its original value and ignoring any zero bits. This will return a full bitmask in [MSB:1].
--- drivers/edac/amd64_edac.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/edac/amd64_edac.c +21 -1
@@ -797,12 +797,14 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)#define CS_ODD_PRIMARY BIT(1)#define CS_EVEN_SECONDARY BIT(2)#define CS_ODD_SECONDARY BIT(3) +#define CS_3R_INTERLEAVE BIT(4)#define CS_EVEN (CS_EVEN_PRIMARY | CS_EVEN_SECONDARY)#define CS_ODD (CS_ODD_PRIMARY | CS_ODD_SECONDARY)static int f17_get_cs_mode (int dimm,u8 ctrl,struct amd64_pvt *pvt) { +u8 base, count =0 ;int cs_mode =0 ;if (csrow_enabled (2 * dimm, ctrl, pvt))
@@ -815,6 +817,20 @@ static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)if (csrow_sec_enabled (2 * dimm +1 , ctrl, pvt)) cs_mode |=CS_ODD_SECONDARY ; +/* +* 3 Rank inteleaving support. +* There should be only three bases enabled and their two masks should +* be equal. +*/ +for_each_chip_select (base, ctrl, pvt) + count +=csrow_enabled (base, ctrl, pvt); + +if (count ==3 && + pvt->csels[ctrl].csmasks[0 ] == pvt->csels[ctrl].csmasks[1 ]) { +edac_dbg (1 ,"3R interleaving in use.\n" ); + cs_mode |=CS_3R_INTERLEAVE ; + } +return cs_mode; }
@@ -1623,10 +1639,14 @@ static int f17_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc,* * The MSB is the number of bits in the full mask because BIT[0] is * always 0. +* +* In the special 3 Rank interleaving case, a single bit is flipped +* without swapping with the most significant bit. This can be handled +* by keeping the MSB where it is and ignoring the single zero bit. */ msb =fls (addr_mask_orig) -1 ; weight =hweight_long (addr_mask_orig); - num_zero_bits = msb - weight; + num_zero_bits = msb - weight - !!(cs_mode &CS_3R_INTERLEAVE );/* Take the number of zero bits off from the top of the mask. */ addr_mask_deinterleaved =GENMASK_ULL (msb - num_zero_bits,1 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 142/355 ipmi: Disable some operations during a panic
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit b36eb5e7b75a756baa64909a176dd4269ee05a8b ]
Don't do kfree or other risky things when oops_in_progress is set. It's easy enough to avoid doing them
--- drivers/char/ipmi/ipmi_msghandler.c | 10 +++++++--- drivers/char/ipmi/ipmi_watchdog.c | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +7 -3
@@ -4797,7 +4797,9 @@ static atomic_t recv_msg_inuse_count = ATOMIC_INIT(0);static void free_smi_msg (struct ipmi_smi_msg *msg) {atomic_dec (&smi_msg_inuse_count); -kfree (msg); +/* Try to keep as much stuff out of the panic path as possible. */ +if (!oops_in_progress) +kfree (msg); }struct ipmi_smi_msg *ipmi_alloc_smi_msg (void )
@@ -4816,7 +4818,9 @@ EXPORT_SYMBOL(ipmi_alloc_smi_msg);static void free_recv_msg (struct ipmi_recv_msg *msg) {atomic_dec (&recv_msg_inuse_count); -kfree (msg); +/* Try to keep as much stuff out of the panic path as possible. */ +if (!oops_in_progress) +kfree (msg); }static struct ipmi_recv_msg *ipmi_alloc_recv_msg (void )
@@ -4834,7 +4838,7 @@ static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void)void ipmi_free_recv_msg (struct ipmi_recv_msg *msg) { -if (msg->user) +if (msg->user && !oops_in_progress)kref_put (&msg->user->refcount, free_user); msg->done (msg); }
drivers/char/ipmi/ipmi_watchdog.c +12 -5
@@ -337,13 +337,17 @@ static atomic_t msg_tofree = ATOMIC_INIT(0);static DECLARE_COMPLETION (msg_wait);static void msg_free_smi (struct ipmi_smi_msg *msg) { -if (atomic_dec_and_test (&msg_tofree)) -complete (&msg_wait); +if (atomic_dec_and_test (&msg_tofree)) { +if (!oops_in_progress) +complete (&msg_wait); + } }static void msg_free_recv (struct ipmi_recv_msg *msg) { -if (atomic_dec_and_test (&msg_tofree)) -complete (&msg_wait); +if (atomic_dec_and_test (&msg_tofree)) { +if (!oops_in_progress) +complete (&msg_wait); + } }static struct ipmi_smi_msg smi_msg = { .done = msg_free_smi
@@ -429,8 +433,10 @@ static int _ipmi_set_timeout(int do_heartbeat) rv =__ipmi_set_timeout (&smi_msg, &recv_msg, &send_heartbeat_now); -if (rv) +if (rv) { +atomic_set (&msg_tofree,0 );return rv; + }wait_for_completion (&msg_wait);
@@ -575,6 +581,7 @@ restart: &recv_msg, 1);if (rv) { +atomic_set (&msg_tofree,0 );pr_warn ("heartbeat send failure: %d\n" , rv);return rv; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 220/355 memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit beae4a6258e64af609ad5995cc6b6056eb0d898e ]
The "msh" pointer is device managed, meaning that memstick_alloc_host() calls device_initialize() on it. That means that it can't be free using kfree() but must instead be freed with memstick_free_host(). Otherwise it leads to a tiny memory leak of device resources.
--- drivers/memstick/host/jmb38x_ms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memstick/host/jmb38x_ms.c +1 -1
@@ -899,7 +899,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)iounmap (host->addr); err_out_free: -kfree (msh); +memstick_free_host (msh);return NULL ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 172/355 net: annotate data-race in neigh_output()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d18785e213866935b4c3dc0c33c3e18801ce0ce8 ]
neigh_output() reads n->nud_state and hh->hh_len locklessly.
This is fine, but we need to add annotations and document this.
We evaluate skip_cache first to avoid reading these fields if the cache has to by bypassed.
syzbot report:
BUG: KCSAN: data-race in __neigh_event_send / ip_finish_output2
write to 0xffff88810798a885 of 1 bytes by interrupt on cpu 1:
__neigh_event_send+0x40d/0xac0 net/core/neighbour.c:1128 neigh_event_send include/net/neighbour.h:444 [inline] neigh_resolve_output+0x104/0x410 net/core/neighbour.c:1476 neigh_output include/net/neighbour.h:510 [inline] ip_finish_output2+0x80a/0xaa0 net/ipv4/ip_output.c:221 ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423 dst_output include/net/dst.h:450 [inline] ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126 __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525 ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539 __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405 tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline] tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline] tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064 tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079 tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline] tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626 tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642 call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421 expire_timers+0x135/0x240 kernel/time/timer.c:1466 __run_timers+0x368/0x430 kernel/time/timer.c:1734 run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747 __do_softirq+0x12c/0x26e kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu kernel/softirq.c:636 [inline] irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline] acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688 cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237 cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351 call_cpuidle kernel/sched/idle.c:158 [inline] cpuidle_idle_call kernel/sched/idle.c:239 [inline] do_idle+0x1a3/0x250 kernel/sched/idle.c:306 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403 secondary_startup_64_no_verify+0xb1/0xbb
read to 0xffff88810798a885 of 1 bytes by interrupt on cpu 0:
neigh_output include/net/neighbour.h:507 [inline] ip_finish_output2+0x79a/0xaa0 net/ipv4/ip_output.c:221 ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423 dst_output include/net/dst.h:450 [inline] ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126 __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525 ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539 __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405 tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline] tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline] tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064 tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079 tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline] tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626 tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642 call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421 expire_timers+0x135/0x240 kernel/time/timer.c:1466 __run_timers+0x368/0x430 kernel/time/timer.c:1734 run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747 __do_softirq+0x12c/0x26e kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu kernel/softirq.c:636 [inline] irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline] acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688 cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237 cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351 call_cpuidle kernel/sched/idle.c:158 [inline] cpuidle_idle_call kernel/sched/idle.c:239 [inline] do_idle+0x1a3/0x250 kernel/sched/idle.c:306 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403 rest_init+0xee/0x100 init/main.c:734 arch_call_rest_init+0xa/0xb start_kernel+0x5e4/0x669 init/main.c:1142 secondary_startup_64_no_verify+0xb1/0xbb
value changed: 0x20 -> 0x01
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/neighbour.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
include/net/neighbour.h +8 -3
@@ -505,10 +505,15 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb, {const struct hh_cache *hh = &n->hh; -if ((n->nud_state &NUD_CONNECTED ) && hh->hh_len && !skip_cache) +/* n->nud_state and hh->hh_len could be changed under us. +* neigh_hh_output() is taking care of the race later. +*/ +if (!skip_cache && + (READ_ONCE (n->nud_state) &NUD_CONNECTED ) && +READ_ONCE (hh->hh_len))return neigh_hh_output (hh, skb); -else -return n->output (n, skb); + +return n->output (n, skb); } static inline struct neighbour *
Signature · 1 line
2.33.0
Re: [PATCH 5.4 043/355] reset: tegra-bpmp: Handle errors in BPMP response
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
From: Mikko Perttunen <[email protected]>
[ Upstream commit
c045ceb5a145d2a9a4bf33cbc55185ddf99f60ab]The return value from
tegra_bpmp_transferindicates the success or failure of the IPC transaction with BPMP. If the transaction succeeded, we also need to check the actual command's result code. Add code to do this.
Quoted 6 lines
Signed-off-by Mikko Perttunen <[email protected]>Signed-off-by Philipp Zabel <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
...
Can we drop this patch from all stable trees. A revert has been submitted by Jon Hunter -- the reason is that the tegra-hda driver has a (harmless) bug that was previously masked, but with this patch causes the driver to fail to probe.
Thanks,
Mikko
Greg Kroah-Hartman
maintainerPATCH 186/355 net: net_namespace: Fix undefined member in key_remove_domain()
In reply to Greg Kroah-HartmanFrom: Yajun Deng <[email protected]>
[ Upstream commit aed0826b0cf2e488900ab92193893e803d65c070 ]
The key_domain member in struct net only exists if we define CONFIG_KEYS. So we should add the define when we used key_domain.
--- net/core/net_namespace.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/net_namespace.c +4 -0
@@ -480,7 +480,9 @@ struct net *copy_net_ns(unsigned long flags,if (rv <0 ) { put_userns: +#ifdef CONFIG_KEYS key_remove_domain (net->key_domain); +#endif put_user_ns (user_ns);net_drop_ns (net); dec_ucounts:
@@ -612,7 +614,9 @@ static void cleanup_net(struct work_struct *work)list_for_each_entry_safe (net, tmp, &net_exit_list, exit_list) {list_del_init (&net->exit_list);dec_net_namespaces (net->ucounts); +#ifdef CONFIG_KEYS key_remove_domain (net->key_domain); +#endif put_user_ns (net->user_ns);net_drop_ns (net); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 185/355 virtio-gpu: fix possible memory allocation failure
In reply to Greg Kroah-HartmanFrom: liuyuntao <[email protected]>
[ Upstream commit 5bd4f20de8acad37dbb3154feb34dbc36d506c02 ]
When kmem_cache_zalloc in virtio_gpu_get_vbuf fails, it will return an error code. But none of its callers checks this error code, and a core dump will take place.
Considering many of its callers can't handle such error, I add a __GFP_NOFAIL flag when calling kmem_cache_zalloc to make sure it won't fail, and delete those unused error handlings.
--- drivers/gpu/drm/virtio/virtgpu_vq.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -7
@@ -80,9 +80,7 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev, {struct virtio_gpu_vbuffer *vbuf; - vbuf =kmem_cache_zalloc (vgdev->vbufs,GFP_KERNEL ); -if (!vbuf) -return ERR_PTR (-ENOMEM ); + vbuf =kmem_cache_zalloc (vgdev->vbufs,GFP_KERNEL | __GFP_NOFAIL);BUG_ON (size >MAX_INLINE_CMD_SIZE ); vbuf->buf = (void *)vbuf +sizeof (*vbuf);
@@ -142,10 +140,6 @@ static void *virtio_gpu_alloc_cmd_resp(struct virtio_gpu_device *vgdev, vbuf =virtio_gpu_get_vbuf (vgdev, cmd_size, resp_size, resp_buf, cb); -if (IS_ERR (vbuf)) { - *vbuffer_p =NULL ; -return ERR_CAST (vbuf); - } *vbuffer_p = vbuf;return (struct virtio_gpu_command *)vbuf->buf; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 203/355 media: tm6000: Avoid card name truncation
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 42bb98e420d454fef3614b70ea11cc59068395f6 ]
The "card" string only holds 31 characters (and the terminating NUL). In order to avoid truncation, use a shorter card description instead of the current result, "Trident TVMaster TM5600/6000/60".
--- drivers/media/usb/tm6000/tm6000-video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/tm6000/tm6000-video.c +1 -2
@@ -854,8 +854,7 @@ static int vidioc_querycap(struct file *file, void *priv,struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev;strscpy (cap->driver,"tm6000" ,sizeof (cap->driver)); -strscpy (cap->card,"Trident TVMaster TM5600/6000/6010" , -sizeof (cap->card)); +strscpy (cap->card,"Trident TM5600/6000/6010" ,sizeof (cap->card));usb_make_path (dev->udev, cap->bus_info,sizeof (cap->bus_info)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_DEVICE_CAPS ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 239/355 libbpf: Fix BTF data layout checks and allow empty BTF
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit d8123624506cd62730c9cd9c7672c698e462703d ]
Make data section layout checks stricter, disallowing overlap of types and strings data.
Additionally, allow BTFs with no type data. There is nothing inherently wrong with having BTF with no types (put potentially with some strings). This could be a situation with kernel module BTFs, if module doesn't introduce any new type information.
Also fix invalid offset alignment check for btf->hdr->type_off.
--- tools/lib/bpf/btf.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
tools/lib/bpf/btf.c +6 -10
@@ -100,22 +100,18 @@ static int btf_parse_hdr(struct btf *btf)return -EINVAL ; } -if (meta_left < hdr->type_off) { -pr_debug ("Invalid BTF type section offset:%u\n" , hdr->type_off); +if (meta_left < hdr->str_off + hdr->str_len) { +pr_debug ("Invalid BTF total size:%u\n" , btf->raw_size);return -EINVAL ; } -if (meta_left < hdr->str_off) { -pr_debug ("Invalid BTF string section offset:%u\n" , hdr->str_off); +if (hdr->type_off + hdr->type_len > hdr->str_off) { +pr_debug ("Invalid BTF data sections layout: type data at %u + %u, strings data at %u + %u\n" , + hdr->type_off, hdr->type_len, hdr->str_off, hdr->str_len);return -EINVAL ; } -if (hdr->type_off >= hdr->str_off) { -pr_debug ("BTF type section offset >= string section offset. No type?\n" ); -return -EINVAL ; - } - -if (hdr->type_off &0x02 ) { +if (hdr->type_off %4 ) {pr_debug ("BTF type section is not aligned to 4 bytes\n" );return -EINVAL ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 197/355 media: dvb-usb: fix ununit-value in az6027_rc_query
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit afae4ef7d5ad913cab1316137854a36bea6268a5 ]
Syzbot reported ununit-value bug in az6027_rc_query(). The problem was in missing state pointer initialization. Since this function does nothing we can simply initialize state to REMOTE_NO_KEY_PRESSED.
--- drivers/media/usb/dvb-usb/az6027.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/dvb-usb/az6027.c +1 -0
@@ -391,6 +391,7 @@ static struct rc_map_table rc_map_az6027_table[] = {/* remote control stuff (does not work with my box) */ static int az6027_rc_query (struct dvb_usb_device *d,u32 *event,int *state) { + *state =REMOTE_NO_KEY_PRESSED ;return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 211/355 netfilter: nft_dynset: relax superfluous check on set updates
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 7b1394892de8d95748d05e3ee41e85edb4abbfa1 ]
Relax this condition to make add and update commands idempotent for sets with no timeout. The eval function already checks if the set element timeout is available and updates it if the update command is used.
--- net/netfilter/nft_dynset.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
net/netfilter/nft_dynset.c +1 -10
@@ -164,17 +164,8 @@ static int nft_dynset_init(const struct nft_ctx *ctx,return -EBUSY ; priv->op =ntohl (nla_get_be32 (tb[NFTA_DYNSET_OP ])); -switch (priv->op) { -case NFT_DYNSET_OP_ADD : -case NFT_DYNSET_OP_DELETE : -break ; -case NFT_DYNSET_OP_UPDATE : -if (!(set->flags &NFT_SET_TIMEOUT )) -return -EOPNOTSUPP ; -break ; -default : +if (priv->op >NFT_DYNSET_OP_DELETE )return -EOPNOTSUPP ; - } timeout =0 ;if (tb[NFTA_DYNSET_TIMEOUT ] !=NULL ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 180/355 netfilter: conntrack: set on IPS_ASSURED if flows enters internal stream state
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b7b1d02fc43925a4d569ec221715db2dfa1ce4f5 ]
The internal stream state sets the timeout to 120 seconds 2 seconds after the creation of the flow, attach this internal stream state to the IPS_ASSURED flag for consistent event reporting.
Before this patch:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Note IPS_ASSURED for the flow not yet in the internal stream state.
after this update:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 120 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Before this patch, short-lived UDP flows never entered IPS_ASSURED, so they were already candidate flow to be deleted by early_drop under stress.
Before this patch, IPS_ASSURED is set on regardless the internal stream state, attach this internal stream state to IPS_ASSURED.
packet #1 (original direction) enters NEW state
packet #2 (reply direction) enters ESTABLISHED state, sets on IPS_SEEN_REPLY paclet #3 (any direction) sets on IPS_ASSURED (if 2 seconds since the
creation has passed by).
--- net/netfilter/nf_conntrack_proto_udp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_udp.c +5 -2
@@ -105,15 +105,18 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,*/ if (test_bit (IPS_SEEN_REPLY_BIT , &ct->status)) {unsigned long extra = timeouts[UDP_CT_UNREPLIED ]; +bool stream = false;/* Still active after two seconds? Extend timeout. */ -if (time_after (jiffies, ct->proto.udp.stream_ts)) +if (time_after (jiffies, ct->proto.udp.stream_ts)) { extra = timeouts[UDP_CT_REPLIED ]; + stream = true; + }nf_ct_refresh_acct (ct, ctinfo, skb, extra);/* Also, more likely to be important, and not a probe */ -if (!test_and_set_bit (IPS_ASSURED_BIT , &ct->status)) +if (stream && !test_and_set_bit (IPS_ASSURED_BIT , &ct->status))nf_conntrack_event_cache (IPCT_ASSURED , ct); }else { nf_ct_refresh_acct(ct, ctinfo, skb,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 191/355 rxrpc: Fix _usecs_to_jiffies() by using usecs_to_jiffies()
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit acde891c243c1ed85b19d4d5042bdf00914f5739 ]
Directly using _usecs_to_jiffies() might be unsafe, so it's better to use usecs_to_jiffies() instead.
Because we can see that the result of _usecs_to_jiffies() could be larger than MAX_JIFFY_OFFSET values without the check of the input.
--- net/rxrpc/rtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/rtt.c +1 -1
@@ -23,7 +23,7 @@ static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer)static u32 __rxrpc_set_rto (const struct rxrpc_peer *peer) { -return _usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); +return usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); }static u32 rxrpc_bound_rto (u32 rto)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 238/355 smackfs: use netlbl_cfg_cipsov4_del() for deleting cipso_v4_doi
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 0934ad42bb2c5df90a1b9de690f93de735b622fe ]
syzbot is reporting UAF at cipso_v4_doi_search() [1], for smk_cipso_doi() is calling kfree() without removing from the cipso_v4_doi_list list after netlbl_cfg_cipsov4_map_add() returned an error. We need to use netlbl_cfg_cipsov4_del() in order to remove from the list and wait for RCU grace period before kfree().
--- security/smack/smackfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/smack/smackfs.c +1 -1
@@ -712,7 +712,7 @@ static void smk_cipso_doi(void)if (rc !=0 ) {printk (KERN_WARNING "%s:%d map add rc = %d\n" , __func__, __LINE__, rc); -kfree (doip); +netlbl_cfg_cipsov4_del (doip->doi, &nai);return ; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 223/355 hwmon: (pmbus/lm25066) Let compiler determine outer dimension of lm25066_coeff
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
[ Upstream commit b7931a7b0e0df4d2a25fedd895ad32c746b77bc1 ]
Maintaining this manually is error prone (there are currently only five chips supported, not six); gcc can do it for us automatically.
--- drivers/hwmon/pmbus/lm25066.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/lm25066.c +1 -1
@@ -51,7 +51,7 @@ struct __coeff {#define PSC_CURRENT_IN_L (PSC_NUM_CLASSES)#define PSC_POWER_L (PSC_NUM_CLASSES + 1) -static struct __coeff lm25066_coeff[6 ][PSC_NUM_CLASSES +2 ] = { +static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES +2 ] = { [lm25056] = { [PSC_VOLTAGE_IN ] = { .m =16296 ,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 212/355 media: dvb-frontends: mn88443x: Handle errors of clk_prepare_enable()
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 69a10678e2fba3d182e78ea041f2d1b1a6058764 ]
mn88443x_cmn_power_on() did not handle possible errors of clk_prepare_enable() and always finished successfully so that its caller mn88443x_probe() did not care about failed preparing/enabling of clocks as well.
Add missed error handling in both mn88443x_cmn_power_on() and mn88443x_probe(). This required to change the return value of the former from "void" to "int".
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/dvb-frontends/mn88443x.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/mn88443x.c +15 -3
@@ -204,11 +204,18 @@ struct mn88443x_priv {struct regmap *regmap_t; }; -static void mn88443x_cmn_power_on (struct mn88443x_priv *chip) +static int mn88443x_cmn_power_on (struct mn88443x_priv *chip) { +struct device *dev = &chip->client_s->dev;struct regmap *r_t = chip->regmap_t; +int ret; -clk_prepare_enable (chip->mclk); + ret =clk_prepare_enable (chip->mclk); +if (ret) { +dev_err (dev,"Failed to prepare and enable mclk: %d\n" , + ret); +return ret; + }gpiod_set_value_cansleep (chip->reset_gpio,1 );usleep_range (100 ,1000 );
@@ -222,6 +229,8 @@ static void mn88443x_cmn_power_on(struct mn88443x_priv *chip) }else {regmap_write (r_t,HIZSET3 ,0x8f ); } + +return 0 ; }static void mn88443x_cmn_power_off (struct mn88443x_priv *chip)
@@ -738,7 +747,10 @@ static int mn88443x_probe(struct i2c_client *client, chip->fe.demodulator_priv = chip;i2c_set_clientdata (client, chip); -mn88443x_cmn_power_on (chip); + ret =mn88443x_cmn_power_on (chip); +if (ret) + goto err_i2c_t; +mn88443x_s_sleep (chip);mn88443x_t_sleep (chip);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 219/355 memstick: avoid out-of-range warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 4853396f03c3019eccf5cd113e464231e9ddf0b3 ]
clang-14 complains about a sanity check that always passes when the page size is 64KB or larger:
drivers/memstick/core/ms_block.c:1739:21: error: result of comparison of constant 65536 with expression of type 'unsigned short' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (msb->page_size > PAGE_SIZE) {
~~~~~~~~~~~~~~ ^ ~~~~~~~~~This is fine, it will still work on all architectures, so just shut up that warning with a cast.
--- drivers/memstick/core/ms_block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memstick/core/ms_block.c +1 -1
@@ -1727,7 +1727,7 @@ static int msb_init_card(struct memstick_dev *card) msb->pages_in_block = boot_block->attr.block_size *2 ; msb->block_size = msb->page_size * msb->pages_in_block; -if (msb->page_size >PAGE_SIZE ) { +if ((size_t )msb->page_size >PAGE_SIZE ) {/* this isn't supported by linux at all, anyway*/ dbg ("device page %d size isn't supported" , msb->page_size);return -EINVAL ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 221/355 net, neigh: Fix NTF_EXT_LEARNED in combination with NTF_USE
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit e4400bbf5b15750e1b59bf4722d18d99be60c69f ]
The NTF_EXT_LEARNED neigh flag is usually propagated back to user space upon dump of the neighbor table. However, when used in combination with NTF_USE flag this is not the case despite exempting the entry from the garbage collector. This results in inconsistent state since entries are typically marked in neigh->flags with NTF_EXT_LEARNED, but here they are not. Fix it by propagating the creation flag to ___neigh_create().
Before fix:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE [...]
After fix:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a extern_learn REACHABLE [...]
--- net/core/neighbour.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
net/core/neighbour.c +14 -12
@@ -380,7 +380,7 @@ EXPORT_SYMBOL(neigh_ifdown);static struct neighbour *neigh_alloc (struct neigh_table *tbl,struct net_device *dev, -bool exempt_from_gc) +u8 flags,bool exempt_from_gc) {struct neighbour *n =NULL ;unsigned long now = jiffies;
@@ -413,6 +413,7 @@ do_alloc: n->updated = n->used = now; n->nud_state =NUD_NONE ; n->output = neigh_blackhole; + n->flags = flags;seqlock_init (&n->hh.hh_lock); n->parms =neigh_parms_clone (&tbl->parms);timer_setup (&n->timer, neigh_timer_handler,0 );
@@ -576,19 +577,18 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, }EXPORT_SYMBOL (neigh_lookup_nodev); -static struct neighbour *___neigh_create (struct neigh_table *tbl, -const void *pkey, -struct net_device *dev, -bool exempt_from_gc,bool want_ref) +static struct neighbour * +___neigh_create (struct neigh_table *tbl,const void *pkey, +struct net_device *dev,u8 flags, +bool exempt_from_gc,bool want_ref) { -struct neighbour *n1, *rc, *n =neigh_alloc (tbl, dev, exempt_from_gc); -u32 hash_val; -unsigned int key_len = tbl->key_len; -int error; +u32 hash_val, key_len = tbl->key_len; +struct neighbour *n1, *rc, *n;struct neigh_hash_table *nht; +int error; + n =neigh_alloc (tbl, dev, flags, exempt_from_gc);trace_neigh_create (tbl, dev, pkey, n, exempt_from_gc); -if (!n) { rc =ERR_PTR (-ENOBUFS ); goto out;
@@ -675,7 +675,7 @@ out_neigh_release:struct neighbour *__neigh_create (struct neigh_table *tbl,const void *pkey,struct net_device *dev,bool want_ref) { -return ___neigh_create (tbl, pkey, dev, false, want_ref); +return ___neigh_create (tbl, pkey, dev,0 , false, want_ref); }EXPORT_SYMBOL (__neigh_create);
@@ -1945,7 +1945,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, exempt_from_gc = ndm->ndm_state &NUD_PERMANENT || ndm->ndm_flags &NTF_EXT_LEARNED ; - neigh =___neigh_create (tbl, dst, dev, exempt_from_gc, true); + neigh =___neigh_create (tbl, dst, dev, + ndm->ndm_flags &NTF_EXT_LEARNED , + exempt_from_gc, true);if (IS_ERR (neigh)) { err =PTR_ERR (neigh); goto out;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 173/355 btrfs: do not take the uuid_mutex in btrfs_rm_device
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 8ef9dc0f14ba6124c62547a4fdc59b163d8b864e ]
We got the following lockdep splat while running fstests (specifically btrfs/003 and btrfs/020 in a row) with the new rc. This was uncovered by 87579e9b7d8d ("loop: use worker per cgroup instead of kworker") which converted loop to using workqueues, which comes with lockdep annotations that don't exist with kworkers. The lockdep splat is as follows:
WARNING: possible circular locking dependency detected 5.14.0-rc2-custom+ #34 Not tainted
------------------------------------------------------
losetup/156417 is trying to acquire lock:
ffff9c7645b02d38 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0x84/0x600
but task is already holding lock:
ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #5 (&lo->lo_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 lo_open+0x28/0x60 [loop] blkdev_get_whole+0x28/0xf0 blkdev_get_by_dev.part.0+0x168/0x3c0 blkdev_open+0xd2/0xe0 do_dentry_open+0x163/0x3a0 path_openat+0x74d/0xa40 do_filp_open+0x9c/0x140 do_sys_openat2+0xb1/0x170 __x64_sys_openat+0x54/0x90 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #4 (&disk->open_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 blkdev_get_by_dev.part.0+0xd1/0x3c0 blkdev_get_by_path+0xc0/0xd0 btrfs_scan_one_device+0x52/0x1f0 [btrfs] btrfs_control_ioctl+0xac/0x170 [btrfs] __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #3 (uuid_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 btrfs_rm_device+0x48/0x6a0 [btrfs] btrfs_ioctl+0x2d1c/0x3110 [btrfs] __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #2 (sb_writers#11){.+.+}-{0:0}:
lo_write_bvec+0x112/0x290 [loop] loop_process_work+0x25f/0xcb0 [loop] process_one_work+0x28f/0x5d0 worker_thread+0x55/0x3c0 kthread+0x140/0x170 ret_from_fork+0x22/0x30
-> #1 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}:
process_one_work+0x266/0x5d0 worker_thread+0x55/0x3c0 kthread+0x140/0x170 ret_from_fork+0x22/0x30
-> #0 ((wq_completion)loop0){+.+.}-{0:0}:
__lock_acquire+0x1130/0x1dc0 lock_acquire+0xf5/0x320 flush_workqueue+0xae/0x600 drain_workqueue+0xa0/0x110 destroy_workqueue+0x36/0x250 __loop_clr_fd+0x9a/0x650 [loop] lo_ioctl+0x29d/0x780 [loop] block_ioctl+0x3f/0x50 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
other info that might help us debug this:
Chain exists of:
(wq_completion)loop0 --> &disk->open_mutex --> &lo->lo_mutex
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&lo->lo_mutex);
lock(&disk->open_mutex);
lock(&lo->lo_mutex);
lock((wq_completion)loop0); *** DEADLOCK ***
1 lock held by losetup/156417:
#0: ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
stack backtrace: CPU: 8 PID: 156417 Comm: losetup Not tainted 5.14.0-rc2-custom+ #34 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Call Trace: dump_stack_lvl+0x57/0x72 check_noncircular+0x10a/0x120 __lock_acquire+0x1130/0x1dc0 lock_acquire+0xf5/0x320 ? flush_workqueue+0x84/0x600 flush_workqueue+0xae/0x600 ? flush_workqueue+0x84/0x600 drain_workqueue+0xa0/0x110 destroy_workqueue+0x36/0x250 __loop_clr_fd+0x9a/0x650 [loop] lo_ioctl+0x29d/0x780 [loop] ? __lock_acquire+0x3a0/0x1dc0 ? update_dl_rq_load_avg+0x152/0x360 ? lock_is_held_type+0xa5/0x120 ? find_held_lock.constprop.0+0x2b/0x80 block_ioctl+0x3f/0x50 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f645884de6b
Usually the uuid_mutex exists to protect the fs_devices that map together all of the devices that match a specific uuid. In rm_device we're messing with the uuid of a device, so it makes sense to protect that here.
However in doing that it pulls in a whole host of lockdep dependencies, as we call mnt_may_write() on the sb before we grab the uuid_mutex, thus we end up with the dependency chain under the uuid_mutex being added under the normal sb write dependency chain, which causes problems with loop devices.
We don't need the uuid mutex here however. If we call btrfs_scan_one_device() before we scratch the super block we will find the fs_devices and not find the device itself and return EBUSY because the fs_devices is open. If we call it after the scratch happens it will not appear to be a valid btrfs file system.
We do not need to worry about other fs_devices modifying operations here because we're protected by the exclusive operations locking.
So drop the uuid_mutex here in order to fix the lockdep splat.
A more detailed explanation from the discussion:
We are worried about rm and scan racing with each other, before this change we'll zero the device out under the UUID mutex so when scan does run it'll make sure that it can go through the whole device scan thing without rm messing with us.
We aren't worried if the scratch happens first, because the result is we don't think this is a btrfs device and we bail out.
The only case we are concerned with is we scratch _after_ scan is able to read the superblock and gets a seemingly valid super block, so lets consider this case.
Scan will call device_list_add() with the device we're removing. We'll call find_fsid_with_metadata_uuid() and get our fs_devices for this UUID. At this point we lock the fs_devices->device_list_mutex. This is what protects us in this case, but we have two cases here.
1. We aren't to the device removal part of the RM. We found our device, and device name matches our path, we go down and we set total_devices to our super number of devices, which doesn't affect anything because we haven't done the remove yet.
2. We are past the device removal part, which is protected by the device_list_mutex. Scan doesn't find the device, it goes down and does the
if (fs_devices->opened)
return -EBUSY;
check and we bail out.
Nothing about this situation is ideal, but the lockdep splat is real, and the fix is safe, tho admittedly a bit scary looking.
--- fs/btrfs/volumes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/volumes.c +5 -5
@@ -2162,8 +2162,11 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,u64 num_devices;int ret =0 ; -mutex_lock (&uuid_mutex); - +/* +* The device list in fs_devices is accessed without locks (neither +* uuid_mutex nor device_list_mutex) as it won't change on a mounted +* filesystem and another device rm cannot run. +*/ num_devices =btrfs_num_devices (fs_info); ret =btrfs_check_raid_min_devices (fs_info, num_devices -1 );
@@ -2207,11 +2210,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,mutex_unlock (&fs_info->chunk_mutex); } -mutex_unlock (&uuid_mutex); ret =btrfs_shrink_device (device,0 );if (!ret)btrfs_reada_remove_dev (device); -mutex_lock (&uuid_mutex);if (ret) goto error_undo;
@@ -2293,7 +2294,6 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, } out: -mutex_unlock (&uuid_mutex);return ret; error_undo:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 230/355 mt76: mt76x02: fix endianness warnings in mt76x02_mac.c
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit c33edef520213feccebc22c9474c685b9fb60611 ]
Fix the following sparse warning in mt76x02_mac_write_txwi and mt76x02_mac_tx_rate_val routines:drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:237:19:
warning: restricted __le16 degrades to intege
warning: cast from restricted __le16drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:383:28:
warning: incorrect type in assignment (different base types) expected restricted __le16 [usertype] rate
got unsigned long
--- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +7 -6
@@ -154,7 +154,7 @@ void mt76x02_mac_wcid_set_drop(struct mt76x02_dev *dev, u8 idx, bool drop)mt76_wr (dev,MT_WCID_DROP (idx), (val & ~bit) | (bit * drop)); } -static __le16 +static u16 mt76x02_mac_tx_rate_val (struct mt76x02_dev *dev,const struct ieee80211_tx_rate *rate,u8 *nss_val) {
@@ -200,14 +200,14 @@ mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev, rateval |=MT_RXWI_RATE_SGI ; *nss_val = nss; -return cpu_to_le16 (rateval); +return rateval; }void mt76x02_mac_wcid_set_rate (struct mt76x02_dev *dev,struct mt76_wcid *wcid,const struct ieee80211_tx_rate *rate) {s8 max_txpwr_adj =mt76x02_tx_get_max_txpwr_adj (dev, rate); -__le16 rateval; +u16 rateval;u32 tx_info;s8 nss;
@@ -320,7 +320,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,struct ieee80211_key_conf *key = info->control.hw_key;u32 wcid_tx_info;u16 rate_ht_mask =FIELD_PREP (MT_RXWI_RATE_PHY ,BIT (1 ) |BIT (2 )); -u16 txwi_flags =0 ; +u16 txwi_flags =0 , rateval;u8 nss;s8 txpwr_adj, max_txpwr_adj;u8 ccmp_pn[8 ], nstreams = dev->mt76.chainmask &0xf ;
@@ -356,14 +356,15 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,if (wcid && (rate->idx <0 || !rate->count)) { wcid_tx_info = wcid->tx_info; - txwi->rate =FIELD_GET (MT_WCID_TX_INFO_RATE , wcid_tx_info); + rateval =FIELD_GET (MT_WCID_TX_INFO_RATE , wcid_tx_info); max_txpwr_adj =FIELD_GET (MT_WCID_TX_INFO_TXPWR_ADJ , wcid_tx_info); nss =FIELD_GET (MT_WCID_TX_INFO_NSS , wcid_tx_info); }else { - txwi->rate =mt76x02_mac_tx_rate_val (dev, rate, &nss); + rateval =mt76x02_mac_tx_rate_val (dev, rate, &nss); max_txpwr_adj =mt76x02_tx_get_max_txpwr_adj (dev, rate); } + txwi->rate =cpu_to_le16 (rateval); txpwr_adj =mt76x02_tx_get_txpwr_adj (dev, dev->mt76.txpower_conf, max_txpwr_adj);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 227/355 mmc: mxs-mmc: disable regulator on error and in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ce5f6c2c9b0fcb4094f8e162cfd37fb4294204f7 ]
The 'reg_vmmc' regulator is enabled in the probe. It is never disabled. Neither in the error handling path of the probe nor in the remove function.
Register a devm_action to disable it when needed.
--- drivers/mmc/host/mxs-mmc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mmc/host/mxs-mmc.c +10 -0
@@ -565,6 +565,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = { };MODULE_DEVICE_TABLE (of, mxs_mmc_dt_ids); +static void mxs_mmc_regulator_disable (void *regulator) +{ +regulator_disable (regulator); +} +static int mxs_mmc_probe (struct platform_device *pdev) { const struct of_device_id *of_id =
@@ -606,6 +611,11 @@ static int mxs_mmc_probe(struct platform_device *pdev) "Failed to enable vmmc regulator: %d\n", ret); goto out_mmc_free; } + + ret =devm_add_action_or_reset (&pdev->dev, mxs_mmc_regulator_disable, + reg_vmmc); +if (ret) + goto out_mmc_free; } ssp->clk =devm_clk_get (&pdev->dev,NULL );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 235/355 PM: hibernate: fix sparse warnings
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
[ Upstream commit 01de5fcd8b1ac0ca28d2bb0921226a54fdd62684 ]
When building the kernel with sparse enabled 'C=1' the following warnings shows up:
kernel/power/swap.c:390:29: warning: incorrect type in assignment (different base types)kernel/power/swap.c:390:29: expected int retkernel/power/swap.c:390:29: got restricted blk_status_t
This is due to function hib_wait_io() returns a 'blk_status_t' which is a bitwise u8. Commit 5416da01ff6e ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io") seemed to have mixed up the return type. However, the 4e4cbee93d56 ("block: switch bios to blk_status_t") actually broke the behaviour by returning the wrong type.
Rework so function hib_wait_io() returns a 'int' instead of 'blk_status_t' and make sure to call function blk_status_to_errno(hb->error)' when returning from function hib_wait_io() a int gets returned.
--- kernel/power/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/swap.c +1 -1
@@ -292,7 +292,7 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,return error; } -static blk_status_t hib_wait_io (struct hib_bio_batch *hb) +static int hib_wait_io (struct hib_bio_batch *hb) {wait_event (hb->wait,atomic_read (&hb->count) ==0 );return blk_status_to_errno (hb->error);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 215/355 hwrng: mtk - Force runtime pm ops for sleep ops
In reply to Greg Kroah-HartmanFrom: Markus Schneider-Pargmann <[email protected]>
[ Upstream commit b6f5f0c8f72d348b2d07b20d7b680ef13a7ffe98 ]
Currently mtk_rng_runtime_suspend/resume is called for both runtime pm and system sleep operations.
This is wrong as these should only be runtime ops as the name already suggests. Currently freezing the system will lead to a call to mtk_rng_runtime_suspend even if the device currently isn't active. This leads to a clock warning because it is disabled/unprepared although it isn't enabled/prepared currently.
This patch fixes this by only setting the runtime pm ops and forces to call the runtime pm ops from the system sleep ops as well if active but not otherwise.
--- drivers/char/hw_random/mtk-rng.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/char/hw_random/mtk-rng.c +7 -2
@@ -173,8 +173,13 @@ static int mtk_rng_runtime_resume(struct device *dev)return mtk_rng_init (&priv->rng); } -static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend, - mtk_rng_runtime_resume, NULL); +static const struct dev_pm_ops mtk_rng_pm_ops = { + SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend, + mtk_rng_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, + pm_runtime_force_resume) +}; +#define MTK_RNG_PM_OPS (&mtk_rng_pm_ops)#else /* CONFIG_PM */ #define MTK_RNG_PM_OPS NULL
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 143/355 ACPICA: Avoid evaluating methods too early during system resume
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit d3c4b6f64ad356c0d9ddbcf73fa471e6a841cc5c ]
ACPICA commit 0762982923f95eb652cf7ded27356b247c9774de
During wakeup from system-wide sleep states, acpi_get_sleep_type_data() is called and it tries to get memory from the slab allocator in order to evaluate a control method, but if KFENCE is enabled in the kernel, the memory allocation attempt causes an IRQ work to be queued and a self-IPI to be sent to the CPU running the code which requires the memory controller to be ready, so if that happens too early in the wakeup path, it doesn't work.
Prevent that from taking place by calling acpi_get_sleep_type_data() for S0 upfront, when preparing to enter a given sleep state, and saving the data obtained by it for later use during system wakeup.
--- drivers/acpi/acpica/acglobal.h | 2 ++ drivers/acpi/acpica/hwesleep.c | 8 ++------ drivers/acpi/acpica/hwsleep.c | 11 ++++------- drivers/acpi/acpica/hwxfsleep.c | 7 +++++++ 4 files changed, 15 insertions(+), 13 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -0
@@ -220,6 +220,8 @@ extern struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG ];ACPI_GLOBAL (u8, acpi_gbl_sleep_type_a);ACPI_GLOBAL (u8, acpi_gbl_sleep_type_b); +ACPI_GLOBAL (u8, acpi_gbl_sleep_type_a_s0); +ACPI_GLOBAL (u8, acpi_gbl_sleep_type_b_s0);/***************************************************************************** *
drivers/acpi/acpica/hwesleep.c +2 -6
@@ -147,17 +147,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)acpi_status acpi_hw_extended_wake_prep (u8 sleep_state) { -acpi_status status;u8 sleep_type_value;ACPI_FUNCTION_TRACE (hw_extended_wake_prep); - status =acpi_get_sleep_type_data (ACPI_STATE_S0 , - &acpi_gbl_sleep_type_a, - &acpi_gbl_sleep_type_b); -if (ACPI_SUCCESS (status)) { +if (acpi_gbl_sleep_type_a_s0 !=ACPI_SLEEP_TYPE_INVALID ) { sleep_type_value = - ((acpi_gbl_sleep_type_a <<ACPI_X_SLEEP_TYPE_POSITION ) & + ((acpi_gbl_sleep_type_a_s0 <<ACPI_X_SLEEP_TYPE_POSITION ) &ACPI_X_SLEEP_TYPE_MASK ); (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
drivers/acpi/acpica/hwsleep.c +4 -7
@@ -179,7 +179,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)acpi_status acpi_hw_legacy_wake_prep (u8 sleep_state) { -acpi_status status; +acpi_status status =AE_OK ;struct acpi_bit_register_info *sleep_type_reg_info;struct acpi_bit_register_info *sleep_enable_reg_info;u32 pm1a_control;
@@ -192,10 +192,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)* This is unclear from the ACPI Spec, but it is required * by some machines. */ - status =acpi_get_sleep_type_data (ACPI_STATE_S0 , - &acpi_gbl_sleep_type_a, - &acpi_gbl_sleep_type_b); -if (ACPI_SUCCESS (status)) { +if (acpi_gbl_sleep_type_a_s0 !=ACPI_SLEEP_TYPE_INVALID ) { sleep_type_reg_info =acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE ); sleep_enable_reg_info =
@@ -216,9 +213,9 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)/* Insert the SLP_TYP bits */ - pm1a_control |= (acpi_gbl_sleep_type_a << + pm1a_control |= (acpi_gbl_sleep_type_a_s0 << sleep_type_reg_info->bit_position); - pm1b_control |= (acpi_gbl_sleep_type_b << + pm1b_control |= (acpi_gbl_sleep_type_b_s0 << sleep_type_reg_info->bit_position);/* Write the control registers and ignore any errors */
drivers/acpi/acpica/hwxfsleep.c +7 -0
@@ -214,6 +214,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)return_ACPI_STATUS (status); } + status =acpi_get_sleep_type_data (ACPI_STATE_S0 , + &acpi_gbl_sleep_type_a_s0, + &acpi_gbl_sleep_type_b_s0); +if (ACPI_FAILURE (status)) { + acpi_gbl_sleep_type_a_s0 =ACPI_SLEEP_TYPE_INVALID ; + } +/* Execute the _PTS method (Prepare To Sleep) */ arg_list.count =1 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 169/355 net: dsa: lantiq_gswip: serialize access to the PCE table
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 49753a75b9a32de4c0393bb8d1e51ea223fda8e4 ]
Looking at the code, the GSWIP switch appears to hold bridging service structures (VLANs, FDBs, forwarding rules) in PCE table entries. Hardware access to the PCE table is non-atomic, and is comprised of several register reads and writes.
These accesses are currently serialized by the rtnl_lock, but DSA is changing its driver API and that lock will no longer be held when calling ->port_fdb_add() and ->port_fdb_del().
So this driver needs to serialize the access to the PCE table using its own locking scheme. This patch adds that.
--- drivers/net/dsa/lantiq_gswip.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
drivers/net/dsa/lantiq_gswip.c +23 -5
@@ -274,6 +274,7 @@ struct gswip_priv {int num_gphy_fw;struct gswip_gphy_fw *gphy_fw;u32 port_vlan_filter; +struct mutex pce_table_lock; };struct gswip_pce_table_entry {
@@ -521,10 +522,14 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSRD :GSWIP_PCE_TBL_CTRL_OPMOD_ADRD ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |
@@ -534,8 +539,10 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }for (i =0 ; i <ARRAY_SIZE (tbl->key); i++) tbl->key[i] =gswip_switch_r (priv,GSWIP_PCE_TBL_KEY (i));
@@ -551,6 +558,8 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, tbl->valid = !!(crtl &GSWIP_PCE_TBL_CTRL_VLD ); tbl->gmap = (crtl &GSWIP_PCE_TBL_CTRL_GMAP_MASK ) >>7 ; +mutex_unlock (&priv->pce_table_lock); +return 0 ; }
@@ -563,10 +572,14 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSWR :GSWIP_PCE_TBL_CTRL_OPMOD_ADWR ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |
@@ -598,8 +611,12 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv, crtl |=GSWIP_PCE_TBL_CTRL_BAS ;gswip_switch_w (priv, crtl,GSWIP_PCE_TBL_CTRL ); -return gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , -GSWIP_PCE_TBL_CTRL_BAS ); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , +GSWIP_PCE_TBL_CTRL_BAS ); + +mutex_unlock (&priv->pce_table_lock); + +return err; }/* Add the LAN port into a bridge with the CPU port by
@@ -2020,6 +2037,7 @@ static int gswip_probe(struct platform_device *pdev) priv->ds->priv = priv; priv->ds->ops = &gswip_switch_ops; priv->dev = dev; +mutex_init (&priv->pce_table_lock); version =gswip_switch_r (priv,GSWIP_VERSION );/* bring up the mdio bus */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 179/355 parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 66e29fcda1824f0427966fbee2bd2c85bf362c82 ]
With idle polling, IPIs are not sent when a CPU idle, but queued and run later from do_idle(). The default kgdb_call_nmi_hook() implementation gets the pointer to struct pt_regs from get_irq_reqs(), which doesn't work in that case because it was not called from the IPI interrupt handler. Fix it by defining our own kgdb_roundup() function which sents an IPI_ENTER_KGDB. When that IPI is received on the target CPU kgdb_nmicallback() is called.
--- arch/parisc/kernel/smp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
arch/parisc/kernel/smp.c +17 -2
@@ -29,6 +29,7 @@#include <linux/bitops.h> #include <linux/ftrace.h> #include <linux/cpu.h> +#include <linux/kgdb.h> #include <linux/atomic.h> #include <asm/current.h>
@@ -71,7 +72,10 @@ enum ipi_message_type {IPI_CALL_FUNC ,IPI_CPU_START ,IPI_CPU_STOP , - IPI_CPU_TEST +IPI_CPU_TEST , +#ifdef CONFIG_KGDB + IPI_ENTER_KGDB, +#endif };
@@ -169,7 +173,12 @@ ipi_interrupt(int irq, void *dev_id)case IPI_CPU_TEST :smp_debug (100 ,KERN_DEBUG "CPU%d is alive!\n" , this_cpu);break ; - +#ifdef CONFIG_KGDB +case IPI_ENTER_KGDB : +smp_debug (100 ,KERN_DEBUG "CPU%d ENTER_KGDB\n" , this_cpu); +kgdb_nmicallback (raw_smp_processor_id (),get_irq_regs ()); +break ; +#endif default :printk (KERN_CRIT "Unknown IPI num on CPU%d: %lu\n" , this_cpu, which);
@@ -225,6 +234,12 @@ send_IPI_allbutself(enum ipi_message_type op) } } +#ifdef CONFIG_KGDB +void kgdb_roundup_cpus (void ) +{ +send_IPI_allbutself (IPI_ENTER_KGDB ); +} +#endif inline void smp_send_stop (void ) {send_IPI_allbutself (IPI_CPU_STOP ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 134/355 media: uvcvideo: Set unique vdev name based in type
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit e3f60e7e1a2b451f538f9926763432249bcf39c4 ]
All the entities must have a unique name. We can have a descriptive and unique name by appending the function and the entity->id.
This is even resilent to multi chain devices.
Fixes v4l2-compliance:
Media Controller ioctls:
fail: v4l2-test-media.cpp(205): v2_entity_names_set.find(key) != v2_entity_names_set.end()
test MEDIA_IOC_G_TOPOLOGY: FAIL
fail: v4l2-test-media.cpp(394): num_data_links != num_links
test MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL
--- drivers/media/usb/uvc/uvc_driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +6 -1
@@ -1972,6 +1972,7 @@ int uvc_register_video_device(struct uvc_device *dev,const struct v4l2_file_operations *fops, const struct v4l2_ioctl_ops *ioctl_ops) { + const char *name;int ret;/* Initialize the video buffers queue. */
@@ -2000,16 +2001,20 @@ int uvc_register_video_device(struct uvc_device *dev,case V4L2_BUF_TYPE_VIDEO_CAPTURE :default : vdev->device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; + name ="Video Capture" ;break ;case V4L2_BUF_TYPE_VIDEO_OUTPUT : vdev->device_caps =V4L2_CAP_VIDEO_OUTPUT |V4L2_CAP_STREAMING ; + name ="Video Output" ;break ;case V4L2_BUF_TYPE_META_CAPTURE : vdev->device_caps =V4L2_CAP_META_CAPTURE |V4L2_CAP_STREAMING ; + name ="Metadata" ;break ; } -strscpy (vdev->name, dev->name,sizeof (vdev->name)); +snprintf (vdev->name,sizeof (vdev->name),"%s %u" , name, + stream->header.bTerminalLink);/* * Set the driver data before calling video_register_device, otherwise
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 200/355 media: i2c: ths8200 needs V4L2_ASYNC
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit e4625044d656f3c33ece0cc9da22577bc10ca5d3 ]
Fix the build errors reported by the kernel test robot by selecting V4L2_ASYNC:
mips-linux-ld: drivers/media/i2c/ths8200.o: in function `ths8200_remove':
ths8200.c:(.text+0x1ec): undefined reference to `v4l2_async_unregister_subdev'
mips-linux-ld: drivers/media/i2c/ths8200.o: in function `ths8200_probe':
ths8200.c:(.text+0x404): undefined reference to `v4l2_async_register_subdev'
--- drivers/media/i2c/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/Kconfig +1 -0
@@ -552,6 +552,7 @@ config VIDEO_AK881X config VIDEO_THS8200 tristate "Texas Instruments THS8200 video encoder" depends on VIDEO_V4L2 && I2C + select V4L2_ASYNC help Support for the Texas Instruments THS8200 video encoder.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 218/355 mmc: sdhci-omap: Fix NULL pointer exception if regulator is not configured
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 8e0e7bd38b1ec7f9e5d18725ad41828be4e09859 ]
If sdhci-omap is configured for an unused device instance and the device is not set as disabled, we can get a NULL pointer dereference:
Unable to handle kernel NULL pointer dereference at virtual address
00000045
...
(regulator_set_voltage) from [<c07d7008>] (mmc_regulator_set_ocr+0x44/0xd0) (mmc_regulator_set_ocr) from [<c07e2d80>] (sdhci_set_ios+0xa4/0x490) (sdhci_set_ios) from [<c07ea690>] (sdhci_omap_set_ios+0x124/0x160) (sdhci_omap_set_ios) from [<c07c8e94>] (mmc_power_up.part.0+0x3c/0x154) (mmc_power_up.part.0) from [<c07c9d20>] (mmc_start_host+0x88/0x9c) (mmc_start_host) from [<c07cad34>] (mmc_add_host+0x58/0x7c) (mmc_add_host) from [<c07e2574>] (__sdhci_add_host+0xf0/0x22c) (__sdhci_add_host) from [<c07eaf68>] (sdhci_omap_probe+0x318/0x72c) (sdhci_omap_probe) from [<c06a39d8>] (platform_probe+0x58/0xb8)
AFAIK we are not seeing this with the devices configured in the mainline kernel but this can cause issues for folks bringing up their boards.
--- drivers/mmc/host/sdhci-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-omap.c +2 -1
@@ -675,7 +675,8 @@ static void sdhci_omap_set_power(struct sdhci_host *host, unsigned char mode, {struct mmc_host *mmc = host->mmc; -mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); +if (!IS_ERR (mmc->supply.vmmc)) +mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); }static int sdhci_omap_enable_dma (struct sdhci_host *host)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 193/355 ath10k: Fix missing frame timestamp for beacon/probe-resp
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit e6dfbc3ba90cc2b619229be56b485f085a0a8e1c ]
When receiving a beacon or probe response, we should update the boottime_ns field which is the timestamp the frame was received at. (cf mac80211.h)
This fixes a scanning issue with Android since it relies on this timestamp to determine when the AP has been seen for the last time (via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).
--- drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath10k/wmi.c +4 -0
@@ -2541,6 +2541,10 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)if (ieee80211_is_beacon (hdr->frame_control))ath10k_mac_handle_beacon (ar, skb); +if (ieee80211_is_beacon (hdr->frame_control) || +ieee80211_is_probe_resp (hdr->frame_control)) + status->boottime_ns =ktime_get_boottime_ns (); + ath10k_dbg(ar, ATH10K_DBG_MGMT, "event mgmt rx skb %pK len %d ftype %02x stype %02x\n", skb, skb->len,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 231/355 rsi: stop thread firstly in rsi_91x_init() error handling
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 515e7184bdf0a3ebf1757cc77fb046b4fe282189 ]
When fail to init coex module, free 'common' and 'adapter' directly, but common->tx_thread which will access 'common' and 'adapter' is running at the same time. That will trigger the UAF bug.
==================================================================
BUG: KASAN: use-after-free in rsi_tx_scheduler_thread+0x50f/0x520 [rsi_91x] Read of size 8 at addr ffff8880076dc000 by task Tx-Thread/124777 CPU: 0 PID: 124777 Comm: Tx-Thread Not tainted 5.15.0-rc5+ #19 Call Trace: dump_stack_lvl+0xe2/0x152 print_address_description.constprop.0+0x21/0x140 ? rsi_tx_scheduler_thread+0x50f/0x520 kasan_report.cold+0x7f/0x11b ? rsi_tx_scheduler_thread+0x50f/0x520 rsi_tx_scheduler_thread+0x50f/0x520
...
Freed by task 111873: kasan_save_stack+0x1b/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x20/0x30 __kasan_slab_free+0x109/0x140 kfree+0x117/0x4c0 rsi_91x_init+0x741/0x8a0 [rsi_91x] rsi_probe+0x9f/0x1750 [rsi_usb]
Stop thread before free 'common' and 'adapter' to fix it.
--- drivers/net/wireless/rsi/rsi_91x_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rsi/rsi_91x_main.c +1 -0
@@ -368,6 +368,7 @@ struct rsi_hw *rsi_91x_init(u16 oper_mode)if (common->coex_mode >1 ) {if (rsi_coex_attach (common)) {rsi_dbg (ERR_ZONE ,"Failed to init coex module\n" ); +rsi_kill_thread (&common->tx_thread); goto err; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 174/355 spi: bcm-qspi: Fix missing clk_disable_unprepare() on error in bcm_qspi_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ca9b8f56ec089d3a436050afefd17b7237301f47 ]
Fix the missing clk_disable_unprepare() before return from bcm_qspi_probe() in the error handling case.
--- drivers/spi/spi-bcm-qspi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-bcm-qspi.c +3 -2
@@ -1300,7 +1300,7 @@ int bcm_qspi_probe(struct platform_device *pdev, &qspi->dev_ids[val]);if (ret <0 ) {dev_err (&pdev->dev,"IRQ %s not found\n" , name); - goto qspi_probe_err; + goto qspi_unprepare_err; } qspi->dev_ids[val].dev = qspi;
@@ -1315,7 +1315,7 @@ int bcm_qspi_probe(struct platform_device *pdev,if (!num_ints) {dev_err (&pdev->dev,"no IRQs registered, cannot init driver\n" ); ret = -EINVAL ; - goto qspi_probe_err; + goto qspi_unprepare_err; }/*
@@ -1359,6 +1359,7 @@ int bcm_qspi_probe(struct platform_device *pdev, qspi_reg_err:bcm_qspi_hw_uninit (qspi); +qspi_unprepare_err:clk_disable_unprepare (qspi->clk); qspi_probe_err:kfree (qspi->dev_ids);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 201/355 media: radio-wl1273: Avoid card name truncation
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit dfadec236aa99f6086141949c9dc3ec50f3ff20d ]
The "card" string only holds 31 characters (and the terminating NUL). In order to avoid truncation, use a shorter card description instead of the current result, "Texas Instruments Wl1273 FM Rad".
--- drivers/media/radio/radio-wl1273.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/radio-wl1273.c +1 -1
@@ -1279,7 +1279,7 @@ static int wl1273_fm_vidioc_querycap(struct file *file, void *priv,strscpy (capability->driver,WL1273_FM_DRIVER_NAME ,sizeof (capability->driver)); -strscpy (capability->card,"Texas Instruments Wl1273 FM Radio" , +strscpy (capability->card,"TI Wl1273 FM Radio" ,sizeof (capability->card));strscpy (capability->bus_info, radio->bus_type,sizeof (capability->bus_info));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 209/355 ath9k: Fix potential interrupt storm on queue reset
In reply to Greg Kroah-HartmanFrom: Linus Lüssing <[email protected]>
[ Upstream commit 4925642d541278575ad1948c5924d71ffd57ef14 ]
In tests with two Lima boards from 8devices (QCA4531 based) on OpenWrt 19.07 we could force a silent restart of a device with no serial output when we were sending a high amount of UDP traffic (iperf3 at 80 MBit/s in both directions from external hosts, saturating the wifi and causing a load of about 4.5 to 6) and were then triggering an ath9k_queue_reset().
Further debugging showed that the restart was caused by the ath79 watchdog. With disabled watchdog we could observe that the device was constantly going into ath_isr() interrupt handler and was returning early after the ATH_OP_HW_RESET flag test, without clearing any interrupts. Even though ath9k_queue_reset() calls ath9k_hw_kill_interrupts().
With JTAG we could observe the following race condition:
1) ath9k_queue_reset()
...
-> ath9k_hw_kill_interrupts()
-> set_bit(ATH_OP_HW_RESET, &common->op_flags);
...
<- returns
2) ath9k_tasklet()
...
-> ath9k_hw_resume_interrupts()
...
<- returns
3) loops around:
...
handle_int()
-> ath_isr()
...
-> if (test_bit(ATH_OP_HW_RESET,
&common->op_flags))
return IRQ_HANDLED;
x) ath_reset_internal():
=> never reached <=And in ath_isr() we would typically see the following interrupts / interrupt causes:
* status: 0x00111030 or 0x00110030
* async_cause: 2 (AR_INTR_MAC_IPQ)
* sync_cause: 0
So the ath9k_tasklet() reenables the ath9k interrupts through ath9k_hw_resume_interrupts() which ath9k_queue_reset() had just disabled. And ath_isr() then keeps firing because it returns IRQ_HANDLED without actually clearing the interrupt.
To fix this IRQ storm also clear/disable the interrupts again when we are in reset state.
--- drivers/net/wireless/ath/ath9k/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/main.c +3 -1
@@ -530,8 +530,10 @@ irqreturn_t ath_isr(int irq, void *dev)ath9k_debug_sync_cause (sc, sync_cause); status &= ah->imask;/* discard unasked-for bits */ -if (test_bit (ATH_OP_HW_RESET , &common->op_flags)) +if (test_bit (ATH_OP_HW_RESET , &common->op_flags)) { +ath9k_hw_kill_interrupts (sc->sc_ah);return IRQ_HANDLED ; + }/* * If there are no status bits set, then this interrupt was not
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 140/355 brcmfmac: Add DMI nvram filename quirk for Cyberbook T116 tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 49c3eb3036e6359c5c20fe76c611a2c0e0d4710e ]
The Cyberbook T116 tablet contains quite generic names in the sys_vendor and product_name DMI strings, without this patch brcmfmac will try to load:
"brcmfmac43455-sdio.Default string-Default string.txt" as nvram file which is way too generic.
The nvram file shipped on the factory Android image contains the exact same settings as those used on the AcePC T8 mini PC, so point the new DMI nvram filename quirk to the acepc-t8 nvram file.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c +10 -0
@@ -75,6 +75,16 @@ static const struct dmi_system_id dmi_platform_data[] = { }, .driver_data = (void *)&acepc_t8_data, }, + { +/* Cyberbook T116 rugged tablet */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"Default string" ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"Cherry Trail CR" ), + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"), + }, +/* The factory image nvram file is identical to the ACEPC T8 one */ + .driver_data = (void *)&acepc_t8_data, + }, {/* Match for the GPDwin which unfortunately uses somewhat * generic dmi strings, which is why we test for 4 strings.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 189/355 Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 3e5f2d90c28f9454e421108554707620bc23269d ]
bdev->evt_skb will get freed in the normal path and one error path of mtk_hci_wmt_sync, while the other error paths do not free it, which may cause a memleak. This bug is suggested by a static analysis tool, please advise.
--- drivers/bluetooth/btmtkuart.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/bluetooth/btmtkuart.c +8 -5
@@ -158,8 +158,10 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,int err; hlen =sizeof (*hdr) + wmt_params->dlen; -if (hlen >255 ) -return -EINVAL ; +if (hlen >255 ) { + err = -EINVAL ; + goto err_free_skb; + } hdr = (struct mtk_wmt_hdr *)&wc; hdr->dir =1 ;
@@ -173,7 +175,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, err =__hci_cmd_send (hdev,0xfc6f , hlen, &wc);if (err <0 ) {clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return err; + goto err_free_skb; }/* The vendor specific WMT commands are all answered by a vendor
@@ -190,13 +192,14 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,if (err == -EINTR ) {bt_dev_err (hdev,"Execution of wmt command interrupted" );clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return err; + goto err_free_skb; }if (err) {bt_dev_err (hdev,"Execution of wmt command timed out" );clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return -ETIMEDOUT ; + err = -ETIMEDOUT ; + goto err_free_skb; }/* Parse and handle the return WMT event */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 138/355 media: mceusb: return without resubmitting URB in case of -EPROTO error.
In reply to Greg Kroah-HartmanFrom: Rajat Asthana <[email protected]>
[ Upstream commit 476db72e521983ecb847e4013b263072bb1110fc ]
Syzkaller reported a warning called "rcu detected stall in dummy_timer".
The error seems to be an error in mceusb_dev_recv(). In the case of -EPROTO error, the routine immediately resubmits the URB. Instead it should return without resubmitting URB.
--- drivers/media/rc/mceusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/rc/mceusb.c +1 -0
@@ -1386,6 +1386,7 @@ static void mceusb_dev_recv(struct urb *urb)case -ECONNRESET :case -ENOENT :case -EILSEQ : +case -EPROTO :case -ESHUTDOWN :usb_unlink_urb (urb);return ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 198/355 media: TDA1997x: handle short reads of hdmi info frame.
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 48d219f9cc667bc6fbc3e3af0b1bfd75db94fce4 ]
Static analysis reports this representative problem
tda1997x.c:1939: warning: 7th function call argument is an uninitialized value
The 7th argument is buffer[0], which is set in the earlier call to io_readn(). When io_readn() call to io_read() fails with the first read, buffer[0] is not set and 0 is returned and stored in len.
The later call to hdmi_infoframe_unpack()'s size parameter is the static size of buffer, always 40, so a short read is not caught in hdmi_infoframe_unpacks()'s checking. The variable len should be used instead.
Zero initialize buffer to 0 so it is in a known start state.
--- drivers/media/i2c/tda1997x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/i2c/tda1997x.c +4 -4
@@ -1247,13 +1247,13 @@ tda1997x_parse_infoframe(struct tda1997x_state *state, u16 addr) {struct v4l2_subdev *sd = &state->sd;union hdmi_infoframe frame; -u8 buffer[40 ]; +u8 buffer[40 ] = {0 };u8 reg;int len, err;/* read data */ len =io_readn (sd, addr,sizeof (buffer), buffer); - err =hdmi_infoframe_unpack (&frame, buffer,sizeof (buffer)); + err =hdmi_infoframe_unpack (&frame, buffer, len);if (err) { v4l_err(state->client, "failed parsing %d byte infoframe: 0x%04x/0x%02x\n",
@@ -1927,13 +1927,13 @@ static int tda1997x_log_infoframe(struct v4l2_subdev *sd, int addr) {struct tda1997x_state *state =to_state (sd);union hdmi_infoframe frame; -u8 buffer[40 ]; +u8 buffer[40 ] = {0 };int len, err;/* read data */ len =io_readn (sd, addr,sizeof (buffer), buffer);v4l2_dbg (1 , debug, sd,"infoframe: addr=%d len=%d\n" , addr, len); - err =hdmi_infoframe_unpack (&frame, buffer,sizeof (buffer)); + err =hdmi_infoframe_unpack (&frame, buffer, len);if (err) { v4l_err(state->client, "failed parsing %d byte infoframe: 0x%04x/0x%02x\n",
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 256/355 RDMA/rxe: Fix wrong port_cap_flags
In reply to Greg Kroah-HartmanFrom: Junji Wei <[email protected]>
[ Upstream commit dcd3f985b20ffcc375f82ca0ca9f241c7025eb5e ]
The port->attr.port_cap_flags should be set to enum ib_port_capability_mask_bits in ib_mad.h, not RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP.
--- drivers/infiniband/sw/rxe/rxe_param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_param.h +1 -1
@@ -140,7 +140,7 @@ enum rxe_device_param {/* default/initial rxe port parameters */ enum rxe_port_param {RXE_PORT_GID_TBL_LEN =1024 , -RXE_PORT_PORT_CAP_FLAGS =RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP , +RXE_PORT_PORT_CAP_FLAGS =IB_PORT_CM_SUP ,RXE_PORT_MAX_MSG_SZ =0x800000 ,RXE_PORT_BAD_PKEY_CNTR =0 ,RXE_PORT_QKEY_VIOL_CNTR =0 ,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 250/355 net: phylink: avoid mvneta warning when setting pause parameters
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit fd8d9731bcdfb22d28e45bce789bcb211c868c78 ]
mvneta does not support asymetric pause modes, and it flags this by the lack of AsymPause in the supported field. When setting pause modes, we check that pause->rx_pause == pause->tx_pause, but only when pause autoneg is enabled. When pause autoneg is disabled, we still allow pause->rx_pause != pause->tx_pause, which is incorrect when the MAC does not support asymetric pause, and causes mvneta to issue a warning.
Fix this by removing the test for pause->autoneg, so we always check that pause->rx_pause == pause->tx_pause for network devices that do not support AsymPause.
--- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
@@ -1331,7 +1331,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,return -EOPNOTSUPP ;if (!phylink_test (pl->supported, Asym_Pause) && - !pause->autoneg && pause->rx_pause != pause->tx_pause) + pause->rx_pause != pause->tx_pause)return -EINVAL ; config->pause &= ~(MLO_PAUSE_AN |MLO_PAUSE_TXRX_MASK );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 255/355 ibmvnic: Process crqs after enabling interrupts
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 6e20d00158f31f7631d68b86996b7e951c4451c8 ]
Soon after registering a CRQ it is possible that we get a fail over or maybe a CRQ_INIT from the VIOS while interrupts were disabled.
Look for any such CRQs after enabling interrupts.
Otherwise we can intermittently fail to bring up ibmvnic adapters during boot, specially in kexec/kdump kernels.
--- drivers/net/ethernet/ibm/ibmvnic.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/ibm/ibmvnic.c +3 -0
@@ -4934,6 +4934,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter) crq->cur =0 ;spin_lock_init (&crq->lock); +/* process any CRQs that were queued before we enabled interrupts */ +tasklet_schedule (&adapter->tasklet); +return retrc; req_irq_failed:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 260/355 ARM: dts: qcom: msm8974: Add xo_board reference clock to DSI0 PHY
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 8ccecf6c710b8c048eecc65709640642e5357d6e ]
According to YAML validation, and for a future patchset putting this xo_board reference clock to use as VCO reference parent, add the missing clock to dsi_phy0.
--- arch/arm/boot/dts/qcom-msm8974.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-msm8974.dtsi +2 -2
@@ -1213,8 +1213,8 @@ #phy-cells = <0>; qcom,dsi-phy-index = <0>; - clocks = <&mmcc MDSS_AHB_CLK>; - clock-names = "iface"; + clocks = <&mmcc MDSS_AHB_CLK>, <&xo_board>; + clock-names = "iface", "ref"; }; }; };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 262/355 arm64: dts: meson-g12a: Fix the pwm regulator supply properties
In reply to Greg Kroah-HartmanFrom: Anand Moon <[email protected]>
[ Upstream commit 085675117ecf5e02c4220698fd549024ec64ad2c ]
After enabling CONFIG_REGULATOR_DEBUG=y we observe below debug logs. Changes help link VDDCPU pwm regulator to 12V regulator supply instead of dummy regulator.
[ 11.602281] pwm-regulator regulator-vddcpu: Looking up pwm-supply property
in node /regulator-vddcpu failed
[ 11.602344] VDDCPU: supplied by regulator-dummy
[ 11.602365] regulator-dummy: could not add device link regulator.11: -ENOENT
[ 11.602548] VDDCPU: 721 <--> 1022 mV at 1022 mV, enabled--- arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +1 -1
@@ -139,7 +139,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&dc_in>; + pwm-supply = <&dc_in>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts +1 -1
@@ -139,7 +139,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&main_12v>; + pwm-supply = <&main_12v>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts +1 -1
@@ -139,7 +139,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&dc_in>; + pwm-supply = <&dc_in>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 261/355 RDMA/bnxt_re: Fix query SRQ failure
In reply to Greg Kroah-HartmanFrom: Selvin Xavier <[email protected]>
[ Upstream commit 598d16fa1bf93431ad35bbab3ed1affe4fb7b562 ]
Fill the missing parameters for the FW command while querying SRQ.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +2 -1
@@ -642,12 +642,13 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,int rc =0 ;RCFW_CMD_PREP (req,QUERY_SRQ , cmd_flags); - req.srq_cid =cpu_to_le32 (srq->id);/* Configure the request */ sbuf =bnxt_qplib_rcfw_alloc_sbuf (rcfw,sizeof (*sb));if (!sbuf)return -ENOMEM ; + req.resp_size =sizeof (*sb) /BNXT_QPLIB_CMDQE_UNITS ; + req.srq_cid =cpu_to_le32 (srq->id); sb = sbuf->sb; rc =bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp, (void *)sbuf,0 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 258/355 ARM: s3c: irq-s3c24xx: Fix return value check for s3c24xx_init_intc()
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit 2aa717473ce96c93ae43a5dc8c23cedc8ce7dd9f ]
The s3c24xx_init_intc() returns an error pointer upon failure, not NULL. let's add an error pointer check in s3c24xx_handle_irq.
s3c_intc[0] is not NULL or ERR, we can simplify the code.
--- drivers/irqchip/irq-s3c24xx.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/irqchip/irq-s3c24xx.c +18 -4
@@ -359,11 +359,25 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc, asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs) { do { - if (likely(s3c_intc[0])) - if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) - continue; + /* + * For platform based machines, neither ERR nor NULL can happen here. + * The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds: + * + * s3c_intc[0] = s3c24xx_init_intc() + * + * If this fails, the next calls to s3c24xx_init_intc() won't be executed. + * + * For DT machine, s3c_init_intc_of() could set the IRQ handler without + * setting s3c_intc[0] only if it was called with num_ctrl=0. There is no + * such code path, so again the s3c_intc[0] will have a valid pointer if + * set_handle_irq() is called. + * + * Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something. + */ + if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) + continue; - if (s3c_intc[2]) + if (!IS_ERR_OR_NULL(s3c_intc[2])) if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) continue;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 263/355 ARM: dts: at91: tse850: the emac<->phy interface is rmii
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit dcdbc335a91a26e022a803e1a6b837266989c032 ]
This went unnoticed until commit 7897b071ac3b ("net: macb: convert to phylink") which tickled the problem. The sama5d3 emac has never been capable of rgmii, and it all just happened to work before that commit.
--- arch/arm/boot/dts/at91-tse850-3.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/at91-tse850-3.dts +1 -1
@@ -262,7 +262,7 @@ &macb1 { status = "okay"; - phy-mode = "rgmii"; + phy-mode = "rmii"; #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 259/355 arm64: dts: rockchip: Fix GPU register width for RK3328
In reply to Greg Kroah-HartmanFrom: Alex Bee <[email protected]>
[ Upstream commit 932b4610f55b49f3a158b0db451137bab7ed0e1f ]
As can be seen in RK3328's TRM the register range for the GPU is 0xff300000 to 0xff330000.
It would (and does in vendor kernel) overlap with the registers of the HEVC encoder (node/driver do not exist yet in upstream kernel). See already existing h265e_mmu node.
--- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +1 -1
@@ -555,7 +555,7 @@ gpu: gpu@ff300000 { compatible = "rockchip,rk3328-mali", "arm,mali-450"; - reg = <0x0 0xff300000 0x0 0x40000>; + reg = <0x0 0xff300000 0x0 0x30000>; interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 242/355 tcp: dont free a FIN sk_buff in tcp_remove_empty_skb()
In reply to Greg Kroah-HartmanFrom: Jon Maxwell <[email protected]>
[ Upstream commit cf12e6f9124629b18a6182deefc0315f0a73a199 ]
v1: Implement a more general statement as recommended by Eric Dumazet. The sequence number will be advanced, so this check will fix the FIN case and other cases.
A customer reported sockets stuck in the CLOSING state. A Vmcore revealed that the write_queue was not empty as determined by tcp_write_queue_empty() but the sk_buff containing the FIN flag had been freed and the socket was zombied in that state. Corresponding pcaps show no FIN from the Linux kernel on the wire.
Some instrumentation was added to the kernel and it was found that there is a timing window where tcp_sendmsg() can run after tcp_send_fin().
tcp_sendmsg() will hit an error, for example:
1269 ▹ if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))↩
1270 ▹ ▹ goto do_error;↩
tcp_remove_empty_skb() will then free the FIN sk_buff as "skb->len == 0". The TCP socket is now wedged in the FIN-WAIT-1 state because the FIN is never sent.
If the other side sends a FIN packet the socket will transition to CLOSING and remain that way until the system is rebooted.
Fix this by checking for the FIN flag in the sk_buff and don't free it if that is the case. Testing confirmed that fixed the issue.
--- net/ipv4/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +1 -1
@@ -955,7 +955,7 @@ static int tcp_send_mss(struct sock *sk, int *size_goal, int flags)*/ static void tcp_remove_empty_skb (struct sock *sk,struct sk_buff *skb) { -if (skb && !skb->len) { +if (skb &&TCP_SKB_CB (skb)->seq ==TCP_SKB_CB (skb)->end_seq) {tcp_unlink_write_queue (skb, sk);if (tcp_write_queue_empty (sk))tcp_chrono_stop (sk,TCP_CHRONO_BUSY );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 257/355 clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit af9617b419f77cf0b99702a7b2b0519da0d27715 ]
If we exit the for_each_of_cpu_node loop early, the reference on the current node must be decremented, otherwise there is a leak.
--- drivers/clk/mvebu/ap-cpu-clk.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/clk/mvebu/ap-cpu-clk.c +11 -3
@@ -256,12 +256,15 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)int cpu, err; err =of_property_read_u32 (dn,"reg" , &cpu); -if (WARN_ON (err)) +if (WARN_ON (err)) { +of_node_put (dn);return err; + }/* If cpu2 or cpu3 is enabled */ if (cpu &APN806_CLUSTER_NUM_MASK ) { nclusters =2 ; +of_node_put (dn);break ; } }
@@ -288,8 +291,10 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)int cpu, err; err =of_property_read_u32 (dn,"reg" , &cpu); -if (WARN_ON (err)) +if (WARN_ON (err)) { +of_node_put (dn);return err; + } cluster_index = cpu &APN806_CLUSTER_NUM_MASK ; cluster_index >>=APN806_CLUSTER_NUM_OFFSET ;
@@ -301,6 +306,7 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) parent =of_clk_get (np, cluster_index);if (IS_ERR (parent)) {dev_err (dev,"Could not get the clock parent\n" ); +of_node_put (dn);return -EINVAL ; } parent_name =__clk_get_name (parent);
@@ -319,8 +325,10 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) init.parent_names = &parent_name; ret =devm_clk_hw_register (dev, &ap_cpu_clk[cluster_index].hw); -if (ret) +if (ret) { +of_node_put (dn);return ret; + } ap_cpu_data->hws[cluster_index] = &ap_cpu_clk[cluster_index].hw; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 254/355 ibmvnic: dont stop queue in xmit
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 8878e46fcfd46b19964bd90e13b25dd94cbfc9be ]
If adapter's resetting bit is on, discard the packet but don't stop the transmit queue - instead leave that to the reset code. With this change, it is possible that we may get several calls to ibmvnic_xmit() that simply discard packets and return.
But if we stop the queue here, we might end up doing so just after __ibmvnic_open() started the queues (during a hard/soft reset) and before the ->resetting bit was cleared. If that happens, there will be no one to restart queue and transmissions will be blocked indefinitely.
This can cause a TIMEOUT reset and with auto priority failover enabled, an unnecessary FAILOVER reset to less favored backing device and then a FAILOVER back to the most favored backing device. If we hit the window repeatedly, we can get stuck in a loop of TIMEOUT, FAILOVER, FAILOVER resets leaving the adapter unusable for extended periods of time.
--- drivers/net/ethernet/ibm/ibmvnic.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -2
@@ -1462,8 +1462,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)netdev_tx_t ret =NETDEV_TX_OK ;if (test_bit (0 , &adapter->resetting)) { -if (!netif_subqueue_stopped (netdev, skb)) -netif_stop_subqueue (netdev, queue_num);dev_kfree_skb_any (skb); tx_send_failed++;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 251/355 crypto: pcrypt - Delay write to padata->info
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
[ Upstream commit 68b6dea802cea0dbdd8bd7ccc60716b5a32a5d8a ]
These three events can race when pcrypt is used multiple times in a template ("pcrypt(pcrypt(...))"):
1. [taskA] The caller makes the crypto request via crypto_aead_encrypt() 2. [kworkerB] padata serializes the inner pcrypt request 3. [kworkerC] padata serializes the outer pcrypt request
3 might finish before the call to crypto_aead_encrypt() returns in 1, resulting in two possible issues.
First, a use-after-free of the crypto request's memory when, for example, taskA writes to the outer pcrypt request's padata->info in pcrypt_aead_enc() after kworkerC completes the request.
Second, the outer pcrypt request overwrites the inner pcrypt request's return code with -EINPROGRESS, making a successful request appear to fail. For instance, kworkerB writes the outer pcrypt request's padata->info in pcrypt_aead_done() and then taskA overwrites it in pcrypt_aead_enc().
Avoid both situations by delaying the write of padata->info until after the inner crypto request's return code is checked. This prevents the use-after-free by not touching the crypto request's memory after the next-inner crypto request is made, and stops padata->info from being overwritten.
--- crypto/pcrypt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
crypto/pcrypt.c +8 -4
@@ -79,12 +79,14 @@ static void pcrypt_aead_enc(struct padata_priv *padata) {struct pcrypt_request *preq =pcrypt_padata_request (padata);struct aead_request *req =pcrypt_request_ctx (preq); +int ret; - padata->info =crypto_aead_encrypt (req); + ret =crypto_aead_encrypt (req); -if (padata->info == -EINPROGRESS ) +if (ret == -EINPROGRESS )return ; + padata->info = ret;padata_do_serial (padata); }
@@ -124,12 +126,14 @@ static void pcrypt_aead_dec(struct padata_priv *padata) {struct pcrypt_request *preq =pcrypt_padata_request (padata);struct aead_request *req =pcrypt_request_ctx (preq); +int ret; - padata->info =crypto_aead_decrypt (req); + ret =crypto_aead_decrypt (req); -if (padata->info == -EINPROGRESS ) +if (ret == -EINPROGRESS )return ; + padata->info = ret;padata_do_serial (padata); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 241/355 irq: mips: avoid nested irq_enter()
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit c65b52d02f6c1a06ddb20cba175ad49eccd6410d ]
As bcm6345_l1_irq_handle() is a chained irqchip handler, it will be invoked within the context of the root irqchip handler, which must have entered IRQ context already.
When bcm6345_l1_irq_handle() calls arch/mips's do_IRQ() , this will nest another call to irq_enter(), and the resulting nested increment to rcu_data.dynticks_nmi_nesting will cause rcu_is_cpu_rrupt_from_idle() to fail to identify wakeups from idle, resulting in failure to preempt, and RCU stalls.
Chained irqchip handlers must invoke IRQ handlers by way of thee core irqchip code, i.e. generic_handle_irq() or generic_handle_domain_irq() and should not call do_IRQ(), which is intended only for root irqchip handlers.
Fix bcm6345_l1_irq_handle() by calling generic_handle_irq() directly.
--- drivers/irqchip/irq-bcm6345-l1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-bcm6345-l1.c +1 -1
@@ -140,7 +140,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc)for_each_set_bit (hwirq, &pending,IRQS_PER_WORD ) { irq =irq_linear_revmap (intc->domain, base + hwirq);if (irq) -do_IRQ (irq); +generic_handle_irq (irq);else spurious_interrupt (); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 252/355 selftests/bpf: Fix fclose/pclose mismatch in test_progs
In reply to Greg Kroah-HartmanFrom: Andrea Righi <[email protected]>
[ Upstream commit f48ad69097fe79d1de13c4d8fef556d4c11c5e68 ]
Make sure to use pclose() to properly close the pipe opened by popen().
--- tools/testing/selftests/bpf/test_progs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/test_progs.c +2 -2
@@ -289,7 +289,7 @@ int extract_build_id(char *build_id, size_t size)if (getline (&line, &len, fp) ==-1 ) goto err; -fclose (fp); +pclose (fp);if (len > size) len = size;
@@ -298,7 +298,7 @@ int extract_build_id(char *build_id, size_t size)free (line);return 0 ; err: -fclose (fp); +pclose (fp);return -1 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 214/355 crypto: qat - disregard spurious PFVF interrupts
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 18fcba469ba5359c1de7e3fb16f7b9e8cd1b8e02 ]
Upon receiving a PFVF message, check if the interrupt bit is set in the message. If it is not, that means that the interrupt was probably triggered by a collision. In this case, disregard the message and re-enable the interrupts.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 6 ++++++ drivers/crypto/qat/qat_common/adf_vf_isr.c | 6 ++++++ 2 files changed, 12 insertions(+)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +6 -0
@@ -250,6 +250,11 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)/* Read message from the VF */ msg =ADF_CSR_RD (pmisc_addr, hw_data->get_pf2vf_offset (vf_nr)); +if (!(msg &ADF_VF2PF_INT )) { +dev_info (&GET_DEV (accel_dev), +"Spurious VF2PF interrupt, msg %X. Ignored\n" , msg); + goto out; + }/* To ACK, clear the VF2PFINT bit */ msg &= ~ADF_VF2PF_INT ;
@@ -333,6 +338,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)if (resp &&adf_iov_putmsg (accel_dev, resp, vf_nr))dev_err (&GET_DEV (accel_dev),"Failed to send response to VF\n" ); +out:/* re-enable interrupt on PF from this VF */ adf_enable_vf2pf_interrupts (accel_dev, (1 << vf_nr));return ;
drivers/crypto/qat/qat_common/adf_vf_isr.c +6 -0
@@ -123,6 +123,11 @@ static void adf_pf2vf_bh_handler(void *data)/* Read the message from PF */ msg =ADF_CSR_RD (pmisc_bar_addr, hw_data->get_pf2vf_offset (0 )); +if (!(msg &ADF_PF2VF_INT )) { +dev_info (&GET_DEV (accel_dev), +"Spurious PF2VF interrupt, msg %X. Ignored\n" , msg); + goto out; + }if (!(msg &ADF_PF2VF_MSGORIGIN_SYSTEM ))/* Ignore legacy non-system (non-kernel) PF2VF messages */
@@ -171,6 +176,7 @@ static void adf_pf2vf_bh_handler(void *data) msg &= ~ADF_PF2VF_INT ;ADF_CSR_WR (pmisc_bar_addr, hw_data->get_pf2vf_offset (0 ), msg); +out:/* Re-enable PF2VF interrupts */ adf_enable_pf2vf_interrupts (accel_dev);return ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 253/355 udp6: allow SO_MARK ctrl msg to affect routing
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 42dcfd850e514b229d616a53dec06d0f2533217c ]
Commit c6af0c227a22 ("ip: support SO_MARK cmsg") added propagation of SO_MARK from cmsg to skb->mark. For IPv4 and raw sockets the mark also affects route lookup, but in case of IPv6 the flow info is initialized before cmsg is parsed.
--- net/ipv6/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/udp.c +1 -1
@@ -1363,7 +1363,6 @@ do_udp_sendmsg:if (!fl6.flowi6_oif) fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; - fl6.flowi6_mark = ipc6.sockc.mark; fl6.flowi6_uid = sk->sk_uid;if (msg->msg_controllen) {
@@ -1399,6 +1398,7 @@ do_udp_sendmsg: ipc6.opt = opt; fl6.flowi6_proto = sk->sk_protocol; + fl6.flowi6_mark = ipc6.sockc.mark; fl6.daddr = *daddr;if (ipv6_addr_any (&fl6.saddr) && !ipv6_addr_any (&np->saddr)) fl6.saddr = np->saddr;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 205/355 kprobes: Do not use local variable when creating debugfs file
In reply to Greg Kroah-HartmanFrom: Punit Agrawal <[email protected]>
[ Upstream commit 8f7262cd66699a4b02eb7549b35c81b2116aad95 ]
debugfs_create_file() takes a pointer argument that can be used during file operation callbacks (accessible via i_private in the inode structure). An obvious requirement is for the pointer to refer to valid memory when used.
When creating the debugfs file to dynamically enable / disable kprobes, a pointer to local variable is passed to debugfs_create_file(); which will go out of scope when the init function returns. The reason this hasn't triggered random memory corruption is because the pointer is not accessed during the debugfs file callbacks.
Since the enabled state is managed by the kprobes_all_disabled global variable, the local variable is not needed. Fix the incorrect (and unnecessary) usage of local variable during debugfs_file_create() by passing NULL instead.
--- kernel/kprobes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/kprobes.c +1 -2
@@ -2712,14 +2712,13 @@ static const struct file_operations fops_kp = {static int __init debugfs_kprobe_init (void ) {struct dentry *dir; -unsigned int value =1 ; dir =debugfs_create_dir ("kprobes" ,NULL );debugfs_create_file ("list" ,0400 , dir,NULL , &debugfs_kprobes_operations); -debugfs_create_file ("enabled" ,0600 , dir, &value, &fops_kp); +debugfs_create_file ("enabled" ,0600 , dir,NULL , &fops_kp);debugfs_create_file ("blacklist" ,0400 , dir,NULL , &debugfs_kprobe_blacklist_ops);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 264/355 scsi: dc395: Fix error case unwinding
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit cbd9a3347c757383f3d2b50cf7cfd03eb479c481 ]
dc395x_init_one()->adapter_init() might fail. In this case, the acb is already cleaned up by adapter_init(), no need to do that in adapter_uninit(acb) again.
[ 1.252251] dc395x: adapter init failed [ 1.254900] RIP: 0010:adapter_uninit+0x94/0x170 [dc395x] [ 1.260307] Call Trace: [ 1.260442] dc395x_init_one.cold+0x72a/0x9bb [dc395x]
--- drivers/scsi/dc395x.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/dc395x.c +1 -0
@@ -4698,6 +4698,7 @@ static int dc395x_init_one(struct pci_dev *dev, const struct pci_device_id *id)/* initialise the adapter and everything we need */ if (adapter_init (acb, io_port_base, io_port_len, irq)) {dprintkl (KERN_INFO ,"adapter init failed\n" ); + acb =NULL ; goto fail; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 265/355 MIPS: loongson64: make CPU_LOONGSON64 depends on MIPS_FP_SUPPORT
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit 7f3b3c2bfa9c93ab9b5595543496f570983dc330 ]
mach/loongson64 fails to build when the FPU support is disabled:
arch/mips/loongson64/cop2-ex.c:45:15: error: implicit declaration of function ‘__is_fpu_owner’; did you mean ‘is_fpu_owner’? [-Werror=implicit-function-declaration] arch/mips/loongson64/cop2-ex.c:98:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:99:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:131:43: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:137:38: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:203:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:219:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:283:38: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:301:38: error: ‘struct thread_struct’ has no member named ‘fpu’
--- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/Kconfig +1 -0
@@ -1393,6 +1393,7 @@ config CPU_LOONGSON3 select WEAK_REORDERING_BEYOND_LLSC select MIPS_PGD_C0_CONTEXT select MIPS_L1_CACHE_SHIFT_6 + select MIPS_FP_SUPPORT select GPIOLIB select SWIOTLB help
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 266/355 JFS: fix memleak in jfs_mount
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit c48a14dca2cb57527dde6b960adbe69953935f10 ]
In jfs_mount, when diMount(ipaimap2) fails, it goes to errout35. However, the following code does not free ipaimap2 allocated by diReadSpecial.
Fix this by refactoring the error handling code of jfs_mount. To be specific, modify the lable name and free ipaimap2 when the above error ocurrs.
--- fs/jfs/jfs_mount.c | 51 ++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 29 deletions(-)
fs/jfs/jfs_mount.c +22 -29
@@ -80,14 +80,14 @@ int jfs_mount(struct super_block *sb)* (initialize mount inode from the superblock) */ if ((rc =chkSuper (sb))) { - goto errout20; + goto out; } ipaimap =diReadSpecial (sb,AGGREGATE_I ,0 );if (ipaimap ==NULL ) {jfs_err ("jfs_mount: Failed to read AGGREGATE_I" ); rc = -EIO ; - goto errout20; + goto out; } sbi->ipaimap = ipaimap;
@@ -98,7 +98,7 @@ int jfs_mount(struct super_block *sb)*/ if ((rc =diMount (ipaimap))) {jfs_err ("jfs_mount: diMount(ipaimap) failed w/rc = %d" , rc); - goto errout21; + goto err_ipaimap; }/*
@@ -107,7 +107,7 @@ int jfs_mount(struct super_block *sb) ipbmap =diReadSpecial (sb,BMAP_I ,0 );if (ipbmap ==NULL ) { rc = -EIO ; - goto errout22; + goto err_umount_ipaimap; }jfs_info ("jfs_mount: ipbmap:0x%p" , ipbmap);
@@ -119,7 +119,7 @@ int jfs_mount(struct super_block *sb)*/ if ((rc =dbMount (ipbmap))) {jfs_err ("jfs_mount: dbMount failed w/rc = %d" , rc); - goto errout22; + goto err_ipbmap; }/*
@@ -138,7 +138,7 @@ int jfs_mount(struct super_block *sb)if (!ipaimap2) {jfs_err ("jfs_mount: Failed to read AGGREGATE_I" ); rc = -EIO ; - goto errout35; + goto err_umount_ipbmap; } sbi->ipaimap2 = ipaimap2;
@@ -150,7 +150,7 @@ int jfs_mount(struct super_block *sb)if ((rc =diMount (ipaimap2))) {jfs_err ("jfs_mount: diMount(ipaimap2) failed, rc = %d" , rc); - goto errout35; + goto err_ipaimap2; } }else /* Secondary aggregate inode table is not valid */
@@ -167,7 +167,7 @@ int jfs_mount(struct super_block *sb)jfs_err ("jfs_mount: Failed to read FILESYSTEM_I" );/* open fileset secondary inode allocation map */ rc = -EIO ; - goto errout40; + goto err_umount_ipaimap2; }jfs_info ("jfs_mount: ipimap:0x%p" , ipimap);
@@ -177,41 +177,34 @@ int jfs_mount(struct super_block *sb)/* initialize fileset inode allocation map */ if ((rc =diMount (ipimap))) {jfs_err ("jfs_mount: diMount failed w/rc = %d" , rc); - goto errout41; + goto err_ipimap; } - goto out; +return rc;/* * unwind on error */ - errout41:/* close fileset inode allocation map inode */ +err_ipimap: +/* close fileset inode allocation map inode */ diFreeSpecial (ipimap); - - errout40:/* fileset closed */ - +err_umount_ipaimap2:/* close secondary aggregate inode allocation map */ -if (ipaimap2) { +if (ipaimap2)diUnmount (ipaimap2,1 ); +err_ipaimap2: +/* close aggregate inodes */ +if (ipaimap2)diFreeSpecial (ipaimap2); - } - - errout35: - -/* close aggregate block allocation map */ +err_umount_ipbmap:/* close aggregate block allocation map */ dbUnmount (ipbmap,1 ); +err_ipbmap:/* close aggregate inodes */ diFreeSpecial (ipbmap); - - errout22:/* close aggregate inode allocation map */ - +err_umount_ipaimap:/* close aggregate inode allocation map */ diUnmount (ipaimap,1 ); - - errout21:/* close aggregate inodes */ +err_ipaimap:/* close aggregate inodes */ diFreeSpecial (ipaimap); - errout20:/* aggregate closed */ - - out: - +out:if (rc)jfs_err ("Mount JFS Failure: %d" , rc);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 247/355 wcn36xx: add proper DMA memory barriers in rx path
In reply to Greg Kroah-HartmanFrom: Benjamin Li <[email protected]>
[ Upstream commit 9bfe38e064af5decba2ffce66a2958ab8b10eaa4 ]
This is essentially exactly following the dma_wmb()/dma_rmb() usage instructions in Documentation/memory-barriers.txt.
The theoretical races here are:
1. DXE (the DMA Transfer Engine in the Wi-Fi subsystem) seeing the dxe->ctrl & WCN36xx_DXE_CTRL_VLD write before the dxe->dst_addr_l write, thus performing DMA into the wrong address.
2. CPU reading dxe->dst_addr_l before DXE unsets dxe->ctrl & WCN36xx_DXE_CTRL_VLD. This should generally be harmless since DXE doesn't write dxe->dst_addr_l (no risk of freeing the wrong skb).
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/dxe.c +11 -1
@@ -563,6 +563,10 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn, dxe = ctl->desc;while (!(READ_ONCE (dxe->ctrl) & WCN36xx_DXE_CTRL_VLD)) { +/* do not read until we own DMA descriptor */ +dma_rmb (); + +/* read/modify DMA descriptor */ skb = ctl->skb; dma_addr = dxe->dst_addr_l; ret =wcn36xx_dxe_fill_skb (wcn->dev, ctl,GFP_ATOMIC );
@@ -573,9 +577,15 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,dma_unmap_single (wcn->dev, dma_addr,WCN36XX_PKT_SIZE ,DMA_FROM_DEVICE );wcn36xx_rx_skb (wcn, skb); - }/* else keep old skb not submitted and use it for rx DMA */ + } +/* else keep old skb not submitted and reuse it for rx DMA +* (dropping the packet that it contained) +*/ +/* flush descriptor changes before re-marking as valid */ +dma_wmb (); dxe->ctrl = ctrl; + ctl = ctl->next; dxe = ctl->desc; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 249/355 net: amd-xgbe: Toggle PLL settings during rate change
In reply to Greg Kroah-HartmanFrom: Shyam Sundar S K <[email protected]>
[ Upstream commit daf182d360e509a494db18666799f4e85d83dda0 ]
For each rate change command submission, the FW has to do a phy power off sequence internally. For this to happen correctly, the PLL re-initialization control setting has to be turned off before sending mailbox commands and re-enabled once the command submission is complete.
Without the PLL control setting, the link up takes longer time in a fixed phy configuration.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 8 ++++++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 20 +++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +8 -0
@@ -1331,6 +1331,10 @@#define MDIO_VEND2_PMA_CDR_CONTROL 0x8056#endif +#ifndef MDIO_VEND2_PMA_MISC_CTRL0 +#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090 +#endif +#ifndef MDIO_CTRL1_SPEED1G #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)#endif
@@ -1389,6 +1393,10 @@#define XGBE_PMA_RX_RST_0_RESET_ON 0x10#define XGBE_PMA_RX_RST_0_RESET_OFF 0x00 +#define XGBE_PMA_PLL_CTRL_MASK BIT(15) +#define XGBE_PMA_PLL_CTRL_ENABLE BIT(15) +#define XGBE_PMA_PLL_CTRL_DISABLE 0x0000 +/* Bit setting and getting macros * The get macro will extract the current bit field value from within * the variable
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +19 -1
@@ -1972,12 +1972,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) } } +static void xgbe_phy_pll_ctrl (struct xgbe_prv_data *pdata,bool enable) +{ +XMDIO_WRITE_BITS (pdata,MDIO_MMD_PMAPMD ,MDIO_VEND2_PMA_MISC_CTRL0 , +XGBE_PMA_PLL_CTRL_MASK , + enable ?XGBE_PMA_PLL_CTRL_ENABLE + :XGBE_PMA_PLL_CTRL_DISABLE ); + +/* Wait for command to complete */ +usleep_range (100 ,200 ); +} +static void xgbe_phy_perform_ratechange (struct xgbe_prv_data *pdata,unsigned int cmd,unsigned int sub_cmd) {unsigned int s0 =0 ;unsigned int wait; +/* Disable PLL re-initialization during FW command processing */ +xgbe_phy_pll_ctrl (pdata, false); +/* Log if a previous command did not complete */ if (XP_IOREAD_BITS (pdata,XP_DRIVER_INT_RO ,STATUS )) { netif_dbg(pdata, link, pdata->netdev,
@@ -1998,7 +2012,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, wait =XGBE_RATECHANGE_COUNT ;while (wait--) {if (!XP_IOREAD_BITS (pdata,XP_DRIVER_INT_RO ,STATUS )) -return ; + goto reenable_pll;usleep_range (1000 ,2000 ); }
@@ -2008,6 +2022,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,/* Reset on error */ xgbe_phy_rx_reset (pdata); + +reenable_pll: +/* Enable PLL re-initialization */ +xgbe_phy_pll_ctrl (pdata, true); }static void xgbe_phy_rrc (struct xgbe_prv_data *pdata)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 248/355 drm/amdgpu/gmc6: fix DMA mask from 44 to 40 bits
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 403475be6d8b122c3e6b8a47e075926d7299e5ef ]
The DMA mask on SI parts is 40 bits not 44. Copy paste typo.
--- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -2
@@ -863,12 +863,12 @@ static int gmc_v6_0_sw_init(void *handle) adev->gmc.mc_mask =0xffffffffffULL ; - r =dma_set_mask_and_coherent (adev->dev,DMA_BIT_MASK (44 )); + r =dma_set_mask_and_coherent (adev->dev,DMA_BIT_MASK (40 ));if (r) {dev_warn (adev->dev,"amdgpu: No suitable DMA available.\n" );return r; } - adev->need_swiotlb =drm_need_swiotlb (44 ); + adev->need_swiotlb =drm_need_swiotlb (40 ); r =gmc_v6_0_init_microcode (adev);if (r) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 245/355 libertas_tf: Fix possible memory leak in probe and disconnect
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit d549107305b4634c81223a853701c06bcf657bc3 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88810a2ddc00 (size 512):
comm "kworker/6:1", pid 176, jiffies 4295009893 (age 757.220s) hex dump (first 32 bytes):
00 50 05 18 81 88 ff ff 00 00 00 00 00 00 00 00 .P..............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
[<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
[<ffffffffa02a1530>] if_usb_probe+0x60/0x37c [libertas_tf_usb]
[<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
[<ffffffff82b59630>] really_probe+0x190/0x480
[<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
[<ffffffff82b59af3>] driver_probe_device+0x53/0x130
[<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
[<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
[<ffffffff82b593c9>] __device_attach+0x1c9/0x270
[<ffffffff82b5a250>] device_initial_probe+0x20/0x30
[<ffffffff82b579c2>] bus_probe_device+0x142/0x160
[<ffffffff82b52e49>] device_add+0x829/0x1300
[<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
[<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
[<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]cardp is missing being freed in the error handling path of the probe and the path of the disconnect, which will cause memory leak.
This patch adds the missing kfree().
--- drivers/net/wireless/marvell/libertas_tf/if_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/libertas_tf/if_usb.c +2 -0
@@ -230,6 +230,7 @@ static int if_usb_probe(struct usb_interface *intf, dealloc:if_usb_free (cardp); +kfree (cardp); error:lbtf_deb_leave (LBTF_DEB_MAIN );return -ENOMEM ;
@@ -254,6 +255,7 @@ static void if_usb_disconnect(struct usb_interface *intf)/* Unlink and free urb */ if_usb_free (cardp); +kfree (cardp);usb_set_intfdata (intf,NULL );usb_put_dev (interface_to_usbdev (intf));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 246/355 libertas: Fix possible memory leak in probe and disconnect
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 9692151e2fe7a326bafe99836fd1f20a2cc3a049 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88812c7d7400 (size 512):
comm "kworker/6:1", pid 176, jiffies 4295003332 (age 822.830s) hex dump (first 32 bytes):
00 68 1e 04 81 88 ff ff 01 00 00 00 00 00 00 00 .h..............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
[<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
[<ffffffffa02c9873>] if_usb_probe+0x63/0x446 [usb8xxx]
[<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
[<ffffffff82b59630>] really_probe+0x190/0x480
[<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
[<ffffffff82b59af3>] driver_probe_device+0x53/0x130
[<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
[<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
[<ffffffff82b593c9>] __device_attach+0x1c9/0x270
[<ffffffff82b5a250>] device_initial_probe+0x20/0x30
[<ffffffff82b579c2>] bus_probe_device+0x142/0x160
[<ffffffff82b52e49>] device_add+0x829/0x1300
[<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
[<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
[<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]cardp is missing being freed in the error handling path of the probe and the path of the disconnect, which will cause memory leak.
This patch adds the missing kfree().
--- drivers/net/wireless/marvell/libertas/if_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/libertas/if_usb.c +2 -0
@@ -292,6 +292,7 @@ err_add_card:if_usb_reset_device (cardp); dealloc:if_usb_free (cardp); +kfree (cardp); error:return r;
@@ -316,6 +317,7 @@ static void if_usb_disconnect(struct usb_interface *intf)/* Unlink and free urb */ if_usb_free (cardp); +kfree (cardp);usb_set_intfdata (intf,NULL );usb_put_dev (interface_to_usbdev (intf));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 273/355 serial: 8250_dw: Drop wrong use of ACPI_PTR()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit ebabb77a2a115b6c5e68f7364b598310b5f61fb2 ]
ACPI_PTR() is more harmful than helpful. For example, in this case if CONFIG_ACPI=n, the ID table left unused which is not what we want.
Instead of adding ifdeffery here and there, drop ACPI_PTR().
--- drivers/tty/serial/8250/8250_dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_dw.c +1 -1
@@ -660,7 +660,7 @@ static struct platform_driver dw8250_platform_driver = { .name = "dw-apb-uart", .pm = &dw8250_pm_ops, .of_match_table = dw8250_of_match, - .acpi_match_table = ACPI_PTR(dw8250_acpi_match), + .acpi_match_table = dw8250_acpi_match, }, .probe = dw8250_probe, .remove = dw8250_remove,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 274/355 usb: gadget: hid: fix error code in do_config()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 68e7c510fdf4f6167404609da52e1979165649f6 ]
Return an error code if usb_get_function() fails. Don't return success.
--- drivers/usb/gadget/legacy/hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/hid.c +3 -1
@@ -99,8 +99,10 @@ static int do_config(struct usb_configuration *c)list_for_each_entry (e, &hidg_func_list, node) { e->f =usb_get_function (e->fi); -if (IS_ERR (e->f)) +if (IS_ERR (e->f)) { + status =PTR_ERR (e->f); goto put; + } status =usb_add_function (c, e->f);if (status <0 ) {usb_put_function (e->f);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 275/355 =?UTF-8?q?power:=20supply:=20rt5033=5Fbattery:=20Change=20voltage?= =?UTF-8?q?=20values=20to=20=C2=B5V?=
In reply to Greg Kroah-HartmanFrom: Jakob Hauser <[email protected]>
[ Upstream commit bf895295e9a73411889816f1a0c1f4f1a2d9c678 ]
Currently the rt5033_battery driver provides voltage values in mV. It should be µV as stated in Documentation/power/power_supply_class.rst.
--- drivers/power/supply/rt5033_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt5033_battery.c +1 -1
@@ -60,7 +60,7 @@ static int rt5033_battery_get_watt_prop(struct i2c_client *client,regmap_read (battery->regmap, regh, &msb);regmap_read (battery->regmap, regl, &lsb); - ret = ((msb <<4 ) + (lsb >>4 )) *1250 /1000 ; + ret = ((msb <<4 ) + (lsb >>4 )) *1250 ;return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 244/355 KVM: s390: Fix handle_sske page fault handling
In reply to Greg Kroah-HartmanFrom: Janis Schoetterl-Glausch <[email protected]>
[ Upstream commit 85f517b29418158d3e6e90c3f0fc01b306d2f1a1 ]
If handle_sske cannot set the storage key, because there is no page table entry or no present large page entry, it calls fixup_user_fault.
However, currently, if the call succeeds, handle_sske returns -EAGAIN, without having set the storage key.
Instead, retry by continue'ing the loop without incrementing the address.
The same issue in handle_pfmf was fixed bya11bdb1a6b78 ("KVM: s390: Fix pfmf and conditional skey emulation").
--- arch/s390/kvm/priv.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kvm/priv.c +2 -0
@@ -398,6 +398,8 @@ static int handle_sske(struct kvm_vcpu *vcpu)up_read (¤t->mm->mmap_sem);if (rc == -EFAULT )return kvm_s390_inject_program_int (vcpu,PGM_ADDRESSING ); +if (rc == -EAGAIN ) +continue ;if (rc <0 )return rc; start +=PAGE_SIZE ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 243/355 samples/kretprobes: Fix return value if register_kretprobe() failed
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit f76fbbbb5061fe14824ba5807c44bd7400a6b4e1 ]
Use the actual return value instead of always -1 if register_kretprobe() failed.
E.g. without this patch:
# insmod samples/kprobes/kretprobe_example.ko func=no_such_func insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted
With this patch:
# insmod samples/kprobes/kretprobe_example.ko func=no_such_func insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module
--- samples/kprobes/kretprobe_example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/kprobes/kretprobe_example.c +1 -1
@@ -84,7 +84,7 @@ static int __init kretprobe_init(void) ret =register_kretprobe (&my_kretprobe);if (ret <0 ) {pr_err ("register_kretprobe failed, returned %d\n" , ret); -return -1 ; +return ret; }pr_info ("Planted return probe at %s: %p\n" , my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 286/355 powerpc/44x/fsp2: add missing of_node_put
In reply to Greg Kroah-HartmanFrom: Bixuan Cui <[email protected]>
[ Upstream commit 290fe8aa69ef5c51c778c0bb33f8ef0181c769f5 ]
Early exits from for_each_compatible_node() should decrement the node reference counter. Reported by Coccinelle:
./arch/powerpc/platforms/44x/fsp2.c:206:1-25: WARNING: Function "for_each_compatible_node" should have of_node_put() before return around line 218.
--- arch/powerpc/platforms/44x/fsp2.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/platforms/44x/fsp2.c +2 -0
@@ -208,6 +208,7 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler)if (irq ==NO_IRQ ) {pr_err ("device tree node %pOFn is missing a interrupt" , np); +of_node_put (np);return ; }
@@ -215,6 +216,7 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler)if (rc) {pr_err ("fsp_of_probe: request_irq failed: np=%pOF rc=%d" , np, rc); +of_node_put (np);return ; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 287/355 mips: cm: Convert to bitfield API to fix out-of-bounds access
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 18b8f5b6fc53d097cadb94a93d8d6566ba88e389 ]
mips_cm_error_report() extracts the cause and other cause from the error register using shifts. This works fine for the former, as it is stored in the top bits, and the shift will thus remove all non-related bits. However, the latter is stored in the bottom bits, hence thus needs masking to get rid of non-related bits. Without such masking, using it as an index into the cm2_causes[] array will lead to an out-of-bounds access, probably causing a crash.
Fix this by using FIELD_GET() instead. Bite the bullet and convert all MIPS CM handling to the bitfield API, to improve readability and safety.
--- arch/mips/include/asm/mips-cm.h | 12 ++++++------ arch/mips/kernel/mips-cm.c | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-)
arch/mips/include/asm/mips-cm.h +6 -6
@@ -11,6 +11,7 @@#ifndef __MIPS_ASM_MIPS_CM_H__#define __MIPS_ASM_MIPS_CM_H__ +#include <linux/bitfield.h> #include <linux/bitops.h> #include <linux/errno.h>
@@ -153,8 +154,8 @@ GCR_ACCESSOR_RO(32, 0x030, rev)#define CM_GCR_REV_MINOR GENMASK(7, 0)#define CM_ENCODE_REV (major, minor) \ - (((major) << __ffs(CM_GCR_REV_MAJOR)) | \ - ((minor) << __ffs(CM_GCR_REV_MINOR))) + (FIELD_PREP(CM_GCR_REV_MAJOR, major) | \ + FIELD_PREP(CM_GCR_REV_MINOR, minor))#define CM_REV_CM2 CM_ENCODE_REV(6, 0)#define CM_REV_CM2_5 CM_ENCODE_REV(7, 0)
@@ -362,10 +363,10 @@ static inline int mips_cm_revision(void)static inline unsigned int mips_cm_max_vp_width (void ) {extern int smp_num_siblings; -uint32_t cfg;if (mips_cm_revision () >=CM_REV_CM3 ) -return read_gcr_sys_config2 () &CM_GCR_SYS_CONFIG2_MAXVPW ; +return FIELD_GET (CM_GCR_SYS_CONFIG2_MAXVPW , +read_gcr_sys_config2 ());if (mips_cm_present ()) {/*
@@ -373,8 +374,7 @@ static inline unsigned int mips_cm_max_vp_width(void)* number of VP(E)s, and if that ever changes then this will * need revisiting. */ - cfg =read_gcr_cl_config () & CM_GCR_Cx_CONFIG_PVPE; -return (cfg >>__ffs (CM_GCR_Cx_CONFIG_PVPE)) +1 ; +return FIELD_GET (CM_GCR_Cx_CONFIG_PVPE,read_gcr_cl_config ()) +1 ; }if (IS_ENABLED (CONFIG_SMP ))
arch/mips/kernel/mips-cm.c +10 -11
@@ -179,8 +179,7 @@ static void mips_cm_probe_l2sync(void)phys_addr_t addr;/* L2-only sync was introduced with CM major revision 6 */ - major_rev = (read_gcr_rev () &CM_GCR_REV_MAJOR ) >> -__ffs (CM_GCR_REV_MAJOR ); + major_rev =FIELD_GET (CM_GCR_REV_MAJOR ,read_gcr_rev ());if (major_rev <6 )return ;
@@ -263,13 +262,13 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core,preempt_disable ();if (cm_rev >=CM_REV_CM3 ) { - val = core <<__ffs (CM3_GCR_Cx_OTHER_CORE); - val |= vp <<__ffs (CM3_GCR_Cx_OTHER_VP); + val =FIELD_PREP (CM3_GCR_Cx_OTHER_CORE, core) | +FIELD_PREP (CM3_GCR_Cx_OTHER_VP, vp);if (cm_rev >=CM_REV_CM3_5 ) { val |= CM_GCR_Cx_OTHER_CLUSTER_EN; - val |= cluster <<__ffs (CM_GCR_Cx_OTHER_CLUSTER); - val |= block <<__ffs (CM_GCR_Cx_OTHER_BLOCK); + val |=FIELD_PREP (CM_GCR_Cx_OTHER_CLUSTER, cluster); + val |=FIELD_PREP (CM_GCR_Cx_OTHER_BLOCK, block); }else {WARN_ON (cluster !=0 );WARN_ON (block != CM_GCR_Cx_OTHER_BLOCK_LOCAL);
@@ -299,7 +298,7 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core,spin_lock_irqsave (&per_cpu (cm_core_lock, curr_core),per_cpu (cm_core_lock_flags, curr_core)); - val = core <<__ffs (CM_GCR_Cx_OTHER_CORENUM); + val =FIELD_PREP (CM_GCR_Cx_OTHER_CORENUM, core); }write_gcr_cl_other (val);
@@ -343,8 +342,8 @@ void mips_cm_error_report(void) cm_other =read_gcr_error_mult ();if (revision <CM_REV_CM3 ) {/* CM2 */ - cause = cm_error >>__ffs (CM_GCR_ERROR_CAUSE_ERRTYPE ); - ocause = cm_other >>__ffs (CM_GCR_ERROR_MULT_ERR2ND ); + cause =FIELD_GET (CM_GCR_ERROR_CAUSE_ERRTYPE , cm_error); + ocause =FIELD_GET (CM_GCR_ERROR_MULT_ERR2ND , cm_other);if (!cause)return ;
@@ -386,8 +385,8 @@ void mips_cm_error_report(void)ulong core_id_bits, vp_id_bits, cmd_bits, cmd_group_bits;ulong cm3_cca_bits, mcp_bits, cm3_tr_bits, sched_bit; - cause = cm_error >>__ffs64 (CM3_GCR_ERROR_CAUSE_ERRTYPE ); - ocause = cm_other >>__ffs (CM_GCR_ERROR_MULT_ERR2ND ); + cause =FIELD_GET (CM3_GCR_ERROR_CAUSE_ERRTYPE , cm_error); + ocause =FIELD_GET (CM_GCR_ERROR_MULT_ERR2ND , cm_other);if (!cause)return ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 288/355 power: supply: bq27xxx: Fix kernel crash on IRQ handler register error
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit cdf10ffe8f626d8a2edc354abf063df0078b2d71 ]
When registering the IRQ handler fails, do not just return the error code, this will free the devm_kzalloc()-ed data struct while leaving the queued work queued and the registered power_supply registered with both of them now pointing to free-ed memory, resulting in various kernel crashes soon afterwards.
Instead properly tear-down things on IRQ handler register errors.
--- drivers/power/supply/bq27xxx_battery_i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/bq27xxx_battery_i2c.c +2 -1
@@ -195,7 +195,8 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client,dev_err (&client->dev,"Unable to register IRQ %d error %d\n" , client->irq, ret); -return ret; +bq27xxx_battery_teardown (di); + goto err_failed; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 291/355 pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds
In reply to Greg Kroah-HartmanFrom: Baptiste Lepers <[email protected]>
[ Upstream commit a2915fa06227b056a8f9b0d79b61dca08ad5cfc6 ]
_nfs4_pnfs_v3/v4_ds_connect do
some work
smp_wmb
ds->ds_clp = clp;
And nfs4_ff_layout_prepare_ds currently does
smp_rmb
if(ds->ds_clp)
...
This patch places the smp_rmb after the if. This ensures that following reads only happen once nfs4_ff_layout_prepare_ds has checked that data has been properly initialized.
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 4 ++-- fs/nfs/pnfs_nfs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +2 -2
@@ -378,10 +378,10 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, goto noconnect; ds = mirror->mirror_ds->ds; +if (READ_ONCE (ds->ds_clp)) + goto out;/* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ smp_rmb (); -if (ds->ds_clp) - goto out;/* FIXME: For now we assume the server sent only one version of NFS * to use for the DS.
fs/nfs/pnfs_nfs.c +2 -2
@@ -641,7 +641,7 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv, }smp_wmb (); - ds->ds_clp = clp; +WRITE_ONCE (ds->ds_clp, clp);dprintk ("%s [new] addr: %s\n" , __func__, ds->ds_remotestr); out:return status;
@@ -714,7 +714,7 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv, }smp_wmb (); - ds->ds_clp = clp; +WRITE_ONCE (ds->ds_clp, clp);dprintk ("%s [new] addr: %s\n" , __func__, ds->ds_remotestr); out:return status;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 292/355 drm/plane-helper: fix uninitialized variable reference
In reply to Greg Kroah-HartmanFrom: Alex Xu (Hello71) <[email protected]>
[ Upstream commit 7be28bd73f23e53d6e7f5fe891ba9503fc0c7210 ]
drivers/gpu/drm/drm_plane_helper.c: In function 'drm_primary_helper_update':drivers/gpu/drm/drm_plane_helper.c:113:32: error: 'visible' is used uninitialized [-Werror=uninitialized]
113 | struct drm_plane_state plane_state = {
| ^~~~~~~~~~~
drivers/gpu/drm/drm_plane_helper.c:178:14: note: 'visible' was declared here
178 | bool visible;
| ^~~~~~~cc1: all warnings being treated as errors
visible is an output, not an input. in practice this use might turn out OK but it's still UB.
--- drivers/gpu/drm/drm_plane_helper.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_plane_helper.c +0 -1
@@ -123,7 +123,6 @@ static int drm_plane_helper_check_update(struct drm_plane *plane, .crtc_w = drm_rect_width(dst), .crtc_h = drm_rect_height(dst), .rotation = rotation, - .visible = *visible, };struct drm_crtc_state crtc_state = { .crtc = crtc,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 297/355 fs: orangefs: fix error return code of orangefs_revalidate_lookup()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 4c2b46c824a78fc8190d8eafaaea5a9078fe7479 ]
When op_alloc() returns NULL to new_op, no error return code of orangefs_revalidate_lookup() is assigned.
To fix this bug, ret is assigned with -ENOMEM in this case.
--- fs/orangefs/dcache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/orangefs/dcache.c +3 -1
@@ -26,8 +26,10 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)gossip_debug (GOSSIP_DCACHE_DEBUG ,"%s: attempting lookup.\n" , __func__); new_op =op_alloc (ORANGEFS_VFS_OP_LOOKUP ); -if (!new_op) +if (!new_op) { + ret = -ENOMEM ; goto out_put_parent; + } new_op->upcall.req.lookup.sym_follow =ORANGEFS_LOOKUP_LINK_NO_FOLLOW ; new_op->upcall.req.lookup.parent_refn = parent->refn;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 298/355 mtd: spi-nor: hisi-sfc: Remove excessive clk_disable_unprepare()
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 78e4d342187625585932bb437ec26e1060f7fc6f ]
hisi_spi_nor_probe() invokes clk_disable_unprepare() on all paths after successful call of clk_prepare_enable(). Besides, the clock is enabled by hispi_spi_nor_prep() and disabled by hispi_spi_nor_unprep(). So at remove time it is not possible to have the clock enabled. The patch removes excessive clk_disable_unprepare() from hisi_spi_nor_remove().
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/mtd/spi-nor/hisi-sfc.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/spi-nor/hisi-sfc.c +0 -1
@@ -474,7 +474,6 @@ static int hisi_spi_nor_remove(struct platform_device *pdev)hisi_spi_nor_unregister_all (host);mutex_destroy (&host->lock); -clk_disable_unprepare (host->clk);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 289/355 apparmor: fix error check
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit d108370c644b153382632b3e5511ade575c91c86 ]
clang static analysis reports this representative problem:
label.c:1463:16: warning: Assigned value is garbage or undefined
label->hname = name;
^ ~~~~In aa_update_label_name(), this the problem block of code
if (aa_label_acntsxprint(&name, ...) == -1) return res;
On failure, aa_label_acntsxprint() has a more complicated return that just -1. So check for a negative return.
It was also noted that the aa_label_acntsxprint() main comment refers to a nonexistent parameter, so clean up the comment.
--- security/apparmor/label.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/apparmor/label.c +2 -2
@@ -1459,7 +1459,7 @@ bool aa_update_label_name(struct aa_ns *ns, struct aa_label *label, gfp_t gfp)if (label->hname ||labels_ns (label) != ns)return res; -if (aa_label_acntsxprint (&name, ns, label,FLAGS_NONE , gfp) ==-1 ) +if (aa_label_acntsxprint (&name, ns, label,FLAGS_NONE , gfp) <0 )return res; ls =labels_set (label);
@@ -1709,7 +1709,7 @@ int aa_label_asxprint(char **strp, struct aa_ns *ns, struct aa_label *label,/** * aa_label_acntsxprint - allocate a __counted string buffer and print label -* @strp: buffer to write to. (MAY BE NULL if @size == 0) +* @strp: buffer to write to. * @ns: namespace profile is being viewed from * @label: label to view (NOT NULL) * @flags: flags controlling what label info is printed
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 290/355 rpmsg: Fix rpmsg_create_ept return when RPMSG config is not defined
In reply to Greg Kroah-HartmanFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit 537d3af1bee8ad1415fda9b622d1ea6d1ae76dfa ]
According to the description of the rpmsg_create_ept in rpmsg_core.c the function should return NULL on error.
--- include/linux/rpmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rpmsg.h +1 -1
@@ -177,7 +177,7 @@ static inline struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev/* This shouldn't be possible */ WARN_ON (1 ); -return ERR_PTR (-ENXIO ); +return NULL ; }static inline int rpmsg_send (struct rpmsg_endpoint *ept,void *data,int len)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 293/355 PCI: aardvark: Dont spam about PIO Response Status
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
[ Upstream commit 464de7e7fff767e87429cd7be09c4f2cb50a6ccb ]
Use dev_dbg() instead of dev_err() in advk_pcie_check_pio_status().
For example CRS is not an error status, it just says that the request should be retried.
--- drivers/pci/controller/pci-aardvark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +1 -1
@@ -539,7 +539,7 @@ static int advk_pcie_check_pio_status(struct advk_pcie *pcie, bool allow_crs, u3else str_posted ="Posted" ; -dev_err (dev,"%s PIO Response Status: %s, %#x @ %#x\n" , +dev_dbg (dev,"%s PIO Response Status: %s, %#x @ %#x\n" , str_posted, strcomp_status, reg,advk_readl (pcie,PIO_ADDR_LS ));return -EFAULT ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 300/355 dmaengine: at_xdmac: fix AT_XDMAC_CC_PERID() macro
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 320c88a3104dc955f928a1eecebd551ff89530c0 ]
AT_XDMAC_CC_PERID() should be used to setup bits 24..30 of XDMAC_CC register. Using it without parenthesis around 0x7f & (i) will lead to setting all the time zero for bits 24..30 of XDMAC_CC as the << operator has higher precedence over bitwise &. Thus, add paranthesis around 0x7f & (i).
--- drivers/dma/at_xdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/at_xdmac.c +1 -1
@@ -145,7 +145,7 @@#define AT_XDMAC_CC_WRIP (0x1 << 23)/* Write in Progress (read only) */ #define AT_XDMAC_CC_WRIP_DONE (0x0 << 23)#define AT_XDMAC_CC_WRIP_IN_PROGRESS (0x1 << 23) -#define AT_XDMAC_CC_PERID (i) (0x7f & (i) << 24)/* Channel Peripheral Identifier */ +#define AT_XDMAC_CC_PERID (i) ((0x7f & (i)) << 24)/* Channel Peripheral Identifier */ #define AT_XDMAC_CDS_MSP 0x2C/* Channel Data Stride Memory Set Pattern */ #define AT_XDMAC_CSUS 0x30/* Channel Source Microblock Stride */ #define AT_XDMAC_CDUS 0x34/* Channel Destination Microblock Stride */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 301/355 auxdisplay: img-ascii-lcd: Fix lock-up when displaying empty string
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit afcb5a811ff3ab3969f09666535eb6018a160358 ]
While writing an empty string to a device attribute is a no-op, and thus does not need explicit safeguards, the user can still write a single newline to an attribute file:
echo > .../message
If that happens, img_ascii_lcd_display() trims the newline, yielding an empty string, and causing an infinite loop in img_ascii_lcd_scroll().
Fix this by adding a check for empty strings. Clear the display in case one is encountered.
--- drivers/auxdisplay/img-ascii-lcd.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/auxdisplay/img-ascii-lcd.c +10 -0
@@ -280,6 +280,16 @@ static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx,if (msg[count -1 ] =='\n' ) count--; +if (!count) { +/* clear the LCD */ +devm_kfree (&ctx->pdev->dev, ctx->message); + ctx->message =NULL ; + ctx->message_len =0 ; +memset (ctx->curr,' ' , ctx->cfg->num_chars); + ctx->cfg->update (ctx); +return 0 ; + } + new_msg =devm_kmalloc (&ctx->pdev->dev, count +1 ,GFP_KERNEL );if (!new_msg)return -ENOMEM ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 307/355 signal/sh: Use force_sig(SIGKILL) instead of do_group_exit(SIGKILL)
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
[ Upstream commit ce0ee4e6ac99606f3945f4d47775544edc3f7985 ]
Today the sh code allocates memory the first time a process uses the fpu. If that memory allocation fails, kill the affected task with force_sig(SIGKILL) rather than do_group_exit(SIGKILL).
Calling do_group_exit from an exception handler can potentially lead to dead locks as do_group_exit is not designed to be called from interrupt context. Instead use force_sig(SIGKILL) to kill the userspace process. Sending signals in general and force_sig in particular has been tested from interrupt context so there should be no problems.
--- arch/sh/kernel/cpu/fpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/sh/kernel/cpu/fpu.c +6 -4
@@ -62,18 +62,20 @@ void fpu_state_restore(struct pt_regs *regs) }if (!tsk_used_math (tsk)) { -local_irq_enable (); +int ret;/* * does a slab alloc which can sleep */ -if (init_fpu (tsk)) { +local_irq_enable (); + ret =init_fpu (tsk); +local_irq_disable (); +if (ret) {/* * ran out of memory! */ -do_group_exit (SIGKILL ); +force_sig (SIGKILL );return ; } -local_irq_disable (); }grab_fpu (regs);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 294/355 PCI: aardvark: Fix preserving PCI_EXP_RTCTL_CRSSVE flag on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit d419052bc6c60fa4ab2b5a51d5f1e55a66e2b4ff ]
Commit 43f5c77bcbd2 ("PCI: aardvark: Fix reporting CRS value") started using CRSSVE flag for handling CRS responses.
PCI_EXP_RTCTL_CRSSVE flag is stored only in emulated config space buffer and there is handler for PCI_EXP_RTCTL register. So every read operation from config space automatically clears CRSSVE flag as it is not defined in PCI_EXP_RTCTL read handler.
Fix this by reading current CRSSVE bit flag from emulated space buffer and appending it to PCI_EXP_RTCTL read response.
--- drivers/pci/controller/pci-aardvark.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/controller/pci-aardvark.c +1 -0
@@ -580,6 +580,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge,case PCI_EXP_RTCTL : {u32 val =advk_readl (pcie,PCIE_ISR0_MASK_REG ); *value = (val &PCIE_MSG_PM_PME_MASK ) ?0 :PCI_EXP_RTCTL_PMEIE ; + *value |=le16_to_cpu (bridge->pcie_conf.rootctl) &PCI_EXP_RTCTL_CRSSVE ; *value |=PCI_EXP_RTCAP_CRSVIS <<16 ;return PCI_BRIDGE_EMUL_HANDLED ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 299/355 mtd: core: dont remove debugfs directory if device is in use
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
[ Upstream commit c13de2386c78e890d4ae6f01a85eefd0b293fb08 ]
Previously, if del_mtd_device() failed with -EBUSY due to a non-zero usecount, a subsequent call to attempt the deletion again would try to remove a debugfs directory that had already been removed and panic. With this change the second call can instead proceed safely.
--- drivers/mtd/mtdcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/mtdcore.c +2 -2
@@ -727,8 +727,6 @@ int del_mtd_device(struct mtd_info *mtd)mutex_lock (&mtd_table_mutex); -debugfs_remove_recursive (mtd->dbg.dfs_dir); -if (idr_find (&mtd_idr, mtd->index) != mtd) { ret = -ENODEV ; goto out_error;
@@ -744,6 +742,8 @@ int del_mtd_device(struct mtd_info *mtd) mtd->index, mtd->name, mtd->usecount); ret = -EBUSY ; }else { +debugfs_remove_recursive (mtd->dbg.dfs_dir); +/* Try to remove the NVMEM provider */ if (mtd->nvmem)nvmem_unregister (mtd->nvmem);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 296/355 NFS: Fix deadlocks in nfs_scan_commit_list()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 64a93dbf25d3a1368bb58ddf0f61d0a92d7479e3 ]
Partially revert commit 2ce209c42c01 ("NFS: Wait for requests that are locked on the commit list"), since it can lead to deadlocks between commit requests and nfs_join_page_group().
For now we should assume that any locked requests on the commit list are either about to be removed and committed by another task, or the writes they describe are about to be retransmitted. In either case, we should not need to worry.
--- fs/nfs/write.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
fs/nfs/write.c +2 -15
@@ -1050,25 +1050,11 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,struct nfs_page *req, *tmp;int ret =0 ; -restart:list_for_each_entry_safe (req, tmp, src, wb_list) {kref_get (&req->wb_kref);if (!nfs_lock_request (req)) { -int status; - -/* Prevent deadlock with nfs_lock_and_join_requests */ -if (!list_empty (dst)) { -nfs_release_request (req); -continue ; - } -/* Ensure we make progress to prevent livelock */ -mutex_unlock (&NFS_I (cinfo->inode)->commit_mutex); - status =nfs_wait_on_request (req);nfs_release_request (req); -mutex_lock (&NFS_I (cinfo->inode)->commit_mutex); -if (status <0 ) -break ; - goto restart; +continue ; }nfs_request_remove_commit_list (req, cinfo);clear_bit (PG_COMMIT_TO_DS , &req->wb_flags);
@@ -1935,6 +1921,7 @@ static int __nfs_commit_inode(struct inode *inode, int how,int may_wait = how &FLUSH_SYNC ;int ret, nscan; + how &= ~FLUSH_SYNC ;nfs_init_cinfo_from_inode (&cinfo, inode);nfs_commit_begin (cinfo.mds);for (;;) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 302/355 auxdisplay: ht16k33: Connect backlight to fbdev
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 80f9eb70fd9276938f0a131f76d438021bfd8b34 ]
Currently /sys/class/graphics/fb0/bl_curve is not accessible (-ENODEV), as the driver does not connect the backlight to the frame buffer device. Fix this moving backlight initialization up, and filling in fb_info.bl_dev.
--- drivers/auxdisplay/ht16k33.c | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/auxdisplay/ht16k33.c +28 -28
@@ -418,6 +418,33 @@ static int ht16k33_probe(struct i2c_client *client,if (err)return err; +/* Backlight */ +memset (&bl_props,0 ,sizeof (struct backlight_properties )); + bl_props.type =BACKLIGHT_RAW ; + bl_props.max_brightness =MAX_BRIGHTNESS ; + + bl =devm_backlight_device_register (&client->dev,DRIVER_NAME "-bl" , + &client->dev, priv, + &ht16k33_bl_ops, &bl_props); +if (IS_ERR (bl)) { +dev_err (&client->dev,"failed to register backlight\n" ); +return PTR_ERR (bl); + } + + err =of_property_read_u32 (node,"default-brightness-level" , + &dft_brightness); +if (err) { + dft_brightness =MAX_BRIGHTNESS ; + }else if (dft_brightness >MAX_BRIGHTNESS ) { +dev_warn (&client->dev, +"invalid default brightness level: %u, using %u\n" , + dft_brightness,MAX_BRIGHTNESS ); + dft_brightness =MAX_BRIGHTNESS ; + } + + bl->props.brightness = dft_brightness; +ht16k33_bl_update_status (bl); +/* Framebuffer (2 bytes per column) */ BUILD_BUG_ON (PAGE_SIZE <HT16K33_FB_SIZE ); fbdev->buffer = (unsigned char *)get_zeroed_page (GFP_KERNEL );
@@ -450,6 +477,7 @@ static int ht16k33_probe(struct i2c_client *client, fbdev->info->screen_size =HT16K33_FB_SIZE ; fbdev->info->fix = ht16k33_fb_fix; fbdev->info->var = ht16k33_fb_var; + fbdev->info->bl_dev = bl; fbdev->info->pseudo_palette =NULL ; fbdev->info->flags =FBINFO_FLAG_DEFAULT ; fbdev->info->par = priv;
@@ -462,34 +490,6 @@ static int ht16k33_probe(struct i2c_client *client,if (err) goto err_fbdev_unregister; -/* Backlight */ -memset (&bl_props,0 ,sizeof (struct backlight_properties )); - bl_props.type =BACKLIGHT_RAW ; - bl_props.max_brightness =MAX_BRIGHTNESS ; - - bl =devm_backlight_device_register (&client->dev,DRIVER_NAME "-bl" , - &client->dev, priv, - &ht16k33_bl_ops, &bl_props); -if (IS_ERR (bl)) { -dev_err (&client->dev,"failed to register backlight\n" ); - err =PTR_ERR (bl); - goto err_fbdev_unregister; - } - - err =of_property_read_u32 (node,"default-brightness-level" , - &dft_brightness); -if (err) { - dft_brightness =MAX_BRIGHTNESS ; - }else if (dft_brightness >MAX_BRIGHTNESS ) { -dev_warn (&client->dev, -"invalid default brightness level: %u, using %u\n" , - dft_brightness,MAX_BRIGHTNESS ); - dft_brightness =MAX_BRIGHTNESS ; - } - - bl->props.brightness = dft_brightness; -ht16k33_bl_update_status (bl); -ht16k33_fb_queue (priv);return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 304/355 soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_read
In reply to Greg Kroah-HartmanFrom: Robert-Ionut Alexa <[email protected]>
[ Upstream commit 8120bd469f5525da229953c1197f2b826c0109f4 ]
Free the kbuf buffer before returning from the dpaa2_console_read() function. The variable no longer goes out of scope, leaking the storage it points to.
--- drivers/soc/fsl/dpaa2-console.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/fsl/dpaa2-console.c +1 -0
@@ -231,6 +231,7 @@ static ssize_t dpaa2_console_read(struct file *fp, char __user *buf, cd->cur_ptr += bytes; written += bytes; +kfree (kbuf);return written; err_free_buf:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 306/355 dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result`
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit e7e1e880b114ca640a2f280b0d5d38aed98f98c6 ]
Before the callback_result callback was introduced drivers coded their invocation to the callback in a similar way to:
if (cb->callback) {
spin_unlock(&dma->lock);
cb->callback(cb->callback_param);
spin_lock(&dma->lock);
}With the introduction of callback_result two helpers where introduced to transparently handle both types of callbacks. And drivers where updated to look like this:
if (dmaengine_desc_callback_valid(cb)) {
spin_unlock(&dma->lock);
dmaengine_desc_callback_invoke(cb, ...);
spin_lock(&dma->lock);
}dmaengine_desc_callback_invoke() correctly handles both callback_result and callback. But we forgot to update the dmaengine_desc_callback_valid() function to check for callback_result. As a result DMA descriptors that use the callback_result rather than callback don't have their callback invoked by drivers that follow the pattern above.
Fix this by checking for both callback and callback_result in dmaengine_desc_callback_valid().
--- drivers/dma/dmaengine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dmaengine.h +1 -1
@@ -168,7 +168,7 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx,static inline bool dmaengine_desc_callback_valid (struct dmaengine_desc_callback *cb) { -return (cb->callback) ? true : false; +return cb->callback || cb->callback_result; }#endif
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 308/355 m68k: set a default value for MEMORY_RESERVE
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 1aaa557b2db95c9506ed0981bc34505c32d6b62b ]
'make randconfig' can produce a .config file with "CONFIG_MEMORY_RESERVE=" (no value) since it has no default. When a subsequent 'make all' is done, kconfig restarts the config and prompts for a value for MEMORY_RESERVE. This breaks scripting/automation where there is no interactive user input.
Add a default value for MEMORY_RESERVE. (Any integer value will work here for kconfig.)
Fixes a kconfig warning:
.config:214:warning: symbol value '' invalid for MEMORY_RESERVE
* Restart config...
Memory reservation (MiB) (MEMORY_RESERVE) [] (NEW)
--- arch/m68k/Kconfig.machine | 1 + 1 file changed, 1 insertion(+)
arch/m68k/Kconfig.machine +1 -0
@@ -190,6 +190,7 @@ config INIT_LCD config MEMORY_RESERVE int "Memory reservation (MiB)" depends on (UCSIMM || UCDIMM) + default 0 help Reserve certain memory regions on 68x328 based boards.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 309/355 watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUT
In reply to Greg Kroah-HartmanFrom: Ahmad Fatoum <[email protected]>
[ Upstream commit 164483c735190775f29d0dcbac0363adc51a068d ]
The fintek watchdog timer can configure timeouts of second granularity only up to 255 seconds. Beyond that, the timeout needs to be configured with minute granularity. WDIOC_GETTIMEOUT should report the actual timeout configured, not just echo back the timeout configured by the user. Do so.
--- drivers/watchdog/f71808e_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/f71808e_wdt.c +3 -1
@@ -228,15 +228,17 @@ static int watchdog_set_timeout(int timeout)mutex_lock (&watchdog.lock); - watchdog.timeout = timeout;if (timeout >0xff ) { watchdog.timer_val =DIV_ROUND_UP (timeout,60 ); watchdog.minutes_mode = true; + timeout = watchdog.timer_val *60 ; }else { watchdog.timer_val = timeout; watchdog.minutes_mode = false; } + watchdog.timeout = timeout; +mutex_unlock (&watchdog.lock);return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 279/355 ARM: dts: stm32: fix SAI sub nodes register range
In reply to Greg Kroah-HartmanFrom: Olivier Moysan <[email protected]>
[ Upstream commit 6f87a74d31277f0896dcf8c0850ec14bde03c423 ]
The STM32 SAI subblocks registers offsets are in the range 0x0004 (SAIx_CR1) to 0x0020 (SAIx_DR).
The corresponding range length is 0x20 instead of 0x1c. Change reg property accordingly.
--- arch/arm/boot/dts/stm32mp157c.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm/boot/dts/stm32mp157c.dtsi +8 -8
@@ -773,7 +773,7 @@ #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-a"; - reg = <0x4 0x1c>; + reg = <0x4 0x20>; clocks = <&rcc SAI1_K>; clock-names = "sai_ck"; dmas = <&dmamux1 87 0x400 0x01>;
@@ -783,7 +783,7 @@ sai1b: audio-controller@4400a024 { #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-b"; - reg = <0x24 0x1c>; + reg = <0x24 0x20>; clocks = <&rcc SAI1_K>; clock-names = "sai_ck"; dmas = <&dmamux1 88 0x400 0x01>;
@@ -804,7 +804,7 @@ sai2a: audio-controller@4400b004 { #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-a"; - reg = <0x4 0x1c>; + reg = <0x4 0x20>; clocks = <&rcc SAI2_K>; clock-names = "sai_ck"; dmas = <&dmamux1 89 0x400 0x01>;
@@ -814,7 +814,7 @@ sai2b: audio-controller@4400b024 { #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-b"; - reg = <0x24 0x1c>; + reg = <0x24 0x20>; clocks = <&rcc SAI2_K>; clock-names = "sai_ck"; dmas = <&dmamux1 90 0x400 0x01>;
@@ -835,7 +835,7 @@ sai3a: audio-controller@4400c004 { #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-a"; - reg = <0x04 0x1c>; + reg = <0x04 0x20>; clocks = <&rcc SAI3_K>; clock-names = "sai_ck"; dmas = <&dmamux1 113 0x400 0x01>;
@@ -845,7 +845,7 @@ sai3b: audio-controller@4400c024 { #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-b"; - reg = <0x24 0x1c>; + reg = <0x24 0x20>; clocks = <&rcc SAI3_K>; clock-names = "sai_ck"; dmas = <&dmamux1 114 0x400 0x01>;
@@ -1191,7 +1191,7 @@ sai4a: audio-controller@50027004 { #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-a"; - reg = <0x04 0x1c>; + reg = <0x04 0x20>; clocks = <&rcc SAI4_K>; clock-names = "sai_ck"; dmas = <&dmamux1 99 0x400 0x01>;
@@ -1201,7 +1201,7 @@ sai4b: audio-controller@50027024 { #sound-dai-cells = <0>; compatible = "st,stm32-sai-sub-b"; - reg = <0x24 0x1c>; + reg = <0x24 0x20>; clocks = <&rcc SAI4_K>; clock-names = "sai_ck"; dmas = <&dmamux1 100 0x400 0x01>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 276/355 scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit f4875d509a0a78ad294a1a538d534b5ba94e685a ]
This variable is just a temporary variable, used to do an endian conversion. The problem is that the last byte is not initialized. After the conversion is completely done, the last byte is discarded so it doesn't cause a problem. But static checkers and the KMSan runtime checker can detect the uninitialized read and will complain about it.
--- drivers/scsi/csiostor/csio_lnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/csiostor/csio_lnode.c +1 -1
@@ -619,7 +619,7 @@ csio_ln_vnp_read_cbfn(struct csio_hw *hw, struct csio_mb *mbp)struct fc_els_csp *csp;struct fc_els_cssp *clsp;enum fw_retval retval; -__be32 nport_id; +__be32 nport_id =0 ; retval =FW_CMD_RETVAL_G (ntohl (rsp->alloc_to_len16));if (retval !=FW_SUCCESS ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 310/355 ar7: fix kernel builds for compiler test
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit 28b7ee33a2122569ac065cad578bf23f50cc65c3 ]
TI AR7 Watchdog Timer is only build for 32bit.
Avoid error like:
In file included from drivers/watchdog/ar7_wdt.c:29:./arch/mips/include/asm/mach-ar7/ar7.h: In function ‘ar7_is_titan’:./arch/mips/include/asm/mach-ar7/ar7.h:111:24: error: implicit declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’? [-Werror=implicit-function-declaration]
111 | return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x24)) & 0xffff) ==
| ^~~~~~~~~
| CKSEG1ADDR--- drivers/watchdog/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -1
@@ -1682,7 +1682,7 @@ config SIBYTE_WDOG config AR7_WDT tristate "TI AR7 Watchdog Timer" - depends on AR7 || (MIPS && COMPILE_TEST) + depends on AR7 || (MIPS && 32BIT && COMPILE_TEST) help Hardware driver for the TI AR7 Watchdog Timer.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 285/355 HID: u2fzero: properly handle timeouts in usb_submit_urb
In reply to Greg Kroah-HartmanFrom: Andrej Shadura <[email protected]>
[ Upstream commit 43775e62c4b784f44a159e13ba80e6146a42d502 ]
The wait_for_completion_timeout function returns 0 if timed out or a positive value if completed. Hence, "less than zero" comparison always misses timeouts and doesn't kill the URB as it should, leading to re-sending it while it is active.
--- drivers/hid/hid-u2fzero.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-u2fzero.c +1 -1
@@ -132,7 +132,7 @@ static int u2fzero_recv(struct u2fzero_device *dev, ret = (wait_for_completion_timeout ( &ctx.done,msecs_to_jiffies (USB_CTRL_SET_TIMEOUT ))); -if (ret <0 ) { +if (ret ==0 ) {usb_kill_urb (dev->urb);hid_err (hdev,"urb submission timed out" ); }else {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 325/355 arm64: pgtable: make __pte_to_phys/__phys_to_pte_val inline functions
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit c7c386fbc20262c1d911c615c65db6a58667d92c ]
gcc warns about undefined behavior the vmalloc code when building with CONFIG_ARM64_PA_BITS_52, when the 'idx++' in the argument to __phys_to_pte_val() is evaluated twice:
mm/vmalloc.c: In function 'vmap_pfn_apply':mm/vmalloc.c:2800:58: error: operation on 'data->idx' may be undefined [-Werror=sequence-point]
2800 | *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
| ~~~~~~~~~^~arch/arm64/include/asm/pgtable-types.h:25:37: note: in definition of macro '__pte'
25 | #define __pte(x) ((pte_t) { (x) } )
| ^arch/arm64/include/asm/pgtable.h:80:15: note: in expansion of macro '__phys_to_pte_val'
80 | __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
| ^~~~~~~~~~~~~~~~~
mm/vmalloc.c:2800:30: note: in expansion of macro 'pfn_pte'
2800 | *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
| ^~~~~~~
I have no idea why this never showed up earlier, but the safest workaround appears to be changing those macros into inline functions so the arguments get evaluated only once.
--- arch/arm64/include/asm/pgtable.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm64/include/asm/pgtable.h +9 -3
@@ -54,9 +54,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];* page table entry, taking care of 52-bit addresses. */ #ifdef CONFIG_ARM64_PA_BITS_52 -#define __pte_to_phys (pte) \ - ((pte_val(pte) & PTE_ADDR_LOW) | ((pte_val(pte) & PTE_ADDR_HIGH) << 36)) -#define __phys_to_pte_val (phys) (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK) +static inline phys_addr_t __pte_to_phys (pte_t pte) +{ +return (pte_val (pte) &PTE_ADDR_LOW ) | + ((pte_val (pte) &PTE_ADDR_HIGH ) <<36 ); +} +static inline pteval_t __phys_to_pte_val (phys_addr_t phys) +{ +return (phys | (phys >>36 )) &PTE_ADDR_MASK ; +}#else #define __pte_to_phys (pte) (pte_val(pte) & PTE_ADDR_MASK)#define __phys_to_pte_val (phys) (phys)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 326/355 bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and colliding
In reply to Greg Kroah-HartmanFrom: John Fastabend <[email protected]>
[ Upstream commit e0dc3b93bd7bcff8c3813d1df43e0908499c7cf0 ]
Strparser is reusing the qdisc_skb_cb struct to stash the skb message handling progress, e.g. offset and length of the skb. First this is poorly named and inherits a struct from qdisc that doesn't reflect the actual usage of cb[] at this layer.
But, more importantly strparser is using the following to access its metadata.
(struct _strp_msg *)((void *)skb->cb + offsetof(struct qdisc_skb_cb, data))
Where _strp_msg is defined as:
struct _strp_msg {
struct strp_msg strp; /* 0 8 */
int accum_len; /* 8 4 */ /* size: 12, cachelines: 1, members: 2 */
/* last cacheline: 12 bytes */};
So we use 12 bytes of ->data[] in struct. However in BPF code running parser and verdict the user has read capabilities into the data[] array as well. Its not too problematic, but we should not be exposing internal state to BPF program. If its really needed then we can use the probe_read() APIs which allow reading kernel memory. And I don't believe cb[] layer poses any API breakage by moving this around because programs can't depend on cb[] across layers.
In order to fix another issue with a ctx rewrite we need to stash a temp variable somewhere. To make this work cleanly this patch builds a cb struct for sk_skb types called sk_skb_cb struct. Then we can use this consistently in the strparser, sockmap space. Additionally we can start allowing ->cb[] write access after this.
--- include/net/strparser.h | 16 +++++++++++++++- net/core/filter.c | 21 +++++++++++++++++++++ net/strparser/strparser.c | 10 +--------- 3 files changed, 37 insertions(+), 10 deletions(-)
include/net/strparser.h +15 -1
@@ -54,10 +54,24 @@ struct strp_msg {int offset; }; +struct _strp_msg { +/* Internal cb structure. struct strp_msg must be first for passing +* to upper layer. +*/ +struct strp_msg strp; +int accum_len; +}; + +struct sk_skb_cb { +#define SK_SKB_CB_PRIV_LEN 20 +unsigned char data[SK_SKB_CB_PRIV_LEN ]; +struct _strp_msg strp; +}; +static inline struct strp_msg *strp_msg (struct sk_buff *skb) {return (struct strp_msg *)((void *)skb->cb + - offsetof(struct qdisc_skb_cb , data)); + offsetof(struct sk_skb_cb , strp)); }/* Structure for an attached lower socket */
net/core/filter.c +21 -0
@@ -8356,6 +8356,27 @@ static u32 sk_skb_convert_ctx_access(enum bpf_access_type type, *insn++ = BPF_LDX_MEM(BPF_SIZEOF(void *), si->dst_reg, si->src_reg, off);break ; + case offsetof(struct __sk_buff, cb[0]) ... + offsetofend(struct __sk_buff, cb[4]) - 1: + BUILD_BUG_ON(sizeof_field(struct sk_skb_cb, data) < 20); +BUILD_BUG_ON ((offsetof(struct sk_buff , cb) + + offsetof(struct sk_skb_cb , data)) % +sizeof (__u64)); + + prog->cb_access =1 ; + off = si->off; + off -= offsetof(struct __sk_buff, cb[0]); + off += offsetof(struct sk_buff , cb); + off += offsetof(struct sk_skb_cb , data); +if (type ==BPF_WRITE ) + *insn++ =BPF_STX_MEM (BPF_SIZE (si->code), si->dst_reg, + si->src_reg, off); +else + *insn++ =BPF_LDX_MEM (BPF_SIZE (si->code), si->dst_reg, + si->src_reg, off); +break ; + +default :return bpf_convert_ctx_access (type, si, insn_buf, prog, target_size);
net/strparser/strparser.c +1 -9
@@ -27,18 +27,10 @@static struct workqueue_struct *strp_wq; -struct _strp_msg { -/* Internal cb structure. struct strp_msg must be first for passing -* to upper layer. -*/ -struct strp_msg strp; -int accum_len; -}; -static inline struct _strp_msg *_strp_msg (struct sk_buff *skb) {return (struct _strp_msg *)((void *)skb->cb + - offsetof(struct qdisc_skb_cb , data)); + offsetof(struct sk_skb_cb , strp)); }/* Lower lock held */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 313/355 NFSv4: Fix a regression in nfs_set_open_stateid_locked()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 01d29f87fcfef38d51ce2b473981a5c1e861ac0a ]
If we already hold open state on the client, yet the server gives us a completely different stateid to the one we already hold, then we currently treat it as if it were an out-of-sequence update, and wait for 5 seconds for other updates to come in.
This commit fixes the behaviour so that we immediately start processing of the new stateid, and then leave it to the call to nfs4_test_and_free_stateid() to decide what to do with the old stateid.
--- fs/nfs/nfs4proc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
fs/nfs/nfs4proc.c +8 -7
@@ -1549,15 +1549,16 @@ static bool nfs_stateid_is_sequential(struct nfs4_state *state, {if (test_bit (NFS_OPEN_STATE , &state->flags)) {/* The common case - we're updating to a new sequence number */ -if (nfs4_stateid_match_other (stateid, &state->open_stateid) && -nfs4_stateid_is_next (&state->open_stateid, stateid)) { -return true; +if (nfs4_stateid_match_other (stateid, &state->open_stateid)) { +if (nfs4_stateid_is_next (&state->open_stateid, stateid)) +return true; +return false; } - }else { -/* This is the first OPEN in this generation */ -if (stateid->seqid ==cpu_to_be32 (1 )) -return true; +/* The server returned a new stateid */ } +/* This is the first OPEN in this generation */ +if (stateid->seqid ==cpu_to_be32 (1 )) +return true;return false; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 327/355 net/sched: sch_taprio: fix undefined behavior in ktime_mono_to_any
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 6dc25401cba4d428328eade8ceae717633fdd702 ]
1) if q->tk_offset == TK_OFFS_MAX, then get_tcp_tstamp() calls ktime_mono_to_any() with out-of-bound value.
2) if q->tk_offset is changed in taprio_parse_clockid(), taprio_get_time() might also call ktime_mono_to_any() with out-of-bound value as sysbot found:
UBSAN: array-index-out-of-bounds in kernel/time/timekeeping.c:908:27 index 3 is out of range for type 'ktime_t *[3]' CPU: 1 PID: 25668 Comm: kworker/u4:0 Not tainted 5.15.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 ubsan_epilogue+0xb/0x5a lib/ubsan.c:151 __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:291 ktime_mono_to_any+0x1d4/0x1e0 kernel/time/timekeeping.c:908 get_tcp_tstamp net/sched/sch_taprio.c:322 [inline] get_packet_txtime net/sched/sch_taprio.c:353 [inline] taprio_enqueue_one+0x5b0/0x1460 net/sched/sch_taprio.c:420 taprio_enqueue+0x3b1/0x730 net/sched/sch_taprio.c:485 dev_qdisc_enqueue+0x40/0x300 net/core/dev.c:3785 __dev_xmit_skb net/core/dev.c:3869 [inline] __dev_queue_xmit+0x1f6e/0x3630 net/core/dev.c:4194 batadv_send_skb_packet+0x4a9/0x5f0 net/batman-adv/send.c:108 batadv_iv_ogm_send_to_if net/batman-adv/bat_iv_ogm.c:393 [inline] batadv_iv_ogm_emit net/batman-adv/bat_iv_ogm.c:421 [inline] batadv_iv_send_outstanding_bat_ogm_packet+0x6d7/0x8e0 net/batman-adv/bat_iv_ogm.c:1701 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
--- net/sched/sch_taprio.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
net/sched/sch_taprio.c +17 -10
@@ -94,18 +94,22 @@ static ktime_t sched_base_time(const struct sched_gate_list *sched)return ns_to_ktime (sched->base_time); } -static ktime_t taprio_get_time (struct taprio_sched *q) +static ktime_t taprio_mono_to_any (const struct taprio_sched *q,ktime_t mono) { -ktime_t mono =ktime_get (); +/* This pairs with WRITE_ONCE() in taprio_parse_clockid() */ +enum tk_offsets tk_offset =READ_ONCE (q->tk_offset); -switch (q->tk_offset) { +switch (tk_offset) {case TK_OFFS_MAX :return mono;default : -return ktime_mono_to_any (mono, q->tk_offset); +return ktime_mono_to_any (mono, tk_offset); } +} -return KTIME_MAX ; +static ktime_t taprio_get_time (const struct taprio_sched *q) +{ +return taprio_mono_to_any (q,ktime_get ()); }static void taprio_free_sched_cb (struct rcu_head *head)
@@ -321,7 +325,7 @@ static ktime_t get_tcp_tstamp(struct taprio_sched *q, struct sk_buff *skb)return 0 ; } -return ktime_mono_to_any (skb->skb_mstamp_ns, q->tk_offset); +return taprio_mono_to_any (q, skb->skb_mstamp_ns); }/* There are a few scenarios where we will have to modify the txtime from
@@ -1342,6 +1346,7 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb, } }else if (tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID ]) {int clockid =nla_get_s32 (tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID ]); +enum tk_offsets tk_offset;/* We only support static clockids and we don't allow * for it to be modified after the first init.
@@ -1356,22 +1361,24 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb,switch (clockid) {case CLOCK_REALTIME : - q->tk_offset =TK_OFFS_REAL ; + tk_offset =TK_OFFS_REAL ;break ;case CLOCK_MONOTONIC : - q->tk_offset =TK_OFFS_MAX ; + tk_offset =TK_OFFS_MAX ;break ;case CLOCK_BOOTTIME : - q->tk_offset =TK_OFFS_BOOT ; + tk_offset =TK_OFFS_BOOT ;break ;case CLOCK_TAI : - q->tk_offset =TK_OFFS_TAI ; + tk_offset =TK_OFFS_TAI ;break ;default :NL_SET_ERR_MSG (extack,"Invalid 'clockid'" ); err = -EINVAL ; goto out; } +/* This pairs with READ_ONCE() in taprio_mono_to_any */ +WRITE_ONCE (q->tk_offset, tk_offset); q->clockid = clockid; }else {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 240/355 s390/gmap: dont unconditionally call pte_unmap_unlock() in __gmap_zap()
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
[ Upstream commit b159f94c86b43cf7e73e654bc527255b1f4eafc4 ]
... otherwise we will try unlocking a spinlock that was never locked via a garbage pointer.
At the time we reach this code path, we usually successfully looked up a PGSTE already; however, evil user space could have manipulated the VMA layout in the meantime and triggered removal of the page table.
--- arch/s390/mm/gmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/s390/mm/gmap.c +3 -2
@@ -684,9 +684,10 @@ void __gmap_zap(struct gmap *gmap, unsigned long gaddr) vmaddr |= gaddr & ~PMD_MASK ;/* Get pointer to the page table entry */ ptep =get_locked_pte (gmap->mm, vmaddr, &ptl); -if (likely (ptep)) +if (likely (ptep)) {ptep_zap_unused (gmap->mm, vmaddr, ptep,0 ); -pte_unmap_unlock (ptep, ptl); +pte_unmap_unlock (ptep, ptl); + } } }EXPORT_SYMBOL_GPL (__gmap_zap);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 272/355 video: fbdev: chipsfb: use memset_io() instead of memset()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit f2719b26ae27282c145202ffd656d5ff1fe737cc ]
While investigating a lockup at startup on Powerbook 3400C, it was identified that the fbdev driver generates alignment exception at startup:
--- interrupt: 600 at memset+0x60/0xc0
NIP: c0021414 LR: c03fc49c CTR: 00007fff
REGS: ca021c10 TRAP: 0600 Tainted: G W (5.14.2-pmac-00727-g12a41fa69492)
MSR: 00009032 <EE,ME,IR,DR,RI> CR: 44008442 XER: 20000100
DAR: cab80020 DSISR: 00017c07
GPR00: 00000007 ca021cd0 c14412e0 cab80000 00000000 00100000 cab8001c 00000004
GPR08: 00100000 00007fff 00000000 00000000 84008442 00000000 c0006fb4 00000000
GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00100000
GPR24: 00000000 81800000 00000320 c15fa400 c14d1878 00000000 c14d1800 c094e19c NIP [c0021414] memset+0x60/0xc0
LR [c03fc49c] chipsfb_pci_init+0x160/0x580
--- interrupt: 600
[ca021cd0] [c03fc46c] chipsfb_pci_init+0x130/0x580 (unreliable) [ca021d20] [c03a3a70] pci_device_probe+0xf8/0x1b8
[ca021d50] [c043d584] really_probe.part.0+0xac/0x388
[ca021d70] [c043d914] __driver_probe_device+0xb4/0x170
[ca021d90] [c043da18] driver_probe_device+0x48/0x144
[ca021dc0] [c043e318] __driver_attach+0x11c/0x1c4
[ca021de0] [c043ad30] bus_for_each_dev+0x88/0xf0
[ca021e10] [c043c724] bus_add_driver+0x190/0x22c
[ca021e40] [c043ee94] driver_register+0x9c/0x170
[ca021e60] [c0006c28] do_one_initcall+0x54/0x1ec
[ca021ed0] [c08246e4] kernel_init_freeable+0x1c0/0x270
[ca021f10] [c0006fdc] kernel_init+0x28/0x11c
[ca021f30] [c0017148] ret_from_kernel_thread+0x14/0x1c Instruction dump:
7d4601a4 39490777 7d4701a4 39490888 7d4801a4 39490999 7d4901a4 39290aaa 7d2a01a4 4c00012c 4bfffe88 0fe00000 <4bfffe80> 9421fff0 38210010 48001970
This is due to 'dcbz' instruction being used on non-cached memory. 'dcbz' instruction is used by memset() to zeroize a complete cacheline at once, and memset() is not expected to be used on non cached memory.
When performing a 'sparse' check on fbdev driver, it also appears that the use of memset() is unexpected:
drivers/video/fbdev/chipsfb.c:334:17: warning: incorrect type in argument 1 (different address spaces)
drivers/video/fbdev/chipsfb.c:334:17: expected void *
drivers/video/fbdev/chipsfb.c:334:17: got char [noderef] __iomem *screen_base
drivers/video/fbdev/chipsfb.c:334:15: warning: memset with byte count of 1048576
Use fb_memset() instead of memset(). fb_memset() is defined as memset_io() for powerpc.
--- drivers/video/fbdev/chipsfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/chipsfb.c +1 -1
@@ -331,7 +331,7 @@ static const struct fb_var_screeninfo chipsfb_var = {static void init_chips (struct fb_info *p,unsigned long addr) { -memset (p->screen_base,0 ,0x100000 ); +fb_memset (p->screen_base,0 ,0x100000 ); p->fix = chipsfb_fix; p->fix.smem_start = addr;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 268/355 arm: dts: omap3-gta04a4: accelerometer irq fix
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit 884ea75d79a36faf3731ad9d6b9c29f58697638d ]
Fix typo in pinctrl. It did only work because the bootloader seems to have initialized it.
--- arch/arm/boot/dts/omap3-gta04.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/omap3-gta04.dtsi +1 -1
@@ -515,7 +515,7 @@ compatible = "bosch,bma180"; reg = <0x41>; pinctrl-names = "default"; - pintcrl-0 = <&bma180_pins>; + pinctrl-0 = <&bma180_pins>; interrupt-parent = <&gpio4>; interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; /* GPIO_115 */ };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 271/355 clk: at91: check pmc node status before registering syscore ops
In reply to Greg Kroah-HartmanFrom: Clément Léger <[email protected]>
[ Upstream commit c405f5c15e9f6094f2fa1658e73e56f3058e2122 ]
Currently, at91 pmc driver always register the syscore_ops whatever the status of the pmc node that has been found. When set as secure and disabled, the pmc should not be accessed or this will generate abort exceptions.
To avoid this, add a check on node availability before registering the syscore operations.
--- drivers/clk/at91/pmc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clk/at91/pmc.c +5 -0
@@ -275,6 +275,11 @@ static int __init pmc_register_ops(void) np =of_find_matching_node (NULL , sama5d2_pmc_dt_ids); +if (!of_device_is_available (np)) { +of_node_put (np); +return -ENODEV ; + } + pmcreg =device_node_to_regmap (np);if (IS_ERR (pmcreg))return PTR_ERR (pmcreg);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 270/355 memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 4ed2f3545c2e5acfbccd7f85fea5b1a82e9862d7 ]
The error handling code of fsl_ifc_ctrl_probe is problematic. When fsl_ifc_ctrl_init fails or request_irq of fsl_ifc_ctrl_dev->irq fails, it forgets to free the irq and nand_irq. Meanwhile, if request_irq of fsl_ifc_ctrl_dev->nand_irq fails, it will still free nand_irq even if the request_irq is not successful.
Fix this by refactoring the error handling code.
--- drivers/memory/fsl_ifc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/memory/fsl_ifc.c +6 -7
@@ -263,7 +263,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) ret =fsl_ifc_ctrl_init (fsl_ifc_ctrl_dev);if (ret <0 ) - goto err; + goto err_unmap_nandirq;init_waitqueue_head (&fsl_ifc_ctrl_dev->nand_wait);
@@ -272,7 +272,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)if (ret !=0 ) {dev_err (&dev->dev,"failed to install irq (%d)\n" , fsl_ifc_ctrl_dev->irq); - goto err_irq; + goto err_unmap_nandirq; }if (fsl_ifc_ctrl_dev->nand_irq) {
@@ -281,17 +281,16 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)if (ret !=0 ) {dev_err (&dev->dev,"failed to install irq (%d)\n" , fsl_ifc_ctrl_dev->nand_irq); - goto err_nandirq; + goto err_free_irq; } }return 0 ; -err_nandirq: -free_irq (fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev); -irq_dispose_mapping (fsl_ifc_ctrl_dev->nand_irq); -err_irq: +err_free_irq:free_irq (fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev); +err_unmap_nandirq: +irq_dispose_mapping (fsl_ifc_ctrl_dev->nand_irq);irq_dispose_mapping (fsl_ifc_ctrl_dev->irq); err:iounmap (fsl_ifc_ctrl_dev->gregs);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 269/355 soc/tegra: Fix an error handling path in tegra_powergate_power_up()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 986b5094708e508baa452a23ffe809870934a7df ]
If an error occurs after a successful tegra_powergate_enable_clocks() call, it must be undone by a tegra_powergate_disable_clocks() call, as already done in the below and above error handling paths of this function.
Update the 'goto' to branch at the correct place of the error handling path.
--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/tegra/pmc.c +1 -1
@@ -591,7 +591,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg, err =reset_control_deassert (pg->reset);if (err) - goto powergate_off; + goto disable_clks;usleep_range (10 ,20 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 267/355 ALSA: hda: Reduce udelay() at SKL+ position reporting
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 46243b85b0ec5d2cee7545e5ce18c015ce91957e ]
The position reporting on Intel Skylake and later chips via azx_get_pos_skl() contains a udelay(20) call for the capture streams. A call for this alone doesn't sound too harmful. However, as the pointer PCM ops is one of the hottest path in the PCM operations -- especially for the timer-scheduled operations like PulseAudio -- such a delay hogs CPU usage significantly in the total performance.
The code there was taken from the original code in ASoC SST Skylake driver blindly. The udelay() is a workaround for the case where the reported position is behind the period boundary at the timing triggered from interrupts; applications often expect that the full data is available for the whole period when returned (and also that's the definition of the ALSA PCM period).
OTOH, HD-audio (legacy) driver has already some workarounds for the delayed position reporting due to its relatively large FIFO, such as the BDL position adjustment and the delayed period-elapsed call in the work. That said, the udelay() is almost superfluous for HD-audio driver unlike SST, and we can drop the udelay().
Though, the current code doesn't guarantee the full period readiness as mentioned in the above, but rather it checks the wallclock and detects the unexpected jump. That's one missing piece, and the drop of udelay() needs a bit more sanity checks for the delayed handling.
This patch implements those: the drop of udelay() call in azx_get_pos_skl() and the more proper check of hwptr in azx_position_ok(). The latter change is applied only for the case where the stream is running in the normal mode without no_period_wakeup flag. When no_period_wakeup is set, it essentially ignores the period handling and rather concentrates only on the current position; which implies that we don't need to care about the period boundary at all.
--- sound/pci/hda/hda_intel.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
sound/pci/hda/hda_intel.c +23 -5
@@ -671,13 +671,17 @@ static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev)* the update-IRQ timing. The IRQ is issued before actually the * data is processed. So, we need to process it afterwords in a * workqueue. +* +* Returns 1 if OK to proceed, 0 for delay handling, -1 for skipping update */ static int azx_position_ok (struct azx *chip,struct azx_dev *azx_dev) {struct snd_pcm_substream *substream = azx_dev->core.substream; +struct snd_pcm_runtime *runtime = substream->runtime;int stream = substream->stream;u32 wallclk;unsigned int pos; +snd_pcm_uframes_t hwptr, target; wallclk =azx_readl (chip,WALLCLK ) - azx_dev->core.start_wallclk;if (wallclk < (azx_dev->core.period_wallclk *2 ) /3 )
@@ -714,6 +718,24 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)/* NG - it's below the first next period boundary */ return chip->bdl_pos_adj ?0 :-1 ; azx_dev->core.start_wallclk += wallclk; + +if (azx_dev->core.no_period_wakeup) +return 1 ;/* OK, no need to check period boundary */ + +if (runtime->hw_ptr_base != runtime->hw_ptr_interrupt) +return 1 ;/* OK, already in hwptr updating process */ + +/* check whether the period gets really elapsed */ + pos =bytes_to_frames (runtime, pos); + hwptr = runtime->hw_ptr_base + pos; +if (hwptr < runtime->status->hw_ptr) + hwptr += runtime->buffer_size; + target = runtime->hw_ptr_interrupt + runtime->period_size; +if (hwptr < target) { +/* too early wakeup, process it later */ +return chip->bdl_pos_adj ?0 :-1 ; + } +return 1 ;/* OK, it's fine */ }
@@ -907,11 +929,7 @@ static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev)if (azx_dev->core.substream->stream ==SNDRV_PCM_STREAM_PLAYBACK )return azx_skl_get_dpib_pos (chip, azx_dev); -/* For capture, we need to read posbuf, but it requires a delay -* for the possible boundary overlap; the read of DPIB fetches the -* actual posbuf -*/ -udelay (20 ); +/* read of DPIB fetches the actual posbuf */ azx_skl_get_dpib_pos (chip, azx_dev);return azx_get_pos_posbuf (chip, azx_dev); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 277/355 RDMA/mlx4: Return missed an error if device doesnt support steering
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit f4e56ec4452f48b8292dcf0e1c4bdac83506fb8b ]
The error flow fixed in this patch is not possible because all kernel users of create QP interface check that device supports steering before set IB_QP_CREATE_NETIF_QP flag.
--- drivers/infiniband/hw/mlx4/qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/qp.c +3 -1
@@ -1149,8 +1149,10 @@ static int create_qp_common(struct ib_pd *pd, struct ib_qp_init_attr *init_attr,if (dev->steering_support ==MLX4_STEERING_MODE_DEVICE_MANAGED ) qp->flags |=MLX4_IB_QP_NETIF ; -else +else { + err = -EINVAL ; goto err; + } } err =set_kernel_sq_size (dev, &init_attr->cap, qp_type, qp);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 295/355 opp: Fix return in _opp_add_static_v2()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 27ff8187f13ecfec8a26fb1928e906f46f326cc5 ]
Fix sparse warning:drivers/opp/of.c:924 _opp_add_static_v2() warn: passing zero to 'ERR_PTR'
For duplicate OPPs 'ret' be set to zero.
--- drivers/opp/of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/of.c +1 -1
@@ -639,7 +639,7 @@ free_required_opps: free_opp:_opp_free (new_opp); -return ERR_PTR (ret); +return ret ?ERR_PTR (ret) :NULL ; }/* Initializes OPP tables based on new bindings */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 322/355 perf bpf: Add missing free to bpf_event__print_bpf_prog_info()
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
[ Upstream commit 88c42f4d6cb249eb68524282f8d4cc32f9059984 ]
If btf__new() is called then there needs to be a corresponding btf__free().
--- tools/perf/util/bpf-event.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/bpf-event.c +3 -1
@@ -467,7 +467,7 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,synthesize_bpf_prog_name (name,KSYM_NAME_LEN , info, btf,0 );fprintf (fp,"# bpf_prog_info %u: %s addr 0x%llx size %u\n" , info->id, name, prog_addrs[0 ], prog_lens[0 ]); -return ; + goto out; }fprintf (fp,"# bpf_prog_info %u:\n" , info->id);
@@ -477,4 +477,6 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,fprintf (fp,"# \tsub_prog %u: %s addr 0x%llx size %u\n" , i, name, prog_addrs[i], prog_lens[i]); } +out: +btf__free (btf); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 278/355 staging: ks7010: select CRYPTO_HASH/CRYPTO_MICHAEL_MIC
In reply to Greg Kroah-HartmanFrom: Vegard Nossum <[email protected]>
[ Upstream commit 9ca0e55e52c7b2a99f3c2051fc4bd1c63a061519 ]
Fix the following build/link errors:
ld: drivers/staging/ks7010/ks_hostif.o: in function `michael_mic.constprop.0':
ks_hostif.c:(.text+0x95b): undefined reference to `crypto_alloc_shash'
ld: ks_hostif.c:(.text+0x97a): undefined reference to `crypto_shash_setkey'
ld: ks_hostif.c:(.text+0xa13): undefined reference to `crypto_shash_update'
ld: ks_hostif.c:(.text+0xa28): undefined reference to `crypto_shash_update'
ld: ks_hostif.c:(.text+0xa48): undefined reference to `crypto_shash_finup'
ld: ks_hostif.c:(.text+0xa6d): undefined reference to `crypto_destroy_tfm'
--- drivers/staging/ks7010/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/ks7010/Kconfig +3 -0
@@ -5,6 +5,9 @@ config KS7010 select WIRELESS_EXT select WEXT_PRIV select FW_LOADER + select CRYPTO + select CRYPTO_HASH + select CRYPTO_MICHAEL_MIC help This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 303/355 auxdisplay: ht16k33: Fix frame buffer device blanking
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 840fe258332544aa7321921e1723d37b772af7a9 ]
As the ht16k33 frame buffer sub-driver does not register an fb_ops.fb_blank() handler, blanking does not work:
$ echo 1 > /sys/class/graphics/fb0/blank
sh: write error: Invalid argumentFix this by providing a handler that always returns zero, to make sure blank events will be sent to the actual device handling the backlight.
--- drivers/auxdisplay/ht16k33.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/auxdisplay/ht16k33.c +10 -0
@@ -219,6 +219,15 @@ static const struct backlight_ops ht16k33_bl_ops = { .check_fb = ht16k33_bl_check_fb, }; +/* +* Blank events will be passed to the actual device handling the backlight when +* we return zero here. +*/ +static int ht16k33_blank (int blank,struct fb_info *info) +{ +return 0 ; +} +static int ht16k33_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct ht16k33_priv *priv = info->par;
@@ -231,6 +240,7 @@ static struct fb_ops ht16k33_fb_ops = { .owner = THIS_MODULE, .fb_read = fb_sys_read, .fb_write = fb_sys_write, + .fb_blank = ht16k33_blank, .fb_fillrect = sys_fillrect, .fb_copyarea = sys_copyarea, .fb_imageblit = sys_imageblit,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 330/355 net/smc: fix sk_refcnt underflow on linkdown and fallback
In reply to Greg Kroah-HartmanFrom: Dust Li <[email protected]>
[ Upstream commit e5d5aadcf3cd59949316df49c27cb21788d7efe4 ]
We got the following WARNING when running ab/nginx test with RDMA link flapping (up-down-up).
The reason is when smc_sock fallback and at linkdown happens simultaneously, we may got the following situation:
__smc_lgr_terminate()
--> smc_conn_kill()
--> smc_close_active_abort()
smc_sock->sk_state = SMC_CLOSED
sock_put(smc_sock)smc_sock was set to SMC_CLOSED and sock_put() been called when terminate the link group. But later application call close() on the socket, then we got:
__smc_release():
if (smc_sock->fallback)
smc_sock->sk_state = SMC_CLOSED
sock_put(smc_sock)Again we set the smc_sock to CLOSED through it's already in CLOSED state, and double put the refcnt, so the following warning happens:
refcount_t: underflow; use-after-free.
WARNING: CPU: 5 PID: 860 at lib/refcount.c:28 refcount_warn_saturate+0x8d/0xf0 Modules linked in: CPU: 5 PID: 860 Comm: nginx Not tainted 5.10.46+ #403 Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 8c24b4c 04/01/2014 RIP: 0010:refcount_warn_saturate+0x8d/0xf0 Code: 05 5c 1e b5 01 01 e8 52 25 bc ff 0f 0b c3 80 3d 4f 1e b5 01 00 75 ad 48
RSP: 0018:ffffc90000527e50 EFLAGS: 00010286 RAX: 0000000000000026 RBX: ffff8881300df2c0 RCX: 0000000000000027 RDX: 0000000000000000 RSI: ffff88813bd58040 RDI: ffff88813bd58048 RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000001 R10: ffff8881300df2c0 R11: ffffc90000527c78 R12: ffff8881300df340 R13: ffff8881300df930 R14: ffff88810b3dad80 R15: ffff8881300df4f8 FS: 00007f739de8fb80(0000) GS:ffff88813bd40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000a01b008 CR3: 0000000111b64003 CR4: 00000000003706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: smc_release+0x353/0x3f0 __sock_release+0x3d/0xb0 sock_close+0x11/0x20 __fput+0x93/0x230 task_work_run+0x65/0xa0 exit_to_user_mode_prepare+0xf9/0x100 syscall_exit_to_user_mode+0x27/0x190 entry_SYSCALL_64_after_hwframe+0x44/0xa9
This patch adds check in __smc_release() to make sure we won't do an extra sock_put() and set the socket to CLOSED when its already in CLOSED state.
--- net/smc/af_smc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
net/smc/af_smc.c +11 -7
@@ -139,14 +139,18 @@ static int __smc_release(struct smc_sock *smc)sock_set_flag (sk,SOCK_DEAD ); sk->sk_shutdown |=SHUTDOWN_MASK ; }else { -if (sk->sk_state !=SMC_LISTEN && sk->sk_state !=SMC_INIT ) -sock_put (sk);/* passive closing */ -if (sk->sk_state ==SMC_LISTEN ) { -/* wake up clcsock accept */ - rc =kernel_sock_shutdown (smc->clcsock,SHUT_RDWR ); +if (sk->sk_state !=SMC_CLOSED ) { +if (sk->sk_state !=SMC_LISTEN && + sk->sk_state !=SMC_INIT ) +sock_put (sk);/* passive closing */ +if (sk->sk_state ==SMC_LISTEN ) { +/* wake up clcsock accept */ + rc =kernel_sock_shutdown (smc->clcsock, +SHUT_RDWR ); + } + sk->sk_state =SMC_CLOSED ; + sk->sk_state_change (sk); } - sk->sk_state =SMC_CLOSED ; - sk->sk_state_change (sk);smc_restore_fallback_changes (smc); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 334/355 ARM: 9156/1: drop cc-option fallbacks for architecture selection
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 418ace9992a7647c446ed3186df40cf165b67298 upstream.
Naresh and Antonio ran into a build failure with latest Debian armhf compilers, with lots of output like
tmp/ccY3nOAs.s:2215: Error: selected processor does not support `cpsid i' in ARM mode
As it turns out, $(cc-option) fails early here when the FPU is not selected before CPU architecture is selected, as the compiler option check runs before enabling -msoft-float, which causes a problem when testing a target architecture level without an FPU:
cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU
Passing e.g. -march=armv6k+fp in place of -march=armv6k would avoid this issue, but the fallback logic is already broken because all supported compilers (gcc-5 and higher) are much more recent than these options, and building with -march=armv5t as a fallback no longer works.
The best way forward that I see is to just remove all the checks, which also has the nice side-effect of slightly improving the startup time for 'make'.
The -mtune=marvell-f option was apparently never supported by any mainline compiler, and the custom Codesourcery gcc build that did support is now too old to build kernels, so just use -mtune=xscale unconditionally for those.
This should be safe to apply on all stable kernels, and will be required in order to keep building them with gcc-11 and higher.
--- arch/arm/Makefile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
arch/arm/Makefile +11 -11
@@ -66,15 +66,15 @@ KBUILD_CFLAGS += $(call cc-option,-fno-i # Note that GCC does not numerically define an architecture version # macro, but instead defines a whole series of macros which makes # testing for a specific architecture or later rather impossible. -arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m -arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) -arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) +arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m +arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 -march=armv7-a +arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 -march=armv6 # Only override the compiler option if ARMv6. The ARMv6K extensions are # always available in ARMv7 ifeq ($(CONFIG_CPU_32v6),y) -arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k) +arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 -march=armv6k endif -arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t) +arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 -march=armv5te arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4 arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3m
@@ -88,7 +88,7 @@ tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7t tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi -tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi) +tune-$(CONFIG_CPU_ARM946E) =-mtune=arm9e tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi
@@ -96,11 +96,11 @@ tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9t tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110 tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100 -tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale -tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale -tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale) -tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) -tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) +tune-$(CONFIG_CPU_XSCALE) =-mtune=xscale +tune-$(CONFIG_CPU_XSC3) =-mtune=xscale +tune-$(CONFIG_CPU_FEROCEON) =-mtune=xscale +tune-$(CONFIG_CPU_V6) =-mtune=arm1136j-s +tune-$(CONFIG_CPU_V6K) =-mtune=arm1136j-s # Evaluate tune cc-option calls now tune-y := $(tune-y)
Greg Kroah-Hartman
maintainerPATCH 337/355 irqchip/sifive-plic: Fixup EOI failed when masked
In reply to Greg Kroah-HartmanFrom: Guo Ren <[email protected]>
commit 69ea463021be0d159ab30f96195fb0dd18ee2272 upstream.
When using "devm_request_threaded_irq(,,,,IRQF_ONESHOT,,)" in a driver, only the first interrupt is handled, and following interrupts are never delivered (initially reported in [1]).
That's because the RISC-V PLIC cannot EOI masked interrupts, as explained in the description of Interrupt Completion in the PLIC spec [2]:
<quote>
The PLIC signals it has completed executing an interrupt handler by writing the interrupt ID it received from the claim to the claim/complete register. The PLIC does not check whether the completion ID is the same as the last claim ID for that target. If the completion ID does not match an interrupt source that *is currently enabled* for the target, the completion is silently ignored.
</quote>
Re-enable the interrupt before completion if it has been masked during the handling, and remask it afterwards.
[1] http://lists.infradead.org/pipermail/linux-riscv/2021-July/007441.html
[2] https://github.com/riscv/riscv-plic-spec/blob/8bc15a35d07c9edf7b5d23fec9728302595ffc4d/riscv-plic.adoc
--- drivers/irqchip/irq-sifive-plic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/irqchip/irq-sifive-plic.c +7 -1
@@ -138,7 +138,13 @@ static void plic_irq_eoi(struct irq_data {struct plic_handler *handler =this_cpu_ptr (&plic_handlers); -writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); +if (irqd_irq_masked (d)) { +plic_irq_unmask (d); +writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); +plic_irq_mask (d); + }else { +writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); + } }static struct irq_chip plic_chip = {
Greg Kroah-Hartman
maintainerPATCH 338/355 f2fs: should use GFP_NOFS for directory inodes
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit 92d602bc7177325e7453189a22e0c8764ed3453e upstream.
We use inline_dentry which requires to allocate dentry page when adding a link. If we allow to reclaim memory from filesystem, we do down_read(&sbi->cp_rwsem) twice by f2fs_lock_op(). I think this should be okay, but how about stopping the lockdep complaint [1]?
f2fs_create()
- f2fs_lock_op()
- f2fs_do_add_link()
- __f2fs_find_entry
- f2fs_get_read_data_page()
-> kswapd
- shrink_node
- f2fs_evict_inode
- f2fs_lock_op()
[1]
fs_reclaim
){+.+.}-{0:0}
:
kswapd0: lock_acquire+0x114/0x394 kswapd0: __fs_reclaim_acquire+0x40/0x50 kswapd0: prepare_alloc_pages+0x94/0x1ec kswapd0: __alloc_pages_nodemask+0x78/0x1b0 kswapd0: pagecache_get_page+0x2e0/0x57c kswapd0: f2fs_get_read_data_page+0xc0/0x394 kswapd0: f2fs_find_data_page+0xa4/0x23c kswapd0: find_in_level+0x1a8/0x36c kswapd0: __f2fs_find_entry+0x70/0x100 kswapd0: f2fs_do_add_link+0x84/0x1ec kswapd0: f2fs_mkdir+0xe4/0x1e4 kswapd0: vfs_mkdir+0x110/0x1c0 kswapd0: do_mkdirat+0xa4/0x160 kswapd0: __arm64_sys_mkdirat+0x24/0x34 kswapd0: el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8 kswapd0: do_el0_svc+0x28/0xa0 kswapd0: el0_svc+0x24/0x38 kswapd0: el0_sync_handler+0x88/0xec kswapd0: el0_sync+0x1c0/0x200
kswapd0:
-> #1
(&sbi->cp_rwsem
){++++}-{3:3}
:
kswapd0: lock_acquire+0x114/0x394 kswapd0: down_read+0x7c/0x98 kswapd0: f2fs_do_truncate_blocks+0x78/0x3dc kswapd0: f2fs_truncate+0xc8/0x128 kswapd0: f2fs_evict_inode+0x2b8/0x8b8 kswapd0: evict+0xd4/0x2f8 kswapd0: iput+0x1c0/0x258 kswapd0: do_unlinkat+0x170/0x2a0 kswapd0: __arm64_sys_unlinkat+0x4c/0x68 kswapd0: el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8 kswapd0: do_el0_svc+0x28/0xa0 kswapd0: el0_svc+0x24/0x38 kswapd0: el0_sync_handler+0x88/0xec kswapd0: el0_sync+0x1c0/0x200
--- fs/f2fs/inode.c | 2 +- fs/f2fs/namei.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/inode.c +1 -1
@@ -455,7 +455,7 @@ make_now: inode->i_op = &f2fs_dir_inode_operations; inode->i_fop = &f2fs_dir_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; -inode_nohighmem (inode); +mapping_set_gfp_mask (inode->i_mapping,GFP_NOFS ); }else if (S_ISLNK (inode->i_mode)) {if (file_is_encrypt (inode)) inode->i_op = &f2fs_encrypted_symlink_inode_operations;
fs/f2fs/namei.c +1 -1
@@ -679,7 +679,7 @@ static int f2fs_mkdir(struct inode *dir, inode->i_op = &f2fs_dir_inode_operations; inode->i_fop = &f2fs_dir_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; -inode_nohighmem (inode); +mapping_set_gfp_mask (inode->i_mapping,GFP_NOFS );set_inode_flag (inode,FI_INC_LINK );f2fs_lock_op (sbi);
Greg Kroah-Hartman
maintainerPATCH 333/355 ARM: 9155/1: fix early early_iounmap()
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
commit 0d08e7bf0d0d1a29aff7b16ef516f7415eb1aa05 upstream.
Currently __set_fixmap() bails out with a warning when called in early boot from early_iounmap(). Fix it, and while at it, make the comment a bit easier to understand.
--- arch/arm/mm/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mm/mmu.c +2 -2
@@ -415,9 +415,9 @@ void __set_fixmap(enum fixed_addresses i FIXADDR_END);BUG_ON (idx >= __end_of_fixed_addresses); -/* we only support device mappings until pgprot_kernel has been set */ +/* We support only device mappings before pgprot_kernel is set. */ if (WARN_ON (pgprot_val (prot) !=pgprot_val (FIXMAP_PAGE_IO ) && -pgprot_val (pgprot_kernel) ==0 )) +pgprot_val (prot) &&pgprot_val (pgprot_kernel) ==0 ))return ;if (pgprot_val (prot))
Greg Kroah-Hartman
maintainerPATCH 335/355 parisc: Fix backtrace to always include init funtion names
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 279917e27edc293eb645a25428c6ab3f3bca3f86 upstream.
I noticed that sometimes at kernel startup the backtraces did not included the function names of init functions. Their address were not resolved to function names and instead only the address was printed.
Debugging shows that the culprit is is_ksym_addr() which is called by the backtrace functions to check if an address belongs to a function in the kernel. The problem occurs only for CONFIG_KALLSYMS_ALL=y.
When looking at is_ksym_addr() one can see that for CONFIG_KALLSYMS_ALL=y the function only tries to resolve the address via is_kernel() function, which checks like this:
if (addr >= _stext && addr <= _end)
return 1;On parisc the init functions are located before _stext, so this check fails. Other platforms seem to have all functions (including init functions) behind _stext.
The following patch moves the _stext symbol at the beginning of the kernel and thus includes the init section. This fixes the check and does not seem to have any negative side effects on where the kernel mapping happens in the map_pages() function in arch/parisc/mm/init.c.
--- arch/parisc/kernel/vmlinux.lds.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/kernel/vmlinux.lds.S +2 -1
@@ -56,6 +56,8 @@ SECTIONS { . = KERNEL_BINARY_TEXT_START; + _stext = .; /* start of kernel text, includes init code & data */ + __init_begin = .; HEAD_TEXT_SECTION MLONGCALL_DISCARD(INIT_TEXT_SECTION(8))
@@ -79,7 +81,6 @@ SECTIONS /* freed after init ends here */ _text = .; /* Text and read-only data */ - _stext = .; MLONGCALL_KEEP(INIT_TEXT_SECTION(8)) .text ALIGN(PAGE_SIZE) : { TEXT_TEXT
Greg Kroah-Hartman
maintainerPATCH 332/355 selftests/net: udpgso_bench_rx: fix port argument
In reply to Greg Kroah-HartmanFrom: Willem de Bruijn <[email protected]>
[ Upstream commit d336509cb9d03970911878bb77f0497f64fda061 ]
The below commit added optional support for passing a bind address. It configures the sockaddr bind arguments before parsing options and reconfigures on options -b and -4.
This broke support for passing port (-p) on its own.
Configure sockaddr after parsing all arguments.
--- tools/testing/selftests/net/udpgso_bench_rx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
tools/testing/selftests/net/udpgso_bench_rx.c +7 -4
@@ -293,19 +293,17 @@ static void usage(const char *filepath)static void parse_opts (int argc,char **argv) { +const char *bind_addr =NULL ;int c; -/* bind to any by default */ -setup_sockaddr (PF_INET6 ,"::" , &cfg_bind_addr);while ((c =getopt (argc, argv,"4b:C:Gl:n:p:rR:S:tv" )) !=-1 ) {switch (c) {case '4' : cfg_family =PF_INET ; cfg_alen =sizeof (struct sockaddr_in ); -setup_sockaddr (PF_INET ,"0.0.0.0" , &cfg_bind_addr);break ;case 'b' : -setup_sockaddr (cfg_family, optarg, &cfg_bind_addr); + bind_addr = optarg;break ;case 'C' : cfg_connect_timeout_ms =strtoul (optarg,NULL ,0 );
@@ -341,6 +339,11 @@ static void parse_opts(int argc, char **argv) } } +if (!bind_addr) + bind_addr = cfg_family ==PF_INET6 ?"::" :"0.0.0.0" ; + +setup_sockaddr (cfg_family, bind_addr, &cfg_bind_addr); +if (optind != argc)usage (argv[0 ]);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 331/355 cxgb4: fix eeprom len when diagnostics not implemented
In reply to Greg Kroah-HartmanFrom: Rahul Lakkireddy <[email protected]>
[ Upstream commit 4ca110bf8d9b31a60f8f8ff6706ea147d38ad97c ]
Ensure diagnostics monitoring support is implemented for the SFF 8472 compliant port module and set the correct length for ethtool port module eeprom read.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 7 +++++-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +5 -2
@@ -1466,12 +1466,15 @@ static int cxgb4_get_module_info(struct net_device *dev,if (ret)return ret; -if (!sff8472_comp || (sff_diag_type &4 )) { +if (!sff8472_comp || (sff_diag_type &SFP_DIAG_ADDRMODE )) { modinfo->type =ETH_MODULE_SFF_8079 ; modinfo->eeprom_len =ETH_MODULE_SFF_8079_LEN ; }else { modinfo->type =ETH_MODULE_SFF_8472 ; - modinfo->eeprom_len =ETH_MODULE_SFF_8472_LEN ; +if (sff_diag_type &SFP_DIAG_IMPLEMENTED ) + modinfo->eeprom_len =ETH_MODULE_SFF_8472_LEN ; +else + modinfo->eeprom_len =ETH_MODULE_SFF_8472_LEN /2 ; }break ;
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +2 -0
@@ -293,6 +293,8 @@ enum {#define I2C_PAGE_SIZE 0x100#define SFP_DIAG_TYPE_ADDR 0x5c#define SFP_DIAG_TYPE_LEN 0x1 +#define SFP_DIAG_ADDRMODE BIT(2) +#define SFP_DIAG_IMPLEMENTED BIT(6)#define SFF_8472_COMP_ADDR 0x5e#define SFF_8472_COMP_LEN 0x1#define SFF_REV_ADDR 0x1
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 336/355 parisc: Fix set_fixmap() on PA1.x CPUs
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 6e866a462867b60841202e900f10936a0478608c upstream.
Fix a kernel crash which happens on PA1.x CPUs while initializing the FTRACE/KPROBE breakpoints. The PTE table entries for the fixmap area were not created correctly.
--- arch/parisc/mm/fixmap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/parisc/mm/fixmap.c +1 -4
@@ -18,12 +18,9 @@ void notrace set_fixmap(enum fixed_addrepte_t *pte;if (pmd_none (*pmd)) - pmd =pmd_alloc (NULL , pgd, vaddr); - - pte =pte_offset_kernel (pmd, vaddr); -if (pte_none (*pte)) pte =pte_alloc_kernel (pmd, vaddr); + pte =pte_offset_kernel (pmd, vaddr);set_pte_at (&init_mm, vaddr, pte,__mk_pte (phys,PAGE_KERNEL_RWX ));flush_tlb_kernel_range (vaddr, vaddr +PAGE_SIZE ); }
Greg Kroah-Hartman
maintainerPATCH 329/355 vsock: prevent unnecessary refcnt inc for nonblocking connect
In reply to Greg Kroah-HartmanFrom: Eiichi Tsukata <[email protected]>
[ Upstream commit c7cd82b90599fa10915f41e3dd9098a77d0aa7b6 ]
Currently vosck_connect() increments sock refcount for nonblocking socket each time it's called, which can lead to memory leak if it's called multiple times because connect timeout function decrements sock refcount only once.
Fixes it by making vsock_connect() return -EALREADY immediately when sock state is already SS_CONNECTING.
--- net/vmw_vsock/af_vsock.c | 2 ++ 1 file changed, 2 insertions(+)
net/vmw_vsock/af_vsock.c +2 -0
@@ -1151,6 +1151,8 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,* non-blocking call. */ err = -EALREADY ; +if (flags &O_NONBLOCK ) + goto out;break ;default : if ((sk->sk_state == TCP_LISTEN) ||
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 328/355 net: hns3: allow configure ETS bandwidth of all TCs
In reply to Greg Kroah-HartmanFrom: Guangbin Huang <[email protected]>
[ Upstream commit 688db0c7a4a69ddc8b8143a1cac01eb20082a3aa ]
Currently, driver only allow configuring ETS bandwidth of TCs according to the max TC number queried from firmware. However, the hardware actually supports 8 TCs and users may need to configure ETS bandwidth of all TCs, so remove the restriction.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +1 -1
@@ -124,7 +124,7 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets,if (ret)return ret; -for (i =0 ; i < hdev->tc_max; i++) { +for (i =0 ; i <HNAE3_MAX_TC ; i++) {switch (ets->tc_tsa[i]) {case IEEE_8021QAZ_TSA_STRICT : if (hdev->tm_info.tc_info[i].tc_sch_mode !=
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1 -8
@@ -974,7 +974,6 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclge_dev *hdev)static int hclge_tm_ets_tc_dwrr_cfg (struct hclge_dev *hdev) { -#define DEFAULT_TC_WEIGHT 1#define DEFAULT_TC_OFFSET 14struct hclge_ets_tc_weight_cmd *ets_weight;
@@ -987,13 +986,7 @@ static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev)for (i =0 ; i <HNAE3_MAX_TC ; i++) {struct hclge_pg_info *pg_info; - ets_weight->tc_weight[i] =DEFAULT_TC_WEIGHT ; - -if (!(hdev->hw_tc_map &BIT (i))) -continue ; - - pg_info = - &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid]; + pg_info = &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid]; ets_weight->tc_weight[i] = pg_info->tc_dwrr[i]; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 324/355 nfc: pn533: Fix double free when pn533_fill_fragment_skbs() fails
In reply to Greg Kroah-HartmanFrom: Chengfeng Ye <[email protected]>
[ Upstream commit 9fec40f850658e00a14a7dd9e06f7fbc7e59cc4a ]
skb is already freed by dev_kfree_skb in pn533_fill_fragment_skbs, but follow error handler branch when pn533_fill_fragment_skbs() fails, skb is freed again, results in double free issue. Fix this by not free skb in error path of pn533_fill_fragment_skbs.
--- drivers/nfc/pn533/pn533.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nfc/pn533/pn533.c +3 -3
@@ -2072,7 +2072,7 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb) frag =pn533_alloc_skb (dev, frag_size);if (!frag) {skb_queue_purge (&dev->fragment_skb); -break ; +return -ENOMEM ; }if (!dev->tgt_mode) {
@@ -2143,7 +2143,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev,/* jumbo frame ? */ if (skb->len >PN533_CMD_DATAEXCH_DATA_MAXLEN ) { rc =pn533_fill_fragment_skbs (dev, skb); -if (rc <=0 ) +if (rc <0 ) goto error; skb =skb_dequeue (&dev->fragment_skb);
@@ -2215,7 +2215,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)/* let's split in multiple chunks if size's too big */ if (skb->len >PN533_CMD_DATAEXCH_DATA_MAXLEN ) { rc =pn533_fill_fragment_skbs (dev, skb); -if (rc <=0 ) +if (rc <0 ) goto error;/* get the first skb */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 323/355 llc: fix out-of-bound array index in llc_sk_dev_hash()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 8ac9dfd58b138f7e82098a4e0a0d46858b12215b ]
Both ifindex and LLC_SK_DEV_HASH_ENTRIES are signed.
This means that (ifindex % LLC_SK_DEV_HASH_ENTRIES) is negative if @ifindex is negative.
We could simply make LLC_SK_DEV_HASH_ENTRIES unsigned.
In this patch I chose to use hash_32() to get more entropy from @ifindex, like llc_sk_laddr_hashfn().
UBSAN: array-index-out-of-bounds in ./include/net/llc.h:75:26 index -43 is out of range for type 'hlist_head [64]' CPU: 1 PID: 20999 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 ubsan_epilogue+0xb/0x5a lib/ubsan.c:151 __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:291 llc_sk_dev_hash include/net/llc.h:75 [inline] llc_sap_add_socket+0x49c/0x520 net/llc/llc_conn.c:697 llc_ui_bind+0x680/0xd70 net/llc/af_llc.c:404 __sys_bind+0x1e9/0x250 net/socket.c:1693 __do_sys_bind net/socket.c:1704 [inline] __se_sys_bind net/socket.c:1702 [inline] __x64_sys_bind+0x6f/0xb0 net/socket.c:1702 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fa503407ae9
--- include/net/llc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/net/llc.h +3 -1
@@ -72,7 +72,9 @@ struct llc_sap {static inline struct hlist_head *llc_sk_dev_hash (struct llc_sap *sap,int ifindex) { -return &sap->sk_dev_hash[ifindex %LLC_SK_DEV_HASH_ENTRIES ]; +u32 bucket =hash_32 (ifindex,LLC_SK_DEV_HASH_BITS ); + +return &sap->sk_dev_hash[bucket]; } static inline
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 339/355 net, neigh: Enable state migration between NUD_PERMANENT and NTF_USE
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 3dc20f4762c62d3b3f0940644881ed818aa7b2f5 ]
Currently, it is not possible to migrate a neighbor entry between NUD_PERMANENT state and NTF_USE flag with a dynamic NUD state from a user space control plane. Similarly, it is not possible to add/remove NTF_EXT_LEARNED flag from an existing neighbor entry in combination with NTF_USE flag.
This is due to the latter directly calling into neigh_event_send() without any meta data updates as happening in __neigh_update(). Thus, to enable this use case, extend the latter with a NEIGH_UPDATE_F_USE flag where we break the NUD_PERMANENT state in particular so that a latter neigh_event_send() is able to re-resolve a neighbor entry.
Before fix, NUD_PERMANENT -> NUD_* & NTF_USE:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a PERMANENT [...] # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a PERMANENT [...]
As can be seen, despite the admin-triggered replace, the entry remains in the NUD_PERMANENT state.
After fix, NUD_PERMANENT -> NUD_* & NTF_USE:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a PERMANENT [...] # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a extern_learn REACHABLE [...] # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a extern_learn STALE [...] # ./ip/ip n replace 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a PERMANENT [...]
After the fix, the admin-triggered replace switches to a dynamic state from the NTF_USE flag which triggered a new neighbor resolution. Likewise, we can transition back from there, if needed, into NUD_PERMANENT.
Similar before/after behavior can be observed for below transitions:
Before fix, NTF_USE -> NTF_USE | NTF_EXT_LEARNED -> NTF_USE:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 use # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE [...] # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE [...]
After fix, NTF_USE -> NTF_USE | NTF_EXT_LEARNED -> NTF_USE:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 use # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE [...] # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a extern_learn REACHABLE [...] # ./ip/ip n replace 192.168.178.30 dev enp5s0 use # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE [..]
--- include/net/neighbour.h | 1 + net/core/neighbour.c | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-)
include/net/neighbour.h +1 -0
@@ -253,6 +253,7 @@ static inline void *neighbour_priv(const struct neighbour *n)#define NEIGH_UPDATE_F_OVERRIDE 0x00000001#define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002#define NEIGH_UPDATE_F_OVERRIDE_ISROUTER 0x00000004 +#define NEIGH_UPDATE_F_USE 0x10000000#define NEIGH_UPDATE_F_EXT_LEARNED 0x20000000#define NEIGH_UPDATE_F_ISROUTER 0x40000000#define NEIGH_UPDATE_F_ADMIN 0x80000000
net/core/neighbour.c +13 -9
@@ -1221,7 +1221,7 @@ static void neigh_update_hhs(struct neighbour *neigh) lladdr instead of overriding it if it is different. NEIGH_UPDATE_F_ADMIN means that the change is administrative. - + NEIGH_UPDATE_F_USE means that the entry is user triggered. NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing NTF_ROUTER flag. NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as
@@ -1259,6 +1259,12 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr, goto out; ext_learn_change =neigh_update_ext_learned (neigh, flags, ¬ify); +if (flags &NEIGH_UPDATE_F_USE ) { + new = old & ~NUD_PERMANENT ; + neigh->nud_state = new; + err =0 ; + goto out; + }if (!(new &NUD_VALID )) {neigh_del_timer (neigh);
@@ -1966,22 +1972,20 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh,if (protocol) neigh->protocol = protocol; -if (ndm->ndm_flags &NTF_EXT_LEARNED ) flags |=NEIGH_UPDATE_F_EXT_LEARNED ; -if (ndm->ndm_flags &NTF_ROUTER ) flags |=NEIGH_UPDATE_F_ISROUTER ; +if (ndm->ndm_flags &NTF_USE ) + flags |=NEIGH_UPDATE_F_USE ; -if (ndm->ndm_flags &NTF_USE ) { + err =__neigh_update (neigh, lladdr, ndm->ndm_state, flags, +NETLINK_CB (skb).portid, extack); +if (!err && ndm->ndm_flags &NTF_USE ) {neigh_event_send (neigh,NULL ); err =0 ; - }else - err =__neigh_update (neigh, lladdr, ndm->ndm_state, flags, -NETLINK_CB (skb).portid, extack); - + }neigh_release (neigh); - out:return err; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 321/355 zram: off by one in read_block_state()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit a88e03cf3d190cf46bc4063a9b7efe87590de5f4 ]
snprintf() returns the number of bytes it would have printed if there were space. But it does not count the NUL terminator. So that means that if "count == copied" then this has already overflowed by one character.
This bug likely isn't super harmful in real life.
--- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +1 -1
@@ -901,7 +901,7 @@ static ssize_t read_block_state(struct file *file, char __user *buf,zram_test_flag (zram, index,ZRAM_HUGE ) ?'h' :'.' , zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.'); -if (count < copied) { +if (count <= copied) {zram_slot_unlock (zram, index);break ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 284/355 HID: u2fzero: clarify error check and length calculations
In reply to Greg Kroah-HartmanFrom: Andrej Shadura <[email protected]>
[ Upstream commit b7abf78b7a6c4a29a6e0ba0bb883fe44a2f3d693 ]
The previous commit fixed handling of incomplete packets but broke error
handling: offsetof returns an unsigned value (size_t), but when compared against the signed return value, the return value is interpreted as if it were unsigned, so negative return values are never less than the offset.
To make the code easier to read, calculate the minimal packet length once and separately, and assign it to a signed int variable to eliminate unsigned math and the need for type casts. It then becomes immediately obvious how the actual data length is calculated and why the return value cannot be less than the minimal length.
--- drivers/hid/hid-u2fzero.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/hid/hid-u2fzero.c +5 -3
@@ -191,6 +191,8 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data,struct u2f_hid_msg resp;int ret;size_t actual_length; +/* valid packets must have a correct header */ + int min_length = offsetof(struct u2f_hid_msg, init.data);if (!dev->present) {hid_dbg (dev->hdev,"device not present" );
@@ -200,12 +202,12 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data, ret =u2fzero_recv (dev, &req, &resp);/* ignore errors or packets without data */ - if (ret < offsetof(struct u2f_hid_msg, init.data)) +if (ret < min_length)return 0 ;/* only take the minimum amount of data it is safe to take */ - actual_length =min3 ((size_t )ret - offsetof(struct u2f_hid_msg , - init.data), U2F_HID_MSG_LEN(resp), max); + actual_length =min3 ((size_t )ret - min_length, +U2F_HID_MSG_LEN (resp), max);memcpy (data, resp.init.data, actual_length);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 283/355 serial: xilinx_uartps: Fix race condition causing stuck TX
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
[ Upstream commit 88b20f84f0fe47409342669caf3e58a3fc64c316 ]
xilinx_uartps .start_tx() clears TXEMPTY when enabling TXEMPTY to avoid any previous TXEVENT event asserting the UART interrupt. This clear operation is done immediately after filling the TX FIFO.
However, if the bytes inserted by cdns_uart_handle_tx() are consumed by the UART before the TXEMPTY is cleared, the clear operation eats the new TXEMPTY event as well, causing cdns_uart_isr() to never receive the TXEMPTY event. If there are bytes still queued in circbuf, TX will get stuck as they will never get transferred to FIFO (unless new bytes are queued to circbuf in which case .start_tx() is called again).
While the racy missed TXEMPTY occurs fairly often with short data sequences (e.g. write 1 byte), in those cases circbuf is usually empty so no action on TXEMPTY would have been needed anyway. On the other hand, longer data sequences make the race much more unlikely as UART takes longer to consume the TX FIFO. Therefore it is rare for this race to cause visible issues in general.
Fix the race by clearing the TXEMPTY bit in ISR *before* filling the FIFO.
The TXEMPTY bit in ISR will only get asserted at the exact moment the TX FIFO *becomes* empty, so clearing the bit before filling FIFO does not cause an extra immediate assertion even if the FIFO is initially empty.
This is hard to reproduce directly on a normal system, but inserting e.g. udelay(200) after cdns_uart_handle_tx(port), setting 4000000 baud, and then running "dd if=/dev/zero bs=128 of=/dev/ttyPS0 count=50" reliably reproduces the issue on my ZynqMP test system unless this fix is applied.
--- drivers/tty/serial/xilinx_uartps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/xilinx_uartps.c +2 -1
@@ -595,9 +595,10 @@ static void cdns_uart_start_tx(struct uart_port *port)if (uart_circ_empty (&port->state->xmit))return ; +writel (CDNS_UART_IXR_TXEMPTY , port->membase +CDNS_UART_ISR ); +cdns_uart_handle_tx (port); -writel (CDNS_UART_IXR_TXEMPTY , port->membase +CDNS_UART_ISR );/* Enable the TX Empty interrupt */ writel (CDNS_UART_IXR_TXEMPTY , port->membase +CDNS_UART_IER ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 280/355 ASoC: cs42l42: Correct some register default values
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit d591d4b32aa9552af14a0c7c586a2d3fe9ecc6e0 ]
Some registers had wrong default values in cs42l42_reg_defaults[].
--- sound/soc/codecs/cs42l42.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs42l42.c +2 -2
@@ -91,7 +91,7 @@ static const struct reg_default cs42l42_reg_defaults[] = { { CS42L42_ASP_RX_INT_MASK, 0x1F }, { CS42L42_ASP_TX_INT_MASK, 0x0F }, { CS42L42_CODEC_INT_MASK, 0x03 }, - { CS42L42_SRCPL_INT_MASK, 0xFF }, + { CS42L42_SRCPL_INT_MASK, 0x7F }, { CS42L42_VPMON_INT_MASK, 0x01 }, { CS42L42_PLL_LOCK_INT_MASK, 0x01 }, { CS42L42_TSRS_PLUG_INT_MASK, 0x0F },
@@ -128,7 +128,7 @@ static const struct reg_default cs42l42_reg_defaults[] = { { CS42L42_MIXER_CHA_VOL, 0x3F }, { CS42L42_MIXER_ADC_VOL, 0x3F }, { CS42L42_MIXER_CHB_VOL, 0x3F }, - { CS42L42_EQ_COEF_IN0, 0x22 }, + { CS42L42_EQ_COEF_IN0, 0x00 }, { CS42L42_EQ_COEF_IN1, 0x00 }, { CS42L42_EQ_COEF_IN2, 0x00 }, { CS42L42_EQ_COEF_IN3, 0x00 },
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 281/355 ASoC: cs42l42: Defer probe if request_threaded_irq() returns EPROBE_DEFER
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit 0306988789d9d91a18ff70bd2bf165d3ae0ef1dd ]
The driver can run without an interrupt so if devm_request_threaded_irq() failed, the probe() just carried on. But if this was EPROBE_DEFER the driver would continue without an interrupt instead of deferring to wait for the interrupt to become available.
--- sound/soc/codecs/cs42l42.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/codecs/cs42l42.c +3 -2
@@ -1798,8 +1798,9 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,NULL , cs42l42_irq_thread,IRQF_ONESHOT |IRQF_TRIGGER_LOW , "cs42l42", cs42l42); - -if (ret !=0 ) +if (ret == -EPROBE_DEFER ) + goto err_disable; +else if (ret !=0 )dev_err (&i2c_client->dev,"Failed to request IRQ: %d\n" , ret);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 282/355 phy: qcom-qusb2: Fix a memory leak on probe
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit bf7ffcd0069d30e2e7ba2b827f08c89f471cd1f3 ]
On success nvmem_cell_read() returns a pointer to a dynamically allocated buffer, and therefore it shall be freed after usage.
The issue is reported by kmemleak:
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff3b3803e4b280 (size 128):
comm "kworker/u16:1", pid 107, jiffies 4294892861 (age 94.120s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000007739afdc>] __kmalloc+0x27c/0x41c
[<0000000071c0fbf8>] nvmem_cell_read+0x40/0xe0
[<00000000e803ef1f>] qusb2_phy_init+0x258/0x5bc
[<00000000fc81fcfa>] phy_init+0x70/0x110
[<00000000e3d48a57>] dwc3_core_soft_reset+0x4c/0x234
[<0000000027d1dbd4>] dwc3_core_init+0x68/0x990
[<000000001965faf9>] dwc3_probe+0x4f4/0x730
[<000000002f7617ca>] platform_probe+0x74/0xf0
[<00000000a2576cac>] really_probe+0xc4/0x470
[<00000000bc77f2c5>] __driver_probe_device+0x11c/0x190
[<00000000130db71f>] driver_probe_device+0x48/0x110
[<0000000019f36c2b>] __device_attach_driver+0xa4/0x140
[<00000000e5812ff7>] bus_for_each_drv+0x84/0xe0
[<00000000f4bac574>] __device_attach+0xe4/0x1c0
[<00000000d3beb631>] device_initial_probe+0x20/0x30
[<000000008019b9db>] bus_probe_device+0xa4/0xb0--- drivers/phy/qualcomm/phy-qcom-qusb2.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/phy/qualcomm/phy-qcom-qusb2.c +10 -6
@@ -432,7 +432,7 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) {struct device *dev = &qphy->phy->dev;const struct qusb2_phy_cfg *cfg = qphy->cfg; -u8 *val; +u8 *val, hstx_trim;/* efuse register is optional */ if (!qphy->cell)
@@ -446,7 +446,13 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)* set while configuring the phy. */ val =nvmem_cell_read (qphy->cell,NULL ); -if (IS_ERR (val) || !val[0 ]) { +if (IS_ERR (val)) { +dev_dbg (dev,"failed to read a valid hs-tx trim value\n" ); +return ; + } + hstx_trim = val[0 ]; +kfree (val); +if (!hstx_trim) {dev_dbg (dev,"failed to read a valid hs-tx trim value\n" );return ; }
@@ -454,12 +460,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)/* Fused TUNE1/2 value is the higher nibble only */ if (cfg->update_tune1_with_efuse)qusb2_write_mask (qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1 ], - val[0 ] <<HSTX_TRIM_SHIFT , -HSTX_TRIM_MASK ); + hstx_trim <<HSTX_TRIM_SHIFT ,HSTX_TRIM_MASK );else qusb2_write_mask (qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2 ], - val[0 ] <<HSTX_TRIM_SHIFT , -HSTX_TRIM_MASK ); + hstx_trim <<HSTX_TRIM_SHIFT ,HSTX_TRIM_MASK ); } static int qusb2_phy_set_mode(struct phy *phy,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 341/355 ovl: fix deadlock in splice write
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 9b91b6b019fda817eb52f728eb9c79b3579760bc upstream.
There's possibility of an ABBA deadlock in case of a splice write to an overlayfs file and a concurrent splice write to a corresponding real file.
The call chain for splice to an overlay file:
-> do_splice [takes sb_writers on overlay file]
-> do_splice_from
-> iter_file_splice_write [takes pipe->mutex]
-> vfs_iter_write
...
-> ovl_write_iter [takes sb_writers on real file]And the call chain for splice to a real file:
-> do_splice [takes sb_writers on real file]
-> do_splice_from
-> iter_file_splice_write [takes pipe->mutex]
Syzbot successfully bisected this to commit 82a763e61e2b ("ovl: simplify file splice").
Fix by reverting the write part of the above commit and by adding missing bits from ovl_write_iter() into ovl_splice_write().
--- fs/overlayfs/file.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
fs/overlayfs/file.c +46 -1
@@ -296,6 +296,51 @@ out_unlock:return ret; } +/* +* Calling iter_file_splice_write() directly from overlay's f_op may deadlock +* due to lock order inversion between pipe->mutex in iter_file_splice_write() +* and file_start_write(real.file) in ovl_write_iter(). +* +* So do everything ovl_write_iter() does and call iter_file_splice_write() on +* the real file. +*/ +static ssize_t ovl_splice_write (struct pipe_inode_info *pipe,struct file *out, +loff_t *ppos,size_t len,unsigned int flags) +{ +struct fd real; +const struct cred *old_cred; +struct inode *inode =file_inode (out); +struct inode *realinode =ovl_inode_real (inode); +ssize_t ret; + +inode_lock (inode); +/* Update mode */ +ovl_copyattr (realinode, inode); + ret =file_remove_privs (out); +if (ret) + goto out_unlock; + + ret =ovl_real_fdget (out, &real); +if (ret) + goto out_unlock; + + old_cred =ovl_override_creds (inode->i_sb); +file_start_write (real.file); + + ret =iter_file_splice_write (pipe, real.file, ppos, len, flags); + +file_end_write (real.file); +/* Update size */ +ovl_copyattr (realinode, inode); +revert_creds (old_cred); +fdput (real); + +out_unlock: +inode_unlock (inode); + +return ret; +} +static int ovl_fsync (struct file *file,loff_t start,loff_t end,int datasync) {struct fd real;
@@ -653,7 +698,7 @@ const struct file_operations ovl_file_op .unlocked_ioctl = ovl_ioctl, .compat_ioctl = ovl_compat_ioctl, .splice_read = generic_file_splice_read, - .splice_write = iter_file_splice_write, + .splice_write = ovl_splice_write, .copy_file_range = ovl_copy_file_range, .remap_file_range = ovl_remap_file_range,
Greg Kroah-Hartman
maintainerPATCH 345/355 powerpc/security: Add a helper to query stf_barrier type
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit 030905920f32e91a52794937f67434ac0b3ea41a
Add a helper to return the stf_barrier type for the current processor.
--- arch/powerpc/include/asm/security_features.h | 5 +++++ arch/powerpc/kernel/security.c | 5 +++++ 2 files changed, 10 insertions(+)
arch/powerpc/include/asm/security_features.h +5 -0
@@ -39,6 +39,11 @@ static inline bool security_ftr_enabled(return !!(powerpc_security_features & feature); } +#ifdef CONFIG_PPC_BOOK3S_64 +enum stf_barrier_type stf_barrier_type_get (void ); +#else +static inline enum stf_barrier_type stf_barrier_type_get (void ) {return STF_BARRIER_NONE ; } +#endif // Features indicating support for Spectre/Meltdown mitigations
arch/powerpc/kernel/security.c +5 -0
@@ -256,6 +256,11 @@ static int __init handle_no_stf_barrier(early_param ("no_stf_barrier" , handle_no_stf_barrier); +enum stf_barrier_type stf_barrier_type_get (void ) +{ +return stf_enabled_flush_types; +} +/* This is the generic flag used by other architectures */ static int __init handle_ssbd (char *p) {
Greg Kroah-Hartman
maintainerPATCH 340/355 9p/net: fix missing error check in p9_check_errors
In reply to Greg Kroah-HartmanFrom: Dominique Martinet <[email protected]>
commit 27eb4c3144f7a5ebef3c9a261d80cb3e1fa784dc upstream.
--- net/9p/client.c | 2 ++ 1 file changed, 2 insertions(+)
net/9p/client.c +2 -0
@@ -538,6 +538,8 @@ static int p9_check_errors(struct p9_clikfree (ename); }else { err =p9pdu_readf (&req->rc, c->proto_version,"d" , &ecode); +if (err) + goto out_err; err = -ecode;p9_debug (P9_DEBUG_9P ,"<<< RLERROR (%d)\n" , -ecode);
Greg Kroah-Hartman
maintainerPATCH 347/355 mm, oom: pagefault_out_of_memory: dont force global OOM for dying tasks
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
commit 0b28179a6138a5edd9d82ad2687c05b3773c387b upstream.
Patch series "memcg: prohibit unconditional exceeding the limit of dying tasks", v3.
Memory cgroup charging allows killed or exiting tasks to exceed the hard limit. It can be misused and allowed to trigger global OOM from inside a memcg-limited container. On the other hand if memcg fails allocation, called from inside #PF handler it triggers global OOM from inside pagefault_out_of_memory().
To prevent these problems this patchset:
(a) removes execution of out_of_memory() from pagefault_out_of_memory(), becasue nobody can explain why it is necessary.
(b) allow memcg to fail allocation of dying/killed tasks.
This patch (of 3):
Any allocation failure during the #PF path will return with VM_FAULT_OOM which in turn results in pagefault_out_of_memory which in turn executes out_out_memory() and can kill a random task.
An allocation might fail when the current task is the oom victim and there are no memory reserves left. The OOM killer is already handled at the page allocator level for the global OOM and at the charging level for the memcg one. Both have much more information about the scope of allocation/charge request. This means that either the OOM killer has been invoked properly and didn't lead to the allocation success or it has been skipped because it couldn't have been invoked. In both cases triggering it from here is pointless and even harmful.
It makes much more sense to let the killed task die rather than to wake up an eternally hungry oom-killer and send him to choose a fatter victim for breakfast.
--- mm/oom_kill.c | 3 +++ 1 file changed, 3 insertions(+)
mm/oom_kill.c +3 -0
@@ -1131,6 +1131,9 @@ void pagefault_out_of_memory(void)if (mem_cgroup_oom_synchronize (true))return ; +if (fatal_signal_pending (current)) +return ; +if (!mutex_trylock (&oom_lock))return ;out_of_memory (&oc);
Greg Kroah-Hartman
maintainerPATCH 346/355 powerpc/bpf: Emit stf barrier instruction sequences for BPF_NOSPEC
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit b7540d62509453263604a155bf2d5f0ed450cba2
Emit similar instruction sequences to commit a048a07d7f4535 ("powerpc/64s: Add support for a store forwarding barrier at kernel entry/exit") when encountering BPF_NOSPEC.
Mitigations are enabled depending on what the firmware advertises. In particular, we do not gate these mitigations based on current settings, just like in x86. Due to this, we don't need to take any action if mitigations are enabled or disabled at runtime.
[adjust macros to account for commits 0654186510a40e, 3a181237916310 and ef909ba954145e. adjust security feature checks to account for commit 84ed26fd00c514]
--- arch/powerpc/net/bpf_jit64.h | 8 ++--- arch/powerpc/net/bpf_jit_comp64.c | 56 +++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 8 deletions(-)
arch/powerpc/net/bpf_jit64.h +4 -4
@@ -16,18 +16,18 @@* with our redzone usage. * * [ prev sp ] <------------- -* [ nv gpr save area ] 6*8 | +* [ nv gpr save area ] 5*8 | * [ tail_call_cnt ] 8 | -* [ local_tmp_var ] 8 | +* [ local_tmp_var ] 16 | * fp (r31) --> [ ebpf stack space ] upto 512 | * [ frame header ] 32/112 | * sp (r1) ---> [ stack pointer ] -------------- */ /* for gpr non volatile registers BPG_REG_6 to 10 */ -#define BPF_PPC_STACK_SAVE (6*8) +#define BPF_PPC_STACK_SAVE (5*8)/* for bpf JIT code internal usage */ -#define BPF_PPC_STACK_LOCALS 16 +#define BPF_PPC_STACK_LOCALS 24/* stack frame excluding BPF stack, ensure this is quadword aligned */ #define BPF_PPC_STACKFRAME (STACK_FRAME_MIN_SIZE + \ BPF_PPC_STACK_LOCALS + BPF_PPC_STACK_SAVE)
arch/powerpc/net/bpf_jit_comp64.c +52 -4
96 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 355/355 SUNRPC: Partial revert of commit 6f9f17287e78
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit ea7a1019d8baf8503ecd6e3ec8436dec283569e6 upstream.
The premise of commit 6f9f17287e78 ("SUNRPC: Mitigate cond_resched() in xprt_transmit()") was that cond_resched() is expensive and unnecessary when there has been just a single send.
The point of cond_resched() is to ensure that tasks that should pre-empt this one get a chance to do so when it is safe to do so. The code prior to commit 6f9f17287e78 failed to take into account that it was keeping a rpc_task pinned for longer than it needed to, and so rather than doing a full revert, let's just move the cond_resched.
--- net/sunrpc/xprt.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
net/sunrpc/xprt.c +15 -13
@@ -1538,15 +1538,14 @@ xprt_transmit(struct rpc_task *task) {struct rpc_rqst *next, *req = task->tk_rqstp;struct rpc_xprt *xprt = req->rq_xprt; -int counter, status; +int status;spin_lock (&xprt->queue_lock); - counter =0 ; -while (!list_empty (&xprt->xmit_queue)) { -if (++counter ==20 ) +for (;;) { + next =list_first_entry_or_null (&xprt->xmit_queue, + struct rpc_rqst, rq_xmit); +if (!next)break ; - next =list_first_entry (&xprt->xmit_queue, - struct rpc_rqst, rq_xmit);xprt_pin_rqst (next);spin_unlock (&xprt->queue_lock); status =xprt_request_transmit (next, task);
@@ -1554,13 +1553,16 @@ xprt_transmit(struct rpc_task *task) status =0 ;spin_lock (&xprt->queue_lock);xprt_unpin_rqst (next); -if (status ==0 ) { -if (!xprt_request_data_received (task) || -test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) -continue ; - }else if (test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) - task->tk_status = status; -break ; +if (status <0 ) { +if (test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) + task->tk_status = status; +break ; + } +/* Was @task transmitted, and has it received a reply? */ +if (xprt_request_data_received (task) && + !test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) +break ; +cond_resched_lock (&xprt->queue_lock); }spin_unlock (&xprt->queue_lock); }
Greg Kroah-Hartman
maintainerPATCH 312/355 scsi: qla2xxx: Turn off target reset during issue_lip
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 0b7a9fd934a68ebfc1019811b7bdc1742072ad7b ]
When user uses issue_lip to do link bounce, driver sends additional target reset to remote device before resetting the link. The target reset would affect other paths with active I/Os. This patch will remove the unnecessary target reset.
--- drivers/scsi/qla2xxx/qla_gbl.h | 2 -- drivers/scsi/qla2xxx/qla_mr.c | 23 ----------------------- drivers/scsi/qla2xxx/qla_os.c | 27 ++------------------------- 3 files changed, 2 insertions(+), 50 deletions(-)
drivers/scsi/qla2xxx/qla_gbl.h +0 -2
@@ -156,7 +156,6 @@ extern int ql2xasynctmfenable;extern int ql2xgffidenable;extern int ql2xenabledif;extern int ql2xenablehba_err_chk; -extern int ql2xtargetreset;extern int ql2xdontresethba;extern uint64_t ql2xmaxlun;extern int ql2xmdcapmask;
@@ -770,7 +769,6 @@ extern void qlafx00_abort_iocb(srb_t *, struct abort_iocb_entry_fx00 *);extern void qlafx00_fxdisc_iocb (srb_t *,struct fxdisc_entry_fx00 *);extern void qlafx00_timer_routine (scsi_qla_host_t *);extern int qlafx00_rescan_isp (scsi_qla_host_t *); -extern int qlafx00_loop_reset (scsi_qla_host_t *vha);/* qla82xx related functions */
drivers/scsi/qla2xxx/qla_mr.c +0 -23
@@ -740,29 +740,6 @@ qlafx00_lun_reset(fc_port_t *fcport, uint64_t l, int tag)return qla2x00_async_tm_cmd (fcport,TCF_LUN_RESET , l, tag); } -int -qlafx00_loop_reset (scsi_qla_host_t *vha) -{ -int ret; -struct fc_port *fcport; -struct qla_hw_data *ha = vha->hw; - -if (ql2xtargetreset) { -list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->port_type !=FCT_TARGET ) -continue ; - - ret = ha->isp_ops->target_reset (fcport,0 ,0 ); -if (ret !=QLA_SUCCESS ) { -ql_dbg (ql_dbg_taskm, vha,0x803d , -"Bus Reset failed: Reset=%d " -"d_id=%x.\n" , ret, fcport->d_id.b24); - } - } - } -return QLA_SUCCESS ; -} -int qlafx00_iospace_config (struct qla_hw_data *ha) {
drivers/scsi/qla2xxx/qla_os.c +2 -25
@@ -191,12 +191,6 @@ MODULE_PARM_DESC(ql2xdbwr," 0 -- Regular doorbell.\n" " 1 -- CAMRAM doorbell (faster).\n"); -int ql2xtargetreset =1 ; -module_param (ql2xtargetreset, int,S_IRUGO ); -MODULE_PARM_DESC (ql2xtargetreset, -"Enable target reset." -"Default is 1 - use hw defaults." ); -int ql2xgffidenable;module_param (ql2xgffidenable, int,S_IRUGO ); MODULE_PARM_DESC(ql2xgffidenable,
@@ -1638,27 +1632,10 @@ int qla2x00_loop_reset(scsi_qla_host_t *vha) {int ret; -struct fc_port *fcport;struct qla_hw_data *ha = vha->hw; -if (IS_QLAFX00 (ha)) { -return qlafx00_loop_reset (vha); - } - -if (ql2xtargetreset ==1 && ha->flags.enable_target_reset) { -list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->port_type !=FCT_TARGET ) -continue ; - - ret = ha->isp_ops->target_reset (fcport,0 ,0 ); -if (ret !=QLA_SUCCESS ) { -ql_dbg (ql_dbg_taskm, vha,0x802c , -"Bus Reset failed: Reset=%d " -"d_id=%x.\n" , ret, fcport->d_id.b24); - } - } - } - +if (IS_QLAFX00 (ha)) +return QLA_SUCCESS ;if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE (ha)) {atomic_set (&vha->loop_state,LOOP_DOWN );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 354/355 PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 460275f124fb072dca218a6b43b6370eebbab20d upstream.
Define a macro PCI_EXP_DEVCTL_PAYLOAD_* for every possible Max Payload Size in linux/pci_regs.h, in the same style as PCI_EXP_DEVCTL_READRQ_*.
--- include/uapi/linux/pci_regs.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/uapi/linux/pci_regs.h +6 -0
@@ -502,6 +502,12 @@#define PCI_EXP_DEVCTL_URRE 0x0008/* Unsupported Request Reporting En. */ #define PCI_EXP_DEVCTL_RELAX_EN 0x0010/* Enable relaxed ordering */ #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0/* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000/* 128 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020/* 256 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040/* 512 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060/* 1024 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080/* 2048 Bytes */ +#define PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00a0/* 4096 Bytes */ #define PCI_EXP_DEVCTL_EXT_TAG 0x0100/* Extended Tag Field Enable */ #define PCI_EXP_DEVCTL_PHANTOM 0x0200/* Phantom Functions Enable */ #define PCI_EXP_DEVCTL_AUX_PME 0x0400/* Auxiliary Power PM Enable */
Greg Kroah-Hartman
maintainerPATCH 353/355 powerpc/powernv/prd: Unregister OPAL_MSG_PRD2 notifier during module unload
In reply to Greg Kroah-HartmanFrom: Vasant Hegde <[email protected]>
commit 52862ab33c5d97490f3fa345d6529829e6d6637b upstream.
Commit 587164cd, introduced new opal message type (OPAL_MSG_PRD2) and added opal notifier. But I missed to unregister the notifier during module unload path. This results in below call trace if you try to unload and load opal_prd module.
Also add new notifier_block for OPAL_MSG_PRD2 message.
Sample calltrace (modprobe -r opal_prd; modprobe opal_prd)
BUG: Unable to handle kernel data access on read at 0xc0080000192200e0
Faulting instruction address: 0xc00000000018d1cc
Oops: Kernel access of bad area, sig: 11 [#1]
LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV
CPU: 66 PID: 7446 Comm: modprobe Kdump: loaded Tainted: G E 5.14.0prd #759
NIP: c00000000018d1cc LR: c00000000018d2a8 CTR: c0000000000cde10
REGS: c0000003c4c0f0a0 TRAP: 0300 Tainted: G E (5.14.0prd)
MSR: 9000000002009033 <SF,HV,VEC,EE,ME,IR,DR,RI,LE> CR: 24224824 XER: 20040000
CFAR: c00000000018d2a4 DAR: c0080000192200e0 DSISR: 40000000 IRQMASK: 1
...
NIP notifier_chain_register+0x2c/0xc0
LR atomic_notifier_chain_register+0x48/0x80
Call Trace:
0xc000000002090610 (unreliable)
atomic_notifier_chain_register+0x58/0x80
opal_message_notifier_register+0x7c/0x1e0
opal_prd_probe+0x84/0x150 [opal_prd]
platform_probe+0x78/0x130
really_probe+0x110/0x5d0
__driver_probe_device+0x17c/0x230
driver_probe_device+0x60/0x130
__driver_attach+0xfc/0x220
bus_for_each_dev+0xa8/0x130
driver_attach+0x34/0x50
bus_add_driver+0x1b0/0x300
driver_register+0x98/0x1a0
__platform_driver_register+0x38/0x50
opal_prd_driver_init+0x34/0x50 [opal_prd]
do_one_initcall+0x60/0x2d0
do_init_module+0x7c/0x320
load_module+0x3394/0x3650
__do_sys_finit_module+0xd4/0x160
system_call_exception+0x140/0x290
system_call_common+0xf4/0x258--- arch/powerpc/platforms/powernv/opal-prd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/powerpc/platforms/powernv/opal-prd.c +11 -1
@@ -372,6 +372,12 @@ static struct notifier_block opal_prd_ev .priority = 0, }; +static struct notifier_block opal_prd_event_nb2 = { + .notifier_call = opal_prd_msg_notifier, + .next =NULL , + .priority =0 , +}; +static int opal_prd_probe (struct platform_device *pdev) {int rc;
@@ -393,9 +399,10 @@ static int opal_prd_probe(struct platforreturn rc; } - rc =opal_message_notifier_register (OPAL_MSG_PRD2 , &opal_prd_event_nb); + rc =opal_message_notifier_register (OPAL_MSG_PRD2 , &opal_prd_event_nb2);if (rc) {pr_err ("Couldn't register PRD2 event notifier\n" ); +opal_message_notifier_unregister (OPAL_MSG_PRD , &opal_prd_event_nb);return rc; }
@@ -404,6 +411,8 @@ static int opal_prd_probe(struct platforpr_err ("failed to register miscdev\n" );opal_message_notifier_unregister (OPAL_MSG_PRD , &opal_prd_event_nb); +opal_message_notifier_unregister (OPAL_MSG_PRD2 , + &opal_prd_event_nb2);return rc; }
@@ -414,6 +423,7 @@ static int opal_prd_remove(struct platfo {misc_deregister (&opal_prd_dev);opal_message_notifier_unregister (OPAL_MSG_PRD , &opal_prd_event_nb); +opal_message_notifier_unregister (OPAL_MSG_PRD2 , &opal_prd_event_nb2);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 352/355 s390/cio: make ccw_device_dma_* more robust
In reply to Greg Kroah-HartmanFrom: Halil Pasic <[email protected]>
commit ad9a14517263a16af040598c7920c09ca9670a31 upstream.
Since commit 48720ba56891 ("virtio/s390: use DMA memory for ccw I/O and classic notifiers") we were supposed to make sure that virtio_ccw_release_dev() completes before the ccw device and the attached dma pool are torn down, but unfortunately we did not. Before that commit it used to be OK to delay cleaning up the memory allocated by virtio-ccw indefinitely (which isn't really intuitive for guys used to destruction happens in reverse construction order), but now we trigger a BUG_ON if the genpool is destroyed before all memory allocated from it is deallocated. Which brings down the guest. We can observe this problem, when unregister_virtio_device() does not give up the last reference to the virtio_device (e.g. because a virtio-scsi attached scsi disk got removed without previously unmounting its previously mounted partition).
To make sure that the genpool is only destroyed after all the necessary freeing is done let us take a reference on the ccw device on each ccw_device_dma_zalloc() and give it up on each ccw_device_dma_free().
Actually there are multiple approaches to fixing the problem at hand that can work. The upside of this one is that it is the safest one while remaining simple. We don't crash the guest even if the driver does not pair allocations and frees. The downside is the reference counting overhead, that the reference counting for ccw devices becomes more complex, in a sense that we need to pair the calls to the aforementioned functions for it to be correct, and that if we happen to leak, we leak more than necessary (the whole ccw device instead of just the genpool).
Some alternatives to this approach are taking a reference in virtio_ccw_online() and giving it up in virtio_ccw_release_dev() or making sure virtio_ccw_release_dev() completes its work before virtio_ccw_remove() returns. The downside of these approaches is that these are less safe against programming errors.
--- drivers/s390/cio/device_ops.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/s390/cio/device_ops.c +11 -1
@@ -717,13 +717,23 @@ EXPORT_SYMBOL_GPL(ccw_device_get_schid);*/ void *ccw_device_dma_zalloc (struct ccw_device *cdev,size_t size) { -return cio_gp_dma_zalloc (cdev->private->dma_pool, &cdev->dev, size); +void *addr; + +if (!get_device (&cdev->dev)) +return NULL ; + addr =cio_gp_dma_zalloc (cdev->private->dma_pool, &cdev->dev, size); +if (IS_ERR_OR_NULL (addr)) +put_device (&cdev->dev); +return addr; }EXPORT_SYMBOL (ccw_device_dma_zalloc);void ccw_device_dma_free (struct ccw_device *cdev,void *cpu_addr,size_t size) { +if (!cpu_addr) +return ;cio_gp_dma_free (cdev->private->dma_pool, cpu_addr, size); +put_device (&cdev->dev); }EXPORT_SYMBOL (ccw_device_dma_free);
Greg Kroah-Hartman
maintainerPATCH 350/355 s390/cio: check the subchannel validity for dev_busid
In reply to Greg Kroah-HartmanFrom: Vineeth Vijayan <[email protected]>
commit a4751f157c194431fae9e9c493f456df8272b871 upstream.
Check the validity of subchanel before reading other fields in the schib.
--- drivers/s390/cio/css.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/css.c +2 -2
@@ -433,8 +433,8 @@ static ssize_t dev_busid_show(struct devstruct subchannel *sch =to_subchannel (dev);struct pmcw *pmcw = &sch->schib.pmcw; -if ((pmcw->st ==SUBCHANNEL_TYPE_IO || - pmcw->st ==SUBCHANNEL_TYPE_MSG ) && pmcw->dnv) +if ((pmcw->st ==SUBCHANNEL_TYPE_IO && pmcw->dnv) || + (pmcw->st ==SUBCHANNEL_TYPE_MSG && pmcw->w))return sysfs_emit (buf,"0.%x.%04x\n" , sch->schid.ssid, pmcw->dev);else
Greg Kroah-Hartman
maintainerPATCH 320/355 mm/zsmalloc.c: close race window between zs_pool_dec_isolated() and zs_unregister_migration()
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit afe8605ca45424629fdddfd85984b442c763dc47 ]
There is one possible race window between zs_pool_dec_isolated() and zs_unregister_migration() because wait_for_isolated_drain() checks the isolated count without holding class->lock and there is no order inside zs_pool_dec_isolated(). Thus the below race window could be possible:
zs_pool_dec_isolated zs_unregister_migration
check pool->destroying != 0
pool->destroying = true;
smp_mb();
wait_for_isolated_drain()
wait for pool->isolated_pages == 0
atomic_long_dec(&pool->isolated_pages);
atomic_long_read(&pool->isolated_pages) == 0Since we observe the pool->destroying (false) before atomic_long_dec() for pool->isolated_pages, waking pool->migration_wait up is missed.
Fix this by ensure checking pool->destroying happens after the atomic_long_dec(&pool->isolated_pages).
--- mm/zsmalloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/zsmalloc.c +4 -3
@@ -1835,10 +1835,11 @@ static inline void zs_pool_dec_isolated(struct zs_pool *pool)VM_BUG_ON (atomic_long_read (&pool->isolated_pages) <=0 );atomic_long_dec (&pool->isolated_pages);/* -* There's no possibility of racing, since wait_for_isolated_drain() -* checks the isolated count under &class->lock after enqueuing -* on migration_wait. +* Checking pool->destroying must happen after atomic_long_dec() +* for pool->isolated_pages above. Paired with the smp_mb() in +* zs_unregister_migration(). */ +smp_mb__after_atomic ();if (atomic_long_read (&pool->isolated_pages) ==0 && pool->destroying)wake_up_all (&pool->migration_wait); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 348/355 mm, oom: do not trigger out_of_memory from the #PF
In reply to Greg Kroah-HartmanFrom: Michal Hocko <[email protected]>
commit 60e2793d440a3ec95abb5d6d4fc034a4b480472d upstream.
Any allocation failure during the #PF path will return with VM_FAULT_OOM which in turn results in pagefault_out_of_memory. This can happen for 2 different reasons. a) Memcg is out of memory and we rely on mem_cgroup_oom_synchronize to perform the memcg OOM handling or b) normal allocation fails.
The latter is quite problematic because allocation paths already trigger out_of_memory and the page allocator tries really hard to not fail allocations. Anyway, if the OOM killer has been already invoked there is no reason to invoke it again from the #PF path. Especially when the OOM condition might be gone by that time and we have no way to find out other than allocate.
Moreover if the allocation failed and the OOM killer hasn't been invoked then we are unlikely to do the right thing from the #PF context because we have already lost the allocation context and restictions and therefore might oom kill a task from a different NUMA domain.
This all suggests that there is no legitimate reason to trigger out_of_memory from pagefault_out_of_memory so drop it. Just to be sure that no #PF path returns with VM_FAULT_OOM without allocation print a warning that this is happening before we restart the #PF.
[VvS: #PF allocation can hit into limit of cgroup v1 kmem controller. This is a local problem related to memcg, however, it causes unnecessary global OOM kills that are repeated over and over again and escalate into a real disaster. This has been broken since kmem accounting has been introduced for cgroup v1 (3.8). There was no kmem specific reclaim for the separate limit so the only way to handle kmem hard limit was to return with ENOMEM. In upstream the problem will be fixed by removing the outdated kmem limit, however stable and LTS kernels cannot do it and are still affected. This patch fixes the problem and should be backported into stable/LTS.]
--- mm/oom_kill.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
mm/oom_kill.c +8 -14
@@ -1114,19 +1114,15 @@ bool out_of_memory(struct oom_control *o }/* -* The pagefault handler calls here because it is out of memory, so kill a -* memory-hogging task. If oom_lock is held by somebody else, a parallel oom -* killing is already in progress so do nothing. +* The pagefault handler calls here because some allocation has failed. We have +* to take care of the memcg OOM here because this is the only safe context without +* any locks held but let the oom killer triggered from the allocation context care +* about the global OOM. */ void pagefault_out_of_memory (void ) { -struct oom_control oc = { - .zonelist =NULL , - .nodemask =NULL , - .memcg =NULL , - .gfp_mask =0 , - .order =0 , - }; + static DEFINE_RATELIMIT_STATE(pfoom_rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST);if (mem_cgroup_oom_synchronize (true))return ;
@@ -1134,8 +1130,6 @@ void pagefault_out_of_memory(void)if (fatal_signal_pending (current))return ; -if (!mutex_trylock (&oom_lock)) -return ; -out_of_memory (&oc); -mutex_unlock (&oom_lock); +if (__ratelimit (&pfoom_rs)) +pr_warn ("Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF\n" ); }
Greg Kroah-Hartman
maintainerPATCH 349/355 video: backlight: Drop maximum brightness override for brightness zero
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
commit 33a5471f8da976bf271a1ebbd6b9d163cb0cb6aa upstream.
The note in c2adda27d202f ("video: backlight: Add of_find_backlight helper in backlight.c") says that gpio-backlight uses brightness as power state. This has been fixed since in ec665b756e6f7 ("backlight: gpio-backlight:
Correct initial power state handling") and other backlight drivers do not require this workaround. Drop the workaround.
This fixes the case where e.g. pwm-backlight can perfectly well be set to brightness 0 on boot in DT, which without this patch leads to the display brightness to be max instead of off.
--- drivers/video/backlight/backlight.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/video/backlight/backlight.c +0 -6
@@ -630,12 +630,6 @@ struct backlight_device *of_find_backligof_node_put (np);if (!bd)return ERR_PTR (-EPROBE_DEFER ); -/* -* Note: gpio_backlight uses brightness as -* power state during probe -*/ -if (!bd->props.brightness) - bd->props.brightness = bd->props.max_brightness; } }
Greg Kroah-Hartman
maintainerPATCH 351/355 s390/tape: fix timer initialization in tape_std_assign()
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit 213fca9e23b59581c573d558aa477556f00b8198 upstream.
commit 9c6c273aa424 ("timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()") changed the timer setup from init_timer_on_stack(() to timer_setup(), but missed to change the mod_timer() call. And while at it, use msecs_to_jiffies() instead of the open coded timeout calculation.
--- drivers/s390/char/tape_std.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/char/tape_std.c +1 -2
@@ -53,7 +53,6 @@ int tape_std_assign(struct tape_device *device) {int rc; -struct timer_list timeout;struct tape_request *request; request =tape_alloc_request (2 ,11 );
@@ -70,7 +69,7 @@ tape_std_assign(struct tape_device *devi* So we set up a timeout for this call. */ timer_setup (&request->timer, tape_std_assign_timeout,0 ); -mod_timer (&timeout, jiffies +2 *HZ ); +mod_timer (&request->timer, jiffies +msecs_to_jiffies (2000 )); rc =tape_do_io_interruptible (device, request);
Greg Kroah-Hartman
maintainerPATCH 319/355 bonding: Fix a use-after-free problem when bond_sysfs_slave_add() failed
In reply to Greg Kroah-HartmanFrom: Huang Guobin <[email protected]>
[ Upstream commit b93c6a911a3fe926b00add28f3b932007827c4ca ]
When I do fuzz test for bonding device interface, I got the following use-after-free Calltrace:
==================================================================
BUG: KASAN: use-after-free in bond_enslave+0x1521/0x24f0
Read of size 8 at addr ffff88825bc11c00 by task ifenslave/7365
CPU: 5 PID: 7365 Comm: ifenslave Tainted: G E 5.15.0-rc1+ #13
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
Call Trace:
dump_stack_lvl+0x6c/0x8b
print_address_description.constprop.0+0x48/0x70
kasan_report.cold+0x82/0xdb
__asan_load8+0x69/0x90
bond_enslave+0x1521/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f19159cf577
Code: b3 66 90 48 8b 05 11 89 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 78
RSP: 002b:00007ffeb3083c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffeb3084bca RCX: 00007f19159cf577
RDX: 00007ffeb3083ce0 RSI: 0000000000008990 RDI: 0000000000000003
RBP: 00007ffeb3084bc4 R08: 0000000000000040 R09: 0000000000000000
R10: 00007ffeb3084bc0 R11: 0000000000000246 R12: 00007ffeb3083ce0
R13: 0000000000000000 R14: 0000000000000000 R15: 00007ffeb3083cb0
Allocated by task 7365:
kasan_save_stack+0x23/0x50
__kasan_kmalloc+0x83/0xa0
kmem_cache_alloc_trace+0x22e/0x470
bond_enslave+0x2e1/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
Freed by task 7365:
kasan_save_stack+0x23/0x50
kasan_set_track+0x20/0x30
kasan_set_free_info+0x24/0x40
__kasan_slab_free+0xf2/0x130
kfree+0xd1/0x5c0
slave_kobj_release+0x61/0x90
kobject_put+0x102/0x180
bond_sysfs_slave_add+0x7a/0xa0
bond_enslave+0x11b6/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
Last potentially related work creation:
kasan_save_stack+0x23/0x50
kasan_record_aux_stack+0xb7/0xd0
insert_work+0x43/0x190
__queue_work+0x2e3/0x970
delayed_work_timer_fn+0x3e/0x50
call_timer_fn+0x148/0x470
run_timer_softirq+0x8a8/0xc50
__do_softirq+0x107/0x55f
Second to last potentially related work creation:
kasan_save_stack+0x23/0x50
kasan_record_aux_stack+0xb7/0xd0
insert_work+0x43/0x190
__queue_work+0x2e3/0x970
__queue_delayed_work+0x130/0x180
queue_delayed_work_on+0xa7/0xb0
bond_enslave+0xe25/0x24f0
bond_do_ioctl+0x3e0/0x450
dev_ifsioc+0x2ba/0x970
dev_ioctl+0x112/0x710
sock_do_ioctl+0x118/0x1b0
sock_ioctl+0x2e0/0x490
__x64_sys_ioctl+0x118/0x150
do_syscall_64+0x35/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
The buggy address belongs to the object at ffff88825bc11c00
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 0 bytes inside of
1024-byte region [ffff88825bc11c00, ffff88825bc12000)
The buggy address belongs to the page:
page:ffffea00096f0400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25bc10
head:ffffea00096f0400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000010200 ffffea0009a71c08 ffff888240001968 ffff88810004dbc0
raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88825bc11b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88825bc11b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88825bc11c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88825bc11c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88825bc11d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================Put new_slave in bond_sysfs_slave_add() will cause use-after-free problems when new_slave is accessed in the subsequent error handling process. Since new_slave will be put in the subsequent error handling process, remove the unnecessary put to fix it.
In addition, when sysfs_create_file() fails, if some files have been crea- ted successfully, we need to call sysfs_remove_file() to remove them. Since there are sysfs_create_files() & sysfs_remove_files() can be used, use these two functions instead.
--- drivers/net/bonding/bond_sysfs_slave.c | 36 ++++++++------------------ 1 file changed, 11 insertions(+), 25 deletions(-)
drivers/net/bonding/bond_sysfs_slave.c +11 -25
@@ -108,15 +108,15 @@ static ssize_t ad_partner_oper_port_state_show(struct slave *slave, char *buf) }static SLAVE_ATTR_RO (ad_partner_oper_port_state); -static const struct slave_attribute *slave_attrs[] = { - &slave_attr_state, - &slave_attr_mii_status, - &slave_attr_link_failure_count, - &slave_attr_perm_hwaddr, - &slave_attr_queue_id, - &slave_attr_ad_aggregator_id, - &slave_attr_ad_actor_oper_port_state, - &slave_attr_ad_partner_oper_port_state, +static const struct attribute *slave_attrs[] = { + &slave_attr_state.attr, + &slave_attr_mii_status.attr, + &slave_attr_link_failure_count.attr, + &slave_attr_perm_hwaddr.attr, + &slave_attr_queue_id.attr, + &slave_attr_ad_aggregator_id.attr, + &slave_attr_ad_actor_oper_port_state.attr, + &slave_attr_ad_partner_oper_port_state.attr,NULL };
@@ -137,24 +137,10 @@ const struct sysfs_ops slave_sysfs_ops = {int bond_sysfs_slave_add (struct slave *slave) { -const struct slave_attribute **a; -int err; - -for (a = slave_attrs; *a; ++a) { - err =sysfs_create_file (&slave->kobj, &((*a)->attr)); -if (err) { -kobject_put (&slave->kobj); -return err; - } - } - -return 0 ; +return sysfs_create_files (&slave->kobj, slave_attrs); }void bond_sysfs_slave_del (struct slave *slave) { -const struct slave_attribute **a; - -for (a = slave_attrs; *a; ++a) -sysfs_remove_file (&slave->kobj, &((*a)->attr)); +sysfs_remove_files (&slave->kobj, slave_attrs); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 318/355 ACPI: PMIC: Fix intel_pmic_regs_handler() read accesses
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 009a789443fe4c8e6b1ecb7c16b4865c026184cd ]
The handling of PMIC register reads through writing 0 to address 4 of the OpRegion is wrong. Instead of returning the read value through the value64, which is a no-op for function == ACPI_WRITE calls, store the value and then on a subsequent function == ACPI_READ with address == 3 (the address for the value field of the OpRegion) return the stored value.
This has been tested on a Xiaomi Mi Pad 2 and makes the ACPI battery dev there mostly functional (unfortunately there are still other issues).
Here are the SET() / GET() functions of the PMIC ACPI device, which use this OpRegion, which clearly show the new behavior to be correct:
OperationRegion (REGS, 0x8F, Zero, 0x50)
Field (REGS, ByteAcc, NoLock, Preserve)
{
CLNT, 8,
SA, 8,
OFF, 8,
VAL, 8,
RWM, 8
}Method (GET, 3, Serialized)
{
If ((AVBE == One))
{
CLNT = Arg0
SA = Arg1
OFF = Arg2
RWM = Zero
If ((AVBG == One))
{
GPRW = Zero
}
}
Return (VAL) /* \_SB_.PCI0.I2C7.PMI5.VAL_ */
}Method (SET, 4, Serialized)
{
If ((AVBE == One))
{
CLNT = Arg0
SA = Arg1
OFF = Arg2
VAL = Arg3
RWM = One
If ((AVBG == One))
{
GPRW = One
}
}
}
--- drivers/acpi/pmic/intel_pmic.c | 51 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 23 deletions(-)
drivers/acpi/pmic/intel_pmic.c +28 -23
@@ -211,31 +211,36 @@ static acpi_status intel_pmic_regs_handler(u32 function, void *handler_context, void *region_context) { struct intel_pmic_opregion *opregion = region_context; -int result =0 ; +int result = -EINVAL ; + +if (function ==ACPI_WRITE ) { +switch (address) { +case 0 : +return AE_OK ; +case 1 : + opregion->ctx.addr |= (*value64 &0xff ) <<8 ; +return AE_OK ; +case 2 : + opregion->ctx.addr |= *value64 &0xff ; +return AE_OK ; +case 3 : + opregion->ctx.val = *value64 &0xff ; +return AE_OK ; +case 4 : +if (*value64) { + result =regmap_write (opregion->regmap, opregion->ctx.addr, + opregion->ctx.val); + }else { + result =regmap_read (opregion->regmap, opregion->ctx.addr, + &opregion->ctx.val); + } + opregion->ctx.addr =0 ; + } + } -switch (address) { -case 0 : -return AE_OK ; -case 1 : - opregion->ctx.addr |= (*value64 &0xff ) <<8 ; -return AE_OK ; -case 2 : - opregion->ctx.addr |= *value64 &0xff ; +if (function ==ACPI_READ && address ==3 ) { + *value64 = opregion->ctx.val;return AE_OK ; -case 3 : - opregion->ctx.val = *value64 &0xff ; -return AE_OK ; -case 4 : -if (*value64) { - result =regmap_write (opregion->regmap, opregion->ctx.addr, - opregion->ctx.val); - }else { - result =regmap_read (opregion->regmap, opregion->ctx.addr, - &opregion->ctx.val); -if (result ==0 ) - *value64 = opregion->ctx.val; - } -memset (&opregion->ctx,0x00 ,sizeof (opregion->ctx)); }if (result <0 ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 311/355 scsi: qla2xxx: Fix gnl list corruption
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit c98c5daaa24b583cba1369b7d167f93c6ae7299c ]
Current code does list element deletion and addition in and out of lock protection. This patch moves deletion behind lock.
list_add double add: new=ffff9130b5eb89f8, prev=ffff9130b5eb89f8,
next=ffff9130c6a715f0. ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:31! invalid opcode: 0000 [#1] SMP PTI CPU: 1 PID: 182395 Comm: kworker/1:37 Kdump: loaded Tainted: G W OE --------- - - 4.18.0-193.el8.x86_64 #1 Hardware name: HP ProLiant DL160 Gen8, BIOS J03 02/10/2014 Workqueue: qla2xxx_wq qla2x00_iocb_work_fn [qla2xxx] RIP: 0010:__list_add_valid+0x41/0x50 Code: 85 94 00 00 00 48 39 c7 74 0b 48 39 d7 74 06 b8 01 00 00 00 c3 48 89 f2 4c 89 c1 48 89 fe 48 c7 c7 60 83 ad 97 e8 4d bd ce ff <0f> 0b 0f 1f 00 66 2e 0f 1f 84 00 00 00 00 00 48 8b 07 48 8b 57 08 RSP: 0018:ffffaba306f47d68 EFLAGS: 00010046 RAX: 0000000000000058 RBX: ffff9130b5eb8800 RCX: 0000000000000006 RDX: 0000000000000000 RSI: 0000000000000096 RDI: ffff9130b7456a00 RBP: ffff9130c6a70a58 R08: 000000000008d7be R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000001 R12: ffff9130c6a715f0 R13: ffff9130b5eb8824 R14: ffff9130b5eb89f8 R15: ffff9130b5eb89f8 FS: 0000000000000000(0000) GS:ffff9130b7440000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efcaaef11a0 CR3: 000000005200a002 CR4: 00000000000606e0 Call Trace: qla24xx_async_gnl+0x113/0x3c0 [qla2xxx] ? qla2x00_iocb_work_fn+0x53/0x80 [qla2xxx] ? process_one_work+0x1a7/0x3b0 ? worker_thread+0x30/0x390 ? create_worker+0x1a0/0x1a0 ? kthread+0x112/0x130
--- drivers/scsi/qla2xxx/qla_init.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +1 -3
@@ -978,8 +978,6 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res) sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1 ], sp->u.iocb_cmd.u.mbx.in_mb[2]); -if (res ==QLA_FUNCTION_TIMEOUT ) -return ; sp->fcport->flags &= ~(FCF_ASYNC_SENT |FCF_ASYNC_ACTIVE );memset (&ea,0 ,sizeof (ea));
@@ -1017,8 +1015,8 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res)spin_unlock_irqrestore (&vha->hw->tgt.sess_lock, flags);list_for_each_entry_safe (fcport, tf, &h, gnl_entry) { -list_del_init (&fcport->gnl_entry);spin_lock_irqsave (&vha->hw->tgt.sess_lock, flags); +list_del_init (&fcport->gnl_entry); fcport->flags &= ~(FCF_ASYNC_SENT |FCF_ASYNC_ACTIVE );spin_unlock_irqrestore (&vha->hw->tgt.sess_lock, flags); ea.fcport = fcport;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 344/355 powerpc/bpf: Fix BPF_SUB when imm == 0x80000000
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit 5855c4c1f415ca3ba1046e77c0b3d3dfc96c9025
We aren't handling subtraction involving an immediate value of 0x80000000 properly. Fix the same.
--- arch/powerpc/net/bpf_jit_comp64.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
arch/powerpc/net/bpf_jit_comp64.c +17 -10
@@ -349,18 +349,25 @@ static int bpf_jit_build_body(struct bpfPPC_SUB (dst_reg, dst_reg, src_reg); goto bpf_alu32_trunc;case BPF_ALU |BPF_ADD |BPF_K :/* (u32) dst += (u32) imm */ -case BPF_ALU |BPF_SUB |BPF_K :/* (u32) dst -= (u32) imm */ case BPF_ALU64 |BPF_ADD |BPF_K :/* dst += imm */ +if (!imm) { + goto bpf_alu32_trunc; + }else if (imm >=-32768 && imm <32768 ) { +PPC_ADDI (dst_reg, dst_reg,IMM_L (imm)); + }else { +PPC_LI32 (b2p[TMP_REG_1 ], imm); +PPC_ADD (dst_reg, dst_reg, b2p[TMP_REG_1 ]); + } + goto bpf_alu32_trunc; +case BPF_ALU |BPF_SUB |BPF_K :/* (u32) dst -= (u32) imm */ case BPF_ALU64 |BPF_SUB |BPF_K :/* dst -= imm */ -if (BPF_OP (code) ==BPF_SUB ) - imm = -imm; -if (imm) { -if (imm >=-32768 && imm <32768 ) -PPC_ADDI (dst_reg, dst_reg,IMM_L (imm)); -else { -PPC_LI32 (b2p[TMP_REG_1 ], imm); -PPC_ADD (dst_reg, dst_reg, b2p[TMP_REG_1 ]); - } +if (!imm) { + goto bpf_alu32_trunc; + }else if (imm >-32768 && imm <=32768 ) { +PPC_ADDI (dst_reg, dst_reg,IMM_L (-imm)); + }else { +PPC_LI32 (b2p[TMP_REG_1 ], imm); +PPC_SUB (dst_reg, dst_reg, b2p[TMP_REG_1 ]); } goto bpf_alu32_trunc;case BPF_ALU |BPF_MUL |BPF_X :/* (u32) dst *= (u32) src */
Greg Kroah-Hartman
maintainerPATCH 316/355 net: davinci_emac: Fix interrupt pacing disable
In reply to Greg Kroah-HartmanFrom: Maxim Kiselev <[email protected]>
[ Upstream commit d52bcb47bdf971a59a2467975d2405fcfcb2fa19 ]
This patch allows to use 0 for coal->rx_coalesce_usecs param to disable rx irq coalescing.
Previously we could enable rx irq coalescing via ethtool (For ex: ethtool -C eth0 rx-usecs 2000) but we couldn't disable it because this part rejects 0 value:
if (!coal->rx_coalesce_usecs)
return -EINVAL;--- drivers/net/ethernet/ti/davinci_emac.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +14 -2
@@ -412,8 +412,20 @@ static int emac_set_coalesce(struct net_device *ndev,u32 int_ctrl, num_interrupts =0 ;u32 prescale =0 , addnl_dvdr =1 , coal_intvl =0 ; -if (!coal->rx_coalesce_usecs) -return -EINVAL ; +if (!coal->rx_coalesce_usecs) { + priv->coal_intvl =0 ; + +switch (priv->version) { +case EMAC_VERSION_2 : +emac_ctrl_write (EMAC_DM646X_CMINTCTRL ,0 ); +break ; +default : +emac_ctrl_write (EMAC_CTRL_EWINTTCNT ,0 ); +break ; + } + +return 0 ; + } coal_intvl = coal->rx_coalesce_usecs;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 315/355 xen-pciback: Fix return in pm_ctrl_init()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 4745ea2628bb43a7ec34b71763b5a56407b33990 ]
Return NULL instead of passing to ERR_PTR while err is zero, this fix smatch warnings:drivers/xen/xen-pciback/conf_space_capability.c:163
pm_ctrl_init() warn: passing zero to 'ERR_PTR'
--- drivers/xen/xen-pciback/conf_space_capability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-pciback/conf_space_capability.c +1 -1
@@ -160,7 +160,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset) } out: -return ERR_PTR (err); +return err ?ERR_PTR (err) :NULL ; }static const struct config_field caplist_pm[] = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 317/355 net: vlan: fix a UAF in vlan_dev_real_dev()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 563bcbae3ba233c275c244bfce2efe12938f5363 ]
The real_dev of a vlan net_device may be freed after unregister_vlan_dev(). Access the real_dev continually by vlan_dev_real_dev() will trigger the UAF problem for the real_dev like following:
==================================================================
BUG: KASAN: use-after-free in vlan_dev_real_dev+0xf9/0x120 Call Trace: kasan_report.cold+0x83/0xdf vlan_dev_real_dev+0xf9/0x120 is_eth_port_of_netdev_filter.part.0+0xb1/0x2c0 is_eth_port_of_netdev_filter+0x28/0x40 ib_enum_roce_netdev+0x1a3/0x300 ib_enum_all_roce_netdevs+0xc7/0x140 netdevice_event_work_handler+0x9d/0x210
...
Freed by task 9288: kasan_save_stack+0x1b/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x20/0x30 __kasan_slab_free+0xfc/0x130 slab_free_freelist_hook+0xdd/0x240 kfree+0xe4/0x690 kvfree+0x42/0x50 device_release+0x9f/0x240 kobject_put+0x1c8/0x530 put_device+0x1b/0x30 free_netdev+0x370/0x540 ppp_destroy_interface+0x313/0x3d0
...
Move the put_device(real_dev) to vlan_dev_free(). Ensure real_dev not be freed before vlan_dev unregistered.
--- net/8021q/vlan.c | 3 --- net/8021q/vlan_dev.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
net/8021q/vlan.c +0 -3
@@ -116,9 +116,6 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head) }vlan_vid_del (real_dev, vlan->vlan_proto, vlan_id); - -/* Get rid of the vlan's reference to real_dev */ -dev_put (real_dev); } int vlan_check_real_dev(struct net_device *real_dev,
net/8021q/vlan_dev.c +3 -0
@@ -790,6 +790,9 @@ static void vlan_dev_free(struct net_device *dev)free_percpu (vlan->vlan_pcpu_stats); vlan->vlan_pcpu_stats =NULL ; + +/* Get rid of the vlan's reference to real_dev */ +dev_put (vlan->real_dev); }void vlan_setup (struct net_device *dev)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 343/355 powerpc/bpf: Validate branch ranges
In reply to Greg Kroah-HartmanFrom: "Naveen N. Rao" <[email protected]>
upstream commit 3832ba4e283d7052b783dab8311df7e3590fed93
Add checks to ensure that we never emit branch instructions with truncated branch offsets.
--- arch/powerpc/net/bpf_jit.h | 26 ++++++++++++++++++++------ arch/powerpc/net/bpf_jit_comp64.c | 8 ++++++-- 2 files changed, 26 insertions(+), 8 deletions(-)
arch/powerpc/net/bpf_jit.h +20 -6
@@ -11,6 +11,7 @@#ifndef __ASSEMBLY__#include <asm/types.h> +#include <asm/code-patching.h> #ifdef PPC64_ELF_ABI_v1#define FUNCTION_DESCR_SIZE 24
@@ -180,13 +181,26 @@#define PPC_NEG (d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a))/* Long jump; (unconditional 'branch') */ -#define PPC_JMP (dest) EMIT(PPC_INST_BRANCH | \ - (((dest) - (ctx->idx * 4)) & 0x03fffffc)) +#define PPC_JMP (dest) \ + do { \ + long offset = (long)(dest) - (ctx->idx * 4); \ + if (!is_offset_in_branch_range(offset)) { \ + pr_err_ratelimited("Branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \ + return -ERANGE; \ + } \ + EMIT(PPC_INST_BRANCH | (offset & 0x03fffffc)); \ + } while (0)/* "cond" here covers BO:BI fields. */ -#define PPC_BCC_SHORT (cond, dest) EMIT(PPC_INST_BRANCH_COND | \ - (((cond) & 0x3ff) << 16) | \ - (((dest) - (ctx->idx * 4)) & \ - 0xfffc)) +#define PPC_BCC_SHORT (cond, dest) \ + do { \ + long offset = (long)(dest) - (ctx->idx * 4); \ + if (!is_offset_in_cond_branch_range(offset)) { \ + pr_err_ratelimited("Conditional branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \ + return -ERANGE; \ + } \ + EMIT(PPC_INST_BRANCH_COND | (((cond) & 0x3ff) << 16) | (offset & 0xfffc)); \ + } while (0) +/* Sign-extended 32-bit immediate load */ #define PPC_LI32 (d, i) do { \ if ((int)(uintptr_t)(i) >= -32768 && \
arch/powerpc/net/bpf_jit_comp64.c +6 -2
@@ -224,7 +224,7 @@ static void bpf_jit_emit_func_call_rel(uPPC_BLRL (); } -static void bpf_jit_emit_tail_call (u32 *image,struct codegen_context *ctx,u32 out) +static int bpf_jit_emit_tail_call (u32 *image,struct codegen_context *ctx,u32 out) {/* * By now, the eBPF program has already setup parameters in r3, r4 and r5
@@ -285,7 +285,9 @@ static void bpf_jit_emit_tail_call(u32 *bpf_jit_emit_common_epilogue (image, ctx);PPC_BCTR (); +/* out: */ +return 0 ; }/* Assemble the body code between the prologue & epilogue */
@@ -1001,7 +1003,9 @@ cond_branch:*/ case BPF_JMP |BPF_TAIL_CALL : ctx->seen |=SEEN_TAILCALL ; -bpf_jit_emit_tail_call (image, ctx, addrs[i +1 ]); + ret =bpf_jit_emit_tail_call (image, ctx, addrs[i +1 ]); +if (ret <0 ) +return ret;break ;default :
Re: [PATCH 5.4 063/355] powerpc/kvm: Fix kvm_use_magic_page
In reply to Greg Kroah-HartmanGreg,
Quoted 7 lines · Greg Kroah-Hartman
From: Andreas Gruenbacher <[email protected]>
commit
0c8eb2884a42d992c7726539328b7d3568f22143upstream.When switching from
__get_usertofault_in_pages_readable, commit9f9eae5ce717brokekvm_use_magic_page: like__get_user,fault_in_pages_readablereturns 0 on success.
I've not heard back from the maintainers about this patch so far, so it would probably be safer to leave it out of stable for now.
Thanks,
Andreas
Quoted 21 lines
Fixes 9f9eae5ce717 ("powerpc/kvm: Prefer fault_in_pages_readable function")Cc [email protected] # v4.18+Signed-off-by Andreas Gruenbacher <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/powerpc/kernel/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/kernel/kvm.c +1
-1@@ -669,7 +669,7 @@ static void __init kvm_use_magic_page(voon_each_cpu (kvm_map_magic_page, &features,1 );/* Quick self-test to see if the mapping works */ -if (!fault_in_pages_readable ((const char *)KVM_MAGIC_PAGE ,sizeof (u32))) { +if (fault_in_pages_readable ((const char *)KVM_MAGIC_PAGE ,sizeof (u32))) { kvm_patching_worked = false;return ; }
Greg Kroah-Hartman
maintainerPATCH 213/355 crypto: qat - detect PFVF collision after ACK
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 9b768e8a3909ac1ab39ed44a3933716da7761a6f ]
Detect a PFVF collision between the local and the remote function by checking if the message on the PFVF CSR has been overwritten. This is done after the remote function confirms that the message has been received, by clearing the interrupt bit, or the maximum number of attempts (ADF_IOV_MSG_ACK_MAX_RETRY) to check the CSR has been exceeded.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +7 -0
@@ -195,6 +195,13 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) val =ADF_CSR_RD (pmisc_bar_addr, pf2vf_offset); }while ((val & int_bit) && (count++ <ADF_IOV_MSG_ACK_MAX_RETRY )); +if (val != msg) { +dev_dbg (&GET_DEV (accel_dev), +"Collision - PFVF CSR overwritten by remote function\n" ); + ret = -EIO ; + goto out; + } +if (val & int_bit) {dev_dbg (&GET_DEV (accel_dev),"ACK not received from remote\n" ); val &= ~int_bit;
Signature · 1 line
2.33.0
Re: [PATCH 5.4 169/355] net: dsa: lantiq_gswip: serialize access to the PCE table
In reply to Greg Kroah-HartmanQuoted 118 lines · Greg Kroah-Hartman
From: Vladimir Oltean <[email protected]>
[ Upstream commit
49753a75b9a32de4c0393bb8d1e51ea223fda8e4]Looking at the code, the GSWIP switch appears to hold bridging service structures (VLANs, FDBs, forwarding rules) in PCE table entries. Hardware access to the PCE table is non-atomic, and is comprised of several register reads and writes.
These accesses are currently serialized by the
rtnl_lock, but DSA is changing its driver API and that lock will no longer be held when calling ->port_fdb_add() and ->port_fdb_del().So this driver needs to serialize the access to the PCE table using its own locking scheme. This patch adds that.
Signed-off-by Vladimir Oltean <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Acked-by Hauke Mehrtens <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/net/dsa/lantiq_gswip.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)drivers/net/dsa/lantiq_gswip.c +23
-5@@ -274,6 +274,7 @@ struct gswip_priv {int num_gphy_fw;struct gswip_gphy_fw *gphy_fw;u32 port_vlan_filter; +struct mutex pce_table_lock; };struct gswip_pce_table_entry {@@ -521,10 +522,14 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSRD :GSWIP_PCE_TBL_CTRL_OPMOD_ADRD ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |@@ -534,8 +539,10 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }for (i =0 ; i <ARRAY_SIZE (tbl->key); i++) tbl->key[i] =gswip_switch_r (priv,GSWIP_PCE_TBL_KEY (i));@@ -551,6 +558,8 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, tbl->valid = !!(crtl &GSWIP_PCE_TBL_CTRL_VLD ); tbl->gmap = (crtl &GSWIP_PCE_TBL_CTRL_GMAP_MASK ) >>7 ; +mutex_unlock (&priv->pce_table_lock); +return 0 ; }@@ -563,10 +572,14 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSWR :GSWIP_PCE_TBL_CTRL_OPMOD_ADWR ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |@@ -598,8 +611,12 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv, crtl |=GSWIP_PCE_TBL_CTRL_BAS ;gswip_switch_w (priv, crtl,GSWIP_PCE_TBL_CTRL ); -return gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , -GSWIP_PCE_TBL_CTRL_BAS ); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , +GSWIP_PCE_TBL_CTRL_BAS ); + +mutex_unlock (&priv->pce_table_lock); + +return err; }/* Add the LAN port into a bridge with the CPU port by @@ -2020,6 +2037,7 @@ static int gswip_probe(struct platform_device *pdev) priv->ds->priv = priv; priv->ds->ops = &gswip_switch_ops; priv->dev = dev; +mutex_init (&priv->pce_table_lock); version =gswip_switch_r (priv,GSWIP_VERSION );/* bring up the mdio bus */ Signature · 1 line
2.33.0
As discussed on the v5.14 backport, this patch can be dropped. Same thing for the 5.10 version of the backport.
Sasha Levin
maintainerRe: [PATCH 5.4 063/355] powerpc/kvm: Fix kvm_use_magic_page
In reply to Andreas GruenbacherQuoted 6 lines · Andreas Gruenbacher
Greg,
Quoted 2 lines · Greg Kroah-Hartman
From: Andreas Gruenbacher <[email protected]>
Quoted 8 lines
Quoted 5 lines
commit
0c8eb2884a42d992c7726539328b7d3568f22143upstream.When switching from
__get_usertofault_in_pages_readable, commit9f9eae5ce717brokekvm_use_magic_page: like__get_user,fault_in_pages_readablereturns 0 on success.I've not heard back from the maintainers about this patch so far, so it would probably be safer to leave it out of stable for now.
What do you mean exactly? It's upstream.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerRe: [PATCH 5.4 043/355] reset: tegra-bpmp: Handle errors in BPMP response
In reply to Mikko PerttunenQuoted 10 lines · Mikko Perttunen
Quoted 9 lines · Greg Kroah-Hartman
From: Mikko Perttunen <[email protected]>
[ Upstream commit
c045ceb5a145d2a9a4bf33cbc55185ddf99f60ab]The return value from
tegra_bpmp_transferindicates the success or failure of the IPC transaction with BPMP. If the transaction succeeded, we also need to check the actual command's result code. Add code to do this.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Mikko Perttunen <[email protected]>Signed-off-by Philipp Zabel <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
...Can we drop this patch from all stable trees. A revert has been submitted by Jon Hunter -- the reason is that the tegra-hda driver has a (harmless) bug that was previously masked, but with this patch causes the driver to fail to probe.
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.160 release. There are 355 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Nov 2021 16:52:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.160-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Perf build broken due to following errors.
Quoted 2 lines
Andrii Nakryiko <[email protected]>
libbpf: Fix BTF data layout checks and allow empty BTF
In file included from btf.c:17:btf.c: In function 'btf_parse_hdr':
btf.c:104:62: error: 'struct btf' has no member named 'raw_size'; did you mean 'data_size'?
104 | pr_debug("Invalid BTF total size:%u\n", btf->raw_size);
| ^~~~~~~~
Build log:
https://builds.tuxbuild.com/20xsgAxLwf4E60xl2dTdXnNS8FZ/
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.160 release. There are 355 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Nov 2021 16:52:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.160-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Tested on arm64 and x86 for 5.4.160-rc1,
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-5.4.y
Version: 5.4.160-rc1
Commit: f365aef38d8d52a2a8290c32251df98437038572
Compiler: gcc version 7.3.0 (GCC)
arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 9016
passed: 9016
failed: 0
timeout: 0
--------------------------------------------------------------------
x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 9016
passed: 9016
failed: 0
timeout: 0
--------------------------------------------------------------------
Greg Kroah-Hartman
maintainerPATCH 314/355 i2c: xlr: Fix a resource leak in the error handling path of xlr_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 7f98960c046ee1136e7096aee168eda03aef8a5d ]
A successful 'clk_prepare()' call should be balanced by a corresponding 'clk_unprepare()' call in the error handling path of the probe, as already done in the remove function.
More specifically, 'clk_prepare_enable()' is used, but 'clk_disable()' is also already called. So just the unprepare step has still to be done.
Update the error handling path accordingly.
--- drivers/i2c/busses/i2c-xlr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-xlr.c +5 -1
@@ -433,11 +433,15 @@ static int xlr_i2c_probe(struct platform_device *pdev)i2c_set_adapdata (&priv->adap, priv); ret =i2c_add_numbered_adapter (&priv->adap);if (ret <0 ) -return ret; + goto err_unprepare_clk;platform_set_drvdata (pdev, priv);dev_info (&priv->adap.dev,"Added I2C Bus.\n" );return 0 ; + +err_unprepare_clk: +clk_unprepare (clk); +return ret; }static int xlr_i2c_remove (struct platform_device *pdev)
Signature · 1 line
2.33.0