5.10.231-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 271/459 um: vector: Do not use drvdata in release
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
commit 51b39d741970742a5c41136241a9c48ac607cf82 upstream.
The drvdata is not available in release. Let's just use container_of() to get the vector_device instance. Otherwise, removing a vector device will result in a crash:
RIP: 0033:vector_device_release+0xf/0x50 RSP: 00000000e187bc40 EFLAGS: 00010202 RAX: 0000000060028f61 RBX: 00000000600f1baf RCX: 00000000620074e0 RDX: 000000006220b9c0 RSI: 0000000060551c80 RDI: 0000000000000000 RBP: 00000000e187bc50 R08: 00000000603ad594 R09: 00000000e187bb70 R10: 000000000000135a R11: 00000000603ad422 R12: 00000000623ae028 R13: 000000006287a200 R14: 0000000062006d30 R15: 00000000623700b6 Kernel panic - not syncing: Segfault with no mm CPU: 0 UID: 0 PID: 16 Comm: kworker/0:1 Not tainted 6.12.0-rc6-g59b723cd2adb #1 Workqueue: events mc_work_proc Stack: 60028f61 623ae028 e187bc80 60276fcd 6220b9c0 603f5820 623ae028 00000000 e187bcb0 603a2bcd 623ae000 62370010 Call Trace: [<60028f61>] ? vector_device_release+0x0/0x50 [<60276fcd>] device_release+0x70/0xba [<603a2bcd>] kobject_put+0xba/0xe7 [<60277265>] put_device+0x19/0x1c [<60281266>] platform_device_put+0x26/0x29 [<60281e5f>] platform_device_unregister+0x2c/0x2e [<60029422>] vector_remove+0x52/0x58 [<60031316>] ? mconsole_reply+0x0/0x50 [<600310c8>] mconsole_remove+0x160/0x1cc [<603b19f4>] ? strlen+0x0/0x15 [<60066611>] ? __dequeue_entity+0x1a9/0x206 [<600666a7>] ? set_next_entity+0x39/0x63 [<6006666e>] ? set_next_entity+0x0/0x63 [<60038fa6>] ? um_set_signals+0x0/0x43 [<6003070c>] mc_work_proc+0x77/0x91 [<60057664>] process_scheduled_works+0x1b3/0x2dd [<60055f32>] ? assign_work+0x0/0x58 [<60057f0a>] worker_thread+0x1e9/0x293 [<6005406f>] ? set_pf_worker+0x0/0x64 [<6005d65d>] ? arch_local_irq_save+0x0/0x2d [<6005d748>] ? kthread_exit+0x0/0x3a [<60057d21>] ? worker_thread+0x0/0x293 [<6005dbf1>] kthread+0x126/0x12b [<600219c5>] new_thread_handler+0x85/0xb6
--- arch/um/drivers/vector_kern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/drivers/vector_kern.c +2 -1
@@ -827,7 +827,8 @@ static struct platform_driver uml_net_drstatic void vector_device_release (struct device *dev) { -struct vector_device *device =dev_get_drvdata (dev); +struct vector_device *device = + container_of(dev, struct vector_device, pdev.dev);struct net_device *netdev = device->dev;list_del (&device->list);
Greg Kroah-Hartman
maintainerPATCH 272/459 sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 3c891f7c6a4e90bb1199497552f24b26e46383bc upstream.
When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS are selected, cpu_max_bits_warn() generates a runtime warning similar as below when showing /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs.
[ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]---
--- arch/sh/kernel/cpu/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/cpu/proc.c +1 -1
@@ -132,7 +132,7 @@ static int show_cpuinfo(struct seq_filestatic void *c_start (struct seq_file *m,loff_t *pos) { -return *pos <NR_CPUS ? cpu_data + *pos :NULL ; +return *pos < nr_cpu_ids ? cpu_data + *pos :NULL ; }static void *c_next (struct seq_file *m,void *v,loff_t *pos) {
Greg Kroah-Hartman
maintainerPATCH 273/459 arm64: tls: Fix context-switching of tpidrro_el0 when kpti is enabled
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 67ab51cbdfee02ef07fb9d7d14cc0bf6cb5a5e5c upstream.
Commit 18011eac28c7 ("arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks") tried to optimise the context switching of tpidrro_el0 by eliding the clearing of the register when switching to a native task with kpti enabled, on the erroneous assumption that the kpti trampoline entry code would already have taken care of the write.
Although the kpti trampoline does zero the register on entry from a native task, the check in tls_thread_switch() is on the *next* task and so we can end up leaving a stale, non-zero value in the register if the previous task was 32-bit.
Drop the broken optimisation and zero tpidrro_el0 unconditionally when switching to a native 64-bit task.
--- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/process.c +1 -1
@@ -455,7 +455,7 @@ static void tls_thread_switch(struct tasif (is_compat_thread (task_thread_info (next)))write_sysreg (next->thread.uw.tp_value, tpidrro_el0); -else if (!arm64_kernel_unmapped_at_el0 ()) +else write_sysreg (0 , tpidrro_el0);write_sysreg (*task_user_tls (next), tpidr_el0);
Greg Kroah-Hartman
maintainerPATCH 274/459 block: fix ordering between checking BLK_MQ_S_STOPPED request adding
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muchun Song <[email protected]>
commit 96a9fe64bfd486ebeeacf1e6011801ffe89dae18 upstream.
Supposing first scenario with a virtio_blk driver.
CPU0 CPU1
blk_mq_try_issue_directly()
__blk_mq_issue_directly()
q->mq_ops->queue_rq()
virtio_queue_rq()
blk_mq_stop_hw_queue()
virtblk_done()
blk_mq_request_bypass_insert() 1) store
blk_mq_start_stopped_hw_queue()
clear_bit(BLK_MQ_S_STOPPED) 3) store
blk_mq_run_hw_queue()
if (!blk_mq_hctx_has_pending()) 4) load
return
blk_mq_sched_dispatch_requests()
blk_mq_run_hw_queue()
if (!blk_mq_hctx_has_pending())
return
blk_mq_sched_dispatch_requests()
if (blk_mq_hctx_stopped()) 2) load
return
__blk_mq_sched_dispatch_requests()Supposing another scenario.
CPU0 CPU1
blk_mq_requeue_work()
blk_mq_insert_request() 1) store
virtblk_done()
blk_mq_start_stopped_hw_queue()
blk_mq_run_hw_queues() clear_bit(BLK_MQ_S_STOPPED) 3) store
blk_mq_run_hw_queue()
if (!blk_mq_hctx_has_pending()) 4) load
return
blk_mq_sched_dispatch_requests()
if (blk_mq_hctx_stopped()) 2) load
continue
blk_mq_run_hw_queue()Both scenarios are similar, the full memory barrier should be inserted between 1) and 2), as well as between 3) and 4) to make sure that either CPU0 sees BLK_MQ_S_STOPPED is cleared or CPU1 sees dispatch list. Otherwise, either CPU will not rerun the hardware queue causing starvation of the request.
The easy way to fix it is to add the essential full memory barrier into helper of blk_mq_hctx_stopped(). In order to not affect the fast path (hardware queue is not stopped most of the time), we only insert the barrier into the slow path. Actually, only slow path needs to care about missing of dispatching the request to the low-level device driver.
--- block/blk-mq.c | 6 ++++++ block/blk-mq.h | 13 +++++++++++++ 2 files changed, 19 insertions(+)
block/blk-mq.c +6 -0
@@ -1787,6 +1787,12 @@ void blk_mq_start_stopped_hw_queue(strucreturn ;clear_bit (BLK_MQ_S_STOPPED , &hctx->state); +/* +* Pairs with the smp_mb() in blk_mq_hctx_stopped() to order the +* clearing of BLK_MQ_S_STOPPED above and the checking of dispatch +* list in the subsequent routine. +*/ +smp_mb__after_atomic ();blk_mq_run_hw_queue (hctx, async); }EXPORT_SYMBOL_GPL (blk_mq_start_stopped_hw_queue);
block/blk-mq.h +13 -0
@@ -175,6 +175,19 @@ static inline struct blk_mq_tags *blk_mqstatic inline bool blk_mq_hctx_stopped (struct blk_mq_hw_ctx *hctx) { +/* Fast path: hardware queue is not stopped most of the time. */ +if (likely (!test_bit (BLK_MQ_S_STOPPED , &hctx->state))) +return false; + +/* +* This barrier is used to order adding of dispatch list before and +* the test of BLK_MQ_S_STOPPED below. Pairs with the memory barrier +* in blk_mq_start_stopped_hw_queue() so that dispatch code could +* either see BLK_MQ_S_STOPPED is cleared or dispatch list is not +* empty to avoid missing dispatching requests. +*/ +smp_mb (); +return test_bit (BLK_MQ_S_STOPPED , &hctx->state); }
Greg Kroah-Hartman
maintainerPATCH 275/459 HID: wacom: Interpret tilt data from Intuos Pro BT as signed values
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
commit 49a397ad24ee5e2c53a59dada2780d7e71bd3f77 upstream.
The tilt data contained in the Bluetooth packets of an Intuos Pro are supposed to be interpreted as signed values. Simply casting the values to type char is not guaranteed to work since it is implementation- defined whether it is signed or unsigned. At least one user has noticed the data being reported incorrectly on their system. To ensure that the data is interpreted properly, we specifically cast to signed char instead.
--- drivers/hid/wacom_wac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/wacom_wac.c +2 -2
@@ -1394,9 +1394,9 @@ static void wacom_intuos_pro2_bt_pen(str rotation -=1800 ;input_report_abs (pen_input,ABS_TILT_X , - (char )frame[7 ]); + (signed char )frame[7 ]);input_report_abs (pen_input,ABS_TILT_Y , - (char )frame[8 ]); + (signed char )frame[8 ]);input_report_abs (pen_input,ABS_Z , rotation);input_report_abs (pen_input,ABS_WHEEL ,get_unaligned_le16 (&frame[11 ]));
Greg Kroah-Hartman
maintainerPATCH 276/459 media: wl128x: Fix atomicity violation in fmc_send_cmd()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiu-ji Chen <[email protected]>
commit ca59f9956d4519ab18ab2270be47c6b8c6ced091 upstream.
Atomicity violation occurs when the fmc_send_cmd() function is executed simultaneously with the modification of the fmdev->resp_skb value. Consider a scenario where, after passing the validity check within the function, a non-null fmdev->resp_skb variable is assigned a null value. This results in an invalid fmdev->resp_skb variable passing the validity check. As seen in the later part of the function, skb = fmdev->resp_skb; when the invalid fmdev->resp_skb passes the check, a null pointer dereference error may occur at line 478, evt_hdr = (void *)skb->data;
To address this issue, it is recommended to include the validity check of fmdev->resp_skb within the locked section of the function. This modification ensures that the value of fmdev->resp_skb does not change during the validation process, thereby maintaining its validity.
This possible bug is found by an experimental static analysis tool developed by our team. This tool analyzes the locking APIs to extract function pairs that can be concurrently executed, and then analyzes the instructions in the paired functions to identify possible concurrency bugs including data races and atomicity violations.
--- drivers/media/radio/wl128x/fmdrv_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/radio/wl128x/fmdrv_common.c +2 -1
@@ -465,11 +465,12 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 jiffies_to_msecs(FM_DRV_TX_TIMEOUT) / 1000);return -ETIMEDOUT ; } +spin_lock_irqsave (&fmdev->resp_skb_lock, flags);if (!fmdev->resp_skb) { +spin_unlock_irqrestore (&fmdev->resp_skb_lock, flags);fmerr ("Response SKB is missing\n" );return -EFAULT ; } -spin_lock_irqsave (&fmdev->resp_skb_lock, flags); skb = fmdev->resp_skb; fmdev->resp_skb =NULL ;spin_unlock_irqrestore (&fmdev->resp_skb_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 277/459 media: v4l2-core: v4l2-dv-timings: check cvt/gtf result
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 9f070b1862f3411b8bcdfd51a8eaad25286f9deb upstream.
The v4l2_detect_cvt/gtf functions should check the result against the timing capabilities: these functions calculate the timings, so if they are out of bounds, they should be rejected.
To do this, add the struct v4l2_dv_timings_cap as argument to those functions.
This required updates to the adv7604 and adv7842 drivers since the prototype of these functions has now changed. The timings struct that is passed to v4l2_detect_cvt/gtf in those two drivers is filled with the timings detected by the hardware.
The vivid driver was also updated, but an additional check was added:
the width and height specified by VIDIOC_S_DV_TIMINGS has to match the calculated result, otherwise something went wrong. Note that vivid *emulates* hardware, so all the values passed to the v4l2_detect_cvt/gtf functions came from the timings struct that was filled by userspace and passed on to the driver via VIDIOC_S_DV_TIMINGS. So these fields can contain random data. Both the constraints check via struct v4l2_dv_timings_cap and the additional width/height check ensure that the resulting timings are sane and not messed up by the v4l2_detect_cvt/gtf calculations.
--- drivers/media/i2c/adv7604.c | 5 drivers/media/i2c/adv7842.c | 13 +- drivers/media/test-drivers/vivid/vivid-vid-cap.c | 15 ++ drivers/media/v4l2-core/v4l2-dv-timings.c | 132 ++++++++++++----------- include/media/v4l2-dv-timings.h | 18 ++- 5 files changed, 107 insertions(+), 76 deletions(-)
drivers/media/i2c/adv7604.c +3 -2
@@ -1391,12 +1391,13 @@ static int stdi2dv_timings(struct v4l2_sif (v4l2_detect_cvt (stdi->lcf +1 , hfreq, stdi->lcvs,0 , (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, timings)) + false,adv76xx_get_dv_timings_cap (sd,-1 ), timings))return 0 ;if (v4l2_detect_gtf (stdi->lcf +1 , hfreq, stdi->lcvs, (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, state->aspect_ratio, timings)) + false, state->aspect_ratio, +adv76xx_get_dv_timings_cap (sd,-1 ), timings))return 0 ; v4l2_dbg(2, debug, sd,
drivers/media/i2c/adv7842.c +7 -6
@@ -1443,14 +1443,15 @@ static int stdi2dv_timings(struct v4l2_s }if (v4l2_detect_cvt (stdi->lcf +1 , hfreq, stdi->lcvs,0 , - (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | - (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, timings)) + (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | + (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), + false,adv7842_get_dv_timings_cap (sd), timings))return 0 ;if (v4l2_detect_gtf (stdi->lcf +1 , hfreq, stdi->lcvs, - (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | - (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, state->aspect_ratio, timings)) + (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | + (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), + false, state->aspect_ratio, +adv7842_get_dv_timings_cap (sd), timings))return 0 ; v4l2_dbg(2, debug, sd,
drivers/media/test-drivers/vivid/vivid-vid-cap.c +13 -2
@@ -1711,12 +1711,19 @@ static bool valid_cvt_gtf_timings(struct h_freq = (u32 )bt->pixelclock / total_h_pixel;if (bt->standards ==0 || (bt->standards &V4L2_DV_BT_STD_CVT )) { +struct v4l2_dv_timings cvt = {}; +if (v4l2_detect_cvt (total_v_lines, h_freq, bt->vsync, bt->width, - bt->polarities, bt->interlaced, timings)) + bt->polarities, bt->interlaced, + &vivid_dv_timings_cap, &cvt) && + cvt.bt.width == bt->width && cvt.bt.height == bt->height) { + *timings = cvt;return true; + } }if (bt->standards ==0 || (bt->standards &V4L2_DV_BT_STD_GTF )) { +struct v4l2_dv_timings gtf = {};struct v4l2_fract aspect_ratio; find_aspect_ratio(bt->width, bt->height,
@@ -1724,8 +1731,12 @@ static bool valid_cvt_gtf_timings(struct &aspect_ratio.denominator);if (v4l2_detect_gtf (total_v_lines, h_freq, bt->vsync, bt->polarities, bt->interlaced, - aspect_ratio, timings)) + aspect_ratio, &vivid_dv_timings_cap, + >f) && + gtf.bt.width == bt->width && gtf.bt.height == bt->height) { + *timings = gtf;return true; + } }return false; }
drivers/media/v4l2-core/v4l2-dv-timings.c +72 -60
191 lines not on this page · raw message
include/media/v4l2-dv-timings.h +12 -6
@@ -146,15 +146,18 @@ void v4l2_print_dv_timings(const char *d* @polarities: the horizontal and vertical polarities (same as struct * v4l2_bt_timings polarities). * @interlaced: if this flag is true, it indicates interlaced format +* @cap: the v4l2_dv_timings_cap capabilities. * @fmt: the resulting timings. * * This function will attempt to detect if the given values correspond to a * valid CVT format. If so, then it will return true, and fmt will be filled * in with the found CVT timings. */ -bool v4l2_detect_cvt (unsigned frame_height,unsigned hfreq,unsigned vsync, -unsigned active_width,u32 polarities,bool interlaced, -struct v4l2_dv_timings *fmt); +bool v4l2_detect_cvt (unsigned int frame_height,unsigned int hfreq, +unsigned int vsync,unsigned int active_width, +u32 polarities,bool interlaced, +const struct v4l2_dv_timings_cap *cap, +struct v4l2_dv_timings *fmt);/** * v4l2_detect_gtf - detect if the given timings follow the GTF standard
@@ -170,15 +173,18 @@ bool v4l2_detect_cvt(unsigned frame_heig* image height, so it has to be passed explicitly. Usually * the native screen aspect ratio is used for this. If it * is not filled in correctly, then 16:9 will be assumed. +* @cap: the v4l2_dv_timings_cap capabilities. * @fmt: the resulting timings. * * This function will attempt to detect if the given values correspond to a * valid GTF format. If so, then it will return true, and fmt will be filled * in with the found GTF timings. */ -bool v4l2_detect_gtf (unsigned frame_height,unsigned hfreq,unsigned vsync, -u32 polarities,bool interlaced,struct v4l2_fract aspect, -struct v4l2_dv_timings *fmt); +bool v4l2_detect_gtf (unsigned int frame_height,unsigned int hfreq, +unsigned int vsync,u32 polarities,bool interlaced, +struct v4l2_fract aspect, +const struct v4l2_dv_timings_cap *cap, +struct v4l2_dv_timings *fmt);/** * v4l2_calc_aspect_ratio - calculate the aspect ratio based on bytes
Greg Kroah-Hartman
maintainerPATCH 278/459 ALSA: hda/realtek: Update ALC225 depop procedure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 1fd50509fe14a9adc9329e0454b986157a4c155a upstream.
Old procedure has a chance to meet Headphone no output.
--- sound/pci/hda/patch_realtek.c | 95 +++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 52 deletions(-)
sound/pci/hda/patch_realtek.c +43 -52
@@ -3691,33 +3691,28 @@ static void alc225_init(struct hda_codec hp1_pin_sense =snd_hda_jack_detect (codec, hp_pin); hp2_pin_sense =snd_hda_jack_detect (codec,0x16 ); -if (hp1_pin_sense || hp2_pin_sense) +if (hp1_pin_sense || hp2_pin_sense) {msleep (2 ); +alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x1 );/* Low power */ -alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x1 );/* Low power */ +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +msleep (75 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (85 ); - -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (100 ); - -alc_update_coef_idx (codec,0x4a ,3 <<10 ,0 ); -alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x4 );/* Hight power */ +msleep (75 ); +alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x4 );/* Hight power */ + } }static void alc225_shutup (struct hda_codec *codec)
@@ -3729,36 +3724,35 @@ static void alc225_shutup(struct hda_codif (!hp_pin) hp_pin =0x21 ; -alc_disable_headset_jack_key (codec); -/* 3k pull low control for Headset jack. */ -alc_update_coef_idx (codec,0x4a ,0 ,3 <<10 ); - hp1_pin_sense =snd_hda_jack_detect (codec, hp_pin); hp2_pin_sense =snd_hda_jack_detect (codec,0x16 ); -if (hp1_pin_sense || hp2_pin_sense) +if (hp1_pin_sense || hp2_pin_sense) { +alc_disable_headset_jack_key (codec); +/* 3k pull low control for Headset jack. */ +alc_update_coef_idx (codec,0x4a ,0 ,3 <<10 );msleep (2 ); -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (85 ); - -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (100 ); - +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); + +msleep (75 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); + +msleep (75 ); +alc_update_coef_idx (codec,0x4a ,3 <<10 ,0 ); +alc_enable_headset_jack_key (codec); + }alc_auto_setup_eapd (codec, false);alc_shutup_pins (codec);if (spec->ultra_low_power) {
@@ -3769,9 +3763,6 @@ static void alc225_shutup(struct hda_codalc_update_coef_idx (codec,0x4a ,3 <<4 ,2 <<4 );msleep (30 ); } - -alc_update_coef_idx (codec,0x4a ,3 <<10 ,0 ); -alc_enable_headset_jack_key (codec); }static void alc_default_init (struct hda_codec *codec)
Greg Kroah-Hartman
maintainerPATCH 279/459 ALSA: hda/realtek: Set PCBeep to default value for ALC274
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 155699ccab7c78cbba69798242b68bc8ac66d5d2 upstream.
BIOS Enable PC beep path cause pop noise via speaker during boot time. Set to default value from driver will solve the issue.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -464,6 +464,8 @@ static void alc_fill_eapd_coef(struct hdbreak ;case 0x10ec0234 :case 0x10ec0274 : +alc_write_coef_idx (codec,0x6e ,0x0c25 ); + fallthrough;case 0x10ec0294 :case 0x10ec0700 :case 0x10ec0701 :
Greg Kroah-Hartman
maintainerPATCH 280/459 ALSA: hda/realtek: Fix Internal Speaker and Mic boost of Infinix Y4 Max
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dinesh Kumar <[email protected]>
commit 5ebe792a5139f1ce6e4aed22bef12e7e2660df96 upstream.
Internal Speaker of Infinix Y4 Max remains muted due to incorrect Pin configuration, and the Internal Mic records high noise. This patch corrects the Pin configuration for the Internal Speaker and limits the Internal Mic boost.
HW Probe for device: https://linux-hardware.org/?probe=6d4386c347
Test: Internal Speaker works fine, Mic has low noise.
--- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/pci/hda/patch_realtek.c +11 -0
@@ -6869,6 +6869,7 @@ enum {ALC269_FIXUP_THINKPAD_ACPI ,ALC269_FIXUP_DMIC_THINKPAD_ACPI ,ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13 , +ALC269VC_FIXUP_INFINIX_Y4_MAX ,ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO ,ALC255_FIXUP_ACER_MIC_NO_PRESENCE , ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
@@ -7180,6 +7181,15 @@ static const struct hda_fixup alc269_fix .chained = true, .chain_id =ALC269_FIXUP_LIMIT_INT_MIC_BOOST }, + [ALC269VC_FIXUP_INFINIX_Y4_MAX] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x1b ,0x90170150 },/* use as internal speaker */ + { } + }, + .chained = true, + .chain_id =ALC269_FIXUP_LIMIT_INT_MIC_BOOST + }, [ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -9453,6 +9463,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x2782 ,0x0214 ,"VAIO VJFE-CL" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x2782 ,0x0228 ,"Infinix ZERO BOOK 13" ,ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13 ),SND_PCI_QUIRK (0x2782 ,0x0232 ,"CHUWI CoreBook XPro" ,ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO ), +SND_PCI_QUIRK (0x2782 ,0x1701 ,"Infinix Y4 Max" ,ALC269VC_FIXUP_INFINIX_Y4_MAX ),SND_PCI_QUIRK (0x2782 ,0x1707 ,"Vaio VJFE-ADL" ,ALC298_FIXUP_SPK_VOLUME ),SND_PCI_QUIRK (0x8086 ,0x2074 ,"Intel NUC 8" ,ALC233_FIXUP_INTEL_NUC8_DMIC ), SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Greg Kroah-Hartman
maintainerPATCH 281/459 ALSA: hda/realtek: Apply quirk for Medion E15433
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit ca0f79f0286046f6a91c099dc941cf7afae198d6 upstream.
Medion E15433 laptop wich ALC269VC (SSID 2782:1705) needs the same workaround for the missing speaker as another model.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9464,6 +9464,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x2782 ,0x0228 ,"Infinix ZERO BOOK 13" ,ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13 ),SND_PCI_QUIRK (0x2782 ,0x0232 ,"CHUWI CoreBook XPro" ,ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO ),SND_PCI_QUIRK (0x2782 ,0x1701 ,"Infinix Y4 Max" ,ALC269VC_FIXUP_INFINIX_Y4_MAX ), +SND_PCI_QUIRK (0x2782 ,0x1705 ,"MEDION E15433" ,ALC269VC_FIXUP_INFINIX_Y4_MAX ),SND_PCI_QUIRK (0x2782 ,0x1707 ,"Vaio VJFE-ADL" ,ALC298_FIXUP_SPK_VOLUME ),SND_PCI_QUIRK (0x8086 ,0x2074 ,"Intel NUC 8" ,ALC233_FIXUP_INTEL_NUC8_DMIC ), SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Greg Kroah-Hartman
maintainerPATCH 282/459 usb: dwc3: gadget: Fix checking for number of TRBs left
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 02a6982b0ccfcdc39e20016f5fc9a1b7826a6ee7 upstream.
The check whether the TRB ring is full or empty in dwc3_calc_trbs_left() is insufficient. It assumes there are active TRBs if there's any request in the started_list. However, that's not the case for requests with a large SG list.
That is, if we have a single usb request that requires more TRBs than the total TRBs in the TRB ring, the queued TRBs will be available when all the TRBs in the ring are completed. But the request is only partially completed and remains in the started_list. With the current logic, the TRB ring is empty, but dwc3_calc_trbs_left() returns 0.
Fix this by additionally checking for the request->num_trbs for active TRB count.
--- drivers/usb/dwc3/gadget.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/dwc3/gadget.c +6 -3
@@ -953,11 +953,14 @@ static u32 dwc3_calc_trbs_left(struct dw* pending to be processed by the driver. */ if (dep->trb_enqueue == dep->trb_dequeue) { +struct dwc3_request *req; +/* -* If there is any request remained in the started_list at -* this point, that means there is no TRB available. +* If there is any request remained in the started_list with +* active TRBs at this point, then there is no TRB available. */ -if (!list_empty (&dep->started_list)) + req =next_request (&dep->started_list); +if (req && req->num_trbs)return 0 ;return DWC3_TRB_NUM -1 ;
Greg Kroah-Hartman
maintainerPATCH 283/459 usb: dwc3: gadget: Fix looping of queued SG entries
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit b7fc65f5141c24785dc8c19249ca4efcf71b3524 upstream.
The dwc3_request->num_queued_sgs is decremented on completion. If a partially completed request is handled, then the dwc3_request->num_queued_sgs no longer reflects the total number of num_queued_sgs (it would be cleared).
Correctly check the number of request SG entries remained to be prepare and queued. Failure to do this may cause null pointer dereference when accessing non-existent SG entry.
--- drivers/usb/dwc3/gadget.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/gadget.c +3 -3
@@ -1188,8 +1188,8 @@ static int dwc3_prepare_trbs_sg(struct dstruct scatterlist *s;int i;unsigned int length = req->request.length; -unsigned int remaining = req->request.num_mapped_sgs - - req->num_queued_sgs; +unsigned int remaining = req->num_pending_sgs; +unsigned int num_queued_sgs = req->request.num_mapped_sgs - remaining;unsigned int num_trbs = req->num_trbs;bool needs_extra_trb =dwc3_needs_extra_trb (dep, req);
@@ -1197,7 +1197,7 @@ static int dwc3_prepare_trbs_sg(struct d* If we resume preparing the request, then get the remaining length of * the request and resume where we left off. */ -for_each_sg (req->request.sg, s, req->num_queued_sgs, i) +for_each_sg (req->request.sg, s, num_queued_sgs, i) length -=sg_dma_len (s);for_each_sg (sg, s, remaining, i) {
Greg Kroah-Hartman
maintainerPATCH 284/459 lib: string_helpers: silence snprintf() output truncation warning
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit a508ef4b1dcc82227edc594ffae583874dd425d7 upstream.
The output of ".%03u" with the unsigned int in range [0, 4294966295] may get truncated if the target buffer is not 12 bytes. This can't really happen here as the 'remainder' variable cannot exceed 999 but the compiler doesn't know it. To make it happy just increase the buffer to where the warning goes away.
--- lib/string_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/string_helpers.c +1 -1
@@ -51,7 +51,7 @@ void string_get_size(u64 size, u64 blk_sstatic const unsigned int rounding[] = {500 ,50 ,5 };int i =0 , j;u32 remainder =0 , sf_cap; -char tmp[8 ]; +char tmp[12 ];const char *unit; tmp[0 ] ='\0' ;
Greg Kroah-Hartman
maintainerPATCH 285/459 NFSD: Prevent a potential integer overflow
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 7f33b92e5b18e904a481e6e208486da43e4dc841 upstream.
If the tag length is >= U32_MAX - 3 then the "length + 4" addition can result in an integer overflow. Address this by splitting the decoding into several steps so that decode_cb_compound4res() does not have to perform arithmetic on the unsafe length value.
--- fs/nfsd/nfs4callback.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/nfsd/nfs4callback.c +7 -7
@@ -297,17 +297,17 @@ static int decode_cb_compound4res(structu32 length;__be32 *p; - p =xdr_inline_decode (xdr,4 +4 ); + p =xdr_inline_decode (xdr,XDR_UNIT );if (unlikely (p ==NULL )) goto out_overflow; - hdr->status =be32_to_cpup (p++); + hdr->status =be32_to_cpup (p);/* Ignore the tag */ - length =be32_to_cpup (p++); - p =xdr_inline_decode (xdr, length +4 ); -if (unlikely (p ==NULL )) +if (xdr_stream_decode_u32 (xdr, &length) <0 ) + goto out_overflow; +if (xdr_inline_decode (xdr, length) ==NULL ) + goto out_overflow; +if (xdr_stream_decode_u32 (xdr, &hdr->nops) <0 ) goto out_overflow; - p +=XDR_QUADLEN (length); - hdr->nops =be32_to_cpup (p);return 0 ; out_overflow:return -EIO ;
Greg Kroah-Hartman
maintainerPATCH 286/459 SUNRPC: make sure cache entry active before cache_show
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
commit 2862eee078a4d2d1f584e7f24fa50dddfa5f3471 upstream.
The function c_show was called with protection from RCU. This only ensures that cp will not be freed. Therefore, the reference count for cp can drop to zero, which will trigger a refcount use-after-free warning when cache_get is called. To resolve this issue, use cache_get_rcu to ensure that cp remains active.
------------[ cut here ]------------ refcount_t: addition on 0; use-after-free. WARNING: CPU: 7 PID: 822 at lib/refcount.c:25 refcount_warn_saturate+0xb1/0x120 CPU: 7 UID: 0 PID: 822 Comm: cat Not tainted 6.12.0-rc3+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:refcount_warn_saturate+0xb1/0x120 Call Trace: <TASK> c_show+0x2fc/0x380 [sunrpc] seq_read_iter+0x589/0x770 seq_read+0x1e5/0x270 proc_reg_read+0xe1/0x140 vfs_read+0x125/0x530 ksys_read+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/sunrpc/cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/cache.c +3 -1
@@ -1434,7 +1434,9 @@ static int c_show(struct seq_file *m, voseq_printf (m,"# expiry=%lld refcnt=%d flags=%lx\n" ,convert_to_wallclock (cp->expiry_time),kref_read (&cp->ref), cp->flags); -cache_get (cp); +if (!cache_get_rcu (cp)) +return 0 ; +if (cache_check (cd, cp,NULL ))/* cache_check does a cache_put on failure */ seq_puts (m,"# " );
Greg Kroah-Hartman
maintainerPATCH 287/459 rpmsg: glink: Propagate TX failures in intentless mode as well
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
commit 7a68f9fa97357a0f2073c9c31ed4101da4fce93e upstream.
As support for splitting transmission over several messages using TX_DATA_CONT was introduced it does not immediately return the return value of qcom_glink_tx().
The result is that in the intentless case (i.e. intent == NULL), the code will continue to send all additional chunks. This is wasteful, and it's possible that the send operation could incorrectly indicate success, if the last chunk fits in the TX fifo.
Fix the condition.
--- drivers/rpmsg/qcom_glink_native.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/rpmsg/qcom_glink_native.c +6 -4
@@ -1355,8 +1355,9 @@ static int __qcom_glink_send(struct glin ret =qcom_glink_tx (glink, &req,sizeof (req), data, chunk_size, wait);/* Mark intent available if we failed */ -if (ret && intent) { - intent->in_use = false; +if (ret) { +if (intent) + intent->in_use = false;return ret; }
@@ -1377,8 +1378,9 @@ static int __qcom_glink_send(struct glin chunk_size, wait);/* Mark intent available if we failed */ -if (ret && intent) { - intent->in_use = false; +if (ret) { +if (intent) + intent->in_use = false;break ; } }
Greg Kroah-Hartman
maintainerPATCH 288/459 um: Fix potential integer overflow during physmem setup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit a98b7761f697e590ed5d610d87fa12be66f23419 ]
This issue happens when the real map size is greater than LONG_MAX, which can be easily triggered on UML/i386.
--- arch/um/kernel/physmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/um/kernel/physmem.c +3 -3
@@ -80,10 +80,10 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, unsigned long len, unsigned long long highmem) {unsigned long reserve = reserve_end - start; -long map_size = len - reserve; +unsigned long map_size = len - reserve;int err; -if (map_size <=0 ) { +if (len <= reserve) {os_warn ("Too few physical memory! Needed=%lu, given=%lu\n" , reserve, len);exit (1 );
@@ -94,7 +94,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, err =os_map_memory ((void *) reserve_end, physmem_fd, reserve, map_size,1 ,1 ,1 );if (err <0 ) { -os_warn ("setup_physmem - mapping %ld bytes of memory at 0x%p " +os_warn ("setup_physmem - mapping %lu bytes of memory at 0x%p " "failed - errno = %d\n" , map_size, (void *) reserve_end, err);exit (1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 289/459 um: Fix the return value of elf_core_copy_task_fpregs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 865e3845eeaa21e9a62abc1361644e67124f1ec0 ]
This function is expected to return a boolean value, which should be true on success and false on failure.
--- arch/um/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/kernel/process.c +1 -1
@@ -406,6 +406,6 @@ int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu) {int cpu =current_thread_info ()->cpu; -return save_i387_registers (userspace_pid[cpu], (unsigned long *) fpu); +return save_i387_registers (userspace_pid[cpu], (unsigned long *) fpu) ==0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 290/459 um: Always dump trace for specified task in show_stack
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 0f659ff362eac69777c4c191b7e5ccb19d76c67d ]
Currently, show_stack() always dumps the trace of the current task. However, it should dump the trace of the specified task if one is provided. Otherwise, things like running "echo t > sysrq-trigger" won't work as expected.
--- arch/um/kernel/sysrq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/kernel/sysrq.c +1 -1
@@ -52,5 +52,5 @@ void show_stack(struct task_struct *task, unsigned long *stack, }printk ("%sCall Trace:\n" , loglvl); -dump_trace (current, &stackops, (void *)loglvl); +dump_trace (task ?: current, &stackops, (void *)loglvl); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 291/459 NFSv4.0: Fix a use-after-free problem in the asynchronous open()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 2fdb05dc0931250574f0cb0ebeb5ed8e20f4a889 ]
Yang Erkun reports that when two threads are opening files at the same time, and are forced to abort before a reply is seen, then the call to nfs_release_seqid() in nfs4_opendata_free() can result in a use-after-free of the pointer to the defunct rpc task of the other thread.
The fix is to ensure that if the RPC call is aborted before the call to nfs_wait_on_sequence() is complete, then we must call nfs_release_seqid() in nfs4_open_release() before the rpc_task is freed.
--- fs/nfs/nfs4proc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +5 -3
@@ -2518,12 +2518,14 @@ static void nfs4_open_release(void *calldata)struct nfs4_opendata *data = calldata;struct nfs4_state *state =NULL ; +/* In case of error, no cleanup! */ +if (data->rpc_status !=0 || !data->rpc_done) { +nfs_release_seqid (data->o_arg.seqid); + goto out_free; + }/* If this request hasn't been cancelled, do nothing */ if (!data->cancelled) goto out_free; -/* In case of error, no cleanup! */ -if (data->rpc_status !=0 || !data->rpc_done) - goto out_free;/* In case we need an open_confirm, no cleanup! */ if (data->o_res.rflags &NFS4_OPEN_RESULT_CONFIRM ) goto out_free;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 292/459 rtc: st-lpc: Use IRQF_NO_AUTOEN flag in request_irq()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit b6cd7adec0cf03f0aefc55676e71dd721cbc71a8 ]
If request_irq() fails in st_rtc_probe(), there is no need to enable the irq, and if it succeeds, disable_irq() after request_irq() still has a time gap in which interrupts can come.
request_irq() with IRQF_NO_AUTOEN flag will disable IRQ auto-enable when request IRQ.
--- drivers/rtc/rtc-st-lpc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/rtc/rtc-st-lpc.c +2 -3
@@ -218,15 +218,14 @@ static int st_rtc_probe(struct platform_device *pdev)return -EINVAL ; } - ret =devm_request_irq (&pdev->dev, rtc->irq, st_rtc_handler,0 , - pdev->name, rtc); + ret =devm_request_irq (&pdev->dev, rtc->irq, st_rtc_handler, +IRQF_NO_AUTOEN , pdev->name, rtc);if (ret) {dev_err (&pdev->dev,"Failed to request irq %i\n" , rtc->irq);return ret; }enable_irq_wake (rtc->irq); -disable_irq (rtc->irq); rtc->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (rtc->clk)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 293/459 rtc: abx80x: Fix WDT bit position of the status register
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nobuhiro Iwamatsu <[email protected]>
[ Upstream commit 10e078b273ee7a2b8b4f05a64ac458f5e652d18d ]
The WDT bit in the status register is 5, not 6. This fixes from 6 to 5.
--- drivers/rtc/rtc-abx80x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-abx80x.c +1 -1
@@ -37,7 +37,7 @@#define ABX8XX_REG_STATUS 0x0f#define ABX8XX_STATUS_AF BIT(2)#define ABX8XX_STATUS_BLF BIT(4) -#define ABX8XX_STATUS_WDT BIT(6) +#define ABX8XX_STATUS_WDT BIT(5)#define ABX8XX_REG_CTRL1 0x10#define ABX8XX_CTRL_WRITE BIT(0)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 294/459 rtc: check if __rtc_read_time was successful in rtc_timer_do_work()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongliang Gao <[email protected]>
[ Upstream commit e8ba8a2bc4f60a1065f23d6a0e7cbea945a0f40d ]
If the __rtc_read_time call fails,, the struct rtc_time tm; may contain uninitialized data, or an illegal date/time read from the RTC hardware.
When calling rtc_tm_to_ktime later, the result may be a very large value (possibly KTIME_MAX). If there are periodic timers in rtc->timerqueue, they will continually expire, may causing kernel softlockup.
--- drivers/rtc/interface.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/rtc/interface.c +6 -1
@@ -907,13 +907,18 @@ void rtc_timer_do_work(struct work_struct *work)struct timerqueue_node *next;ktime_t now;struct rtc_time tm; +int err;struct rtc_device *rtc = container_of(work, struct rtc_device, irqwork);mutex_lock (&rtc->ops_lock); again: -__rtc_read_time (rtc, &tm); + err =__rtc_read_time (rtc, &tm); +if (err) { +mutex_unlock (&rtc->ops_lock); +return ; + } now =rtc_tm_to_ktime (tm);while ((next =timerqueue_getnext (&rtc->timerqueue))) {if (next->expires > now)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 295/459 ubifs: Correct the total block count by deducting journal reservation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhihao Cheng <[email protected]>
[ Upstream commit 84a2bee9c49769310efa19601157ef50a1df1267 ]
Since commit e874dcde1cbf ("ubifs: Reserve one leb for each journal head while doing budget"), available space is calulated by deducting reservation for all journal heads. However, the total block count ( which is only used by statfs) is not updated yet, which will cause the wrong displaying for used space(total - available). Fix it by deducting reservation for all journal heads from total block count.
--- fs/ubifs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ubifs/super.c +3 -3
@@ -777,10 +777,10 @@ static void init_constants_master(struct ubifs_info *c)* necessary to report something for the 'statfs()' call. * * Subtract the LEB reserved for GC, the LEB which is reserved for -* deletions, minimum LEBs for the index, and assume only one journal -* head is available. +* deletions, minimum LEBs for the index, the LEBs which are reserved +* for each journal head. */ - tmp64 = c->main_lebs -1 -1 -MIN_INDEX_LEBS - c->jhead_cnt +1 ; + tmp64 = c->main_lebs -1 -1 -MIN_INDEX_LEBS - c->jhead_cnt; tmp64 *= (long long )c->leb_size - c->leb_overhead; tmp64 =ubifs_reported_space (c, tmp64); c->block_cnt = tmp64 >>UBIFS_BLOCK_SHIFT ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 296/459 ubi: fastmap: Fix duplicate slab cache names while attaching
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhihao Cheng <[email protected]>
[ Upstream commit bcddf52b7a17adcebc768d26f4e27cf79adb424c ]
Since commit 4c39529663b9 ("slab: Warn on duplicate cache names when DEBUG_VM=y"), the duplicate slab cache names can be detected and a kernel WARNING is thrown out.
In UBI fast attaching process, alloc_ai() could be invoked twice with the same slab cache name 'ubi_aeb_slab_cache', which will trigger following warning messages:
kmem_cache of name 'ubi_aeb_slab_cache' already exists
WARNING: CPU: 0 PID: 7519 at mm/slab_common.c:107
__kmem_cache_create_args+0x100/0x5f0
Modules linked in: ubi(+) nandsim [last unloaded: nandsim]
CPU: 0 UID: 0 PID: 7519 Comm: modprobe Tainted: G 6.12.0-rc2
RIP: 0010:__kmem_cache_create_args+0x100/0x5f0
Call Trace:
__kmem_cache_create_args+0x100/0x5f0
alloc_ai+0x295/0x3f0 [ubi]
ubi_attach+0x3c3/0xcc0 [ubi]
ubi_attach_mtd_dev+0x17cf/0x3fa0 [ubi]
ubi_init+0x3fb/0x800 [ubi]
do_init_module+0x265/0x7d0
__x64_sys_finit_module+0x7a/0xc0The problem could be easily reproduced by loading UBI device by fastmap with CONFIG_DEBUG_VM=y.
Fix it by using different slab names for alloc_ai() callers.
--- drivers/mtd/ubi/attach.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/mtd/ubi/attach.c +6 -6
@@ -1447,7 +1447,7 @@ static int scan_all(struct ubi_device *ubi, struct ubi_attach_info *ai,return err; } -static struct ubi_attach_info *alloc_ai (void ) +static struct ubi_attach_info *alloc_ai (const char *slab_name) {struct ubi_attach_info *ai;
@@ -1461,7 +1461,7 @@ static struct ubi_attach_info *alloc_ai(void)INIT_LIST_HEAD (&ai->alien);INIT_LIST_HEAD (&ai->fastmap); ai->volumes =RB_ROOT ; - ai->aeb_slab_cache =kmem_cache_create ("ubi_aeb_slab_cache" , + ai->aeb_slab_cache =kmem_cache_create (slab_name,sizeof (struct ubi_ainf_peb ),0 ,0 ,NULL );if (!ai->aeb_slab_cache) {
@@ -1491,7 +1491,7 @@ static int scan_fast(struct ubi_device *ubi, struct ubi_attach_info **ai) err = -ENOMEM ; - scan_ai =alloc_ai (); + scan_ai =alloc_ai ("ubi_aeb_slab_cache_fastmap" );if (!scan_ai) goto out;
@@ -1557,7 +1557,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)int err;struct ubi_attach_info *ai; - ai =alloc_ai (); + ai =alloc_ai ("ubi_aeb_slab_cache" );if (!ai)return -ENOMEM ;
@@ -1575,7 +1575,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)if (err >0 ||mtd_is_eccerr (err)) {if (err !=UBI_NO_FASTMAP ) {destroy_ai (ai); - ai =alloc_ai (); + ai =alloc_ai ("ubi_aeb_slab_cache" );if (!ai)return -ENOMEM ;
@@ -1614,7 +1614,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)if (ubi->fm &&ubi_dbg_chk_fastmap (ubi)) {struct ubi_attach_info *scan_ai; - scan_ai =alloc_ai (); + scan_ai =alloc_ai ("ubi_aeb_slab_cache_dbg_chk_fastmap" );if (!scan_ai) { err = -ENOMEM ; goto out_wl;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 297/459 ubifs: authentication: Fix use-after-free in ubifs_tnc_end_commit
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waqar Hameed <[email protected]>
[ Upstream commit 4617fb8fc15effe8eda4dd898d4e33eb537a7140 ]
After an insertion in TNC, the tree might split and cause a node to change its znode->parent. A further deletion of other nodes in the tree (which also could free the nodes), the aforementioned node's znode->cparent could still point to a freed node. This znode->cparent may not be updated when getting nodes to commit in ubifs_tnc_start_commit(). This could then trigger a use-after-free when accessing the znode->cparent in write_index() in ubifs_tnc_end_commit().
This can be triggered by running
rm -f /etc/test-file.bin
dd if=/dev/urandom of=/etc/test-file.bin bs=1M count=60 conv=fsync
in a loop, and with CONFIG_UBIFS_FS_AUTHENTICATION. KASAN then reports:
BUG: KASAN: use-after-free in ubifs_tnc_end_commit+0xa5c/0x1950 Write of size 32 at addr ffffff800a3af86c by task ubifs_bgt0_20/153 Call trace: dump_backtrace+0x0/0x340 show_stack+0x18/0x24 dump_stack_lvl+0x9c/0xbc print_address_description.constprop.0+0x74/0x2b0 kasan_report+0x1d8/0x1f0 kasan_check_range+0xf8/0x1a0 memcpy+0x84/0xf4 ubifs_tnc_end_commit+0xa5c/0x1950 do_commit+0x4e0/0x1340 ubifs_bg_thread+0x234/0x2e0 kthread+0x36c/0x410 ret_from_fork+0x10/0x20 Allocated by task 401: kasan_save_stack+0x38/0x70 __kasan_kmalloc+0x8c/0xd0 __kmalloc+0x34c/0x5bc tnc_insert+0x140/0x16a4 ubifs_tnc_add+0x370/0x52c ubifs_jnl_write_data+0x5d8/0x870 do_writepage+0x36c/0x510 ubifs_writepage+0x190/0x4dc __writepage+0x58/0x154 write_cache_pages+0x394/0x830 do_writepages+0x1f0/0x5b0 filemap_fdatawrite_wbc+0x170/0x25c file_write_and_wait_range+0x140/0x190 ubifs_fsync+0xe8/0x290 vfs_fsync_range+0xc0/0x1e4 do_fsync+0x40/0x90 __arm64_sys_fsync+0x34/0x50 invoke_syscall.constprop.0+0xa8/0x260 do_el0_svc+0xc8/0x1f0 el0_svc+0x34/0x70 el0t_64_sync_handler+0x108/0x114 el0t_64_sync+0x1a4/0x1a8 Freed by task 403: kasan_save_stack+0x38/0x70 kasan_set_track+0x28/0x40 kasan_set_free_info+0x28/0x4c __kasan_slab_free+0xd4/0x13c kfree+0xc4/0x3a0 tnc_delete+0x3f4/0xe40 ubifs_tnc_remove_range+0x368/0x73c ubifs_tnc_remove_ino+0x29c/0x2e0 ubifs_jnl_delete_inode+0x150/0x260 ubifs_evict_inode+0x1d4/0x2e4 evict+0x1c8/0x450 iput+0x2a0/0x3c4 do_unlinkat+0x2cc/0x490 __arm64_sys_unlinkat+0x90/0x100 invoke_syscall.constprop.0+0xa8/0x260 do_el0_svc+0xc8/0x1f0 el0_svc+0x34/0x70 el0t_64_sync_handler+0x108/0x114 el0t_64_sync+0x1a4/0x1a8
The offending memcpy() in ubifs_copy_hash() has a use-after-free when a node becomes root in TNC but still has a cparent to an already freed node. More specifically, consider the following TNC:
zroot
/
/
zp1
/
/
znInserting a new node zn_new with a key smaller then zn will trigger a split in tnc_insert() if zp1 is full:
zroot
/ \
/ \
zp1 zp2
/ \
/ \ zn_new zn
zn->parent has now been moved to zp2, *but* zn->cparent still points to zp1.
Now, consider a removal of all the nodes _except_ zn. Just when tnc_delete() is about to delete zroot and zp2:
zroot
\
\
zp2
\
\
znzroot and zp2 get freed and the tree collapses:
zn
zn now becomes the new zroot.
get_znodes_to_commit() will now only find zn, the new zroot, and write_index() will check its znode->cparent that wrongly points to the already freed zp1. ubifs_copy_hash() thus gets wrongly called with znode->cparent->zbranch[znode->iip].hash that triggers the use-after-free!
Fix this by explicitly setting znode->cparent to NULL in get_znodes_to_commit() for the root node. The search for the dirty nodes is bottom-up in the tree. Thus, when find_next_dirty(znode) returns NULL, the current znode _is_ the root node. Add an assert for this.
--- fs/ubifs/tnc_commit.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ubifs/tnc_commit.c +2 -0
@@ -657,6 +657,8 @@ static int get_znodes_to_commit(struct ubifs_info *c) znode->alt =0 ; cnext =find_next_dirty (znode);if (!cnext) { +ubifs_assert (c, !znode->parent); + znode->cparent =NULL ; znode->cnext = c->cnext;break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 298/459 jffs2: fix use of uninitialized variable
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingfang Deng <[email protected]>
[ Upstream commit 3ba44ee966bc3c41dd8a944f963466c8fcc60dc8 ]
When building the kernel with -Wmaybe-uninitialized, the compiler reports this warning:
In function 'jffs2_mark_erased_block',
inlined from 'jffs2_erase_pending_blocks' at fs/jffs2/erase.c:116:4:fs/jffs2/erase.c:474:9: warning: 'bad_offset' may be used uninitialized [-Wmaybe-uninitialized]
474 | jffs2_erase_failed(c, jeb, bad_offset);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/jffs2/erase.c: In function 'jffs2_erase_pending_blocks':
fs/jffs2/erase.c:402:18: note: 'bad_offset' was declared here
402 | uint32_t bad_offset;
| ^~~~~~~~~~When mtd->point() is used, jffs2_erase_pending_blocks can return -EIO without initializing bad_offset, which is later used at the filebad label in jffs2_mark_erased_block.
Fix it by initializing this variable.
--- fs/jffs2/erase.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/jffs2/erase.c +3 -4
@@ -340,10 +340,9 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl }while (--retlen);mtd_unpoint (c->mtd, jeb->offset, c->sector_size);if (retlen) { -pr_warn ("Newly-erased block contained word 0x%lx at offset 0x%08tx\n" , - *wordebuf, - jeb->offset + - c->sector_size-retlen *sizeof (*wordebuf)); + *bad_offset = jeb->offset + c->sector_size - retlen *sizeof (*wordebuf); +pr_warn ("Newly-erased block contained word 0x%lx at offset 0x%08x\n" , + *wordebuf, *bad_offset);return -EIO ; }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 299/459 block: return unsigned int from bdev_io_min
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 46fd48ab3ea3eb3bb215684bd66ea3d260b091a9 ]
The underlying limit is defined as an unsigned int, so return that from bdev_io_min as well.
--- include/linux/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
@@ -1468,7 +1468,7 @@ static inline unsigned int queue_io_min(const struct request_queue *q)return q->limits.io_min; } -static inline int bdev_io_min (struct block_device *bdev) +static inline unsigned int bdev_io_min (struct block_device *bdev) {return queue_io_min (bdev_get_queue (bdev)); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 300/459 9p/xen: fix init sequence
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Zenla <[email protected]>
[ Upstream commit 7ef3ae82a6ebbf4750967d1ce43bcdb7e44ff74b ]
Large amount of mount hangs observed during hotplugging of 9pfs devices. The 9pfs Xen driver attempts to initialize itself more than once, causing the frontend and backend to disagree: the backend listens on a channel that the frontend does not send on, resulting in stalled processing.
Only allow initialization of 9p frontend once.
Message-ID: <[email protected]>
--- net/9p/trans_xen.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/9p/trans_xen.c +5 -2
@@ -487,6 +487,7 @@ static int xen_9pfs_front_init(struct xenbus_device *dev) goto error; } +xenbus_switch_state (dev, XenbusStateInitialised);return 0 ; error_xenbus:
@@ -534,8 +535,10 @@ static void xen_9pfs_front_changed(struct xenbus_device *dev,break ;case XenbusStateInitWait: -if (!xen_9pfs_front_init (dev)) -xenbus_switch_state (dev, XenbusStateInitialised); +if (dev->state != XenbusStateInitialising) +break ; + +xen_9pfs_front_init (dev);break ;case XenbusStateConnected:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 301/459 9p/xen: fix release of IRQ
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Zenla <[email protected]>
[ Upstream commit e43c608f40c065b30964f0a806348062991b802d ]
Kernel logs indicate an IRQ was double-freed.
Pass correct device ID during IRQ release.
Message-ID: <[email protected]>
--- net/9p/trans_xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/9p/trans_xen.c +1 -1
@@ -307,7 +307,7 @@ static void xen_9pfs_front_free(struct xen_9pfs_front_priv *priv)if (!priv->rings[i].intf)break ;if (priv->rings[i].irq >0 ) -unbind_from_irqhandler (priv->rings[i].irq, priv->dev); +unbind_from_irqhandler (priv->rings[i].irq, ring);if (priv->rings[i].data.in) { for (j = 0; j < (1 << priv->rings[i].intf->ring_order);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 302/459 rtc: ab-eoz9: dont fail temperature reads on undervoltage notification
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit e0779a0dcf41a6452ac0a169cd96863feb5787c7 ]
The undervoltage flags reported by the RTC are useful to know if the time and date are reliable after a reboot. Although the threshold VLOW1 indicates that the thermometer has been shutdown and time compensation is off, it doesn't mean that the temperature readout is currently impossible.
As the system is running, the RTC voltage is now fully established and we can read the temperature.
--- drivers/rtc/rtc-ab-eoz9.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/rtc/rtc-ab-eoz9.c +0 -7
@@ -281,13 +281,6 @@ static int abeoz9z3_temp_read(struct device *dev,if (ret <0 )return ret; -if ((val &ABEOZ9_REG_CTRL_STATUS_V1F ) || - (val &ABEOZ9_REG_CTRL_STATUS_V2F )) { -dev_err (dev, -"thermometer might be disabled due to low voltage\n" ); -return -EINVAL ; - } -switch (attr) {case hwmon_temp_input: ret =regmap_read (regmap,ABEOZ9_REG_REG_TEMP , &val);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 303/459 modpost: remove incorrect code in do_eisa_entry()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 0c3e091319e4748cb36ac9a50848903dc6f54054 ]
This function contains multiple bugs after the following commits:
- ac551828993e ("modpost: i2c aliases need no trailing wildcard")
- 6543becf26ff ("mod/file2alias: make modalias generation safe for cross compiling")
Commit ac551828993e inserted the following code to do_eisa_entry():
else
strcat(alias, "*");
This is incorrect because 'alias' is uninitialized. If it is not NULL-terminated, strcat() could cause a buffer overrun.
Even if 'alias' happens to be zero-filled, it would output:
MODULE_ALIAS("*");This would match anything. As a result, the module could be loaded by any unrelated uevent from an unrelated subsystem.
Commit ac551828993e introduced another bug.
Prior to that commit, the conditional check was:
if (eisa->sig[0])
This checked if the first character of eisa_device_id::sig was not '\0'.
However, commit ac551828993e changed it as follows:
if (sig[0])
sig[0] is NOT the first character of the eisa_device_id::sig. The type of 'sig' is 'char (*)[8]', meaning that the type of 'sig[0]' is 'char [8]' instead of 'char'. 'sig[0]' and 'symval' refer to the same address, which never becomes NULL.
The correct conversion would have been:
if ((*sig)[0])
However, this if-conditional was meaningless because the earlier change in commit ac551828993e was incorrect.
This commit removes the entire incorrect code, which should never have been executed.
--- scripts/mod/file2alias.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
scripts/mod/file2alias.c +1 -4
@@ -786,10 +786,7 @@ static int do_eisa_entry(const char *filename, void *symval, char *alias) {DEF_FIELD_ADDR (symval, eisa_device_id, sig); -if (sig[0 ]) -sprintf (alias,EISA_DEVICE_MODALIAS_FMT "*" , *sig); -else -strcat (alias,"*" ); +sprintf (alias,EISA_DEVICE_MODALIAS_FMT "*" , *sig);return 1 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 304/459 nfs: ignore SB_RDONLY when mounting nfs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
[ Upstream commit 52cb7f8f177878b4f22397b9c4d2c8f743766be3 ]
When exporting only one file system with fsid=0 on the server side, the client alternately uses the ro/rw mount options to perform the mount operation, and a new vfsmount is generated each time.
It can be reproduced as follows:
[root@localhost ~]# mount /dev/sda /mnt2
[root@localhost ~]# echo "/mnt2 *(rw,no_root_squash,fsid=0)" >/etc/exports [root@localhost ~]# systemctl restart nfs-server [root@localhost ~]# mount -t nfs -o ro,vers=4 127.0.0.1:/ /mnt/sdaa [root@localhost ~]# mount -t nfs -o rw,vers=4 127.0.0.1:/ /mnt/sdaa [root@localhost ~]# mount -t nfs -o ro,vers=4 127.0.0.1:/ /mnt/sdaa [root@localhost ~]# mount -t nfs -o rw,vers=4 127.0.0.1:/ /mnt/sdaa [root@localhost ~]# mount | grep nfs4
127.0.0.1:/ on /mnt/sdaa type nfs4 (ro,relatime,vers=4.2,rsize=1048576,... 127.0.0.1:/ on /mnt/sdaa type nfs4 (rw,relatime,vers=4.2,rsize=1048576,... 127.0.0.1:/ on /mnt/sdaa type nfs4 (ro,relatime,vers=4.2,rsize=1048576,... 127.0.0.1:/ on /mnt/sdaa type nfs4 (rw,relatime,vers=4.2,rsize=1048576,... [root@localhost ~]#
We expected that after mounting with the ro option, using the rw option to mount again would return EBUSY, but the actual situation was not the case.
As shown above, when mounting for the first time, a superblock with the ro flag will be generated, and at the same time, in do_new_mount_fc --> do_add_mount, it detects that the superblock corresponding to the current target directory is inconsistent with the currently generated one (path->mnt->mnt_sb != newmnt->mnt.mnt_sb), and a new vfsmount will be generated.
When mounting with the rw option for the second time, since no matching superblock can be found in the fs_supers list, a new superblock with the rw flag will be generated again. The superblock in use (ro) is different from the newly generated superblock (rw), and a new vfsmount will be generated again.
When mounting with the ro option for the third time, the superblock (ro) is found in fs_supers, the superblock in use (rw) is different from the found superblock (ro), and a new vfsmount will be generated again.
We can switch between ro/rw through remount, and only one superblock needs to be generated, thus avoiding the problem of repeated generation of vfsmount caused by switching superblocks.
Furthermore, This can also resolve the issue described in the link.
--- fs/nfs/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/internal.h +1 -1
@@ -11,7 +11,7 @@#include <linux/nfs_page.h> #include <linux/wait_bit.h> -#define NFS_SB_MASK (SB_RDONLY|SB_NOSUID|SB_NODEV|SB_NOEXEC|SB_SYNCHRONOUS) +#define NFS_SB_MASK (SB_NOSUID|SB_NODEV|SB_NOEXEC|SB_SYNCHRONOUS)extern const struct export_operations nfs_export_ops;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 305/459 SUNRPC: correct error code comment in xs_tcp_setup_socket()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Calum Mackay <[email protected]>
[ Upstream commit 8c71139d9f84c1963b0a416941244502a20a7e52 ]
This comment was introduced by commit 6ea44adce915 ("SUNRPC: ensure correct error is reported by xs_tcp_setup_socket()").
I believe EIO was a typo at the time: it should have been EAGAIN.
Subsequently, commit 0445f92c5d53 ("SUNRPC: Fix disconnection races") changed that to ENOTCONN.
Rather than trying to keep the comment here in sync with the code in xprt_force_disconnect(), make the point in a non-specific way.
Stable-dep-of: 4db9ad82a6c8 ("sunrpc: clear XPRT_SOCK_UPD_TIMEOUT when reset transport")
--- net/sunrpc/xprtsock.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/sunrpc/xprtsock.c +2 -4
@@ -2332,10 +2332,8 @@ static void xs_tcp_setup_socket(struct work_struct *work)case -EHOSTUNREACH :case -EADDRINUSE :case -ENOBUFS : -/* -* xs_tcp_force_close() wakes tasks with -EIO. -* We need to wake them first to ensure the -* correct error code. +/* xs_tcp_force_close() wakes tasks with a fixed error code. +* We need to wake them first to ensure the correct error code. */ xprt_wake_pending_tasks (xprt, status);xs_tcp_force_close (xprt);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 306/459 SUNRPC: Convert rpc_client refcount to use refcount_t
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 71d3d0ebc894294ef9454e45a3ac2e9ba60b3351 ]
There are now tools in the refcount library that allow us to convert the client shutdown code.
Stable-dep-of: 4db9ad82a6c8 ("sunrpc: clear XPRT_SOCK_UPD_TIMEOUT when reset transport")
--- include/linux/sunrpc/clnt.h | 3 ++- net/sunrpc/auth_gss/gss_rpc_upcall.c | 2 +- net/sunrpc/clnt.c | 22 ++++++++++------------ net/sunrpc/debugfs.c | 2 +- net/sunrpc/rpc_pipe.c | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-)
include/linux/sunrpc/clnt.h +2 -1
@@ -14,6 +14,7 @@#include <linux/socket.h> #include <linux/in.h> #include <linux/in6.h> +#include <linux/refcount.h> #include <linux/sunrpc/msg_prot.h> #include <linux/sunrpc/sched.h>
@@ -34,7 +35,7 @@ struct rpc_inode;* The high-level client handle */ struct rpc_clnt { -atomic_t cl_count;/* Number of references */ +refcount_t cl_count;/* Number of references */ unsigned int cl_clid;/* client id */ struct list_head cl_clients;/* Global list of clients */ struct list_head cl_tasks;/* List of tasks */
net/sunrpc/auth_gss/gss_rpc_upcall.c +1 -1
@@ -160,7 +160,7 @@ static struct rpc_clnt *get_gssp_clnt(struct sunrpc_net *sn)mutex_lock (&sn->gssp_lock); clnt = sn->gssp_clnt;if (clnt) -atomic_inc (&clnt->cl_count); +refcount_inc (&clnt->cl_count);mutex_unlock (&sn->gssp_lock);return clnt; }
net/sunrpc/clnt.c +10 -12
@@ -169,7 +169,7 @@ static int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event)case RPC_PIPEFS_MOUNT :if (clnt->cl_pipedir_objects.pdh_dentry !=NULL )return 1 ; -if (atomic_read (&clnt->cl_count) ==0 ) +if (refcount_read (&clnt->cl_count) ==0 )return 1 ;break ;case RPC_PIPEFS_UMOUNT :
@@ -419,7 +419,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, clnt->cl_rtt = &clnt->cl_rtt_default;rpc_init_rtt (&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); -atomic_set (&clnt->cl_count,1 ); +refcount_set (&clnt->cl_count,1 );if (nodename ==NULL ) nodename =utsname ()->nodename;
@@ -430,7 +430,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,if (err) goto out_no_path;if (parent) -atomic_inc (&parent->cl_count); +refcount_inc (&parent->cl_count);trace_rpc_clnt_new (clnt, xprt, program->name, args->servername);return clnt;
@@ -917,18 +917,16 @@ rpc_free_client(struct rpc_clnt *clnt)static struct rpc_clnt *rpc_free_auth (struct rpc_clnt *clnt) { -if (clnt->cl_auth ==NULL ) -return rpc_free_client (clnt); -/* * Note: RPCSEC_GSS may need to send NULL RPC calls in order to * release remaining GSS contexts. This mechanism ensures * that it can do so safely. */ -atomic_inc (&clnt->cl_count); -rpcauth_release (clnt->cl_auth); - clnt->cl_auth =NULL ; -if (atomic_dec_and_test (&clnt->cl_count)) +if (clnt->cl_auth !=NULL ) { +rpcauth_release (clnt->cl_auth); + clnt->cl_auth =NULL ; + } +if (refcount_dec_and_test (&clnt->cl_count))return rpc_free_client (clnt);return NULL ; }
@@ -942,7 +940,7 @@ rpc_release_client(struct rpc_clnt *clnt)do {if (list_empty (&clnt->cl_tasks))wake_up (&destroy_wait); -if (!atomic_dec_and_test (&clnt->cl_count)) +if (refcount_dec_not_one (&clnt->cl_count))break ; clnt =rpc_free_auth (clnt); }while (clnt !=NULL );
@@ -1083,7 +1081,7 @@ void rpc_task_set_client(struct rpc_task *task, struct rpc_clnt *clnt)if (clnt !=NULL ) {rpc_task_set_transport (task, clnt); task->tk_client = clnt; -atomic_inc (&clnt->cl_count); +refcount_inc (&clnt->cl_count);if (clnt->cl_softrtry) task->tk_flags |=RPC_TASK_SOFT ;if (clnt->cl_softerr)
net/sunrpc/debugfs.c +1 -1
@@ -90,7 +90,7 @@ static int tasks_open(struct inode *inode, struct file *filp)struct seq_file *seq = filp->private_data;struct rpc_clnt *clnt = seq->private = inode->i_private; -if (!atomic_inc_not_zero (&clnt->cl_count)) { +if (!refcount_inc_not_zero (&clnt->cl_count)) {seq_release (inode, filp); ret = -EINVAL ; }
net/sunrpc/rpc_pipe.c +1 -1
@@ -423,7 +423,7 @@ rpc_info_open(struct inode *inode, struct file *file)spin_lock (&file->f_path.dentry->d_lock);if (!d_unhashed (file->f_path.dentry)) clnt =RPC_I (inode)->private; -if (clnt !=NULL &&atomic_inc_not_zero (&clnt->cl_count)) { +if (clnt !=NULL &&refcount_inc_not_zero (&clnt->cl_count)) {spin_unlock (&file->f_path.dentry->d_lock); m->private = clnt; }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 307/459 sunrpc: remove unnecessary test in rpc_task_set_client()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thiago Rafael Becker <[email protected]>
[ Upstream commit 023859ce6f88f7cfc223752fb56ec453a147b852 ]
In rpc_task_set_client(), testing for a NULL clnt is not necessary, as clnt should always be a valid pointer to a rpc_client.
Stable-dep-of: 4db9ad82a6c8 ("sunrpc: clear XPRT_SOCK_UPD_TIMEOUT when reset transport")
--- net/sunrpc/clnt.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)
net/sunrpc/clnt.c +15 -18
@@ -1077,24 +1077,21 @@ void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt)static void rpc_task_set_client (struct rpc_task *task,struct rpc_clnt *clnt) { - -if (clnt !=NULL ) { -rpc_task_set_transport (task, clnt); - task->tk_client = clnt; -refcount_inc (&clnt->cl_count); -if (clnt->cl_softrtry) - task->tk_flags |=RPC_TASK_SOFT ; -if (clnt->cl_softerr) - task->tk_flags |=RPC_TASK_TIMEOUT ; -if (clnt->cl_noretranstimeo) - task->tk_flags |=RPC_TASK_NO_RETRANS_TIMEOUT ; -if (atomic_read (&clnt->cl_swapper)) - task->tk_flags |=RPC_TASK_SWAPPER ; -/* Add to the client's list of all tasks */ -spin_lock (&clnt->cl_lock); -list_add_tail (&task->tk_task, &clnt->cl_tasks); -spin_unlock (&clnt->cl_lock); - } +rpc_task_set_transport (task, clnt); + task->tk_client = clnt; +refcount_inc (&clnt->cl_count); +if (clnt->cl_softrtry) + task->tk_flags |=RPC_TASK_SOFT ; +if (clnt->cl_softerr) + task->tk_flags |=RPC_TASK_TIMEOUT ; +if (clnt->cl_noretranstimeo) + task->tk_flags |=RPC_TASK_NO_RETRANS_TIMEOUT ; +if (atomic_read (&clnt->cl_swapper)) + task->tk_flags |=RPC_TASK_SWAPPER ; +/* Add to the client's list of all tasks */ +spin_lock (&clnt->cl_lock); +list_add_tail (&task->tk_task, &clnt->cl_tasks); +spin_unlock (&clnt->cl_lock); } static void
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 308/459 SUNRPC: Replace internal use of SOCKWQ_ASYNC_NOSPACE
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 2790a624d43084de590884934969e19c7a82316a ]
The socket's SOCKWQ_ASYNC_NOSPACE can be cleared by various actors in the socket layer, so replace it with our own flag in the transport sock_state field.
Stable-dep-of: 4db9ad82a6c8 ("sunrpc: clear XPRT_SOCK_UPD_TIMEOUT when reset transport")
--- include/linux/sunrpc/xprtsock.h | 1 + net/sunrpc/xprtsock.c | 22 ++++------------------ 2 files changed, 5 insertions(+), 18 deletions(-)
include/linux/sunrpc/xprtsock.h +1 -0
@@ -90,5 +90,6 @@ struct sock_xprt {#define XPRT_SOCK_WAKE_PENDING (6)#define XPRT_SOCK_WAKE_DISCONNECT (7)#define XPRT_SOCK_CONNECT_SENT (8) +#define XPRT_SOCK_NOSPACE (9)#endif /* _LINUX_SUNRPC_XPRTSOCK_H */
net/sunrpc/xprtsock.c +4 -18
@@ -770,14 +770,8 @@ static int xs_nospace(struct rpc_rqst *req, struct sock_xprt *transport)/* Don't race with disconnect */ if (xprt_connected (xprt)) { -struct socket_wq *wq; - -rcu_read_lock (); - wq =rcu_dereference (sk->sk_wq); -set_bit (SOCKWQ_ASYNC_NOSPACE , &wq->flags); -rcu_read_unlock (); -/* wait for more buffer space */ +set_bit (XPRT_SOCK_NOSPACE , &transport->sock_state);set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); sk->sk_write_pending++;xprt_wait_for_buffer_space (xprt);
@@ -1134,6 +1128,7 @@ static void xs_sock_reset_state_flags(struct rpc_xprt *xprt)clear_bit (XPRT_SOCK_WAKE_ERROR , &transport->sock_state);clear_bit (XPRT_SOCK_WAKE_WRITE , &transport->sock_state);clear_bit (XPRT_SOCK_WAKE_DISCONNECT , &transport->sock_state); +clear_bit (XPRT_SOCK_NOSPACE , &transport->sock_state); }static void xs_run_error_worker (struct sock_xprt *transport,unsigned int nr)
@@ -1497,7 +1492,6 @@ static void xs_tcp_state_change(struct sock *sk)static void xs_write_space (struct sock *sk) { -struct socket_wq *wq;struct sock_xprt *transport;struct rpc_xprt *xprt;
@@ -1508,15 +1502,10 @@ static void xs_write_space(struct sock *sk)if (unlikely (!(xprt =xprt_from_sock (sk))))return ; transport = container_of(xprt, struct sock_xprt, xprt); -rcu_read_lock (); - wq =rcu_dereference (sk->sk_wq); -if (!wq ||test_and_clear_bit (SOCKWQ_ASYNC_NOSPACE , &wq->flags) ==0 ) - goto out; - +if (!test_and_clear_bit (XPRT_SOCK_NOSPACE , &transport->sock_state)) +return ;xs_run_error_worker (transport,XPRT_SOCK_WAKE_WRITE ); sk->sk_write_pending--; -out: -rcu_read_unlock (); }/**
@@ -1860,7 +1849,6 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt, sk->sk_user_data = xprt; sk->sk_data_ready = xs_data_ready; sk->sk_write_space = xs_udp_write_space; -sock_set_flag (sk,SOCK_FASYNC ); sk->sk_error_report = xs_error_report;xprt_clear_connected (xprt);
@@ -2058,7 +2046,6 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) sk->sk_user_data = xprt; sk->sk_data_ready = xs_data_ready; sk->sk_write_space = xs_udp_write_space; -sock_set_flag (sk,SOCK_FASYNC );xprt_set_connected (xprt);
@@ -2214,7 +2201,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) sk->sk_data_ready = xs_data_ready; sk->sk_state_change = xs_tcp_state_change; sk->sk_write_space = xs_tcp_write_space; -sock_set_flag (sk,SOCK_FASYNC ); sk->sk_error_report = xs_error_report;/* socket options */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 309/459 sunrpc: clear XPRT_SOCK_UPD_TIMEOUT when reset transport
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Jian <[email protected]>
[ Upstream commit 4db9ad82a6c823094da27de4825af693a3475d51 ]
Since transport->sock has been set to NULL during reset transport, XPRT_SOCK_UPD_TIMEOUT also needs to be cleared. Otherwise, the xs_tcp_set_socket_timeouts() may be triggered in xs_tcp_send_request() to dereference the transport->sock that has been set to NULL.
--- net/sunrpc/xprtsock.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/xprtsock.c +1 -0
@@ -1129,6 +1129,7 @@ static void xs_sock_reset_state_flags(struct rpc_xprt *xprt)clear_bit (XPRT_SOCK_WAKE_WRITE , &transport->sock_state);clear_bit (XPRT_SOCK_WAKE_DISCONNECT , &transport->sock_state);clear_bit (XPRT_SOCK_NOSPACE , &transport->sock_state); +clear_bit (XPRT_SOCK_UPD_TIMEOUT , &transport->sock_state); }static void xs_run_error_worker (struct sock_xprt *transport,unsigned int nr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 310/459 sh: intc: Fix use-after-free bug in register_intc_controller()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 63e72e551942642c48456a4134975136cdcb9b3c ]
In the error handling for this function, d is freed without ever removing it from intc_list which would lead to a use after free. To fix this, let's only add it to the list after everything has succeeded.
--- drivers/sh/intc/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/sh/intc/core.c +1 -1
@@ -194,7 +194,6 @@ int __init register_intc_controller(struct intc_desc *desc) goto err0;INIT_LIST_HEAD (&d->list); -list_add_tail (&d->list, &intc_list);raw_spin_lock_init (&d->lock);INIT_RADIX_TREE (&d->tree,GFP_ATOMIC );
@@ -380,6 +379,7 @@ int __init register_intc_controller(struct intc_desc *desc) d->skip_suspend = desc->skip_syscore_suspend; +list_add_tail (&d->list, &intc_list); nr_intc_controllers++;return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 311/459 ASoC: fsl_micfil: fix the naming style for mask definition
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
commit 101b096bc2549618f18bc08ae3a0e364b3c8fff1 upstream.
Remove the _SHIFT for the mask definition.
--- sound/soc/fsl/fsl_micfil.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/fsl/fsl_micfil.h +4 -4
@@ -75,9 +75,9 @@#define MICFIL_FIFO_STAT_FIFOX_UNDER (ch) BIT((ch) + 8)/* MICFIL HWVAD0 Control 1 Register -- REG_MICFIL_VAD0_CTRL1*/ -#define MICFIL_VAD0_CTRL1_CHSEL_SHIFT GENMASK(26, 24) -#define MICFIL_VAD0_CTRL1_CICOSR_SHIFT GENMASK(19, 16) -#define MICFIL_VAD0_CTRL1_INITT_SHIFT GENMASK(12, 8) +#define MICFIL_VAD0_CTRL1_CHSEL GENMASK(26, 24) +#define MICFIL_VAD0_CTRL1_CICOSR GENMASK(19, 16) +#define MICFIL_VAD0_CTRL1_INITT GENMASK(12, 8)#define MICFIL_VAD0_CTRL1_ST10 BIT(4)#define MICFIL_VAD0_CTRL1_ERIE BIT(3)#define MICFIL_VAD0_CTRL1_IE BIT(2)
@@ -107,7 +107,7 @@/* MICFIL HWVAD0 Zero-Crossing Detector - REG_MICFIL_VAD0_ZCD */ #define MICFIL_VAD0_ZCD_ZCDTH GENMASK(25, 16) -#define MICFIL_VAD0_ZCD_ZCDADJ_SHIFT GENMASK(11, 8) +#define MICFIL_VAD0_ZCD_ZCDADJ GENMASK(11, 8)#define MICFIL_VAD0_ZCD_ZCDAND BIT(4)#define MICFIL_VAD0_ZCD_ZCDAUT BIT(2)#define MICFIL_VAD0_ZCD_ZCDEN BIT(0)
Greg Kroah-Hartman
maintainerPATCH 312/459 octeontx2-pf: Fix out-of-bounds read in otx2_get_fecparam()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 93efb0c656837f4a31d7cc6117a7c8cecc8fadac upstream.
Code at line 967 implies that rsp->fwdata.supported_fec may be up to 4:
967: if (rsp->fwdata.supported_fec <= FEC_MAX_INDEX)
If rsp->fwdata.supported_fec evaluates to 4, then there is an out-of-bounds read at line 971 because fec is an array with a maximum of 4 elements:
954 const int fec[] = {
955 ETHTOOL_FEC_OFF, 956 ETHTOOL_FEC_BASER, 957 ETHTOOL_FEC_RS, 958 ETHTOOL_FEC_BASER | ETHTOOL_FEC_RS};
959 #define FEC_MAX_INDEX 4
971: fecparam->fec = fec[rsp->fwdata.supported_fec];
Fix this by properly indexing fec[] with rsp->fwdata.supported_fec - 1. In this case the proper indexes 0 to 3 are used when rsp->fwdata.supported_fec evaluates to a range of 1 to 4, correspondingly.
Addresses-Coverity-ID: 1501722 ("Out-of-bounds read")
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +1 -1
@@ -805,7 +805,7 @@ static int otx2_get_fecparam(struct net_if (!rsp->fwdata.supported_fec) fecparam->fec =ETHTOOL_FEC_NONE ;else - fecparam->fec = fec[rsp->fwdata.supported_fec]; + fecparam->fec = fec[rsp->fwdata.supported_fec -1 ]; }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 313/459 quota: flush quota_release_work upon quota writeback
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ojaswin Mujoo <[email protected]>
[ Upstream commit ac6f420291b3fee1113f21d612fa88b628afab5b ]
One of the paths quota writeback is called from is:
freeze_super()
sync_filesystem()
ext4_sync_fs()
dquot_writeback_dquots()Since we currently don't always flush the quota_release_work queue in this path, we can end up with the following race:
1. dquot are added to releasing_dquots list during regular operations.
2. FS Freeze starts, however, this does not flush the quota_release_work queue.
3. Freeze completes.
4. Kernel eventually tries to flush the workqueue while FS is frozen which hits a WARN_ON since transaction gets started during frozen state:
ext4_journal_check_start+0x28/0x110 [ext4] (unreliable) __ext4_journal_start_sb+0x64/0x1c0 [ext4] ext4_release_dquot+0x90/0x1d0 [ext4] quota_release_workfn+0x43c/0x4d0
Which is the following line:
WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE);
Which ultimately results in generic/390 failing due to dmesg noise. This was detected on powerpc machine 15 cores.
To avoid this, make sure to flush the workqueue during dquot_writeback_dquots() so we dont have any pending workitems after freeze.
--- fs/quota/dquot.c | 2 ++ 1 file changed, 2 insertions(+)
fs/quota/dquot.c +2 -0
@@ -692,6 +692,8 @@ int dquot_writeback_dquots(struct super_block *sb, int type)WARN_ON_ONCE (!rwsem_is_locked (&sb->s_umount)); +flush_delayed_work ("a_release_work); +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (type !=-1 && cnt != type)continue ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 314/459 btrfs: ref-verify: fix use-after-free after invalid ref action
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 7c4e39f9d2af4abaf82ca0e315d1fd340456620f ]
At btrfs_ref_tree_mod() after we successfully inserted the new ref entry (local variable 'ref') into the respective block entry's rbtree (local variable 'be'), if we find an unexpected action of BTRFS_DROP_DELAYED_REF, we error out and free the ref entry without removing it from the block entry's rbtree. Then in the error path of btrfs_ref_tree_mod() we call btrfs_free_ref_cache(), which iterates over all block entries and then calls free_block_entry() for each one, and there we will trigger a use-after-free when we are called against the block entry to which we added the freed ref entry to its rbtree, since the rbtree still points to the block entry, as we didn't remove it from the rbtree before freeing it in the error path at btrfs_ref_tree_mod(). Fix this by removing the new ref entry from the rbtree before freeing it.
Syzbot report this with the following stack traces:
BTRFS error (device loop0 state EA): Ref action 2, root 5, ref_root 0, parent 8564736, owner 0, offset 0, num_refs 18446744073709551615
__btrfs_mod_ref+0x7dd/0xac0 fs/btrfs/extent-tree.c:2523
update_ref_for_cow+0x9cd/0x11f0 fs/btrfs/ctree.c:512
btrfs_force_cow_block+0x9f6/0x1da0 fs/btrfs/ctree.c:594
btrfs_cow_block+0x35e/0xa40 fs/btrfs/ctree.c:754
btrfs_search_slot+0xbdd/0x30d0 fs/btrfs/ctree.c:2116
btrfs_insert_empty_items+0x9c/0x1a0 fs/btrfs/ctree.c:4314
btrfs_insert_empty_item fs/btrfs/ctree.h:669 [inline]
btrfs_insert_orphan_item+0x1f1/0x320 fs/btrfs/orphan.c:23
btrfs_orphan_add+0x6d/0x1a0 fs/btrfs/inode.c:3482
btrfs_unlink+0x267/0x350 fs/btrfs/inode.c:4293
vfs_unlink+0x365/0x650 fs/namei.c:4469
do_unlinkat+0x4ae/0x830 fs/namei.c:4533
__do_sys_unlinkat fs/namei.c:4576 [inline]
__se_sys_unlinkat fs/namei.c:4569 [inline]
__x64_sys_unlinkat+0xcc/0xf0 fs/namei.c:4569
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
BTRFS error (device loop0 state EA): Ref action 1, root 5, ref_root 5, parent 0, owner 260, offset 0, num_refs 1
__btrfs_mod_ref+0x76b/0xac0 fs/btrfs/extent-tree.c:2521
update_ref_for_cow+0x96a/0x11f0
btrfs_force_cow_block+0x9f6/0x1da0 fs/btrfs/ctree.c:594
btrfs_cow_block+0x35e/0xa40 fs/btrfs/ctree.c:754
btrfs_search_slot+0xbdd/0x30d0 fs/btrfs/ctree.c:2116
btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:411
__btrfs_update_delayed_inode+0x1e7/0xb90 fs/btrfs/delayed-inode.c:1030
btrfs_update_delayed_inode fs/btrfs/delayed-inode.c:1114 [inline]
__btrfs_commit_inode_delayed_items+0x2318/0x24a0 fs/btrfs/delayed-inode.c:1137
__btrfs_run_delayed_items+0x213/0x490 fs/btrfs/delayed-inode.c:1171
btrfs_commit_transaction+0x8a8/0x3740 fs/btrfs/transaction.c:2313
prepare_to_relocate+0x3c4/0x4c0 fs/btrfs/relocation.c:3586
relocate_block_group+0x16c/0xd40 fs/btrfs/relocation.c:3611
btrfs_relocate_block_group+0x77d/0xd90 fs/btrfs/relocation.c:4081
btrfs_relocate_chunk+0x12c/0x3b0 fs/btrfs/volumes.c:3377
__btrfs_balance+0x1b0f/0x26b0 fs/btrfs/volumes.c:4161
btrfs_balance+0xbdc/0x10c0 fs/btrfs/volumes.c:4538
BTRFS error (device loop0 state EA): Ref action 2, root 5, ref_root 0, parent 8564736, owner 0, offset 0, num_refs 18446744073709551615
__btrfs_mod_ref+0x7dd/0xac0 fs/btrfs/extent-tree.c:2523
update_ref_for_cow+0x9cd/0x11f0 fs/btrfs/ctree.c:512
btrfs_force_cow_block+0x9f6/0x1da0 fs/btrfs/ctree.c:594
btrfs_cow_block+0x35e/0xa40 fs/btrfs/ctree.c:754
btrfs_search_slot+0xbdd/0x30d0 fs/btrfs/ctree.c:2116
btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:411
__btrfs_update_delayed_inode+0x1e7/0xb90 fs/btrfs/delayed-inode.c:1030
btrfs_update_delayed_inode fs/btrfs/delayed-inode.c:1114 [inline]
__btrfs_commit_inode_delayed_items+0x2318/0x24a0 fs/btrfs/delayed-inode.c:1137
__btrfs_run_delayed_items+0x213/0x490 fs/btrfs/delayed-inode.c:1171
btrfs_commit_transaction+0x8a8/0x3740 fs/btrfs/transaction.c:2313
prepare_to_relocate+0x3c4/0x4c0 fs/btrfs/relocation.c:3586
relocate_block_group+0x16c/0xd40 fs/btrfs/relocation.c:3611
btrfs_relocate_block_group+0x77d/0xd90 fs/btrfs/relocation.c:4081
btrfs_relocate_chunk+0x12c/0x3b0 fs/btrfs/volumes.c:3377
__btrfs_balance+0x1b0f/0x26b0 fs/btrfs/volumes.c:4161
btrfs_balance+0xbdc/0x10c0 fs/btrfs/volumes.c:4538
==================================================================
BUG: KASAN: slab-use-after-free in rb_first+0x69/0x70 lib/rbtree.c:473
Read of size 8 at addr ffff888042d1af38 by task syz.0.0/5329
CPU: 0 UID: 0 PID: 5329 Comm: syz.0.0 Not tainted 6.12.0-rc7-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
rb_first+0x69/0x70 lib/rbtree.c:473
free_block_entry+0x78/0x230 fs/btrfs/ref-verify.c:248
btrfs_free_ref_cache+0xa3/0x100 fs/btrfs/ref-verify.c:917
btrfs_ref_tree_mod+0x139f/0x15e0 fs/btrfs/ref-verify.c:898
btrfs_free_extent+0x33c/0x380 fs/btrfs/extent-tree.c:3544
__btrfs_mod_ref+0x7dd/0xac0 fs/btrfs/extent-tree.c:2523
update_ref_for_cow+0x9cd/0x11f0 fs/btrfs/ctree.c:512
btrfs_force_cow_block+0x9f6/0x1da0 fs/btrfs/ctree.c:594
btrfs_cow_block+0x35e/0xa40 fs/btrfs/ctree.c:754
btrfs_search_slot+0xbdd/0x30d0 fs/btrfs/ctree.c:2116
btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:411
__btrfs_update_delayed_inode+0x1e7/0xb90 fs/btrfs/delayed-inode.c:1030
btrfs_update_delayed_inode fs/btrfs/delayed-inode.c:1114 [inline]
__btrfs_commit_inode_delayed_items+0x2318/0x24a0 fs/btrfs/delayed-inode.c:1137
__btrfs_run_delayed_items+0x213/0x490 fs/btrfs/delayed-inode.c:1171
btrfs_commit_transaction+0x8a8/0x3740 fs/btrfs/transaction.c:2313
prepare_to_relocate+0x3c4/0x4c0 fs/btrfs/relocation.c:3586
relocate_block_group+0x16c/0xd40 fs/btrfs/relocation.c:3611
btrfs_relocate_block_group+0x77d/0xd90 fs/btrfs/relocation.c:4081
btrfs_relocate_chunk+0x12c/0x3b0 fs/btrfs/volumes.c:3377
__btrfs_balance+0x1b0f/0x26b0 fs/btrfs/volumes.c:4161
btrfs_balance+0xbdc/0x10c0 fs/btrfs/volumes.c:4538
btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3673
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f996df7e719
RSP: 002b:00007f996ede7038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f996e135f80 RCX: 00007f996df7e719
RDX: 0000000020000180 RSI: 00000000c4009420 RDI: 0000000000000004
RBP: 00007f996dff139e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f996e135f80 R15: 00007fff79f32e68
</TASK>
Allocated by task 5329:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:257 [inline]
__kmalloc_cache_noprof+0x19c/0x2c0 mm/slub.c:4295
kmalloc_noprof include/linux/slab.h:878 [inline]
kzalloc_noprof include/linux/slab.h:1014 [inline]
btrfs_ref_tree_mod+0x264/0x15e0 fs/btrfs/ref-verify.c:701
btrfs_free_extent+0x33c/0x380 fs/btrfs/extent-tree.c:3544
__btrfs_mod_ref+0x7dd/0xac0 fs/btrfs/extent-tree.c:2523
update_ref_for_cow+0x9cd/0x11f0 fs/btrfs/ctree.c:512
btrfs_force_cow_block+0x9f6/0x1da0 fs/btrfs/ctree.c:594
btrfs_cow_block+0x35e/0xa40 fs/btrfs/ctree.c:754
btrfs_search_slot+0xbdd/0x30d0 fs/btrfs/ctree.c:2116
btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:411
__btrfs_update_delayed_inode+0x1e7/0xb90 fs/btrfs/delayed-inode.c:1030
btrfs_update_delayed_inode fs/btrfs/delayed-inode.c:1114 [inline]
__btrfs_commit_inode_delayed_items+0x2318/0x24a0 fs/btrfs/delayed-inode.c:1137
__btrfs_run_delayed_items+0x213/0x490 fs/btrfs/delayed-inode.c:1171
btrfs_commit_transaction+0x8a8/0x3740 fs/btrfs/transaction.c:2313
prepare_to_relocate+0x3c4/0x4c0 fs/btrfs/relocation.c:3586
relocate_block_group+0x16c/0xd40 fs/btrfs/relocation.c:3611
btrfs_relocate_block_group+0x77d/0xd90 fs/btrfs/relocation.c:4081
btrfs_relocate_chunk+0x12c/0x3b0 fs/btrfs/volumes.c:3377
__btrfs_balance+0x1b0f/0x26b0 fs/btrfs/volumes.c:4161
btrfs_balance+0xbdc/0x10c0 fs/btrfs/volumes.c:4538
btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3673
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 5329:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:2342 [inline]
slab_free mm/slub.c:4579 [inline]
kfree+0x1a0/0x440 mm/slub.c:4727
btrfs_ref_tree_mod+0x136c/0x15e0
btrfs_free_extent+0x33c/0x380 fs/btrfs/extent-tree.c:3544
__btrfs_mod_ref+0x7dd/0xac0 fs/btrfs/extent-tree.c:2523
update_ref_for_cow+0x9cd/0x11f0 fs/btrfs/ctree.c:512
btrfs_force_cow_block+0x9f6/0x1da0 fs/btrfs/ctree.c:594
btrfs_cow_block+0x35e/0xa40 fs/btrfs/ctree.c:754
btrfs_search_slot+0xbdd/0x30d0 fs/btrfs/ctree.c:2116
btrfs_lookup_inode+0xdc/0x480 fs/btrfs/inode-item.c:411
__btrfs_update_delayed_inode+0x1e7/0xb90 fs/btrfs/delayed-inode.c:1030
btrfs_update_delayed_inode fs/btrfs/delayed-inode.c:1114 [inline]
__btrfs_commit_inode_delayed_items+0x2318/0x24a0 fs/btrfs/delayed-inode.c:1137
__btrfs_run_delayed_items+0x213/0x490 fs/btrfs/delayed-inode.c:1171
btrfs_commit_transaction+0x8a8/0x3740 fs/btrfs/transaction.c:2313
prepare_to_relocate+0x3c4/0x4c0 fs/btrfs/relocation.c:3586
relocate_block_group+0x16c/0xd40 fs/btrfs/relocation.c:3611
btrfs_relocate_block_group+0x77d/0xd90 fs/btrfs/relocation.c:4081
btrfs_relocate_chunk+0x12c/0x3b0 fs/btrfs/volumes.c:3377
__btrfs_balance+0x1b0f/0x26b0 fs/btrfs/volumes.c:4161
btrfs_balance+0xbdc/0x10c0 fs/btrfs/volumes.c:4538
btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3673
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888042d1af00
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 56 bytes inside of
freed 64-byte region [ffff888042d1af00, ffff888042d1af40)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x42d1a
anon flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000000 ffff88801ac418c0 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000200020 00000001f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5055, tgid 5055 (dhcpcd-run-hook), ts 40377240074, free_ts 40376848335
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1541
prep_new_page mm/page_alloc.c:1549 [inline]
get_page_from_freelist+0x3649/0x3790 mm/page_alloc.c:3459
__alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4735
alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
alloc_slab_page+0x6a/0x140 mm/slub.c:2412
allocate_slab+0x5a/0x2f0 mm/slub.c:2578
new_slab mm/slub.c:2631 [inline]
___slab_alloc+0xcd1/0x14b0 mm/slub.c:3818
__slab_alloc+0x58/0xa0 mm/slub.c:3908
__slab_alloc_node mm/slub.c:3961 [inline]
slab_alloc_node mm/slub.c:4122 [inline]
__do_kmalloc_node mm/slub.c:4263 [inline]
__kmalloc_noprof+0x25a/0x400 mm/slub.c:4276
kmalloc_noprof include/linux/slab.h:882 [inline]
kzalloc_noprof include/linux/slab.h:1014 [inline]
tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
tomoyo_encode+0x26f/0x540 security/tomoyo/realpath.c:80
tomoyo_realpath_from_path+0x59e/0x5e0 security/tomoyo/realpath.c:283
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x255/0x500 security/tomoyo/file.c:771
security_file_open+0x777/0x990 security/security.c:3109
do_dentry_open+0x369/0x1460 fs/open.c:945
vfs_open+0x3e/0x330 fs/open.c:1088
do_open fs/namei.c:3774 [inline]
path_openat+0x2c84/0x3590 fs/namei.c:3933
page last free pid 5055 tgid 5055 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1112 [inline]
free_unref_page+0xcfb/0xf20 mm/page_alloc.c:2642
free_pipe_info+0x300/0x390 fs/pipe.c:860
put_pipe_info fs/pipe.c:719 [inline]
pipe_release+0x245/0x320 fs/pipe.c:742
__fput+0x23f/0x880 fs/file_table.c:431
__do_sys_close fs/open.c:1567 [inline]
__se_sys_close fs/open.c:1552 [inline]
__x64_sys_close+0x7f/0x110 fs/open.c:1552
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888042d1ae00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888042d1ae80: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
>ffff888042d1af00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff888042d1af80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
ffff888042d1b000: 00 00 00 00 00 fc fc 00 00 00 00 00 fc fc 00 00--- fs/btrfs/ref-verify.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/ref-verify.c +1 -0
@@ -862,6 +862,7 @@ int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info, "dropping a ref for a root that doesn't have a ref on the block");dump_block_entry (fs_info, be);dump_ref_action (fs_info, ra); +rb_erase (&ref->node, &be->refs);kfree (ref);kfree (ra); goto out_unlock;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 315/459 ad7780: fix division by zero in ad7780_write_raw()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zicheng Qu <[email protected]>
commit c174b53e95adf2eece2afc56cd9798374919f99a upstream.
In the ad7780_write_raw() , val2 can be zero, which might lead to a division by zero error in DIV_ROUND_CLOSEST(). The ad7780_write_raw() is based on iio_info's write_raw. While val is explicitly declared that can be zero (in read mode), val2 is not specified to be non-zero.
--- drivers/iio/adc/ad7780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7780.c +1 -1
@@ -152,7 +152,7 @@ static int ad7780_write_raw(struct iio_dswitch (m) {case IIO_CHAN_INFO_SCALE : -if (val !=0 ) +if (val !=0 || val2 ==0 )return -EINVAL ; vref = st->int_vref_mv *1000000LL ;
Greg Kroah-Hartman
maintainerPATCH 316/459 util_macros.h: fix/rework find_closest() macros
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandru Ardelean <[email protected]>
commit bc73b4186736341ab5cd2c199da82db6e1134e13 upstream.
A bug was found in the find_closest() (find_closest_descending() is also affected after some testing), where for certain values with small progressions, the rounding (done by averaging 2 values) causes an incorrect index to be returned. The rounding issues occur for progressions of 1, 2 and 3. It goes away when the progression/interval between two values is 4 or larger.
It's particularly bad for progressions of 1. For example if there's an array of 'a = { 1, 2, 3 }', using 'find_closest(2, a ...)' would return 0 (the index of '1'), rather than returning 1 (the index of '2'). This means that for exact values (with a progression of 1), find_closest() will misbehave and return the index of the value smaller than the one we're searching for.
For progressions of 2 and 3, the exact values are obtained correctly; but values aren't approximated correctly (as one would expect). Starting with progressions of 4, all seems to be good (one gets what one would expect).
While one could argue that 'find_closest()' should not be used for arrays with progressions of 1 (i.e. '{1, 2, 3, ...}', the macro should still behave correctly.
The bug was found while testing the 'drivers/iio/adc/ad7606.c', specifically the oversampling feature.
For reference, the oversampling values are listed as:
static const unsigned int ad7606_oversampling_avail[7] = {
1, 2, 4, 8, 16, 32, 64,};
When doing:
1. $ echo 1 > /sys/bus/iio/devices/iio\:device0/oversampling_ratio
$ cat /sys/bus/iio/devices/iio\:device0/oversampling_ratio
1 # this is fine
2. $ echo 2 > /sys/bus/iio/devices/iio\:device0/oversampling_ratio
$ cat /sys/bus/iio/devices/iio\:device0/oversampling_ratio
1 # this is wrong; 2 should be returned here
3. $ echo 3 > /sys/bus/iio/devices/iio\:device0/oversampling_ratio
$ cat /sys/bus/iio/devices/iio\:device0/oversampling_ratio
2 # this is fine
4. $ echo 4 > /sys/bus/iio/devices/iio\:device0/oversampling_ratio
$ cat /sys/bus/iio/devices/iio\:device0/oversampling_ratio
4 # this is fine
And from here-on, the values are as correct (one gets what one would
expect.)While writing a kunit test for this bug, a peculiar issue was found for the array in the 'drivers/hwmon/ina2xx.c' & 'drivers/iio/adc/ina2xx-adc.c' drivers. While running the kunit test (for 'ina226_avg_tab' from these drivers):
* idx = find_closest([-1 to 2], ina226_avg_tab, ARRAY_SIZE(ina226_avg_tab));
This returns idx == 0, so value. * idx = find_closest(3, ina226_avg_tab, ARRAY_SIZE(ina226_avg_tab)); This returns idx == 0, value 1; and now one could argue whether 3 is closer to 4 or to 1. This quirk only appears for value '3' in this array, but it seems to be a another rounding issue.
* And from 4 onwards the 'find_closest'() works fine (one gets what one would expect).
This change reworks the find_closest() macros to also check the difference between the left and right elements when 'x'. If the distance to the right is smaller (than the distance to the left), the index is incremented by 1. This also makes redundant the need for using the DIV_ROUND_CLOSEST() macro.
In order to accommodate for any mix of negative + positive values, the internal variables '__fc_x', '__fc_mid_x', '__fc_left' & '__fc_right' are forced to 'long' type. This also addresses any potential bugs/issues with 'x' being of an unsigned type. In those situations any comparison between signed & unsigned would be promoted to a comparison between 2 unsigned numbers; this is especially annoying when '__fc_left' & '__fc_right' underflow.
The find_closest_descending() macro was also reworked and duplicated from the find_closest(), and it is being iterated in reverse. The main reason for this is to get the same indices as 'find_closest()' (but in reverse). The comparison for '__fc_right < __fc_left' favors going the array in ascending order.
For example for array '{ 1024, 512, 256, 128, 64, 16, 4, 1 }' and x = 3, we get:
__fc_mid_x = 2
__fc_left = -1
__fc_right = -2
Then '__fc_right < __fc_left' evaluates to true and '__fc_i++' becomes 7
which is not quite incorrect, but 3 is closer to 4 than to 1.This change has been validated with the kunit from the next patch.
--- include/linux/util_macros.h | 56 +++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 16 deletions(-)
include/linux/util_macros.h +40 -16
@@ -2,19 +2,6 @@#ifndef _LINUX_HELPER_MACROS_H_#define _LINUX_HELPER_MACROS_H_ -#define __find_closest (x, a, as, op) \ -({ \ - typeof(as) __fc_i, __fc_as = (as) - 1; \ - typeof(x) __fc_x = (x); \ - typeof(*a) const *__fc_a = (a); \ - for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \ - if (__fc_x op DIV_ROUND_CLOSEST(__fc_a[__fc_i] + \ - __fc_a[__fc_i + 1], 2)) \ - break; \ - } \ - (__fc_i); \ -}) -/** * find_closest - locate the closest element in a sorted array * @x: The reference value.
@@ -23,8 +10,27 @@* @as: Size of 'a'. * * Returns the index of the element closest to 'x'. +* Note: If using an array of negative numbers (or mixed positive numbers), +* then be sure that 'x' is of a signed-type to get good results. */ -#define find_closest (x, a, as) __find_closest(x, a, as, <=) +#define find_closest (x, a, as) \ +({ \ + typeof(as) __fc_i, __fc_as = (as) - 1; \ + long __fc_mid_x, __fc_x = (x); \ + long __fc_left, __fc_right; \ + typeof(*a) const *__fc_a = (a); \ + for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \ + __fc_mid_x = (__fc_a[__fc_i] + __fc_a[__fc_i + 1]) / 2; \ + if (__fc_x <= __fc_mid_x) { \ + __fc_left = __fc_x - __fc_a[__fc_i]; \ + __fc_right = __fc_a[__fc_i + 1] - __fc_x; \ + if (__fc_right < __fc_left) \ + __fc_i++; \ + break; \ + } \ + } \ + (__fc_i); \ +})/** * find_closest_descending - locate the closest element in a sorted array
@@ -34,9 +40,27 @@* @as: Size of 'a'. * * Similar to find_closest() but 'a' is expected to be sorted in descending -* order. +* order. The iteration is done in reverse order, so that the comparison +* of '__fc_right' & '__fc_left' also works for unsigned numbers. */ -#define find_closest_descending (x, a, as) __find_closest(x, a, as, >=) +#define find_closest_descending (x, a, as) \ +({ \ + typeof(as) __fc_i, __fc_as = (as) - 1; \ + long __fc_mid_x, __fc_x = (x); \ + long __fc_left, __fc_right; \ + typeof(*a) const *__fc_a = (a); \ + for (__fc_i = __fc_as; __fc_i >= 1; __fc_i--) { \ + __fc_mid_x = (__fc_a[__fc_i] + __fc_a[__fc_i - 1]) / 2; \ + if (__fc_x <= __fc_mid_x) { \ + __fc_left = __fc_x - __fc_a[__fc_i]; \ + __fc_right = __fc_a[__fc_i - 1] - __fc_x; \ + if (__fc_right < __fc_left) \ + __fc_i--; \ + break; \ + } \ + } \ + (__fc_i); \ +})/** * is_insidevar - check if the @ptr points inside the @var memory range.
Greg Kroah-Hartman
maintainerPATCH 317/459 scsi: ufs: exynos: Fix hibern8 notify callbacks
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Griffin <[email protected]>
commit ceef938bbf8b93ba3a218b4adc244cde94b582aa upstream.
v1 of the patch which introduced the ufshcd_vops_hibern8_notify() callback used a bool instead of an enum. In v2 this was updated to an enum based on the review feedback in [1].
ufs-exynos hibernate calls have always been broken upstream as it follows the v1 bool implementation.
--- drivers/scsi/ufs/ufs-exynos.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/scsi/ufs/ufs-exynos.c +8 -8
@@ -1051,12 +1051,12 @@ static void exynos_ufs_dev_hw_reset(struhci_writel (ufs,1 <<0 ,HCI_GPIO_OUT ); } -static void exynos_ufs_pre_hibern8 (struct ufs_hba *hba,u8 enter) +static void exynos_ufs_pre_hibern8 (struct ufs_hba *hba,enum uic_cmd_dme cmd) {struct exynos_ufs *ufs =ufshcd_get_variant (hba);struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; -if (!enter) { +if (cmd ==UIC_CMD_DME_HIBER_EXIT ) {if (ufs->opts &EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL )exynos_ufs_disable_auto_ctrl_hcc (ufs);exynos_ufs_ungate_clks (ufs);
@@ -1084,11 +1084,11 @@ static void exynos_ufs_pre_hibern8(struc } } -static void exynos_ufs_post_hibern8 (struct ufs_hba *hba,u8 enter) +static void exynos_ufs_post_hibern8 (struct ufs_hba *hba,enum uic_cmd_dme cmd) {struct exynos_ufs *ufs =ufshcd_get_variant (hba); -if (!enter) { +if (cmd ==UIC_CMD_DME_HIBER_EXIT ) {u32 cur_mode =0 ;u32 pwrmode;
@@ -1107,7 +1107,7 @@ static void exynos_ufs_post_hibern8(struif (!(ufs->opts &EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB ))exynos_ufs_establish_connt (ufs); - }else { + }else if (cmd ==UIC_CMD_DME_HIBER_ENTER ) { ufs->entry_hibern8_t =ktime_get ();exynos_ufs_gate_clks (ufs);if (ufs->opts &EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL )
@@ -1176,15 +1176,15 @@ static int exynos_ufs_pwr_change_notify( }static void exynos_ufs_hibern8_notify (struct ufs_hba *hba, -enum uic_cmd_dme enter, +enum uic_cmd_dme cmd,enum ufs_notify_change_status notify) {switch ((u8 )notify) {case PRE_CHANGE : -exynos_ufs_pre_hibern8 (hba, enter); +exynos_ufs_pre_hibern8 (hba, cmd);break ;case POST_CHANGE : -exynos_ufs_post_hibern8 (hba, enter); +exynos_ufs_post_hibern8 (hba, cmd);break ; } }
Greg Kroah-Hartman
maintainerPATCH 318/459 i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit 3082990592f7c6d7510a9133afa46e31bbe26533 upstream.
if (dev->boardinfo && dev->boardinfo->init_dyn_addr)
^^^ here check "init_dyn_addr" i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, ...) ^^^^ free "dyn_addr"
Fix copy/paste error "dyn_addr" by replacing it with "init_dyn_addr".
--- drivers/i3c/master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master.c +1 -1
@@ -1285,7 +1285,7 @@ static void i3c_master_put_i3c_addrs(str I3C_ADDR_SLOT_FREE);if (dev->boardinfo && dev->boardinfo->init_dyn_addr) -i3c_bus_set_addr_slot_status (&master->bus, dev->info.dyn_addr, +i3c_bus_set_addr_slot_status (&master->bus, dev->boardinfo->init_dyn_addr,I3C_ADDR_SLOT_FREE ); }
Greg Kroah-Hartman
maintainerPATCH 319/459 PCI: keystone: Add link up check to ks_pcie_other_map_bus()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kishon Vijay Abraham I <[email protected]>
commit 9e9ec8d8692a6f64d81ef67d4fb6255af6be684b upstream.
K2G forwards the error triggered by a link-down state (e.g., no connected endpoint device) on the system bus for PCI configuration transactions; these errors are reported as an SError at system level, which is fatal and hangs the system.
So, apply fix similar to how it was done in the DesignWare Core driver commit 15b23906347c ("PCI: dwc: Add link up check in dw_child_pcie_ops.map_bus()").
--- drivers/pci/controller/dwc/pci-keystone.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/pci/controller/dwc/pci-keystone.c +11 -0
@@ -446,6 +446,17 @@ static void __iomem *ks_pcie_other_map_bstruct keystone_pcie *ks_pcie =to_keystone_pcie (pci);u32 reg; +/* +* Checking whether the link is up here is a last line of defense +* against platforms that forward errors on the system bus as +* SError upon PCI configuration transactions issued when the link +* is down. This check is racy by definition and does not stop +* the system from triggering an SError if the link goes down +* after this check is performed. +*/ +if (!dw_pcie_link_up (pci)) +return NULL ; + reg =CFG_BUS (bus->number) |CFG_DEVICE (PCI_SLOT (devfn)) |CFG_FUNC (PCI_FUNC (devfn));if (!pci_is_root_bus (bus->parent))
Greg Kroah-Hartman
maintainerPATCH 320/459 dm thin: Add missing destroy_work_on_stack()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Can <[email protected]>
commit e74fa2447bf9ed03d085b6d91f0256cc1b53f1a8 upstream.
This commit add missed destroy_work_on_stack() operations for pw->worker in pool_work_wait().
--- drivers/md/dm-thin.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-thin.c +1 -0
@@ -2468,6 +2468,7 @@ static void pool_work_wait(struct pool_winit_completion (&pw->complete);queue_work (pool->wq, &pw->worker);wait_for_completion (&pw->complete); +destroy_work_on_stack (&pw->worker); }/*----------------------------------------------------------------*/
Greg Kroah-Hartman
maintainerPATCH 321/459 nfsd: make sure exp active before svc_export_show
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
commit be8f982c369c965faffa198b46060f8853e0f1f0 upstream.
The function e_show was called with protection from RCU. This only ensures that exp will not be freed. Therefore, the reference count for exp can drop to zero, which will trigger a refcount use-after-free warning when exp_get is called. To resolve this issue, use cache_get_rcu to ensure that exp remains active.
------------[ cut here ]------------ refcount_t: addition on 0; use-after-free. WARNING: CPU: 3 PID: 819 at lib/refcount.c:25 refcount_warn_saturate+0xb1/0x120 CPU: 3 UID: 0 PID: 819 Comm: cat Not tainted 6.12.0-rc3+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:refcount_warn_saturate+0xb1/0x120 ... Call Trace: <TASK> e_show+0x20b/0x230 [nfsd] seq_read_iter+0x589/0x770 seq_read+0x1e5/0x270 vfs_read+0x125/0x530 ksys_read+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- fs/nfsd/export.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfsd/export.c +4 -1
@@ -1318,9 +1318,12 @@ static int e_show(struct seq_file *m, voreturn 0 ; } -exp_get (exp); +if (!cache_get_rcu (&exp->h)) +return 0 ; +if (cache_check (cd, &exp->h,NULL ))return 0 ; +exp_put (exp);return svc_export_show (m, cd, cp); }
Greg Kroah-Hartman
maintainerPATCH 322/459 nfsd: fix nfs4_openowner leak when concurrent nfsd4_open occur
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
commit 98100e88dd8865999dc6379a3356cd799795fe7b upstream.
The action force umount(umount -f) will attempt to kill all rpc_task even umount operation may ultimately fail if some files remain open. Consequently, if an action attempts to open a file, it can potentially send two rpc_task to nfs server.
NFS CLIENT
thread1 thread2open("file")
...nfs4_do_open
_nfs4_do_open
_nfs4_open_and_get_state
_nfs4_proc_open
nfs4_run_open_task
/* rpc_task1 */
rpc_run_task
rpc_wait_for_completion_task
umount -f
nfs_umount_begin
rpc_killall_tasks
rpc_signal_task
rpc_task1 been wakeup
and return -512
_nfs4_do_open // while loop
...
nfs4_run_open_task
/* rpc_task2 */
rpc_run_task
rpc_wait_for_completion_taskWhile processing an open request, nfsd will first attempt to find or allocate an nfs4_openowner. If it finds an nfs4_openowner that is not marked as NFS4_OO_CONFIRMED, this nfs4_openowner will released. Since two rpc_task can attempt to open the same file simultaneously from the client to server, and because two instances of nfsd can run concurrently, this situation can lead to lots of memory leak. Additionally, when we echo 0 to /proc/fs/nfsd/threads, warning will be triggered.
NFS SERVER
nfsd1 nfsd2 echo 0 > /proc/fs/nfsd/threads
nfsd4_open
nfsd4_process_open1
find_or_alloc_open_stateowner
// alloc oo1, stateid1
nfsd4_open
nfsd4_process_open1
find_or_alloc_open_stateowner
// find oo1, without NFS4_OO_CONFIRMED
release_openowner
unhash_openowner_locked
list_del_init(&oo->oo_perclient)
// cannot find this oo
// from client, LEAK!!!
alloc_stateowner // alloc oo2 nfsd4_process_open2
init_open_stateid
// associate oo1
// with stateid1, stateid1 LEAK!!!
nfs4_get_vfs_file
// alloc nfsd_file1 and nfsd_file_mark1
// all LEAK!!!
nfsd4_process_open2
...
write_threads
...
nfsd_destroy_serv
nfsd_shutdown_net
nfs4_state_shutdown_net
nfs4_state_destroy_net
destroy_client
__destroy_client
// won't find oo1!!!
nfsd_shutdown_generic
nfsd_file_cache_shutdown
kmem_cache_destroy
for nfsd_file_slab
and nfsd_file_mark_slab
// bark since nfsd_file1
// and nfsd_file_mark1
// still alive=======================================================================
BUG nfsd_file (Not tainted): Objects remaining in nfsd_file on __kmem_cache_shutdown()
-----------------------------------------------------------------------
Slab 0xffd4000004438a80 objects=34 used=1 fp=0xff11000110e2ad28 flags=0x17ffffc0000240(workingset|head|node=0|zone=2|lastcpupid=0x1fffff)
CPU: 4 UID: 0 PID: 757 Comm: sh Not tainted 6.12.0-rc6+ #19 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x53/0x70 slab_err+0xb0/0xf0 __kmem_cache_shutdown+0x15c/0x310 kmem_cache_destroy+0x66/0x160 nfsd_file_cache_shutdown+0xac/0x210 [nfsd] nfsd_destroy_serv+0x251/0x2a0 [nfsd] nfsd_svc+0x125/0x1e0 [nfsd] write_threads+0x16a/0x2a0 [nfsd] nfsctl_transaction_write+0x74/0xa0 [nfsd] vfs_write+0x1ae/0x6d0 ksys_write+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
Disabling lock debugging due to kernel taint
Object 0xff11000110e2ac38 @offset=3128
Allocated in nfsd_file_do_acquire+0x20f/0xa30 [nfsd] age=1635 cpu=3 pid=800
nfsd_file_do_acquire+0x20f/0xa30 [nfsd] nfsd_file_acquire_opened+0x5f/0x90 [nfsd] nfs4_get_vfs_file+0x4c9/0x570 [nfsd] nfsd4_process_open2+0x713/0x1070 [nfsd] nfsd4_open+0x74b/0x8b0 [nfsd] nfsd4_proc_compound+0x70b/0xc20 [nfsd] nfsd_dispatch+0x1b4/0x3a0 [nfsd] svc_process_common+0x5b8/0xc50 [sunrpc] svc_process+0x2ab/0x3b0 [sunrpc] svc_handle_xprt+0x681/0xa20 [sunrpc] nfsd+0x183/0x220 [nfsd] kthread+0x199/0x1e0 ret_from_fork+0x31/0x60 ret_from_fork_asm+0x1a/0x30
Add nfs4_openowner_unhashed to help found unhashed nfs4_openowner, and break nfsd4_open process to fix this problem.
--- fs/nfsd/nfs4state.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
fs/nfsd/nfs4state.c +19 -0
@@ -1628,6 +1628,14 @@ static void release_open_stateid(structfree_ol_stateid_reaplist (&reaplist); } +static bool nfs4_openowner_unhashed (struct nfs4_openowner *oo) +{ +lockdep_assert_held (&oo->oo_owner.so_client->cl_lock); + +return list_empty (&oo->oo_owner.so_strhash) && +list_empty (&oo->oo_perclient); +} +static void unhash_openowner_locked (struct nfs4_openowner *oo) {struct nfs4_client *clp = oo->oo_owner.so_client;
@@ -4634,6 +4642,12 @@ retry:spin_lock (&oo->oo_owner.so_client->cl_lock);spin_lock (&fp->fi_lock); +if (nfs4_openowner_unhashed (oo)) { +mutex_unlock (&stp->st_mutex); + stp =NULL ; + goto out_unlock; + } + retstp =nfsd4_find_existing_open (fp, open);if (retstp) goto out_unlock;
@@ -5708,6 +5722,11 @@ nfsd4_process_open2(struct svc_rqst *rqsif (!stp) { stp =init_open_stateid (fp, open); +if (!stp) { + status = nfserr_jukebox; + goto out; + } +if (!open->op_stp) new_stp = true; }
Greg Kroah-Hartman
maintainerPATCH 323/459 btrfs: dont BUG_ON on ENOMEM from btrfs_lookup_extent_info() in walk_down_proc()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit a580fb2c3479d993556e1c31b237c9e5be4944a3 upstream.
We handle errors here properly, ENOMEM isn't fatal, return the error.
--- fs/btrfs/extent-tree.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/extent-tree.c +0 -1
@@ -4878,7 +4878,6 @@ static noinline int walk_down_proc(struc eb->start, level,1 , &wc->refs[level], &wc->flags[level]); -BUG_ON (ret == -ENOMEM );if (ret)return ret;if (unlikely (wc->refs[level] ==0 )) {
Greg Kroah-Hartman
maintainerPATCH 324/459 drm/etnaviv: flush shader L1 cache after user commandstream
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Stach <[email protected]>
commit 4f8dbadef085ab447a01a8d4806a3f629fea05ed upstream.
The shader L1 cache is a writeback cache for shader loads/stores and thus must be flushed before any BOs backing the shader buffers are potentially freed.
--- drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_buffer.c +2 -1
@@ -481,7 +481,8 @@ void etnaviv_buffer_queue(struct etnaviv }else {CMD_LOAD_STATE (buffer,VIVS_GL_FLUSH_CACHE ,VIVS_GL_FLUSH_CACHE_DEPTH | -VIVS_GL_FLUSH_CACHE_COLOR ); +VIVS_GL_FLUSH_CACHE_COLOR | +VIVS_GL_FLUSH_CACHE_SHADER_L1 );if (has_blt) {CMD_LOAD_STATE (buffer,VIVS_BLT_ENABLE ,0x1 );CMD_LOAD_STATE (buffer,VIVS_BLT_SET_COMMAND ,0x1 );
Greg Kroah-Hartman
maintainerPATCH 325/459 iTCO_wdt: mask NMI_NOW bit for update_no_reboot_bit() call
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksandr Ocheretnyi <[email protected]>
[ Upstream commit daa814d784ac034c62ab3fb0ef83daeafef527e2 ]
Commit da23b6faa8bf ("watchdog: iTCO: Add support for Cannon Lake PCH iTCO") does not mask NMI_NOW bit during TCO1_CNT register's value comparison for update_no_reboot_bit() call causing following failure:
...
iTCO_vendor_support: vendor-support=0
iTCO_wdt iTCO_wdt: unable to reset NO_REBOOT flag, device
disabled by hardware/BIOS
...
and this can lead to unexpected NMIs later during regular crashkernel's workflow because of watchdog probe call failures.
This change masks NMI_NOW bit for TCO1_CNT register values to avoid unexpected NMI_NOW bit inversions.
--- drivers/watchdog/iTCO_wdt.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/watchdog/iTCO_wdt.c +19 -2
@@ -84,6 +84,13 @@#define TCO2_CNT (p) (TCOBASE(p) + 0x0a)/* TCO2 Control Register */ #define TCOv2_TMR (p) (TCOBASE(p) + 0x12)/* TCOv2 Timer Initial Value*/ +/* +* NMI_NOW is bit 8 of TCO1_CNT register +* Read/Write +* This bit is implemented as RW but has no effect on HW. +*/ +#define NMI_NOW BIT(8) +/* internal variables */ struct iTCO_wdt_private {struct watchdog_device wddev;
@@ -222,13 +229,23 @@ static int update_no_reboot_bit_cnt(void *priv, bool set)struct iTCO_wdt_private *p = priv;u16 val, newval; - val =inw (TCO1_CNT (p)); +/* +* writing back 1b1 to NMI_NOW of TCO1_CNT register +* causes NMI_NOW bit inversion what consequently does +* not allow to perform the register's value comparison +* properly. +* +* NMI_NOW bit masking for TCO1_CNT register values +* helps to avoid possible NMI_NOW bit inversions on +* following write operation. +*/ + val =inw (TCO1_CNT (p)) & ~NMI_NOW ;if (set) val |=BIT (0 );else val &= ~BIT (0 );outw (val,TCO1_CNT (p)); - newval =inw (TCO1_CNT (p)); + newval =inw (TCO1_CNT (p)) & ~NMI_NOW ;/* make sure the update is successful */ return val != newval ? -EIO :0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 326/459 watchdog: mediatek: Make sure system reset gets asserted in mtk_wdt_restart()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yassine Oudjana <[email protected]>
[ Upstream commit a1495a21e0b8aad92132dfcf9c6fffc1bde9d5b2 ]
Clear the IRQ enable bit of WDT_MODE before asserting software reset in order to make TOPRGU issue a system reset signal instead of an IRQ.
--- drivers/watchdog/mtk_wdt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/watchdog/mtk_wdt.c +6 -0
@@ -153,9 +153,15 @@ static int mtk_wdt_restart(struct watchdog_device *wdt_dev, {struct mtk_wdt_dev *mtk_wdt =watchdog_get_drvdata (wdt_dev);void __iomem *wdt_base; +u32 reg; wdt_base = mtk_wdt->wdt_base; +/* Enable reset in order to issue a system reset instead of an IRQ */ + reg =readl (wdt_base +WDT_MODE ); + reg &= ~WDT_MODE_IRQ_EN ; +writel (reg |WDT_MODE_KEY , wdt_base +WDT_MODE ); +while (1 ) {writel (WDT_SWRST_KEY , wdt_base +WDT_SWRST );mdelay (5 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 327/459 can: sun4i_can: sun4i_can_err(): call can_change_state() even if cf is NULL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dario Binacchi <[email protected]>
[ Upstream commit ee6bf3677ae03569d833795064e17f605c2163c7 ]
Call the function can_change_state() if the allocation of the skb fails, as it handles the cf parameter when it is null.
Additionally, this ensures that the statistics related to state error counters (i. e. warning, passive, and bus-off) are updated.
--- drivers/net/can/sun4i_can.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/sun4i_can.c +4 -4
@@ -613,10 +613,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) tx_state = txerr >= rxerr ? state :0 ; rx_state = txerr <= rxerr ? state :0 ; -if (likely (skb)) -can_change_state (dev, cf, tx_state, rx_state); -else - priv->can.state = state; +/* The skb allocation might fail, but can_change_state() +* handles cf == NULL. +*/ +can_change_state (dev, cf, tx_state, rx_state);if (state ==CAN_STATE_BUS_OFF )can_bus_off (dev); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 328/459 can: sun4i_can: sun4i_can_err(): fix {rx,tx}_errors statistics
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dario Binacchi <[email protected]>
[ Upstream commit 595a81988a6fe06eb5849e972c8b9cb21c4e0d54 ]
The sun4i_can_err() function only incremented the receive error counter and never the transmit error counter, even if the STA_ERR_DIR flag reported that an error had occurred during transmission.
Increment the receive/transmit error counter based on the value of the STA_ERR_DIR flag.
--- drivers/net/can/sun4i_can.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/can/sun4i_can.c +9 -5
@@ -563,11 +563,9 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)/* bus error interrupt */ netdev_dbg (dev,"bus error interrupt\n" ); priv->can.can_stats.bus_error++; - stats->rx_errors++; + ecc =readl (priv->base +SUN4I_REG_STA_ADDR );if (likely (skb)) { - ecc =readl (priv->base +SUN4I_REG_STA_ADDR ); - cf->can_id |=CAN_ERR_PROT |CAN_ERR_BUSERROR ;switch (ecc &SUN4I_STA_MASK_ERR ) {
@@ -585,9 +583,15 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) >> 16;break ; } -/* error occurred during transmission? */ -if ((ecc &SUN4I_STA_ERR_DIR ) ==0 ) + } + +/* error occurred during transmission? */ +if ((ecc &SUN4I_STA_ERR_DIR ) ==0 ) { +if (likely (skb)) cf->data[2 ] |=CAN_ERR_PROT_TX ; + stats->tx_errors++; + }else { + stats->rx_errors++; } }if (isrc &SUN4I_INT_ERR_PASSIVE ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 329/459 ipvs: fix UB due to uninitialized stack access in ip_vs_protocol_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinghao Jia <[email protected]>
[ Upstream commit 146b6f1112eb30a19776d6c323c994e9d67790db ]
Under certain kernel configurations when building with Clang/LLVM, the compiler does not generate a return or jump as the terminator instruction for ip_vs_protocol_init(), triggering the following objtool warning during build time:
vmlinux.o: warning: objtool: ip_vs_protocol_init() falls through to next function __initstub__kmod_ip_vs_rr__935_123_ip_vs_rr_init6()
At runtime, this either causes an oops when trying to load the ipvs module or a boot-time panic if ipvs is built-in. This same issue has been reported by the Intel kernel test robot previously.
Digging deeper into both LLVM and the kernel code reveals this to be a undefined behavior problem. ip_vs_protocol_init() uses a on-stack buffer of 64 chars to store the registered protocol names and leaves it uninitialized after definition. The function calls strnlen() when concatenating protocol names into the buffer. With CONFIG_FORTIFY_SOURCE strnlen() performs an extra step to check whether the last byte of the input char buffer is a null character (commit 3009f891bb9f ("fortify:
Allow strlen() and strnlen() to pass compile-time known lengths")). This, together with possibly other configurations, cause the following IR to be generated:
define hidden i32 @ip_vs_protocol_init() local_unnamed_addr #5 section ".init.text" align 16 !kcfi_type !29 {
%1 = alloca [64 x i8], align 16
...14: ; preds = %11
%15 = getelementptr inbounds i8, ptr %1, i64 63
%16 = load i8, ptr %15, align 1
%17 = tail call i1 @llvm.is.constant.i8(i8 %16)
%18 = icmp eq i8 %16, 0
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %20, label %23 20: ; preds = %14
%21 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #23
...
23: ; preds = %14, %11, %20
%24 = call i64 @strnlen(ptr noundef nonnull dereferenceable(1) %1, i64 noundef 64) #24
...
}The above code calculates the address of the last char in the buffer (value %15) and then loads from it (value %16). Because the buffer is never initialized, the LLVM GVN pass marks value %16 as undefined:
%13 = getelementptr inbounds i8, ptr %1, i64 63
br i1 undef, label %14, label %17
This gives later passes (SCCP, in particular) more DCE opportunities by propagating the undef value further, and eventually removes everything after the load on the uninitialized stack location:
define hidden i32 @ip_vs_protocol_init() local_unnamed_addr #0 section ".init.text" align 16 !kcfi_type !11 {
%1 = alloca [64 x i8], align 16
...
12: ; preds = %11
%13 = getelementptr inbounds i8, ptr %1, i64 63
unreachable
}In this way, the generated native code will just fall through to the next function, as LLVM does not generate any code for the unreachable IR instruction and leaves the function without a terminator.
Zero the on-stack buffer to avoid this possible UB.
--- net/netfilter/ipvs/ip_vs_proto.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/netfilter/ipvs/ip_vs_proto.c +1 -3
@@ -340,7 +340,7 @@ void __net_exit ip_vs_protocol_net_cleanup(struct netns_ipvs *ipvs)int __init ip_vs_protocol_init (void ) { -char protocols[64 ]; +char protocols[64 ] = {0 };#define REGISTER_PROTOCOL (p) \ do { \ register_ip_vs_protocol(p); \
@@ -348,8 +348,6 @@ int __init ip_vs_protocol_init(void)strcat (protocols, (p)->name); \ } while (0) - protocols[0 ] ='\0' ; - protocols[2 ] ='\0' ;#ifdef CONFIG_IP_VS_PROTO_TCP REGISTER_PROTOCOL (&ip_vs_protocol_tcp);#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 330/459 netfilter: x_tables: fix LED ID check in led_tg_check()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 04317f4eb2aad312ad85c1a17ad81fe75f1f9bc7 ]
Syzbot has reported the following BUG detected by KASAN:
BUG: KASAN: slab-out-of-bounds in strlen+0x58/0x70 Read of size 1 at addr ffff8881022da0c8 by task repro/5879 ... Call Trace: <TASK> dump_stack_lvl+0x241/0x360 ? __pfx_dump_stack_lvl+0x10/0x10 ? __pfx__printk+0x10/0x10 ? _printk+0xd5/0x120 ? __virt_addr_valid+0x183/0x530 ? __virt_addr_valid+0x183/0x530 print_report+0x169/0x550 ? __virt_addr_valid+0x183/0x530 ? __virt_addr_valid+0x183/0x530 ? __virt_addr_valid+0x45f/0x530 ? __phys_addr+0xba/0x170 ? strlen+0x58/0x70 kasan_report+0x143/0x180 ? strlen+0x58/0x70 strlen+0x58/0x70 kstrdup+0x20/0x80 led_tg_check+0x18b/0x3c0 xt_check_target+0x3bb/0xa40 ? __pfx_xt_check_target+0x10/0x10 ? stack_depot_save_flags+0x6e4/0x830 ? nft_target_init+0x174/0xc30 nft_target_init+0x82d/0xc30 ? __pfx_nft_target_init+0x10/0x10 ? nf_tables_newrule+0x1609/0x2980 ? nf_tables_newrule+0x1609/0x2980 ? rcu_is_watching+0x15/0xb0 ? nf_tables_newrule+0x1609/0x2980 ? nf_tables_newrule+0x1609/0x2980 ? __kmalloc_noprof+0x21a/0x400 nf_tables_newrule+0x1860/0x2980 ? __pfx_nf_tables_newrule+0x10/0x10 ? __nla_parse+0x40/0x60 nfnetlink_rcv+0x14e5/0x2ab0 ? __pfx_validate_chain+0x10/0x10 ? __pfx_nfnetlink_rcv+0x10/0x10 ? __lock_acquire+0x1384/0x2050 ? netlink_deliver_tap+0x2e/0x1b0 ? __pfx_lock_release+0x10/0x10 ? netlink_deliver_tap+0x2e/0x1b0 netlink_unicast+0x7f8/0x990 ? __pfx_netlink_unicast+0x10/0x10 ? __virt_addr_valid+0x183/0x530 ? __check_object_size+0x48e/0x900 netlink_sendmsg+0x8e4/0xcb0 ? __pfx_netlink_sendmsg+0x10/0x10 ? aa_sock_msg_perm+0x91/0x160 ? __pfx_netlink_sendmsg+0x10/0x10 __sock_sendmsg+0x223/0x270 ____sys_sendmsg+0x52a/0x7e0 ? __pfx_____sys_sendmsg+0x10/0x10 __sys_sendmsg+0x292/0x380 ? __pfx___sys_sendmsg+0x10/0x10 ? lockdep_hardirqs_on_prepare+0x43d/0x780 ? __pfx_lockdep_hardirqs_on_prepare+0x10/0x10 ? exc_page_fault+0x590/0x8c0 ? do_syscall_64+0xb6/0x230 do_syscall_64+0xf3/0x230 entry_SYSCALL_64_after_hwframe+0x77/0x7f ... </TASK>
Since an invalid (without '\0' byte at all) byte sequence may be passed from userspace, add an extra check to ensure that such a sequence is rejected as possible ID and so never passed to 'kstrdup()' and further.
--- net/netfilter/xt_LED.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/xt_LED.c +3 -1
@@ -97,7 +97,9 @@ static int led_tg_check(const struct xt_tgchk_param *par)struct xt_led_info_internal *ledinternal;int err; -if (ledinfo->id[0 ] =='\0' ) +/* Bail out if empty string or not a string at all. */ +if (ledinfo->id[0 ] =='\0' || + !memchr (ledinfo->id,'\0' ,sizeof (ledinfo->id)))return -EINVAL ;mutex_lock (&xt_led_mutex);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 331/459 ptp: Add error handling for adjfine callback in ptp_clock_adjtime
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ajay Kaher <[email protected]>
[ Upstream commit 98337d7c87577ded71114f6976edb70a163e27bc ]
ptp_clock_adjtime sets ptp->dialed_frequency even when adjfine callback returns an error. This causes subsequent reads to return an incorrect value.
Fix this by adding error check before ptp->dialed_frequency is set.
--- drivers/ptp/ptp_clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ptp/ptp_clock.c +2 -1
@@ -146,7 +146,8 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) err = ops->adjfine (ops, tx->freq); else err = ops->adjfreq (ops, ppb); - ptp->dialed_frequency = tx->freq; +if (!err) + ptp->dialed_frequency = tx->freq; }else if (tx->modes &ADJ_OFFSET ) {if (ops->adjphase) {s32 offset = tx->offset;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 332/459 net/sched: tbf: correct backlog statistic for GSO packets
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Ottens <[email protected]>
[ Upstream commit 1596a135e3180c92e42dd1fbcad321f4fb3e3b17 ]
When the length of a GSO packet in the tbf qdisc is larger than the burst size configured the packet will be segmented by the tbf_segment function. Whenever this function is used to enqueue SKBs, the backlog statistic of the tbf is not increased correctly. This can lead to underflows of the 'backlog' byte-statistic value when these packets are dequeued from tbf.
Reproduce the bug:
Ensure that the sender machine has GSO enabled. Configured the tbf on the outgoing interface of the machine as follows (burstsize = 1 MTU):
$ tc qdisc add dev <oif> root handle 1: tbf rate 50Mbit burst 1514 latency 50ms
Send bulk TCP traffic out via this interface, e.g., by running an iPerf3 client on this machine. Check the qdisc statistics:
$ tc -s qdisc show dev <oif>
The 'backlog' byte-statistic has incorrect values while traffic is transferred, e.g., high values due to u32 underflows. When the transfer is stopped, the value is != 0, which should never happen.
This patch fixes this bug by updating the statistics correctly, even if single SKBs of a GSO SKB cannot be enqueued.
--- net/sched/sch_tbf.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
net/sched/sch_tbf.c +12 -6
@@ -193,7 +193,7 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch,struct tbf_sched_data *q =qdisc_priv (sch);struct sk_buff *segs, *nskb;netdev_features_t features =netif_skb_features (skb); -unsigned int len =0 , prev_len =qdisc_pkt_len (skb); +unsigned int len =0 , prev_len =qdisc_pkt_len (skb), seg_len;int ret, nb; segs =skb_gso_segment (skb, features & ~NETIF_F_GSO_MASK );
@@ -204,21 +204,27 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch, nb =0 ; skb_list_walk_safe(segs, segs, nskb) {skb_mark_not_on_list (segs); -qdisc_skb_cb (segs)->pkt_len = segs->len; - len += segs->len; + seg_len = segs->len; +qdisc_skb_cb (segs)->pkt_len = seg_len; ret =qdisc_enqueue (segs, q->qdisc, to_free);if (ret !=NET_XMIT_SUCCESS ) {if (net_xmit_drop_count (ret))qdisc_qstats_drop (sch); }else { nb++; + len += seg_len; } } sch->q.qlen += nb; -if (nb >1 ) + sch->qstats.backlog += len; +if (nb >0 ) {qdisc_tree_reduce_backlog (sch,1 - nb, prev_len - len); -consume_skb (skb); -return nb >0 ?NET_XMIT_SUCCESS :NET_XMIT_DROP ; +consume_skb (skb); +return NET_XMIT_SUCCESS ; + } + +kfree_skb (skb); +return NET_XMIT_DROP ; } static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 333/459 net: hsr: avoid potential out-of-bound access in fill_frame_info()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b9653d19e556c6afd035602927a93d100a0d7644 ]
syzbot is able to feed a packet with 14 bytes, pretending it is a vlan one.
Since fill_frame_info() is relying on skb->mac_len already, extend the check to cover this case.
BUG: KMSAN: uninit-value in fill_frame_info net/hsr/hsr_forward.c:709 [inline] BUG: KMSAN: uninit-value in hsr_forward_skb+0x9ee/0x3b10 net/hsr/hsr_forward.c:724 fill_frame_info net/hsr/hsr_forward.c:709 [inline] hsr_forward_skb+0x9ee/0x3b10 net/hsr/hsr_forward.c:724 hsr_dev_xmit+0x2f0/0x350 net/hsr/hsr_device.c:235 __netdev_start_xmit include/linux/netdevice.h:5002 [inline] netdev_start_xmit include/linux/netdevice.h:5011 [inline] xmit_one net/core/dev.c:3590 [inline] dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3606 __dev_queue_xmit+0x366a/0x57d0 net/core/dev.c:4434 dev_queue_xmit include/linux/netdevice.h:3168 [inline] packet_xmit+0x9c/0x6c0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3146 [inline] packet_sendmsg+0x91ae/0xa6f0 net/packet/af_packet.c:3178 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:726 __sys_sendto+0x594/0x750 net/socket.c:2197 __do_sys_sendto net/socket.c:2204 [inline] __se_sys_sendto net/socket.c:2200 [inline] __x64_sys_sendto+0x125/0x1d0 net/socket.c:2200 x64_sys_call+0x346a/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4091 [inline] slab_alloc_node mm/slub.c:4134 [inline] kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4186 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:587 __alloc_skb+0x363/0x7b0 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1323 [inline] alloc_skb_with_frags+0xc8/0xd00 net/core/skbuff.c:6612 sock_alloc_send_pskb+0xa81/0xbf0 net/core/sock.c:2881 packet_alloc_skb net/packet/af_packet.c:2995 [inline] packet_snd net/packet/af_packet.c:3089 [inline] packet_sendmsg+0x74c6/0xa6f0 net/packet/af_packet.c:3178 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:726 __sys_sendto+0x594/0x750 net/socket.c:2197 __do_sys_sendto net/socket.c:2204 [inline] __se_sys_sendto net/socket.c:2200 [inline] __x64_sys_sendto+0x125/0x1d0 net/socket.c:2200 x64_sys_call+0x346a/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/hsr/hsr_forward.c | 2 ++ 1 file changed, 2 insertions(+)
net/hsr/hsr_forward.c +2 -0
@@ -525,6 +525,8 @@ static int fill_frame_info(struct hsr_frame_info *frame, frame->is_vlan = true;if (frame->is_vlan) { + if (skb->mac_len < offsetofend(struct hsr_vlan_ethhdr, vlanhdr)) +return -EINVAL ; vlan_hdr = (struct hsr_vlan_ethhdr *)ethhdr; proto = vlan_hdr->vlanhdr.h_vlan_encapsulated_proto;/* FIXME: */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 334/459 can: j1939: j1939_session_new(): fix skb reference counting
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit a8c695005bfe6569acd73d777ca298ddddd66105 ]
Since j1939_session_skb_queue() does an extra skb_get() for each new skb, do the same for the initial one in j1939_session_new() to avoid refcount underflow.
--- net/can/j1939/transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/can/j1939/transport.c +1 -1
@@ -1489,7 +1489,7 @@ static struct j1939_session *j1939_session_new(struct j1939_priv *priv, session->state =J1939_SESSION_NEW ;skb_queue_head_init (&session->skb_queue); -skb_queue_tail (&session->skb_queue, skb); +skb_queue_tail (&session->skb_queue,skb_get (skb)); skcb =j1939_skb_to_cb (skb);memcpy (&session->skcb, skcb,sizeof (session->skcb));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 335/459 net/ipv6: release expired exception dst cached in socket
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Wiesner <[email protected]>
[ Upstream commit 3301ab7d5aeb0fe270f73a3d4810c9d1b6a9f045 ]
Dst objects get leaked in ip6_negative_advice() when this function is executed for an expired IPv6 route located in the exception table. There are several conditions that must be fulfilled for the leak to occur:
* an ICMPv6 packet indicating a change of the MTU for the path is received, resulting in an exception dst being created
* a TCP connection that uses the exception dst for routing packets must start timing out so that TCP begins retransmissions
* after the exception dst expires, the FIB6 garbage collector must not run before TCP executes ip6_negative_advice() for the expired exception dst
When TCP executes ip6_negative_advice() for an exception dst that has expired and if no other socket holds a reference to the exception dst, the refcount of the exception dst is 2, which corresponds to the increment made by dst_init() and the increment made by the TCP socket for which the connection is timing out. The refcount made by the socket is never released. The refcount of the dst is decremented in sk_dst_reset() but that decrement is counteracted by a dst_hold() intentionally placed just before the sk_dst_reset() in ip6_negative_advice(). After ip6_negative_advice() has finished, there is no other object tied to the dst. The socket lost its reference stored in sk_dst_cache and the dst is no longer in the exception table. The exception dst becomes a leaked object.
As a result of this dst leak, an unbalanced refcount is reported for the loopback device of a net namespace being destroyed under kernels that do not contain e5f80fcf869a ("ipv6: give an IPv6 dev to blackhole_netdev"):unregister_netdevice: waiting for lo to become free. Usage count = 2
Fix the dst leak by removing the dst_hold() in ip6_negative_advice(). The patch that introduced the dst_hold() in ip6_negative_advice() was 92f1655aa2b22 ("net: fix __dst_negative_advice() race"). But 92f1655aa2b22 merely refactored the code with regards to the dst refcount so the issue was present even before 92f1655aa2b22. The bug was introduced in 54c1a859efd9f ("ipv6: Don't drop cache route entry unless timer actually expired.") where the expired cached route is deleted and the sk_dst_cache member of the socket is set to NULL by calling dst_negative_advice() but the refcount belonging to the socket is left unbalanced.
The IPv4 version - ipv4_negative_advice() - is not affected by this bug. When the TCP connection times out ipv4_negative_advice() merely resets the sk_dst_cache of the socket while decrementing the refcount of the exception dst.
--- net/ipv6/route.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv6/route.c +3 -3
@@ -2641,10 +2641,10 @@ static void ip6_negative_advice(struct sock *sk,if (rt->rt6i_flags &RTF_CACHE ) {rcu_read_lock ();if (rt6_check_expired (rt)) { -/* counteract the dst_release() in sk_dst_reset() */ -dst_hold (dst); +/* rt/dst can not be destroyed yet, +* because of rcu_read_lock() +*/ sk_dst_reset (sk); -rt6_remove_exception_rt (rt); }rcu_read_unlock ();
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 336/459 dccp: Fix memory leak in dccp_feat_change_recv
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Solodovnikov <[email protected]>
[ Upstream commit 22be4727a8f898442066bcac34f8a1ad0bc72e14 ]
If dccp_feat_push_confirm() fails after new value for SP feature was accepted without reconciliation ('entry == NULL' branch), memory allocated for that value with dccp_feat_clone_sp_val() is never freed.
Here is the kmemleak stack for this:
unreferenced object 0xffff88801d4ab488 (size 8):
comm "syz-executor310", pid 1127, jiffies 4295085598 (age 41.666s) hex dump (first 8 bytes):
01 b4 4a 1d 80 88 ff ff ..J.....
backtrace:
[<00000000db7cabfe>] kmemdup+0x23/0x50 mm/util.c:128
[<0000000019b38405>] kmemdup include/linux/string.h:465 [inline]
[<0000000019b38405>] dccp_feat_clone_sp_val net/dccp/feat.c:371 [inline]
[<0000000019b38405>] dccp_feat_clone_sp_val net/dccp/feat.c:367 [inline]
[<0000000019b38405>] dccp_feat_change_recv net/dccp/feat.c:1145 [inline]
[<0000000019b38405>] dccp_feat_parse_options+0x1196/0x2180 net/dccp/feat.c:1416
[<00000000b1f6d94a>] dccp_parse_options+0xa2a/0x1260 net/dccp/options.c:125
[<0000000030d7b621>] dccp_rcv_state_process+0x197/0x13d0 net/dccp/input.c:650
[<000000001f74c72e>] dccp_v4_do_rcv+0xf9/0x1a0 net/dccp/ipv4.c:688
[<00000000a6c24128>] sk_backlog_rcv include/net/sock.h:1041 [inline]
[<00000000a6c24128>] __release_sock+0x139/0x3b0 net/core/sock.c:2570
[<00000000cf1f3a53>] release_sock+0x54/0x1b0 net/core/sock.c:3111
[<000000008422fa23>] inet_wait_for_connect net/ipv4/af_inet.c:603 [inline]
[<000000008422fa23>] __inet_stream_connect+0x5d0/0xf70 net/ipv4/af_inet.c:696
[<0000000015b6f64d>] inet_stream_connect+0x53/0xa0 net/ipv4/af_inet.c:735
[<0000000010122488>] __sys_connect_file+0x15c/0x1a0 net/socket.c:1865
[<00000000b4b70023>] __sys_connect+0x165/0x1a0 net/socket.c:1882
[<00000000f4cb3815>] __do_sys_connect net/socket.c:1892 [inline]
[<00000000f4cb3815>] __se_sys_connect net/socket.c:1889 [inline]
[<00000000f4cb3815>] __x64_sys_connect+0x6e/0xb0 net/socket.c:1889
[<00000000e7b1e839>] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
[<0000000055e91434>] entry_SYSCALL_64_after_hwframe+0x67/0xd1Clean up the allocated memory in case of dccp_feat_push_confirm() failure and bail out with an error reset code.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- net/dccp/feat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/dccp/feat.c +5 -1
@@ -1160,8 +1160,12 @@ static u8 dccp_feat_change_recv(struct list_head *fn, u8 is_mandatory, u8 opt, goto not_valid_or_not_known; } -return dccp_feat_push_confirm (fn, feat, local, &fval); +if (dccp_feat_push_confirm (fn, feat, local, &fval)) { +kfree (fval.sp.vec); +return DCCP_RESET_CODE_TOO_BUSY ; + } +return 0 ; }else if (entry->state ==FEAT_UNSTABLE ) {/* 6.6.2 */ return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 337/459 tipc: Fix use-after-free of kernel socket in cleanup_bearer().
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 6a2fa13312e51a621f652d522d7e2df7066330b6 ]
syzkaller reported a use-after-free of UDP kernel socket in cleanup_bearer() without repro. [0][1]
When bearer_disable() calls tipc_udp_disable(), cleanup of the UDP kernel socket is deferred by work calling cleanup_bearer().
tipc_net_stop() waits for such works to finish by checking tipc_net(net)->wq_count. However, the work decrements the count too early before releasing the kernel socket, unblocking cleanup_net() and resulting in use-after-free.
Let's move the decrement after releasing the socket in cleanup_bearer().
[0]:ref_tracker: net notrefcnt@000000009b3d1faf has 1/1 users at
sk_alloc+0x438/0x608
inet_create+0x4c8/0xcb0
__sock_create+0x350/0x6b8
sock_create_kern+0x58/0x78
udp_sock_create4+0x68/0x398
udp_sock_create+0x88/0xc8
tipc_udp_enable+0x5e8/0x848
__tipc_nl_bearer_enable+0x84c/0xed8
tipc_nl_bearer_enable+0x38/0x60
genl_family_rcv_msg_doit+0x170/0x248
genl_rcv_msg+0x400/0x5b0
netlink_rcv_skb+0x1dc/0x398
genl_rcv+0x44/0x68
netlink_unicast+0x678/0x8b0
netlink_sendmsg+0x5e4/0x898
____sys_sendmsg+0x500/0x830[1]:
BUG: KMSAN: use-after-free in udp_hashslot include/net/udp.h:85 [inline] BUG: KMSAN: use-after-free in udp_lib_unhash+0x3b8/0x930 net/ipv4/udp.c:1979 udp_hashslot include/net/udp.h:85 [inline] udp_lib_unhash+0x3b8/0x930 net/ipv4/udp.c:1979 sk_common_release+0xaf/0x3f0 net/core/sock.c:3820 inet_release+0x1e0/0x260 net/ipv4/af_inet.c:437 inet6_release+0x6f/0xd0 net/ipv6/af_inet6.c:489 __sock_release net/socket.c:658 [inline] sock_release+0xa0/0x210 net/socket.c:686 cleanup_bearer+0x42d/0x4c0 net/tipc/udp_media.c:819 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xcaf/0x1c90 kernel/workqueue.c:3310 worker_thread+0xf6c/0x1510 kernel/workqueue.c:3391 kthread+0x531/0x6b0 kernel/kthread.c:389 ret_from_fork+0x60/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:244
Uninit was created at:
slab_free_hook mm/slub.c:2269 [inline] slab_free mm/slub.c:4580 [inline] kmem_cache_free+0x207/0xc40 mm/slub.c:4682 net_free net/core/net_namespace.c:454 [inline] cleanup_net+0x16f2/0x19d0 net/core/net_namespace.c:647 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xcaf/0x1c90 kernel/workqueue.c:3310 worker_thread+0xf6c/0x1510 kernel/workqueue.c:3391 kthread+0x531/0x6b0 kernel/kthread.c:389 ret_from_fork+0x60/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:244 CPU: 0 UID: 0 PID: 54 Comm: kworker/0:2 Not tainted 6.12.0-rc1-00131-gf66ebf37d69c #7 91723d6f74857f70725e1583cba3cf4adc716cfa Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 Workqueue: events cleanup_bearer
--- net/tipc/udp_media.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/udp_media.c +1 -1
@@ -810,10 +810,10 @@ static void cleanup_bearer(struct work_struct *work)kfree_rcu (rcast, rcu); } -atomic_dec (&tipc_net (sock_net (ub->ubsock->sk))->wq_count);dst_cache_destroy (&ub->rcast.dst_cache);udp_tunnel_sock_release (ub->ubsock);synchronize_net (); +atomic_dec (&tipc_net (sock_net (ub->ubsock->sk))->wq_count);kfree (ub); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 338/459 net/qed: allow old cards not supporting "num_images" to work
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Louis Leseur <[email protected]>
[ Upstream commit 7a0ea70da56ee8c2716d0b79e9959d3c47efab62 ]
Commit 43645ce03e00 ("qed: Populate nvm image attribute shadow.") added support for populating flash image attributes, notably "num_images". However, some cards were not able to return this information. In such cases, the driver would return EINVAL, causing the driver to exit.
Add check to return EOPNOTSUPP instead of EINVAL when the card is not able to return these information. The caller function already handles EOPNOTSUPP without error.
--- drivers/net/ethernet/qlogic/qed/qed_mcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_mcp.c +3 -1
@@ -3262,7 +3262,9 @@ int qed_mcp_bist_nvm_get_num_images(struct qed_hwfn *p_hwfn,if (rc)return rc; -if (((rsp &FW_MSG_CODE_MASK ) !=FW_MSG_CODE_OK )) +if (((rsp &FW_MSG_CODE_MASK ) ==FW_MSG_CODE_UNSUPPORTED )) + rc = -EOPNOTSUPP ; +else if (((rsp &FW_MSG_CODE_MASK ) !=FW_MSG_CODE_OK )) rc = -EINVAL ;return rc;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 339/459 igb: Fix potential invalid memory access in igb_init_module()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Can <[email protected]>
[ Upstream commit 0566f83d206c7a864abcd741fe39d6e0ae5eef29 ]
The pci_register_driver() can fail and when this happened, the dca_notifier needs to be unregistered, otherwise the dca_notifier can be called when igb fails to install, resulting to invalid memory access.
--- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +4 -0
@@ -666,6 +666,10 @@ static int __init igb_init_module(void)dca_register_notify (&dca_notifier);#endif ret =pci_register_driver (&igb_driver); +#ifdef CONFIG_IGB_DCA +if (ret) +dca_unregister_notify (&dca_notifier); +#endif return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 340/459 net: sched: fix erspan_opt settings in cls_flower
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 292207809486d99c78068d3f459cbbbffde88415 ]
When matching erspan_opt in cls_flower, only the (version, dir, hwid) fields are relevant. However, in fl_set_erspan_opt() it initializes all bits of erspan_opt and its mask to 1. This inadvertently requires packets to match not only the (version, dir, hwid) fields but also the other fields that are unexpectedly set to 1.
This patch resolves the issue by ensuring that only the (version, dir, hwid) fields are configured in fl_set_erspan_opt(), leaving the other fields to 0 in erspan_opt.
--- net/sched/cls_flower.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sched/cls_flower.c +3 -2
@@ -1218,7 +1218,6 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key,int err; md = (struct erspan_metadata *)&key->enc_opts.data[key->enc_opts.len]; -memset (md,0xff ,sizeof (*md)); md->version =1 ;if (!depth)
@@ -1247,9 +1246,9 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key,NL_SET_ERR_MSG (extack,"Missing tunnel key erspan option index" );return -EINVAL ; } +memset (&md->u.index,0xff ,sizeof (md->u.index));if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX ]) { nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX ]; -memset (&md->u,0x00 ,sizeof (md->u)); md->u.index =nla_get_be32 (nla); } }else if (md->version ==2 ) {
@@ -1258,10 +1257,12 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key,NL_SET_ERR_MSG (extack,"Missing tunnel key erspan option dir or hwid" );return -EINVAL ; } + md->u.md2.dir =1 ;if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_DIR ]) { nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_DIR ]; md->u.md2.dir =nla_get_u8 (nla); } +set_hwid (&md->u.md2,0xff );if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_HWID ]) { nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_HWID ];set_hwid (&md->u.md2,nla_get_u8 (nla));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 341/459 netfilter: ipset: Hold module reference while requesting a module
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit 456f010bfaefde84d3390c755eedb1b0a5857c3c ]
User space may unload ip_set.ko while it is itself requesting a set type backend module, leading to a kernel crash. The race condition may be provoked by inserting an mdelay() right after the nfnl_unlock() call.
--- net/netfilter/ipset/ip_set_core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/ipset/ip_set_core.c +5 -0
@@ -104,14 +104,19 @@ find_set_type(const char *name, u8 family, u8 revision)static bool load_settype (const char *name) { +if (!try_module_get (THIS_MODULE )) +return false; +nfnl_unlock (NFNL_SUBSYS_IPSET );pr_debug ("try to load ip_set_%s\n" , name);if (request_module ("ip_set_%s" , name) <0 ) {pr_warn ("Can't find ip_set type %s\n" , name);nfnl_lock (NFNL_SUBSYS_IPSET ); +module_put (THIS_MODULE );return false; }nfnl_lock (NFNL_SUBSYS_IPSET ); +module_put (THIS_MODULE );return true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 342/459 netfilter: nft_set_hash: skip duplicated elements pending gc run
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 7ffc7481153bbabf3332c6a19b289730c7e1edf5 ]
rhashtable does not provide stable walk, duplicated elements are possible in case of resizing. I considered that checking for errors when calling rhashtable_walk_next() was sufficient to detect the resizing. However, rhashtable_walk_next() returns -EAGAIN only at the end of the iteration, which is too late, because a gc work containing duplicated elements could have been already scheduled for removal to the worker.
Add a u32 gc worker sequence number per set, bump it on every workqueue run. Annotate gc worker sequence number on the expired element. Use it to skip those already seen in this gc workqueue run.
Note that this new field is never reset in case gc transaction fails, so next gc worker run on the expired element overrides it. Wraparound of gc worker sequence number should not be an issue with stale gc worker sequence number in the element, that would just postpone the element removal in one gc run.
Note that it is not possible to use flags to annotate that element is pending gc run to detect duplicates, given that gc transaction can be invalidated in case of update from the control plane, therefore, not allowing to clear such flag.
On x86_64, pahole reports no changes in the size of nft_rhash_elem.
--- net/netfilter/nft_set_hash.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/netfilter/nft_set_hash.c +16 -0
@@ -27,10 +27,12 @@ extern unsigned int nf_tables_net_id;struct nft_rhash {struct rhashtable ht;struct delayed_work gc_work; +u32 wq_gc_seq; };struct nft_rhash_elem {struct rhash_head node; +u32 wq_gc_seq;struct nft_set_ext ext; };
@@ -325,6 +327,10 @@ static void nft_rhash_gc(struct work_struct *work)if (!gc) goto done; +/* Elements never collected use a zero gc worker sequence number. */ +if (unlikely (++priv->wq_gc_seq ==0 )) + priv->wq_gc_seq++; +rhashtable_walk_enter (&priv->ht, &hti);rhashtable_walk_start (&hti);
@@ -342,6 +348,14 @@ static void nft_rhash_gc(struct work_struct *work) goto try_later; } +/* rhashtable walk is unstable, already seen in this gc run? +* Then, skip this element. In case of (unlikely) sequence +* wraparound and stale element wq_gc_seq, next gc run will +* just find this expired element. +*/ +if (he->wq_gc_seq == priv->wq_gc_seq) +continue ; +if (nft_set_elem_is_dead (&he->ext)) goto dead_elem;
@@ -362,6 +376,8 @@ static void nft_rhash_gc(struct work_struct *work)if (!gc) goto try_later; +/* annotate gc sequence for this attempt. */ + he->wq_gc_seq = priv->wq_gc_seq;nft_trans_gc_elem_add (gc, he); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 343/459 ethtool: Fix wrong mod state in case of verbose and no_mask bitset
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kory Maincent <[email protected]>
[ Upstream commit 910c4788d6155b2202ec88273376cd7ecdc24f0a ]
A bitset without mask in a _SET request means we want exactly the bits in the bitset to be set. This works correctly for compact format but when verbose format is parsed, ethnl_update_bitset32_verbose() only sets the bits present in the request bitset but does not clear the rest. The commit 6699170376ab ("ethtool: fix application of verbose no_mask bitset") fixes this issue by clearing the whole target bitmap before we start iterating. The solution proposed brought an issue with the behavior of the mod variable. As the bitset is always cleared the old value will always differ to the new value.
Fix it by adding a new function to compare bitmaps and a temporary variable which save the state of the old bitmap.
--- net/ethtool/bitset.c | 48 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-)
net/ethtool/bitset.c +44 -4
@@ -425,12 +425,32 @@ static int ethnl_parse_bit(unsigned int *index, bool *val, unsigned int nbits,return 0 ; } +/** +* ethnl_bitmap32_equal() - Compare two bitmaps +* @map1: first bitmap +* @map2: second bitmap +* @nbits: bit size to compare +* +* Return: true if first @nbits are equal, false if not +*/ +static bool ethnl_bitmap32_equal (const u32 *map1,const u32 *map2, +unsigned int nbits) +{ +if (memcmp (map1, map2, nbits /32 *sizeof (u32))) +return false; +if (nbits %32 ==0 ) +return true; +return !((map1[nbits /32 ] ^ map2[nbits /32 ]) & +ethnl_lower_bits (nbits %32 )); +} +static int ethnl_update_bitset32_verbose (u32 *bitmap,unsigned int nbits,const struct nlattr *attr,struct nlattr **tb,ethnl_string_array_t names,struct netlink_ext_ack *extack,bool *mod) { +u32 *saved_bitmap =NULL ;struct nlattr *bit_attr;bool no_mask;int rem;
@@ -448,8 +468,20 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, } no_mask = tb[ETHTOOL_A_BITSET_NOMASK ]; -if (no_mask) -ethnl_bitmap32_clear (bitmap,0 , nbits, mod); +if (no_mask) { +unsigned int nwords =DIV_ROUND_UP (nbits,32 ); +unsigned int nbytes = nwords *sizeof (u32); +bool dummy; + +/* The bitmap size is only the size of the map part without +* its mask part. +*/ + saved_bitmap =kcalloc (nwords,sizeof (u32),GFP_KERNEL ); +if (!saved_bitmap) +return -ENOMEM ; +memcpy (saved_bitmap, bitmap, nbytes); +ethnl_bitmap32_clear (bitmap,0 , nbits, &dummy); + }nla_for_each_nested (bit_attr, tb[ETHTOOL_A_BITSET_BITS ], rem) {bool old_val, new_val;
@@ -458,22 +490,30 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits,if (nla_type (bit_attr) !=ETHTOOL_A_BITSET_BITS_BIT ) {NL_SET_ERR_MSG_ATTR (extack, bit_attr,"only ETHTOOL_A_BITSET_BITS_BIT allowed in ETHTOOL_A_BITSET_BITS" ); +kfree (saved_bitmap);return -EINVAL ; } ret =ethnl_parse_bit (&idx, &new_val, nbits, bit_attr, no_mask, names, extack); -if (ret <0 ) +if (ret <0 ) { +kfree (saved_bitmap);return ret; + } old_val = bitmap[idx /32 ] & ((u32 )1 << (idx %32 ));if (new_val != old_val) {if (new_val) bitmap[idx /32 ] |= ((u32 )1 << (idx %32 ));else bitmap[idx /32 ] &= ~((u32 )1 << (idx %32 )); - *mod = true; +if (!no_mask) + *mod = true; } } +if (no_mask && !ethnl_bitmap32_equal (saved_bitmap, bitmap, nbits)) + *mod = true; + +kfree (saved_bitmap);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 344/459 geneve: do not assume mac header is set in geneve_xmit_skb()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 8588c99c7d47448fcae39e3227d6e2bb97aad86d ]
We should not assume mac header is set in output path.
Use skb_eth_hdr() instead of eth_hdr() to fix the issue.
sysbot reported the following :
WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 skb_mac_header include/linux/skbuff.h:3052 [inline] WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 eth_hdr include/linux/if_ether.h:24 [inline] WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 geneve_xmit_skb drivers/net/geneve.c:898 [inline] WARNING: CPU: 0 PID: 11635 at include/linux/skbuff.h:3052 geneve_xmit+0x4c38/0x5730 drivers/net/geneve.c:1039 Modules linked in: CPU: 0 UID: 0 PID: 11635 Comm: syz.4.1423 Not tainted 6.12.0-syzkaller-10296-gaaf20f870da0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:skb_mac_header include/linux/skbuff.h:3052 [inline] RIP: 0010:eth_hdr include/linux/if_ether.h:24 [inline] RIP: 0010:geneve_xmit_skb drivers/net/geneve.c:898 [inline] RIP: 0010:geneve_xmit+0x4c38/0x5730 drivers/net/geneve.c:1039 Code: 21 c6 02 e9 35 d4 ff ff e8 a5 48 4c fb 90 0f 0b 90 e9 fd f5 ff ff e8 97 48 4c fb 90 0f 0b 90 e9 d8 f5 ff ff e8 89 48 4c fb 90 <0f> 0b 90 e9 41 e4 ff ff e8 7b 48 4c fb 90 0f 0b 90 e9 cd e7 ff ff RSP: 0018:ffffc90003b2f870 EFLAGS: 00010283 RAX: 000000000000037a RBX: 000000000000ffff RCX: ffffc9000dc3d000 RDX: 0000000000080000 RSI: ffffffff86428417 RDI: 0000000000000003 RBP: ffffc90003b2f9f0 R08: 0000000000000003 R09: 000000000000ffff R10: 000000000000ffff R11: 0000000000000002 R12: ffff88806603c000 R13: 0000000000000000 R14: ffff8880685b2780 R15: 0000000000000e23 FS: 00007fdc2deed6c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b30a1dff8 CR3: 0000000056b8c000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __netdev_start_xmit include/linux/netdevice.h:5002 [inline] netdev_start_xmit include/linux/netdevice.h:5011 [inline] __dev_direct_xmit+0x58a/0x720 net/core/dev.c:4490 dev_direct_xmit include/linux/netdevice.h:3181 [inline] packet_xmit+0x1e4/0x360 net/packet/af_packet.c:285 packet_snd net/packet/af_packet.c:3146 [inline] packet_sendmsg+0x2700/0x5660 net/packet/af_packet.c:3178 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg net/socket.c:726 [inline] __sys_sendto+0x488/0x4f0 net/socket.c:2197 __do_sys_sendto net/socket.c:2204 [inline] __se_sys_sendto net/socket.c:2200 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2200 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/net/geneve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/geneve.c +1 -1
@@ -983,7 +983,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,if (geneve->cfg.df ==GENEVE_DF_SET ) { df =htons (IP_DF ); }else if (geneve->cfg.df ==GENEVE_DF_INHERIT ) { -struct ethhdr *eth =eth_hdr (skb); +struct ethhdr *eth =skb_eth_hdr (skb);if (ntohs (eth->h_proto) ==ETH_P_IPV6 ) { df =htons (IP_DF );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 345/459 gpio: grgpio: use a helper variable to store the address of ofdev->dev
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit d036ae41cebdfae92666024163c109b8fef516fa ]
Instead of dereferencing the platform device pointer repeatedly, just store its address in a helper variable.
Stable-dep-of: 050b23d081da ("gpio: grgpio: Add NULL check in grgpio_probe")
--- drivers/gpio/gpio-grgpio.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/gpio/gpio-grgpio.c +12 -11
@@ -328,6 +328,7 @@ static const struct irq_domain_ops grgpio_irq_domain_ops = {static int grgpio_probe (struct platform_device *ofdev) {struct device_node *np = ofdev->dev.of_node; +struct device *dev = &ofdev->dev;void __iomem *regs;struct gpio_chip *gc;struct grgpio_priv *priv;
@@ -337,7 +338,7 @@ static int grgpio_probe(struct platform_device *ofdev)int size;int i; - priv =devm_kzalloc (&ofdev->dev,sizeof (*priv),GFP_KERNEL ); + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
@@ -346,29 +347,29 @@ static int grgpio_probe(struct platform_device *ofdev)return PTR_ERR (regs); gc = &priv->gc; - err =bgpio_init (gc, &ofdev->dev,4 , regs +GRGPIO_DATA , + err =bgpio_init (gc, dev,4 , regs +GRGPIO_DATA , regs +GRGPIO_OUTPUT ,NULL , regs +GRGPIO_DIR ,NULL ,BGPIOF_BIG_ENDIAN_BYTE_ORDER );if (err) { -dev_err (&ofdev->dev,"bgpio_init() failed\n" ); +dev_err (dev,"bgpio_init() failed\n" );return err; } priv->regs = regs; priv->imask = gc->read_reg (regs +GRGPIO_IMASK ); - priv->dev = &ofdev->dev; + priv->dev = dev; gc->of_node = np; gc->owner =THIS_MODULE ; gc->to_irq = grgpio_to_irq; - gc->label =devm_kasprintf (&ofdev->dev,GFP_KERNEL ,"%pOF" , np); + gc->label =devm_kasprintf (dev,GFP_KERNEL ,"%pOF" , np); gc->base =-1 ; err =of_property_read_u32 (np,"nbits" , &prop);if (err || prop <=0 || prop >GRGPIO_MAX_NGPIO ) { gc->ngpio =GRGPIO_MAX_NGPIO ; -dev_dbg (&ofdev->dev, -"No or invalid nbits property: assume %d\n" , gc->ngpio); +dev_dbg (dev,"No or invalid nbits property: assume %d\n" , + gc->ngpio); }else { gc->ngpio = prop; }
@@ -380,7 +381,7 @@ static int grgpio_probe(struct platform_device *ofdev) irqmap = (s32 *)of_get_property (np,"irqmap" , &size);if (irqmap) {if (size < gc->ngpio) { -dev_err (&ofdev->dev, +dev_err (dev,"irqmap shorter than ngpio (%d < %d)\n" , size, gc->ngpio);return -EINVAL ;
@@ -390,7 +391,7 @@ static int grgpio_probe(struct platform_device *ofdev) &grgpio_irq_domain_ops, priv);if (!priv->domain) { -dev_err (&ofdev->dev,"Could not add irq domain\n" ); +dev_err (dev,"Could not add irq domain\n" );return -EINVAL ; }
@@ -420,13 +421,13 @@ static int grgpio_probe(struct platform_device *ofdev) err =gpiochip_add_data (gc, priv);if (err) { -dev_err (&ofdev->dev,"Could not add gpiochip\n" ); +dev_err (dev,"Could not add gpiochip\n" );if (priv->domain)irq_domain_remove (priv->domain);return err; } -dev_info (&ofdev->dev,"regs=0x%p, base=%d, ngpio=%d, irqs=%s\n" , +dev_info (dev,"regs=0x%p, base=%d, ngpio=%d, irqs=%s\n" , priv->regs, gc->base, gc->ngpio, priv->domain ?"on" :"off" );return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 346/459 gpio: grgpio: Add NULL check in grgpio_probe
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 050b23d081da0f29474de043e9538c1f7a351b3b ]
devm_kasprintf() can return a NULL pointer on failure,but this returned value in grgpio_probe is not checked.
Add NULL check in grgpio_probe, to handle kernel NULL pointer dereference error.
--- drivers/gpio/gpio-grgpio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpio/gpio-grgpio.c +3 -0
@@ -363,6 +363,9 @@ static int grgpio_probe(struct platform_device *ofdev) gc->owner =THIS_MODULE ; gc->to_irq = grgpio_to_irq; gc->label =devm_kasprintf (dev,GFP_KERNEL ,"%pOF" , np); +if (!gc->label) +return -ENOMEM ; + gc->base =-1 ; err =of_property_read_u32 (np,"nbits" , &prop);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 347/459 dt_bindings: rs485: Correct delay values
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lino Sanfilippo <[email protected]>
[ Upstream commit 885dcb08c93d75b784468e65fd4f1f82d5313061 ]
Currently the documentation claims that a maximum of 1000 msecs is allowed for RTS delays. However nothing actually checks the values read from device tree/ACPI and so it is possible to set much higher values.
There is already a maximum of 100 ms enforced for RTS delays that are set via the UART TIOCSRS485 ioctl. To be consistent with that use the same limit for DT/ACPI values.
Although this change is visible to userspace the risk of breaking anything when reducing the max delays from 1000 to 100 ms should be very low, since 100 ms is already a very high maximum for delays that are usually rather in the usecs range.
Stable-dep-of: 12b3642b6c24 ("dt-bindings: serial: rs485: Fix rs485-rts-delay property")
--- Documentation/devicetree/bindings/serial/rs485.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/serial/rs485.yaml +2 -2
@@ -22,12 +22,12 @@ properties: - description: Delay between rts signal and beginning of data sent in milliseconds. It corresponds to the delay before sending data. default: 0 - maximum: 1000 + maximum: 100 - description: Delay between end of data sent and rts signal in milliseconds. It corresponds to the delay after sending data and actual release of the line. default: 0 - maximum: 1000 + maximum: 100 rs485-rts-active-low: description: drive RTS low when sending (default is high).
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 348/459 dt-bindings: serial: rs485: Fix rs485-rts-delay property
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
[ Upstream commit 12b3642b6c242061d3ba84e6e3050c3141ded14c ]
Code expects array only with 2 items which should be checked. But also item checking is not working as it should likely because of incorrect items description.
--- .../devicetree/bindings/serial/rs485.yaml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/serial/rs485.yaml +9 -10
@@ -18,16 +18,15 @@ properties: description: prop-encoded-array <a b> $ref: /schemas/types.yaml#/definitions/uint32-array items: - items: - - description: Delay between rts signal and beginning of data sent in - milliseconds. It corresponds to the delay before sending data. - default: 0 - maximum: 100 - - description: Delay between end of data sent and rts signal in milliseconds. - It corresponds to the delay after sending data and actual release - of the line. - default: 0 - maximum: 100 + - description: Delay between rts signal and beginning of data sent in + milliseconds. It corresponds to the delay before sending data. + default: 0 + maximum: 100 + - description: Delay between end of data sent and rts signal in milliseconds. + It corresponds to the delay after sending data and actual release + of the line. + default: 0 + maximum: 100 rs485-rts-active-low: description: drive RTS low when sending (default is high).
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 349/459 i3c: fix incorrect address slot lookup on 64-bit
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamie Iles <[email protected]>
[ Upstream commit f18f98110f2b179792cb70d85cba697320a3790f ]
The address slot bitmap is an array of unsigned long's which are the same size as an int on 32-bit platforms but not 64-bit. Loading the bitmap into an int could result in the incorrect status being returned for a slot and slots being reported as the wrong status.
Stable-dep-of: 851bd21cdb55 ("i3c: master: Fix dynamic address leak when 'assigned-address' is present")
--- drivers/i3c/master.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i3c/master.c +2 -1
@@ -347,7 +347,8 @@ struct bus_type i3c_bus_type = {static enum i3c_addr_slot_status i3c_bus_get_addr_slot_status (struct i3c_bus *bus,u16 addr) { -int status, bitpos = addr *2 ; +unsigned long status; +int bitpos = addr *2 ;if (addr >I2C_MAX_ADDR )return I3C_ADDR_SLOT_RSVD ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 350/459 i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit 16aed0a6520ba01b7d22c32e193fc1ec674f92d4 ]
Replace the hardcoded value 2, which indicates 2 bits for I3C address status, with the predefined macro I3C_ADDR_SLOT_STATUS_BITS.
Improve maintainability and extensibility of the code.
Stable-dep-of: 851bd21cdb55 ("i3c: master: Fix dynamic address leak when 'assigned-address' is present")
--- drivers/i3c/master.c | 4 ++-- include/linux/i3c/master.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/i3c/master.c +2 -2
@@ -348,7 +348,7 @@ static enum i3c_addr_slot_status i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) {unsigned long status; -int bitpos = addr *2 ; +int bitpos = addr *I3C_ADDR_SLOT_STATUS_BITS ;if (addr >I2C_MAX_ADDR )return I3C_ADDR_SLOT_RSVD ;
@@ -362,7 +362,7 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)static void i3c_bus_set_addr_slot_status (struct i3c_bus *bus,u16 addr,enum i3c_addr_slot_status status) { -int bitpos = addr *2 ; +int bitpos = addr *I3C_ADDR_SLOT_STATUS_BITS ;unsigned long *ptr;if (addr >I2C_MAX_ADDR )
include/linux/i3c/master.h +3 -1
@@ -291,6 +291,8 @@ enum i3c_addr_slot_status { I3C_ADDR_SLOT_STATUS_MASK = 3, }; +#define I3C_ADDR_SLOT_STATUS_BITS 2 +/** * struct i3c_bus - I3C bus object * @cur_master: I3C master currently driving the bus. Since I3C is multi-master
@@ -332,7 +334,7 @@ enum i3c_addr_slot_status {struct i3c_bus {struct i3c_dev_desc *cur_master;int id; -unsigned long addrslots[((I2C_MAX_ADDR +1 ) *2 ) /BITS_PER_LONG ]; +unsigned long addrslots[((I2C_MAX_ADDR +1 ) *I3C_ADDR_SLOT_STATUS_BITS ) /BITS_PER_LONG ];enum i3c_bus_mode mode;struct {unsigned long i3c;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 351/459 i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_DESIRED
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit 2f552fa280590e61bd3dbe66a7b54b99caa642a4 ]
Extend the address status bit to 4 and introduce the I3C_ADDR_SLOT_EXT_DESIRED macro to indicate that a device prefers a specific address. This is generally set by the 'assigned-address' in the device tree source (dts) file.
┌────┬─────────────┬───┬─────────┬───┐
│S/Sr│ 7'h7E RnW=0 │ACK│ ENTDAA │ T ├────┐
└────┴─────────────┴───┴─────────┴───┘ │
┌─────────────────────────────────────────┘
│ ┌──┬─────────────┬───┬─────────────────┬────────────────┬───┬─────────┐
└─►│Sr│7'h7E RnW=1 │ACK│48bit UID BCR DCR│Assign 7bit Addr│PAR│ ACK/NACK│
└──┴─────────────┴───┴─────────────────┴────────────────┴───┴─────────┘Some master controllers (such as HCI) need to prepare the entire above transaction before sending it out to the I3C bus. This means that a 7-bit dynamic address needs to be allocated before knowing the target device's UID information.
However, some I3C targets may request specific addresses (called as "init_dyn_addr"), which is typically specified by the DT-'s assigned-address property. Lower addresses having higher IBI priority. If it is available, i3c_bus_get_free_addr() preferably return a free address that is not in the list of desired addresses (called as "init_dyn_addr"). This allows the device with the "init_dyn_addr" to switch to its "init_dyn_addr" when it hot-joins the I3C bus. Otherwise, if the "init_dyn_addr" is already in use by another I3C device, the target device will not be able to switch to its desired address.
If the previous step fails, fallback returning one of the remaining unassigned address, regardless of its state in the desired list.
Stable-dep-of: 851bd21cdb55 ("i3c: master: Fix dynamic address leak when 'assigned-address' is present")
--- drivers/i3c/master.c | 65 +++++++++++++++++++++++++++++++------- include/linux/i3c/master.h | 7 ++-- 2 files changed, 59 insertions(+), 13 deletions(-)
drivers/i3c/master.c +54 -11
@@ -345,7 +345,7 @@ struct bus_type i3c_bus_type = { };static enum i3c_addr_slot_status -i3c_bus_get_addr_slot_status (struct i3c_bus *bus,u16 addr) +i3c_bus_get_addr_slot_status_mask (struct i3c_bus *bus,u16 addr,u32 mask) {unsigned long status;int bitpos = addr *I3C_ADDR_SLOT_STATUS_BITS ;
@@ -356,11 +356,17 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) status = bus->addrslots[bitpos /BITS_PER_LONG ]; status >>= bitpos %BITS_PER_LONG ; -return status &I3C_ADDR_SLOT_STATUS_MASK ; +return status & mask; } -static void i3c_bus_set_addr_slot_status (struct i3c_bus *bus,u16 addr, -enum i3c_addr_slot_status status) +static enum i3c_addr_slot_status +i3c_bus_get_addr_slot_status (struct i3c_bus *bus,u16 addr) +{ +return i3c_bus_get_addr_slot_status_mask (bus, addr,I3C_ADDR_SLOT_STATUS_MASK ); +} + +static void i3c_bus_set_addr_slot_status_mask (struct i3c_bus *bus,u16 addr, +enum i3c_addr_slot_status status,u32 mask) {int bitpos = addr *I3C_ADDR_SLOT_STATUS_BITS ;unsigned long *ptr;
@@ -369,9 +375,14 @@ static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,return ; ptr = bus->addrslots + (bitpos /BITS_PER_LONG ); - *ptr &= ~((unsigned long )I3C_ADDR_SLOT_STATUS_MASK << - (bitpos %BITS_PER_LONG )); - *ptr |= (unsigned long )status << (bitpos %BITS_PER_LONG ); + *ptr &= ~((unsigned long )mask << (bitpos %BITS_PER_LONG )); + *ptr |= ((unsigned long )status & mask) << (bitpos %BITS_PER_LONG ); +} + +static void i3c_bus_set_addr_slot_status (struct i3c_bus *bus,u16 addr, +enum i3c_addr_slot_status status) +{ +i3c_bus_set_addr_slot_status_mask (bus, addr, status,I3C_ADDR_SLOT_STATUS_MASK ); }static bool i3c_bus_dev_addr_is_avail (struct i3c_bus *bus,u8 addr)
@@ -383,13 +394,44 @@ static bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr)return status ==I3C_ADDR_SLOT_FREE ; } +/* +* ┌────┬─────────────┬───┬─────────┬───┐ +* │S/Sr│ 7'h7E RnW=0 │ACK│ ENTDAA │ T ├────┐ +* └────┴─────────────┴───┴─────────┴───┘ │ +* ┌─────────────────────────────────────────┘ +* │ ┌──┬─────────────┬───┬─────────────────┬────────────────┬───┬─────────┐ +* └─►│Sr│7'h7E RnW=1 │ACK│48bit UID BCR DCR│Assign 7bit Addr│PAR│ ACK/NACK│ +* └──┴─────────────┴───┴─────────────────┴────────────────┴───┴─────────┘ +* Some master controllers (such as HCI) need to prepare the entire above transaction before +* sending it out to the I3C bus. This means that a 7-bit dynamic address needs to be allocated +* before knowing the target device's UID information. +* +* However, some I3C targets may request specific addresses (called as "init_dyn_addr"), which is +* typically specified by the DT-'s assigned-address property. Lower addresses having higher IBI +* priority. If it is available, i3c_bus_get_free_addr() preferably return a free address that is +* not in the list of desired addresses (called as "init_dyn_addr"). This allows the device with +* the "init_dyn_addr" to switch to its "init_dyn_addr" when it hot-joins the I3C bus. Otherwise, +* if the "init_dyn_addr" is already in use by another I3C device, the target device will not be +* able to switch to its desired address. +* +* If the previous step fails, fallback returning one of the remaining unassigned address, +* regardless of its state in the desired list. +*/ static int i3c_bus_get_free_addr (struct i3c_bus *bus,u8 start_addr) {enum i3c_addr_slot_status status;u8 addr;for (addr = start_addr; addr <I3C_MAX_ADDR ; addr++) { - status =i3c_bus_get_addr_slot_status (bus, addr); + status =i3c_bus_get_addr_slot_status_mask (bus, addr, +I3C_ADDR_SLOT_EXT_STATUS_MASK ); +if (status ==I3C_ADDR_SLOT_FREE ) +return addr; + } + +for (addr = start_addr; addr <I3C_MAX_ADDR ; addr++) { + status =i3c_bus_get_addr_slot_status_mask (bus, addr, +I3C_ADDR_SLOT_STATUS_MASK );if (status ==I3C_ADDR_SLOT_FREE )return addr; }
@@ -1765,9 +1807,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_rstdaa; } -i3c_bus_set_addr_slot_status (&master->bus, - i3cboardinfo->init_dyn_addr, -I3C_ADDR_SLOT_I3C_DEV ); +i3c_bus_set_addr_slot_status_mask (&master->bus, + i3cboardinfo->init_dyn_addr, +I3C_ADDR_SLOT_I3C_DEV |I3C_ADDR_SLOT_EXT_DESIRED , +I3C_ADDR_SLOT_EXT_STATUS_MASK );/* * Only try to create/attach devices that have a static
include/linux/i3c/master.h +5 -2
@@ -276,7 +276,8 @@ enum i3c_bus_mode {* @I3C_ADDR_SLOT_I2C_DEV: address is assigned to an I2C device * @I3C_ADDR_SLOT_I3C_DEV: address is assigned to an I3C device * @I3C_ADDR_SLOT_STATUS_MASK: address slot mask -* +* @I3C_ADDR_SLOT_EXT_DESIRED: the bitmask represents addresses that are preferred by some devices, +* such as the "assigned-address" property in a device tree source. * On an I3C bus, addresses are assigned dynamically, and we need to know which * addresses are free to use and which ones are already assigned. *
@@ -289,9 +290,11 @@ enum i3c_addr_slot_status {I3C_ADDR_SLOT_I2C_DEV ,I3C_ADDR_SLOT_I3C_DEV ,I3C_ADDR_SLOT_STATUS_MASK =3 , +I3C_ADDR_SLOT_EXT_STATUS_MASK =7 , + I3C_ADDR_SLOT_EXT_DESIRED = BIT(2), }; -#define I3C_ADDR_SLOT_STATUS_BITS 2 +#define I3C_ADDR_SLOT_STATUS_BITS 4/** * struct i3c_bus - I3C bus object
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 352/459 i3c: master: Fix dynamic address leak when assigned-address is present
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit 851bd21cdb55e727ab29280bc9f6b678164f802a ]
If the DTS contains 'assigned-address', a dynamic address leak occurs during hotjoin events.
Assume a device have assigned-address 0xb.
- Device issue Hotjoin
- Call i3c_master_do_daa()
- Call driver xxx_do_daa()
- Call i3c_master_get_free_addr() to get dynamic address 0x9
- i3c_master_add_i3c_dev_locked(0x9)
- expected_dyn_addr = newdev->boardinfo->init_dyn_addr (0xb);
- i3c_master_reattach_i3c_dev(newdev(0xb), old_dyn_addr(0x9));
- if (dev->info.dyn_addr != old_dyn_addr &&
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xb != 0x9 -> TRUE
(!dev->boardinfo ||
^^^^^^^^^^^^^^^ -> FALSE
dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0xb != 0xb -> FALSE
...
i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr,
I3C_ADDR_SLOT_FREE);
^^^
This will be skipped. So old_dyn_addr never free
} - i3c_master_get_free_addr() will return increased sequence number.
Remove dev->info.dyn_addr != dev->boardinfo->init_dyn_addr condition check. dev->info.dyn_addr should be checked before calling this function because i3c_master_setnewda_locked() has already been called and the target device has already accepted dyn_addr. It is too late to check if dyn_addr is free in i3c_master_reattach_i3c_dev().
Add check to ensure expected_dyn_addr is free before i3c_master_setnewda_locked().
--- drivers/i3c/master.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/i3c/master.c +5 -10
@@ -1413,16 +1413,9 @@ static int i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, u8 old_dyn_addr) {struct i3c_master_controller *master =i3c_dev_get_master (dev); -enum i3c_addr_slot_status status;int ret; -if (dev->info.dyn_addr != old_dyn_addr && - (!dev->boardinfo || - dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) { - status =i3c_bus_get_addr_slot_status (&master->bus, - dev->info.dyn_addr); -if (status !=I3C_ADDR_SLOT_FREE ) -return -EBUSY ; +if (dev->info.dyn_addr != old_dyn_addr) {i3c_bus_set_addr_slot_status (&master->bus, dev->info.dyn_addr,I3C_ADDR_SLOT_I3C_DEV );
@@ -1807,9 +1800,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_rstdaa; } +/* Do not mark as occupied until real device exist in bus */ i3c_bus_set_addr_slot_status_mask (&master->bus, i3cboardinfo->init_dyn_addr, -I3C_ADDR_SLOT_I3C_DEV |I3C_ADDR_SLOT_EXT_DESIRED , +I3C_ADDR_SLOT_EXT_DESIRED ,I3C_ADDR_SLOT_EXT_STATUS_MASK );/*
@@ -1977,7 +1971,8 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,else expected_dyn_addr = newdev->info.dyn_addr; -if (newdev->info.dyn_addr != expected_dyn_addr) { +if (newdev->info.dyn_addr != expected_dyn_addr && +i3c_bus_get_addr_slot_status (&master->bus, expected_dyn_addr) ==I3C_ADDR_SLOT_FREE ) {/* * Try to apply the expected dynamic address. If it fails, keep * the address assigned by the master.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 353/459 drm/sti: Add __iomem for mixer_dbg_mxns parameter
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 86e8f94789dd6f3e705bfa821e1e416f97a2f863 ]
Sparse complains about incorrect type in argument 1. expected void const volatile __iomem *ptr but got void *. so modify mixer_dbg_mxn's addr parameter.
--- drivers/gpu/drm/sti/sti_mixer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_mixer.c +1 -1
@@ -137,7 +137,7 @@ static void mixer_dbg_crb(struct seq_file *s, int val) } } -static void mixer_dbg_mxn (struct seq_file *s,void *addr) +static void mixer_dbg_mxn (struct seq_file *s,void __iomem *addr) {int i;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 354/459 tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijian Zhang <[email protected]>
[ Upstream commit ca70b8baf2bd125b2a4d96e76db79375c07d7ff2 ]
The current sk memory accounting logic in __SK_REDIRECT is pre-uncharging tosend bytes, which is either msg->sg.size or a smaller value apply_bytes.
Potential problems with this strategy are as follows:
- If the actual sent bytes are smaller than tosend, we need to charge some bytes back, as in line 487, which is okay but seems not clean.
- When tosend is set to apply_bytes, as in line 417, and (ret < 0), we may miss uncharging (msg->sg.size - apply_bytes) bytes.
[...]
415 tosend = msg->sg.size;
416 if (psock->apply_bytes && psock->apply_bytes < tosend)
417 tosend = psock->apply_bytes;
[...]
443 sk_msg_return(sk, msg, tosend);
444 release_sock(sk);
446 origsize = msg->sg.size;
447 ret = tcp_bpf_sendmsg_redir(sk_redir, redir_ingress,
448 msg, tosend, flags);
449 sent = origsize - msg->sg.size;
[...]
454 lock_sock(sk);
455 if (unlikely(ret < 0)) {
456 int free = sk_msg_free_nocharge(sk, msg);
458 if (!cork)
459 *copied -= free;
460 }
[...]
487 if (eval == __SK_REDIRECT)
488 sk_mem_charge(sk, tosend - sent);
[...]
When running the selftest test_txmsg_redir_wait_sndmem with txmsg_apply, the following warning will be reported:
------------[ cut here ]------------ WARNING: CPU: 6 PID: 57 at net/ipv4/af_inet.c:156 inet_sock_destruct+0x190/0x1a0 Modules linked in: CPU: 6 UID: 0 PID: 57 Comm: kworker/6:0 Not tainted 6.12.0-rc1.bm.1-amd64+ #43 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Workqueue: events sk_psock_destroy RIP: 0010:inet_sock_destruct+0x190/0x1a0 RSP: 0018:ffffad0a8021fe08 EFLAGS: 00010206 RAX: 0000000000000011 RBX: ffff9aab4475b900 RCX: ffff9aab481a0800 RDX: 0000000000000303 RSI: 0000000000000011 RDI: ffff9aab4475b900 RBP: ffff9aab4475b990 R08: 0000000000000000 R09: ffff9aab40050ec0 R10: 0000000000000000 R11: ffff9aae6fdb1d01 R12: ffff9aab49c60400 R13: ffff9aab49c60598 R14: ffff9aab49c60598 R15: dead000000000100 FS: 0000000000000000(0000) GS:ffff9aae6fd80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffec7e47bd8 CR3: 00000001a1a1c004 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __warn+0x89/0x130 ? inet_sock_destruct+0x190/0x1a0 ? report_bug+0xfc/0x1e0 ? handle_bug+0x5c/0xa0 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? inet_sock_destruct+0x190/0x1a0 __sk_destruct+0x25/0x220 sk_psock_destroy+0x2b2/0x310 process_scheduled_works+0xa3/0x3e0 worker_thread+0x117/0x240 ? __pfx_worker_thread+0x10/0x10 kthread+0xcf/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x31/0x40 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> ---[ end trace 0000000000000000 ]---
In __SK_REDIRECT, a more concise way is delaying the uncharging after sent bytes are finalized, and uncharge this value. When (ret < 0), we shall invoke sk_msg_free.
Same thing happens in case __SK_DROP, when tosend is set to apply_bytes, we may miss uncharging (msg->sg.size - apply_bytes) bytes. The same warning will be reported in selftest.
[...]
468 case __SK_DROP:
469 default:
470 sk_msg_free_partial(sk, msg, tosend);
471 sk_msg_apply_bytes(psock, tosend);
472 *copied -= (tosend + delta);
473 return -EACCES;
[...]
So instead of sk_msg_free_partial we can do sk_msg_free here.
--- net/ipv4/tcp_bpf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
net/ipv4/tcp_bpf.c +4 -7
@@ -375,7 +375,6 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, cork = true; psock->cork =NULL ; } -sk_msg_return (sk, msg, tosend);release_sock (sk); origsize = msg->sg.size;
@@ -386,8 +385,9 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock,sock_put (sk_redir);lock_sock (sk); +sk_mem_uncharge (sk, sent);if (unlikely (ret <0 )) { -int free =sk_msg_free_nocharge (sk, msg); +int free =sk_msg_free (sk, msg);if (!cork) *copied -= free;
@@ -401,7 +401,7 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock,break ;case __SK_DROP:default : -sk_msg_free_partial (sk, msg, tosend); +sk_msg_free (sk, msg);sk_msg_apply_bytes (psock, tosend); *copied -= (tosend + delta);return -EACCES ;
@@ -417,11 +417,8 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, }if (msg && msg->sg.data[msg->sg.start].page_link && - msg->sg.data[msg->sg.start].length) { -if (eval == __SK_REDIRECT) -sk_mem_charge (sk, tosend - sent); + msg->sg.data[msg->sg.start].length) goto more_data; - } }return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 355/459 spi: mpc52xx: Add cancel_work_sync before module remove
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 984836621aad98802d92c4a3047114cf518074c8 ]
If we remove the module which will call mpc52xx_spi_remove it will free 'ms' through spi_unregister_controller. while the work ms->work will be used. The sequence of operations that may lead to a UAF bug.
Fix it by ensuring that the work is canceled before proceeding with the cleanup in mpc52xx_spi_remove.
--- drivers/spi/spi-mpc52xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-mpc52xx.c +1 -0
@@ -519,6 +519,7 @@ static int mpc52xx_spi_remove(struct platform_device *op)struct mpc52xx_spi *ms =spi_master_get_devdata (master);int i; +cancel_work_sync (&ms->work);free_irq (ms->irq0, ms);free_irq (ms->irq1, ms);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 356/459 ocfs2: free inode when ocfs2_get_init_inode() fails
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 965b5dd1894f4525f38c1b5f99b0106a07dbb5db ]
syzbot is reporting busy inodes after unmount, for commit 9c89fe0af826 ("ocfs2: Handle error from dquot_initialize()") forgot to call iput() when new_inode() succeeded and dquot_initialize() failed.
--- fs/ocfs2/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/namei.c +3 -1
@@ -201,8 +201,10 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode) mode =mode_strip_sgid (dir, mode);inode_init_owner (inode, dir, mode); status =dquot_initialize (inode); -if (status) +if (status) { +iput (inode);return ERR_PTR (status); + }return inode; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 357/459 bpf: Handle BPF_EXIST and BPF_NOEXIST for LPM trie
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit eae6a075e9537dd69891cf77ca5a88fa8a28b4a1 ]
Add the currently missing handling for the BPF_EXIST and BPF_NOEXIST flags. These flags can be specified by users and are relevant since LPM trie supports exact matches during update.
--- kernel/bpf/lpm_trie.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
kernel/bpf/lpm_trie.c +20 -3
@@ -364,6 +364,10 @@ static int trie_update_elem(struct bpf_map *map,* simply assign the @new_node to that slot and be done. */ if (!node) { +if (flags ==BPF_EXIST ) { + ret = -ENOENT ; + goto out; + }rcu_assign_pointer (*slot, new_node); goto out; }
@@ -372,18 +376,31 @@ static int trie_update_elem(struct bpf_map *map,* which already has the correct data array set. */ if (node->prefixlen == matchlen) { +if (!(node->flags &LPM_TREE_NODE_FLAG_IM )) { +if (flags ==BPF_NOEXIST ) { + ret = -EEXIST ; + goto out; + } + trie->n_entries--; + }else if (flags ==BPF_EXIST ) { + ret = -ENOENT ; + goto out; + } + new_node->child[0 ] = node->child[0 ]; new_node->child[1 ] = node->child[1 ]; -if (!(node->flags &LPM_TREE_NODE_FLAG_IM )) - trie->n_entries--; -rcu_assign_pointer (*slot, new_node);kfree_rcu (node, rcu); goto out; } +if (flags ==BPF_EXIST ) { + ret = -ENOENT ; + goto out; + } +/* If the new node matches the prefix completely, it must be inserted * as an ancestor. Simply insert it between @node and *@slot. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 358/459 bpf: Fix exact match conditions in trie_get_next_key()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit 27abc7b3fa2e09bbe41e2924d328121546865eda ]
trie_get_next_key() uses node->prefixlen == key->prefixlen to identify an exact match, However, it is incorrect because when the target key doesn't fully match the found node (e.g., node->prefixlen != matchlen), these two nodes may also have the same prefixlen. It will return expected result when the passed key exist in the trie. However when a recently-deleted key or nonexistent key is passed to trie_get_next_key(), it may skip keys and return incorrect result.
Fix it by using node->prefixlen == matchlen to identify exact matches. When the condition is true after the search, it also implies node->prefixlen equals key->prefixlen, otherwise, the search would return NULL instead.
--- kernel/bpf/lpm_trie.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/lpm_trie.c +2 -2
@@ -650,7 +650,7 @@ static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key)struct lpm_trie_node **node_stack =NULL ;int err =0 , stack_ptr =-1 ;unsigned int next_bit; -size_t matchlen; +size_t matchlen =0 ;/* The get_next_key follows postorder. For the 4 node example in * the top of this file, the trie_get_next_key() returns the following
@@ -689,7 +689,7 @@ static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key) next_bit =extract_bit (key->data, node->prefixlen); node =rcu_dereference (node->child[next_bit]); } -if (!node || node->prefixlen != key->prefixlen || +if (!node || node->prefixlen != matchlen || (node->flags &LPM_TREE_NODE_FLAG_IM )) goto find_leftmost;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 359/459 HID: wacom: fix when get product name maybe null pointer
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
commit 59548215b76be98cf3422eea9a67d6ea578aca3d upstream.
Due to incorrect dev->product reporting by certain devices, null pointer dereferences occur when dev->product is empty, leading to potential system crashes.
This issue was found on EXCELSIOR DL37-D05 device with Loongson-LS3A6000-7A2000-DL37 motherboard.
Kernel logs:
[ 56.470885] usb 4-3: new full-speed USB device number 4 using ohci-pci [ 56.671638] usb 4-3: string descriptor 0 read error: -22 [ 56.671644] usb 4-3: New USB device found, idVendor=056a, idProduct=0374, bcdDevice= 1.07 [ 56.671647] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 56.678839] hid-generic 0003:056A:0374.0004: hiddev0,hidraw3: USB HID v1.10 Device [HID 056a:0374] on usb-0000:00:05.0-3/input0 [ 56.697719] CPU 2 Unable to handle kernel paging request at virtual address 0000000000000000, era == 90000000066e35c8, ra == ffff800004f98a80 [ 56.697732] Oops[#1]: [ 56.697734] CPU: 2 PID: 2742 Comm: (udev-worker) Tainted: G OE 6.6.0-loong64-desktop #25.00.2000.015 [ 56.697737] Hardware name: Inspur CE520L2/C09901N000000000, BIOS 2.09.00 10/11/2024 [ 56.697739] pc 90000000066e35c8 ra ffff800004f98a80 tp 9000000125478000 sp 900000012547b8a0 [ 56.697741] a0 0000000000000000 a1 ffff800004818b28 a2 0000000000000000 a3 0000000000000000 [ 56.697743] a4 900000012547b8f0 a5 0000000000000000 a6 0000000000000000 a7 0000000000000000 [ 56.697745] t0 ffff800004818b2d t1 0000000000000000 t2 0000000000000003 t3 0000000000000005 [ 56.697747] t4 0000000000000000 t5 0000000000000000 t6 0000000000000000 t7 0000000000000000 [ 56.697748] t8 0000000000000000 u0 0000000000000000 s9 0000000000000000 s0 900000011aa48028 [ 56.697750] s1 0000000000000000 s2 0000000000000000 s3 ffff800004818e80 s4 ffff800004810000 [ 56.697751] s5 90000001000b98d0 s6 ffff800004811f88 s7 ffff800005470440 s8 0000000000000000 [ 56.697753] ra: ffff800004f98a80 wacom_update_name+0xe0/0x300 [wacom] [ 56.697802] ERA: 90000000066e35c8 strstr+0x28/0x120 [ 56.697806] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) [ 56.697816] PRMD: 0000000c (PPLV0 +PIE +PWE) [ 56.697821] EUEN: 00000000 (-FPE -SXE -ASXE -BTE) [ 56.697827] ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7) [ 56.697831] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0) [ 56.697835] BADV: 0000000000000000 [ 56.697836] PRID: 0014d000 (Loongson-64bit, Loongson-3A6000) [ 56.697838] Modules linked in: wacom(+) bnep bluetooth rfkill qrtr nls_iso8859_1 nls_cp437 snd_hda_codec_conexant snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore input_leds mousedev led_class joydev deepin_netmonitor(OE) fuse nfnetlink dmi_sysfs ip_tables x_tables overlay amdgpu amdxcp drm_exec gpu_sched drm_buddy radeon drm_suballoc_helper i2c_algo_bit drm_ttm_helper r8169 ttm drm_display_helper spi_loongson_pci xhci_pci cec xhci_pci_renesas spi_loongson_core hid_generic realtek gpio_loongson_64bit [ 56.697887] Process (udev-worker) (pid: 2742, threadinfo=00000000aee0d8b4, task=00000000a9eff1f3) [ 56.697890] Stack : 0000000000000000 ffff800004817e00 0000000000000000 0000251c00000000 [ 56.697896] 0000000000000000 00000011fffffffd 0000000000000000 0000000000000000 [ 56.697901] 0000000000000000 1b67a968695184b9 0000000000000000 90000001000b98d0 [ 56.697906] 90000001000bb8d0 900000011aa48028 0000000000000000 ffff800004f9d74c [ 56.697911] 90000001000ba000 ffff800004f9ce58 0000000000000000 ffff800005470440 [ 56.697916] ffff800004811f88 90000001000b98d0 9000000100da2aa8 90000001000bb8d0 [ 56.697921] 0000000000000000 90000001000ba000 900000011aa48028 ffff800004f9d74c [ 56.697926] ffff8000054704e8 90000001000bb8b8 90000001000ba000 0000000000000000 [ 56.697931] 90000001000bb8d0 9000000006307564 9000000005e666e0 90000001752359b8 [ 56.697936] 9000000008cbe400 900000000804d000 9000000005e666e0 0000000000000000 [ 56.697941] ... [ 56.697944] Call Trace: [ 56.697945] [<90000000066e35c8>] strstr+0x28/0x120 [ 56.697950] [<ffff800004f98a80>] wacom_update_name+0xe0/0x300 [wacom] [ 56.698000] [<ffff800004f9ce58>] wacom_parse_and_register+0x338/0x900 [wacom] [ 56.698050] [<ffff800004f9d74c>] wacom_probe+0x32c/0x420 [wacom] [ 56.698099] [<9000000006307564>] hid_device_probe+0x144/0x260 [ 56.698103] [<9000000005e65d68>] really_probe+0x208/0x540 [ 56.698109] [<9000000005e661dc>] __driver_probe_device+0x13c/0x1e0 [ 56.698112] [<9000000005e66620>] driver_probe_device+0x40/0x100 [ 56.698116] [<9000000005e6680c>] __device_attach_driver+0x12c/0x180 [ 56.698119] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160 [ 56.698123] [<9000000005e66468>] __device_attach+0x108/0x260 [ 56.698126] [<9000000005e63918>] device_reprobe+0x78/0x100 [ 56.698129] [<9000000005e62a68>] bus_for_each_dev+0x88/0x160 [ 56.698132] [<9000000006304e54>] __hid_bus_driver_added+0x34/0x80 [ 56.698134] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160 [ 56.698137] [<9000000006304df0>] __hid_register_driver+0x70/0xa0 [ 56.698142] [<9000000004e10fe4>] do_one_initcall+0x104/0x320 [ 56.698146] [<9000000004f38150>] do_init_module+0x90/0x2c0 [ 56.698151] [<9000000004f3a3d8>] init_module_from_file+0xb8/0x120 [ 56.698155] [<9000000004f3a590>] idempotent_init_module+0x150/0x3a0 [ 56.698159] [<9000000004f3a890>] sys_finit_module+0xb0/0x140 [ 56.698163] [<900000000671e4e8>] do_syscall+0x88/0xc0 [ 56.698166] [<9000000004e12404>] handle_syscall+0xc4/0x160 [ 56.698171] Code: 0011958f 00150224 5800cd85 <2a00022c> 00150004 4000c180 0015022c 03400000 03400000 [ 56.698192] ---[ end trace 0000000000000000 ]---
--- drivers/hid/wacom_sys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/wacom_sys.c +2 -1
@@ -2242,7 +2242,8 @@ static void wacom_update_name(struct wacif (hid_is_usb (wacom->hdev)) {struct usb_interface *intf =to_usb_interface (wacom->hdev->dev.parent);struct usb_device *dev =interface_to_usbdev (intf); - product_name = dev->product; +if (dev->product !=NULL ) + product_name = dev->product; }if (wacom->hdev->bus ==BUS_I2C ) {
Greg Kroah-Hartman
maintainerPATCH 360/459 watchdog: rti: of: honor timeout-sec property
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 4962ee045d8f06638714d801ab0fb72f89c16690 upstream.
Currently "timeout-sec" Device Tree property is being silently ignored:
even though watchdog_init_timeout() is being used, the driver always passes "heartbeat" == DEFAULT_HEARTBEAT == 60 as argument.
Fix this by setting struct watchdog_device::timeout to DEFAULT_HEARTBEAT and passing real module parameter value to watchdog_init_timeout() (which may now be 0 if not specified).
--- drivers/watchdog/rti_wdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/rti_wdt.c +2 -1
@@ -54,7 +54,7 @@#define MAX_HW_ERROR 250 -static int heartbeat =DEFAULT_HEARTBEAT ; +static int heartbeat;/* * struct to hold data for each WDT device
@@ -242,6 +242,7 @@ static int rti_wdt_probe(struct platform wdd->min_timeout =1 ; wdd->max_hw_heartbeat_ms = (WDT_PRELOAD_MAX <<WDT_PRELOAD_SHIFT ) / wdt->freq *1000 ; + wdd->timeout =DEFAULT_HEARTBEAT ; wdd->parent = dev;watchdog_set_drvdata (wdd, wdt);
Greg Kroah-Hartman
maintainerPATCH 361/459 tracing: Fix cmp_entries_dup() to respect sort() comparison rules
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
commit e63fbd5f6810ed756bbb8a1549c7d4132968baa9 upstream.
The cmp_entries_dup() function used as the comparator for sort() violated the symmetry and transitivity properties required by the sorting algorithm. Specifically, it returned 1 whenever memcmp() was non-zero, which broke the following expectations:
* Symmetry: If x < y, then y > x.
* Transitivity: If x < y and y < z, then x < z.
These violations could lead to incorrect sorting and failure to correctly identify duplicate elements.
Fix the issue by directly returning the result of memcmp(), which adheres to the required comparison properties.
--- kernel/trace/tracing_map.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
kernel/trace/tracing_map.c +1 -5
@@ -845,15 +845,11 @@ int tracing_map_init(struct tracing_mapstatic int cmp_entries_dup (const void *A ,const void *B ) {const struct tracing_map_sort_entry *a, *b; -int ret =0 ; a = *(const struct tracing_map_sort_entry **)A ; b = *(const struct tracing_map_sort_entry **)B ; -if (memcmp (a->key, b->key, a->elt->map->key_size)) - ret =1 ; - -return ret; +return memcmp (a->key, b->key, a->elt->map->key_size); }static int cmp_entries_sum (const void *A ,const void *B )
Greg Kroah-Hartman
maintainerPATCH 362/459 arm64: ptrace: fix partial SETREGSET for NT_ARM_TAGGED_ADDR_CTRL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit ca62d90085f4af36de745883faab9f8a7cbb45d3 upstream.
Currently tagged_addr_ctrl_set() doesn't initialize the temporary 'ctrl' variable, and a SETREGSET call with a length of zero will leave this uninitialized. Consequently tagged_addr_ctrl_set() will consume an arbitrary value, potentially leaking up to 64 bits of memory from the kernel stack. The read is limited to a specific slot on the stack, and the issue does not provide a write mechanism.
As set_tagged_addr_ctrl() only accepts values where bits [63:4] zero and rejects other values, a partial SETREGSET attempt will randomly succeed or fail depending on the value of the uninitialized value, and the exposure is significantly limited.
Fix this by initializing the temporary value before copying the regset from userspace, as for other regsets (e.g. NT_PRSTATUS, NT_PRFPREG, NT_ARM_SYSTEM_CALL). In the case of a zero-length write, the existing value of the tagged address ctrl will be retained.
The NT_ARM_TAGGED_ADDR_CTRL regset is only visible in the user_aarch64_view used by a native AArch64 task to manipulate another native AArch64 task. As get_tagged_addr_ctrl() only returns an error value when called for a compat task, tagged_addr_ctrl_get() and tagged_addr_ctrl_set() should never observe an error value from get_tagged_addr_ctrl(). Add a WARN_ON_ONCE() to both to indicate that such an error would be unexpected, and error handlnig is not missing in either case.
--- arch/arm64/kernel/ptrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kernel/ptrace.c +5 -1
@@ -1040,7 +1040,7 @@ static int tagged_addr_ctrl_get(struct t {long ctrl =get_tagged_addr_ctrl (target); -if (IS_ERR_VALUE (ctrl)) +if (WARN_ON_ONCE (IS_ERR_VALUE (ctrl)))return ctrl;return membuf_write (&to, &ctrl,sizeof (ctrl));
@@ -1054,6 +1054,10 @@ static int tagged_addr_ctrl_set(struct tint ret;long ctrl; + ctrl =get_tagged_addr_ctrl (target); +if (WARN_ON_ONCE (IS_ERR_VALUE (ctrl))) +return ctrl; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, &ctrl,0 ,-1 );if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 363/459 ALSA: usb-audio: add mixer mapping for Corsair HS80
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marie Ramlow <[email protected]>
commit a7de2b873f3dbcda02d504536f1ec6dc50e3f6c4 upstream.
The Corsair HS80 RGB Wireless is a USB headset with a mic and a sidetone feature. It has the same quirk as the Virtuoso series.
This labels the mixers appropriately, so applications don't move the sidetone volume when they actually intend to move the main headset volume.
--- sound/usb/mixer_maps.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/usb/mixer_maps.c +10 -0
@@ -596,6 +596,16 @@ static const struct usbmix_ctl_map usbmi .id = USB_ID(0x1b1c, 0x0a42), .map = corsair_virtuoso_map, }, + { + /* Corsair HS80 RGB Wireless (wired mode) */ + .id = USB_ID(0x1b1c, 0x0a6a), + .map = corsair_virtuoso_map, + }, + { + /* Corsair HS80 RGB Wireless (wireless mode) */ + .id = USB_ID(0x1b1c, 0x0a6b), + .map = corsair_virtuoso_map, + }, { /* Gigabyte TRX40 Aorus Master (rear panel + front mic) */ .id = USB_ID(0x0414, 0xa001), .map = aorus_master_alc1220vb_map,
Greg Kroah-Hartman
maintainerPATCH 364/459 ALSA: hda/realtek: Enable mute and micmute LED on HP ProBook 430 G8
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nazar Bilinskyi <[email protected]>
commit 3a83f7baf1346aca885cb83cb888e835fef7c472 upstream.
HP ProBook 430 G8 has a mute and micmute LEDs that can be made to work using quirk ALC236_FIXUP_HP_GPIO_LED. Enable already existing quirk.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9149,6 +9149,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x103c ,0x87b7 ,"HP Laptop 14-fq0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x87c8 ,"HP" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87d3 ,"HP Laptop 15-gw0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), +SND_PCI_QUIRK (0x103c ,0x87df ,"HP ProBook 430 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87e5 ,"HP ProBook 440 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87e7 ,"HP ProBook 450 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Greg Kroah-Hartman
maintainerPATCH 365/459 ALSA: hda/realtek: Add support for Samsung Galaxy Book3 360 (NP730QFG)
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sahas Leelodharry <[email protected]>
commit e2974a220594c06f536e65dfd7b2447e0e83a1cb upstream.
Fixes the 3.5mm headphone jack on the Samsung Galaxy Book 3 360 NP730QFG laptop.
Unlike the other Galaxy Book3 series devices, this device only needs the ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET quirk. Verified changes on the device and compared with codec state in Windows.
[ white-space fixes by tiwai ]
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9269,6 +9269,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x144d ,0xc830 ,"Samsung Galaxy Book Ion (NT950XCJ-X716A)" ,ALC298_FIXUP_SAMSUNG_AMP ),SND_PCI_QUIRK (0x144d ,0xc832 ,"Samsung Galaxy Book Flex Alpha (NP730QCJ)" ,ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xca03 ,"Samsung Galaxy Book2 Pro 360 (NP930QED)" ,ALC298_FIXUP_SAMSUNG_AMP ), +SND_PCI_QUIRK (0x144d ,0xca06 ,"Samsung Galaxy Book3 360 (NP730QFG)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc868 ,"Samsung Galaxy Book2 Pro (NP930XED)" ,ALC298_FIXUP_SAMSUNG_AMP ),SND_PCI_QUIRK (0x1458 ,0xfa53 ,"Gigabyte BXBT-2807" ,ALC283_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Greg Kroah-Hartman
maintainerPATCH 366/459 scsi: qla2xxx: Fix NVMe and NPIV connect issue
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 4812b7796c144f63a1094f79a5eb8fbdad8d7ebc upstream.
NVMe controller fails to send connect command due to failure to locate hw context buffer for NVMe queue 0 (blk_mq_hw_ctx, hctx_idx=0). The cause of the issue is NPIV host did not initialize the vha->irq_offset field. This field is given to blk-mq (blk_mq_pci_map_queues) to help locate the beginning of IO Queues which in turn help locate NVMe queue 0.
Initialize this field to allow NVMe to work properly with NPIV host.
kernel: nvme nvme5: Connect command failed, errno: -18
kernel: nvme nvme5: qid 0: secure concatenation is not supported
kernel: nvme nvme5: NVME-FC{5}: create_assoc failed, assoc_id 2e9100 ret 401
kernel: nvme nvme5: NVME-FC{5}: reset: Reconnect attempt failed (401)
kernel: nvme nvme5: NVME-FC{5}: Reconnect attempt in 2 seconds
--- drivers/scsi/qla2xxx/qla_mid.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_mid.c +1 -0
@@ -498,6 +498,7 @@ qla24xx_create_vhost(struct fc_vport *fcreturn (NULL ); } + vha->irq_offset =QLA_BASE_VECTORS ; host = vha->host; fc_vport->dd_data = vha;/* New host info */
Greg Kroah-Hartman
maintainerPATCH 367/459 scsi: qla2xxx: Supported speed displayed incorrectly for VPorts
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anil Gurumurthy <[email protected]>
commit e4e268f898c8a08f0a1188677e15eadbc06e98f6 upstream.
The fc_function_template for vports was missing the .show_host_supported_speeds. The base port had the same.
Add .show_host_supported_speeds to the vport template as well.
--- drivers/scsi/qla2xxx/qla_attr.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_attr.c +1 -0
@@ -3244,6 +3244,7 @@ struct fc_function_template qla2xxx_tran .show_host_node_name = 1, .show_host_port_name = 1, .show_host_supported_classes = 1, + .show_host_supported_speeds = 1, .get_host_port_id = qla2x00_get_host_port_id, .show_host_port_id = 1,
Greg Kroah-Hartman
maintainerPATCH 368/459 scsi: qla2xxx: Fix use after free on unload
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 07c903db0a2ff84b68efa1a74a4de353ea591eb0 upstream.
System crash is observed with stack trace warning of use after free. There are 2 signals to tell dpc_thread to terminate (UNLOADING flag and kthread_stop).
On setting the UNLOADING flag when dpc_thread happens to run at the time and sees the flag, this causes dpc_thread to exit and clean up itself. When kthread_stop is called for final cleanup, this causes use after free.
Remove UNLOADING signal to terminate dpc_thread. Use the kthread_stop as the main signal to exit dpc_thread.
[596663.812935] kernel BUG at mm/slub.c:294! [596663.812950] invalid opcode: 0000 [#1] SMP PTI [596663.812957] CPU: 13 PID: 1475935 Comm: rmmod Kdump: loaded Tainted: G IOE --------- - - 4.18.0-240.el8.x86_64 #1 [596663.812960] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 08/20/2012 [596663.812974] RIP: 0010:__slab_free+0x17d/0x360
...
[596663.813008] Call Trace: [596663.813022] ? __dentry_kill+0x121/0x170 [596663.813030] ? _cond_resched+0x15/0x30 [596663.813034] ? _cond_resched+0x15/0x30 [596663.813039] ? wait_for_completion+0x35/0x190 [596663.813048] ? try_to_wake_up+0x63/0x540 [596663.813055] free_task+0x5a/0x60 [596663.813061] kthread_stop+0xf3/0x100 [596663.813103] qla2x00_remove_one+0x284/0x440 [qla2xxx]
--- drivers/scsi/qla2xxx/qla_os.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +8 -7
@@ -6655,12 +6655,15 @@ qla2x00_do_dpc(void *data)set_user_nice (current,MIN_NICE );set_current_state (TASK_INTERRUPTIBLE ); -while (!kthread_should_stop ()) { +while (1 ) {ql_dbg (ql_dbg_dpc, base_vha,0x4000 ,"DPC handler sleeping.\n" );schedule (); +if (kthread_should_stop ()) +break ; +if (test_and_clear_bit (DO_EEH_RECOVERY , &base_vha->dpc_flags))qla_pci_set_eeh_busy (base_vha);
@@ -6673,15 +6676,16 @@ qla2x00_do_dpc(void *data) goto end_loop; } +if (test_bit (UNLOADING , &base_vha->dpc_flags)) +/* don't do any work. Wait to be terminated by kthread_stop */ + goto end_loop; + ha->dpc_active =1 ;ql_dbg (ql_dbg_dpc + ql_dbg_verbose, base_vha,0x4001 ,"DPC handler waking up, dpc_flags=0x%lx.\n" , base_vha->dpc_flags); -if (test_bit (UNLOADING , &base_vha->dpc_flags)) -break ; -if (IS_P3P_TYPE (ha)) {if (IS_QLA8044 (ha)) { if (test_and_clear_bit(ISP_UNRECOVERABLE,
@@ -6999,9 +7003,6 @@ end_loop:*/ ha->dpc_active =0 ; -/* Cleanup any residual CTX SRBs. */ -qla2x00_abort_all_cmds (base_vha,DID_NO_CONNECT <<16 ); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 369/459 scsi: qla2xxx: Remove check req_sg_cnt should be equal to rsp_sg_cnt
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saurav Kashyap <[email protected]>
commit 833c70e212fc40d3e98da941796f4c7bcaecdf58 upstream.
Firmware supports multiple sg_cnt for request and response for CT commands, so remove the redundant check. A check is there where sg_cnt for request and response should be same. This is not required as driver and FW have code to handle multiple and different sg_cnt on request and response.
--- drivers/scsi/qla2xxx/qla_bsg.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.c +0 -10
@@ -471,16 +471,6 @@ qla2x00_process_ct(struct bsg_job *bsg_j goto done; } -if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || - (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { -ql_log (ql_log_warn, vha,0x7011 , -"request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x " -"dma_reply_sg_cnt: %x\n" , bsg_job->request_payload.sg_cnt, - req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); - rval = -EAGAIN ; - goto done_unmap_sg; - } -if (!vha->flags.online) {ql_log (ql_log_warn, vha,0x7012 ,"Host is not online.\n" );
Greg Kroah-Hartman
maintainerPATCH 370/459 nilfs2: fix potential out-of-bounds memory access in nilfs_find_entry()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 985ebec4ab0a28bb5910c3b1481a40fbf7f9e61d upstream.
Syzbot reported that when searching for records in a directory where the inode's i_size is corrupted and has a large value, memory access outside the folio/page range may occur, or a use-after-free bug may be detected if KASAN is enabled.
This is because nilfs_last_byte(), which is called by nilfs_find_entry() and others to calculate the number of valid bytes of directory data in a page from i_size and the page index, loses the upper 32 bits of the 64-bit size information due to an inappropriate type of local variable to which the i_size value is assigned.
This caused a large byte offset value due to underflow in the end address calculation in the calling nilfs_find_entry(), resulting in memory access that exceeds the folio/page size.
Fix this issue by changing the type of the local variable causing the bit loss from "unsigned int" to "u64". The return value of nilfs_last_byte() is also of type "unsigned int", but it is truncated so as not to exceed PAGE_SIZE and no bit loss occurs, so no change is required.
--- fs/nilfs2/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/dir.c +1 -1
@@ -76,7 +76,7 @@ static inline void nilfs_put_page(struct*/ static unsigned int nilfs_last_byte (struct inode *inode,unsigned long page_nr) { -unsigned int last_byte = inode->i_size; +u64 last_byte = inode->i_size; last_byte -= page_nr <<PAGE_SHIFT ;if (last_byte >PAGE_SIZE )
Greg Kroah-Hartman
maintainerPATCH 371/459 bcache: revert replacing IS_ERR_OR_NULL with IS_ERR again
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liequan Che <[email protected]>
commit b2e382ae12a63560fca35050498e19e760adf8c0 upstream.
Commit 028ddcac477b ("bcache: Remove unnecessary NULL point check in node allocations") leads a NULL pointer deference in cache_set_flush().
1721 if (!IS_ERR_OR_NULL(c->root))
1722 list_add(&c->root->list, &c->btree_cache);
Quoted 1 line
From the above code in
cache_set_flush(), if previous registration code
fails before allocating c->root, it is possible c->root is NULL as what it is initialized. __bch_btree_node_alloc() never returns NULL but c->root is possible to be NULL at above line 1721.
This patch replaces IS_ERR() by IS_ERR_OR_NULL() to fix this.
--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/super.c +1 -1
@@ -1750,7 +1750,7 @@ static void cache_set_flush(struct closuif (!IS_ERR_OR_NULL (c->gc_thread))kthread_stop (c->gc_thread); -if (!IS_ERR (c->root)) +if (!IS_ERR_OR_NULL (c->root))list_add (&c->root->list, &c->btree_cache);/*
Greg Kroah-Hartman
maintainerPATCH 372/459 bpf: fix OOB devmap writes when deleting elements
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
commit ab244dd7cf4c291f82faacdc50b45cc0f55b674d upstream.
Jordy reported issue against XSKMAP which also applies to DEVMAP - the index used for accessing map entry, due to being a signed integer, causes the OOB writes. Fix is simple as changing the type from int to u32, however, when compared to XSKMAP case, one more thing needs to be addressed.
When map is released from system via dev_map_free(), we iterate through all of the entries and an iterator variable is also an int, which implies OOB accesses. Again, change it to be u32.
Example splat below:
[ 160.724676] BUG: unable to handle page fault for address: ffffc8fc2c001000 [ 160.731662] #PF: supervisor read access in kernel mode [ 160.736876] #PF: error_code(0x0000) - not-present page [ 160.742095] PGD 0 P4D 0 [ 160.744678] Oops: Oops: 0000 [#1] PREEMPT SMP [ 160.749106] CPU: 1 UID: 0 PID: 520 Comm: kworker/u145:12 Not tainted 6.12.0-rc1+ #487 [ 160.757050] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019 [ 160.767642] Workqueue: events_unbound bpf_map_free_deferred [ 160.773308] RIP: 0010:dev_map_free+0x77/0x170 [ 160.777735] Code: 00 e8 fd 91 ed ff e8 b8 73 ed ff 41 83 7d 18 19 74 6e 41 8b 45 24 49 8b bd f8 00 00 00 31 db 85 c0 74 48 48 63 c3 48 8d 04 c7 <48> 8b 28 48 85 ed 74 30 48 8b 7d 18 48 85 ff 74 05 e8 b3 52 fa ff [ 160.796777] RSP: 0018:ffffc9000ee1fe38 EFLAGS: 00010202 [ 160.802086] RAX: ffffc8fc2c001000 RBX: 0000000080000000 RCX: 0000000000000024 [ 160.809331] RDX: 0000000000000000 RSI: 0000000000000024 RDI: ffffc9002c001000 [ 160.816576] RBP: 0000000000000000 R08: 0000000000000023 R09: 0000000000000001 [ 160.823823] R10: 0000000000000001 R11: 00000000000ee6b2 R12: dead000000000122 [ 160.831066] R13: ffff88810c928e00 R14: ffff8881002df405 R15: 0000000000000000 [ 160.838310] FS: 0000000000000000(0000) GS:ffff8897e0c40000(0000) knlGS:0000000000000000 [ 160.846528] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 160.852357] CR2: ffffc8fc2c001000 CR3: 0000000005c32006 CR4: 00000000007726f0 [ 160.859604] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 160.866847] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 160.874092] PKRU: 55555554 [ 160.876847] Call Trace: [ 160.879338] <TASK> [ 160.881477] ? __die+0x20/0x60 [ 160.884586] ? page_fault_oops+0x15a/0x450 [ 160.888746] ? search_extable+0x22/0x30 [ 160.892647] ? search_bpf_extables+0x5f/0x80 [ 160.896988] ? exc_page_fault+0xa9/0x140 [ 160.900973] ? asm_exc_page_fault+0x22/0x30 [ 160.905232] ? dev_map_free+0x77/0x170 [ 160.909043] ? dev_map_free+0x58/0x170 [ 160.912857] bpf_map_free_deferred+0x51/0x90 [ 160.917196] process_one_work+0x142/0x370 [ 160.921272] worker_thread+0x29e/0x3b0 [ 160.925082] ? rescuer_thread+0x4b0/0x4b0 [ 160.929157] kthread+0xd4/0x110 [ 160.932355] ? kthread_park+0x80/0x80 [ 160.936079] ret_from_fork+0x2d/0x50 [ 160.943396] ? kthread_park+0x80/0x80 [ 160.950803] ret_from_fork_asm+0x11/0x20 [ 160.958482] </TASK>
--- kernel/bpf/devmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/bpf/devmap.c +3 -3
@@ -198,7 +198,7 @@ static struct bpf_map *dev_map_alloc(unistatic void dev_map_free (struct bpf_map *map) { struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); -int i; +u32 i;/* At this point bpf_prog->aux->refcnt == 0 and this map->refcnt == 0, * so the programs (can be more than one that used this map) were
@@ -557,7 +557,7 @@ static int dev_map_delete_elem(struct bp { struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map);struct bpf_dtab_netdev *old_dev; -int k = *(u32 *)key; +u32 k = *(u32 *)key;if (k >= map->max_entries)return -EINVAL ;
@@ -579,7 +579,7 @@ static int dev_map_hash_delete_elem(stru { struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map);struct bpf_dtab_netdev *old_dev; -int k = *(u32 *)key; +u32 k = *(u32 *)key;unsigned long flags;int ret = -ENOENT ;
Greg Kroah-Hartman
maintainerPATCH 373/459 dma-buf: fix dma_fence_array_signaled v4
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit 78ac1c3558810486d90aa533b0039aa70487a3da upstream.
The function silently assumed that signaling was already enabled for the dma_fence_array. This meant that without enabling signaling first we would never see forward progress.
Fix that by falling back to testing each individual fence when signaling isn't enabled yet.
v2: add the comment suggested by Boris why this is done this way
v3: fix the underflow pointed out by Tvrtko
v4: atomic_read_acquire() as suggested by Tvrtko
--- drivers/dma-buf/dma-fence-array.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/dma-buf/dma-fence-array.c +27 -1
@@ -103,10 +103,36 @@ static bool dma_fence_array_enable_signastatic bool dma_fence_array_signaled (struct dma_fence *fence) {struct dma_fence_array *array =to_dma_fence_array (fence); +int num_pending; +unsigned int i; -if (atomic_read (&array->num_pending) >0 ) +/* +* We need to read num_pending before checking the enable_signal bit +* to avoid racing with the enable_signaling() implementation, which +* might decrement the counter, and cause a partial check. +* atomic_read_acquire() pairs with atomic_dec_and_test() in +* dma_fence_array_enable_signaling() +* +* The !--num_pending check is here to account for the any_signaled case +* if we race with enable_signaling(), that means the !num_pending check +* in the is_signalling_enabled branch might be outdated (num_pending +* might have been decremented), but that's fine. The user will get the +* right value when testing again later. +*/ + num_pending =atomic_read_acquire (&array->num_pending); +if (test_bit (DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT , &array->base.flags)) { +if (num_pending <=0 ) + goto signal;return false; + } +for (i =0 ; i < array->num_fences; ++i) { +if (dma_fence_is_signaled (array->fences[i]) && !--num_pending) + goto signal; + } +return false; + +signal:dma_fence_array_clear_pending_error (array);return true; }
Greg Kroah-Hartman
maintainerPATCH 374/459 regmap: detach regmap from dev on regmap_exit
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
commit 3061e170381af96d1e66799d34264e6414d428a7 upstream.
At the end of __regmap_init(), if dev is not NULL, regmap_attach_dev() is called, which adds a devres reference to the regmap, to be able to retrieve a dev's regmap by name using dev_get_regmap().
When calling regmap_exit, the opposite does not happen, and the reference is kept until the dev is detached.
Add a regmap_detach_dev() function and call it in regmap_exit() to make sure that the devres reference is not kept.
Rule: add
--- drivers/base/regmap/regmap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/base/regmap/regmap.c +12 -0
@@ -636,6 +636,17 @@ int regmap_attach_dev(struct device *dev }EXPORT_SYMBOL_GPL (regmap_attach_dev); +static int dev_get_regmap_match (struct device *dev,void *res,void *data); + +static int regmap_detach_dev (struct device *dev,struct regmap *map) +{ +if (!dev) +return 0 ; + +return devres_release (dev, dev_get_regmap_release, + dev_get_regmap_match, (void *)map->name); +} +static enum regmap_endian regmap_get_reg_endian (const struct regmap_bus *bus,const struct regmap_config *config) {
@@ -1493,6 +1504,7 @@ void regmap_exit(struct regmap *map) {struct regmap_async *async; +regmap_detach_dev (map->dev, map);regcache_exit (map);regmap_debugfs_exit (map);regmap_range_exit (map);
Greg Kroah-Hartman
maintainerPATCH 375/459 mmc: sdhci-pci: Add DMI quirk for missing CD GPIO on Vexia Edu Atla 10 tablet
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 7f0fa47ceebcff0e3591bb7e32a71a2cd7846149 upstream.
The Vexia Edu Atla 10 tablet distributed to schools in the Spanish Andalucía region has no ACPI fwnode associated with the SDHCI controller for its microsd-slot and thus has no ACPI GPIO resource info.
This causes the following error to be logged and the slot to not work:
[ 10.572113] sdhci-pci 0000:00:12.0: failed to setup card detect gpio
Add a DMI quirk table for providing gpiod_lookup_tables with manually provided CD GPIO info and use this DMI table to provide the CD GPIO info on this tablet. This fixes the microsd-slot not working.
Message-ID: <[email protected]>
--- drivers/mmc/host/sdhci-pci-core.c | 72 ++++++++++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci-pci.h | 1 2 files changed, 73 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +72 -0
@@ -23,6 +23,7 @@#include <linux/io.h> #include <linux/iopoll.h> #include <linux/gpio.h> +#include <linux/gpio/machine.h> #include <linux/pm_runtime.h> #include <linux/pm_qos.h> #include <linux/debugfs.h>
@@ -1292,6 +1293,29 @@ static const struct sdhci_pci_fixes sdhc .priv_size = sizeof(struct intel_host), }; +/* DMI quirks for devices with missing or broken CD GPIO info */ +static const struct gpiod_lookup_table vexia_edu_atla10_cd_gpios = { + .dev_id ="0000:00:12.0" , + .table = { +GPIO_LOOKUP ("INT33FC:00" ,38 ,"cd" ,GPIO_ACTIVE_HIGH ), + { } + }, +}; + +static const struct dmi_system_id sdhci_intel_byt_cd_gpio_override[] = { + { +/* Vexia Edu Atla 10 tablet 9V version */ + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"AMI Corporation" ), +DMI_MATCH (DMI_BOARD_NAME ,"Aptio CRB" ), +/* Above strings are too generic, also match on BIOS date */ +DMI_MATCH (DMI_BIOS_DATE ,"08/25/2014" ), + }, + .driver_data = (void *)&vexia_edu_atla10_cd_gpios, + }, + { } +}; +static const struct sdhci_pci_fixes sdhci_intel_byt_sd = { #ifdef CONFIG_PM_SLEEP .resume = byt_resume,
@@ -1310,6 +1334,7 @@ static const struct sdhci_pci_fixes sdhc .add_host = byt_add_host, .remove_slot = byt_remove_slot, .ops = &sdhci_intel_byt_ops, + .cd_gpio_override = sdhci_intel_byt_cd_gpio_override, .priv_size = sizeof(struct intel_host), };
@@ -2101,6 +2126,42 @@ static const struct dev_pm_ops sdhci_pci* * \*****************************************************************************/ +static struct gpiod_lookup_table *sdhci_pci_add_gpio_lookup_table ( +struct sdhci_pci_chip *chip) +{ +struct gpiod_lookup_table *cd_gpio_lookup_table; +const struct dmi_system_id *dmi_id =NULL ; +size_t count; + +if (chip->fixes && chip->fixes->cd_gpio_override) + dmi_id =dmi_first_match (chip->fixes->cd_gpio_override); + +if (!dmi_id) +return NULL ; + + cd_gpio_lookup_table = dmi_id->driver_data; +for (count =0 ; cd_gpio_lookup_table->table[count].key; count++) + ; + + cd_gpio_lookup_table =kmemdup (dmi_id->driver_data, +/* count + 1 terminating entry */ +struct_size (cd_gpio_lookup_table, table, count +1 ), +GFP_KERNEL ); +if (!cd_gpio_lookup_table) +return ERR_PTR (-ENOMEM ); + +gpiod_add_lookup_table (cd_gpio_lookup_table); +return cd_gpio_lookup_table; +} + +static void sdhci_pci_remove_gpio_lookup_table (struct gpiod_lookup_table *lookup_table) +{ +if (lookup_table) { +gpiod_remove_lookup_table (lookup_table); +kfree (lookup_table); + } +} +static struct sdhci_pci_slot *sdhci_pci_probe_slot (struct pci_dev *pdev,struct sdhci_pci_chip *chip,int first_bar,int slotno)
@@ -2205,8 +2266,19 @@ static struct sdhci_pci_slot *sdhci_pci_device_init_wakeup (&pdev->dev, true);if (slot->cd_idx >=0 ) { +struct gpiod_lookup_table *cd_gpio_lookup_table; + + cd_gpio_lookup_table =sdhci_pci_add_gpio_lookup_table (chip); +if (IS_ERR (cd_gpio_lookup_table)) { + ret =PTR_ERR (cd_gpio_lookup_table); + goto remove; + } + ret =mmc_gpiod_request_cd (host->mmc,"cd" , slot->cd_idx, slot->cd_override_level,0 ); + +sdhci_pci_remove_gpio_lookup_table (cd_gpio_lookup_table); +if (ret && ret != -EPROBE_DEFER ) ret = mmc_gpiod_request_cd(host->mmc, NULL, slot->cd_idx,
drivers/mmc/host/sdhci-pci.h +1 -0
@@ -151,6 +151,7 @@ struct sdhci_pci_fixes {#endif const struct sdhci_ops *ops; +const struct dmi_system_id *cd_gpio_override;size_t priv_size; };
Greg Kroah-Hartman
maintainerPATCH 376/459 mmc: core: Further prevent card detect during shutdown
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit 87a0d90fcd31c0f36da0332428c9e1a1e0f97432 upstream.
Disabling card detect from the host's ->shutdown_pre() callback turned out to not be the complete solution. More precisely, beyond the point when the mmc_bus->shutdown() has been called, to gracefully power off the card, we need to prevent card detect. Otherwise the mmc_rescan work may poll for the card with a CMD13, to see if it's still alive, which then will fail and hang as the card has already been powered off.
To fix this problem, let's disable mmc_rescan prior to power off the card during shutdown.
Message-ID: <[email protected]>
--- drivers/mmc/core/bus.c | 2 ++ drivers/mmc/core/core.c | 3 +++ 2 files changed, 5 insertions(+)
drivers/mmc/core/bus.c +2 -0
@@ -160,6 +160,8 @@ static void mmc_bus_shutdown(struct deviif (dev->driver && drv->shutdown) drv->shutdown (card); +__mmc_stop_host (host); +if (host->bus_ops->shutdown) { ret = host->bus_ops->shutdown (host);if (ret)
drivers/mmc/core/core.c +3 -0
@@ -2345,6 +2345,9 @@ void mmc_start_host(struct mmc_host *hosvoid __mmc_stop_host (struct mmc_host *host) { +if (host->rescan_disable) +return ; +if (host->slot.cd_irq >=0 ) {mmc_gpio_set_cd_wake (host, false);disable_irq (host->slot.cd_irq);
Greg Kroah-Hartman
maintainerPATCH 377/459 ocfs2: update seq_file index in ocfs2_dlm_seq_next
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wengang Wang <[email protected]>
commit 914eec5e980171bc128e7e24f7a22aa1d803570e upstream.
The following INFO level message was seen:
seq_file: buggy .next function ocfs2_dlm_seq_next [ocfs2] did not update position index
Fix:
Update *pos (so m->index) to make seq_read_iter happy though the index its self makes no sense to ocfs2_dlm_seq_next.
--- fs/ocfs2/dlmglue.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/dlmglue.c +1 -0
@@ -3101,6 +3101,7 @@ static void *ocfs2_dlm_seq_next(struct sstruct ocfs2_lock_res *iter = v;struct ocfs2_lock_res *dummy = &priv->p_iter_res; + (*pos)++;spin_lock (&ocfs2_dlm_tracking_lock); iter =ocfs2_dlm_next_res (iter, priv);list_del_init (&dummy->l_debug_list);
Greg Kroah-Hartman
maintainerPATCH 378/459 iommu/arm-smmu: Defer probe of clients after smmu device bound
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Brahma <[email protected]>
commit 229e6ee43d2a160a1592b83aad620d6027084aad upstream.
Null pointer dereference occurs due to a race between smmu driver probe and client driver probe, when of_dma_configure() for client is called after the iommu_device_register() for smmu driver probe has executed but before the driver_bound() for smmu driver has been called.
Following is how the race occurs:
T1:Smmu device probe T2: Client device probe
really_probe()arm_smmu_device_probe()iommu_device_register()
really_probe() platform_dma_configure() of_dma_configure() of_dma_configure_id() of_iommu_configure() iommu_probe_device() iommu_init_device() arm_smmu_probe_device() arm_smmu_get_by_fwnode() driver_find_device_by_fwnode() driver_find_device() next_device() klist_next() /* null ptr assigned to smmu */ /* null ptr dereference while smmu->streamid_mask */
driver_bound()
klist_add_tail()
When this null smmu pointer is dereferenced later in arm_smmu_probe_device, the device crashes.
Fix this by deferring the probe of the client device until the smmu device has bound to the arm smmu driver.
--- drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/iommu/arm/arm-smmu/arm-smmu.c +11 -0
@@ -1387,6 +1387,17 @@ static struct iommu_device *arm_smmu_pro goto out_free; }else if (fwspec && fwspec->ops == &arm_smmu_ops) { smmu =arm_smmu_get_by_fwnode (fwspec->iommu_fwnode); + +/* +* Defer probe if the relevant SMMU instance hasn't finished +* probing yet. This is a fragile hack and we'd ideally +* avoid this race in the core code. Until that's ironed +* out, however, this is the most pragmatic option on the +* table. +*/ +if (!smmu) +return ERR_PTR (dev_err_probe (dev, -EPROBE_DEFER , +"smmu dev has not bound yet\n" )); }else {return ERR_PTR (-ENODEV ); }
Greg Kroah-Hartman
maintainerPATCH 379/459 s390/cpum_sf: Handle CPU hotplug remove during sampling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit a0bd7dacbd51c632b8e2c0500b479af564afadf3 ]
CPU hotplug remove handling triggers the following function call sequence:
CPUHP_AP_PERF_S390_SF_ONLINE --> s390_pmu_sf_offline_cpu()
...
CPUHP_AP_PERF_ONLINE --> perf_event_exit_cpu()
The s390 CPUMF sampling CPU hotplug handler invokes:
s390_pmu_sf_offline_cpu()
+--> cpusf_pmu_setup()
+--> setup_pmc_cpu()
+--> deallocate_buffers()This function de-allocates all sampling data buffers (SDBs) allocated for that CPU at event initialization. It also clears the PMU_F_RESERVED bit. The CPU is gone and can not be sampled.
With the event still being active on the removed CPU, the CPU event hotplug support in kernel performance subsystem triggers the following function calls on the removed CPU:
perf_event_exit_cpu()
+--> perf_event_exit_cpu_context()
+--> __perf_event_exit_context()
+--> __perf_remove_from_context()
+--> event_sched_out()
+--> cpumsf_pmu_del()
+--> cpumsf_pmu_stop()
+--> hw_perf_event_update()to stop and remove the event. During removal of the event, the sampling device driver tries to read out the remaining samples from the sample data buffers (SDBs). But they have already been freed (and may have been re-assigned). This may lead to a use after free situation in which case the samples are most likely invalid. In the best case the memory has not been reassigned and still contains valid data.
Remedy this situation and check if the CPU is still in reserved state (bit PMU_F_RESERVED set). In this case the SDBs have not been released an contain valid data. This is always the case when the event is removed (and no CPU hotplug off occured). If the PMU_F_RESERVED bit is not set, the SDB buffers are gone.
--- arch/s390/kernel/perf_cpum_sf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/s390/kernel/perf_cpum_sf.c +3 -1
@@ -1896,7 +1896,9 @@ static void cpumsf_pmu_stop(struct perf_event *event, int flags) event->hw.state |=PERF_HES_STOPPED ;if ((flags &PERF_EF_UPDATE ) && !(event->hw.state &PERF_HES_UPTODATE )) { -hw_perf_event_update (event,1 ); +/* CPU hotplug off removes SDBs. No samples to extract. */ +if (cpuhw->flags &PMU_F_RESERVED ) +hw_perf_event_update (event,1 ); event->hw.state |=PERF_HES_UPTODATE ; }perf_pmu_enable (event->pmu);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 380/459 btrfs: avoid unnecessary device path update for the same device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 2e8b6bc0ab41ce41e6dfcc204b6cc01d5abbc952 ]
[PROBLEM]
It is very common for udev to trigger device scan, and every time a mounted btrfs device got re-scan from different soft links, we will get some of unnecessary device path updates, this is especially common for LVM based storage:
# lvs scratch1 test -wi-ao---- 10.00g scratch2 test -wi-a----- 10.00g scratch3 test -wi-a----- 10.00g scratch4 test -wi-a----- 10.00g scratch5 test -wi-a----- 10.00g test test -wi-a----- 10.00g
# mkfs.btrfs -f /dev/test/scratch1 # mount /dev/test/scratch1 /mnt/btrfs # dmesg -c [ 205.705234] BTRFS: device fsid 7be2602f-9e35-4ecf-a6ff-9e91d2c182c9 devid 1 transid 6 /dev/mapper/test-scratch1 (253:4) scanned by mount (1154) [ 205.710864] BTRFS info (device dm-4): first mount of filesystem 7be2602f-9e35-4ecf-a6ff-9e91d2c182c9 [ 205.711923] BTRFS info (device dm-4): using crc32c (crc32c-intel) checksum algorithm [ 205.713856] BTRFS info (device dm-4): using free-space-tree [ 205.722324] BTRFS info (device dm-4): checking UUID tree
So far so good, but even if we just touched any soft link of "dm-4", we will get quite some unnecessary device path updates.
# touch /dev/mapper/test-scratch1 # dmesg -c [ 469.295796] BTRFS info: devid 1 device path /dev/mapper/test-scratch1 changed to /dev/dm-4 scanned by (udev-worker) (1221) [ 469.300494] BTRFS info: devid 1 device path /dev/dm-4 changed to /dev/mapper/test-scratch1 scanned by (udev-worker) (1221)
Such device path rename is unnecessary and can lead to random path change due to the udev race.
[CAUSE]
Inside device_list_add(), we are using a very primitive way checking if the device has changed, strcmp().
Which can never handle links well, no matter if it's hard or soft links.
So every different link of the same device will be treated as a different device, causing the unnecessary device path update.
[FIX]
Introduce a helper, is_same_device(), and use path_equal() to properly detect the same block device.
So that the different soft links won't trigger the rename race.
--- fs/btrfs/volumes.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +37 -1
@@ -726,6 +726,42 @@ u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb)return has_metadata_uuid ? sb->metadata_uuid : sb->fsid; } +static bool is_same_device (struct btrfs_device *device,const char *new_path) +{ +struct path old = { .mnt =NULL , .dentry =NULL }; +struct path new = { .mnt =NULL , .dentry =NULL }; +char *old_path =NULL ; +bool is_same = false; +int ret; + +if (!device->name) + goto out; + + old_path =kzalloc (PATH_MAX ,GFP_NOFS ); +if (!old_path) + goto out; + +rcu_read_lock (); + ret =strscpy (old_path,rcu_str_deref (device->name),PATH_MAX ); +rcu_read_unlock (); +if (ret <0 ) + goto out; + + ret =kern_path (old_path,LOOKUP_FOLLOW , &old); +if (ret) + goto out; + ret =kern_path (new_path,LOOKUP_FOLLOW , &new); +if (ret) + goto out; +if (path_equal (&old, &new)) + is_same = true; +out: +kfree (old_path); +path_put (&old); +path_put (&new); +return is_same; +} +/* * Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices * being created with a disk that has already completed its fsid change. Such
@@ -927,7 +963,7 @@ static noinline struct btrfs_device *device_list_add(const char *path, disk_super->fsid, devid, found_transid, path, current->comm, task_pid_nr(current)); - }else if (!device->name ||strcmp (device->name->str, path)) { + }else if (!device->name || !is_same_device (device, path)) {/* * When FS is already mounted. * 1. If you are here and if the device->name is NULL that
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 381/459 kselftest/arm64: Dont leak pipe fds in pac.exec_sign_all()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit 27141b690547da5650a420f26ec369ba142a9ebb ]
The PAC exec_sign_all() test spawns some child processes, creating pipes to be stdin and stdout for the child. It cleans up most of the file descriptors that are created as part of this but neglects to clean up the parent end of the child stdin and stdout. Add the missing close() calls.
--- tools/testing/selftests/arm64/pauth/pac.c | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/arm64/pauth/pac.c +3 -0
@@ -182,6 +182,9 @@ int exec_sign_all(struct signatures *signed_vals, size_t val)return -1 ; } +close (new_stdin[1 ]); +close (new_stdout[0 ]); +return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 382/459 kcsan: Turn report_filterlist_lock into a raw_spinlock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Elver <[email protected]>
[ Upstream commit 59458fa4ddb47e7891c61b4a928d13d5f5b00aa0 ]
Ran Xiaokai reports that with a KCSAN-enabled PREEMPT_RT kernel, we can see splats like:
| BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 | in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1 | preempt_count: 10002, expected: 0 | RCU nest depth: 0, expected: 0 | no locks held by swapper/1/0. | irq event stamp: 156674 | hardirqs last enabled at (156673): [<ffffffff81130bd9>] do_idle+0x1f9/0x240 | hardirqs last disabled at (156674): [<ffffffff82254f84>] sysvec_apic_timer_interrupt+0x14/0xc0 | softirqs last enabled at (0): [<ffffffff81099f47>] copy_process+0xfc7/0x4b60 | softirqs last disabled at (0): [<0000000000000000>] 0x0 | Preemption disabled at: | [<ffffffff814a3e2a>] paint_ptr+0x2a/0x90 | CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.11.0+ #3 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 | Call Trace: | <IRQ> | dump_stack_lvl+0x7e/0xc0 | dump_stack+0x1d/0x30 | __might_resched+0x1a2/0x270 | rt_spin_lock+0x68/0x170 | kcsan_skip_report_debugfs+0x43/0xe0 | print_report+0xb5/0x590 | kcsan_report_known_origin+0x1b1/0x1d0 | kcsan_setup_watchpoint+0x348/0x650 | __tsan_unaligned_write1+0x16d/0x1d0 | hrtimer_interrupt+0x3d6/0x430 | __sysvec_apic_timer_interrupt+0xe8/0x3a0 | sysvec_apic_timer_interrupt+0x97/0xc0 | </IRQ>
On a detected data race, KCSAN's reporting logic checks if it should filter the report. That list is protected by the report_filterlist_lock *non-raw* spinlock which may sleep on RT kernels.
Since KCSAN may report data races in any context, convert it to a raw_spinlock.
This requires being careful about when to allocate memory for the filter list itself which can be done via KCSAN's debugfs interface. Concurrent modification of the filter list via debugfs should be rare: the chosen strategy is to optimistically pre-allocate memory before the critical section and discard if unused.
--- kernel/kcsan/debugfs.c | 74 ++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 38 deletions(-)
kernel/kcsan/debugfs.c +36 -38
@@ -41,14 +41,8 @@ static struct {int used;/* number of elements used */ bool sorted;/* if elements are sorted */ bool whitelist;/* if list is a blacklist or whitelist */ -} report_filterlist = { - .addrs = NULL, - .size = 8, /* small initial size */ - .used = 0, - .sorted = false, - .whitelist = false, /* default is blacklist */ -}; -static DEFINE_SPINLOCK (report_filterlist_lock); +} report_filterlist; +static DEFINE_RAW_SPINLOCK (report_filterlist_lock);/* * The microbenchmark allows benchmarking KCSAN core runtime only. To run
@@ -105,7 +99,7 @@ bool kcsan_skip_report_debugfs(unsigned long func_addr)return false; func_addr -= offset;/* Get function start */ -spin_lock_irqsave (&report_filterlist_lock, flags); +raw_spin_lock_irqsave (&report_filterlist_lock, flags);if (report_filterlist.used ==0 ) goto out;
@@ -122,7 +116,7 @@ bool kcsan_skip_report_debugfs(unsigned long func_addr) ret = !ret; out: -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags);return ret; }
@@ -130,9 +124,9 @@ static void set_report_filterlist_whitelist(bool whitelist) {unsigned long flags; -spin_lock_irqsave (&report_filterlist_lock, flags); +raw_spin_lock_irqsave (&report_filterlist_lock, flags); report_filterlist.whitelist = whitelist; -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags); }/* Returns 0 on success, error-code otherwise. */
@@ -140,6 +134,9 @@ static ssize_t insert_report_filterlist(const char *func) {unsigned long flags;unsigned long addr =kallsyms_lookup_name (func); +unsigned long *delay_free =NULL ; +unsigned long *new_addrs =NULL ; +size_t new_size =0 ;ssize_t ret =0 ;if (!addr) {
@@ -147,32 +144,33 @@ static ssize_t insert_report_filterlist(const char *func)return -ENOENT ; } -spin_lock_irqsave (&report_filterlist_lock, flags); +retry_alloc: +/* +* Check if we need an allocation, and re-validate under the lock. Since +* the report_filterlist_lock is a raw, cannot allocate under the lock. +*/ +if (data_race (report_filterlist.used == report_filterlist.size)) { + new_size = (report_filterlist.size ?:4 ) *2 ; + delay_free = new_addrs =kmalloc_array (new_size,sizeof (unsigned long ),GFP_KERNEL ); +if (!new_addrs) +return -ENOMEM ; + } -if (report_filterlist.addrs ==NULL ) { -/* initial allocation */ - report_filterlist.addrs = -kmalloc_array (report_filterlist.size, -sizeof (unsigned long ),GFP_ATOMIC ); -if (report_filterlist.addrs ==NULL ) { - ret = -ENOMEM ; - goto out; - } - }else if (report_filterlist.used == report_filterlist.size) { -/* resize filterlist */ -size_t new_size = report_filterlist.size *2 ; -unsigned long *new_addrs = -krealloc (report_filterlist.addrs, - new_size *sizeof (unsigned long ),GFP_ATOMIC ); - -if (new_addrs ==NULL ) { -/* leave filterlist itself untouched */ - ret = -ENOMEM ; - goto out; +raw_spin_lock_irqsave (&report_filterlist_lock, flags); +if (report_filterlist.used == report_filterlist.size) { +/* Check we pre-allocated enough, and retry if not. */ +if (report_filterlist.used >= new_size) { +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags); +kfree (new_addrs);/* kfree(NULL) is safe */ + delay_free = new_addrs =NULL ; + goto retry_alloc; } +if (report_filterlist.used) +memcpy (new_addrs, report_filterlist.addrs, report_filterlist.used *sizeof (unsigned long )); + delay_free = report_filterlist.addrs;/* free the old list */ + report_filterlist.addrs = new_addrs;/* switch to the new list */ report_filterlist.size = new_size; - report_filterlist.addrs = new_addrs; }/* Note: deduplicating should be done in userspace. */
@@ -180,9 +178,9 @@ static ssize_t insert_report_filterlist(const char *func)kallsyms_lookup_name (func); report_filterlist.sorted = false; -out: -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags); +kfree (delay_free);return ret; }
@@ -199,13 +197,13 @@ static int show_info(struct seq_file *file, void *v) }/* show filter functions, and filter type */ -spin_lock_irqsave (&report_filterlist_lock, flags); +raw_spin_lock_irqsave (&report_filterlist_lock, flags);seq_printf (file,"\n%s functions: %s\n" , report_filterlist.whitelist ?"whitelisted" :"blacklisted" , report_filterlist.used ==0 ?"none" :"" );for (i =0 ; i < report_filterlist.used; ++i)seq_printf (file," %ps\n" , (void *)report_filterlist.addrs[i]); -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 383/459 media: uvcvideo: Add a quirk for the Kaiweets KTI-W02 infrared camera
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Given <[email protected]>
[ Upstream commit b2ec92bb5605452d539a7aa1e42345b95acd8583 ]
Adds a quirk to make the NXP Semiconductors 1fc9:009b chipset work.
lsusb for the device reports:
Bus 003 Device 011: ID 1fc9:009b NXP Semiconductors IR VIDEO Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 [unknown]
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x1fc9 NXP Semiconductors
idProduct 0x009b IR VIDEO
bcdDevice 1.01
iManufacturer 1 Guide sensmart iProduct 2 IR VIDEO iSerial 0 bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x00c2
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 3 IR Camera
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 0
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.00
wTotalLength 0x0033
dwClockFrequency 6.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x00000000
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 1
iTerminal 0
VideoControl Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 5 (PROCESSING_UNIT)
Warning: Descriptor too short
bUnitID 3
bSourceID 1
wMaxMultiplier 0
bControlSize 2
bmControls 0x00000000
iProcessing 0
bmVideoStandards 0x62
NTSC - 525/60
PAL - 525/60
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
VideoStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 1
wTotalLength 0x0055
bEndpointAddress 0x82 EP 2 IN
bmInfo 0
bTerminalLink 2
bStillCaptureMethod 2
bTriggerSupport 0
bTriggerUsage 0
bControlSize 1
bmaControls( 0) 0
VideoStreaming Interface Descriptor:
bLength 27
bDescriptorType 36
bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED)
bFormatIndex 1
bNumFrameDescriptors 1
guidFormat {e436eb7b-524f-11ce-9f53-0020af0ba770}
bBitsPerPixel 16
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 1
bmCapabilities 0x00
Still image unsupported
wWidth 240
wHeight 322
dwMinBitRate 12364800
dwMaxBitRate 30912000
dwMaxVideoFrameBufferSize 154560
dwDefaultFrameInterval 400000
bFrameIntervalType 2
dwFrameInterval( 0) 400000
dwFrameInterval( 1) 1000000
VideoStreaming Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 3 (STILL_IMAGE_FRAME)
bEndpointAddress 0x00 EP 0 OUT
bNumImageSizePatterns 1
wWidth( 0) 240
wHeight( 0) 322
bNumCompressionPatterns 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 1
Device Status: 0x0001
Self Powered
--- drivers/media/usb/uvc/uvc_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +11 -0
@@ -2548,6 +2548,8 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {* The Logitech cameras listed below have their interface class set to * VENDOR_SPEC because they don't announce themselves as UVC devices, even * though they are compliant. +* +* Sort these by vendor/product ID. */ static const struct usb_device_id uvc_ids[] = {/* LogiLink Wireless Webcam */
@@ -3016,6 +3018,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceProtocol = 0, .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_PROBE_MINMAX | UVC_QUIRK_IGNORE_SELECTOR_UNIT) }, +/* NXP Semiconductors IR VIDEO */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x1fc9, + .idProduct = 0x009b, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },/* Oculus VR Positional Tracker DK2 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 384/459 media: cx231xx: Add support for Dexatek USB Video Grabber 1d19:6108
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rohan Barar <[email protected]>
[ Upstream commit 61a830bc0ea69a05d8a4534f825c6aa618263649 ]
Add Dexatek Technology Ltd USB Video Grabber 1d19:6108 to the cx231xx driver. This device is sold under the name "BAUHN DVD Maker (DK8723)" by ALDI in Australia.
This device is similar to 1d19:6109, which is already included in cx231xx.
Both video and audio capture function correctly after installing the patched cx231xx driver.
Patch Changelog
v1:
- Initial submission.
v2:
- Fix SoB + Improve subject.
v3:
- Rephrase message to not exceed 75 characters per line.
- Removed reference to external GitHub URL.
--- drivers/media/usb/cx231xx/cx231xx-cards.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/cx231xx/cx231xx-cards.c +2 -0
@@ -994,6 +994,8 @@ const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);/* table of devices that work with this driver */ struct usb_device_id cx231xx_id_table[] = { + {USB_DEVICE (0x1D19 ,0x6108 ), + .driver_info =CX231XX_BOARD_PV_XCAPTURE_USB }, {USB_DEVICE (0x1D19 ,0x6109 ), .driver_info =CX231XX_BOARD_PV_XCAPTURE_USB }, {USB_DEVICE (0x0572 ,0x5A3C ),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 385/459 drm/vc4: hvs: Set AXI panic modes for the HVS
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 014eccc9da7bfc76a3107fceea37dd60f1d63630 ]
The HVS can change AXI request mode based on how full the COB FIFOs are.
Until now the vc4 driver has been relying on the firmware to have set these to sensible values.
With HVS channel 2 now being used for live video, change the panic mode for all channels to be explicitly set by the driver, and the same for all channels.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/vc4/vc4_hvs.c +11 -0
@@ -688,6 +688,17 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC1 ); dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC2 ); +/* Set AXI panic mode. +* VC4 panics when < 2 lines in FIFO. +* VC5 panics when less than 1 line in the FIFO. +*/ + dispctrl &= ~(SCALER_DISPCTRL_PANIC0_MASK | +SCALER_DISPCTRL_PANIC1_MASK | +SCALER_DISPCTRL_PANIC2_MASK ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC0 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC1 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC2 ); +HVS_WRITE (SCALER_DISPCTRL , dispctrl); ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 386/459 drm: panel-orientation-quirks: Add quirk for AYA NEO 2 model
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joaquín Ignacio Aramendía <[email protected]>
[ Upstream commit 361ebf5ef843b0aa1704c72eb26b91cf76c3c5b7 ]
Add quirk orientation for AYA NEO 2. The name appears without spaces in DMI strings. That made it difficult to reuse the 2021 match. Also the display is larger in resolution.
Tested by the JELOS team that has been patching their own kernel for a while now and confirmed by users in the AYA NEO and ChimeraOS discord servers.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -166,6 +166,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AYANEO 2 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* AYA NEO 2021 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYADEVICE"),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 387/459 drm/mcde: Enable module autoloading
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Chen <[email protected]>
[ Upstream commit 8a16b5cdae26207ff4c22834559384ad3d7bc970 ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from of_device_id table.
--- drivers/gpu/drm/mcde/mcde_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mcde/mcde_drv.c +1 -0
@@ -453,6 +453,7 @@ static const struct of_device_id mcde_of_match[] = { }, {}, }; +MODULE_DEVICE_TABLE (of, mcde_of_match);static struct platform_driver mcde_driver = { .driver = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 388/459 drm/radeon/r600_cs: Fix possible int overflow in r600_packet3_check()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Artemiev <[email protected]>
[ Upstream commit a1e2da6a5072f8abe5b0feaa91a5bcd9dc544a04 ]
It is possible, although unlikely, that an integer overflow will occur when the result of radeon_get_ib_value() is shifted to the left.
Avoid it by casting one of the operands to larger data type (u64).
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/radeon/r600_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r600_cs.c +1 -1
@@ -2102,7 +2102,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p,return -EINVAL ; } - offset =radeon_get_ib_value (p, idx+1 ) <<8 ; + offset = (u64 )radeon_get_ib_value (p, idx+1 ) <<8 ;if (offset != track->vgt_strmout_bo_offset[idx_value]) {DRM_ERROR ("bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n" , offset, track->vgt_strmout_bo_offset[idx_value]);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 389/459 r8169: dont apply UDP padding quirk on RTL8126A
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
[ Upstream commit 87e26448dbda4523b73a894d96f0f788506d3795 ]
Vendor drivers r8125/r8126 indicate that this quirk isn't needed any longer for RTL8126A. Mimic this in r8169.
--- drivers/net/ethernet/realtek/r8169_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +10 -4
@@ -4155,8 +4155,8 @@ static unsigned int rtl8125_quirk_udp_padto(struct rtl8169_private *tp, {unsigned int padto =0 , len = skb->len; -if (rtl_is_8125 (tp) && len <128 +RTL_MIN_PATCH_LEN && -rtl_skb_is_udp (skb) &&skb_transport_header_was_set (skb)) { +if (len <128 +RTL_MIN_PATCH_LEN &&rtl_skb_is_udp (skb) && +skb_transport_header_was_set (skb)) {unsigned int trans_data_len =skb_tail_pointer (skb) -skb_transport_header (skb);
@@ -4180,9 +4180,15 @@ static unsigned int rtl8125_quirk_udp_padto(struct rtl8169_private *tp,static unsigned int rtl_quirk_packet_padto (struct rtl8169_private *tp,struct sk_buff *skb) { -unsigned int padto; +unsigned int padto =0 ; - padto =rtl8125_quirk_udp_padto (tp, skb); +switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_63: + padto =rtl8125_quirk_udp_padto (tp, skb); +break ; +default : +break ; + }switch (tp->mac_version) {case RTL_GIGA_MAC_VER_34 :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 390/459 samples/bpf: Fix a resource leak
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <[email protected]>
[ Upstream commit f3ef53174b23246fe9bc2bbc2542f3a3856fa1e2 ]
The opened file should be closed in show_sockopts(), otherwise resource leak will occur that this problem was discovered by reading code
--- samples/bpf/test_cgrp2_sock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
samples/bpf/test_cgrp2_sock.c +3 -1
@@ -174,8 +174,10 @@ static int show_sockopts(int family)return 1 ; } -if (get_bind_to_device (sd, name,sizeof (name)) <0 ) +if (get_bind_to_device (sd, name,sizeof (name)) <0 ) { +close (sd);return 1 ; + } mark =get_somark (sd); prio =get_priority (sd);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 391/459 net: fec_mpc52xx_phy: Use %pa to format resource_size_t
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Horman <[email protected]>
[ Upstream commit 020bfdc4ed94be472138c891bde4d14241cf00fd ]
The correct format string for resource_size_t is %pa which acts on the address of the variable to be formatted [1].
[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
Flagged by gcc-14 as:
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c: In function 'mpc52xx_fec_mdio_probe':drivers/net/ethernet/freescale/fec_mpc52xx_phy.c:97:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
97 | snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
| ~^ ~~~~~~~~~
| | |
| | resource_size_t {aka long long unsigned int}
| unsigned int
| %llxNo functional change intended.
Compile tested only.
--- drivers/net/ethernet/freescale/fec_mpc52xx_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c +1 -1
@@ -92,7 +92,7 @@ static int mpc52xx_fec_mdio_probe(struct platform_device *of) goto out_free; } -snprintf (bus->id,MII_BUS_ID_SIZE ,"%x" , res.start); +snprintf (bus->id,MII_BUS_ID_SIZE ,"%pa" , &res.start); bus->priv = priv; bus->parent = dev;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 392/459 net: ethernet: fs_enet: Use %pa to format resource_size_t
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Horman <[email protected]>
[ Upstream commit 45fe45fada261e1e83fce2a07fa22835aec1cf0a ]
The correct format string for resource_size_t is %pa which acts on the address of the variable to be formatted [1].
[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
Flagged by gcc-14 as:
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c: In function 'fs_mii_bitbang_init':drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:126:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
126 | snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
| ~^ ~~~~~~~~~
| | |
| | resource_size_t {aka long long unsigned int}
| unsigned int
| %llxNo functional change intended.
Compile tested only.
--- drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +1 -1
@@ -126,7 +126,7 @@ static int fs_mii_bitbang_init(struct mii_bus *bus, struct device_node *np)* we get is an int, and the odds of multiple bitbang mdio buses * is low enough that it's not worth going too crazy. */ -snprintf (bus->id,MII_BUS_ID_SIZE ,"%x" , res.start); +snprintf (bus->id,MII_BUS_ID_SIZE ,"%pa" , &res.start); data =of_get_property (np,"fsl,mdio-pin" , &len);if (!data || len !=4 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 393/459 net/sched: cbs: Fix integer overflow in cbs_set_port_rate()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Elena Salomatkina <[email protected]>
[ Upstream commit 397006ba5d918f9b74e734867e8fddbc36dc2282 ]
The subsequent calculation of port_rate = speed * 1000 * BYTES_PER_KBIT, where the BYTES_PER_KBIT is of type LL, may cause an overflow. At least when speed = SPEED_20000, the expression to the left of port_rate will be greater than INT_MAX.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/sched/sch_cbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_cbs.c +1 -1
@@ -309,7 +309,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) {struct ethtool_link_ksettings ecmd;int speed =SPEED_10 ; -int port_rate; +s64 port_rate;int err; err =__ethtool_get_link_ksettings (dev, &ecmd);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 394/459 af_packet: avoid erroring out after sock_init_data() in packet_create()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 46f2a11cb82b657fd15bab1c47821b635e03838b ]
After sock_init_data() the allocated sk object is attached to the provided sock object. On error, packet_create() frees the sk object leaving the dangling pointer in the sock object on return. Some other code may try to use this pointer and cause use-after-free.
--- net/packet/af_packet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/packet/af_packet.c +6 -6
@@ -3386,18 +3386,18 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,if (sock->type ==SOCK_PACKET ) sock->ops = &packet_ops_spkt; + po =pkt_sk (sk); + err =packet_alloc_pending (po); +if (err) + goto out_sk_free; +sock_init_data (sock, sk); - po =pkt_sk (sk);init_completion (&po->skb_completion); sk->sk_family =PF_PACKET ; po->num = proto; po->xmit = dev_queue_xmit; - err =packet_alloc_pending (po); -if (err) - goto out2; -packet_cached_dev_reset (po); sk->sk_destruct = packet_sock_destruct;
@@ -3432,7 +3432,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,preempt_enable ();return 0 ; -out2: +out_sk_free:sk_free (sk); out:return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 395/459 Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 7c4f78cdb8e7501e9f92d291a7d956591bf73be9 ]
bt_sock_alloc() allocates the sk object and attaches it to the provided sock object. On error l2cap_sock_alloc() frees the sk object, but the dangling pointer is still attached to the sock object, which may create use-after-free in other code.
--- net/bluetooth/l2cap_sock.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/l2cap_sock.c +1 -0
@@ -1864,6 +1864,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, chan =l2cap_chan_create ();if (!chan) {sk_free (sk); + sock->sk =NULL ;return NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 396/459 net: af_can: do not leave a dangling sk pointer in can_create()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 811a7ca7320c062e15d0f5b171fe6ad8592d1434 ]
On error can_create() frees the allocated sk object, but sock_init_data() has already attached it to the provided sock object. This will leave a dangling sk pointer in the sock object and may cause use-after-free later.
--- net/can/af_can.c | 1 + 1 file changed, 1 insertion(+)
net/can/af_can.c +1 -0
@@ -171,6 +171,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,/* release sk on errors */ sock_orphan (sk);sock_put (sk); + sock->sk =NULL ; } errout:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 397/459 net: ieee802154: do not leave a dangling sk pointer in ieee802154_create()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit b4fcd63f6ef79c73cafae8cf4a114def5fc3d80d ]
sock_init_data() attaches the allocated sk object to the provided sock object. If ieee802154_create() fails later, the allocated sk object is freed, but the dangling pointer remains in the provided sock object, which may allow use-after-free.
Clear the sk pointer in the sock object on error.
--- net/ieee802154/socket.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ieee802154/socket.c +7 -5
@@ -1047,19 +1047,21 @@ static int ieee802154_create(struct net *net, struct socket *sock,if (sk->sk_prot->hash) { rc = sk->sk_prot->hash (sk); -if (rc) { -sk_common_release (sk); - goto out; - } +if (rc) + goto out_sk_release; }if (sk->sk_prot->init) { rc = sk->sk_prot->init (sk);if (rc) -sk_common_release (sk); + goto out_sk_release; } out:return rc; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; }static const struct net_proto_family ieee802154_family_ops = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 398/459 net: inet: do not leave a dangling sk pointer in inet_create()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 9365fa510c6f82e3aa550a09d0c5c6b44dbc78ff ]
sock_init_data() attaches the allocated sk object to the provided sock object. If inet_create() fails later, the sk object is freed, but the sock object retains the dangling pointer, which may create use-after-free later.
Clear the sk pointer in the sock object on error.
--- net/ipv4/af_inet.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/ipv4/af_inet.c +10 -12
@@ -373,32 +373,30 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, inet->inet_sport =htons (inet->inet_num);/* Add to protocol hash chains. */ err = sk->sk_prot->hash (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (sk->sk_prot->init) { err = sk->sk_prot->init (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (!kern) { err =BPF_CGROUP_RUN_PROG_INET_SOCK (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; } out:return err; out_rcu_unlock:rcu_read_unlock (); goto out; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 399/459 net: inet6: do not leave a dangling sk pointer in inet6_create()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 9df99c395d0f55fb444ef39f4d6f194ca437d884 ]
sock_init_data() attaches the allocated sk pointer to the provided sock object. If inet6_create() fails later, the sk object is released, but the sock object retains the dangling sk pointer, which may cause use-after-free later.
Clear the sock sk pointer on error.
--- net/ipv6/af_inet6.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/ipv6/af_inet6.c +10 -12
@@ -257,31 +257,29 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,*/ inet->inet_sport =htons (inet->inet_num); err = sk->sk_prot->hash (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (sk->sk_prot->init) { err = sk->sk_prot->init (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (!kern) { err =BPF_CGROUP_RUN_PROG_INET_SOCK (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; } out:return err; out_rcu_unlock:rcu_read_unlock (); goto out; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; } static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 400/459 wifi: ath5k: add PCI ID for SX76X
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit da0474012402d4729b98799d71a54c35dc5c5de3 ]
This is in two devices made by Gigaset, SX762 and SX763.
--- drivers/net/wireless/ath/ath5k/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath5k/pci.c +1 -0
@@ -46,6 +46,7 @@ static const struct pci_device_id ath5k_pci_id_table[] = { { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ + { PCI_VDEVICE(ATHEROS, 0xff16) }, /* Gigaset SX76[23] AR241[34]A */ { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ { 0 } };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 401/459 wifi: ath5k: add PCI ID for Arcadyan devices
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit f3ced9bb90b0a287a1fa6184d16b0f104a78fa90 ]
Arcadyan made routers with this PCI ID containing an AR2417.
--- drivers/net/wireless/ath/ath5k/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath5k/pci.c +1 -0
@@ -47,6 +47,7 @@ static const struct pci_device_id ath5k_pci_id_table[] = { { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ { PCI_VDEVICE(ATHEROS, 0xff16) }, /* Gigaset SX76[23] AR241[34]A */ + { PCI_VDEVICE(ATHEROS, 0xff1a) }, /* Arcadyan ARV45XX AR2417 */ { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ { 0 } };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 402/459 drm/amdgpu: refine error handling in amdgpu_ttm_tt_pin_userptr
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lang Yu <[email protected]>
[ Upstream commit 46186667f98fb7158c98f4ff5da62c427761ffcd ]
Free sg table when dma_map_sgtable() failed to avoid memory leak.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -1
@@ -1006,7 +1006,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_bo_device *bdev,/* Map SG to device */ r =dma_map_sgtable (adev->dev, ttm->sg, direction,0 );if (r) - goto release_sg; + goto release_sg_table;/* convert SG to linear array of pages and dma addresses */ drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
@@ -1014,6 +1014,8 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_bo_device *bdev,return 0 ; +release_sg_table: +sg_free_table (ttm->sg); release_sg:kfree (ttm->sg); ttm->sg =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 403/459 dma-debug: fix a possible deadlock on radix_lock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Levi Yun <[email protected]>
[ Upstream commit 7543c3e3b9b88212fcd0aaf5cab5588797bdc7de ]
radix_lock() shouldn't be held while holding dma_hash_entry[idx].lock otherwise, there's a possible deadlock scenario when
dma debug API is called holding rq_lock():
CPU0 CPU1 CPU2dma_free_attrs()check_unmap() add_dma_entry() __schedule() //out
(A) rq_lock()
get_hash_bucket()
(A) dma_entry_hash
check_sync()
(A) radix_lock() (W) dma_entry_hashdma_entry_free()
(W) radix_lock()
// CPU2's one
(W) rq_lock()CPU1 situation can happen when it extending radix tree and it tries to wake up kswapd via wake_all_kswapd().
CPU2 situation can happen while perf_event_task_sched_out() (i.e. dma sync operation is called while deleting perf_event using
etm and etr tmc which are Arm Coresight hwtracing driver backends).
To remove this possible situation, call dma_entry_free() after put_hash_bucket() in check_unmap().
--- kernel/dma/debug.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/dma/debug.c +6 -2
@@ -1047,9 +1047,13 @@ static void check_unmap(struct dma_debug_entry *ref) }hash_bucket_del (entry); -dma_entry_free (entry); -put_hash_bucket (bucket, flags); + +/* +* Free the entry outside of bucket_lock to avoid ABBA deadlocks +* between that and radix_lock. +*/ +dma_entry_free (entry); } static void check_for_stack(struct device *dev,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 404/459 jfs: array-index-out-of-bounds fix in dtReadFirst
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ghanshyam Agrawal <[email protected]>
[ Upstream commit ca84a2c9be482836b86d780244f0357e5a778c46 ]
The value of stbl can be sometimes out of bounds due to a bad filesystem. Added a check with appopriate return of error code in that case.
--- fs/jfs/jfs_dtree.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/jfs/jfs_dtree.c +7 -0
@@ -3382,6 +3382,13 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack)/* get the leftmost entry */ stbl =DT_GETSTBL (p); + +if (stbl[0 ] <0 || stbl[0 ] >127 ) { +DT_PUTPAGE (mp); +jfs_error (ip->i_sb,"stbl[0] out of bound\n" ); +return -EIO ; + } + xd = (pxd_t *) & p->slot[stbl[0 ]];/* get the child page block address */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 405/459 jfs: fix shift-out-of-bounds in dbSplit
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ghanshyam Agrawal <[email protected]>
[ Upstream commit a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d ]
When dmt_budmin is less than zero, it causes errors
in the later stages. Added a check to return an error beforehand in dbAllocCtl itself.
--- fs/jfs/jfs_dmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dmap.c +3 -0
@@ -1886,6 +1886,9 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)return -EIO ; dp = (struct dmap *) mp->data; +if (dp->tree.budmin <0 ) +return -EIO ; +/* try to allocate the blocks. */ rc =dbAllocDmapLev (bmp, dp, (int ) nblocks, l2nb, results);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 406/459 jfs: fix array-index-out-of-bounds in jfs_readdir
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ghanshyam Agrawal <[email protected]>
[ Upstream commit 839f102efb168f02dfdd46717b7c6dddb26b015e ]
The stbl might contain some invalid values. Added a check to return error code in that case.
--- fs/jfs/jfs_dtree.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/jfs/jfs_dtree.c +8 -0
@@ -3187,6 +3187,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) stbl =DT_GETSTBL (p);for (i = index; i < p->header.nextindex; i++) { +if (stbl[i] <0 || stbl[i] >127 ) { +jfs_err ("JFS: Invalid stbl[%d] = %d for inode %ld, block = %lld" , + i, stbl[i], (long )ip->i_ino, (long long )bn); +free_page (dirent_buf); +DT_PUTPAGE (mp); +return -EIO ; + } + d = (struct ldtentry *) & p->slot[stbl[i]]; if (((long) jfs_dirent + d->namlen + 1) >
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 407/459 jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nihar Chaithanya <[email protected]>
[ Upstream commit a174706ba4dad895c40b1d2277bade16dfacdcd9 ]
When the value of lp is 0 at the beginning of the for loop, it will become negative in the next assignment and we should bail out.
--- fs/jfs/jfs_dmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dmap.c +3 -0
@@ -2953,6 +2953,9 @@ static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)/* bubble the new value up the tree as required. */ for (k =0 ; k <le32_to_cpu (tp->dmt_height); k++) { +if (lp ==0 ) +break ; +/* get the index of the first leaf of the 4 leaf * group containing the specified leaf (leafno). */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 408/459 drm/amdgpu: skip amdgpu_device_cache_pci_state under sriov
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Zhao <[email protected]>
[ Upstream commit afe260df55ac280cd56306248cb6d8a6b0db095c ]
Under sriov, host driver will save and restore vf pci cfg space during reset. And during device init, under sriov, pci_restore_state happens after fullaccess released, and it can have race condition with mmio protection enable from host side leading to missing interrupts.
So skip amdgpu_device_cache_pci_state for sriov.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -5088,6 +5088,9 @@ bool amdgpu_device_cache_pci_state(struct pci_dev *pdev)struct amdgpu_device *adev =drm_to_adev (dev);int r; +if (amdgpu_sriov_vf (adev)) +return false; + r =pci_save_state (pdev);if (!r) {kfree (adev->pci_state);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 409/459 drm/amdgpu: set the right AMDGPU sg segment limitation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
[ Upstream commit e2e97435783979124ba92d6870415c57ecfef6a5 ]
The driver needs to set the correct max_segment_size; otherwise debug_dma_map_sg() will complain about the over-mapping of the AMDGPU sg length as following:
WARNING: CPU: 6 PID: 1964 at kernel/dma/debug.c:1178 debug_dma_map_sg+0x2dc/0x370 [ 364.049444] Modules linked in: veth amdgpu(OE) amdxcp drm_exec gpu_sched drm_buddy drm_ttm_helper ttm(OE) drm_suballoc_helper drm_display_helper drm_kms_helper i2c_algo_bit rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs lockd grace netfs xt_conntrack xt_MASQUERADE nf_conntrack_netlink xfrm_user xfrm_algo iptable_nat xt_addrtype iptable_filter br_netfilter nvme_fabrics overlay nfnetlink_cttimeout nfnetlink openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c bridge stp llc amd_atl intel_rapl_msr intel_rapl_common sunrpc sch_fq_codel snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg edac_mce_amd binfmt_misc snd_hda_codec snd_pci_acp6x snd_hda_core snd_acp_config snd_hwdep snd_soc_acpi kvm_amd snd_pcm kvm snd_seq_midi snd_seq_midi_event crct10dif_pclmul ghash_clmulni_intel sha512_ssse3 snd_rawmidi sha256_ssse3 sha1_ssse3 aesni_intel snd_seq nls_iso8859_1 crypto_simd snd_seq_device cryptd snd_timer rapl input_leds snd [ 364.049532] ipmi_devintf wmi_bmof ccp serio_raw k10temp sp5100_tco soundcore ipmi_msghandler cm32181 industrialio mac_hid msr parport_pc ppdev lp parport drm efi_pstore ip_tables x_tables pci_stub crc32_pclmul nvme ahci libahci i2c_piix4 r8169 nvme_core i2c_designware_pci realtek i2c_ccgx_ucsi video wmi hid_generic cdc_ether usbnet usbhid hid r8152 mii [ 364.049576] CPU: 6 PID: 1964 Comm: rocminfo Tainted: G OE 6.10.0-custom #492 [ 364.049579] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS RMJ1009A 06/13/2021 [ 364.049582] RIP: 0010:debug_dma_map_sg+0x2dc/0x370 [ 364.049585] Code: 89 4d b8 e8 36 b1 86 00 8b 4d b8 48 8b 55 b0 44 8b 45 a8 4c 8b 4d a0 48 89 c6 48 c7 c7 00 4b 74 bc 4c 89 4d b8 e8 b4 73 f3 ff <0f> 0b 4c 8b 4d b8 8b 15 c8 2c b8 01 85 d2 0f 85 ee fd ff ff 8b 05 [ 364.049588] RSP: 0018:ffff9ca600b57ac0 EFLAGS: 00010286 [ 364.049590] RAX: 0000000000000000 RBX: ffff88b7c132b0c8 RCX: 0000000000000027 [ 364.049592] RDX: ffff88bb0f521688 RSI: 0000000000000001 RDI: ffff88bb0f521680 [ 364.049594] RBP: ffff9ca600b57b20 R08: 000000000000006f R09: ffff9ca600b57930 [ 364.049596] R10: ffff9ca600b57928 R11: ffffffffbcb46328 R12: 0000000000000000 [ 364.049597] R13: 0000000000000001 R14: ffff88b7c19c0700 R15: ffff88b7c9059800 [ 364.049599] FS: 00007fb2d3516e80(0000) GS:ffff88bb0f500000(0000) knlGS:0000000000000000 [ 364.049601] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 364.049603] CR2: 000055610bd03598 CR3: 00000001049f6000 CR4: 0000000000350ef0 [ 364.049605] Call Trace: [ 364.049607] <TASK> [ 364.049609] ? show_regs+0x6d/0x80 [ 364.049614] ? __warn+0x8c/0x140 [ 364.049618] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049621] ? report_bug+0x193/0x1a0 [ 364.049627] ? handle_bug+0x46/0x80 [ 364.049631] ? exc_invalid_op+0x1d/0x80 [ 364.049635] ? asm_exc_invalid_op+0x1f/0x30 [ 364.049642] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049647] __dma_map_sg_attrs+0x90/0xe0 [ 364.049651] dma_map_sgtable+0x25/0x40 [ 364.049654] amdgpu_bo_move+0x59a/0x850 [amdgpu] [ 364.049935] ? srso_return_thunk+0x5/0x5f [ 364.049939] ? amdgpu_ttm_tt_populate+0x5d/0xc0 [amdgpu] [ 364.050095] ttm_bo_handle_move_mem+0xc3/0x180 [ttm] [ 364.050103] ttm_bo_validate+0xc1/0x160 [ttm] [ 364.050108] ? amdgpu_ttm_tt_get_user_pages+0xe5/0x1b0 [amdgpu] [ 364.050263] amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu+0xa12/0xc90 [amdgpu] [ 364.050473] kfd_ioctl_alloc_memory_of_gpu+0x16b/0x3b0 [amdgpu] [ 364.050680] kfd_ioctl+0x3c2/0x530 [amdgpu] [ 364.050866] ? __pfx_kfd_ioctl_alloc_memory_of_gpu+0x10/0x10 [amdgpu] [ 364.051054] ? srso_return_thunk+0x5/0x5f [ 364.051057] ? tomoyo_file_ioctl+0x20/0x30 [ 364.051063] __x64_sys_ioctl+0x9c/0xd0 [ 364.051068] x64_sys_call+0x1219/0x20d0 [ 364.051073] do_syscall_64+0x51/0x120 [ 364.051077] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 364.051081] RIP: 0033:0x7fb2d2f1a94f
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
@@ -1886,6 +1886,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)mutex_init (&adev->mman.gtt_window_lock); +dma_set_max_seg_size (adev->dev,UINT_MAX );/* No others user of address space so set it to 0 */ r = ttm_bo_device_init(&adev->mman.bdev, &amdgpu_bo_driver,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 410/459 wifi: ipw2x00: libipw_rx_any(): fix bad alignment
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiapeng Chong <[email protected]>
[ Upstream commit 4fa4f049dc0d9741b16c96bcbf0108c85368a2b9 ]
This patch fixes incorrect code alignment.
./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882. ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.
--- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +4 -4
@@ -870,8 +870,8 @@ void libipw_rx_any(struct libipw_device *ieee,switch (ieee->iw_mode) {case IW_MODE_ADHOC :/* our BSS and not from/to DS */ -if (ether_addr_equal (hdr->addr3, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==0 ) { +if (ether_addr_equal (hdr->addr3, ieee->bssid) && + ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==0 )) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
@@ -885,8 +885,8 @@ void libipw_rx_any(struct libipw_device *ieee,break ;case IW_MODE_INFRA :/* our BSS (== from our AP) and from DS */ -if (ether_addr_equal (hdr->addr2, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS ) { +if (ether_addr_equal (hdr->addr2, ieee->bssid) && + ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS )) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 411/459 wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Norbert van Bolhuis <[email protected]>
[ Upstream commit 857282b819cbaa0675aaab1e7542e2c0579f52d7 ]
This patch fixes a NULL pointer dereference bug in brcmfmac that occurs when a high 'sd_sgentry_align' value applies (e.g. 512) and a lot of queued SKBs are sent from the pkt queue.
The problem is the number of entries in the pre-allocated sgtable, it is nents = max(rxglom_size, txglom_size) + max(rxglom_size, txglom_size) >> 4 + 1. Given the default [rt]xglom_size=32 it's actually 35 which is too small. Worst case, the pkt queue can end up with 64 SKBs. This occurs when a new SKB is added for each original SKB if tailroom isn't enough to hold tail_pad. At least one sg entry is needed for each SKB. So, eventually the "skb_queue_walk loop" in brcmf_sdiod_sglist_rw may run out of sg entries. This makes sg_next return NULL and this causes the oops.
The patch sets nents to max(rxglom_size, txglom_size) * 2 to be able handle the worst-case.
Btw. this requires only 64-35=29 * 16 (or 20 if CONFIG_NEED_SG_DMA_LENGTH) = 464 additional bytes of memory.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +1 -1
@@ -769,7 +769,7 @@ void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) nents =max_t (uint,BRCMF_DEFAULT_RXGLOM_SIZE , sdiodev->settings->bus.sdio.txglomsz); - nents += (nents >>4 ) +1 ; + nents *=2 ;WARN_ON (nents > sdiodev->max_segment_count);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 412/459 Bluetooth: btusb: Add RTL8852BE device 0489:e123 to device tables
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hilda Wu <[email protected]>
[ Upstream commit 69b84ffce260ff13826dc10aeb3c3e5c2288a552 ]
Add the support ID 0489:e123 to usb_device_id table for Realtek RTL8852B chip.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=01 Lev=01 Prnt=01 Port=07 Cnt=04 Dev#= 7 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0489 ProdID=e123 Rev= 0.00 S: Manufacturer=Realtek S: Product=Bluetooth Radio S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -430,6 +430,8 @@ static const struct usb_device_id blacklist_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3591), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe123), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe125), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 413/459 ASoC: hdmi-codec: reorder channel allocation list
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 82ff5abc2edcfba0c0f1a1be807795e2876f46e9 ]
The ordering in hdmi_codec_get_ch_alloc_table_idx() results in wrong channel allocation for a number of cases, e.g. when ELD reports FL|FR|LFE|FC|RL|RR or FL|FR|LFE|FC|RL|RR|RC|RLC|RRC:
ca_id 0x01 with speaker mask FL|FR|LFE is selected instead of ca_id 0x03 with speaker mask FL|FR|LFE|FC for 4 channels
and
ca_id 0x04 with speaker mask FL|FR|RC gets selected instead of ca_id 0x0b with speaker mask FL|FR|LFE|FC|RL|RR for 6 channels
Fix this by reordering the channel allocation list with most specific speaker masks at the top.
--- sound/soc/codecs/hdmi-codec.c | 140 +++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 63 deletions(-)
sound/soc/codecs/hdmi-codec.c +77 -63
@@ -189,84 +189,97 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {/* * hdmi_codec_channel_alloc: speaker configuration available for CEA * -* This is an ordered list that must match with hdmi_codec_8ch_chmaps struct +* This is an ordered list where ca_id must exist in hdmi_codec_8ch_chmaps * The preceding ones have better chances to be selected by * hdmi_codec_get_ch_alloc_table_idx(). */ static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { { .ca_id =0x00 , .n_ch =2 , - .mask =FL |FR }, -/* 2.1 */ - { .ca_id =0x01 , .n_ch =4 , - .mask =FL |FR |LFE }, -/* Dolby Surround */ + .mask =FL |FR }, + { .ca_id =0x03 , .n_ch =4 , + .mask =FL |FR |LFE |FC }, { .ca_id =0x02 , .n_ch =4 , .mask =FL |FR |FC }, -/* surround51 */ + { .ca_id =0x01 , .n_ch =4 , + .mask =FL |FR |LFE }, { .ca_id =0x0b , .n_ch =6 , - .mask =FL |FR |LFE |FC |RL |RR }, -/* surround40 */ - { .ca_id =0x08 , .n_ch =6 , - .mask =FL |FR |RL |RR }, -/* surround41 */ - { .ca_id =0x09 , .n_ch =6 , - .mask =FL |FR |LFE |RL |RR }, -/* surround50 */ + .mask =FL |FR |LFE |FC |RL |RR }, { .ca_id =0x0a , .n_ch =6 , .mask =FL |FR |FC |RL |RR }, -/* 6.1 */ - { .ca_id =0x0f , .n_ch =8 , - .mask =FL |FR |LFE |FC |RL |RR |RC }, -/* surround71 */ + { .ca_id =0x09 , .n_ch =6 , + .mask =FL |FR |LFE |RL |RR }, + { .ca_id =0x08 , .n_ch =6 , + .mask =FL |FR |RL |RR }, + { .ca_id =0x07 , .n_ch =6 , + .mask =FL |FR |LFE |FC |RC }, + { .ca_id =0x06 , .n_ch =6 , + .mask =FL |FR |FC |RC }, + { .ca_id =0x05 , .n_ch =6 , + .mask =FL |FR |LFE |RC }, + { .ca_id =0x04 , .n_ch =6 , + .mask =FL |FR |RC }, { .ca_id =0x13 , .n_ch =8 , .mask =FL |FR |LFE |FC |RL |RR |RLC |RRC }, -/* others */ - { .ca_id =0x03 , .n_ch =8 , - .mask =FL |FR |LFE |FC }, - { .ca_id =0x04 , .n_ch =8 , - .mask =FL |FR |RC }, - { .ca_id =0x05 , .n_ch =8 , - .mask =FL |FR |LFE |RC }, - { .ca_id =0x06 , .n_ch =8 , - .mask =FL |FR |FC |RC }, - { .ca_id =0x07 , .n_ch =8 , - .mask =FL |FR |LFE |FC |RC }, - { .ca_id =0x0c , .n_ch =8 , - .mask =FL |FR |RC |RL |RR }, - { .ca_id =0x0d , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |RC }, - { .ca_id =0x0e , .n_ch =8 , - .mask =FL |FR |FC |RL |RR |RC }, - { .ca_id =0x10 , .n_ch =8 , - .mask =FL |FR |RL |RR |RLC |RRC }, - { .ca_id =0x11 , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |RLC |RRC }, + { .ca_id =0x1f , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR |FLC |FRC }, { .ca_id =0x12 , .n_ch =8 , .mask =FL |FR |FC |RL |RR |RLC |RRC }, - { .ca_id =0x14 , .n_ch =8 , - .mask =FL |FR |FLC |FRC }, - { .ca_id =0x15 , .n_ch =8 , - .mask =FL |FR |LFE |FLC |FRC }, - { .ca_id =0x16 , .n_ch =8 , - .mask =FL |FR |FC |FLC |FRC }, - { .ca_id =0x17 , .n_ch =8 , - .mask =FL |FR |LFE |FC |FLC |FRC }, - { .ca_id =0x18 , .n_ch =8 , - .mask =FL |FR |RC |FLC |FRC }, - { .ca_id =0x19 , .n_ch =8 , - .mask =FL |FR |LFE |RC |FLC |FRC }, - { .ca_id =0x1a , .n_ch =8 , - .mask =FL |FR |RC |FC |FLC |FRC }, - { .ca_id =0x1b , .n_ch =8 , - .mask =FL |FR |LFE |RC |FC |FLC |FRC }, - { .ca_id =0x1c , .n_ch =8 , - .mask =FL |FR |RL |RR |FLC |FRC }, - { .ca_id =0x1d , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |FLC |FRC }, { .ca_id =0x1e , .n_ch =8 , .mask =FL |FR |FC |RL |RR |FLC |FRC }, - { .ca_id =0x1f , .n_ch =8 , - .mask =FL |FR |LFE |FC |RL |RR |FLC |FRC }, + { .ca_id =0x11 , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |RLC |RRC }, + { .ca_id =0x1d , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |FLC |FRC }, + { .ca_id =0x10 , .n_ch =8 , + .mask =FL |FR |RL |RR |RLC |RRC }, + { .ca_id =0x1c , .n_ch =8 , + .mask =FL |FR |RL |RR |FLC |FRC }, + { .ca_id =0x0f , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR |RC }, + { .ca_id =0x1b , .n_ch =8 , + .mask =FL |FR |LFE |RC |FC |FLC |FRC }, + { .ca_id =0x0e , .n_ch =8 , + .mask =FL |FR |FC |RL |RR |RC }, + { .ca_id =0x1a , .n_ch =8 , + .mask =FL |FR |RC |FC |FLC |FRC }, + { .ca_id =0x0d , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |RC }, + { .ca_id =0x19 , .n_ch =8 , + .mask =FL |FR |LFE |RC |FLC |FRC }, + { .ca_id =0x0c , .n_ch =8 , + .mask =FL |FR |RC |RL |RR }, + { .ca_id =0x18 , .n_ch =8 , + .mask =FL |FR |RC |FLC |FRC }, + { .ca_id =0x17 , .n_ch =8 , + .mask =FL |FR |LFE |FC |FLC |FRC }, + { .ca_id =0x16 , .n_ch =8 , + .mask =FL |FR |FC |FLC |FRC }, + { .ca_id =0x15 , .n_ch =8 , + .mask =FL |FR |LFE |FLC |FRC }, + { .ca_id =0x14 , .n_ch =8 , + .mask =FL |FR |FLC |FRC }, + { .ca_id =0x0b , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR }, + { .ca_id =0x0a , .n_ch =8 , + .mask =FL |FR |FC |RL |RR }, + { .ca_id =0x09 , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR }, + { .ca_id =0x08 , .n_ch =8 , + .mask =FL |FR |RL |RR }, + { .ca_id =0x07 , .n_ch =8 , + .mask =FL |FR |LFE |FC |RC }, + { .ca_id =0x06 , .n_ch =8 , + .mask =FL |FR |FC |RC }, + { .ca_id =0x05 , .n_ch =8 , + .mask =FL |FR |LFE |RC }, + { .ca_id =0x04 , .n_ch =8 , + .mask =FL |FR |RC }, + { .ca_id =0x03 , .n_ch =8 , + .mask =FL |FR |LFE |FC }, + { .ca_id =0x02 , .n_ch =8 , + .mask =FL |FR |FC }, + { .ca_id =0x01 , .n_ch =8 , + .mask =FL |FR |LFE }, };struct hdmi_codec_priv {
@@ -373,7 +386,8 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol,struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol);struct hdmi_codec_priv *hcp = info->private_data; - map = info->chmap[hcp->chmap_idx].map; +if (hcp->chmap_idx !=HDMI_CODEC_CHMAP_IDX_UNKNOWN ) + map = info->chmap[hcp->chmap_idx].map;for (i =0 ; i < info->max_channels; i++) {if (hcp->chmap_idx ==HDMI_CODEC_CHMAP_IDX_UNKNOWN )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 414/459 rocker: fix link status detection in rocker_carrier_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit e64285ff41bb7a934bd815bd38f31119be62ac37 ]
Since '1 << rocker_port->pport' may be undefined for port >= 32, cast the left operand to 'unsigned long long' like it's done in 'rocker_port_set_enable()' above. Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/rocker/rocker_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/rocker/rocker_main.c +1 -1
@@ -2542,7 +2542,7 @@ static void rocker_carrier_init(const struct rocker_port *rocker_port)u64 link_status =rocker_read64 (rocker,PORT_PHYS_LINK_STATUS );bool link_up; - link_up = link_status & (1 << rocker_port->pport); + link_up = link_status & (1ULL << rocker_port->pport);if (link_up)netif_carrier_on (rocker_port->dev);else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 415/459 net/neighbor: clear error in case strict check is not set
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 0de6a472c3b38432b2f184bd64eb70d9ea36d107 ]
Commit 51183d233b5a ("net/neighbor: Update neigh_dump_info for strict data checking") added strict checking. The err variable is not cleared, so if we find no table to dump we will return the validation error even if user did not want strict checking.
I think the only way to hit this is to send an buggy request, and ask for a table which doesn't exist, so there's no point treating this as a real fix. I only noticed it because a syzbot repro depended on it to trigger another bug.
--- net/core/neighbour.c | 1 + 1 file changed, 1 insertion(+)
net/core/neighbour.c +1 -0
@@ -2739,6 +2739,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb) err =neigh_valid_dump_req (nlh, cb->strict_check, &filter, cb->extack);if (err <0 && cb->strict_check)return err; + err =0 ; s_t = cb->args[0 ];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 416/459 netpoll: Use rcu_access_pointer() in __netpoll_setup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit c69c5e10adb903ae2438d4f9c16eccf43d1fcbc1 ]
The ndev->npinfo pointer in __netpoll_setup() is RCU-protected but is being accessed directly for a NULL check. While no RCU read lock is held in this context, we should still use proper RCU primitives for consistency and correctness.
Replace the direct NULL check with rcu_access_pointer(), which is the appropriate primitive when only checking for NULL without dereferencing the pointer. This function provides the necessary ordering guarantees without requiring RCU read-side protection.
--- net/core/netpoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/netpoll.c +1 -1
@@ -635,7 +635,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) goto out; } -if (!ndev->npinfo) { +if (!rcu_access_pointer (ndev->npinfo)) { npinfo =kmalloc (sizeof (*npinfo),GFP_KERNEL );if (!npinfo) { err = -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 417/459 pinctrl: freescale: fix COMPILE_TEST error with PINCTRL_IMX_SCU
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esben Haabendal <[email protected]>
[ Upstream commit 58414a31c5713afb5449fd74a26a843d34cc62e8 ]
When PINCTRL_IMX_SCU was selected by PINCTRL_IMX8DXL or PINCTRL_IMX8QM combined with COMPILE_TEST on a non-arm platforms, the IMX_SCU dependency could not be enabled.
--- drivers/pinctrl/freescale/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/freescale/Kconfig +1 -1
@@ -9,7 +9,7 @@ config PINCTRL_IMX config PINCTRL_IMX_SCU tristate - depends on IMX_SCU + depends on IMX_SCU || COMPILE_TEST select PINCTRL_IMX config PINCTRL_IMX1_CORE
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 418/459 tracing: Use atomic64_inc_return() in trace_clock_counter()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uros Bizjak <[email protected]>
[ Upstream commit eb887c4567d1b0e7684c026fe7df44afa96589e6 ]
Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref) to use optimized implementation and ease register pressure around the primitive for targets that implement optimized variant.
--- kernel/trace/trace_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_clock.c +1 -1
@@ -154,5 +154,5 @@ static atomic64_t trace_counter;*/ u64 notrace trace_clock_counter(void) { -return atomic64_add_return (1 , &trace_counter); +return atomic64_inc_return (&trace_counter); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 419/459 scsi: hisi_sas: Add cond_resched() for no forced preemption model
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yihang Li <[email protected]>
[ Upstream commit 2233c4a0b948211743659b24c13d6bd059fa75fc ]
For no forced preemption model kernel, in the scenario where the expander is connected to 12 high performance SAS SSDs, the following call trace may occur:
[ 214.409199][ C240] watchdog: BUG: soft lockup - CPU#240 stuck for 22s! [irq/149-hisi_sa:3211] [ 214.568533][ C240] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--) [ 214.575224][ C240] pc : fput_many+0x8c/0xdc [ 214.579480][ C240] lr : fput+0x1c/0xf0 [ 214.583302][ C240] sp : ffff80002de2b900 [ 214.587298][ C240] x29: ffff80002de2b900 x28: ffff1082aa412000 [ 214.593291][ C240] x27: ffff3062a0348c08 x26: ffff80003a9f6000 [ 214.599284][ C240] x25: ffff1062bbac5c40 x24: 0000000000001000 [ 214.605277][ C240] x23: 000000000000000a x22: 0000000000000001 [ 214.611270][ C240] x21: 0000000000001000 x20: 0000000000000000 [ 214.617262][ C240] x19: ffff3062a41ae580 x18: 0000000000010000 [ 214.623255][ C240] x17: 0000000000000001 x16: ffffdb3a6efe5fc0 [ 214.629248][ C240] x15: ffffffffffffffff x14: 0000000003ffffff [ 214.635241][ C240] x13: 000000000000ffff x12: 000000000000029c [ 214.641234][ C240] x11: 0000000000000006 x10: ffff80003a9f7fd0 [ 214.647226][ C240] x9 : ffffdb3a6f0482fc x8 : 0000000000000001 [ 214.653219][ C240] x7 : 0000000000000002 x6 : 0000000000000080 [ 214.659212][ C240] x5 : ffff55480ee9b000 x4 : fffffde7f94c6554 [ 214.665205][ C240] x3 : 0000000000000002 x2 : 0000000000000020 [ 214.671198][ C240] x1 : 0000000000000021 x0 : ffff3062a41ae5b8 [ 214.677191][ C240] Call trace: [ 214.680320][ C240] fput_many+0x8c/0xdc [ 214.684230][ C240] fput+0x1c/0xf0 [ 214.687707][ C240] aio_complete_rw+0xd8/0x1fc [ 214.692225][ C240] blkdev_bio_end_io+0x98/0x140 [ 214.696917][ C240] bio_endio+0x160/0x1bc [ 214.701001][ C240] blk_update_request+0x1c8/0x3bc [ 214.705867][ C240] scsi_end_request+0x3c/0x1f0 [ 214.710471][ C240] scsi_io_completion+0x7c/0x1a0 [ 214.715249][ C240] scsi_finish_command+0x104/0x140 [ 214.720200][ C240] scsi_softirq_done+0x90/0x180 [ 214.724892][ C240] blk_mq_complete_request+0x5c/0x70 [ 214.730016][ C240] scsi_mq_done+0x48/0xac [ 214.734194][ C240] sas_scsi_task_done+0xbc/0x16c [libsas] [ 214.739758][ C240] slot_complete_v3_hw+0x260/0x760 [hisi_sas_v3_hw] [ 214.746185][ C240] cq_thread_v3_hw+0xbc/0x190 [hisi_sas_v3_hw] [ 214.752179][ C240] irq_thread_fn+0x34/0xa4 [ 214.756435][ C240] irq_thread+0xc4/0x130 [ 214.760520][ C240] kthread+0x108/0x13c [ 214.764430][ C240] ret_from_fork+0x10/0x18
This is because in the hisi_sas driver, both the hardware interrupt handler and the interrupt thread are executed on the same CPU. In the performance test scenario, function irq_wait_for_interrupt() will always return 0 if lots of interrupts occurs and the CPU will be continuously consumed. As a result, the CPU cannot run the watchdog thread. When the watchdog time exceeds the specified time, call trace occurs.
To fix it, add cond_resched() to execute the watchdog thread.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -0
@@ -2381,6 +2381,7 @@ static irqreturn_t cq_thread_v3_hw(int irq_no, void *p)/* update rd_point */ cq->rd_point = rd_point;hisi_sas_write32 (hisi_hba,COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); +cond_resched ();return IRQ_HANDLED ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 420/459 leds: class: Protect brightness_show() with led_cdev->led_access mutex
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit 4ca7cd938725a4050dcd62ae9472e931d603118d ]
There is NULL pointer issue observed if from Process A where hid device being added which results in adding a led_cdev addition and later a another call to access of led_cdev attribute from Process B can result in NULL pointer issue.
Use mutex led_cdev->led_access to protect access to led->cdev and its attribute inside brightness_show() and max_brightness_show() and also update the comment for mutex that it should be used to protect the led class device fields.
Process A Process B
kthread+0x114
worker_thread+0x244
process_scheduled_works+0x248
uhid_device_add_worker+0x24
hid_add_device+0x120
device_add+0x268
bus_probe_device+0x94
device_initial_probe+0x14
__device_attach+0xfc
bus_for_each_drv+0x10c
__device_attach_driver+0x14c
driver_probe_device+0x3c
__driver_probe_device+0xa0
really_probe+0x190
hid_device_probe+0x130
ps_probe+0x990
ps_led_register+0x94
devm_led_classdev_register_ext+0x58
led_classdev_register_ext+0x1f8
device_create_with_groups+0x48
device_create_groups_vargs+0xc8
device_add+0x244
kobject_uevent+0x14
kobject_uevent_env[jt]+0x224
mutex_unlock[jt]+0xc4
__mutex_unlock_slowpath+0xd4
wake_up_q+0x70
try_to_wake_up[jt]+0x48c
preempt_schedule_common+0x28
__schedule+0x628
__switch_to+0x174
el0t_64_sync+0x1a8/0x1ac el0t_64_sync_handler+0x68/0xbc el0_svc+0x38/0x68 do_el0_svc+0x1c/0x28 el0_svc_common+0x80/0xe0 invoke_syscall+0x58/0x114 __arm64_sys_read+0x1c/0x2c ksys_read+0x78/0xe8 vfs_read+0x1e0/0x2c8 kernfs_fop_read_iter+0x68/0x1b4 seq_read_iter+0x158/0x4ec kernfs_seq_show+0x44/0x54 sysfs_kf_seq_show+0xb4/0x130 dev_attr_show+0x38/0x74 brightness_show+0x20/0x4c dualshock4_led_get_brightness+0xc/0x74
[ 3313.874295][ T4013] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000060 [ 3313.874301][ T4013] Mem abort info: [ 3313.874303][ T4013] ESR = 0x0000000096000006 [ 3313.874305][ T4013] EC = 0x25: DABT (current EL), IL = 32 bits [ 3313.874307][ T4013] SET = 0, FnV = 0 [ 3313.874309][ T4013] EA = 0, S1PTW = 0 [ 3313.874311][ T4013] FSC = 0x06: level 2 translation fault [ 3313.874313][ T4013] Data abort info: [ 3313.874314][ T4013] ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000 [ 3313.874316][ T4013] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 3313.874318][ T4013] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 3313.874320][ T4013] user pgtable: 4k pages, 39-bit VAs, pgdp=00000008f2b0a000
..
[ 3313.874332][ T4013] Dumping ftrace buffer: [ 3313.874334][ T4013] (ftrace buffer empty) .. .. [ dd3313.874639][ T4013] CPU: 6 PID: 4013 Comm: InputReader [ 3313.874648][ T4013] pc : dualshock4_led_get_brightness+0xc/0x74 [ 3313.874653][ T4013] lr : led_update_brightness+0x38/0x60 [ 3313.874656][ T4013] sp : ffffffc0b910bbd0 .. .. [ 3313.874685][ T4013] Call trace: [ 3313.874687][ T4013] dualshock4_led_get_brightness+0xc/0x74 [ 3313.874690][ T4013] brightness_show+0x20/0x4c [ 3313.874692][ T4013] dev_attr_show+0x38/0x74 [ 3313.874696][ T4013] sysfs_kf_seq_show+0xb4/0x130 [ 3313.874700][ T4013] kernfs_seq_show+0x44/0x54 [ 3313.874703][ T4013] seq_read_iter+0x158/0x4ec [ 3313.874705][ T4013] kernfs_fop_read_iter+0x68/0x1b4 [ 3313.874708][ T4013] vfs_read+0x1e0/0x2c8 [ 3313.874711][ T4013] ksys_read+0x78/0xe8 [ 3313.874714][ T4013] __arm64_sys_read+0x1c/0x2c [ 3313.874718][ T4013] invoke_syscall+0x58/0x114 [ 3313.874721][ T4013] el0_svc_common+0x80/0xe0 [ 3313.874724][ T4013] do_el0_svc+0x1c/0x28 [ 3313.874727][ T4013] el0_svc+0x38/0x68 [ 3313.874730][ T4013] el0t_64_sync_handler+0x68/0xbc [ 3313.874732][ T4013] el0t_64_sync+0x1a8/0x1ac
--- drivers/leds/led-class.c | 14 +++++++++++--- include/linux/leds.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/leds/led-class.c +11 -3
@@ -28,11 +28,14 @@ static ssize_t brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); +unsigned int brightness; -/* no lock needed for this */ +mutex_lock (&led_cdev->led_access);led_update_brightness (led_cdev); + brightness = led_cdev->brightness; +mutex_unlock (&led_cdev->led_access); -return sprintf (buf,"%u\n" , led_cdev->brightness); +return sprintf (buf,"%u\n" , brightness); } static ssize_t brightness_store(struct device *dev,
@@ -69,8 +72,13 @@ static ssize_t max_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); +unsigned int max_brightness; + +mutex_lock (&led_cdev->led_access); + max_brightness = led_cdev->max_brightness; +mutex_unlock (&led_cdev->led_access); -return sprintf (buf,"%u\n" , led_cdev->max_brightness); +return sprintf (buf,"%u\n" , max_brightness); }static DEVICE_ATTR_RO (max_brightness);
include/linux/leds.h +1 -1
@@ -155,7 +155,7 @@ struct led_classdev {struct kernfs_node *brightness_hw_changed_kn;#endif -/* Ensures consistent access to the LED Flash Class device */ +/* Ensures consistent access to the LED class device */ struct mutex led_access; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 421/459 scsi: st: Dont modify unknown block number in MTIOCGET
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
[ Upstream commit 5bb2d6179d1a8039236237e1e94cfbda3be1ed9e ]
Struct mtget field mt_blkno -1 means it is unknown. Don't add anything to it.
--- drivers/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/st.c +1 -1
@@ -3755,7 +3755,7 @@ static long st_ioctl_common(struct file *file, unsigned int cmd_in, void __user ((STp->density <<MT_ST_DENSITY_SHIFT ) &MT_ST_DENSITY_MASK ); mt_status.mt_blkno = STps->drv_block; mt_status.mt_fileno = STps->drv_file; -if (STp->block_size !=0 ) { +if (STp->block_size !=0 && mt_status.mt_blkno >=0 ) {if (STps->rw ==ST_WRITING ) mt_status.mt_blkno += (STp->buffer)->buffer_bytes / STp->block_size;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 422/459 scsi: st: Add MTIOCGET and MTLOAD to ioctls allowed after device reset
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
[ Upstream commit 0b120edb37dc9dd8ca82893d386922eb6b16f860 ]
Most drives rewind the tape when the device is reset. Reading and writing are not allowed until something is done to make the tape position match the user's expectation (e.g., rewind the tape). Add MTIOCGET and MTLOAD to operations allowed after reset. MTIOCGET is modified to not touch the tape if pos_unknown is non-zero. The tape location is known after MTLOAD.
--- drivers/scsi/st.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/scsi/st.c +21 -8
@@ -3505,6 +3505,7 @@ static long st_ioctl_common(struct file *file, unsigned int cmd_in, void __userint i, cmd_nr, cmd_type, bt;int retval =0 ;unsigned int blk; +bool cmd_mtiocget;struct scsi_tape *STp = file->private_data;struct st_modedef *STm;struct st_partstat *STps;
@@ -3618,6 +3619,7 @@ static long st_ioctl_common(struct file *file, unsigned int cmd_in, void __user*/ if (mtc.mt_op != MTREW && mtc.mt_op != MTOFFL && + mtc.mt_op != MTLOAD && mtc.mt_op != MTRETEN && mtc.mt_op != MTERASE && mtc.mt_op != MTSEEK &&
@@ -3731,17 +3733,28 @@ static long st_ioctl_common(struct file *file, unsigned int cmd_in, void __user goto out; } + cmd_mtiocget = cmd_type ==_IOC_TYPE (MTIOCGET ) && cmd_nr ==_IOC_NR (MTIOCGET ); +if ((i =flush_buffer (STp,0 )) <0 ) { - retval = i; - goto out; - } -if (STp->can_partitions && - (i =switch_partition (STp)) <0 ) { - retval = i; - goto out; +if (cmd_mtiocget && STp->pos_unknown) { +/* flush fails -> modify status accordingly */ +reset_state (STp); + STp->pos_unknown =1 ; + }else {/* return error */ + retval = i; + goto out; + } + }else {/* flush_buffer succeeds */ +if (STp->can_partitions) { + i =switch_partition (STp); +if (i <0 ) { + retval = i; + goto out; + } + } } -if (cmd_type ==_IOC_TYPE (MTIOCGET ) && cmd_nr ==_IOC_NR (MTIOCGET )) { +if (cmd_mtiocget) {struct mtget mt_status;if (_IOC_SIZE (cmd_in) !=sizeof (struct mtget )) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 423/459 pinctrl: qcom-pmic-gpio: add support for PM8937
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Barnabás Czémán <[email protected]>
[ Upstream commit 89265a58ff24e3885c2c9ca722bc3aaa47018be9 ]
PM8937 has 8 GPIO-s with holes on GPIO3, GPIO4 and GPIO6.
--- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +2 -0
@@ -1106,6 +1106,8 @@ static int pmic_gpio_remove(struct platform_device *pdev)static const struct of_device_id pmic_gpio_of_match[] = { { .compatible ="qcom,pm8005-gpio" , .data = (void *)4 }, { .compatible ="qcom,pm8916-gpio" , .data = (void *)4 }, +/* pm8937 has 8 GPIOs with holes on 3, 4 and 6 */ + { .compatible ="qcom,pm8937-gpio" , .data = (void *)8 }, { .compatible ="qcom,pm8941-gpio" , .data = (void *)36 },/* pm8950 has 8 GPIOs with holes on 3 */ { .compatible ="qcom,pm8950-gpio" , .data = (void *)8 },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 424/459 nvdimm: rectify the illogical code within nd_dax_probe()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit b61352101470f8b68c98af674e187cfaa7c43504 ]
When nd_dax is NULL, nd_pfn is consequently NULL as well. Nevertheless, it is inadvisable to perform pointer arithmetic or address-taking on a NULL pointer.
Introduce the nd_dax_devinit() function to enhance the code's logic and improve its readability.
--- drivers/nvdimm/dax_devs.c | 4 ++-- drivers/nvdimm/nd.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/nvdimm/dax_devs.c +2 -2
@@ -106,12 +106,12 @@ int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns)nvdimm_bus_lock (&ndns->dev); nd_dax =nd_dax_alloc (nd_region); - nd_pfn = &nd_dax->nd_pfn; - dax_dev =nd_pfn_devinit (nd_pfn, ndns); + dax_dev =nd_dax_devinit (nd_dax, ndns);nvdimm_bus_unlock (&ndns->dev);if (!dax_dev)return -ENOMEM ; pfn_sb =devm_kmalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); + nd_pfn = &nd_dax->nd_pfn; nd_pfn->pfn_sb = pfn_sb; rc =nd_pfn_validate (nd_pfn,DAX_SIG );dev_dbg (dev,"dax: %s\n" , rc ==0 ?dev_name (dax_dev) :"<none>" );
drivers/nvdimm/nd.h +7 -0
@@ -335,6 +335,13 @@ struct nd_dax *to_nd_dax(struct device *dev);int nd_dax_probe (struct device *dev,struct nd_namespace_common *ndns);bool is_nd_dax (struct device *dev);struct device *nd_dax_create (struct nd_region *nd_region); +static inline struct device *nd_dax_devinit (struct nd_dax *nd_dax, +struct nd_namespace_common *ndns) +{ +if (!nd_dax) +return NULL ; +return nd_pfn_devinit (&nd_dax->nd_pfn, ndns); +}#else static inline int nd_dax_probe (struct device *dev,struct nd_namespace_common *ndns)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 425/459 f2fs: fix f2fs_bug_on when uninstalling filesystem call f2fs_evict_inode.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Han <[email protected]>
[ Upstream commit d5c367ef8287fb4d235c46a2f8c8d68715f3a0ca ]
creating a large files during checkpoint disable until it runs out of space and then delete it, then remount to enable checkpoint again, and then unmount the filesystem triggers the f2fs_bug_on as below:
------------[ cut here ]------------ kernel BUG at fs/f2fs/inode.c:896! CPU: 2 UID: 0 PID: 1286 Comm: umount Not tainted 6.11.0-rc7-dirty #360 Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:f2fs_evict_inode+0x58c/0x610 Call Trace: __die_body+0x15/0x60 die+0x33/0x50 do_trap+0x10a/0x120 f2fs_evict_inode+0x58c/0x610 do_error_trap+0x60/0x80 f2fs_evict_inode+0x58c/0x610 exc_invalid_op+0x53/0x60 f2fs_evict_inode+0x58c/0x610 asm_exc_invalid_op+0x16/0x20 f2fs_evict_inode+0x58c/0x610 evict+0x101/0x260 dispose_list+0x30/0x50 evict_inodes+0x140/0x190 generic_shutdown_super+0x2f/0x150 kill_block_super+0x11/0x40 kill_f2fs_super+0x7d/0x140 deactivate_locked_super+0x2a/0x70 cleanup_mnt+0xb3/0x140 task_work_run+0x61/0x90
The root cause is: creating large files during disable checkpoint period results in not enough free segments, so when writing back root inode will failed in f2fs_enable_checkpoint. When umount the file system after enabling checkpoint, the root inode is dirty in f2fs_evict_inode function, which triggers BUG_ON. The steps to reproduce are as follows:
dd if=/dev/zero of=f2fs.img bs=1M count=55
mount f2fs.img f2fs_dir -o checkpoint=disable:10%
dd if=/dev/zero of=big bs=1M count=50
sync
rm big
mount -o remount,checkpoint=enable f2fs_dir
umount f2fs_dir
Let's redirty inode when there is not free segments during checkpoint is disable.
--- fs/f2fs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/inode.c +3 -1
@@ -701,8 +701,10 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) !is_inode_flag_set(inode, FI_DIRTY_INODE))return 0 ; -if (!f2fs_is_checkpoint_ready (sbi)) +if (!f2fs_is_checkpoint_ready (sbi)) { +f2fs_mark_inode_dirty_sync (inode, true);return -ENOSPC ; + }/* * We need to balance fs here to prevent from producing dirty node pages
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 426/459 PCI: Add reset_subordinate to reset hierarchy below bridge
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 2fa046449a82a7d0f6d9721dd83e348816038444 ]
The "bus" and "cxl_bus" reset methods reset a device by asserting Secondary Bus Reset on the bridge leading to the device. These only work if the device is the only device below the bridge.
Add a sysfs 'reset_subordinate' attribute on bridges that can assert Secondary Bus Reset regardless of how many devices are below the bridge.
This resets all the devices below a bridge in a single command, including the locking and config space save/restore that reset methods normally do.
This may be the only way to reset devices that don't support other reset methods (ACPI, FLR, PM reset, etc).
--- Documentation/ABI/testing/sysfs-bus-pci | 11 +++++++++++ drivers/pci/pci-sysfs.c | 26 +++++++++++++++++++++++++ drivers/pci/pci.c | 2 +- drivers/pci/pci.h | 1 + 4 files changed, 39 insertions(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-bus-pci +11 -0
@@ -131,6 +131,17 @@ Description: will be present in sysfs. Writing 1 to this file will perform reset. +What: /sys/bus/pci/devices/.../reset_subordinate +Date: October 2024 +Contact: [email protected] +Description: + This is visible only for bridge devices. If you want to reset + all devices attached through the subordinate bus of a specific + bridge device, writing 1 to this will try to do it. This will + affect all devices attached to the system through this bridge + similiar to writing 1 to their individual "reset" file, so use + with caution. + What: /sys/bus/pci/devices/.../vpd Date: February 2008 Contact: Ben Hutchings <[email protected]>
drivers/pci/pci-sysfs.c +26 -0
@@ -488,6 +488,31 @@ static ssize_t bus_rescan_store(struct device *dev,static struct device_attribute dev_attr_bus_rescan =__ATTR (rescan,0200 ,NULL , bus_rescan_store); +static ssize_t reset_subordinate_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct pci_bus *bus = pdev->subordinate; +unsigned long val; + +if (!capable (CAP_SYS_ADMIN )) +return -EPERM ; + +if (kstrtoul (buf,0 , &val) <0 ) +return -EINVAL ; + +if (val) { +int ret =__pci_reset_bus (bus); + +if (ret) +return ret; + } + +return count; +} +static DEVICE_ATTR_WO (reset_subordinate); +#if defined(CONFIG_PM ) && defined(CONFIG_ACPI ) static ssize_t d3cold_allowed_store(struct device *dev, struct device_attribute *attr,
@@ -611,6 +636,7 @@ static struct attribute *pci_dev_attrs[] = {static struct attribute *pci_bridge_attrs[] = { &dev_attr_subordinate_bus_number.attr, &dev_attr_secondary_bus_number.attr, + &dev_attr_reset_subordinate.attr,NULL , };
drivers/pci/pci.c +1 -1
@@ -5598,7 +5598,7 @@ EXPORT_SYMBOL_GPL(pci_probe_reset_bus);* * Same as above except return -EAGAIN if the bus cannot be locked */ -static int __pci_reset_bus (struct pci_bus *bus) +int __pci_reset_bus (struct pci_bus *bus) {int rc;
drivers/pci/pci.h +1 -0
@@ -42,6 +42,7 @@ int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vmai,int pci_probe_reset_function (struct pci_dev *dev);int pci_bridge_secondary_bus_reset (struct pci_dev *dev);int pci_bus_error_reset (struct pci_dev *dev); +int __pci_reset_bus (struct pci_bus *bus);#define PCI_PM_D2_DELAY 200/* usec; see PCIe r4.0, sec 5.9.1 */ #define PCI_PM_D3HOT_WAIT 10/* msec */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 427/459 PCI: Add ACS quirk for Wangxun FF5xxx NICs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mengyuan Lou <[email protected]>
[ Upstream commit aa46a3736afcb7b0793766d22479b8b99fc1b322 ]
Wangxun FF5xxx NICs are similar to SFxxx, RP1000 and RP2000 NICs. They may be multi-function devices, but they do not advertise an ACS capability.
But the hardware does isolate FF5xxx functions as though it had an ACS capability and PCI_ACS_RR and PCI_ACS_CR were set in the ACS Control register, i.e., all peer-to-peer traffic is directed upstream instead of being routed internally.
Add ACS quirk for FF5xxx NICs in pci_quirk_wangxun_nic_acs() so the functions can be in independent IOMMU groups.
--- drivers/pci/quirks.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +9 -6
@@ -4829,18 +4829,21 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags) }/* -* Wangxun 10G/1G NICs have no ACS capability, and on multi-function -* devices, peer-to-peer transactions are not be used between the functions. -* So add an ACS quirk for below devices to isolate functions. +* Wangxun 40G/25G/10G/1G NICs have no ACS capability, but on +* multi-function devices, the hardware isolates the functions by +* directing all peer-to-peer traffic upstream as though PCI_ACS_RR and +* PCI_ACS_CR were set. * SFxxx 1G NICs(em). * RP1000/RP2000 10G NICs(sp). +* FF5xxx 40G/25G/10G NICs(aml). */ static int pci_quirk_wangxun_nic_acs (struct pci_dev *dev,u16 acs_flags) {switch (dev->device) { - case 0x0100 ... 0x010F: -case 0x1001 : -case 0x2001 : + case 0x0100 ... 0x010F: /* EM */ +case 0x1001 :case 0x2001 :/* SP */ +case 0x5010 :case 0x5025 :case 0x5040 :/* AML */ +case 0x5110 :case 0x5125 :case 0x5140 :/* AML */ return pci_acs_ctrl_enabled (acs_flags,PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 428/459 i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Defa Li <[email protected]>
[ Upstream commit 6cf7b65f7029914dc0cd7db86fac9ee5159008c6 ]
A deadlock may happen since the i3c_master_register() acquires &i3cbus->lock twice. See the log below.
Use i3cdev->desc->info instead of calling i3c_device_info() to avoid acquiring the lock twice.
v2:
- Modified the title and commit message
============================================
WARNING: possible recursive locking detected
6.11.0-mainline
--------------------------------------------
init/1 is trying to acquire lock:f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_bus_normaluse_lock
but task is already holding lock:f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_master_register
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&i3cbus->lock);
lock(&i3cbus->lock);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by init/1:
#0: fcffff809b6798f8 (&dev->mutex){....}-{3:3}, at: __driver_attach #1: f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_master_register
stack backtrace: CPU: 6 UID: 0 PID: 1 Comm: init Call trace: dump_backtrace+0xfc/0x17c show_stack+0x18/0x28 dump_stack_lvl+0x40/0xc0 dump_stack+0x18/0x24 print_deadlock_bug+0x388/0x390 __lock_acquire+0x18bc/0x32ec lock_acquire+0x134/0x2b0 down_read+0x50/0x19c i3c_bus_normaluse_lock+0x14/0x24 i3c_device_get_info+0x24/0x58 i3c_device_uevent+0x34/0xa4 dev_uevent+0x310/0x384 kobject_uevent_env+0x244/0x414 kobject_uevent+0x14/0x20 device_add+0x278/0x460 device_register+0x20/0x34 i3c_master_register_new_i3c_devs+0x78/0x154 i3c_master_register+0x6a0/0x6d4 mtk_i3c_master_probe+0x3b8/0x4d8 platform_probe+0xa0/0xe0 really_probe+0x114/0x454 __driver_probe_device+0xa0/0x15c driver_probe_device+0x3c/0x1ac __driver_attach+0xc4/0x1f0 bus_for_each_dev+0x104/0x160 driver_attach+0x24/0x34 bus_add_driver+0x14c/0x294 driver_register+0x68/0x104 __platform_driver_register+0x20/0x30 init_module+0x20/0xfe4 do_one_initcall+0x184/0x464 do_init_module+0x58/0x1ec load_module+0xefc/0x10c8 __arm64_sys_finit_module+0x238/0x33c invoke_syscall+0x58/0x10c el0_svc_common+0xa8/0xdc do_el0_svc+0x1c/0x28 el0_svc+0x50/0xac el0t_64_sync_handler+0x70/0xbc el0t_64_sync+0x1a8/0x1ac
--- drivers/i3c/master.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i3c/master.c +2 -1
@@ -279,7 +279,8 @@ static int i3c_device_uevent(struct device *dev, struct kobj_uevent_env *env)struct i3c_device_info devinfo;u16 manuf, part, ext; -i3c_device_get_info (i3cdev, &devinfo); +if (i3cdev->desc) + devinfo = i3cdev->desc->info; manuf =I3C_PID_MANUF_ID (devinfo.pid); part =I3C_PID_PART_ID (devinfo.pid); ext =I3C_PID_EXTRA_INFO (devinfo.pid);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 429/459 usb: chipidea: udc: handle USB Error Interrupt if IOC not set
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
[ Upstream commit 548f48b66c0c5d4b9795a55f304b7298cde2a025 ]
As per USBSTS register description about UEI:
When completion of a USB transaction results in an error condition, this bit is set by the Host/Device Controller. This bit is set along with the USBINT bit, if the TD on which the error interrupt occurred also had its interrupt on complete (IOC) bit set.
UI is set only when IOC set. Add checking UEI to fix miss call isr_tr_complete_handler() when IOC have not set and transfer error happen.
--- drivers/usb/chipidea/udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/chipidea/udc.c +1 -1
@@ -2024,7 +2024,7 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci) } } -if (USBi_UI & intr) +if ((USBi_UI | USBi_UEI) & intr)isr_tr_complete_handler (ci);if ((USBi_SLI & intr) && !(ci->suspended)) {
Signature · 1 line
2.43.0