6.1.93-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 142/473 drivers/perf: hisi: hns3: Fix out-of-bound access when valid event group
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junhao He <[email protected]>
[ Upstream commit 81bdd60a3d1d3b05e6cc6674845afb1694dd3a0e ]
The perf tool allows users to create event groups through following cmd [1], but the driver does not check whether the array index is out of bounds when writing data to the event_group array. If the number of events in an event_group is greater than HNS3_PMU_MAX_HW_EVENTS, the memory write overflow of event_group array occurs.
Add array index check to fix the possible array out of bounds violation, and return directly when write new events are written to array bounds.
There are 9 different events in an event_group.
[1] perf stat -e '{pmu/event1/, ... ,pmu/event9/}
--- drivers/perf/hisilicon/hns3_pmu.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/perf/hisilicon/hns3_pmu.c +13 -1
@@ -1085,15 +1085,27 @@ static bool hns3_pmu_validate_event_group(struct perf_event *event)return false;for (num =0 ; num < counters; num++) { +/* +* If we find a related event, then it's a valid group +* since we don't need to allocate a new counter for it. +*/ if (hns3_pmu_cmp_event (event_group[num], sibling))break ; } +/* +* Otherwise it's a new event but if there's no available counter, +* fail the check since we cannot schedule all the events in +* the group simultaneously. +*/ +if (num ==HNS3_PMU_MAX_HW_EVENTS ) +return false; +if (num == counters) event_group[counters++] = sibling; } -return counters <=HNS3_PMU_MAX_HW_EVENTS ; +return true; }static u32 hns3_pmu_get_filter_condition (struct perf_event *event)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 143/473 drivers/perf: hisi: hns3: Actually use devm_add_action_or_reset()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Chen <[email protected]>
[ Upstream commit 582c1aeee0a9e73010cf1c4cef338709860deeb0 ]
pci_alloc_irq_vectors() allocates an irq vector. When devm_add_action() fails, the irq vector is not freed, which leads to a memory leak.
Replace the devm_add_action with devm_add_action_or_reset to ensure the irq vector can be destroyed when it fails.
--- drivers/perf/hisilicon/hns3_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/hisilicon/hns3_pmu.c +1 -1
@@ -1527,7 +1527,7 @@ static int hns3_pmu_irq_register(struct pci_dev *pdev,return ret; } - ret =devm_add_action (&pdev->dev, hns3_pmu_free_irq, pdev); + ret =devm_add_action_or_reset (&pdev->dev, hns3_pmu_free_irq, pdev);if (ret) {pci_err (pdev,"failed to add free irq action, ret = %d.\n" , ret);return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/473 net: give more chances to rcu in netdev_wait_allrefs_any()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit cd42ba1c8ac9deb9032add6adf491110e7442040 ]
This came while reviewing commit c4e86b4363ac ("net: add two more call_rcu_hurry()").
Paolo asked if adding one synchronize_rcu() would help.
While synchronize_rcu() does not help, making sure to call rcu_barrier() before msleep(wait) is definitely helping to make sure lazy call_rcu() are completed.
Instead of waiting ~100 seconds in my tests, the ref_tracker splats occurs one time only, and netdev_wait_allrefs_any() latency is reduced to the strict minimum.
Ideally we should audit our call_rcu() users to make sure no refcount (or cascading call_rcu()) is held too long, because rcu_barrier() is quite expensive.
--- net/core/dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/dev.c +2 -1
@@ -10300,8 +10300,9 @@ static struct net_device *netdev_wait_allrefs_any(struct list_head *list) rebroadcast_time = jiffies; } +rcu_barrier (); +if (!wait) { -rcu_barrier (); wait =WAIT_REFS_MIN_MSECS ; }else {msleep (wait);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/473 macintosh/via-macii: Fix "BUG: sleeping function called from invalid context"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit d301a71c76ee4c384b4e03cdc320a55f5cf1df05 ]
The via-macii ADB driver calls request_irq() after disabling hard interrupts. But disabling interrupts isn't necessary here because the VIA shift register interrupt was masked during VIA1 initialization.
--- drivers/macintosh/via-macii.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/macintosh/via-macii.c +3 -8
@@ -140,24 +140,19 @@ static int macii_probe(void)/* Initialize the driver */ static int macii_init (void ) { -unsigned long flags;int err; -local_irq_save (flags); - err =macii_init_via ();if (err) - goto out; +return err; err =request_irq (IRQ_MAC_ADB , macii_interrupt,0 ,"ADB" , macii_interrupt);if (err) - goto out; +return err; macii_state = idle; -out: -local_irq_restore (flags); -return err; +return 0 ; }/* initialize the hardware */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/473 wifi: carl9170: add a proper sanity check for endpoints
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit b6dd09b3dac89b45d1ea3e3bd035a3859c0369a0 ]
Syzkaller reports [1] hitting a warning which is caused by presence of a wrong endpoint type at the URB sumbitting stage. While there was a check for a specific 4th endpoint, since it can switch types between bulk and interrupt, other endpoints are trusted implicitly. Similar warning is triggered in a couple of other syzbot issues [2].
Fix the issue by doing a comprehensive check of all endpoints taking into account difference between high- and full-speed configuration.
[1] Syzkaller report:
...
WARNING: CPU: 0 PID: 4721 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 ... Call Trace: <TASK> carl9170_usb_send_rx_irq_urb+0x273/0x340 drivers/net/wireless/ath/carl9170/usb.c:504 carl9170_usb_init_device drivers/net/wireless/ath/carl9170/usb.c:939 [inline] carl9170_usb_firmware_finish drivers/net/wireless/ath/carl9170/usb.c:999 [inline] carl9170_usb_firmware_step2+0x175/0x240 drivers/net/wireless/ath/carl9170/usb.c:1028 request_firmware_work_func+0x130/0x240 drivers/base/firmware_loader/main.c:1107 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 </TASK>
[2] Related syzkaller crashes:
--- drivers/net/wireless/ath/carl9170/usb.c | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/net/wireless/ath/carl9170/usb.c +32 -0
@@ -1069,6 +1069,38 @@ static int carl9170_usb_probe(struct usb_interface *intf, ar->usb_ep_cmd_is_bulk = true; } +/* Verify that all expected endpoints are present */ +if (ar->usb_ep_cmd_is_bulk) { +u8 bulk_ep_addr[] = { +AR9170_USB_EP_RX |USB_DIR_IN , +AR9170_USB_EP_TX |USB_DIR_OUT , +AR9170_USB_EP_CMD |USB_DIR_OUT , +0 }; +u8 int_ep_addr[] = { +AR9170_USB_EP_IRQ |USB_DIR_IN , +0 }; +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr) || + !usb_check_int_endpoints (intf, int_ep_addr)) + err = -ENODEV ; + }else { +u8 bulk_ep_addr[] = { +AR9170_USB_EP_RX |USB_DIR_IN , +AR9170_USB_EP_TX |USB_DIR_OUT , +0 }; +u8 int_ep_addr[] = { +AR9170_USB_EP_IRQ |USB_DIR_IN , +AR9170_USB_EP_CMD |USB_DIR_OUT , +0 }; +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr) || + !usb_check_int_endpoints (intf, int_ep_addr)) + err = -ENODEV ; + } + +if (err) { +carl9170_free (ar); +return err; + } +usb_set_intfdata (intf, ar);SET_IEEE80211_DEV (ar->hw, &intf->dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/473 wifi: ar5523: enable proper endpoint verification
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit e120b6388d7d88635d67dcae6483f39c37111850 ]
Syzkaller reports [1] hitting a warning about an endpoint in use not having an expected type to it.
Fix the issue by checking for the existence of all proper endpoints with their according types intact.
Sadly, this patch has not been tested on real hardware.
[1] Syzkaller report:
------------[ cut here ]------------ usb 1-1: BOGUS urb xfer, pipe 3 != type 1 WARNING: CPU: 0 PID: 3643 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 ... Call Trace: <TASK> ar5523_cmd+0x41b/0x780 drivers/net/wireless/ath/ar5523/ar5523.c:275 ar5523_cmd_read drivers/net/wireless/ath/ar5523/ar5523.c:302 [inline] ar5523_host_available drivers/net/wireless/ath/ar5523/ar5523.c:1376 [inline] ar5523_probe+0x14b0/0x1d10 drivers/net/wireless/ath/ar5523/ar5523.c:1655 usb_probe_interface+0x30f/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:560 [inline] really_probe+0x249/0xb90 drivers/base/dd.c:639 __driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:808 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:936 bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:1008 bus_probe_device+0x1e8/0x2a0 drivers/base/bus.c:487 device_add+0xbd9/0x1e90 drivers/base/core.c:3517 usb_set_configuration+0x101d/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xbe/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd8/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:560 [inline] really_probe+0x249/0xb90 drivers/base/dd.c:639 __driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:808 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:936 bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:1008 bus_probe_device+0x1e8/0x2a0 drivers/base/bus.c:487 device_add+0xbd9/0x1e90 drivers/base/core.c:3517 usb_new_device.cold+0x685/0x10ad drivers/usb/core/hub.c:2573 hub_port_connect drivers/usb/core/hub.c:5353 [inline] hub_port_connect_change drivers/usb/core/hub.c:5497 [inline] port_event drivers/usb/core/hub.c:5653 [inline] hub_event+0x26cb/0x45d0 drivers/usb/core/hub.c:5735 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 </TASK>
--- drivers/net/wireless/ath/ar5523/ar5523.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/wireless/ath/ar5523/ar5523.c +14 -0
@@ -1589,6 +1589,20 @@ static int ar5523_probe(struct usb_interface *intf,struct ar5523 *ar;int error = -ENOMEM ; +static const u8 bulk_ep_addr[] = { +AR5523_CMD_TX_PIPE |USB_DIR_OUT , +AR5523_DATA_TX_PIPE |USB_DIR_OUT , +AR5523_CMD_RX_PIPE |USB_DIR_IN , +AR5523_DATA_RX_PIPE |USB_DIR_IN , +0 }; + +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr)) { +dev_err (&dev->dev, +"Could not find all expected endpoints\n" ); + error = -ENODEV ; + goto out; + } +/* * Load firmware if the device requires it. This will return * -ENXIO on success and we'll get called back afer the usb
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/473 sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 1422ae080b66134fe192082d9b721ab7bd93fcc5 ]
arch/sh/kernel/kprobes.c:52:16: warning: no previous prototype for 'arch_copy_kprobe' [-Wmissing-prototypes]
Although SH kprobes support was only merged in v2.6.28, it missed the earlier removal of the arch_copy_kprobe() callback in v2.6.15.
Based on the powerpc part of commit 49a2a1b83ba6fa40 ("[PATCH] kprobes:
changed from using spinlock to mutex").
--- arch/sh/kernel/kprobes.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/sh/kernel/kprobes.c +1 -6
@@ -44,17 +44,12 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)if (OPCODE_RTE (opcode))return -EFAULT ;/* Bad breakpoint */ +memcpy (p->ainsn.insn, p->addr,MAX_INSN_SIZE *sizeof (kprobe_opcode_t)); p->opcode = opcode;return 0 ; } -void __kprobes arch_copy_kprobe (struct kprobe *p) -{ -memcpy (p->ainsn.insn, p->addr,MAX_INSN_SIZE *sizeof (kprobe_opcode_t)); - p->opcode = *p->addr; -} -void __kprobes arch_arm_kprobe (struct kprobe *p) { *p->addr =BREAKPOINT_INSTRUCTION ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/473 Revert "sh: Handle calling csum_partial with misaligned data"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit b5319c96292ff877f6b58d349acf0a9dc8d3b454 ]
This reverts commit cadc4e1a2b4d20d0cc0e81f2c6ba0588775e54e5.
Commit cadc4e1a2b4d ("sh: Handle calling csum_partial with misaligned data") causes bad checksum calculations on unaligned data. Reverting it fixes the problem.
# Subtest: checksum
# module: checksum_kunit
1..5
# test_csum_fixed_random_inputs: ASSERTION FAILED at lib/checksum_kunit.c:500 Expected ( u64)result == ( u64)expec, but
( u64)result == 53378 (0xd082)
( u64)expec == 33488 (0x82d0)
# test_csum_fixed_random_inputs: pass:0 fail:1 skip:0 total:1 not ok 1 test_csum_fixed_random_inputs
# test_csum_all_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:525 Expected ( u64)result == ( u64)expec, but
( u64)result == 65281 (0xff01)
( u64)expec == 65280 (0xff00)
# test_csum_all_carry_inputs: pass:0 fail:1 skip:0 total:1
not ok 2 test_csum_all_carry_inputs
# test_csum_no_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:573 Expected ( u64)result == ( u64)expec, but
( u64)result == 65535 (0xffff)
( u64)expec == 65534 (0xfffe)
# test_csum_no_carry_inputs: pass:0 fail:1 skip:0 total:1
not ok 3 test_csum_no_carry_inputs
# test_ip_fast_csum: pass:1 fail:0 skip:0 total:1
ok 4 test_ip_fast_csum
# test_csum_ipv6_magic: pass:1 fail:0 skip:0 total:1
ok 5 test_csum_ipv6_magic
# checksum: pass:2 fail:3 skip:0 total:5
# Totals: pass:2 fail:3 skip:0 total:5
not ok 22 checksum
--- arch/sh/lib/checksum.S | 67 ++++++++++++------------------------------ 1 file changed, 18 insertions(+), 49 deletions(-)
arch/sh/lib/checksum.S +18 -49
@@ -33,7 +33,8 @@ */ /* - * asmlinkage __wsum csum_partial(const void *buf, int len, __wsum sum); + * unsigned int csum_partial(const unsigned char *buf, int len, + * unsigned int sum); */ .text
@@ -45,31 +46,11 @@ ENTRY(csum_partial) * Fortunately, it is easy to convert 2-byte alignment to 4-byte * alignment for the unrolled loop. */ + mov r5, r1 mov r4, r0 - tst #3, r0 ! Check alignment. - bt/s 2f ! Jump if alignment is ok. - mov r4, r7 ! Keep a copy to check for alignment + tst #2, r0 ! Check alignment. + bt 2f ! Jump if alignment is ok. ! - tst #1, r0 ! Check alignment. - bt 21f ! Jump if alignment is boundary of 2bytes. - - ! buf is odd - tst r5, r5 - add #-1, r5 - bt 9f - mov.b @r4+, r0 - extu.b r0, r0 - addc r0, r6 ! t=0 from previous tst - mov r6, r0 - shll8 r6 - shlr16 r0 - shlr8 r0 - or r0, r6 - mov r4, r0 - tst #2, r0 - bt 2f -21: - ! buf is 2 byte aligned (len could be 0) add #-2, r5 ! Alignment uses up two bytes. cmp/pz r5 ! bt/s 1f ! Jump if we had at least two bytes.
@@ -77,17 +58,16 @@ ENTRY(csum_partial) bra 6f add #2, r5 ! r5 was < 2. Deal with it. 1: + mov r5, r1 ! Save new len for later use. mov.w @r4+, r0 extu.w r0, r0 addc r0, r6 bf 2f add #1, r6 2: - ! buf is 4 byte aligned (len could be 0) - mov r5, r1 mov #-5, r0 - shld r0, r1 - tst r1, r1 + shld r0, r5 + tst r5, r5 bt/s 4f ! if it's =0, go to 4f clrt .align 2
@@ -109,31 +89,30 @@ ENTRY(csum_partial) addc r0, r6 addc r2, r6 movt r0 - dt r1 + dt r5 bf/s 3b cmp/eq #1, r0 - ! here, we know r1==0 - addc r1, r6 ! add carry to r6 + ! here, we know r5==0 + addc r5, r6 ! add carry to r6 4: - mov r5, r0 + mov r1, r0 and #0x1c, r0 tst r0, r0 - bt 6f - ! 4 bytes or more remaining - mov r0, r1 - shlr2 r1 + bt/s 6f + mov r0, r5 + shlr2 r5 mov #0, r2 5: addc r2, r6 mov.l @r4+, r2 movt r0 - dt r1 + dt r5 bf/s 5b cmp/eq #1, r0 addc r2, r6 - addc r1, r6 ! r1==0 here, so it means add carry-bit + addc r5, r6 ! r5==0 here, so it means add carry-bit 6: - ! 3 bytes or less remaining + mov r1, r5 mov #3, r0 and r0, r5 tst r5, r5
@@ -159,16 +138,6 @@ ENTRY(csum_partial) mov #0, r0 addc r0, r6 9: - ! Check if the buffer was misaligned, if so realign sum - mov r7, r0 - tst #1, r0 - bt 10f - mov r6, r0 - shll8 r6 - shlr16 r0 - shlr8 r0 - or r0, r6 -10: rts mov r6, r0
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/473 wifi: mt76: mt7603: add wpdma tx eof flag for PSE client reset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 21de5f72260b4246e2415bc900c18139bc52ea80 ]
This flag is needed for the PSE client reset. Fixes watchdog reset issues.
--- drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7603/mac.c +1 -0
@@ -1382,6 +1382,7 @@ void mt7603_pse_client_reset(struct mt7603_dev *dev) MT_CLIENT_RESET_TX_R_E_2_S);/* Start PSE client TX abort */ +mt76_set (dev,MT_WPDMA_GLO_CFG ,MT_WPDMA_GLO_CFG_FORCE_TX_EOF );mt76_set (dev, addr,MT_CLIENT_RESET_TX_R_E_1 );mt76_poll_msec (dev, addr,MT_CLIENT_RESET_TX_R_E_1_S ,MT_CLIENT_RESET_TX_R_E_1_S ,500 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/473 libbpf: Fix error message in attach_kprobe_multi
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit 7c13ef16e87ac2e44d16c0468b1191bceb06f95c ]
We just failed to retrieve pattern, so we need to print spec instead.
--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
@@ -10417,7 +10417,7 @@ static int attach_kprobe_multi(const struct bpf_program *prog, long cookie, stru n =sscanf (spec,"%m[a-zA-Z0-9_.*?]" , &pattern);if (n <1 ) { -pr_warn ("kprobe multi pattern is invalid: %s\n" , pattern); +pr_warn ("kprobe multi pattern is invalid: %s\n" , spec);return -EINVAL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/473 selftests/binderfs: use the Makefiles rules, not Makes implicit rules
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Hubbard <[email protected]>
[ Upstream commit 019baf635eb6ffe8d6c1343f81788f02a7e0ed98 ]
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via:
make LLVM=1 -C tools/testing/selftests
...the following error occurs:
clang: error: cannot specify -o when generating multiple output files
This is because clang, unlike gcc, won't accept invocations of this form:
clang file1.c header2.h
While trying to fix this, I noticed that:
a) selftests/lib.mk already avoids the problem, and
b) The binderfs Makefile indavertently bypasses the selftests/lib.mk build system, and quitely uses Make's implicit build rules for .c files instead.
The Makefile attempts to set up both a dependency and a source file, neither of which was needed, because lib.mk is able to automatically handle both. This line:
binderfs_test: binderfs_test.c
...causes Make's implicit rules to run, which builds binderfs_test without ever looking at lib.mk.
Fix this by simply deleting the "binderfs_test:" Makefile target and letting lib.mk handle it instead.
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
--- tools/testing/selftests/filesystems/binderfs/Makefile | 2 -- 1 file changed, 2 deletions(-)
tools/testing/selftests/filesystems/binderfs/Makefile +0 -2
@@ -3,6 +3,4 @@ CFLAGS += $(KHDR_INCLUDES) -pthread TEST_GEN_PROGS := binderfs_test -binderfs_test: binderfs_test.c ../../kselftest.h ../../kselftest_harness.h - include ../../lib.mk
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/473 selftests/resctrl: fix clang build failure: use LOCAL_HDRS
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Hubbard <[email protected]>
[ Upstream commit d8171aa4ca72f1a67bf3c14c59441d63c1d2585f ]
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via:
make LLVM=1 -C tools/testing/selftests
...the following error occurs:
clang: error: cannot specify -o when generating multiple output files
This is because clang, unlike gcc, won't accept invocations of this form:
clang file1.c header2.h
Fix this by using selftests/lib.mk facilities for tracking local header file dependencies: add them to LOCAL_HDRS, leaving only the .c files to be passed to the compiler.
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
--- tools/testing/selftests/resctrl/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/resctrl/Makefile +3 -1
@@ -5,6 +5,8 @@ CFLAGS += $(KHDR_INCLUDES) TEST_GEN_PROGS := resctrl_tests +LOCAL_HDRS += $(wildcard *.h) + include ../lib.mk -$(OUTPUT)/resctrl_tests: $(wildcard *.[ch]) +$(OUTPUT)/resctrl_tests: $(wildcard *.c)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/473 selftests: default to host arch for LLVM builds
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Valentin Obst <[email protected]>
[ Upstream commit d4e6fbd245c48b272cc591d1c5e7c07aedd7f071 ]
Align the behavior for gcc and clang builds by interpreting unset ARCH and CROSS_COMPILE variables in LLVM builds as a sign that the user wants to build for the host architecture.
This patch preserves the properties that setting the ARCH variable to an unknown value will trigger an error that complains about insufficient information, and that a set CROSS_COMPILE variable will override the target triple that is determined based on presence/absence of ARCH.
When compiling with clang, i.e., LLVM is set, an unset ARCH variable in combination with an unset CROSS_COMPILE variable, i.e., compiling for the host architecture, leads to compilation failures since lib.mk can not determine the clang target triple. In this case, the following error message is displayed for each subsystem that does not set ARCH in its own Makefile before including lib.mk (lines wrapped at 75 chrs):
make[1]: Entering directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
../lib.mk:33: *** Specify CROSS_COMPILE or add '--target=' option to
lib.mk. Stop.
make[1]: Leaving directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
In the same scenario a gcc build would default to the host architecture, i.e., it would use plain gcc.
--- tools/testing/selftests/lib.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
tools/testing/selftests/lib.mk +10 -2
@@ -7,6 +7,8 @@ else ifneq ($(filter -%,$(LLVM)),) LLVM_SUFFIX := $(LLVM) endif +CLANG := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) + CLANG_TARGET_FLAGS_arm := arm-linux-gnueabi CLANG_TARGET_FLAGS_arm64 := aarch64-linux-gnu CLANG_TARGET_FLAGS_hexagon := hexagon-linux-musl
@@ -18,7 +20,13 @@ CLANG_TARGET_FLAGS_riscv := riscv64-linux-gnu CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu CLANG_TARGET_FLAGS_x86_64 := x86_64-linux-gnu -CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH)) + +# Default to host architecture if ARCH is not explicitly given. +ifeq ($(ARCH),) +CLANG_TARGET_FLAGS := $(shell $(CLANG) -print-target-triple) +else +CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH)) +endif ifeq ($(CROSS_COMPILE),) ifeq ($(CLANG_TARGET_FLAGS),)
@@ -30,7 +38,7 @@ else CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # CROSS_COMPILE -CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) $(CLANG_FLAGS) -fintegrated-as +CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as else CC := $(CROSS_COMPILE)gcc endif # LLVM
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/473 kunit: Fix kthread reference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mickaël Salaün <[email protected]>
[ Upstream commit f8aa1b98ce40184521ed95ec26cc115a255183b2 ]
There is a race condition when a kthread finishes after the deadline and before the call to kthread_stop(), which may lead to use after free.
--- lib/kunit/try-catch.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
lib/kunit/try-catch.c +6 -3
@@ -11,6 +11,7 @@#include <linux/completion.h> #include <linux/kernel.h> #include <linux/kthread.h> +#include <linux/sched/task.h> #include "try-catch-impl.h"
@@ -65,13 +66,14 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context) try_catch->context = context; try_catch->try_completion = &try_completion; try_catch->try_result =0 ; - task_struct =kthread_run (kunit_generic_run_threadfn_adapter, - try_catch, -"kunit_try_catch_thread" ); + task_struct =kthread_create (kunit_generic_run_threadfn_adapter, + try_catch,"kunit_try_catch_thread" );if (IS_ERR (task_struct)) { try_catch->catch (try_catch->context);return ; } +get_task_struct (task_struct); +wake_up_process (task_struct); time_remaining =wait_for_completion_timeout (&try_completion,kunit_test_timeout ());
@@ -81,6 +83,7 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)kthread_stop (task_struct); } +put_task_struct (task_struct); exit_code = try_catch->try_result;if (!exit_code)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/473 HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 6baa4524027fd64d7ca524e1717c88c91a354b93 ]
Add a check for the return value of pci_alloc_irq_vectors() and return error if it fails.
--- drivers/hid/intel-ish-hid/ipc/pci-ish.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/intel-ish-hid/ipc/pci-ish.c +5 -0
@@ -216,6 +216,11 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* request and enable interrupt */ ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES ); +if (ret <0 ) { +dev_err (dev,"ISH: Failed to allocate IRQ vectors\n" ); +return ret; + } +if (!pdev->msi_enabled && !pdev->msix_enabled) irq_flag =IRQF_SHARED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/473 scsi: bfa: Ensure the copied buf is NUL terminated
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Quang Minh <[email protected]>
[ Upstream commit 13d0cecb4626fae67c00c84d3c7851f6b62f7df3 ]
Currently, we allocate a nbytes-sized kernel buffer and copy nbytes from userspace to that buffer. Later, we use sscanf on this buffer but we don't ensure that the string is terminated inside the buffer, this can lead to OOB read when using sscanf. Fix this issue by using memdup_user_nul instead of memdup_user.
--- drivers/scsi/bfa/bfad_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bfa/bfad_debugfs.c +2 -2
@@ -250,7 +250,7 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf,unsigned long flags;void *kern_buf; - kern_buf =memdup_user (buf, nbytes); + kern_buf =memdup_user_nul (buf, nbytes);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
@@ -317,7 +317,7 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf,unsigned long flags;void *kern_buf; - kern_buf =memdup_user (buf, nbytes); + kern_buf =memdup_user_nul (buf, nbytes);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/473 scsi: qedf: Ensure the copied buf is NUL terminated
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Quang Minh <[email protected]>
[ Upstream commit d0184a375ee797eb657d74861ba0935b6e405c62 ]
Currently, we allocate a count-sized kernel buffer and copy count from userspace to that buffer. Later, we use kstrtouint on this buffer but we don't ensure that the string is terminated inside the buffer, this can lead to OOB read when using kstrtouint. Fix this issue by using memdup_user_nul instead of memdup_user.
--- drivers/scsi/qedf/qedf_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedf/qedf_debugfs.c +1 -1
@@ -170,7 +170,7 @@ qedf_dbg_debug_cmd_write(struct file *filp, const char __user *buffer,if (!count || *ppos)return 0 ; - kern_buf =memdup_user (buffer, count); + kern_buf =memdup_user_nul (buffer, count);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/473 scsi: qla2xxx: Fix debugfs output for fw_resource_count
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Himanshu Madhani <[email protected]>
[ Upstream commit 998d09c5ef6183bd8137d1a892ba255b15978bb4 ]
DebugFS output for fw_resource_count shows:
estimate exchange used[0] high water limit [1945] n estimate iocb2 used [0] high water limit [5141]
estimate exchange2 used[0] high water limit [1945]
Which shows incorrect display due to missing newline in seq_print().
[mkp: fix checkpatch warning about space before newline]
--- drivers/scsi/qla2xxx/qla_dfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_dfs.c +1 -1
@@ -274,7 +274,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)seq_printf (s,"Driver: estimate iocb used [%d] high water limit [%d]\n" , iocbs_used, ha->base_qpair->fwres.iocbs_limit); -seq_printf (s,"estimate exchange used[%d] high water limit [%d] n" , +seq_printf (s,"estimate exchange used[%d] high water limit [%d]\n" , exch_used, ha->base_qpair->fwres.exch_limit);if (ql2xenforce_iocb_limit ==2 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/473 kernel/numa.c: Move logging out of numa.h
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <[email protected]>
[ Upstream commit d7a73e3f089204aee3393687e23fd45a22657b08 ]
Moving these stub functions to a .c file means we can kill a sched.h dependency on printk.h.
Stable-dep-of: f9f67e5adc8d ("x86/numa: Fix SRAT lookup of CFMWS ranges with numa_fill_memblks()")
--- include/linux/numa.h | 19 ++++++------------- kernel/Makefile | 1 + kernel/numa.c | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 kernel/numa.c
include/linux/numa.h +6 -13
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_NUMA_H#define _LINUX_NUMA_H +#include <linux/init.h> #include <linux/types.h> #ifdef CONFIG_NODES_SHIFT
@@ -22,34 +23,26 @@#endif #ifdef CONFIG_NUMA -#include <linux/printk.h> #include <asm/sparsemem.h> /* Generic implementation available */ int numa_map_to_online_node (int node);#ifndef memory_add_physaddr_to_nid -static inline int memory_add_physaddr_to_nid (u64 start) -{ -pr_info_once ("Unknown online node for memory at 0x%llx, assuming node 0\n" , - start); -return 0 ; -} +int memory_add_physaddr_to_nid (u64 start);#endif +#ifndef phys_to_target_node -static inline int phys_to_target_node (u64 start) -{ -pr_info_once ("Unknown target node for memory at 0x%llx, assuming node 0\n" , - start); -return 0 ; -} +int phys_to_target_node (u64 start);#endif +#ifndef numa_fill_memblksstatic inline int __init numa_fill_memblks (u64 start,u64 end) {return NUMA_NO_MEMBLK ; }#endif +#else /* !CONFIG_NUMA */ static inline int numa_map_to_online_node (int node) {
kernel/Makefile +1 -0
@@ -112,6 +112,7 @@ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o obj-$(CONFIG_CFI_CLANG) += cfi.o +obj-$(CONFIG_NUMA) += numa.o obj-$(CONFIG_PERF_EVENTS) += events/
kernel/numa.c new file +26 -0
@@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <linux/printk.h> +#include <linux/numa.h> + +/* Stub functions: */ + +#ifndef memory_add_physaddr_to_nid +int memory_add_physaddr_to_nid (u64 start) +{ +pr_info_once ("Unknown online node for memory at 0x%llx, assuming node 0\n" , + start); +return 0 ; +} +EXPORT_SYMBOL_GPL (memory_add_physaddr_to_nid); +#endif + +#ifndef phys_to_target_node +int phys_to_target_node (u64 start) +{ +pr_info_once ("Unknown target node for memory at 0x%llx, assuming node 0\n" , + start); +return 0 ; +} +EXPORT_SYMBOL_GPL (phys_to_target_node); +#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/473 x86/numa: Fix SRAT lookup of CFMWS ranges with numa_fill_memblks()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Richter <[email protected]>
[ Upstream commit f9f67e5adc8dc2e1cc51ab2d3d6382fa97f074d4 ]
For configurations that have the kconfig option NUMA_KEEP_MEMINFO disabled, numa_fill_memblks() only returns with NUMA_NO_MEMBLK (-1). SRAT lookup fails then because an existing SRAT memory range cannot be found for a CFMWS address range. This causes the addition of a duplicate numa_memblk with a different node id and a subsequent page fault and kernel crash during boot.
Fix this by making numa_fill_memblks() always available regardless of NUMA_KEEP_MEMINFO.
As Dan suggested, the fix is implemented to remove numa_fill_memblks() from sparsemem.h and alos using __weak for the function.
Note that the issue was initially introduced with [1]. But since phys_to_target_node() was originally used that returned the valid node 0, an additional numa_memblk was not added. Though, the node id was wrong too, a message is seen then in the logs:
kernel/numa.c: pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
[1] commit fd49f99c1809 ("ACPI: NUMA: Add a node and memblk for each CFMWS not in SRAT")
--- arch/x86/include/asm/sparsemem.h | 2 -- arch/x86/mm/numa.c | 4 ++-- drivers/acpi/numa/srat.c | 5 +++++ include/linux/numa.h | 7 +------ 4 files changed, 8 insertions(+), 10 deletions(-)
arch/x86/include/asm/sparsemem.h +0 -2
@@ -37,8 +37,6 @@ extern int phys_to_target_node(phys_addr_t start);#define phys_to_target_node phys_to_target_nodeextern int memory_add_physaddr_to_nid (u64 start);#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid -extern int numa_fill_memblks (u64 start,u64 end); -#define numa_fill_memblks numa_fill_memblks#endif #endif /* __ASSEMBLY__ */
arch/x86/mm/numa.c +2 -2
@@ -956,6 +956,8 @@ int memory_add_physaddr_to_nid(u64 start) }EXPORT_SYMBOL_GPL (memory_add_physaddr_to_nid); +#endif +static int __init cmp_memblk (const void *a,const void *b) {const struct numa_memblk *ma = *(const struct numa_memblk **)a;
@@ -1028,5 +1030,3 @@ int __init numa_fill_memblks(u64 start, u64 end) }return 0 ; } - -#endif
drivers/acpi/numa/srat.c +5 -0
@@ -206,6 +206,11 @@ int __init srat_disabled(void)return acpi_numa <0 ; } +__weak int __init numa_fill_memblks (u64 start,u64 end) +{ +return NUMA_NO_MEMBLK ; +} +#if defined(CONFIG_X86 ) || defined(CONFIG_ARM64 ) || defined(CONFIG_LOONGARCH )/* * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for
include/linux/numa.h +1 -6
@@ -36,12 +36,7 @@ int memory_add_physaddr_to_nid(u64 start);int phys_to_target_node (u64 start);#endif -#ifndef numa_fill_memblks -static inline int __init numa_fill_memblks (u64 start,u64 end) -{ -return NUMA_NO_MEMBLK ; -} -#endif +int numa_fill_memblks (u64 start,u64 end);#else /* !CONFIG_NUMA */ static inline int numa_map_to_online_node (int node)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/473 wifi: mwl8k: initialize cmd->addr[] properly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 1d60eabb82694e58543e2b6366dae3e7465892a5 ]
This loop is supposed to copy the mac address to cmd->addr but the i++ increment is missing so it copies everything to cmd->addr[0] and only the last address is recorded.
--- drivers/net/wireless/marvell/mwl8k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwl8k.c +1 -1
@@ -2718,7 +2718,7 @@ __mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti, cmd->action |=cpu_to_le16 (MWL8K_ENABLE_RX_MULTICAST ); cmd->numaddr =cpu_to_le16 (mc_count);netdev_hw_addr_list_for_each (ha, mc_list) { -memcpy (cmd->addr[i], ha->addr,ETH_ALEN ); +memcpy (cmd->addr[i++], ha->addr,ETH_ALEN ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/473 HID: amd_sfh: Handle "no sensors" in PM operations
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Basavaraj Natikar <[email protected]>
[ Upstream commit 077e3e3bc84a51891e732507bbbd9acf6e0e4c8b ]
Resume or suspend each sensor device based on the num_hid_devices. Therefore, add a check to handle the special case where no sensors are present.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c +10 -0
@@ -222,6 +222,11 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2)struct amd_mp2_sensor_info info;int i, status; +if (!cl_data->is_any_sensor_enabled) { +amd_sfh_clear_intr (mp2); +return ; + } +for (i =0 ; i < cl_data->num_hid_devices; i++) {if (cl_data->sensor_sts[i] ==SENSOR_DISABLED ) { info.sensor_idx = cl_data->sensor_idx[i];
@@ -247,6 +252,11 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2)struct amdtp_cl_data *cl_data = mp2->cl_data;int i, status; +if (!cl_data->is_any_sensor_enabled) { +amd_sfh_clear_intr (mp2); +return ; + } +for (i =0 ; i < cl_data->num_hid_devices; i++) {if (cl_data->sensor_idx[i] !=HPD_IDX && cl_data->sensor_sts[i] ==SENSOR_ENABLED ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/473 usb: aqc111: stop lying about skb->truesize
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9aad6e45c4e7d16b2bb7c3794154b828fb4384b4 ]
Some usb drivers try to set small skb->truesize and break core networking stacks.
I replace one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
--- drivers/net/usb/aqc111.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/usb/aqc111.c +3 -5
@@ -1141,17 +1141,15 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)continue ; } -/* Clone SKB */ - new_skb =skb_clone (skb,GFP_ATOMIC ); + new_skb =netdev_alloc_skb_ip_align (dev->net, pkt_len);if (!new_skb) goto err; - new_skb->len = pkt_len; +skb_put (new_skb, pkt_len); +memcpy (new_skb->data, skb->data, pkt_len);skb_pull (new_skb,AQ_RX_HW_PAD ); -skb_set_tail_pointer (new_skb, new_skb->len); - new_skb->truesize =SKB_TRUESIZE (new_skb->len);if (aqc111_data->rx_checksum)aqc111_rx_checksum (new_skb, pkt_desc);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/473 net: usb: sr9700: stop lying about skb->truesize
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 05417aa9c0c038da2464a0c504b9d4f99814a23b ]
Some usb drivers set small skb->truesize and break core networking stacks.
In this patch, I removed one of the skb->truesize override.
I also replaced one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
--- drivers/net/usb/sr9700.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/net/usb/sr9700.c +3 -7
@@ -421,19 +421,15 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)skb_pull (skb,3 ); skb->len = len;skb_set_tail_pointer (skb, len); - skb->truesize = len +sizeof (struct sk_buff );return 2 ; } -/* skb_clone is used for address align */ - sr_skb =skb_clone (skb,GFP_ATOMIC ); + sr_skb =netdev_alloc_skb_ip_align (dev->net, len);if (!sr_skb)return 0 ; - sr_skb->len = len; - sr_skb->data = skb->data +3 ; -skb_set_tail_pointer (sr_skb, len); - sr_skb->truesize = len +sizeof (struct sk_buff ); +skb_put (sr_skb, len); +memcpy (sr_skb->data, skb->data +3 , len);usbnet_skb_return (dev, sr_skb);skb_pull (skb, len +SR_RX_OVERHEAD );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/473 m68k: Fix spinlock race in kernel thread creation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Schmitz <[email protected]>
[ Upstream commit da89ce46f02470ef08f0f580755d14d547da59ed ]
Context switching does take care to retain the correct lock owner across the switch from 'prev' to 'next' tasks. This does rely on interrupts remaining disabled for the entire duration of the switch.
This condition is guaranteed for normal process creation and context switching between already running processes, because both 'prev' and 'next' already have interrupts disabled in their saved copies of the status register.
The situation is different for newly created kernel threads. The status register is set to PS_S in copy_thread(), which does leave the IPL at 0. Upon restoring the 'next' thread's status register in switch_to() aka resume(), interrupts then become enabled prematurely. resume() then returns via ret_from_kernel_thread() and schedule_tail() where run queue lock is released (see finish_task_switch() and finish_lock_switch()).
A timer interrupt calling scheduler_tick() before the lock is released in finish_task_switch() will find the lock already taken, with the current task as lock owner. This causes a spinlock recursion warning as reported by Guenter Roeck.
As far as I can ascertain, this race has been opened in commit 533e6903bea0 ("m68k: split ret_from_fork(), simplify kernel_thread()") but I haven't done a detailed study of kernel history so it may well predate that commit.
Interrupts cannot be disabled in the saved status register copy for kernel threads (init will complain about interrupts disabled when finally starting user space). Disable interrupts temporarily when switching the tasks' register sets in resume().
Note that a simple oriw 0x700,%sr after restoring sr is not enough here
- this leaves enough of a race for the 'spinlock recursion' warning to still be observed.
Tested on ARAnyM and qemu (Quadra 800 emulation).
--- arch/m68k/kernel/entry.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/m68k/kernel/entry.S +3 -1
@@ -430,7 +430,9 @@ resume: movec %a0,%dfc /* restore status register */ - movew %a1@(TASK_THREAD+THREAD_SR),%sr + movew %a1@(TASK_THREAD+THREAD_SR),%d0 + oriw #0x0700,%d0 + movew %d0,%sr rts
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/473 m68k: mac: Fix reboot hang on Mac IIci
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 265a3b322df9a973ff1fc63da70af456ab6ae1d6 ]
Calling mac_reset() on a Mac IIci does reset the system, but what follows is a POST failure that requires a manual reset to resolve. Avoid that by using the 68030 asm implementation instead of the C implementation.
Apparently the SE/30 has a similar problem as it has used the asm implementation since before git. This patch extends that solution to other systems with a similar ROM.
After this patch, the only systems still using the C implementation are 68040 systems where adb_type is either MAC_ADB_IOP or MAC_ADB_II. This implies a 1 MiB Quadra ROM.
This now includes the Quadra 900/950, which previously fell through to the "should never get here" catch-all.
--- arch/m68k/mac/misc.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
arch/m68k/mac/misc.c +18 -18
@@ -451,30 +451,18 @@ void mac_poweroff(void)void mac_reset (void ) { -if (macintosh_config->adb_type ==MAC_ADB_II && - macintosh_config->ident !=MAC_MODEL_SE30 ) { -/* need ROMBASE in booter */ -/* indeed, plus need to MAP THE ROM !! */ - -if (mac_bi_data.rombase ==0 ) - mac_bi_data.rombase =0x40800000 ; - -/* works on some */ - rom_reset = (void *) (mac_bi_data.rombase +0xa ); - -local_irq_disable (); -rom_reset ();#ifdef CONFIG_ADB_CUDA - }else if (macintosh_config->adb_type ==MAC_ADB_EGRET || - macintosh_config->adb_type ==MAC_ADB_CUDA ) { +if (macintosh_config->adb_type ==MAC_ADB_EGRET || + macintosh_config->adb_type ==MAC_ADB_CUDA ) {cuda_restart (); + } else#endif #ifdef CONFIG_ADB_PMU - }else if (macintosh_config->adb_type ==MAC_ADB_PB2 ) { +if (macintosh_config->adb_type ==MAC_ADB_PB2 ) {pmu_restart (); + } else#endif - }else if (CPU_IS_030 ) { - +if (CPU_IS_030 ) {/* 030-specific reset routine. The idea is general, but the * specific registers to reset are '030-specific. Until I * have a non-030 machine, I can't test anything else.
@@ -522,6 +510,18 @@ void mac_reset(void) "jmp %/a0@\n\t" /* jump to the reset vector */ ".chip 68k" : : "r" (offset), "a" (rombase) : "a0"); + }else { +/* need ROMBASE in booter */ +/* indeed, plus need to MAP THE ROM !! */ + +if (mac_bi_data.rombase ==0 ) + mac_bi_data.rombase =0x40800000 ; + +/* works on some */ + rom_reset = (void *)(mac_bi_data.rombase +0xa ); + +local_irq_disable (); +rom_reset (); }/* should never get here */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/473 net: ipv6: fix wrong start position when receive hop-by-hop fragment
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: gaoxingwang <[email protected]>
[ Upstream commit 1cd354fe1e4864eeaff62f66ee513080ec946f20 ]
In IPv6, ipv6_rcv_core will parse the hop-by-hop type extension header and increase skb->transport_header by one extension header length. But if there are more other extension headers like fragment header at this time, the skb->transport_header points to the second extension header, not the transport layer header or the first extension header.
This will result in the start and nexthdrp variable not pointing to the same position in ipv6frag_thdr_trunced,
and ipv6_skip_exthdr returning incorrect offset and frag_off.Sometimes,the length of the last sharded packet is smaller than the calculated incorrect offset, resulting in packet loss. We can use network header to offset and calculate the correct position to solve this problem.
--- net/ipv6/reassembly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/reassembly.c +1 -1
@@ -364,7 +364,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)* the source of the fragment, with the Pointer field set to zero. */ nexthdr = hdr->nexthdr; -if (ipv6frag_thdr_truncated (skb,skb_transport_offset (skb), &nexthdr)) { +if (ipv6frag_thdr_truncated (skb,skb_network_offset (skb) +sizeof (struct ipv6hdr ), &nexthdr)) {__IP6_INC_STATS (net,__in6_dev_get_safely (skb->dev),IPSTATS_MIB_INHDRERRORS );icmpv6_param_prob (skb,ICMPV6_HDR_INCOMP ,0 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/473 eth: sungem: remove .ndo_poll_controller to avoid deadlocks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit ac0a230f719b02432d8c7eba7615ebd691da86f4 ]
Erhard reports netpoll warnings from sungem:
netpoll_send_skb_on_dev(): eth0 enabled interrupts in poll (gem_start_xmit+0x0/0x398)
WARNING: CPU: 1 PID: 1 at net/core/netpoll.c:370 netpoll_send_skb+0x1fc/0x20c
gem_poll_controller() disables interrupts, which may sleep. We can't sleep in netpoll, it has interrupts disabled completely. Strangely, gem_poll_controller() doesn't even poll the completions, and instead acts as if an interrupt has fired so it just schedules NAPI and exits. None of this has been necessary for years, since netpoll invokes NAPI directly.
--- drivers/net/ethernet/sun/sungem.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/net/ethernet/sun/sungem.c +0 -14
@@ -948,17 +948,6 @@ static irqreturn_t gem_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void gem_poll_controller (struct net_device *dev) -{ -struct gem *gp =netdev_priv (dev); - -disable_irq (gp->pdev->irq); -gem_interrupt (gp->pdev->irq, dev); -enable_irq (gp->pdev->irq); -} -#endif -static void gem_tx_timeout (struct net_device *dev,unsigned int txqueue) {struct gem *gp =netdev_priv (dev);
@@ -2838,9 +2827,6 @@ static const struct net_device_ops gem_netdev_ops = { .ndo_change_mtu = gem_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = gem_set_mac_address, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = gem_poll_controller, -#endif };static int gem_init_one (struct pci_dev *pdev,const struct pci_device_id *ent)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/473 selftests: net: move amt to socat for better compatibility
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 4c639b6a7b9db236c0907aca8e92d1537076f2cd ]
The test seems to expect that nc will exit after the first received message. This is not the case with Ncat 7.94. There are multiple versions of nc out there, switch to socat for better compatibility.
Tell socat to exit after 128 bytes and pad the message.
Since the test sets -e make sure we don't set exit code (|| true) and print the pass / fail rather then silently moving over the test and just setting non-zero exit code with no output indicating what failed.
--- tools/testing/selftests/net/amt.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/net/amt.sh +6 -6
@@ -210,8 +210,8 @@ check_features() test_ipv4_forward() { - RESULT4=$(ip netns exec "${LISTENER}" nc -w 1 -l -u 239.0.0.1 4000) - if [ "$RESULT4" == "172.17.0.2" ]; then + RESULT4=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP4-LISTEN:4000,readbytes=128 || true) + if echo "$RESULT4" | grep -q "172.17.0.2"; then printf "TEST: %-60s [ OK ]\n" "IPv4 amt multicast forwarding" exit 0 else
@@ -222,8 +222,8 @@ test_ipv4_forward() test_ipv6_forward() { - RESULT6=$(ip netns exec "${LISTENER}" nc -w 1 -l -u ff0e::5:6 6000) - if [ "$RESULT6" == "2001:db8:3::2" ]; then + RESULT6=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP6-LISTEN:6000,readbytes=128 || true) + if echo "$RESULT6" | grep -q "2001:db8:3::2"; then printf "TEST: %-60s [ OK ]\n" "IPv6 amt multicast forwarding" exit 0 else
@@ -236,14 +236,14 @@ send_mcast4() { sleep 2 ip netns exec "${SOURCE}" bash -c \ - 'echo 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' & + 'printf "%s %128s" 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' & } send_mcast6() { sleep 2 ip netns exec "${SOURCE}" bash -c \ - 'echo 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' & + 'printf "%s %128s" 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' & } check_features
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/473 net: ethernet: cortina: Locking fixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 812552808f7ff71133fc59768cdc253c5b8ca1bf ]
This fixes a probably long standing problem in the Cortina Gemini ethernet driver: there are some paths in the code where the IRQ registers are written without taking the proper locks.
--- drivers/net/ethernet/cortina/gemini.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/cortina/gemini.c +10 -2
@@ -1108,10 +1108,13 @@ static void gmac_tx_irq_enable(struct net_device *netdev, {struct gemini_ethernet_port *port =netdev_priv (netdev);struct gemini_ethernet *geth = port->geth; +unsigned long flags;u32 val, mask;netdev_dbg (netdev,"%s device %d\n" , __func__, netdev->dev_id); +spin_lock_irqsave (&geth->irq_lock, flags); + mask =GMAC0_IRQ0_TXQ0_INTS << (6 * netdev->dev_id + txq);if (en)
@@ -1120,6 +1123,8 @@ static void gmac_tx_irq_enable(struct net_device *netdev, val =readl (geth->base +GLOBAL_INTERRUPT_ENABLE_0_REG ); val = en ? val | mask : val & ~mask;writel (val, geth->base +GLOBAL_INTERRUPT_ENABLE_0_REG ); + +spin_unlock_irqrestore (&geth->irq_lock, flags); }static void gmac_tx_irq (struct net_device *netdev,unsigned int txq_num)
@@ -1426,15 +1431,19 @@ static unsigned int gmac_rx(struct net_device *netdev, unsigned int budget)union gmac_rxdesc_3 word3;struct page *page =NULL ;unsigned int page_offs; +unsigned long flags;unsigned short r, w;union dma_rwptr rw;dma_addr_t mapping;int frag_nr =0 ; +spin_lock_irqsave (&geth->irq_lock, flags); rw.bits32 =readl (ptr_reg);/* Reset interrupt as all packages until here are taken into account */ writel (DEFAULT_Q0_INT_BIT << netdev->dev_id, geth->base +GLOBAL_INTERRUPT_STATUS_1_REG ); +spin_unlock_irqrestore (&geth->irq_lock, flags); + r = rw.bits.rptr; w = rw.bits.wptr;
@@ -1737,10 +1746,9 @@ static irqreturn_t gmac_irq(int irq, void *data)gmac_update_hw_stats (netdev);if (val & (GMAC0_RX_OVERRUN_INT_BIT << (netdev->dev_id *8 ))) { +spin_lock (&geth->irq_lock);writel (GMAC0_RXDERR_INT_BIT << (netdev->dev_id *8 ), geth->base +GLOBAL_INTERRUPT_STATUS_4_REG ); - -spin_lock (&geth->irq_lock);u64_stats_update_begin (&port->ir_stats_syncp); ++port->stats.rx_fifo_errors;u64_stats_update_end (&port->ir_stats_syncp);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/473 af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 540bf24fba16b88c1b3b9353927204b4f1074e25 ]
A data-race condition has been identified in af_unix. In one data path, the write function unix_release_sock() atomically writes to sk->sk_shutdown using WRITE_ONCE. However, on the reader side, unix_stream_sendmsg() does not read it atomically. Consequently, this issue is causing the following KCSAN splat to occur:
BUG: KCSAN: data-race in unix_release_sock / unix_stream_sendmsg
write (marked) to 0xffff88867256ddbb of 1 bytes by task 7270 on cpu 28: unix_release_sock (net/unix/af_unix.c:640) unix_release (net/unix/af_unix.c:1050) sock_close (net/socket.c:659 net/socket.c:1421) __fput (fs/file_table.c:422) __fput_sync (fs/file_table.c:508) __se_sys_close (fs/open.c:1559 fs/open.c:1541) __x64_sys_close (fs/open.c:1541) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) read to 0xffff88867256ddbb of 1 bytes by task 989 on cpu 14: unix_stream_sendmsg (net/unix/af_unix.c:2273) __sock_sendmsg (net/socket.c:730 net/socket.c:745) ____sys_sendmsg (net/socket.c:2584) __sys_sendmmsg (net/socket.c:2638 net/socket.c:2724) __x64_sys_sendmmsg (net/socket.c:2753 net/socket.c:2750 net/socket.c:2750) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) value changed: 0x01 -> 0x03
The line numbers are related to commit dd5a440a31fa ("Linux 6.9-rc7").
Commit e1d09c2c2f57 ("af_unix: Fix data races around sk->sk_shutdown.") addressed a comparable issue in the past regarding sk->sk_shutdown. However, it overlooked resolving this particular data path. This patch only offending unix_stream_sendmsg() function, since the other reads seem to be protected by unix_state_lock() as discussed in
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -2189,7 +2189,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, goto out_err; } -if (sk->sk_shutdown &SEND_SHUTDOWN ) +if (READ_ONCE (sk->sk_shutdown) &SEND_SHUTDOWN ) goto pipe_err;while (sent < len) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/473 net: usb: smsc95xx: stop lying about skb->truesize
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d50729f1d60bca822ef6d9c1a5fb28d486bd7593 ]
Some usb drivers try to set small skb->truesize and break core networking stacks.
In this patch, I removed one of the skb->truesize override.
I also replaced one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
v3: also fix a sparse error ( https://lore.kernel.org/oe-kbuild-all/[email protected]/ )
v2: leave the skb_trim() game because smsc95xx_rx_csum_offload()
needs the csum part. (Jakub)
While we are it, use get_unaligned() in smsc95xx_rx_csum_offload().
--- drivers/net/usb/smsc95xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/net/usb/smsc95xx.c +7 -8
@@ -1810,9 +1810,11 @@ static int smsc95xx_reset_resume(struct usb_interface *intf)static void smsc95xx_rx_csum_offload (struct sk_buff *skb) { - skb->csum = *(u16 *)(skb_tail_pointer (skb) -2 ); +u16 *csum_ptr = (u16 *)(skb_tail_pointer (skb) -2 ); + + skb->csum = (__force __wsum )get_unaligned (csum_ptr); skb->ip_summed =CHECKSUM_COMPLETE ; -skb_trim (skb, skb->len -2 ); +skb_trim (skb, skb->len -2 );/* remove csum */ }static int smsc95xx_rx_fixup (struct usbnet *dev,struct sk_buff *skb)
@@ -1870,25 +1872,22 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)if (dev->net->features &NETIF_F_RXCSUM )smsc95xx_rx_csum_offload (skb);skb_trim (skb, skb->len -4 );/* remove fcs */ - skb->truesize = size +sizeof (struct sk_buff );return 1 ; } - ax_skb =skb_clone (skb,GFP_ATOMIC ); + ax_skb =netdev_alloc_skb_ip_align (dev->net, size);if (unlikely (!ax_skb)) {netdev_warn (dev->net,"Error allocating skb\n" );return 0 ; } - ax_skb->len = size; - ax_skb->data = packet; -skb_set_tail_pointer (ax_skb, size); +skb_put (ax_skb, size); +memcpy (ax_skb->data, packet, size);if (dev->net->features &NETIF_F_RXCSUM )smsc95xx_rx_csum_offload (ax_skb);skb_trim (ax_skb, ax_skb->len -4 );/* remove fcs */ - ax_skb->truesize = size +sizeof (struct sk_buff );usbnet_skb_return (dev, ax_skb); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/473 net: openvswitch: fix overwriting ct original tuple for ICMPv6
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 7c988176b6c16c516474f6fceebe0f055af5eb56 ]
OVS_PACKET_CMD_EXECUTE has 3 main attributes:
- OVS_PACKET_ATTR_KEY - Packet metadata in a netlink format.
- OVS_PACKET_ATTR_PACKET - Binary packet content.
- OVS_PACKET_ATTR_ACTIONS - Actions to execute on the packet.
OVS_PACKET_ATTR_KEY is parsed first to populate sw_flow_key structure with the metadata like conntrack state, input port, recirculation id, etc. Then the packet itself gets parsed to populate the rest of the keys from the packet headers.
Whenever the packet parsing code starts parsing the ICMPv6 header, it first zeroes out fields in the key corresponding to Neighbor Discovery information even if it is not an ND packet.
It is an 'ipv6.nd' field. However, the 'ipv6' is a union that shares the space between 'nd' and 'ct_orig' that holds the original tuple conntrack metadata parsed from the OVS_PACKET_ATTR_KEY.
ND packets should not normally have conntrack state, so it's fine to share the space, but normal ICMPv6 Echo packets or maybe other types of ICMPv6 can have the state attached and it should not be overwritten.
The issue results in all but the last 4 bytes of the destination address being wiped from the original conntrack tuple leading to incorrect packet matching and potentially executing wrong actions in case this packet recirculates within the datapath or goes back to userspace.
ND fields should not be accessed in non-ND packets, so not clearing them should be fine. Executing memset() only for actual ND packets to avoid the issue.
Initializing the whole thing before parsing is needed because ND packet may not contain all the options.
The issue only affects the OVS_PACKET_CMD_EXECUTE path and doesn't affect packets entering OVS datapath from network interfaces, because in this case CT metadata is populated from skb after the packet is already parsed.
--- net/openvswitch/flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/flow.c +2 -1
@@ -558,7 +558,6 @@ static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,*/ key->tp.src =htons (icmp->icmp6_type); key->tp.dst =htons (icmp->icmp6_code); -memset (&key->ipv6.nd,0 ,sizeof (key->ipv6.nd)); if (icmp->icmp6_code == 0 && (icmp->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION ||
@@ -567,6 +566,8 @@ static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,struct nd_msg *nd;int offset; +memset (&key->ipv6.nd,0 ,sizeof (key->ipv6.nd)); +/* In order to process neighbor discovery options, we need the * entire packet. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/473 ipv6: sr: add missing seg6_local_exit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 3321687e321307629c71b664225b861ebf3e5753 ]
Currently, we only call seg6_local_exit() in seg6_init() if seg6_local_init() failed. But forgot to call it in seg6_exit().
--- net/ipv6/seg6.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/seg6.c +1 -0
@@ -564,6 +564,7 @@ void seg6_exit(void)seg6_hmac_exit ();#endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL +seg6_local_exit ();seg6_iptunnel_exit ();#endif unregister_pernet_subsys (&ip6_segments_ops);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/473 ipv6: sr: fix incorrect unregister order
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 6e370a771d2985107e82d0f6174381c1acb49c20 ]
Commit 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref") changed the register order in seg6_init(). But the unregister order in seg6_exit() is not updated.
--- net/ipv6/seg6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/seg6.c +1 -1
@@ -567,6 +567,6 @@ void seg6_exit(void)seg6_local_exit ();seg6_iptunnel_exit ();#endif -unregister_pernet_subsys (&ip6_segments_ops);genl_unregister_family (&seg6_genl_family); +unregister_pernet_subsys (&ip6_segments_ops); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/473 ipv6: sr: fix invalid unregister error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 160e9d2752181fcf18c662e74022d77d3164cd45 ]
The error path of seg6_init() is wrong in case CONFIG_IPV6_SEG6_LWTUNNEL is not defined. In that case if seg6_hmac_init() fails, the genl_unregister_family() isn't called.
This issue exist since commit 46738b1317e1 ("ipv6: sr: add option to control lwtunnel support"), and commit 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref") replaced unregister_pernet_subsys() with genl_unregister_family() in this error path.
--- net/ipv6/seg6.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/seg6.c +2 -0
@@ -551,6 +551,8 @@ int __init seg6_init(void)#endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL out_unregister_genl: +#endif +#if IS_ENABLED (CONFIG_IPV6_SEG6_LWTUNNEL ) ||IS_ENABLED (CONFIG_IPV6_SEG6_HMAC )genl_unregister_family (&seg6_genl_family);#endif out_unregister_pernet:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/473 net/mlx5: Add a timeout to acquire the command queue semaphore
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akiva Goldberger <[email protected]>
[ Upstream commit 485d65e1357123a697c591a5aeb773994b247ad7 ]
Prevent forced completion handling on an entry that has not yet been assigned an index, causing an out of bounds access on idx = -22. Instead of waiting indefinitely for the sem, blocking flow now waits for index to be allocated or a sem acquisition timeout before beginning the timer for FW completion.
Kernel log example:mlx5_core 0000:06:00.0: wait_func_handle_exec_timeout:1128:(pid 185911): cmd[-22]: CREATE_UCTX(0xa04) No done completion
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 41 +++++++++++++++---- include/linux/mlx5/driver.h | 1 + 2 files changed, 33 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +32 -9
@@ -964,19 +964,32 @@ static void cmd_work_handler(struct work_struct *work)bool poll_cmd = ent->polling;struct mlx5_cmd_layout *lay;struct mlx5_core_dev *dev; -unsigned long cb_timeout; -struct semaphore *sem; +unsigned long timeout;unsigned long flags;int alloc_ret;int cmd_mode; +complete (&ent->handling); + dev = container_of(cmd, struct mlx5_core_dev, cmd); - cb_timeout =msecs_to_jiffies (mlx5_tout_ms (dev,CMD )); + timeout =msecs_to_jiffies (mlx5_tout_ms (dev,CMD )); -complete (&ent->handling); - sem = ent->page_queue ? &cmd->vars.pages_sem : &cmd->vars.sem; -down (sem);if (!ent->page_queue) { +if (down_timeout (&cmd->vars.sem, timeout)) { +mlx5_core_warn (dev,"%s(0x%x) timed out while waiting for a slot.\n" , +mlx5_command_str (ent->op), ent->op); +if (ent->callback) { + ent->callback (-EBUSY , ent->context); +mlx5_free_cmd_msg (dev, ent->out); +free_msg (dev, ent->in); +cmd_ent_put (ent); + }else { + ent->ret = -EBUSY ; +complete (&ent->done); + } +complete (&ent->slotted); +return ; + } alloc_ret =cmd_alloc_index (cmd, ent);if (alloc_ret <0 ) {mlx5_core_err_rl (dev,"failed to allocate command entry\n" );
@@ -989,10 +1002,11 @@ static void cmd_work_handler(struct work_struct *work) ent->ret = -EAGAIN ;complete (&ent->done); } -up (sem); +up (&cmd->vars.sem);return ; } }else { +down (&cmd->vars.pages_sem); ent->idx = cmd->vars.max_reg_cmds;spin_lock_irqsave (&cmd->alloc_lock, flags);clear_bit (ent->idx, &cmd->vars.bitmask);
@@ -1000,6 +1014,8 @@ static void cmd_work_handler(struct work_struct *work)spin_unlock_irqrestore (&cmd->alloc_lock, flags); } +complete (&ent->slotted); + lay =get_inst (cmd, ent->idx); ent->lay = lay;memset (lay,0 ,sizeof (*lay));
@@ -1018,7 +1034,7 @@ static void cmd_work_handler(struct work_struct *work) ent->ts1 =ktime_get_ns (); cmd_mode = cmd->mode; -if (ent->callback &&schedule_delayed_work (&ent->cb_timeout_work, cb_timeout)) +if (ent->callback &&schedule_delayed_work (&ent->cb_timeout_work, timeout))cmd_ent_get (ent);set_bit (MLX5_CMD_ENT_STATE_PENDING_COMP , &ent->state);
@@ -1138,6 +1154,9 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) ent->ret = -ECANCELED ; goto out_err; } + +wait_for_completion (&ent->slotted); +if (cmd->mode ==CMD_MODE_POLLING || ent->polling)wait_for_completion (&ent->done);else if (!wait_for_completion_timeout (&ent->done, timeout))
@@ -1152,6 +1171,9 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) }else if (err == -ECANCELED ) {mlx5_core_warn (dev,"%s(0x%x) canceled on out of queue timeout.\n" ,mlx5_command_str (ent->op), ent->op); + }else if (err == -EBUSY ) { +mlx5_core_warn (dev,"%s(0x%x) timeout while waiting for command semaphore.\n" , +mlx5_command_str (ent->op), ent->op); }mlx5_core_dbg (dev,"err %d, delivery status %s(%d)\n" , err,deliv_status_to_str (ent->status), ent->status);
@@ -1203,6 +1225,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, ent->polling = force_polling;init_completion (&ent->handling); +init_completion (&ent->slotted);if (!callback)init_completion (&ent->done);
@@ -1220,7 +1243,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in,return 0 ;/* mlx5_cmd_comp_handler() will put(ent) */ err =wait_func (dev, ent); -if (err == -ETIMEDOUT || err == -ECANCELED ) +if (err == -ETIMEDOUT || err == -ECANCELED || err == -EBUSY ) goto out_free; ds = ent->ts2 - ent->ts1;
include/linux/mlx5/driver.h +1 -0
@@ -850,6 +850,7 @@ struct mlx5_cmd_work_ent {void *context;int idx;struct completion handling; +struct completion slotted;struct completion done;struct mlx5_cmd *cmd;struct work_struct work;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 179/473 net/mlx5: Discard command completions in internal error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akiva Goldberger <[email protected]>
[ Upstream commit db9b31aa9bc56ff0d15b78f7e827d61c4a096e40 ]
Fix use after free when FW completion arrives while device is in internal error state. Avoid calling completion handler in this case, since the device will flush the command interface and trigger all completions manually.
Kernel log:
------------[ cut here ]------------ refcount_t: underflow; use-after-free. ... RIP: 0010:refcount_warn_saturate+0xd8/0xe0 ... Call Trace: <IRQ> ? __warn+0x79/0x120 ? refcount_warn_saturate+0xd8/0xe0 ? report_bug+0x17c/0x190 ? handle_bug+0x3c/0x60 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? refcount_warn_saturate+0xd8/0xe0 cmd_ent_put+0x13b/0x160 [mlx5_core] mlx5_cmd_comp_handler+0x5f9/0x670 [mlx5_core] cmd_comp_notifier+0x1f/0x30 [mlx5_core] notifier_call_chain+0x35/0xb0 atomic_notifier_call_chain+0x16/0x20 mlx5_eq_async_int+0xf6/0x290 [mlx5_core] notifier_call_chain+0x35/0xb0 atomic_notifier_call_chain+0x16/0x20 irq_int_handler+0x19/0x30 [mlx5_core] __handle_irq_event_percpu+0x4b/0x160 handle_irq_event+0x2e/0x80 handle_edge_irq+0x98/0x230 __common_interrupt+0x3b/0xa0 common_interrupt+0x7b/0xa0 </IRQ> <TASK> asm_common_interrupt+0x22/0x40
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +3 -0
@@ -1632,6 +1632,9 @@ static int cmd_comp_notifier(struct notifier_block *nb, dev = container_of(cmd, struct mlx5_core_dev, cmd); eqe = data; +if (dev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR ) +return NOTIFY_DONE ; +mlx5_cmd_comp_handler (dev,be32_to_cpu (eqe->data.cmd.vector), false);return NOTIFY_OK ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 180/473 s390/bpf: Emit a barrier for BPF_FETCH instructions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Leoshkevich <[email protected]>
[ Upstream commit 68378982f0b21de02ac3c6a11e2420badefcb4bc ]
BPF_ATOMIC_OP() macro documentation states that "BPF_ADD | BPF_FETCH" should be the same as atomic_fetch_add(), which is currently not the case on s390x: the serialization instruction "bcr 14,0" is missing. This applies to "and", "or" and "xor" variants too.
s390x is allowed to reorder stores with subsequent fetches from different addresses, so code relying on BPF_FETCH acting as a barrier, for example:
stw [%r0], 1
afadd [%r1], %r2
ldxw %r3, [%r4]
may be broken. Fix it by emitting "bcr 14,0".
Note that a separate serialization instruction is not needed for BPF_XCHG and BPF_CMPXCHG, because COMPARE AND SWAP performs serialization itself.
--- arch/s390/net/bpf_jit_comp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +6 -2
@@ -1207,8 +1207,12 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,EMIT6_DISP_LH (0xeb000000 , is32 ? (op32) : (op64), \ (insn->imm &BPF_FETCH ) ? src_reg :REG_W0 , \ src_reg, dst_reg, off); \ -if (is32 && (insn->imm &BPF_FETCH )) \ -EMIT_ZERO (src_reg); \ +if (insn->imm &BPF_FETCH ) { \ +/* bcr 14,0 - see atomic_fetch_{add,and,or,xor}() */ \ +_EMIT2 (0x07e0 ); \ +if (is32) \ +EMIT_ZERO (src_reg); \ + } \ }while (0 )case BPF_ADD :case BPF_ADD |BPF_FETCH :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 181/473 riscv, bpf: make some atomic operations fully ordered
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 20a759df3bba35bf5c3ddec0c02ad69b603b584c ]
The BPF atomic operations with the BPF_FETCH modifier along with BPF_XCHG and BPF_CMPXCHG are fully ordered but the RISC-V JIT implements all atomic operations except BPF_CMPXCHG with relaxed ordering.
Section 8.1 of the "The RISC-V Instruction Set Manual Volume I:
Unprivileged ISA" [1], titled, "Specifying Ordering of Atomic Instructions" says:
| To provide more efficient support for release consistency [5], each | atomic instruction has two bits, aq and rl, used to specify additional | memory ordering constraints as viewed by other RISC-V harts.
and
| If only the aq bit is set, the atomic memory operation is treated as | an acquire access. | If only the rl bit is set, the atomic memory operation is treated as a | release access. | | If both the aq and rl bits are set, the atomic memory operation is | sequentially consistent.
Fix this by setting both aq and rl bits as 1 for operations with BPF_FETCH and BPF_XCHG.
[1] https://riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf
--- arch/riscv/net/bpf_jit_comp64.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/riscv/net/bpf_jit_comp64.c +10 -10
@@ -503,33 +503,33 @@ static void emit_atomic(u8 rd, u8 rs, s16 off, s32 imm, bool is64,break ;/* src_reg = atomic_fetch_<op>(dst_reg + off16, src_reg) */ case BPF_ADD |BPF_FETCH : -emit (is64 ?rv_amoadd_d (rs, rs, rd,0 ,0 ) : -rv_amoadd_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoadd_d (rs, rs, rd,1 ,1 ) : +rv_amoadd_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;case BPF_AND |BPF_FETCH : -emit (is64 ?rv_amoand_d (rs, rs, rd,0 ,0 ) : -rv_amoand_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoand_d (rs, rs, rd,1 ,1 ) : +rv_amoand_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;case BPF_OR |BPF_FETCH : -emit (is64 ?rv_amoor_d (rs, rs, rd,0 ,0 ) : -rv_amoor_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoor_d (rs, rs, rd,1 ,1 ) : +rv_amoor_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;case BPF_XOR |BPF_FETCH : -emit (is64 ?rv_amoxor_d (rs, rs, rd,0 ,0 ) : -rv_amoxor_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoxor_d (rs, rs, rd,1 ,1 ) : +rv_amoxor_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;/* src_reg = atomic_xchg(dst_reg + off16, src_reg); */ case BPF_XCHG : -emit (is64 ?rv_amoswap_d (rs, rs, rd,0 ,0 ) : -rv_amoswap_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoswap_d (rs, rs, rd,1 ,1 ) : +rv_amoswap_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 182/473 ax25: Use kernel universal linked list to implement ax25_dev_list
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit a7d6e36b9ad052926ba2ecba3a59d8bb67dabcb4 ]
The origin ax25_dev_list implements its own single linked list, which is complicated and error-prone. For example, when deleting the node of ax25_dev_list in ax25_dev_device_down(), we have to operate on the head node and other nodes separately.
This patch uses kernel universal linked list to replace original ax25_dev_list, which make the operation of ax25_dev_list easier.
We should do "dev->ax25_ptr = ax25_dev;" and "dev->ax25_ptr = NULL;" while holding the spinlock, otherwise the ax25_dev_device_up() and ax25_dev_device_down() could race.
Stable-dep-of: b505e0319852 ("ax25: Fix reference count leak issues of ax25_dev")
--- include/net/ax25.h | 3 +-- net/ax25/ax25_dev.c | 40 +++++++++++++++------------------------- 2 files changed, 16 insertions(+), 27 deletions(-)
include/net/ax25.h +1 -2
@@ -216,7 +216,7 @@ typedef struct {struct ctl_table ; typedef struct ax25_dev { - struct ax25_dev *next; + struct list_head list; struct net_device *dev; netdevice_tracker dev_tracker;
@@ -333,7 +333,6 @@ int ax25_addr_size(const ax25_digi *);void ax25_digi_invert (const ax25_digi *,ax25_digi *);/* ax25_dev.c */ -extern ax25_dev *ax25_dev_list;extern spinlock_t ax25_dev_lock;#if IS_ENABLED (CONFIG_AX25 )
net/ax25/ax25_dev.c +15 -25
@@ -22,11 +22,12 @@#include <net/sock.h> #include <linux/uaccess.h> #include <linux/fcntl.h> +#include <linux/list.h> #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/init.h> -ax25_dev *ax25_dev_list; +static LIST_HEAD (ax25_dev_list);DEFINE_SPINLOCK (ax25_dev_lock);ax25_dev *ax25_addr_ax25dev (ax25_address *addr)
@@ -34,7 +35,7 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr)ax25_dev *ax25_dev, *res =NULL ;spin_lock_bh (&ax25_dev_lock); -for (ax25_dev = ax25_dev_list; ax25_dev !=NULL ; ax25_dev = ax25_dev->next) +list_for_each_entry (ax25_dev, &ax25_dev_list, list)if (ax25cmp (addr, (const ax25_address *)ax25_dev->dev->dev_addr) ==0 ) { res = ax25_dev;ax25_dev_hold (ax25_dev);
@@ -59,7 +60,6 @@ void ax25_dev_device_up(struct net_device *dev) }refcount_set (&ax25_dev->refcount,1 ); - dev->ax25_ptr = ax25_dev; ax25_dev->dev = dev;netdev_hold (dev, &ax25_dev->dev_tracker,GFP_KERNEL ); ax25_dev->forward =NULL ;
@@ -85,8 +85,8 @@ void ax25_dev_device_up(struct net_device *dev)#endif spin_lock_bh (&ax25_dev_lock); - ax25_dev->next = ax25_dev_list; - ax25_dev_list = ax25_dev; +list_add (&ax25_dev->list, &ax25_dev_list); + dev->ax25_ptr = ax25_dev;spin_unlock_bh (&ax25_dev_lock);ax25_dev_hold (ax25_dev);
@@ -111,32 +111,25 @@ void ax25_dev_device_down(struct net_device *dev)/* * Remove any packet forwarding that points to this device. */ -for (s = ax25_dev_list; s !=NULL ; s = s->next) +list_for_each_entry (s, &ax25_dev_list, list)if (s->forward == dev) s->forward =NULL ; -if ((s = ax25_dev_list) == ax25_dev) { - ax25_dev_list = s->next; - goto unlock_put; - } - -while (s !=NULL && s->next !=NULL ) { -if (s->next == ax25_dev) { - s->next = ax25_dev->next; +list_for_each_entry (s, &ax25_dev_list, list) { +if (s == ax25_dev) { +list_del (&s->list); goto unlock_put; } - - s = s->next; } -spin_unlock_bh (&ax25_dev_lock); dev->ax25_ptr =NULL ; +spin_unlock_bh (&ax25_dev_lock);ax25_dev_put (ax25_dev);return ; unlock_put: + dev->ax25_ptr =NULL ;spin_unlock_bh (&ax25_dev_lock);ax25_dev_put (ax25_dev); - dev->ax25_ptr =NULL ;netdev_put (dev, &ax25_dev->dev_tracker);ax25_dev_put (ax25_dev); }
@@ -200,16 +193,13 @@ struct net_device *ax25_fwd_dev(struct net_device *dev)*/ void __exit ax25_dev_free(void) { -ax25_dev *s, *ax25_dev; +ax25_dev *s, *n;spin_lock_bh (&ax25_dev_lock); - ax25_dev = ax25_dev_list; -while (ax25_dev !=NULL ) { - s = ax25_dev; -netdev_put (ax25_dev->dev, &ax25_dev->dev_tracker); - ax25_dev = ax25_dev->next; +list_for_each_entry_safe (s, n, &ax25_dev_list, list) { +netdev_put (s->dev, &s->dev_tracker); +list_del (&s->list);kfree (s); } - ax25_dev_list =NULL ;spin_unlock_bh (&ax25_dev_lock); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 183/473 ax25: Fix reference count leak issues of ax25_dev
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit b505e0319852b08a3a716b64620168eab21f4ced ]
The ax25_addr_ax25dev() and ax25_dev_device_down() exist a reference count leak issue of the object "ax25_dev".
Memory leak issue in ax25_addr_ax25dev():
The reference count of the object "ax25_dev" can be increased multiple times in ax25_addr_ax25dev(). This will cause a memory leak.
Memory leak issues in ax25_dev_device_down():
The reference count of ax25_dev is set to 1 in ax25_dev_device_up() and then increase the reference count when ax25_dev is added to ax25_dev_list. As a result, the reference count of ax25_dev is 2. But when the device is shutting down. The ax25_dev_device_down() drops the reference count once or twice depending on if we goto unlock_put or not, which will cause memory leak.
As for the issue of ax25_addr_ax25dev(), it is impossible for one pointer to be on a list twice. So add a break in ax25_addr_ax25dev(). As for the issue of ax25_dev_device_down(), increase the reference count of ax25_dev once in ax25_dev_device_up() and decrease the reference count of ax25_dev after it is removed from the ax25_dev_list.
--- net/ax25/ax25_dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ax25/ax25_dev.c +1 -2
@@ -39,6 +39,7 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr)if (ax25cmp (addr, (const ax25_address *)ax25_dev->dev->dev_addr) ==0 ) { res = ax25_dev;ax25_dev_hold (ax25_dev); +break ; }spin_unlock_bh (&ax25_dev_lock);
@@ -88,7 +89,6 @@ void ax25_dev_device_up(struct net_device *dev)list_add (&ax25_dev->list, &ax25_dev_list); dev->ax25_ptr = ax25_dev;spin_unlock_bh (&ax25_dev_lock); -ax25_dev_hold (ax25_dev);ax25_register_dev_sysctl (ax25_dev); }
@@ -129,7 +129,6 @@ void ax25_dev_device_down(struct net_device *dev) unlock_put: dev->ax25_ptr =NULL ;spin_unlock_bh (&ax25_dev_lock); -ax25_dev_put (ax25_dev);netdev_put (dev, &ax25_dev->dev_tracker);ax25_dev_put (ax25_dev); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 184/473 ax25: Fix reference count leak issue of net_device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit 36e56b1b002bb26440403053f19f9e1a8bc075b2 ]
There is a reference count leak issue of the object "net_device" in ax25_dev_device_down(). When the ax25 device is shutting down, the ax25_dev_device_down() drops the reference count of net_device one or zero times depending on if we goto unlock_put or not, which will cause memory leak.
In order to solve the above issue, decrease the reference count of net_device after dev->ax25_ptr is set to null.
--- net/ax25/ax25_dev.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
net/ax25/ax25_dev.c +1 -6
@@ -118,15 +118,10 @@ void ax25_dev_device_down(struct net_device *dev)list_for_each_entry (s, &ax25_dev_list, list) {if (s == ax25_dev) {list_del (&s->list); - goto unlock_put; +break ; } } - dev->ax25_ptr =NULL ; -spin_unlock_bh (&ax25_dev_lock); -ax25_dev_put (ax25_dev); -return ; -unlock_put: dev->ax25_ptr =NULL ;spin_unlock_bh (&ax25_dev_lock);netdev_put (dev, &ax25_dev->dev_tracker);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 185/473 mptcp: SO_KEEPALIVE: fix getsockopt support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
[ Upstream commit a65198136eaa15b74ee0abf73f12ef83d469a334 ]
SO_KEEPALIVE support has to be set on each subflow: on each TCP socket, where sk_prot->keepalive is defined. Technically, nothing has to be done on the MPTCP socket. That's why mptcp_sol_socket_sync_intval() was called instead of mptcp_sol_socket_intval().
Except that when nothing is done on the MPTCP socket, the getsockopt(SO_KEEPALIVE), handled in net/core/sock.c:sk_getsockopt(), will not know if SO_KEEPALIVE has been set on the different subflows or not.
The fix is simple: simply call mptcp_sol_socket_intval() which will end up calling net/core/sock.c:sk_setsockopt() where the SOCK_KEEPOPEN flag will be set, the one used in sk_getsockopt().
So now, getsockopt(SO_KEEPALIVE) on an MPTCP socket will return the same value as the one previously set with setsockopt(SO_KEEPALIVE).
--- net/mptcp/sockopt.c | 2 -- 1 file changed, 2 deletions(-)
net/mptcp/sockopt.c +0 -2
@@ -179,8 +179,6 @@ static int mptcp_setsockopt_sol_socket_int(struct mptcp_sock *msk, int optname,switch (optname) {case SO_KEEPALIVE : -mptcp_sol_socket_sync_intval (msk, optname, val); -return 0 ;case SO_DEBUG :case SO_MARK :case SO_PRIORITY :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 186/473 Bluetooth: Consolidate code around sk_alloc into a helper function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 6bfa273e533d7b25eee3d74e28a7fe8e6a8e7a93 ]
This consolidates code around sk_alloc into bt_sock_alloc which does take care of common initialization.
Stable-dep-of: ce60b9231b66 ("Bluetooth: compute LE flow credits based on recvbuf space")
--- include/net/bluetooth/bluetooth.h | 2 ++ net/bluetooth/af_bluetooth.c | 21 +++++++++++++++++++++ net/bluetooth/bnep/sock.c | 10 +--------- net/bluetooth/hci_sock.c | 10 ++-------- net/bluetooth/iso.c | 10 +--------- net/bluetooth/l2cap_sock.c | 10 +--------- net/bluetooth/rfcomm/sock.c | 13 +++---------- net/bluetooth/sco.c | 10 +--------- 8 files changed, 32 insertions(+), 54 deletions(-)
include/net/bluetooth/bluetooth.h +2 -0
@@ -383,6 +383,8 @@ int bt_sock_register(int proto, const struct net_proto_family *ops);void bt_sock_unregister (int proto);void bt_sock_link (struct bt_sock_list *l,struct sock *s);void bt_sock_unlink (struct bt_sock_list *l,struct sock *s); +struct sock *bt_sock_alloc (struct net *net,struct socket *sock, +struct proto *prot,int proto,gfp_t prio,int kern);int bt_sock_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags); int bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg,
net/bluetooth/af_bluetooth.c +21 -0
@@ -140,6 +140,27 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto,return err; } +struct sock *bt_sock_alloc (struct net *net,struct socket *sock, +struct proto *prot,int proto,gfp_t prio,int kern) +{ +struct sock *sk; + + sk =sk_alloc (net,PF_BLUETOOTH , prio, prot, kern); +if (!sk) +return NULL ; + +sock_init_data (sock, sk); +INIT_LIST_HEAD (&bt_sk (sk)->accept_q); + +sock_reset_flag (sk,SOCK_ZAPPED ); + + sk->sk_protocol = proto; + sk->sk_state =BT_OPEN ; + +return sk; +} +EXPORT_SYMBOL (bt_sock_alloc); +void bt_sock_link (struct bt_sock_list *l,struct sock *sk) {write_lock (&l->lock);
net/bluetooth/bnep/sock.c +1 -9
@@ -205,21 +205,13 @@ static int bnep_sock_create(struct net *net, struct socket *sock, int protocol,if (sock->type !=SOCK_RAW )return -ESOCKTNOSUPPORT ; - sk =sk_alloc (net,PF_BLUETOOTH ,GFP_ATOMIC , &bnep_proto, kern); + sk =bt_sock_alloc (net, sock, &bnep_proto, protocol,GFP_ATOMIC , kern);if (!sk)return -ENOMEM ; -sock_init_data (sock, sk); - sock->ops = &bnep_sock_ops; - sock->state =SS_UNCONNECTED ; -sock_reset_flag (sk,SOCK_ZAPPED ); - - sk->sk_protocol = protocol; - sk->sk_state =BT_OPEN ; -bt_sock_link (&bnep_sk_list, sk);return 0 ; }
net/bluetooth/hci_sock.c +2 -8
@@ -2144,18 +2144,12 @@ static int hci_sock_create(struct net *net, struct socket *sock, int protocol, sock->ops = &hci_sock_ops; - sk =sk_alloc (net,PF_BLUETOOTH ,GFP_ATOMIC , &hci_sk_proto, kern); + sk =bt_sock_alloc (net, sock, &hci_sk_proto, protocol,GFP_ATOMIC , + kern);if (!sk)return -ENOMEM ; -sock_init_data (sock, sk); - -sock_reset_flag (sk,SOCK_ZAPPED ); - - sk->sk_protocol = protocol; - sock->state =SS_UNCONNECTED ; - sk->sk_state =BT_OPEN ; sk->sk_destruct = hci_sock_destruct;bt_sock_link (&hci_sk_list, sk);
net/bluetooth/iso.c +1 -9
@@ -695,21 +695,13 @@ static struct sock *iso_sock_alloc(struct net *net, struct socket *sock, {struct sock *sk; - sk =sk_alloc (net,PF_BLUETOOTH , prio, &iso_proto, kern); + sk =bt_sock_alloc (net, sock, &iso_proto, proto, prio, kern);if (!sk)return NULL ; -sock_init_data (sock, sk); -INIT_LIST_HEAD (&bt_sk (sk)->accept_q); - sk->sk_destruct = iso_sock_destruct; sk->sk_sndtimeo =ISO_CONN_TIMEOUT ; -sock_reset_flag (sk,SOCK_ZAPPED ); - - sk->sk_protocol = proto; - sk->sk_state =BT_OPEN ; -/* Set address type as public as default src address is BDADDR_ANY */ iso_pi (sk)->src_type =BDADDR_LE_PUBLIC ;
net/bluetooth/l2cap_sock.c +1 -9
@@ -1847,21 +1847,13 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,struct sock *sk;struct l2cap_chan *chan; - sk =sk_alloc (net,PF_BLUETOOTH , prio, &l2cap_proto, kern); + sk =bt_sock_alloc (net, sock, &l2cap_proto, proto, prio, kern);if (!sk)return NULL ; -sock_init_data (sock, sk); -INIT_LIST_HEAD (&bt_sk (sk)->accept_q); - sk->sk_destruct = l2cap_sock_destruct; sk->sk_sndtimeo =L2CAP_CONN_TIMEOUT ; -sock_reset_flag (sk,SOCK_ZAPPED ); - - sk->sk_protocol = proto; - sk->sk_state =BT_OPEN ; - chan =l2cap_chan_create ();if (!chan) {sk_free (sk);
net/bluetooth/rfcomm/sock.c +3 -10
@@ -268,18 +268,16 @@ static struct proto rfcomm_proto = { .obj_size = sizeof(struct rfcomm_pinfo) }; -static struct sock *rfcomm_sock_alloc (struct net *net,struct socket *sock,int proto,gfp_t prio,int kern) +static struct sock *rfcomm_sock_alloc (struct net *net,struct socket *sock, +int proto,gfp_t prio,int kern) {struct rfcomm_dlc *d;struct sock *sk; - sk =sk_alloc (net,PF_BLUETOOTH , prio, &rfcomm_proto, kern); + sk =bt_sock_alloc (net, sock, &rfcomm_proto, proto, prio, kern);if (!sk)return NULL ; -sock_init_data (sock, sk); -INIT_LIST_HEAD (&bt_sk (sk)->accept_q); - d =rfcomm_dlc_alloc (prio);if (!d) {sk_free (sk);
@@ -298,11 +296,6 @@ static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int sk->sk_sndbuf =RFCOMM_MAX_CREDITS *RFCOMM_DEFAULT_MTU *10 ; sk->sk_rcvbuf =RFCOMM_MAX_CREDITS *RFCOMM_DEFAULT_MTU *10 ; -sock_reset_flag (sk,SOCK_ZAPPED ); - - sk->sk_protocol = proto; - sk->sk_state =BT_OPEN ; -bt_sock_link (&rfcomm_sk_list, sk);BT_DBG ("sk %p" , sk);
net/bluetooth/sco.c +1 -9
@@ -484,21 +484,13 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, {struct sock *sk; - sk =sk_alloc (net,PF_BLUETOOTH , prio, &sco_proto, kern); + sk =bt_sock_alloc (net, sock, &sco_proto, proto, prio, kern);if (!sk)return NULL ; -sock_init_data (sock, sk); -INIT_LIST_HEAD (&bt_sk (sk)->accept_q); - sk->sk_destruct = sco_sock_destruct; sk->sk_sndtimeo =SCO_CONN_TIMEOUT ; -sock_reset_flag (sk,SOCK_ZAPPED ); - - sk->sk_protocol = proto; - sk->sk_state =BT_OPEN ; -sco_pi (sk)->setting =BT_VOICE_CVSD_16BIT ;sco_pi (sk)->codec.id =BT_CODEC_CVSD ;sco_pi (sk)->codec.cid =0xffff ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 187/473 Bluetooth: compute LE flow credits based on recvbuf space
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Urban <[email protected]>
[ Upstream commit ce60b9231b66710b6ee24042ded26efee120ecfc ]
Previously LE flow credits were returned to the sender even if the socket's receive buffer was full. This meant that no back-pressure
was applied to the sender, thus it continued to send data, resulting in data loss without any error being reported. Furthermore, the amount of credits was essentially fixed to a small amount, leading to reduced performance.
This is fixed by computing the number of returned LE flow credits based on the estimated available space in the receive buffer of an L2CAP socket. Consequently, if the receive buffer is full, no credits are returned until the buffer is read and thus cleared by user-space.
Since the computation of available receive buffer space can only be performed approximately (due to sk_buff overhead) and the receive buffer size may be changed by user-space after flow credits have been sent, superfluous received data is temporary stored within l2cap_pinfo. This is necessary because Bluetooth LE provides no retransmission mechanism once the data has been acked by the physical layer.
If receive buffer space estimation is not possible at the moment, we fall back to providing credits for one full packet as before. This is currently the case during connection setup, when MPS is not yet available.
--- include/net/bluetooth/l2cap.h | 11 ++++- net/bluetooth/l2cap_core.c | 56 ++++++++++++++++++--- net/bluetooth/l2cap_sock.c | 91 ++++++++++++++++++++++++++++------- 3 files changed, 132 insertions(+), 26 deletions(-)
include/net/bluetooth/l2cap.h +10 -1
@@ -584,6 +584,9 @@ struct l2cap_chan {__u16 tx_credits;__u16 rx_credits; +/* estimated available receive buffer space or -1 if unknown */ +ssize_t rx_avail; +__u8 tx_state;__u8 rx_state;
@@ -724,10 +727,15 @@ struct l2cap_user {/* ----- L2CAP socket info ----- */ #define l2cap_pi (sk) ((struct l2cap_pinfo *) sk) +struct l2cap_rx_busy { +struct list_head list; +struct sk_buff *skb; +}; +struct l2cap_pinfo {struct bt_sock bt;struct l2cap_chan *chan; -struct sk_buff *rx_busy_skb; +struct list_head rx_busy; };enum {
@@ -985,6 +993,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,int l2cap_chan_reconfigure (struct l2cap_chan *chan,__u16 mtu);int l2cap_chan_send (struct l2cap_chan *chan,struct msghdr *msg,size_t len);void l2cap_chan_busy (struct l2cap_chan *chan,int busy); +void l2cap_chan_rx_avail (struct l2cap_chan *chan,ssize_t rx_avail);int l2cap_chan_check_security (struct l2cap_chan *chan,bool initiator);void l2cap_chan_set_defaults (struct l2cap_chan *chan);int l2cap_ertm_init (struct l2cap_chan *chan);
net/bluetooth/l2cap_core.c +49 -7
104 lines not on this page · raw message
net/bluetooth/l2cap_sock.c +73 -18
166 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 188/473 Bluetooth: qca: Fix error code in qca_read_fw_build_info()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit a189f0ee6685457528db7a36ded3085e5d13ddc3 ]
Return -ENOMEM on allocation failure. Don't return success.
--- drivers/bluetooth/btqca.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bluetooth/btqca.c +3 -1
@@ -148,8 +148,10 @@ static int qca_read_fw_build_info(struct hci_dev *hdev) } build_label =kstrndup (&edl->data[1 ], build_lbl_len,GFP_KERNEL ); -if (!build_label) +if (!build_label) { + err = -ENOMEM ; goto out; + }hci_set_fw_info (hdev,"%s" , build_label);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 189/473 drm/bridge: Fix improper bridge init order with pre_enable_prev_first
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jagan Teki <[email protected]>
[ Upstream commit e18aeeda0b6905c333df5a0566b99f5c84426098 ]
For a given bridge pipeline if any bridge sets pre_enable_prev_first flag then the pre_enable for the previous bridge will be called before pre_enable of this bridge and opposite is done for post_disable.
These are the potential bridge flags to alter bridge init order in order to satisfy the MIPI DSI host and downstream panel or bridge to function. However the existing pre_enable_prev_first logic with associated bridge ordering has broken for both pre_enable and post_disable calls.
[pre_enable]
The altered bridge ordering has failed if two consecutive bridges on a given pipeline enables the pre_enable_prev_first flag.
Example:
- Panel
- Bridge 1
- Bridge 2 pre_enable_prev_first
- Bridge 3
- Bridge 4 pre_enable_prev_first
- Bridge 5 pre_enable_prev_first
- Bridge 6
- Encoder
In this example, Bridge 4 and Bridge 5 have pre_enable_prev_first.
The logic looks for a bridge which enabled pre_enable_prev_first flag on each iteration and assigned the previou bridge to limit pointer if the bridge doesn't enable pre_enable_prev_first flags.
If control found Bridge 2 is pre_enable_prev_first then the iteration looks for Bridge 3 and found it is not pre_enable_prev_first and assigns it's previous Bridge 4 to limit pointer and calls pre_enable of Bridge 3 and Bridge 2 and assign iter pointer with limit which is Bridge 4.
Here is the actual problem, for the next iteration control look for Bridge 5 instead of Bridge 4 has iter pointer in previous iteration moved to Bridge 4 so this iteration skips the Bridge 4. The iteration found Bridge 6 doesn't pre_enable_prev_first flags so the limit assigned to Encoder. From next iteration Encoder skips as it is the last bridge for reverse order pipeline.
So, the resulting pre_enable bridge order would be,
- Panel, Bridge 1, Bridge 3, Bridge 2, Bridge 6, Bridge 5.
This patch fixes this by assigning limit to next pointer instead of previous bridge since the iteration always looks for bridge that does NOT request prev so assigning next makes sure the last bridge on a given iteration what exactly the limit bridge is.
So, the resulting pre_enable bridge order with fix would be,
- Panel, Bridge 1, Bridge 3, Bridge 2, Bridge 6, Bridge 5, Bridge 4, Encoder.
[post_disable]
The altered bridge ordering has failed if two consecutive bridges on a given pipeline enables the pre_enable_prev_first flag.
Example:
- Panel
- Bridge 1
- Bridge 2 pre_enable_prev_first
- Bridge 3
- Bridge 4 pre_enable_prev_first
- Bridge 5 pre_enable_prev_first
- Bridge 6
- Encoder
In this example Bridge 5 and Bridge 4 have pre_enable_prev_first.
The logic looks for a bridge which enabled pre_enable_prev_first flags on each iteration and assigned the previou bridge to next and next to limit pointer if the bridge does enable pre_enable_prev_first flag.
If control starts from Bridge 6 then it found next Bridge 5 is pre_enable_prev_first and immediately the next assigned to previous Bridge 6 and limit assignments to next Bridge 6 and call post_enable of Bridge 6 even though the next consecutive Bridge 5 is enabled with pre_enable_prev_first. This clearly misses the logic to find the state of next conducive bridge as everytime the next and limit assigns previous bridge if given bridge enabled pre_enable_prev_first.
So, the resulting post_disable bridge order would be,
- Encoder, Bridge 6, Bridge 5, Bridge 4, Bridge 3, Bridge 2, Bridge 1, Panel.
This patch fixes this by assigning next with previou bridge only if the bridge doesn't enable pre_enable_prev_first flag and the next further assign it to limit. This way we can find the bridge that NOT requested prev to disable last.
So, the resulting pre_enable bridge order with fix would be,
- Encoder, Bridge 4, Bridge 5, Bridge 6, Bridge 2, Bridge 3, Bridge 1, Panel.
Validated the bridge init ordering by incorporating dummy bridges in the sun6i-mipi-dsi pipeline
--- drivers/gpu/drm/drm_bridge.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_bridge.c +8 -2
@@ -755,11 +755,17 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,*/ list_for_each_entry_from (next, &encoder->bridge_chain, chain_node) { -if (next->pre_enable_prev_first) { +if (!next->pre_enable_prev_first) { next =list_prev_entry (next, chain_node); limit = next;break ; } + +if (list_is_last (&next->chain_node, + &encoder->bridge_chain)) { + limit = next; +break ; + } }/* Call these bridges in reverse order */
@@ -842,7 +848,7 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,/* Found first bridge that does NOT * request prev to be enabled first */ - limit =list_prev_entry (next, chain_node); + limit = next;break ; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 190/473 printk: Let no_printk() use _printk()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 8522f6b760ca588928eede740d5d69dd1e936b49 ]
When printk-indexing is enabled, each printk() invocation emits a pi_entry structure, containing the format string and other information related to its location in the kernel sources. This is even true for no_printk(): while the actual code to print the message is optimized out by the compiler due to the always-false check, the pi_entry structure is still emitted.
As the main purpose of no_printk() is to provide a helper to maintain printf()-style format checking when debugging is disabled, this leads to the inclusion in the index of lots of printk formats that cannot be emitted by the current kernel.
Fix this by switching no_printk() from printk() to _printk().
This reduces the size of an arm64 defconfig kernel with CONFIG_PRINTK_INDEX=y by 576 KiB.
--- include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/printk.h +1 -1
@@ -128,7 +128,7 @@ struct va_format {#define no_printk (fmt, ...) \ ({ \ if (0) \ - printk(fmt, ##__VA_ARGS__); \ + _printk(fmt, ##__VA_ARGS__); \ 0; \ })
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 191/473 dev_printk: Add and use dev_no_printk()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit c26ec799042a3888935d59b599f33e41efedf5f8 ]
When printk-indexing is enabled, each dev_printk() invocation emits a pi_entry structure. This is even true when the dev_printk() is protected by an always-false check, as is typically the case for debug
messages: while the actual code to print the message is optimized out by the compiler, the pi_entry structure is still emitted.
Avoid emitting pi_entry structures for unavailable dev_printk() kernel messages by:
1. Introducing a dev_no_printk() helper, mimicked after the existing no_printk() helper, which calls _dev_printk() instead of dev_printk(),
2. Replacing all "if (0) dev_printk(...)" constructs by calls to the new helper.
This reduces the size of an arm64 defconfig kernel with CONFIG_PRINTK_INDEX=y by 957 KiB.
--- include/linux/dev_printk.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
include/linux/dev_printk.h +13 -12
@@ -129,6 +129,16 @@ void _dev_info(const struct device *dev, const char *fmt, ...) _dev_printk(level, dev, fmt, ##__VA_ARGS__); \ }) +/* +* Dummy dev_printk for disabled debugging statements to use whilst maintaining +* gcc's format checking. +*/ +#define dev_no_printk (level, dev, fmt, ...) \ + ({ \ + if (0) \ + _dev_printk(level, dev, fmt, ##__VA_ARGS__); \ + }) +/* * #defines for all the dev_<level> macros to prefix with whatever * possible use of #define dev_fmt(fmt) ...
@@ -158,10 +168,7 @@ void _dev_info(const struct device *dev, const char *fmt, ...) dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#else #define dev_dbg (dev, fmt, ...) \ -({ \ - if (0) \ - dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ -}) + dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#endif #ifdef CONFIG_PRINTK
@@ -247,20 +254,14 @@ do { \ } while (0)#else #define dev_dbg_ratelimited (dev, fmt, ...) \ -do { \ - if (0) \ - dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ -} while (0) + dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#endif #ifdef VERBOSE_DEBUG #define dev_vdbg dev_dbg#else #define dev_vdbg (dev, fmt, ...) \ -({ \ - if (0) \ - dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ -}) + dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#endif /*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 192/473 drm/lcdif: Do not disable clocks on already suspended hardware
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 172695f145fb4798ab605e8a73f6e87711930124 ]
In case the LCDIF is enabled in DT but unused, the clocks used by the LCDIF are not enabled. Those clocks may even have a use count of 0 in case there are no other users of those clocks. This can happen e.g. in case the LCDIF drives HDMI bridge which has no panel plugged into the HDMI connector.
Do not attempt to disable clocks in the suspend callback and re-enable clocks in the resume callback unless the LCDIF is enabled and was in use before the system entered suspend, otherwise the driver might end up trying to disable clocks which are already disabled with use count 0, and would trigger a warning from clock core about this condition.
Note that the lcdif_rpm_suspend() and lcdif_rpm_resume() functions internally perform the clocks disable and enable operations and act as runtime PM hooks too.
--- drivers/gpu/drm/mxsfb/lcdif_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/mxsfb/lcdif_drv.c +5 -1
@@ -290,6 +290,9 @@ static int __maybe_unused lcdif_suspend(struct device *dev)if (ret)return ret; +if (pm_runtime_suspended (dev)) +return 0 ; +return lcdif_rpm_suspend (dev); }
@@ -297,7 +300,8 @@ static int __maybe_unused lcdif_resume(struct device *dev) {struct drm_device *drm =dev_get_drvdata (dev); -lcdif_rpm_resume (dev); +if (!pm_runtime_suspended (dev)) +lcdif_rpm_resume (dev);return drm_mode_config_helper_resume (drm); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 193/473 drm/panel-samsung-atna33xc20: Use ktime_get_boottime for delays
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Drew Davenport <[email protected]>
[ Upstream commit 62e43673ca84a68cc06dcaa9337a06df7f79fef9 ]
ktime_get_boottime continues while the device is suspended. This change ensures that the resume path will not be delayed if the power off delay has already been met while the device is suspended
Stable-dep-of: 5e842d55bad7 ("drm/panel: atna33xc20: Fix unbalanced regulator in the case HPD doesn't assert")
--- drivers/gpu/drm/panel/panel-samsung-atna33xc20.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +4 -4
@@ -53,7 +53,7 @@ static void atana33xc20_wait(ktime_t start_ktime, unsigned int min_ms)ktime_t now_ktime, min_ktime; min_ktime =ktime_add (start_ktime,ms_to_ktime (min_ms)); - now_ktime =ktime_get (); + now_ktime =ktime_get_boottime ();if (ktime_before (now_ktime, min_ktime))msleep (ktime_to_ms (ktime_sub (min_ktime, now_ktime)) +1 );
@@ -75,7 +75,7 @@ static int atana33xc20_suspend(struct device *dev) ret =regulator_disable (p->supply);if (ret)return ret; - p->powered_off_time =ktime_get (); + p->powered_off_time =ktime_get_boottime (); p->el3_was_on = false;return 0 ;
@@ -93,7 +93,7 @@ static int atana33xc20_resume(struct device *dev) ret =regulator_enable (p->supply);if (ret)return ret; - p->powered_on_time =ktime_get (); + p->powered_on_time =ktime_get_boottime ();if (p->no_hpd) {msleep (HPD_MAX_MS );
@@ -142,7 +142,7 @@ static int atana33xc20_disable(struct drm_panel *panel)return 0 ;gpiod_set_value_cansleep (p->el_on3_gpio,0 ); - p->el_on3_off_time =ktime_get (); + p->el_on3_off_time =ktime_get_boottime (); p->enabled = false;/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 194/473 drm/dp: Dont attempt AUX transfers when eDP panels are not powered
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 8df1ddb5bf11ab820ad991e164dab82c0960add9 ]
If an eDP panel is not powered on then any attempts to talk to it over the DP AUX channel will timeout. Unfortunately these attempts may be quite slow. Userspace can initiate these attempts either via a /dev/drm_dp_auxN device or via the created i2c device.
Making the DP AUX drivers timeout faster is a difficult proposition. In theory we could just poll the panel's HPD line in the AUX transfer function and immediately return an error there. However, this is easier said than done. For one thing, there's no hard requirement to hook the HPD line up for eDP panels and it's OK to just delay a fixed amount. For another thing, the HPD line may not be fast to probe. On parade-ps8640 we need to wait for the bridge chip's firmware to boot before we can get the HPD line and this is a slow process.
The fact that the transfers are taking so long to timeout is causing real problems. The open source fwupd daemon sometimes scans DP busses looking for devices whose firmware need updating. If it happens to scan while a panel is turned off this scan can take a long time. The fwupd daemon could try to be smarter and only scan when eDP panels are turned on, but we can also improve the behavior in the kernel.
Let's let eDP panels drivers specify that a panel is turned off and then modify the common AUX transfer code not to attempt a transfer in this case.
Stable-dep-of: 5e842d55bad7 ("drm/panel: atna33xc20: Fix unbalanced regulator in the case HPD doesn't assert")
--- drivers/gpu/drm/display/drm_dp_helper.c | 35 +++++++++++++++++++ drivers/gpu/drm/panel/panel-edp.c | 3 ++ .../gpu/drm/panel/panel-samsung-atna33xc20.c | 2 ++ include/drm/display/drm_dp_helper.h | 6 ++++ 4 files changed, 46 insertions(+)
drivers/gpu/drm/display/drm_dp_helper.c +35 -0
@@ -532,6 +532,15 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,mutex_lock (&aux->hw_mutex); +/* +* If the device attached to the aux bus is powered down then there's +* no reason to attempt a transfer. Error out immediately. +*/ +if (aux->powered_down) { + ret = -EBUSY ; + goto unlock; + } +/* * The specification doesn't give any recommendation on how often to * retry native transactions. We used to retry 7 times like for
@@ -599,6 +608,29 @@ int drm_dp_dpcd_probe(struct drm_dp_aux *aux, unsigned int offset) }EXPORT_SYMBOL (drm_dp_dpcd_probe); +/** +* drm_dp_dpcd_set_powered() - Set whether the DP device is powered +* @aux: DisplayPort AUX channel; for convenience it's OK to pass NULL here +* and the function will be a no-op. +* @powered: true if powered; false if not +* +* If the endpoint device on the DP AUX bus is known to be powered down +* then this function can be called to make future transfers fail immediately +* instead of needing to time out. +* +* If this function is never called then a device defaults to being powered. +*/ +void drm_dp_dpcd_set_powered (struct drm_dp_aux *aux,bool powered) +{ +if (!aux) +return ; + +mutex_lock (&aux->hw_mutex); + aux->powered_down = !powered; +mutex_unlock (&aux->hw_mutex); +} +EXPORT_SYMBOL (drm_dp_dpcd_set_powered); +/** * drm_dp_dpcd_read() - read a series of bytes from the DPCD * @aux: DisplayPort AUX channel (SST or MST)
@@ -1855,6 +1887,9 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,struct drm_dp_aux_msg msg;int err =0 ; +if (aux->powered_down) +return -EBUSY ; + dp_aux_i2c_transfer_size =clamp (dp_aux_i2c_transfer_size,1 ,DP_AUX_MAX_PAYLOAD_BYTES );memset (&msg,0 ,sizeof (msg));
drivers/gpu/drm/panel/panel-edp.c +3 -0
@@ -397,6 +397,7 @@ static int panel_edp_suspend(struct device *dev) {struct panel_edp *p =dev_get_drvdata (dev); +drm_dp_dpcd_set_powered (p->aux, false);gpiod_set_value_cansleep (p->enable_gpio,0 );regulator_disable (p->supply); p->unprepared_time =ktime_get ();
@@ -453,6 +454,7 @@ static int panel_edp_prepare_once(struct panel_edp *p) }gpiod_set_value_cansleep (p->enable_gpio,1 ); +drm_dp_dpcd_set_powered (p->aux, true); delay = p->desc->delay.hpd_reliable;if (p->no_hpd)
@@ -489,6 +491,7 @@ static int panel_edp_prepare_once(struct panel_edp *p)return 0 ; error: +drm_dp_dpcd_set_powered (p->aux, false);gpiod_set_value_cansleep (p->enable_gpio,0 );regulator_disable (p->supply); p->unprepared_time =ktime_get ();
drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +2 -0
@@ -72,6 +72,7 @@ static int atana33xc20_suspend(struct device *dev)if (p->el3_was_on)atana33xc20_wait (p->el_on3_off_time,150 ); +drm_dp_dpcd_set_powered (p->aux, false); ret =regulator_disable (p->supply);if (ret)return ret;
@@ -93,6 +94,7 @@ static int atana33xc20_resume(struct device *dev) ret =regulator_enable (p->supply);if (ret)return ret; +drm_dp_dpcd_set_powered (p->aux, true); p->powered_on_time =ktime_get_boottime ();if (p->no_hpd) {
include/drm/display/drm_dp_helper.h +6 -0
@@ -436,9 +436,15 @@ struct drm_dp_aux {* @is_remote: Is this AUX CH actually using sideband messaging. */ bool is_remote; + +/** +* @powered_down: If true then the remote endpoint is powered down. +*/ +bool powered_down; };int drm_dp_dpcd_probe (struct drm_dp_aux *aux,unsigned int offset); +void drm_dp_dpcd_set_powered (struct drm_dp_aux *aux,bool powered);ssize_t drm_dp_dpcd_read (struct drm_dp_aux *aux,unsigned int offset,void *buffer,size_t size); ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 195/473 drm/panel: atna33xc20: Fix unbalanced regulator in the case HPD doesnt assert
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 5e842d55bad7794823a50f24fd645b58f2ef93ab ]
When the atna33xc20 driver was first written the resume code never returned an error. If there was a problem waiting for HPD it just printed a warning and moved on. This changed in response to review feedback [1] on a future patch but I accidentally didn't account for rolling back the regulator enable in the error cases. Do so now.
[1] https://lore.kernel.org/all/[email protected]/
--- .../gpu/drm/panel/panel-samsung-atna33xc20.c | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +13 -9
@@ -109,19 +109,17 @@ static int atana33xc20_resume(struct device *dev)if (hpd_asserted <0 ) ret = hpd_asserted; -if (ret) +if (ret) {dev_warn (dev,"Error waiting for HPD GPIO: %d\n" , ret); - -return ret; - } - -if (p->aux->wait_hpd_asserted) { + goto error; + } + }else if (p->aux->wait_hpd_asserted) { ret = p->aux->wait_hpd_asserted (p->aux,HPD_MAX_US ); -if (ret) +if (ret) {dev_warn (dev,"Controller error waiting for HPD: %d\n" , ret); - -return ret; + goto error; + } }/*
@@ -133,6 +131,12 @@ static int atana33xc20_resume(struct device *dev)* right times. */ return 0 ; + +error: +drm_dp_dpcd_set_powered (p->aux, false); +regulator_disable (p->supply); + +return ret; }static int atana33xc20_disable (struct drm_panel *panel)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 196/473 drm/amd/display: Fix potential index out of bounds in color transformation function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 63ae548f1054a0b71678d0349c7dc9628ddd42ca ]
Fixes index out of bounds issue in the color transformation function. The issue could occur when the index 'i' exceeds the number of transfer function points (TRANSFER_FUNC_POINTS).
The fix adds a check to ensure 'i' is within bounds before accessing the transfer function points. If 'i' is out of bounds, an error message is logged and the function returns false to indicate an error.
Reported by smatch:drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:405 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.red' 1025 <= s32max drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:406 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.green' 1025 <= s32max drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:407 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.blue' 1025 <= s32max
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +5 -0
@@ -382,6 +382,11 @@ bool cm_helper_translate_curve_to_hw_format(struct dc_context *ctx, i += increment) {if (j == hw_points -1 )break ; +if (i >=TRANSFER_FUNC_POINTS ) { +DC_LOG_ERROR ("Index out of bounds: i=%d, TRANSFER_FUNC_POINTS=%d\n" , + i,TRANSFER_FUNC_POINTS ); +return false; + } rgb_resulted[j].red = output_tf->tf_pts.red[i]; rgb_resulted[j].green = output_tf->tf_pts.green[i]; rgb_resulted[j].blue = output_tf->tf_pts.blue[i];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 197/473 ASoC: Intel: Disable route checks for Skylake boards
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 0cb3b7fd530b8c107443218ce6db5cb6e7b5dbe1 ]
Topology files that are propagated to the world and utilized by the skylake-driver carry shortcomings in their SectionGraphs.
Since commit daa480bde6b3 ("ASoC: soc-core: tidyup for snd_soc_dapm_add_routes()") route checks are no longer permissive. Probe failures for Intel boards have been partially addressed by commit a22ae72b86a4 ("ASoC: soc-core: disable route checks for legacy devices") and its follow up but only skl_nau88l25_ssm4567.c is patched. Fix the problem for the rest of the boards.
--- sound/soc/intel/boards/bxt_da7219_max98357a.c | 1 + sound/soc/intel/boards/bxt_rt298.c | 1 + sound/soc/intel/boards/glk_rt5682_max98357a.c | 2 ++ sound/soc/intel/boards/kbl_da7219_max98357a.c | 1 + sound/soc/intel/boards/kbl_da7219_max98927.c | 4 ++++ sound/soc/intel/boards/kbl_rt5660.c | 1 + sound/soc/intel/boards/kbl_rt5663_max98927.c | 2 ++ sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 1 + sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 ++ sound/soc/intel/boards/skl_nau88l25_max98357a.c | 1 + sound/soc/intel/boards/skl_rt286.c | 1 + 11 files changed, 17 insertions(+)
sound/soc/intel/boards/bxt_da7219_max98357a.c +1 -0
@@ -762,6 +762,7 @@ static struct snd_soc_card broxton_audio_card = { .dapm_routes = audio_map, .num_dapm_routes = ARRAY_SIZE(audio_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = bxt_card_late_probe, };
sound/soc/intel/boards/bxt_rt298.c +1 -0
@@ -574,6 +574,7 @@ static struct snd_soc_card broxton_rt298 = { .dapm_routes = broxton_rt298_map, .num_dapm_routes = ARRAY_SIZE(broxton_rt298_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = bxt_card_late_probe, };
sound/soc/intel/boards/glk_rt5682_max98357a.c +2 -0
@@ -649,6 +649,8 @@ static int geminilake_audio_probe(struct platform_device *pdev) card = &glk_audio_card_rt5682_m98357a; card->dev = &pdev->dev;snd_soc_card_set_drvdata (card, ctx); +if (!snd_soc_acpi_sof_parent (&pdev->dev)) + card->disable_route_checks = true;/* override platform name, if required */ mach = pdev->dev.platform_data;
sound/soc/intel/boards/kbl_da7219_max98357a.c +1 -0
@@ -633,6 +633,7 @@ static struct snd_soc_card kabylake_audio_card_da7219_m98357a = { .dapm_routes = kabylake_map, .num_dapm_routes = ARRAY_SIZE(kabylake_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_da7219_max98927.c +4 -0
@@ -1030,6 +1030,7 @@ static struct snd_soc_card kbl_audio_card_da7219_m98927 = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -1048,6 +1049,7 @@ static struct snd_soc_card kbl_audio_card_max98927 = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -1065,6 +1067,7 @@ static struct snd_soc_card kbl_audio_card_da7219_m98373 = { .codec_conf = max98373_codec_conf, .num_configs = ARRAY_SIZE(max98373_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -1082,6 +1085,7 @@ static struct snd_soc_card kbl_audio_card_max98373 = { .codec_conf = max98373_codec_conf, .num_configs = ARRAY_SIZE(max98373_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_rt5660.c +1 -0
@@ -518,6 +518,7 @@ static struct snd_soc_card kabylake_audio_card_rt5660 = { .dapm_routes = kabylake_rt5660_map, .num_dapm_routes = ARRAY_SIZE(kabylake_rt5660_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_rt5663_max98927.c +2 -0
@@ -966,6 +966,7 @@ static struct snd_soc_card kabylake_audio_card_rt5663_m98927 = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -982,6 +983,7 @@ static struct snd_soc_card kabylake_audio_card_rt5663 = { .dapm_routes = kabylake_5663_map, .num_dapm_routes = ARRAY_SIZE(kabylake_5663_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +1 -0
@@ -791,6 +791,7 @@ static struct snd_soc_card kabylake_audio_card = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/skl_hda_dsp_generic.c +2 -0
@@ -231,6 +231,8 @@ static int skl_hda_audio_probe(struct platform_device *pdev) ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; hda_soc_card.dev = &pdev->dev; +if (!snd_soc_acpi_sof_parent (&pdev->dev)) + hda_soc_card.disable_route_checks = true;if (mach->mach_params.dmic_num >0 ) { snprintf(hda_soc_components, sizeof(hda_soc_components),
sound/soc/intel/boards/skl_nau88l25_max98357a.c +1 -0
@@ -654,6 +654,7 @@ static struct snd_soc_card skylake_audio_card = { .dapm_routes = skylake_map, .num_dapm_routes = ARRAY_SIZE(skylake_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = skylake_card_late_probe, };
sound/soc/intel/boards/skl_rt286.c +1 -0
@@ -523,6 +523,7 @@ static struct snd_soc_card skylake_rt286 = { .dapm_routes = skylake_rt286_map, .num_dapm_routes = ARRAY_SIZE(skylake_rt286_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = skylake_card_late_probe, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 198/473 ASoC: Intel: avs: ssm4567: Do not ignore route checks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit e6719d48ba6329536c459dcee5a571e535687094 ]
A copy-paste from intel/boards/skl_nau88l25_ssm4567.c made the avs's equivalent disable route checks as well. Such behavior is not desired.
--- sound/soc/intel/avs/boards/ssm4567.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/intel/avs/boards/ssm4567.c +0 -1
@@ -217,7 +217,6 @@ static int avs_ssm4567_probe(struct platform_device *pdev) card->dapm_routes = routes; card->num_dapm_routes = num_routes; card->fully_routed = true; - card->disable_route_checks = true; ret =snd_soc_fixup_dai_links_platform_name (card, pname);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 199/473 mtd: core: Report error if first mtd_otp_size() call fails in mtd_otp_nvmem_add()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aapo Vienamo <[email protected]>
[ Upstream commit d44f0bbbd8d182debcce88bda55b05269f3d33d6 ]
Jump to the error reporting code in mtd_otp_nvmem_add() if the mtd_otp_size() call fails. Without this fix, the error is not logged.
--- drivers/mtd/mtdcore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/mtdcore.c +4 -2
@@ -942,8 +942,10 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)if (mtd->_get_user_prot_info && mtd->_read_user_prot_reg) { size =mtd_otp_size (mtd, true); -if (size <0 ) -return size; +if (size <0 ) { + err = size; + goto err; + }if (size >0 ) { nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 200/473 mtd: rawnand: hynix: fixed typo
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Korotkov <[email protected]>
[ Upstream commit 6819db94e1cd3ce24a432f3616cd563ed0c4eaba ]
The function hynix_nand_rr_init() should probably return an error code. Judging by the usage, it seems that the return code is passed up the call stack.
Right now, it always returns 0 and the function hynix_nand_cleanup() in hynix_nand_init() has never been called.
Found by RASU JSC and Linux Verification Center (linuxtesting.org)
--- drivers/mtd/nand/raw/nand_hynix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/nand_hynix.c +1 -1
@@ -402,7 +402,7 @@ static int hynix_nand_rr_init(struct nand_chip *chip)if (ret)pr_warn ("failed to initialize read-retry infrastructure" ); -return 0 ; +return ret; } static void hynix_nand_extract_oobsize(struct nand_chip *chip,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 201/473 fbdev: shmobile: fix snprintf truncation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 26c8cfb9d1e4b252336d23dd5127a8cbed414a32 ]
The name of the overlay does not fit into the fixed-length field:
drivers/video/fbdev/sh_mobile_lcdcfb.c:1577:2: error: 'snprintf' will always be truncated; specified size is 16, but format string expands to at least 25
Make it short enough by changing the string.
--- drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sh_mobile_lcdcfb.c +1 -1
@@ -1576,7 +1576,7 @@ sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)*/ info->fix = sh_mobile_lcdc_overlay_fix;snprintf (info->fix.id,sizeof (info->fix.id), -"SH Mobile LCDC Overlay %u" , ovl->index); +"SHMobile ovl %u" , ovl->index); info->fix.smem_start = ovl->dma_handle; info->fix.smem_len = ovl->fb_size; info->fix.line_length = ovl->pitch;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 202/473 ASoC: kirkwood: Fix potential NULL dereference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit ea60ab95723f5738e7737b56dda95e6feefa5b50 ]
In kirkwood_dma_hw_params() mv_mbus_dram_info() returns NULL if CONFIG_PLAT_ORION macro is not defined.
Fix this bug by adding NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/soc/kirkwood/kirkwood-dma.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/kirkwood/kirkwood-dma.c +3 -0
@@ -182,6 +182,9 @@ static int kirkwood_dma_hw_params(struct snd_soc_component *component,const struct mbus_dram_target_info *dram =mv_mbus_dram_info ();unsigned long addr = substream->runtime->dma_addr; +if (!dram) +return 0 ; +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK )kirkwood_dma_conf_mbus_windows (priv->io,KIRKWOOD_PLAYBACK_WIN , addr, dram);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 203/473 drm/meson: vclk: fix calculation of 59.94 fractional rates
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Hewitt <[email protected]>
[ Upstream commit bfbc68e4d8695497f858a45a142665e22a512ea3 ]
Playing 4K media with 59.94 fractional rate (typically VP9) causes the screen to lose sync with the following error reported in the system log:
[ 89.610280] Fatal Error, invalid HDMI vclk freq 593406
Modetest shows the following:
3840x2160 59.94 3840 4016 4104 4400 2160 2168 2178 2250 593407 flags: xxxx, xxxx, drm calculated value -------------------------------------^
Change the fractional rate calculation to stop DIV_ROUND_CLOSEST rounding down which results in vclk freq failing to match correctly.
--- drivers/gpu/drm/meson/meson_vclk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/meson/meson_vclk.c +3 -3
@@ -790,13 +790,13 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq, FREQ_1000_1001(params[i].pixel_freq));DRM_DEBUG_DRIVER ("i = %d phy_freq = %d alt = %d\n" , i, params[i].phy_freq, -FREQ_1000_1001 (params[i].phy_freq/10 )*10 ); +FREQ_1000_1001 (params[i].phy_freq/1000 )*1000 );/* Match strict frequency */ if (phy_freq == params[i].phy_freq && vclk_freq == params[i].vclk_freq)return MODE_OK ;/* Match 1000/1001 variant */ -if (phy_freq == (FREQ_1000_1001 (params[i].phy_freq/10 )*10 ) && +if (phy_freq == (FREQ_1000_1001 (params[i].phy_freq/1000 )*1000 ) && vclk_freq ==FREQ_1000_1001 (params[i].vclk_freq))return MODE_OK ; }
@@ -1070,7 +1070,7 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,for (freq =0 ; params[freq].pixel_freq ; ++freq) {if ((phy_freq == params[freq].phy_freq || - phy_freq ==FREQ_1000_1001 (params[freq].phy_freq/10 )*10 ) && + phy_freq ==FREQ_1000_1001 (params[freq].phy_freq/1000 )*1000 ) && (vclk_freq == params[freq].vclk_freq || vclk_freq ==FREQ_1000_1001 (params[freq].vclk_freq))) {if (vclk_freq != params[freq].vclk_freq)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 204/473 drm/mediatek: Add 0 size check to mtk_drm_gem_obj
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Green <[email protected]>
[ Upstream commit 1e4350095e8ab2577ee05f8c3b044e661b5af9a0 ]
Add a check to mtk_drm_gem_init if we attempt to allocate a GEM object of 0 bytes. Currently, no such check exists and the kernel will panic if a userspace application attempts to allocate a 0x0 GBM buffer.
Tested by attempting to allocate a 0x0 GBM buffer on an MT8188 and verifying that we now return EINVAL.
--- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +3 -0
@@ -33,6 +33,9 @@ static struct mtk_drm_gem_obj *mtk_drm_gem_init(struct drm_device *dev, size =round_up (size,PAGE_SIZE ); +if (size ==0 ) +return ERR_PTR (-EINVAL ); + mtk_gem_obj =kzalloc (sizeof (*mtk_gem_obj),GFP_KERNEL );if (!mtk_gem_obj)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 205/473 powerpc/fsl-soc: hide unused const variable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 01acaf3aa75e1641442cc23d8fe0a7bb4226efb1 ]
vmpic_msi_feature is only used conditionally, which triggers a rare -Werror=unused-const-variable= warning with gcc:
arch/powerpc/sysdev/fsl_msi.c:567:37: error: 'vmpic_msi_feature' defined but not used [-Werror=unused-const-variable=]
567 | static const struct fsl_msi_feature vmpic_msi_feature =
Hide this one in the same #ifdef as the reference so we can turn on the warning by default.
--- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/sysdev/fsl_msi.c +2 -0
@@ -567,10 +567,12 @@ static const struct fsl_msi_feature ipic_msi_feature = { .msiir_offset = 0x38, }; +#ifdef CONFIG_EPAPR_PARAVIRT static const struct fsl_msi_feature vmpic_msi_feature = { .fsl_pic_ip =FSL_PIC_IP_VMPIC , .msiir_offset =0 , }; +#endif static const struct of_device_id fsl_of_msi_ids[] = { {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 206/473 fbdev: sisfb: hide unused variables
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 688cf598665851b9e8cb5083ff1d208ce43d10ff ]
Building with W=1 shows that a couple of variables in this driver are only used in certain configurations:
drivers/video/fbdev/sis/init301.c:239:28: error: 'SiS_Part2CLVX_6' defined but not used [-Werror=unused-const-variable=]
239 | static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:230:28: error: 'SiS_Part2CLVX_5' defined but not used [-Werror=unused-const-variable=]
230 | static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:211:28: error: 'SiS_Part2CLVX_4' defined but not used [-Werror=unused-const-variable=]
211 | static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:192:28: error: 'SiS_Part2CLVX_3' defined but not used [-Werror=unused-const-variable=]
192 | static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:184:28: error: 'SiS_Part2CLVX_2' defined but not used [-Werror=unused-const-variable=]
184 | static const unsigned char SiS_Part2CLVX_2[] = {
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:176:28: error: 'SiS_Part2CLVX_1' defined but not used [-Werror=unused-const-variable=]
176 | static const unsigned char SiS_Part2CLVX_1[] = {
| ^~~~~~~~~~~~~~~This started showing up after the definitions were moved into the source file from the header, which was not flagged by the compiler. Move the definition into the appropriate #ifdef block that already exists next to them.
--- drivers/video/fbdev/sis/init301.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/sis/init301.c +1 -2
@@ -172,7 +172,7 @@ static const unsigned char SiS_HiTVGroup3_2[] = { };/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */ - +#ifdef CONFIG_FB_SIS_315 static const unsigned char SiS_Part2CLVX_1[] = {0x00 ,0x00 , 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
@@ -245,7 +245,6 @@ static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */ 0xFF,0xFF, }; -#ifdef CONFIG_FB_SIS_315 /* 661 et al LCD data structure (2.03.00) */ static const unsigned char SiS_LCDStruct661[] = {/* 1024x768 */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 207/473 ASoC: Intel: avs: Fix ASRC module initialization
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 9d2e26f31c7cc3fa495c423af9b4902ec0dc7be3 ]
The ASRC module configuration consists of several reserved fields. Zero them out when initializing the module to avoid sending invalid data.
--- sound/soc/intel/avs/path.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/avs/path.c +1 -0
@@ -308,6 +308,7 @@ static int avs_asrc_create(struct avs_dev *adev, struct avs_path_module *mod)struct avs_tplg_module *t = mod->template;struct avs_asrc_cfg cfg; +memset (&cfg,0 ,sizeof (cfg)); cfg.base.cpc = t->cfg_base->cpc; cfg.base.ibs = t->cfg_base->ibs; cfg.base.obs = t->cfg_base->obs;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 208/473 ASoC: Intel: avs: Fix potential integer overflow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit c7e832cabe635df47c2bf6df7801e97bf3045b1e ]
While stream_tag for CLDMA on SKL-based platforms is always 1, function hda_cldma_setup() uses AZX_SD_CTL_STRM() macro which does:
stream_tag << 20
what combined with stream_tag type of 'unsigned int' generates a potential overflow issue. Update the field type to fix that.
--- sound/soc/intel/avs/cldma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/cldma.c +1 -1
@@ -35,7 +35,7 @@ struct hda_cldma {unsigned int buffer_size;unsigned int num_periods; -unsigned int stream_tag; +unsigned char stream_tag;void __iomem *sd_addr;struct snd_dma_buffer dmab_data;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 209/473 media: ngene: Add dvb_ca_en50221_init return value check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Burakov <[email protected]>
[ Upstream commit 9bb1fd7eddcab2d28cfc11eb20f1029154dac718 ]
The return value of dvb_ca_en50221_init() is not checked here that may cause undefined behavior in case of nonzero value return.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/pci/ngene/ngene-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/pci/ngene/ngene-core.c +3 -1
@@ -1488,7 +1488,9 @@ static int init_channel(struct ngene_channel *chan) }if (dev->ci.en && (io &NGENE_IO_TSOUT )) { -dvb_ca_en50221_init (adapter, dev->ci.en,0 ,1 ); + ret =dvb_ca_en50221_init (adapter, dev->ci.en,0 ,1 ); +if (ret !=0 ) + goto err;set_transfer (chan,1 ); chan->dev->channel[2 ].DataFormatFlags =DF_SWAP32 ;set_transfer (&chan->dev->channel[2 ],1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 210/473 media: rcar-vin: work around -Wenum-compare-conditional warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 1a742c6010d136cb6c441a0f1dd2bfbfae3c4df2 ]
clang-19 warns about mixing two enum types here:
drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional] drivers/media/platform/renesas/rcar-vin/rcar-core.c:216:18: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional] drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional] drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
This one is intentional, and there is already a cast to work around another warning, so address this by adding another cast.
--- drivers/media/platform/renesas/rcar-vin/rcar-vin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/renesas/rcar-vin/rcar-vin.h +1 -1
@@ -58,7 +58,7 @@ enum rvin_isp_id {#define RVIN_REMOTES_MAX \ (((unsigned int)RVIN_CSI_MAX) > ((unsigned int)RVIN_ISP_MAX) ? \ - RVIN_CSI_MAX : RVIN_ISP_MAX) + (unsigned int)RVIN_CSI_MAX : (unsigned int)RVIN_ISP_MAX)/** * enum rvin_dma_state - DMA states
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 211/473 media: radio-shark2: Avoid led_names truncations
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 1820e16a3019b6258e6009d34432946a6ddd0a90 ]
Increase the size of led_names so it can fit any valid v4l2 device name.
Fixes:drivers/media/radio/radio-shark2.c:197:17: warning: ‘%s’ directive output may be truncated writing up to 35 bytes into a region of size 32 [-Wformat-truncation=]
--- drivers/media/radio/radio-shark2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/radio-shark2.c +1 -1
@@ -62,7 +62,7 @@ struct shark_device {#ifdef SHARK_USE_LEDS struct work_struct led_work;struct led_classdev leds[NO_LEDS ]; -char led_names[NO_LEDS ][32 ]; +char led_names[NO_LEDS ][64 ];atomic_t brightness[NO_LEDS ];unsigned long brightness_new;#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 212/473 drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit 935a92a1c400285545198ca2800a4c6c519c650a ]
In cdns_mhdp_atomic_enable(), the return value of drm_mode_duplicate() is assigned to mhdp_state->current_mode, and there is a dereference of it in drm_mode_set_name(), which will lead to a NULL pointer dereference on failure of drm_mode_duplicate().
Fix this bug add a check of mhdp_state->current_mode.
--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3 -0
@@ -2042,6 +2042,9 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge, mhdp_state =to_cdns_mhdp_bridge_state (new_state); mhdp_state->current_mode =drm_mode_duplicate (bridge->dev, mode); +if (!mhdp_state->current_mode) +return ; +drm_mode_set_name (mhdp_state->current_mode);dev_dbg (mhdp->dev,"%s: Enabling mode %s\n" , __func__, mode->name);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 213/473 platform/x86: xiaomi-wmi: Fix race condition when reporting key events
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 290680c2da8061e410bcaec4b21584ed951479af ]
Multiple WMI events can be received concurrently, so multiple instances of xiaomi_wmi_notify() can be active at the same time. Since the input device is shared between those handlers, the key input sequence can be disturbed.
Fix this by protecting the key input sequence with a mutex.
Compile-tested only.
--- drivers/platform/x86/xiaomi-wmi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/platform/x86/xiaomi-wmi.c +18 -0
@@ -2,8 +2,10 @@/* WMI driver for Xiaomi Laptops */ #include <linux/acpi.h> +#include <linux/device.h> #include <linux/input.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/wmi.h> #include <uapi/linux/input-event-codes.h>
@@ -20,12 +22,21 @@struct xiaomi_wmi {struct input_dev *input_dev; +struct mutex key_lock;/* Protects the key event sequence */ unsigned int key_code; }; +static void xiaomi_mutex_destroy (void *data) +{ +struct mutex *lock = data; + +mutex_destroy (lock); +} +static int xiaomi_wmi_probe (struct wmi_device *wdev,const void *context) {struct xiaomi_wmi *data; +int ret;if (wdev ==NULL || context ==NULL )return -EINVAL ;
@@ -35,6 +46,11 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)return -ENOMEM ;dev_set_drvdata (&wdev->dev, data); +mutex_init (&data->key_lock); + ret =devm_add_action_or_reset (&wdev->dev, xiaomi_mutex_destroy, &data->key_lock); +if (ret <0 ) +return ret; + data->input_dev =devm_input_allocate_device (&wdev->dev);if (data->input_dev ==NULL )return -ENOMEM ;
@@ -59,10 +75,12 @@ static void xiaomi_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)if (data ==NULL )return ; +mutex_lock (&data->key_lock);input_report_key (data->input_dev, data->key_code,1 );input_sync (data->input_dev);input_report_key (data->input_dev, data->key_code,0 );input_sync (data->input_dev); +mutex_unlock (&data->key_lock); }static const struct wmi_device_id xiaomi_wmi_id_table[] = {
Signature · 1 line
2.43.0
Re: [PATCH 6.1 213/473] platform/x86: xiaomi-wmi: Fix race condition when reporting key events
Am 06.06.24 um 16:02 schrieb Greg Kroah-Hartman:
Quoted 3 lines
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
Hi,
i already said that the underlying race condition can only be triggered since commit e2ffcda16290 ("ACPI: OSL: Allow Notify () handlers to run on all CPUs"), which afaik was introduced with kernel 6.8.
Because of this, i do not think that we have to backport this commit to kernels before 6.8.
Thanks,
Armin Wolf
Quoted 87 lines
From: Armin Wolf <[email protected]>
[ Upstream commit
290680c2da8061e410bcaec4b21584ed951479af]Multiple WMI events can be received concurrently, so multiple instances of
xiaomi_wmi_notify()can be active at the same time. Since the input device is shared between those handlers, the key input sequence can be disturbed.Fix this by protecting the key input sequence with a mutex.
Compile-tested only.
Fixes edb73f4f0247 ("platform/x86: wmi: add Xiaomi WMI key driver")Signed-off-by Armin Wolf <[email protected]>Reviewed-by Kuppuswamy Sathyanarayanan <[email protected]>Reviewed-by Hans de Goede <[email protected]>Signed-off-by Hans de Goede <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/platform/x86/xiaomi-wmi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/platform/x86/xiaomi-wmi.c +18
-0@@ -2,8 +2,10 @@/* WMI driver for Xiaomi Laptops */ #include <linux/acpi.h> +#include <linux/device.h> #include <linux/input.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/wmi.h> #include <uapi/linux/input-event-codes.h> @@ -20,12 +22,21 @@struct xiaomi_wmi {struct input_dev *input_dev; +struct mutex key_lock;/* Protects the key event sequence */ unsigned int key_code; }; +static void xiaomi_mutex_destroy (void *data) +{ +struct mutex *lock = data; + +mutex_destroy (lock); +} +static int xiaomi_wmi_probe (struct wmi_device *wdev,const void *context) {struct xiaomi_wmi *data; +int ret;if (wdev ==NULL || context ==NULL )return -EINVAL ;@@ -35,6 +46,11 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)return -ENOMEM ;dev_set_drvdata (&wdev->dev, data); +mutex_init (&data->key_lock); + ret =devm_add_action_or_reset (&wdev->dev, xiaomi_mutex_destroy, &data->key_lock); +if (ret <0 ) +return ret; + data->input_dev =devm_input_allocate_device (&wdev->dev);if (data->input_dev ==NULL )return -ENOMEM ;@@ -59,10 +75,12 @@ static void xiaomi_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)if (data ==NULL )return ; +mutex_lock (&data->key_lock);input_report_key (data->input_dev, data->key_code,1 );input_sync (data->input_dev);input_report_key (data->input_dev, data->key_code,0 );input_sync (data->input_dev); +mutex_unlock (&data->key_lock); }static const struct wmi_device_id xiaomi_wmi_id_table[] = {
Greg Kroah-Hartman
maintainerPATCH 214/473 drm/msm/dp: allow voltage swing / pre emphasis of 3
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 22578178e5dd6d3aa4490879df8b6c2977d980be ]
Both dp_link_adjust_levels() and dp_ctrl_update_vx_px() limit swing and pre-emphasis to 2, while the real maximum value for the sum of the voltage swing and pre-emphasis is 3. Fix the DP code to remove this limitation.
Patchwork: https://patchwork.freedesktop.org/patch/577006/
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 6 +++--- drivers/gpu/drm/msm/dp/dp_link.c | 22 +++++++++++----------- drivers/gpu/drm/msm/dp/dp_link.h | 14 +------------- 3 files changed, 15 insertions(+), 27 deletions(-)
drivers/gpu/drm/msm/dp/dp_ctrl.c +3 -3
@@ -1014,14 +1014,14 @@ static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl)if (ret)return ret; -if (voltage_swing_level >=DP_TRAIN_VOLTAGE_SWING_MAX ) { +if (voltage_swing_level >=DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (ctrl->drm_dev,"max. voltage swing level reached %d\n" , voltage_swing_level); max_level_reached |=DP_TRAIN_MAX_SWING_REACHED ; } -if (pre_emphasis_level >=DP_TRAIN_PRE_EMPHASIS_MAX ) { +if (pre_emphasis_level >=DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (ctrl->drm_dev,"max. pre-emphasis level reached %d\n" , pre_emphasis_level);
@@ -1112,7 +1112,7 @@ static int dp_ctrl_link_train_1(struct dp_ctrl_private *ctrl, }if (ctrl->link->phy_params.v_level >= -DP_TRAIN_VOLTAGE_SWING_MAX ) { +DP_TRAIN_LEVEL_MAX ) {DRM_ERROR_RATELIMITED ("max v_level reached\n" );return -EAGAIN ; }
drivers/gpu/drm/msm/dp/dp_link.c +11 -11
@@ -1102,6 +1102,7 @@ int dp_link_get_colorimetry_config(struct dp_link *dp_link)int dp_link_adjust_levels (struct dp_link *dp_link,u8 *link_status) {int i; +u8 max_p_level;int v_max =0 , p_max =0 ;struct dp_link_private *link;
@@ -1133,30 +1134,29 @@ int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status)* Adjust the voltage swing and pre-emphasis level combination to within * the allowable range. */ -if (dp_link->phy_params.v_level >DP_TRAIN_VOLTAGE_SWING_MAX ) { +if (dp_link->phy_params.v_level >DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (link->drm_dev,"Requested vSwingLevel=%d, change to %d\n" , dp_link->phy_params.v_level, -DP_TRAIN_VOLTAGE_SWING_MAX ); - dp_link->phy_params.v_level =DP_TRAIN_VOLTAGE_SWING_MAX ; +DP_TRAIN_LEVEL_MAX ); + dp_link->phy_params.v_level =DP_TRAIN_LEVEL_MAX ; } -if (dp_link->phy_params.p_level >DP_TRAIN_PRE_EMPHASIS_MAX ) { +if (dp_link->phy_params.p_level >DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (link->drm_dev,"Requested preEmphasisLevel=%d, change to %d\n" , dp_link->phy_params.p_level, -DP_TRAIN_PRE_EMPHASIS_MAX ); - dp_link->phy_params.p_level =DP_TRAIN_PRE_EMPHASIS_MAX ; +DP_TRAIN_LEVEL_MAX ); + dp_link->phy_params.p_level =DP_TRAIN_LEVEL_MAX ; } -if ((dp_link->phy_params.p_level >DP_TRAIN_PRE_EMPHASIS_LVL_1 ) - && (dp_link->phy_params.v_level == -DP_TRAIN_VOLTAGE_SWING_LVL_2 )) { + max_p_level =DP_TRAIN_LEVEL_MAX - dp_link->phy_params.v_level; +if (dp_link->phy_params.p_level > max_p_level) {drm_dbg_dp (link->drm_dev,"Requested preEmphasisLevel=%d, change to %d\n" , dp_link->phy_params.p_level, -DP_TRAIN_PRE_EMPHASIS_LVL_1 ); - dp_link->phy_params.p_level =DP_TRAIN_PRE_EMPHASIS_LVL_1 ; + max_p_level); + dp_link->phy_params.p_level = max_p_level; } drm_dbg_dp(link->drm_dev, "adjusted: v_level=%d, p_level=%d\n",
drivers/gpu/drm/msm/dp/dp_link.h +1 -13
@@ -19,19 +19,7 @@ struct dp_link_info {unsigned long capabilities; }; -enum dp_link_voltage_level { -DP_TRAIN_VOLTAGE_SWING_LVL_0 =0 , -DP_TRAIN_VOLTAGE_SWING_LVL_1 =1 , -DP_TRAIN_VOLTAGE_SWING_LVL_2 =2 , -DP_TRAIN_VOLTAGE_SWING_MAX =DP_TRAIN_VOLTAGE_SWING_LVL_2 , -}; - -enum dp_link_preemaphasis_level { -DP_TRAIN_PRE_EMPHASIS_LVL_0 =0 , -DP_TRAIN_PRE_EMPHASIS_LVL_1 =1 , -DP_TRAIN_PRE_EMPHASIS_LVL_2 =2 , -DP_TRAIN_PRE_EMPHASIS_MAX =DP_TRAIN_PRE_EMPHASIS_LVL_2 , -}; +#define DP_TRAIN_LEVEL_MAX 3struct dp_link_test_video {u32 test_video_pattern;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 215/473 drm/msm/dp: Return IRQ_NONE for unhandled interrupts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit bfc12020e63d017ea8f85cda9c39cbd1314ecd77 ]
If our interrupt handler gets called and we don't really handle the interrupt then we should return IRQ_NONE. The current interrupt handler didn't do this, so let's fix it.
NOTE: for some of the cases it's clear that we should return IRQ_NONE and some cases it's clear that we should return IRQ_HANDLED. However, there are a few that fall somewhere in between. Specifically, the documentation for when to return IRQ_NONE vs. IRQ_HANDLED is probably best spelled out in the commit message of commit d9e4ad5badf4 ("Document that IRQ_NONE should be returned when IRQ not actually handled"). That commit makes it clear that we should return IRQ_HANDLED if we've done something to make the interrupt stop happening.
The case where it's unclear is, for instance, in dp_aux_isr() after we've read the interrupt using dp_catalog_aux_get_irq() and confirmed that "isr" is non-zero. The function dp_catalog_aux_get_irq() not only reads the interrupts but it also "ack"s all the interrupts that are returned. For an "unknown" interrupt this has a very good chance of actually stopping the interrupt from happening. That would mean we've identified that it's our device and done something to stop them from happening and should return IRQ_HANDLED. Specifically, it should be noted that most interrupts that need "ack"ing are ones that are one-time events and doing an "ack" is enough to clear them. However, since these interrupts are unknown then, by definition, it's unknown if "ack"ing them is truly enough to clear them. It's possible that we also need to remove the original source of the interrupt. In this case, IRQ_NONE would be a better choice.
Given that returning an occasional IRQ_NONE isn't the absolute end of the world, however, let's choose that course of action. The IRQ framework will forgive a few IRQ_NONE returns now and again (and it won't even log them, which is why we have to log them ourselves). This means that if we _do_ end hitting an interrupt where "ack"ing isn't enough the kernel will eventually detect the problem and shut our device down.
Patchwork: https://patchwork.freedesktop.org/patch/520660/
Stable-dep-of: 5d1a7493343c ("drm/msm/dp: Avoid a long timeout for AUX transfer if nothing connected")
--- drivers/gpu/drm/msm/dp/dp_aux.c | 12 +++++++----- drivers/gpu/drm/msm/dp/dp_aux.h | 2 +- drivers/gpu/drm/msm/dp/dp_ctrl.c | 10 ++++++++-- drivers/gpu/drm/msm/dp/dp_ctrl.h | 2 +- drivers/gpu/drm/msm/dp/dp_display.c | 8 +++++--- 5 files changed, 22 insertions(+), 12 deletions(-)
drivers/gpu/drm/msm/dp/dp_aux.c +7 -5
@@ -368,14 +368,14 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux,return ret; } -void dp_aux_isr (struct drm_dp_aux *dp_aux) +irqreturn_t dp_aux_isr (struct drm_dp_aux *dp_aux) {u32 isr;struct dp_aux_private *aux;if (!dp_aux) {DRM_ERROR ("invalid input\n" ); -return ; +return IRQ_NONE ; } aux = container_of(dp_aux, struct dp_aux_private, dp_aux);
@@ -384,11 +384,11 @@ void dp_aux_isr(struct drm_dp_aux *dp_aux)/* no interrupts pending, return immediately */ if (!isr) -return ; +return IRQ_NONE ;if (!aux->cmd_busy) {DRM_ERROR ("Unexpected DP AUX IRQ %#010x when not busy\n" , isr); -return ; +return IRQ_NONE ; }/*
@@ -420,10 +420,12 @@ void dp_aux_isr(struct drm_dp_aux *dp_aux) aux->aux_error_num =DP_AUX_ERR_NONE ; }else {DRM_WARN ("Unexpected interrupt: %#010x\n" , isr); -return ; +return IRQ_NONE ; }complete (&aux->comp); + +return IRQ_HANDLED ; }void dp_aux_reconfig (struct drm_dp_aux *dp_aux)
drivers/gpu/drm/msm/dp/dp_aux.h +1 -1
@@ -11,7 +11,7 @@int dp_aux_register (struct drm_dp_aux *dp_aux);void dp_aux_unregister (struct drm_dp_aux *dp_aux); -void dp_aux_isr (struct drm_dp_aux *dp_aux); +irqreturn_t dp_aux_isr (struct drm_dp_aux *dp_aux);void dp_aux_init (struct drm_dp_aux *dp_aux);void dp_aux_deinit (struct drm_dp_aux *dp_aux);void dp_aux_reconfig (struct drm_dp_aux *dp_aux);
drivers/gpu/drm/msm/dp/dp_ctrl.c +8 -2
@@ -1973,27 +1973,33 @@ int dp_ctrl_off(struct dp_ctrl *dp_ctrl)return ret; } -void dp_ctrl_isr (struct dp_ctrl *dp_ctrl) +irqreturn_t dp_ctrl_isr (struct dp_ctrl *dp_ctrl) {struct dp_ctrl_private *ctrl;u32 isr; +irqreturn_t ret =IRQ_NONE ;if (!dp_ctrl) -return ; +return IRQ_NONE ; ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); isr =dp_catalog_ctrl_get_interrupt (ctrl->catalog); +if (isr &DP_CTRL_INTR_READY_FOR_VIDEO ) {drm_dbg_dp (ctrl->drm_dev,"dp_video_ready\n" );complete (&ctrl->video_comp); + ret =IRQ_HANDLED ; }if (isr &DP_CTRL_INTR_IDLE_PATTERN_SENT ) {drm_dbg_dp (ctrl->drm_dev,"idle_patterns_sent\n" );complete (&ctrl->idle_comp); + ret =IRQ_HANDLED ; } + +return ret; } struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link,
drivers/gpu/drm/msm/dp/dp_ctrl.h +1 -1
@@ -25,7 +25,7 @@ int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl);int dp_ctrl_off_link (struct dp_ctrl *dp_ctrl);int dp_ctrl_off (struct dp_ctrl *dp_ctrl);void dp_ctrl_push_idle (struct dp_ctrl *dp_ctrl); -void dp_ctrl_isr (struct dp_ctrl *dp_ctrl); +irqreturn_t dp_ctrl_isr (struct dp_ctrl *dp_ctrl);void dp_ctrl_handle_sink_request (struct dp_ctrl *dp_ctrl); struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, struct dp_panel *panel, struct drm_dp_aux *aux,
drivers/gpu/drm/msm/dp/dp_display.c +5 -3
@@ -1193,7 +1193,7 @@ static int dp_hpd_event_thread_start(struct dp_display_private *dp_priv)static irqreturn_t dp_display_irq_handler (int irq,void *dev_id) {struct dp_display_private *dp = dev_id; -irqreturn_t ret =IRQ_HANDLED ; +irqreturn_t ret =IRQ_NONE ;u32 hpd_isr_status;if (!dp) {
@@ -1221,13 +1221,15 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id)if (hpd_isr_status &DP_DP_HPD_UNPLUG_INT_MASK )dp_add_event (dp,EV_HPD_UNPLUG_INT ,0 ,0 ); + + ret =IRQ_HANDLED ; }/* DP controller isr */ -dp_ctrl_isr (dp->ctrl); + ret |=dp_ctrl_isr (dp->ctrl);/* DP aux isr */ -dp_aux_isr (dp->aux); + ret |=dp_aux_isr (dp->aux);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 216/473 drm/msm/dp: Avoid a long timeout for AUX transfer if nothing connected
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 5d1a7493343cc00d9019880b686e4e0a0f649531 ]
As documented in the description of the transfer() function of "struct drm_dp_aux", the transfer() function can be called at any time regardless of the state of the DP port. Specifically if the kernel has the DP AUX character device enabled and userspace accesses "/dev/drm_dp_auxN" directly then the AUX transfer function will be called regardless of whether a DP device is connected.
For eDP panels we have a special rule where we wait (with a 5 second timeout) for HPD to go high. This rule was important before all panels drivers were converted to call wait_hpd_asserted() and actually can be removed in a future commit.
For external DP devices we never checked for HPD. That means that trying to access the DP AUX character device (AKA hexdump -C /dev/drm_dp_auxN) would very, very slowly timeout. Specifically on my system:
$ time hexdump -C /dev/drm_dp_aux0 hexdump: /dev/drm_dp_aux0: Connection timed out real 0m8.200s We want access to the drm_dp_auxN character device to fail faster than 8 seconds when no DP cable is plugged in.
Let's add a test to make transfers fail right away if a device isn't plugged in. Rather than testing the HPD line directly, we have the dp_display module tell us when AUX transfers should be enabled so we can handle cases where HPD is signaled out of band like with Type C.
Patchwork: https://patchwork.freedesktop.org/patch/583127/
--- drivers/gpu/drm/msm/dp/dp_aux.c | 20 ++++++++++++++++++++ drivers/gpu/drm/msm/dp/dp_aux.h | 1 + drivers/gpu/drm/msm/dp/dp_display.c | 4 ++++ 3 files changed, 25 insertions(+)
drivers/gpu/drm/msm/dp/dp_aux.c +20 -0
@@ -35,6 +35,7 @@ struct dp_aux_private {bool no_send_stop;bool initted;bool is_edp; +bool enable_xfers;u32 offset;u32 segment;
@@ -297,6 +298,17 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, goto exit; } +/* +* If we're using DP and an external display isn't connected then the +* transfer won't succeed. Return right away. If we don't do this we +* can end up with long timeouts if someone tries to access the DP AUX +* character device when no DP device is connected. +*/ +if (!aux->is_edp && !aux->enable_xfers) { + ret = -ENXIO ; + goto exit; + } +/* * For eDP it's important to give a reasonably long wait here for HPD * to be asserted. This is because the panel driver may have _just_
@@ -428,6 +440,14 @@ irqreturn_t dp_aux_isr(struct drm_dp_aux *dp_aux)return IRQ_HANDLED ; } +void dp_aux_enable_xfers (struct drm_dp_aux *dp_aux,bool enabled) +{ +struct dp_aux_private *aux; + + aux = container_of(dp_aux, struct dp_aux_private, dp_aux); + aux->enable_xfers = enabled; +} +void dp_aux_reconfig (struct drm_dp_aux *dp_aux) {struct dp_aux_private *aux;
drivers/gpu/drm/msm/dp/dp_aux.h +1 -0
@@ -12,6 +12,7 @@int dp_aux_register (struct drm_dp_aux *dp_aux);void dp_aux_unregister (struct drm_dp_aux *dp_aux);irqreturn_t dp_aux_isr (struct drm_dp_aux *dp_aux); +void dp_aux_enable_xfers (struct drm_dp_aux *dp_aux,bool enabled);void dp_aux_init (struct drm_dp_aux *dp_aux);void dp_aux_deinit (struct drm_dp_aux *dp_aux);void dp_aux_reconfig (struct drm_dp_aux *dp_aux);
drivers/gpu/drm/msm/dp/dp_display.c +4 -0
@@ -577,6 +577,8 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)if (!hpd)return 0 ; +dp_aux_enable_xfers (dp->aux, true); +mutex_lock (&dp->event_mutex); state = dp->hpd_state;
@@ -641,6 +643,8 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)if (!hpd)return 0 ; +dp_aux_enable_xfers (dp->aux, false); +mutex_lock (&dp->event_mutex); state = dp->hpd_state;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 217/473 media: ipu3-cio2: Request IRQ earlier
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
[ Upstream commit a069f79bfa6ec1ea0744981ea8425c8a25322579 ]
Call devm_request_irq() before registering the async notifier, as otherwise it would be possible to use the device before the interrupts could be delivered to the driver.
--- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +5 -5
@@ -1798,11 +1798,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,v4l2_async_nf_init (&cio2->notifier); -/* Register notifier for subdevices we care */ - r =cio2_parse_firmware (cio2); -if (r) - goto fail_clean_notifier; - r =devm_request_irq (dev, pci_dev->irq, cio2_irq,IRQF_SHARED ,CIO2_NAME , cio2);if (r) {
@@ -1810,6 +1805,11 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, goto fail_clean_notifier; } +/* Register notifier for subdevices we care */ + r =cio2_parse_firmware (cio2); +if (r) + goto fail_clean_notifier; +pm_runtime_put_noidle (dev);pm_runtime_allow (dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 218/473 media: dt-bindings: ovti,ov2680: Fix the power supply names
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit e2f6ea61b6f3e4ebbb7dff857eea6220c18cd17b ]
The original .txt bindings had the OV2680 power supply names correct, but the transition from .txt to yaml spelled them incorrectly.
Fix the OV2680 power supply names as the original .txt bindings as these are the names used by the OV2680 driver and in devicetree.
--- .../bindings/media/i2c/ovti,ov2680.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/media/i2c/ovti,ov2680.yaml +9 -9
@@ -37,15 +37,15 @@ properties: active low. maxItems: 1 - dovdd-supply: + DOVDD-supply: description: Definition of the regulator used as interface power supply. - avdd-supply: + AVDD-supply: description: Definition of the regulator used as analog power supply. - dvdd-supply: + DVDD-supply: description: Definition of the regulator used as digital power supply.
@@ -59,9 +59,9 @@ required: - reg - clocks - clock-names - - dovdd-supply - - avdd-supply - - dvdd-supply + - DOVDD-supply + - AVDD-supply + - DVDD-supply - reset-gpios - port
@@ -82,9 +82,9 @@ examples: clock-names = "xvclk"; reset-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; - dovdd-supply = <&sw2_reg>; - dvdd-supply = <&sw2_reg>; - avdd-supply = <®_peri_3p15v>; + DOVDD-supply = <&sw2_reg>; + DVDD-supply = <&sw2_reg>; + AVDD-supply = <®_peri_3p15v>; port { ov2680_to_mipi: endpoint {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 219/473 fbdev: sh7760fb: allow modular build
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 51084f89d687e14d96278241e5200cde4b0985c7 ]
There is no reason to prohibit sh7760fb from being built as a loadable module as suggested by Geert, so change the config symbol from bool to tristate to allow that and change the FB dependency as needed.
--- drivers/video/fbdev/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/Kconfig +2 -2
@@ -2014,8 +2014,8 @@ config FB_COBALT depends on FB && MIPS_COBALT config FB_SH7760 - bool "SH7760/SH7763/SH7720/SH7721 LCDC support" - depends on FB=y && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ + tristate "SH7760/SH7763/SH7720/SH7721 LCDC support" + depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ || CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721) select FB_CFB_FILLRECT select FB_CFB_COPYAREA
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 220/473 media: atomisp: ssh_css: Fix a null-pointer dereference in load_video_binaries
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 3b621e9e9e148c0928ab109ac3d4b81487469acb ]
The allocation failure of mycs->yuv_scaler_binary in load_video_binaries() is followed with a dereference of mycs->yuv_scaler_binary after the following call chain:
sh_css_pipe_load_binaries()
|-> load_video_binaries(mycs->yuv_scaler_binary == NULL)
|
|-> sh_css_pipe_unload_binaries()
|-> unload_video_binaries()In unload_video_binaries(), it calls to ia_css_binary_unload with argument &pipe->pipe_settings.video.yuv_scaler_binary[i], which refers to the same memory slot as mycs->yuv_scaler_binary. Thus, a null-pointer dereference is triggered.
--- drivers/staging/media/atomisp/pci/sh_css.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/atomisp/pci/sh_css.c +1 -0
@@ -4972,6 +4972,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe)sizeof (struct ia_css_binary ), GFP_KERNEL);if (!mycs->yuv_scaler_binary) { + mycs->num_yuv_scaler =0 ; err = -ENOMEM ;return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 221/473 drm/arm/malidp: fix a possible null pointer dereference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huai-Yuan Liu <[email protected]>
[ Upstream commit a1f95aede6285dba6dd036d907196f35ae3a11ea ]
In malidp_mw_connector_reset, new memory is allocated with kzalloc, but no check is performed. In order to prevent null pointer dereferencing, ensure that mw_state is checked before calling __drm_atomic_helper_connector_reset.
--- drivers/gpu/drm/arm/malidp_mw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_mw.c +4 -1
@@ -72,7 +72,10 @@ static void malidp_mw_connector_reset(struct drm_connector *connector)__drm_atomic_helper_connector_destroy_state (connector->state);kfree (connector->state); -__drm_atomic_helper_connector_reset (connector, &mw_state->base); + connector->state =NULL ; + +if (mw_state) +__drm_atomic_helper_connector_reset (connector, &mw_state->base); } static enum drm_connector_status
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 222/473 drm: vc4: Fix possible null pointer dereference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit c534b63bede6cb987c2946ed4d0b0013a52c5ba7 ]
In vc4_hdmi_audio_init() of_get_address() may return
NULL which is later dereferenced. Fix this bug by adding NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/vc4/vc4_hdmi.c +2 -0
@@ -2489,6 +2489,8 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) index =1 ; addr =of_get_address (dev->of_node, index,NULL ,NULL ); +if (!addr) +return -EINVAL ; vc4_hdmi->audio.dma_data.addr =be32_to_cpup (addr) + mai_data->offset; vc4_hdmi->audio.dma_data.addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 223/473 ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 58300f8d6a48e58d1843199be743f819e2791ea3 ]
The string SND_SOC_DAPM_DIR_OUT is printed in the snd_soc_dapm_path trace event instead of its value:
(((REC->path_dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")
User space cannot parse this, as it has no idea what SND_SOC_DAPM_DIR_OUT is. Use TRACE_DEFINE_ENUM() to convert it to its value:
(((REC->path_dir) == 1) ? "->" : "<-")
So that user space tools, such as perf and trace-cmd, can parse it correctly.
--- include/trace/events/asoc.h | 2 ++ 1 file changed, 2 insertions(+)
include/trace/events/asoc.h +2 -0
@@ -12,6 +12,8 @@#define DAPM_DIRECT "(direct)"#define DAPM_ARROW (dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-") +TRACE_DEFINE_ENUM (SND_SOC_DAPM_DIR_OUT ); +struct snd_soc_jack ;struct snd_soc_card ;struct snd_soc_dapm_widget ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 224/473 drm/bridge: anx7625: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit ef4a9204d594fe959cdbc7418273caf4001535c8 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -4
@@ -2077,10 +2077,8 @@ static int anx7625_setup_dsi_device(struct anx7625_data *ctx) }; host =of_find_mipi_dsi_host_by_node (ctx->pdata.mipi_host_node); -if (!host) { -DRM_DEV_ERROR (dev,"fail to find dsi host.\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"fail to find dsi host.\n" ); dsi =devm_mipi_dsi_device_register_full (dev, host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 225/473 drm/bridge: icn6211: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 275fafe58faa7fdb10fa245412696ecef676aac5 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/chipone-icn6211.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +2 -4
@@ -563,10 +563,8 @@ static int chipone_dsi_host_attach(struct chipone *icn) host =of_find_mipi_dsi_host_by_node (host_node);of_node_put (host_node); -if (!host) { -dev_err (dev,"failed to find dsi host\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"failed to find dsi host\n" ); dsi =mipi_dsi_device_register_full (host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 226/473 drm/bridge: lt8912b: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit b3b4695ff47c4964d4ccb930890c9ffd8e455e20 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/lontium-lt8912b.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +2 -4
@@ -485,10 +485,8 @@ static int lt8912_attach_dsi(struct lt8912 *lt) }; host =of_find_mipi_dsi_host_by_node (lt->host_node); -if (!host) { -dev_err (dev,"failed to find dsi host\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"failed to find dsi host\n" ); dsi =devm_mipi_dsi_device_register_full (dev, host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 227/473 drm/bridge: lt9611: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit cd0a2c6a081ff67007323725b9ff07d9934b1ed8 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/lontium-lt9611.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -4
@@ -777,10 +777,8 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,int ret; host =of_find_mipi_dsi_host_by_node (dsi_node); -if (!host) { -dev_err (lt9611->dev,"failed to find dsi host\n" ); -return ERR_PTR (-EPROBE_DEFER ); - } +if (!host) +return ERR_PTR (dev_err_probe (lt9611->dev, -EPROBE_DEFER ,"failed to find dsi host\n" )); dsi =devm_mipi_dsi_device_register_full (dev, host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 228/473 drm/bridge: lt9611uxc: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 6d9e877cde7e9b516a9a99751b8222c87557436d ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611uxc.c +2 -4
@@ -263,10 +263,8 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc,int ret; host =of_find_mipi_dsi_host_by_node (dsi_node); -if (!host) { -dev_err (dev,"failed to find dsi host\n" ); -return ERR_PTR (-EPROBE_DEFER ); - } +if (!host) +return ERR_PTR (dev_err_probe (dev, -EPROBE_DEFER ,"failed to find dsi host\n" )); dsi =devm_mipi_dsi_device_register_full (dev, host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 229/473 drm/bridge: tc358775: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 272377aa0e3dddeec3f568c8bb9d12c7a79d8ef5 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/tc358775.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/tc358775.c +2 -4
@@ -611,10 +611,8 @@ static int tc_attach_host(struct tc_data *tc) }; host =of_find_mipi_dsi_host_by_node (tc->host_node); -if (!host) { -dev_err (dev,"failed to find dsi host\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"failed to find dsi host\n" ); dsi =devm_mipi_dsi_device_register_full (dev, host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 230/473 drm/bridge: dpc3433: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 24f4f575214de776539d346b99b8717bffa8ebba ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
Also move the "failed to attach" error message so that it's only printed when the devm_mipi_dsi_attach() call fails.
--- drivers/gpu/drm/bridge/ti-dlpc3433.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/ti-dlpc3433.c +9 -8
@@ -319,12 +319,11 @@ static int dlpc_host_attach(struct dlpc *dlpc) .channel = 0, .node = NULL, }; +int ret; host =of_find_mipi_dsi_host_by_node (dlpc->host_node); -if (!host) { -DRM_DEV_ERROR (dev,"failed to find dsi host\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"failed to find dsi host\n" ); dlpc->dsi =mipi_dsi_device_register_full (host, &info);if (IS_ERR (dlpc->dsi)) {
@@ -336,7 +335,11 @@ static int dlpc_host_attach(struct dlpc *dlpc) dlpc->dsi->format =MIPI_DSI_FMT_RGB565 ; dlpc->dsi->lanes = dlpc->dsi_lanes; -return devm_mipi_dsi_attach (dev, dlpc->dsi); + ret =devm_mipi_dsi_attach (dev, dlpc->dsi); +if (ret) +DRM_DEV_ERROR (dev,"failed to attach dsi host\n" ); + +return ret; }static int dlpc3433_probe (struct i2c_client *client)
@@ -367,10 +370,8 @@ static int dlpc3433_probe(struct i2c_client *client)drm_bridge_add (&dlpc->bridge); ret =dlpc_host_attach (dlpc); -if (ret) { -DRM_DEV_ERROR (dev,"failed to attach dsi host\n" ); +if (ret) goto err_remove_bridge; - }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 231/473 drm/panel: novatek-nt35950: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 5ff5505b9a2d827cae3f95dceba258c963138175 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/panel/panel-novatek-nt35950.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt35950.c +2 -4
@@ -573,10 +573,8 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) } dsi_r_host =of_find_mipi_dsi_host_by_node (dsi_r);of_node_put (dsi_r); -if (!dsi_r_host) { -dev_err (dev,"Cannot get secondary DSI host\n" ); -return -EPROBE_DEFER ; - } +if (!dsi_r_host) +return dev_err_probe (dev, -EPROBE_DEFER ,"Cannot get secondary DSI host\n" ); nt->dsi[1 ] =mipi_dsi_device_register_full (dsi_r_host, info);if (!nt->dsi[1 ]) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 232/473 drm/panel: simple: Add missing Innolux G121X1-L03 format, flags, connector
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 11ac72d033b9f577e8ba0c7a41d1c312bb232593 ]
The .bpc = 6 implies .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG , add the missing bus_format. Add missing connector type and bus_flags as well.
Documentation [1] 1.4 GENERAL SPECIFICATI0NS indicates this panel is capable of both RGB 18bit/24bit panel, the current configuration uses 18bit mode, .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG , .bpc = 6.
Support for the 24bit mode would require another entry in panel-simple with .bus_format = MEDIA_BUS_FMT_RGB666_1X7X4_SPWG and .bpc = 8, which is out of scope of this fix.
[1] https://www.distec.de/fileadmin/pdf/produkte/TFT-Displays/Innolux/G121X1-L03_Datasheet.pdf
--- drivers/gpu/drm/panel/panel-simple.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +3 -0
@@ -2286,6 +2286,9 @@ static const struct panel_desc innolux_g121x1_l03 = { .unprepare = 200, .disable = 400, }, + .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, + .bus_flags = DRM_BUS_FLAG_DE_HIGH, + .connector_type = DRM_MODE_CONNECTOR_LVDS, }; static const struct drm_display_mode innolux_n156bge_l21_mode = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 233/473 drm/mipi-dsi: use correct return type for the DSC functions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit de1c705c50326acaceaf1f02bc5bf6f267c572bd ]
The functions mipi_dsi_compression_mode() and mipi_dsi_picture_parameter_set() return 0-or-error rather than a buffer size. Follow example of other similar MIPI DSI functions and use int return type instead of size_t.
--- drivers/gpu/drm/drm_mipi_dsi.c | 6 +++--- include/drm/drm_mipi_dsi.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_mipi_dsi.c +3 -3
@@ -653,7 +653,7 @@ EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size);* * Return: 0 on success or a negative error code on failure. */ -ssize_t mipi_dsi_compression_mode (struct mipi_dsi_device *dsi,bool enable) +int mipi_dsi_compression_mode (struct mipi_dsi_device *dsi,bool enable) {/* Note: Needs updating for non-default PPS or algorithm */ u8 tx[2 ] = { enable <<0 ,0 };
@@ -678,8 +678,8 @@ EXPORT_SYMBOL(mipi_dsi_compression_mode);* * Return: 0 on success or a negative error code on failure. */ -ssize_t mipi_dsi_picture_parameter_set (struct mipi_dsi_device *dsi, -const struct drm_dsc_picture_parameter_set *pps) +int mipi_dsi_picture_parameter_set (struct mipi_dsi_device *dsi, +const struct drm_dsc_picture_parameter_set *pps) {struct mipi_dsi_msg msg = { .channel = dsi->channel,
include/drm/drm_mipi_dsi.h +3 -3
@@ -244,9 +244,9 @@ int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi);int mipi_dsi_turn_on_peripheral (struct mipi_dsi_device *dsi);int mipi_dsi_set_maximum_return_packet_size (struct mipi_dsi_device *dsi,u16 value); -ssize_t mipi_dsi_compression_mode (struct mipi_dsi_device *dsi,bool enable); -ssize_t mipi_dsi_picture_parameter_set (struct mipi_dsi_device *dsi, -const struct drm_dsc_picture_parameter_set *pps); +int mipi_dsi_compression_mode (struct mipi_dsi_device *dsi,bool enable); +int mipi_dsi_picture_parameter_set (struct mipi_dsi_device *dsi, +const struct drm_dsc_picture_parameter_set *pps);ssize_t mipi_dsi_generic_write (struct mipi_dsi_device *dsi,const void *payload,size_t size);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 234/473 drm/rockchip: vop2: Do not divide height twice for YUV
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Detlev Casanova <[email protected]>
[ Upstream commit e80c219f52861e756181d7f88b0d341116daac2b ]
For the cbcr format, gt2 and gt4 are computed again after src_h has been divided by vsub.
As src_h as already been divided by 2 before, introduce cbcr_src_h and cbcr_src_w to keep a copy of those values to be used for cbcr gt2 and gt4 computation.
This fixes yuv planes being unaligned vertically when down scaling to 1080 pixels from 2160.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +12 -10
@@ -607,6 +607,8 @@ static void vop2_setup_scale(struct vop2 *vop2, const struct vop2_win *win,const struct drm_format_info *info;u16 hor_scl_mode, ver_scl_mode;u16 hscl_filter_mode, vscl_filter_mode; +uint16_t cbcr_src_w = src_w; +uint16_t cbcr_src_h = src_h;u8 gt2 =0 ;u8 gt4 =0 ;u32 val;
@@ -664,27 +666,27 @@ static void vop2_setup_scale(struct vop2 *vop2, const struct vop2_win *win,vop2_win_write (win,VOP2_WIN_YRGB_VSCL_FILTER_MODE , vscl_filter_mode);if (info->is_yuv) { - src_w /= info->hsub; - src_h /= info->vsub; + cbcr_src_w /= info->hsub; + cbcr_src_h /= info->vsub; gt4 =0 ; gt2 =0 ; -if (src_h >= (4 * dst_h)) { +if (cbcr_src_h >= (4 * dst_h)) { gt4 =1 ; - src_h >>=2 ; - }else if (src_h >= (2 * dst_h)) { + cbcr_src_h >>=2 ; + }else if (cbcr_src_h >= (2 * dst_h)) { gt2 =1 ; - src_h >>=1 ; + cbcr_src_h >>=1 ; } - hor_scl_mode =scl_get_scl_mode (src_w, dst_w); - ver_scl_mode =scl_get_scl_mode (src_h, dst_h); + hor_scl_mode =scl_get_scl_mode (cbcr_src_w, dst_w); + ver_scl_mode =scl_get_scl_mode (cbcr_src_h, dst_h); - val =vop2_scale_factor (src_w, dst_w); + val =vop2_scale_factor (cbcr_src_w, dst_w);vop2_win_write (win,VOP2_WIN_SCALE_CBCR_X , val); - val =vop2_scale_factor (src_h, dst_h); + val =vop2_scale_factor (cbcr_src_h, dst_h);vop2_win_write (win,VOP2_WIN_SCALE_CBCR_Y , val);vop2_win_write (win,VOP2_WIN_VSD_CBCR_GT4 , gt4);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 235/473 clk: samsung: exynosautov9: fix wrong pll clock id value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaewon Kim <[email protected]>
[ Upstream commit 04ee3a0b44e3d18cf6b0c712d14b98624877fd26 ]
All PLL id values of CMU_TOP were incorrectly set to FOUT_SHARED0_PLL. It modified to the correct PLL clock id value.
--- drivers/clk/samsung/clk-exynosautov9.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/samsung/clk-exynosautov9.c +4 -4
@@ -343,13 +343,13 @@ static const struct samsung_pll_clock top_pll_clks[] __initconst = {/* CMU_TOP_PURECLKCOMP */ PLL (pll_0822x,FOUT_SHARED0_PLL ,"fout_shared0_pll" ,"oscclk" ,PLL_LOCKTIME_PLL_SHARED0 ,PLL_CON3_PLL_SHARED0 ,NULL ), -PLL (pll_0822x,FOUT_SHARED0_PLL ,"fout_shared1_pll" ,"oscclk" , +PLL (pll_0822x,FOUT_SHARED1_PLL ,"fout_shared1_pll" ,"oscclk" ,PLL_LOCKTIME_PLL_SHARED1 ,PLL_CON3_PLL_SHARED1 ,NULL ), -PLL (pll_0822x,FOUT_SHARED0_PLL ,"fout_shared2_pll" ,"oscclk" , +PLL (pll_0822x,FOUT_SHARED2_PLL ,"fout_shared2_pll" ,"oscclk" ,PLL_LOCKTIME_PLL_SHARED2 ,PLL_CON3_PLL_SHARED2 ,NULL ), -PLL (pll_0822x,FOUT_SHARED0_PLL ,"fout_shared3_pll" ,"oscclk" , +PLL (pll_0822x,FOUT_SHARED3_PLL ,"fout_shared3_pll" ,"oscclk" ,PLL_LOCKTIME_PLL_SHARED3 ,PLL_CON3_PLL_SHARED3 ,NULL ), -PLL (pll_0822x,FOUT_SHARED0_PLL ,"fout_shared4_pll" ,"oscclk" , +PLL (pll_0822x,FOUT_SHARED4_PLL ,"fout_shared4_pll" ,"oscclk" , PLL_LOCKTIME_PLL_SHARED4, PLL_CON3_PLL_SHARED4, NULL), };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 236/473 RDMA/mlx5: Adding remote atomic access flag to updatable flags
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Or Har-Toov <[email protected]>
[ Upstream commit 2ca7e93bc963d9ec2f5c24d117176851454967af ]
Currently IB_ACCESS_REMOTE_ATOMIC is blocked from being updated via UMR although in some cases it should be possible. These cases are checked in mlx5r_umr_can_reconfig function.
--- drivers/infiniband/hw/mlx5/mr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mr.c +2 -1
@@ -1349,7 +1349,8 @@ static bool can_use_umr_rereg_access(struct mlx5_ib_dev *dev,unsigned int diffs = current_access_flags ^ target_access_flags;if (diffs & ~(IB_ACCESS_LOCAL_WRITE |IB_ACCESS_REMOTE_WRITE | -IB_ACCESS_REMOTE_READ |IB_ACCESS_RELAXED_ORDERING )) +IB_ACCESS_REMOTE_READ |IB_ACCESS_RELAXED_ORDERING | +IB_ACCESS_REMOTE_ATOMIC ))return false;return mlx5r_umr_can_reconfig (dev, current_access_flags, target_access_flags);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 237/473 RDMA/hns: Fix return value in hns_roce_map_mr_sg
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
[ Upstream commit 203b70fda63425a4eb29f03f9074859afe821a39 ]
As described in the ib_map_mr_sg function comment, it returns the number of sg elements that were mapped to the memory region. However, hns_roce_map_mr_sg returns the number of pages required for mapping the DMA area. Fix it.
--- drivers/infiniband/hw/hns/hns_roce_mr.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/infiniband/hw/hns/hns_roce_mr.c +7 -8
@@ -421,18 +421,18 @@ int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,struct ib_device *ibdev = &hr_dev->ib_dev;struct hns_roce_mr *mr =to_hr_mr (ibmr);struct hns_roce_mtr *mtr = &mr->pbl_mtr; -int ret =0 ; +int ret, sg_num =0 ; mr->npages =0 ; mr->page_list =kvcalloc (mr->pbl_mtr.hem_cfg.buf_pg_count,sizeof (dma_addr_t),GFP_KERNEL );if (!mr->page_list) -return ret; +return sg_num; - ret =ib_sg_to_pages (ibmr, sg, sg_nents, sg_offset, hns_roce_set_page); -if (ret <1 ) { + sg_num =ib_sg_to_pages (ibmr, sg, sg_nents, sg_offset, hns_roce_set_page); +if (sg_num <1 ) {ibdev_err (ibdev,"failed to store sg pages %u %u, cnt = %d.\n" , - mr->npages, mr->pbl_mtr.hem_cfg.buf_pg_count, ret); + mr->npages, mr->pbl_mtr.hem_cfg.buf_pg_count, sg_num); goto err_page_list; }
@@ -443,17 +443,16 @@ int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, ret =hns_roce_mtr_map (hr_dev, mtr, mr->page_list, mr->npages);if (ret) {ibdev_err (ibdev,"failed to map sg mtr, ret = %d.\n" , ret); - ret =0 ; + sg_num =0 ; }else { mr->pbl_mtr.hem_cfg.buf_pg_shift = (u32 )ilog2 (ibmr->page_size); - ret = mr->npages; } err_page_list:kvfree (mr->page_list); mr->page_list =NULL ; -return ret; +return sg_num; } static void hns_roce_mw_free(struct hns_roce_dev *hr_dev,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 238/473 RDMA/hns: Fix deadlock on SRQ async events.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit b46494b6f9c19f141114a57729e198698f40af37 ]
xa_lock for SRQ table may be required in AEQ. Use xa_store_irq()/ xa_erase_irq() to avoid deadlock.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 1 + drivers/infiniband/hw/hns/hns_roce_srq.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/hw/hns/hns_roce_main.c +1 -0
@@ -37,6 +37,7 @@#include <rdma/ib_smi.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_cache.h> +#include "hnae3.h" #include "hns_roce_common.h" #include "hns_roce_device.h" #include "hns_roce_hem.h"
drivers/infiniband/hw/hns/hns_roce_srq.c +3 -3
@@ -122,7 +122,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)return ret; } - ret =xa_err (xa_store (&srq_table->xa, srq->srqn, srq,GFP_KERNEL )); + ret =xa_err (xa_store_irq (&srq_table->xa, srq->srqn, srq,GFP_KERNEL ));if (ret) {ibdev_err (ibdev,"failed to store SRQC, ret = %d.\n" , ret); goto err_put;
@@ -135,7 +135,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)return 0 ; err_xa: -xa_erase (&srq_table->xa, srq->srqn); +xa_erase_irq (&srq_table->xa, srq->srqn); err_put:hns_roce_table_put (hr_dev, &srq_table->table, srq->srqn);
@@ -153,7 +153,7 @@ static void free_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)dev_err (hr_dev->dev,"DESTROY_SRQ failed (%d) for SRQN %06lx\n" , ret, srq->srqn); -xa_erase (&srq_table->xa, srq->srqn); +xa_erase_irq (&srq_table->xa, srq->srqn);if (refcount_dec_and_test (&srq->refcount))complete (&srq->free);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 239/473 RDMA/hns: Fix UAF for cq async event
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit a942ec2745ca864cd8512142100e4027dc306a42 ]
The refcount of CQ is not protected by locks. When CQ asynchronous events and CQ destruction are concurrent, CQ may have been released, which will cause UAF.
Use the xa_lock() to protect the CQ refcount.
--- drivers/infiniband/hw/hns/hns_roce_cq.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/infiniband/hw/hns/hns_roce_cq.c +13 -11
@@ -151,7 +151,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)return ret; } - ret =xa_err (xa_store (&cq_table->array, hr_cq->cqn, hr_cq,GFP_KERNEL )); + ret =xa_err (xa_store_irq (&cq_table->array, hr_cq->cqn, hr_cq,GFP_KERNEL ));if (ret) {ibdev_err (ibdev,"failed to xa_store CQ, ret = %d.\n" , ret); goto err_put;
@@ -164,7 +164,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)return 0 ; err_xa: -xa_erase (&cq_table->array, hr_cq->cqn); +xa_erase_irq (&cq_table->array, hr_cq->cqn); err_put:hns_roce_table_put (hr_dev, &cq_table->table, hr_cq->cqn);
@@ -183,7 +183,7 @@ static void free_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)dev_err (dev,"DESTROY_CQ failed (%d) for CQN %06lx\n" , ret, hr_cq->cqn); -xa_erase (&cq_table->array, hr_cq->cqn); +xa_erase_irq (&cq_table->array, hr_cq->cqn);/* Waiting interrupt process procedure carried out */ synchronize_irq (hr_dev->eq_table.eq[hr_cq->vector].irq);
@@ -472,13 +472,6 @@ void hns_roce_cq_event(struct hns_roce_dev *hr_dev, u32 cqn, int event_type)struct ib_event event;struct ib_cq *ibcq; - hr_cq =xa_load (&hr_dev->cq_table.array, - cqn & (hr_dev->caps.num_cqs -1 )); -if (!hr_cq) { -dev_warn (dev,"async event for bogus CQ 0x%06x\n" , cqn); -return ; - } -if (event_type !=HNS_ROCE_EVENT_TYPE_CQ_ID_INVALID && event_type !=HNS_ROCE_EVENT_TYPE_CQ_ACCESS_ERROR && event_type !=HNS_ROCE_EVENT_TYPE_CQ_OVERFLOW ) {
@@ -487,7 +480,16 @@ void hns_roce_cq_event(struct hns_roce_dev *hr_dev, u32 cqn, int event_type)return ; } -refcount_inc (&hr_cq->refcount); +xa_lock (&hr_dev->cq_table.array); + hr_cq =xa_load (&hr_dev->cq_table.array, + cqn & (hr_dev->caps.num_cqs -1 )); +if (hr_cq) +refcount_inc (&hr_cq->refcount); +xa_unlock (&hr_dev->cq_table.array); +if (!hr_cq) { +dev_warn (dev,"async event for bogus CQ 0x%06x\n" , cqn); +return ; + } ibcq = &hr_cq->ib_cq;if (ibcq->event_handler) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 240/473 RDMA/hns: Fix GMV table pagesize
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit ee045493283403969591087bd405fa280103282a ]
GMV's BA table only supports 4K pages. Currently, PAGESIZE is used to calculate gmv_bt_num, which will cause an abnormal number of gmv_bt_num in a 64K OS.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -1
@@ -2229,7 +2229,7 @@ static void apply_func_caps(struct hns_roce_dev *hr_dev) caps->gid_table_len[0 ] = caps->gmv_bt_num * (HNS_HW_PAGE_SIZE / caps->gmv_entry_sz); - caps->gmv_entry_num = caps->gmv_bt_num * (PAGE_SIZE / + caps->gmv_entry_num = caps->gmv_bt_num * (HNS_HW_PAGE_SIZE / caps->gmv_entry_sz); }else {u32 func_num =max_t (u32,1 , hr_dev->func_num);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 241/473 RDMA/hns: Use complete parentheses in macros
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 4125269bb9b22e1d8cdf4412c81be8074dbc61ca ]
Use complete parentheses to ensure that macro expansion does not produce unexpected results.
--- drivers/infiniband/hw/hns/hns_roce_hem.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hem.h +6 -6
@@ -61,16 +61,16 @@ enum { (sizeof(struct scatterlist) + sizeof(void *)))#define check_whether_bt_num_3 (type, hop_num) \ - (type < HEM_TYPE_MTT && hop_num == 2) + ((type) < HEM_TYPE_MTT && (hop_num) == 2)#define check_whether_bt_num_2 (type, hop_num) \ - ((type < HEM_TYPE_MTT && hop_num == 1) || \ - (type >= HEM_TYPE_MTT && hop_num == 2)) + (((type) < HEM_TYPE_MTT && (hop_num) == 1) || \ + ((type) >= HEM_TYPE_MTT && (hop_num) == 2))#define check_whether_bt_num_1 (type, hop_num) \ - ((type < HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0) || \ - (type >= HEM_TYPE_MTT && hop_num == 1) || \ - (type >= HEM_TYPE_MTT && hop_num == HNS_ROCE_HOP_NUM_0)) + (((type) < HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0) || \ + ((type) >= HEM_TYPE_MTT && (hop_num) == 1) || \ + ((type) >= HEM_TYPE_MTT && (hop_num) == HNS_ROCE_HOP_NUM_0))struct hns_roce_hem_chunk {struct list_head list;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 242/473 RDMA/hns: Modify the print level of CQE error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 349e859952285ab9689779fb46de163f13f18f43 ]
Too much print may lead to a panic in kernel. Change ibdev_err() to ibdev_err_ratelimited(), and change the printing level of cqe dump to debug level.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -2
@@ -3857,8 +3857,9 @@ static void get_cqe_status(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp, wc->status == IB_WC_WR_FLUSH_ERR))return ; -ibdev_err (&hr_dev->ib_dev,"error cqe status 0x%x:\n" , cqe_status); -print_hex_dump (KERN_ERR ,"" ,DUMP_PREFIX_NONE ,16 ,4 , cqe, +ibdev_err_ratelimited (&hr_dev->ib_dev,"error cqe status 0x%x:\n" , + cqe_status); +print_hex_dump (KERN_DEBUG ,"" ,DUMP_PREFIX_NONE ,16 ,4 , cqe, cq->cqe_size, false); wc->vendor_err =hr_reg_read (cqe,CQE_SUB_STATUS );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 243/473 clk: mediatek: mt8365-mm: fix DPI0 parent
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Mergnat <[email protected]>
[ Upstream commit 4c0c087772d7e29bc2489ddb068d5167140bfc38 ]
To have a working display through DPI, a workaround has been implemented downstream to add "mm_dpi0_dpi0" and "dpi0_sel" to the DPI node. Shortly, that add an extra clock.
It seems consistent to have the "dpi0_sel" as parent. Additionnaly, "vpll_dpix" isn't used/managed.
Then, set the "mm_dpi0_dpi0" parent clock to "dpi0_sel".
The new clock tree is:
clk26m
lvdspll
lvdspll_X (2, 4, 8, 16)
dpi0_sel
mm_dpi0_dpi0--- drivers/clk/mediatek/clk-mt8365-mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8365-mm.c +1 -1
@@ -53,7 +53,7 @@ static const struct mtk_gate mm_clks[] = {GATE_MM0 (CLK_MM_MM_DSI0 ,"mm_dsi0" ,"mm_sel" ,17 ),GATE_MM0 (CLK_MM_MM_DISP_RDMA1 ,"mm_disp_rdma1" ,"mm_sel" ,18 ),GATE_MM0 (CLK_MM_MM_MDP_RDMA1 ,"mm_mdp_rdma1" ,"mm_sel" ,19 ), -GATE_MM0 (CLK_MM_DPI0_DPI0 ,"mm_dpi0_dpi0" ,"vpll_dpix" ,20 ), +GATE_MM0 (CLK_MM_DPI0_DPI0 ,"mm_dpi0_dpi0" ,"dpi0_sel" ,20 ),GATE_MM0 (CLK_MM_MM_FAKE ,"mm_fake" ,"mm_sel" ,21 ),GATE_MM0 (CLK_MM_MM_SMI_COMMON ,"mm_smi_common" ,"mm_sel" ,22 ), GATE_MM0(CLK_MM_MM_SMI_LARB0, "mm_smi_larb0", "mm_sel", 23),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 244/473 clk: rs9: fix wrong default value for clock amplitude
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Popescu <[email protected]>
[ Upstream commit 1758c68c81b8b881818fcebaaeb91055362a82f8 ]
According to 9FGV0241, 9FGV0441 & 9FGV0841 datasheets, the default value for the clock amplitude is 0.8V, while the driver assumes 0.7V.
Additionally, define constants for default values for both clock amplitude and spread spectrum and use them.
--- drivers/clk/clk-renesas-pcie.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/clk/clk-renesas-pcie.c +6 -4
@@ -24,10 +24,12 @@#define RS9_REG_SS_AMP_0V7 0x1#define RS9_REG_SS_AMP_0V8 0x2#define RS9_REG_SS_AMP_0V9 0x3 +#define RS9_REG_SS_AMP_DEFAULT RS9_REG_SS_AMP_0V8#define RS9_REG_SS_AMP_MASK 0x3#define RS9_REG_SS_SSC_100 0#define RS9_REG_SS_SSC_M025 (1 << 3)#define RS9_REG_SS_SSC_M050 (3 << 3) +#define RS9_REG_SS_SSC_DEFAULT RS9_REG_SS_SSC_100#define RS9_REG_SS_SSC_MASK (3 << 3)#define RS9_REG_SS_SSC_LOCK BIT(5)#define RS9_REG_SR 0x2
@@ -196,8 +198,8 @@ static int rs9_get_common_config(struct rs9_driver_data *rs9)int ret;/* Set defaults */ - rs9->pll_amplitude =RS9_REG_SS_AMP_0V7 ; - rs9->pll_ssc =RS9_REG_SS_SSC_100 ; + rs9->pll_amplitude =RS9_REG_SS_AMP_DEFAULT ; + rs9->pll_ssc =RS9_REG_SS_SSC_DEFAULT ;/* Output clock amplitude */ ret = of_property_read_u32(np, "renesas,out-amplitude-microvolt",
@@ -238,13 +240,13 @@ static void rs9_update_config(struct rs9_driver_data *rs9)int i;/* If amplitude is non-default, update it. */ -if (rs9->pll_amplitude !=RS9_REG_SS_AMP_0V7 ) { +if (rs9->pll_amplitude !=RS9_REG_SS_AMP_DEFAULT ) {regmap_update_bits (rs9->regmap,RS9_REG_SS ,RS9_REG_SS_AMP_MASK , rs9->pll_amplitude); }/* If SSC is non-default, update it. */ -if (rs9->pll_ssc !=RS9_REG_SS_SSC_100 ) { +if (rs9->pll_ssc !=RS9_REG_SS_SSC_DEFAULT ) {regmap_update_bits (rs9->regmap,RS9_REG_SS ,RS9_REG_SS_SSC_MASK , rs9->pll_ssc); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 245/473 RDMA/rxe: Fix seg fault in rxe_comp_queue_pkt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Pearson <[email protected]>
[ Upstream commit 2b23b6097303ed0ba5f4bc036a1c07b6027af5c6 ]
In rxe_comp_queue_pkt() an incoming response packet skb is enqueued to the resp_pkts queue and then a decision is made whether to run the completer task inline or schedule it. Finally the skb is dereferenced to bump a 'hw' performance counter. This is wrong because if the completer task is already running in a separate thread it may have already processed the skb and freed it which can cause a seg fault. This has been observed infrequently in testing at high scale.
This patch fixes this by changing the order of enqueuing the packet until after the counter is accessed.
--- drivers/infiniband/sw/rxe/rxe_comp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +3 -3
@@ -126,12 +126,12 @@ void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) {int must_sched; -skb_queue_tail (&qp->resp_pkts, skb); - - must_sched =skb_queue_len (&qp->resp_pkts) >1 ; + must_sched =skb_queue_len (&qp->resp_pkts) >0 ;if (must_sched !=0 )rxe_counter_inc (SKB_TO_PKT (skb)->rxe,RXE_CNT_COMPLETER_SCHED ); +skb_queue_tail (&qp->resp_pkts, skb); +if (must_sched)rxe_sched_task (&qp->comp.task);else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 246/473 RDMA/rxe: Replace pr_xxx by rxe_dbg_xxx in rxe_net.c
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Pearson <[email protected]>
[ Upstream commit 34549e88e0a3088416177023abf1232fe40e721c ]
Replace (some) calls to pr_xxx() in rxe_net.c with rxe_dbg_xxx(). Calls with a rxe device not yet in scope are left as is.
Stable-dep-of: 8776618dbbd1 ("RDMA/rxe: Fix incorrect rxe_put in error path")
--- drivers/infiniband/sw/rxe/rxe_net.c | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-)
drivers/infiniband/sw/rxe/rxe_net.c +21 -17
@@ -20,9 +20,10 @@static struct rxe_recv_sockets recv_sockets; -static struct dst_entry *rxe_find_route4 (struct net_device *ndev, -struct in_addr *saddr, -struct in_addr *daddr) +static struct dst_entry *rxe_find_route4 (struct rxe_qp *qp, +struct net_device *ndev, +struct in_addr *saddr, +struct in_addr *daddr) {struct rtable *rt;struct flowi4 fl = { {0 } };
@@ -35,7 +36,7 @@ static struct dst_entry *rxe_find_route4(struct net_device *ndev, rt =ip_route_output_key (&init_net, &fl);if (IS_ERR (rt)) { -pr_err_ratelimited ("no route to %pI4\n" , &daddr->s_addr); +rxe_dbg_qp (qp,"no route to %pI4\n" , &daddr->s_addr);return NULL ; }
@@ -43,7 +44,8 @@ static struct dst_entry *rxe_find_route4(struct net_device *ndev, }#if IS_ENABLED (CONFIG_IPV6 ) -static struct dst_entry *rxe_find_route6 (struct net_device *ndev, +static struct dst_entry *rxe_find_route6 (struct rxe_qp *qp, +struct net_device *ndev,struct in6_addr *saddr,struct in6_addr *daddr) {
@@ -60,12 +62,12 @@ static struct dst_entry *rxe_find_route6(struct net_device *ndev, recv_sockets.sk6->sk, &fl6, NULL);if (IS_ERR (ndst)) { -pr_err_ratelimited ("no route to %pI6\n" , daddr); +rxe_dbg_qp (qp,"no route to %pI6\n" , daddr);return NULL ; }if (unlikely (ndst->error)) { -pr_err ("no route to %pI6\n" , daddr); +rxe_dbg_qp (qp,"no route to %pI6\n" , daddr); goto put; }
@@ -77,7 +79,8 @@ static struct dst_entry *rxe_find_route6(struct net_device *ndev,#else -static struct dst_entry *rxe_find_route6 (struct net_device *ndev, +static struct dst_entry *rxe_find_route6 (struct rxe_qp *qp, +struct net_device *ndev,struct in6_addr *saddr,struct in6_addr *daddr) {
@@ -105,14 +108,14 @@ static struct dst_entry *rxe_find_route(struct net_device *ndev, saddr = &av->sgid_addr._sockaddr_in.sin_addr; daddr = &av->dgid_addr._sockaddr_in.sin_addr; - dst =rxe_find_route4 (ndev, saddr, daddr); + dst =rxe_find_route4 (qp, ndev, saddr, daddr); }else if (av->network_type ==RXE_NETWORK_TYPE_IPV6 ) {struct in6_addr *saddr6;struct in6_addr *daddr6; saddr6 = &av->sgid_addr._sockaddr_in6.sin6_addr; daddr6 = &av->dgid_addr._sockaddr_in6.sin6_addr; - dst =rxe_find_route6 (ndev, saddr6, daddr6); + dst =rxe_find_route6 (qp, ndev, saddr6, daddr6);#if IS_ENABLED (CONFIG_IPV6 )if (dst) qp->dst_cookie =
@@ -285,7 +288,7 @@ static int prepare4(struct rxe_av *av, struct rxe_pkt_info *pkt, dst =rxe_find_route (skb->dev, qp, av);if (!dst) { -pr_err ("Host not reachable\n" ); +rxe_dbg_qp (qp,"Host not reachable\n" );return -EHOSTUNREACH ; }
@@ -309,7 +312,7 @@ static int prepare6(struct rxe_av *av, struct rxe_pkt_info *pkt, dst =rxe_find_route (skb->dev, qp, av);if (!dst) { -pr_err ("Host not reachable\n" ); +rxe_dbg_qp (qp,"Host not reachable\n" );return -EHOSTUNREACH ; }
@@ -368,7 +371,8 @@ static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt) }else if (skb->protocol ==htons (ETH_P_IPV6 )) { err =ip6_local_out (dev_net (skb_dst (skb)->dev), skb->sk, skb); }else { -pr_err ("Unknown layer 3 protocol: %d\n" , skb->protocol); +rxe_dbg_qp (pkt->qp,"Unknown layer 3 protocol: %d\n" , + skb->protocol);atomic_dec (&pkt->qp->skb_out);rxe_put (pkt->qp);kfree_skb (skb);
@@ -376,7 +380,7 @@ static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt) }if (unlikely (net_xmit_eval (err))) { -pr_debug ("error sending packet: %d\n" , err); +rxe_dbg_qp (pkt->qp,"error sending packet: %d\n" , err);return -EAGAIN ; }
@@ -417,7 +421,7 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,if ((is_request && (qp->req.state !=QP_STATE_READY )) || (!is_request && (qp->resp.state !=QP_STATE_READY ))) { -pr_info ("Packet dropped. QP is not in ready state\n" ); +rxe_dbg_qp (qp,"Packet dropped. QP is not in ready state\n" ); goto drop; }
@@ -598,7 +602,7 @@ static int rxe_notify(struct notifier_block *not_blk,rxe_port_down (rxe);break ;case NETDEV_CHANGEMTU : -pr_info ("%s changed mtu to %d\n" , ndev->name, ndev->mtu); +rxe_dbg (rxe,"%s changed mtu to %d\n" , ndev->name, ndev->mtu);rxe_set_mtu (rxe, ndev->mtu);break ;case NETDEV_CHANGE :
@@ -610,7 +614,7 @@ static int rxe_notify(struct notifier_block *not_blk,case NETDEV_CHANGENAME :case NETDEV_FEAT_CHANGE :default : -pr_info ("ignoring netdev event = %ld for %s\n" , +rxe_dbg (rxe,"ignoring netdev event = %ld for %s\n" , event, ndev->name);break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 247/473 RDMA/rxe: Fix incorrect rxe_put in error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Pearson <[email protected]>
[ Upstream commit 8776618dbbd1b6f210b31509507e1aad461d6435 ]
In rxe_send() a ref is taken on the qp to keep it alive until the kfree_skb() has a chance to call the skb destructor rxe_skb_tx_dtor() which drops the reference. If the packet has an incorrect protocol the error path just calls kfree_skb() which will call the destructor which will drop the ref. Currently the driver also calls rxe_put() which is incorrect. Additionally since the packets sent to rxe_send() are under the control of the driver and it only ever produces IPV4 or IPV6 packets the simplest fix is to remove all the code in this block.
--- drivers/infiniband/sw/rxe/rxe_net.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/infiniband/sw/rxe/rxe_net.c +2 -10
@@ -366,18 +366,10 @@ static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt)rxe_get (pkt->qp);atomic_inc (&pkt->qp->skb_out); -if (skb->protocol ==htons (ETH_P_IP )) { +if (skb->protocol ==htons (ETH_P_IP )) err =ip_local_out (dev_net (skb_dst (skb)->dev), skb->sk, skb); - }else if (skb->protocol ==htons (ETH_P_IPV6 )) { +else err =ip6_local_out (dev_net (skb_dst (skb)->dev), skb->sk, skb); - }else { -rxe_dbg_qp (pkt->qp,"Unknown layer 3 protocol: %d\n" , - skb->protocol); -atomic_dec (&pkt->qp->skb_out); -rxe_put (pkt->qp); -kfree_skb (skb); -return -EINVAL ; - }if (unlikely (net_xmit_eval (err))) {rxe_dbg_qp (pkt->qp,"error sending packet: %d\n" , err);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 248/473 IB/mlx5: Use __iowrite64_copy() for write combining stores
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit ef302283ddfceaba2657923af3f90fd58e6dff06 ]
mlx5 has a built in self-test at driver startup to evaluate if the platform supports write combining to generate a 64 byte PCIe TLP or not. This has proven necessary because a lot of common scenarios end up with broken write combining (especially inside virtual machines) and there is other way to learn this information.
This self test has been consistently failing on new ARM64 CPU designs (specifically with NVIDIA Grace's implementation of Neoverse V2). The C loop around writeq() generates some pretty terrible ARM64 assembly, but historically this has worked on a lot of existing ARM64 CPUs till now.
We see it succeed about 1 time in 10,000 on the worst effected systems. The CPU architects speculate that the load instructions interspersed with the stores makes the WC buffers statistically flush too often and thus the generation of large TLPs becomes infrequent. This makes the boot up test unreliable in that it indicates no write-combining, however userspace would be fine since it uses a ST4 instruction.
Further, S390 has similar issues where only the special zpci_memcpy_toio() will actually generate large TLPs, and the open coded loop does not trigger it at all.
Fix both ARM64 and S390 by switching to __iowrite64_copy() which now provides architecture specific variants that have a high change of generating a large TLP with write combining. x86 continues to use a similar writeq loop in the generate __iowrite64_copy().
--- drivers/infiniband/hw/mlx5/mem.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx5/mem.c +3 -5
@@ -30,6 +30,7 @@* SOFTWARE. */ +#include <linux/io.h> #include <rdma/ib_umem_odp.h> #include "mlx5_ib.h" #include <linux/jiffies.h>
@@ -108,7 +109,6 @@ static int post_send_nop(struct mlx5_ib_dev *dev, struct ib_qp *ibqp, u64 wr_id,__be32 mmio_wqe[16 ] = {};unsigned long flags;unsigned int idx; -int i;if (unlikely (dev->mdev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR ))return -EIO ;
@@ -148,10 +148,8 @@ static int post_send_nop(struct mlx5_ib_dev *dev, struct ib_qp *ibqp, u64 wr_id,* we hit doorbell */ wmb (); -for (i =0 ; i <8 ; i++) -mlx5_write64 (&mmio_wqe[i *2 ], - bf->bfreg->map + bf->offset + i *8 ); -io_stop_wc (); +__iowrite64_copy (bf->bfreg->map + bf->offset, mmio_wqe, +sizeof (mmio_wqe) /8 ); bf->offset ^= bf->buf_size;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 249/473 clk: renesas: r8a779a0: Fix CANFD parent clock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3b23118bdbd898dc2f4de8f549d598d492c42ba8 ]
According to Figure 52A.1 ("RS-CANFD Module Block Diagram (in classical CAN mode)") in the R-Car V3U Series User’s Manual Rev. 0.5, the parent clock for the CANFD peripheral module clock is the S3D2 clock.
--- drivers/clk/renesas/r8a779a0-cpg-mssr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/r8a779a0-cpg-mssr.c +1 -1
@@ -139,7 +139,7 @@ static const struct mssr_mod_clk r8a779a0_mod_clks[] __initconst = {DEF_MOD ("avb3" ,214 ,R8A779A0_CLK_S3D2 ),DEF_MOD ("avb4" ,215 ,R8A779A0_CLK_S3D2 ),DEF_MOD ("avb5" ,216 ,R8A779A0_CLK_S3D2 ), -DEF_MOD ("canfd0" ,328 ,R8A779A0_CLK_CANFD ), +DEF_MOD ("canfd0" ,328 ,R8A779A0_CLK_S3D2 ),DEF_MOD ("csi40" ,331 ,R8A779A0_CLK_CSI0 ),DEF_MOD ("csi41" ,400 ,R8A779A0_CLK_CSI0 ), DEF_MOD("csi42", 401, R8A779A0_CLK_CSI0),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 250/473 clk: renesas: r9a07g043: Add clock and reset entry for PLIC
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 44019387fce230beda35b83da3a2c9fc5787704e ]
Add the missing clock and reset entry for PLIC. Also add R9A07G043_NCEPLIC_ACLK to the critical clocks list.
--- drivers/clk/renesas/r9a07g043-cpg.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/clk/renesas/r9a07g043-cpg.c +9 -0
@@ -252,6 +252,10 @@ static struct rzg2l_mod_clk r9a07g043_mod_clks[] = { 0x5a8, 1), DEF_MOD("tsu_pclk", R9A07G043_TSU_PCLK, R9A07G043_CLK_TSU, 0x5ac, 0), +#ifdef CONFIG_RISCV + DEF_MOD("nceplic_aclk", R9A07G043_NCEPLIC_ACLK, R9A07G043_CLK_P1, + 0x608, 0), +#endif };static struct rzg2l_reset r9a07g043_resets[] = {
@@ -305,6 +309,10 @@ static struct rzg2l_reset r9a07g043_resets[] = {DEF_RST (R9A07G043_ADC_PRESETN ,0x8a8 ,0 ),DEF_RST (R9A07G043_ADC_ADRST_N ,0x8a8 ,1 ),DEF_RST (R9A07G043_TSU_PRESETN ,0x8ac ,0 ), +#ifdef CONFIG_RISCV + DEF_RST(R9A07G043_NCEPLIC_ARESETN, 0x908, 0), +#endif + }; static const unsigned int r9a07g043_crit_mod_clks[] __initconst = {
@@ -314,6 +322,7 @@ static const unsigned int r9a07g043_crit_mod_clks[] __initconst = {#endif #ifdef CONFIG_RISCV MOD_CLK_BASE +R9A07G043_IAX45_CLK , +MOD_CLK_BASE +R9A07G043_NCEPLIC_ACLK , #endif MOD_CLK_BASE + R9A07G043_DMAC_ACLK, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 251/473 lib/test_hmm.c: handle src_pfns and dst_pfns allocation failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit c2af060d1c18beaec56351cf9c9bcbbc5af341a3 ]
The kcalloc() in dmirror_device_evict_chunk() will return null if the physical memory has run out. As a result, if src_pfns or dst_pfns is dereferenced, the null pointer dereference bug will happen.
Moreover, the device is going away. If the kcalloc() fails, the pages mapping a chunk could not be evicted. So add a __GFP_NOFAIL flag in kcalloc().
Finally, as there is no need to have physically contiguous memory, Switch kcalloc() to kvcalloc() in order to avoid failing allocations.
--- lib/test_hmm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/test_hmm.c +4 -4
@@ -1232,8 +1232,8 @@ static void dmirror_device_evict_chunk(struct dmirror_chunk *chunk)unsigned long *src_pfns;unsigned long *dst_pfns; - src_pfns =kcalloc (npages,sizeof (*src_pfns),GFP_KERNEL ); - dst_pfns =kcalloc (npages,sizeof (*dst_pfns),GFP_KERNEL ); + src_pfns =kvcalloc (npages,sizeof (*src_pfns),GFP_KERNEL | __GFP_NOFAIL); + dst_pfns =kvcalloc (npages,sizeof (*dst_pfns),GFP_KERNEL | __GFP_NOFAIL);migrate_device_range (src_pfns, start_pfn, npages);for (i =0 ; i < npages; i++) {
@@ -1256,8 +1256,8 @@ static void dmirror_device_evict_chunk(struct dmirror_chunk *chunk) }migrate_device_pages (src_pfns, dst_pfns, npages);migrate_device_finalize (src_pfns, dst_pfns, npages); -kfree (src_pfns); -kfree (dst_pfns); +kvfree (src_pfns); +kvfree (dst_pfns); }/* Removes free pages from the free list so they can't be re-allocated */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 252/473 clk: qcom: dispcc-sm8450: fix DisplayPort clocks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit e801038a02ce1e8c652a0b668dd233a4ee48aeb7 ]
On SM8450 DisplayPort link clocks use frequency tables inherited from the vendor kernel, it is not applicable in the upstream kernel. Drop frequency tables and use clk_byte2_ops for those clocks.
This fixes frequency selection in the OPP core (which otherwise attempts
to use invalid 810 KHz as DP link rate), also fixing the following
message:
msm-dp-display ae90000.displayport-controller: _opp_config_clk_single: failed to set clock rate: -22
--- drivers/clk/qcom/dispcc-sm8450.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/clk/qcom/dispcc-sm8450.c +4 -16
@@ -309,26 +309,17 @@ static struct clk_rcg2 disp_cc_mdss_dptx0_aux_clk_src = { }, }; -static const struct freq_tbl ftbl_disp_cc_mdss_dptx0_link_clk_src[] = { -F (162000 ,P_DP0_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), -F (270000 ,P_DP0_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), -F (540000 ,P_DP0_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), -F (810000 ,P_DP0_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), - { } -}; -static struct clk_rcg2 disp_cc_mdss_dptx0_link_clk_src = { .cmd_rcgr =0x819c , .mnd_width =0 , .hid_width =5 , .parent_map = disp_cc_parent_map_3, - .freq_tbl = ftbl_disp_cc_mdss_dptx0_link_clk_src, .clkr.hw.init = &(struct clk_init_data ) { .name ="disp_cc_mdss_dptx0_link_clk_src" , .parent_data = disp_cc_parent_data_3, .num_parents =ARRAY_SIZE (disp_cc_parent_data_3), .flags =CLK_SET_RATE_PARENT , - .ops = &clk_rcg2_ops, + .ops = &clk_byte2_ops, }, };
@@ -382,13 +373,12 @@ static struct clk_rcg2 disp_cc_mdss_dptx1_link_clk_src = { .mnd_width = 0, .hid_width = 5, .parent_map = disp_cc_parent_map_3, - .freq_tbl = ftbl_disp_cc_mdss_dptx0_link_clk_src, .clkr.hw.init = &(struct clk_init_data ) { .name ="disp_cc_mdss_dptx1_link_clk_src" , .parent_data = disp_cc_parent_data_3, .num_parents =ARRAY_SIZE (disp_cc_parent_data_3), .flags =CLK_SET_RATE_PARENT , - .ops = &clk_rcg2_ops, + .ops = &clk_byte2_ops, }, };
@@ -442,13 +432,12 @@ static struct clk_rcg2 disp_cc_mdss_dptx2_link_clk_src = { .mnd_width = 0, .hid_width = 5, .parent_map = disp_cc_parent_map_3, - .freq_tbl = ftbl_disp_cc_mdss_dptx0_link_clk_src, .clkr.hw.init = &(struct clk_init_data ) { .name ="disp_cc_mdss_dptx2_link_clk_src" , .parent_data = disp_cc_parent_data_3, .num_parents =ARRAY_SIZE (disp_cc_parent_data_3), .flags =CLK_SET_RATE_PARENT , - .ops = &clk_rcg2_ops, + .ops = &clk_byte2_ops, }, };
@@ -502,13 +491,12 @@ static struct clk_rcg2 disp_cc_mdss_dptx3_link_clk_src = { .mnd_width = 0, .hid_width = 5, .parent_map = disp_cc_parent_map_3, - .freq_tbl = ftbl_disp_cc_mdss_dptx0_link_clk_src, .clkr.hw.init = &(struct clk_init_data ) { .name ="disp_cc_mdss_dptx3_link_clk_src" , .parent_data = disp_cc_parent_data_3, .num_parents =ARRAY_SIZE (disp_cc_parent_data_3), .flags =CLK_SET_RATE_PARENT , - .ops = &clk_rcg2_ops, + .ops = &clk_byte2_ops, }, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 253/473 clk: qcom: dispcc-sm6350: fix DisplayPort clocks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1113501cfb46d5c0eb960f0a8a9f6c0f91dc6fb6 ]
On SM6350 DisplayPort link clocks use frequency tables inherited from the vendor kernel, it is not applicable in the upstream kernel. Drop frequency tables and use clk_byte2_ops for those clocks.
This fixes frequency selection in the OPP core (which otherwise attempts
to use invalid 810 KHz as DP link rate), also fixing the following
message:
msm-dp-display ae90000.displayport-controller: _opp_config_clk_single: failed to set clock rate: -22
--- drivers/clk/qcom/dispcc-sm6350.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/clk/qcom/dispcc-sm6350.c +1 -10
@@ -221,26 +221,17 @@ static struct clk_rcg2 disp_cc_mdss_dp_crypto_clk_src = { }, }; -static const struct freq_tbl ftbl_disp_cc_mdss_dp_link_clk_src[] = { -F (162000 ,P_DP_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), -F (270000 ,P_DP_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), -F (540000 ,P_DP_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), -F (810000 ,P_DP_PHY_PLL_LINK_CLK ,1 ,0 ,0 ), - { } -}; -static struct clk_rcg2 disp_cc_mdss_dp_link_clk_src = { .cmd_rcgr =0x10f8 , .mnd_width =0 , .hid_width =5 , .parent_map = disp_cc_parent_map_0, - .freq_tbl = ftbl_disp_cc_mdss_dp_link_clk_src, .clkr.hw.init = &(struct clk_init_data ){ .name ="disp_cc_mdss_dp_link_clk_src" , .parent_data = disp_cc_parent_data_0, .num_parents =ARRAY_SIZE (disp_cc_parent_data_0), .flags =CLK_SET_RATE_PARENT |CLK_GET_RATE_NOCACHE , - .ops = &clk_rcg2_ops, + .ops = &clk_byte2_ops, }, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 254/473 clk: qcom: mmcc-msm8998: fix venus clock issue
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Gonzalez <[email protected]>
[ Upstream commit e20ae5ae9f0c843aded4f06f3d1cab7384789e92 ]
Right now, msm8998 video decoder (venus) is non-functional:
$ time mpv --hwdec=v4l2m2m-copy --vd-lavc-software-fallback=no --vo=null --no-audio --untimed --length=30 --quiet demo-480.webm
(+) Video --vid=1 (*) (vp9 854x480 29.970fps)
Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
[ffmpeg/video] vp9_v4l2m2m: output VIDIOC_REQBUFS failed: Connection timed out
[ffmpeg/video] vp9_v4l2m2m: no v4l2 output context's buffers
[ffmpeg/video] vp9_v4l2m2m: can't configure decoder
Could not open codec.
Software decoding fallback is disabled.
Exiting... (Quit)Bryan O'Donoghue suggested the proper fix:
- Set required register offsets in venus GDSC structs.
- Set HW_CTRL flag.
$ time mpv --hwdec=v4l2m2m-copy --vd-lavc-software-fallback=no --vo=null --no-audio --untimed --length=30 --quiet demo-480.webm
(+) Video --vid=1 (*) (vp9 854x480 29.970fps)
Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
[ffmpeg/video] vp9_v4l2m2m: VIDIOC_G_FMT ioctl
[ffmpeg/video] vp9_v4l2m2m: VIDIOC_G_FMT ioctl
...
Using hardware decoding (v4l2m2m-copy).
VO: [null] 854x480 nv12
Exiting... (End of file)
real 0m3.315s
user 0m1.277s
sys 0m0.453sNOTES:
GDSC = Globally Distributed Switch Controller
Use same code as mmcc-msm8996 with:
s/venus_gdsc/video_top_gdsc/
s/venus_core0_gdsc/video_subcore0_gdsc/
s/venus_core1_gdsc/video_subcore1_gdsc/
https://git.codelinaro.org/clo/la/kernel/msm-4.4/-/blob/caf_migration/kernel.lnx.4.4.r38-rel/include/dt-bindings/clock/msm-clocks-hwio-8996.h
https://git.codelinaro.org/clo/la/kernel/msm-4.4/-/blob/caf_migration/kernel.lnx.4.4.r38-rel/include/dt-bindings/clock/msm-clocks-hwio-8998.h
0x1024 = MMSS_VIDEO GDSCR (undocumented)0x1028 = MMSS_VIDEO_CORE_CBCR0x1030 = MMSS_VIDEO_AHB_CBCR0x1034 = MMSS_VIDEO_AXI_CBCR0x1038 = MMSS_VIDEO_MAXI_CBCR0x1040 = MMSS_VIDEO_SUBCORE0 GDSCR (undocumented)0x1044 = MMSS_VIDEO_SUBCORE1 GDSCR (undocumented)0x1048 = MMSS_VIDEO_SUBCORE0_CBCR0x104c = MMSS_VIDEO_SUBCORE1_CBCR
--- drivers/clk/qcom/mmcc-msm8998.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/qcom/mmcc-msm8998.c +8 -0
@@ -2578,6 +2578,8 @@ static struct clk_hw *mmcc_msm8998_hws[] = {static struct gdsc video_top_gdsc = { .gdscr =0x1024 , + .cxcs = (unsigned int []){0x1028 ,0x1034 ,0x1038 }, + .cxc_count =3 , .pd = { .name ="video_top" , },
@@ -2586,20 +2588,26 @@ static struct gdsc video_top_gdsc = {static struct gdsc video_subcore0_gdsc = { .gdscr =0x1040 , + .cxcs = (unsigned int []){0x1048 }, + .cxc_count =1 , .pd = { .name ="video_subcore0" , }, .parent = &video_top_gdsc.pd, .pwrsts =PWRSTS_OFF_ON , + .flags =HW_CTRL , };static struct gdsc video_subcore1_gdsc = { .gdscr =0x1044 , + .cxcs = (unsigned int []){0x104c }, + .cxc_count =1 , .pd = { .name ="video_subcore1" , }, .parent = &video_top_gdsc.pd, .pwrsts =PWRSTS_OFF_ON , + .flags =HW_CTRL , };static struct gdsc mdss_gdsc = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 255/473 x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit 59162e0c11d7257cde15f907d19fefe26da66692 ]
The x86 instruction decoder is used not only for decoding kernel instructions. It is also used by perf uprobes (user space probes) and by perf tools Intel Processor Trace decoding. Consequently, it needs to support instructions executed by user space also.
Opcode 0x68 PUSH instruction is currently defined as 64-bit operand size only i.e. (d64). That was based on Intel SDM Opcode Map. However that is contradicted by the Instruction Set Reference section for PUSH in the same manual.
Remove 64-bit operand size only annotation from opcode 0x68 PUSH instruction.
Example:
$ cat pushw.s
.global _start
.text
_start:
pushw $0x1234
mov $0x1,%eax # system call number (sys_exit)
int $0x80
$ as -o pushw.o pushw.s
$ ld -s -o pushw pushw.o
$ objdump -d pushw | tail -4
0000000000401000 <.text>:
401000: 66 68 34 12 pushw $0x1234
401004: b8 01 00 00 00 mov $0x1,%eax
401009: cd 80 int $0x80
$ perf record -e intel_pt//u ./pushw
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.014 MB perf.data ]Before:
$ perf script --insn-trace=disasm
Warning:
1 instruction trace errors
pushw 10349 [000] 10586.869237014: 401000 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) pushw $0x1234
pushw 10349 [000] 10586.869237014: 401006 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) addb %al, (%rax)
pushw 10349 [000] 10586.869237014: 401008 [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) addb %cl, %ch
pushw 10349 [000] 10586.869237014: 40100a [unknown] (/home/ahunter/git/misc/rtit-tests/pushw) addb $0x2e, (%rax)
instruction trace error type 1 time 10586.869237224 cpu 0 pid 10349 tid 10349 ip 0x40100d code 6: Trace doesn't match instructionAfter:
$ perf script --insn-trace=disasm
pushw 10349 [000] 10586.869237014: 401000 [unknown] (./pushw) pushw $0x1234
pushw 10349 [000] 10586.869237014: 401004 [unknown] (./pushw) movl $1, %eax--- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/arch/x86/lib/x86-opcode-map.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -148,7 +148,7 @@ AVXcode: 65: SEG=GS (Prefix) 66: Operand-Size (Prefix) 67: Address-Size (Prefix) -68: PUSH Iz (d64) +68: PUSH Iz 69: IMUL Gv,Ev,Iz 6a: PUSH Ib (d64) 6b: IMUL Gv,Ev,Ib
tools/arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -148,7 +148,7 @@ AVXcode: 65: SEG=GS (Prefix) 66: Operand-Size (Prefix) 67: Address-Size (Prefix) -68: PUSH Iz (d64) +68: PUSH Iz 69: IMUL Gv,Ev,Iz 6a: PUSH Ib (d64) 6b: IMUL Gv,Ev,Ib
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 256/473 x86/insn: Add VEX versions of VPDPBUSD, VPDPBUSDS, VPDPWSSD and VPDPWSSDS
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit b8000264348979b60dbe479255570a40e1b3a097 ]
The x86 instruction decoder is used not only for decoding kernel instructions. It is also used by perf uprobes (user space probes) and by perf tools Intel Processor Trace decoding. Consequently, it needs to support instructions executed by user space also.
Intel Architecture Instruction Set Extensions and Future Features manual number 319433-044 of May 2021, documented VEX versions of instructions VPDPBUSD, VPDPBUSDS, VPDPWSSD and VPDPWSSDS, but the opcode map has them listed as EVEX only.
Remove EVEX-only (ev) annotation from instructions VPDPBUSD, VPDPBUSDS, VPDPWSSD and VPDPWSSDS, which allows them to be decoded with either a VEX or EVEX prefix.
--- arch/x86/lib/x86-opcode-map.txt | 8 ++++---- tools/arch/x86/lib/x86-opcode-map.txt | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
arch/x86/lib/x86-opcode-map.txt +4 -4
@@ -698,10 +698,10 @@ AVXcode: 2 4d: vrcp14ss/d Vsd,Hpd,Wsd (66),(ev) 4e: vrsqrt14ps/d Vpd,Wpd (66),(ev) 4f: vrsqrt14ss/d Vsd,Hsd,Wsd (66),(ev) -50: vpdpbusd Vx,Hx,Wx (66),(ev) -51: vpdpbusds Vx,Hx,Wx (66),(ev) -52: vdpbf16ps Vx,Hx,Wx (F3),(ev) | vpdpwssd Vx,Hx,Wx (66),(ev) | vp4dpwssd Vdqq,Hdqq,Wdq (F2),(ev) -53: vpdpwssds Vx,Hx,Wx (66),(ev) | vp4dpwssds Vdqq,Hdqq,Wdq (F2),(ev) +50: vpdpbusd Vx,Hx,Wx (66) +51: vpdpbusds Vx,Hx,Wx (66) +52: vdpbf16ps Vx,Hx,Wx (F3),(ev) | vpdpwssd Vx,Hx,Wx (66) | vp4dpwssd Vdqq,Hdqq,Wdq (F2),(ev) +53: vpdpwssds Vx,Hx,Wx (66) | vp4dpwssds Vdqq,Hdqq,Wdq (F2),(ev) 54: vpopcntb/w Vx,Wx (66),(ev) 55: vpopcntd/q Vx,Wx (66),(ev) 58: vpbroadcastd Vx,Wx (66),(v)
tools/arch/x86/lib/x86-opcode-map.txt +4 -4
@@ -698,10 +698,10 @@ AVXcode: 2 4d: vrcp14ss/d Vsd,Hpd,Wsd (66),(ev) 4e: vrsqrt14ps/d Vpd,Wpd (66),(ev) 4f: vrsqrt14ss/d Vsd,Hsd,Wsd (66),(ev) -50: vpdpbusd Vx,Hx,Wx (66),(ev) -51: vpdpbusds Vx,Hx,Wx (66),(ev) -52: vdpbf16ps Vx,Hx,Wx (F3),(ev) | vpdpwssd Vx,Hx,Wx (66),(ev) | vp4dpwssd Vdqq,Hdqq,Wdq (F2),(ev) -53: vpdpwssds Vx,Hx,Wx (66),(ev) | vp4dpwssds Vdqq,Hdqq,Wdq (F2),(ev) +50: vpdpbusd Vx,Hx,Wx (66) +51: vpdpbusds Vx,Hx,Wx (66) +52: vdpbf16ps Vx,Hx,Wx (F3),(ev) | vpdpwssd Vx,Hx,Wx (66) | vp4dpwssd Vdqq,Hdqq,Wdq (F2),(ev) +53: vpdpwssds Vx,Hx,Wx (66) | vp4dpwssds Vdqq,Hdqq,Wdq (F2),(ev) 54: vpopcntb/w Vx,Wx (66),(ev) 55: vpopcntd/q Vx,Wx (66),(ev) 58: vpbroadcastd Vx,Wx (66),(v)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 257/473 ext4: avoid excessive credit estimate in ext4_tmpfile()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 35a1f12f0ca857fee1d7a04ef52cbd5f1f84de13 ]
A user with minimum journal size (1024 blocks these days) complained about the following error triggered by generic/697 test in ext4_tmpfile():
run fstests generic/697 at 2024-02-28 05:34:46
JBD2: vfstest wants too many credits credits:260 rsv_credits:0 max:256 EXT4-fs error (device loop0) in __ext4_new_inode:1083: error 28
Indeed the credit estimate in ext4_tmpfile() is huge. EXT4_MAXQUOTAS_INIT_BLOCKS() is 219, then 10 credits from ext4_tmpfile() itself and then ext4_xattr_credits_for_new_inode() adds more credits needed for security attributes and ACLs. Now the EXT4_MAXQUOTAS_INIT_BLOCKS() is in fact unnecessary because we've already initialized quotas with dquot_init() shortly before and so EXT4_MAXQUOTAS_TRANS_BLOCKS() is enough (which boils down to 3 credits).
--- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
@@ -2901,7 +2901,7 @@ static int ext4_tmpfile(struct user_namespace *mnt_userns, struct inode *dir, inode =ext4_new_inode_start_handle (mnt_userns, dir, mode,NULL ,0 ,NULL ,EXT4_HT_DIR , -EXT4_MAXQUOTAS_INIT_BLOCKS (dir->i_sb) + +EXT4_MAXQUOTAS_TRANS_BLOCKS (dir->i_sb) +4 +EXT4_XATTR_TRANS_BLOCKS ); handle =ext4_journal_current_handle (); err =PTR_ERR (inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 258/473 virt: acrn: stop using follow_pfn
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 1b265da7ea1e1ae997fa119c2846bb389eb39c6b ]
Patch series "remove follow_pfn".
This series open codes follow_pfn in the only remaining caller, although the code there remains questionable. It then also moves follow_phys into the only user and simplifies it a bit.
This patch (of 3):
Switch from follow_pfn to follow_pte so that we can get rid of follow_pfn. Note that this doesn't fix any of the pre-existing raciness and lack of permission checking in the code.
Stable-dep-of: 3d6586008f7b ("drivers/virt/acrn: fix PFNMAP PTE checks in acrn_vm_ram_map()")
--- drivers/virt/acrn/mm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/virt/acrn/mm.c +8 -2
@@ -171,18 +171,24 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap)mmap_read_lock (current->mm); vma =vma_lookup (current->mm, memmap->vma_base);if (vma && ((vma->vm_flags &VM_PFNMAP ) !=0 )) { +spinlock_t *ptl; +pte_t *ptep; +if ((memmap->vma_base + memmap->len) > vma->vm_end) {mmap_read_unlock (current->mm);return -EINVAL ; } - ret =follow_pfn (vma, memmap->vma_base, &pfn); -mmap_read_unlock (current->mm); + ret =follow_pte (vma->vm_mm, memmap->vma_base, &ptep, &ptl);if (ret <0 ) { +mmap_read_unlock (current->mm);dev_dbg (acrn_dev.this_device,"Failed to lookup PFN at VMA:%pK.\n" , (void *)memmap->vma_base);return ret; } + pfn =pte_pfn (ptep_get (ptep)); +pte_unmap_unlock (ptep, ptl); +mmap_read_unlock (current->mm); return acrn_mm_region_add(vm, memmap->user_vm_pa, PFN_PHYS(pfn), memmap->len,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 259/473 drivers/virt/acrn: fix PFNMAP PTE checks in acrn_vm_ram_map()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 3d6586008f7b638f91f3332602592caa8b00b559 ]
Patch series "mm: follow_pte() improvements and acrn follow_pte() fixes".
Patch #1 fixes a bunch of issues I spotted in the acrn driver. It compiles, that's all I know. I'll appreciate some review and testing from acrn folks.
Patch #2+#3 improve follow_pte(), passing a VMA instead of the MM, adding more sanity checks, and improving the documentation. Gave it a quick test on x86-64 using VM_PAT that ends up using follow_pte().
This patch (of 3):
We currently miss handling various cases, resulting in a dangerous follow_pte() (previously follow_pfn()) usage.
(1) We're not checking PTE write permissions.
Maybe we should simply always require pte_write() like we do for pin_user_pages_fast(FOLL_WRITE)? Hard to tell, so let's check for ACRN_MEM_ACCESS_WRITE for now.
(2) We're not rejecting refcounted pages.
As we are not using MMU notifiers, messing with refcounted pages is dangerous and can result in use-after-free. Let's make sure to reject them.
(3) We are only looking at the first PTE of a bigger range.
We only lookup a single PTE, but memmap->len may span a larger area. Let's loop over all involved PTEs and make sure the PFN range is actually contiguous. Reject everything else: it couldn't have worked either way, and rather made use access PFNs we shouldn't be accessing.
--- drivers/virt/acrn/mm.c | 63 +++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 16 deletions(-)
drivers/virt/acrn/mm.c +47 -16
@@ -155,23 +155,29 @@ int acrn_vm_memseg_unmap(struct acrn_vm *vm, struct acrn_vm_memmap *memmap)int acrn_vm_ram_map (struct acrn_vm *vm,struct acrn_vm_memmap *memmap) {struct vm_memory_region_batch *regions_info; -int nr_pages, i =0 , order, nr_regions =0 ; +int nr_pages, i, order, nr_regions =0 ;struct vm_memory_mapping *region_mapping;struct vm_memory_region_op *vm_region;struct page **pages =NULL , *page;void *remap_vaddr;int ret, pinned;u64 user_vm_pa; -unsigned long pfn;struct vm_area_struct *vma;if (!vm || !memmap)return -EINVAL ; +/* Get the page number of the map region */ + nr_pages = memmap->len >>PAGE_SHIFT ; +if (!nr_pages) +return -EINVAL ; +mmap_read_lock (current->mm); vma =vma_lookup (current->mm, memmap->vma_base);if (vma && ((vma->vm_flags &VM_PFNMAP ) !=0 )) { +unsigned long start_pfn, cur_pfn;spinlock_t *ptl; +bool writable;pte_t *ptep;if ((memmap->vma_base + memmap->len) > vma->vm_end) {
@@ -179,25 +185,53 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap)return -EINVAL ; } - ret =follow_pte (vma->vm_mm, memmap->vma_base, &ptep, &ptl); -if (ret <0 ) { -mmap_read_unlock (current->mm); +for (i =0 ; i < nr_pages; i++) { + ret =follow_pte (vma->vm_mm, + memmap->vma_base + i *PAGE_SIZE , + &ptep, &ptl); +if (ret) +break ; + + cur_pfn =pte_pfn (ptep_get (ptep)); +if (i ==0 ) + start_pfn = cur_pfn; + writable = !!pte_write (ptep_get (ptep)); +pte_unmap_unlock (ptep, ptl); + +/* Disallow write access if the PTE is not writable. */ +if (!writable && + (memmap->attr &ACRN_MEM_ACCESS_WRITE )) { + ret = -EFAULT ; +break ; + } + +/* Disallow refcounted pages. */ +if (pfn_valid (cur_pfn) && + !PageReserved (pfn_to_page (cur_pfn))) { + ret = -EFAULT ; +break ; + } + +/* Disallow non-contiguous ranges. */ +if (cur_pfn != start_pfn + i) { + ret = -EINVAL ; +break ; + } + } +mmap_read_unlock (current->mm); + +if (ret) {dev_dbg (acrn_dev.this_device,"Failed to lookup PFN at VMA:%pK.\n" , (void *)memmap->vma_base);return ret; } - pfn =pte_pfn (ptep_get (ptep)); -pte_unmap_unlock (ptep, ptl); -mmap_read_unlock (current->mm);return acrn_mm_region_add (vm, memmap->user_vm_pa, -PFN_PHYS (pfn), memmap->len, +PFN_PHYS (start_pfn), memmap->len,ACRN_MEM_TYPE_WB , memmap->attr); }mmap_read_unlock (current->mm); -/* Get the page number of the map region */ - nr_pages = memmap->len >>PAGE_SHIFT ; pages =vzalloc (array_size (nr_pages,sizeof (*pages)));if (!pages)return -ENOMEM ;
@@ -241,12 +275,11 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap)mutex_unlock (&vm->regions_mapping_lock);/* Calculate count of vm_memory_region_op */ -while (i < nr_pages) { +for (i =0 ; i < nr_pages; i +=1 << order) { page = pages[i];VM_BUG_ON_PAGE (PageTail (page), page); order =compound_order (page); nr_regions++; - i +=1 << order; }/* Prepare the vm_memory_region_batch */
@@ -263,8 +296,7 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap) regions_info->regions_num = nr_regions; regions_info->regions_gpa =virt_to_phys (vm_region); user_vm_pa = memmap->user_vm_pa; - i =0 ; -while (i < nr_pages) { +for (i =0 ; i < nr_pages; i +=1 << order) {u32 region_size; page = pages[i];
@@ -280,7 +312,6 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap) vm_region++; user_vm_pa += region_size; - i +=1 << order; }/* Inform the ACRN Hypervisor to set up EPT mappings */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 260/473 sunrpc: removed redundant procp check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Aprelkov <[email protected]>
[ Upstream commit a576f36971ab4097b6aa76433532aa1fb5ee2d3b ]
since vs_proc pointer is dereferenced before getting it's address there's no need to check for NULL.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/sunrpc/svc.c | 2 -- 1 file changed, 2 deletions(-)
net/sunrpc/svc.c +0 -2
@@ -1205,8 +1205,6 @@ svc_generic_init_request(struct svc_rqst *rqstp,if (rqstp->rq_proc >= versp->vs_nproc) goto err_bad_proc; rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc]; -if (!procp) - goto err_bad_proc;/* Initialize storage for argp and resp */ memset (rqstp->rq_argp,0 , procp->pc_argzero);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 261/473 ext4: simplify calculation of blkoff in ext4_mb_new_blocks_simple
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit 253cacb0de89235673ad5889d61f275a73dbee79 ]
We try to allocate a block from goal in ext4_mb_new_blocks_simple. We only need get blkoff in first group with goal and set blkoff to 0 for the rest groups.
Stable-dep-of: 3f4830abd236 ("ext4: fix potential unnitialized variable")
--- fs/ext4/mballoc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/ext4/mballoc.c +2 -3
@@ -5896,9 +5896,6 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,return 0 ; } -ext4_get_group_no_and_offset (sb, -max (ext4_group_first_block_no (sb, group), goal), -NULL , &blkoff);while (1 ) { i =mb_find_next_zero_bit (bitmap_bh->b_data, max, blkoff);
@@ -5913,6 +5910,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,brelse (bitmap_bh);if (i < max)break ; + + blkoff =0 ; }if (group >=ext4_get_groups_count (sb) || i >= max) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 262/473 ext4: fix unit mismatch in ext4_mb_new_blocks_simple
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit 497885f72d930305d8e61b6b616b22b4da1adf90 ]
The "i" returned from mb_find_next_zero_bit is in cluster unit and we need offset "block" corresponding to "i" in block unit. Convert "i" to block unit to fix the unit mismatch.
Stable-dep-of: 3f4830abd236 ("ext4: fix potential unnitialized variable")
--- fs/ext4/mballoc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext4/mballoc.c +4 -2
@@ -5874,6 +5874,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle, {struct buffer_head *bitmap_bh;struct super_block *sb = ar->inode->i_sb; +struct ext4_sb_info *sbi =EXT4_SB (sb);ext4_group_t group;ext4_grpblk_t blkoff;ext4_grpblk_t max =EXT4_CLUSTERS_PER_GROUP (sb);
@@ -5902,7 +5903,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,if (i >= max)break ;if (ext4_fc_replay_check_excluded (sb, -ext4_group_first_block_no (sb, group) + i)) { +ext4_group_first_block_no (sb, group) + +EXT4_C2B (sbi, i))) { blkoff = i +1 ; }else break ;
@@ -5919,7 +5921,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,return 0 ; } - block =ext4_group_first_block_no (sb, group) + i; + block =ext4_group_first_block_no (sb, group) +EXT4_C2B (sbi, i);ext4_mb_mark_bb (sb, block,1 ,1 ); ar->len =1 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 263/473 ext4: try all groups in ext4_mb_new_blocks_simple
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit 19a043bb1fd1b5cb2652ca33536c55e6c0a70df0 ]
ext4_mb_new_blocks_simple ignores the group before goal, so it will fail if free blocks reside in group before goal. Try all groups to avoid unexpected failure.
Search finishes either if any free block is found or if no available blocks are found. Simpliy check "i >= max" to distinguish the above cases.
Stable-dep-of: 3f4830abd236 ("ext4: fix potential unnitialized variable")
--- fs/ext4/mballoc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ext4/mballoc.c +6 -3
@@ -5875,7 +5875,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,struct buffer_head *bitmap_bh;struct super_block *sb = ar->inode->i_sb;struct ext4_sb_info *sbi =EXT4_SB (sb); -ext4_group_t group; +ext4_group_t group, nr;ext4_grpblk_t blkoff;ext4_grpblk_t max =EXT4_CLUSTERS_PER_GROUP (sb);ext4_grpblk_t i =0 ;
@@ -5889,7 +5889,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle, ar->len =0 ;ext4_get_group_no_and_offset (sb, goal, &group, &blkoff); -for (; group <ext4_get_groups_count (sb); group++) { +for (nr =ext4_get_groups_count (sb); nr >0 ; nr--) { bitmap_bh =ext4_read_block_bitmap (sb, group);if (IS_ERR (bitmap_bh)) { *errp =PTR_ERR (bitmap_bh);
@@ -5913,10 +5913,13 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,if (i < max)break ; +if (++group >=ext4_get_groups_count (sb)) + group =0 ; + blkoff =0 ; } -if (group >=ext4_get_groups_count (sb) || i >= max) { +if (i >= max) { *errp = -ENOSPC ;return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 264/473 ext4: remove unused parameter from ext4_mb_new_blocks_simple()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit ad78b5efe4246e5deba8d44a6ed172b8a00d3113 ]
Two cleanups for ext4_mb_new_blocks_simple:
Remove unused parameter handle of ext4_mb_new_blocks_simple. Move ext4_mb_new_blocks_simple definition before ext4_mb_new_blocks to remove unnecessary forward declaration of ext4_mb_new_blocks_simple.
Stable-dep-of: 3f4830abd236 ("ext4: fix potential unnitialized variable")
--- fs/ext4/mballoc.c | 137 +++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 70 deletions(-)
fs/ext4/mballoc.c +67 -70
@@ -5608,8 +5608,72 @@ static bool ext4_mb_discard_preallocations_should_retry(struct super_block *sb,return ret; } -static ext4_fsblk_t ext4_mb_new_blocks_simple (handle_t *handle, -struct ext4_allocation_request *ar,int *errp); +/* +* Simple allocator for Ext4 fast commit replay path. It searches for blocks +* linearly starting at the goal block and also excludes the blocks which +* are going to be in use after fast commit replay. +*/ +static ext4_fsblk_t +ext4_mb_new_blocks_simple (struct ext4_allocation_request *ar,int *errp) +{ +struct buffer_head *bitmap_bh; +struct super_block *sb = ar->inode->i_sb; +struct ext4_sb_info *sbi =EXT4_SB (sb); +ext4_group_t group, nr; +ext4_grpblk_t blkoff; +ext4_grpblk_t max =EXT4_CLUSTERS_PER_GROUP (sb); +ext4_grpblk_t i =0 ; +ext4_fsblk_t goal, block; +struct ext4_super_block *es =EXT4_SB (sb)->s_es; + + goal = ar->goal; +if (goal <le32_to_cpu (es->s_first_data_block) || + goal >=ext4_blocks_count (es)) + goal =le32_to_cpu (es->s_first_data_block); + + ar->len =0 ; +ext4_get_group_no_and_offset (sb, goal, &group, &blkoff); +for (nr =ext4_get_groups_count (sb); nr >0 ; nr--) { + bitmap_bh =ext4_read_block_bitmap (sb, group); +if (IS_ERR (bitmap_bh)) { + *errp =PTR_ERR (bitmap_bh); +pr_warn ("Failed to read block bitmap\n" ); +return 0 ; + } + +while (1 ) { + i =mb_find_next_zero_bit (bitmap_bh->b_data, max, + blkoff); +if (i >= max) +break ; +if (ext4_fc_replay_check_excluded (sb, +ext4_group_first_block_no (sb, group) + +EXT4_C2B (sbi, i))) { + blkoff = i +1 ; + }else +break ; + } +brelse (bitmap_bh); +if (i < max) +break ; + +if (++group >=ext4_get_groups_count (sb)) + group =0 ; + + blkoff =0 ; + } + +if (i >= max) { + *errp = -ENOSPC ; +return 0 ; + } + + block =ext4_group_first_block_no (sb, group) +EXT4_C2B (sbi, i); +ext4_mb_mark_bb (sb, block,1 ,1 ); + ar->len =1 ; + +return block; +}/* * Main entry point into mballoc to allocate blocks
@@ -5634,7 +5698,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,trace_ext4_request_blocks (ar);if (sbi->s_mount_state &EXT4_FC_REPLAY ) -return ext4_mb_new_blocks_simple (handle, ar, errp); +return ext4_mb_new_blocks_simple (ar, errp);/* Allow to use superuser reservation for quota file */ if (ext4_is_quota_file (ar->inode))
@@ -5864,73 +5928,6 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,return 0 ; } -/* -* Simple allocator for Ext4 fast commit replay path. It searches for blocks -* linearly starting at the goal block and also excludes the blocks which -* are going to be in use after fast commit replay. -*/ -static ext4_fsblk_t ext4_mb_new_blocks_simple (handle_t *handle, -struct ext4_allocation_request *ar,int *errp) -{ -struct buffer_head *bitmap_bh; -struct super_block *sb = ar->inode->i_sb; -struct ext4_sb_info *sbi =EXT4_SB (sb); -ext4_group_t group, nr; -ext4_grpblk_t blkoff; -ext4_grpblk_t max =EXT4_CLUSTERS_PER_GROUP (sb); -ext4_grpblk_t i =0 ; -ext4_fsblk_t goal, block; -struct ext4_super_block *es =EXT4_SB (sb)->s_es; - - goal = ar->goal; -if (goal <le32_to_cpu (es->s_first_data_block) || - goal >=ext4_blocks_count (es)) - goal =le32_to_cpu (es->s_first_data_block); - - ar->len =0 ; -ext4_get_group_no_and_offset (sb, goal, &group, &blkoff); -for (nr =ext4_get_groups_count (sb); nr >0 ; nr--) { - bitmap_bh =ext4_read_block_bitmap (sb, group); -if (IS_ERR (bitmap_bh)) { - *errp =PTR_ERR (bitmap_bh); -pr_warn ("Failed to read block bitmap\n" ); -return 0 ; - } - -while (1 ) { - i =mb_find_next_zero_bit (bitmap_bh->b_data, max, - blkoff); -if (i >= max) -break ; -if (ext4_fc_replay_check_excluded (sb, -ext4_group_first_block_no (sb, group) + -EXT4_C2B (sbi, i))) { - blkoff = i +1 ; - }else -break ; - } -brelse (bitmap_bh); -if (i < max) -break ; - -if (++group >=ext4_get_groups_count (sb)) - group =0 ; - - blkoff =0 ; - } - -if (i >= max) { - *errp = -ENOSPC ; -return 0 ; - } - - block =ext4_group_first_block_no (sb, group) +EXT4_C2B (sbi, i); -ext4_mb_mark_bb (sb, block,1 ,1 ); - ar->len =1 ; - -return block; -} -static void ext4_free_blocks_simple (struct inode *inode,ext4_fsblk_t block,unsigned long count) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 265/473 ext4: fix potential unnitialized variable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 3f4830abd236d0428e50451e1ecb62e14c365e9b ]
Smatch complains "err" can be uninitialized in the caller.
fs/ext4/indirect.c:349 ext4_alloc_branch()
error: uninitialized symbol 'err'.
Set the error to zero on the success path.
--- fs/ext4/mballoc.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/mballoc.c +1 -0
@@ -5672,6 +5672,7 @@ ext4_mb_new_blocks_simple(struct ext4_allocation_request *ar, int *errp)ext4_mb_mark_bb (sb, block,1 ,1 ); ar->len =1 ; + *errp =0 ;return block; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 266/473 SUNRPC: Fix gss_free_in_token_pages()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit bafa6b4d95d97877baa61883ff90f7e374427fae ]
Dan Carpenter says:
Quoted 19 lines
Commit
5866efa8cbfb("SUNRPC: Fixsvcauth_gss_proxy_init()") from Oct 24, 2019 (linux-next), leads to the following Smatch static checker warning:net/sunrpc/auth_gss/svcauth_gss.c:1039 gss_free_in_token_pages() warn: iterator 'i' not incremented
net/sunrpc/auth_gss/svcauth_gss.c1034 static void gss_free_in_token_pages(struct gssp_in_token *in_token) 1035 { 1036 u32 inlen; 1037 int i; 1038 --> 1039 i = 0; 1040 inlen = in_token->page_len; 1041 while (inlen) { 1042 if (in_token->pages[i]) 1043 put_page(in_token->pages[i]); ^
Quoted 8 lines
This puts page zero over and over.
1044 inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen; 1045 } 1046 1047 kfree(in_token->pages); 1048 in_token->pages = NULL; 1049 }
Based on the way that the ->pages[] array is constructed in gss_read_proxy_verf(), we know that once the loop encounters a NULL page pointer, the remaining array elements must also be NULL.
--- net/sunrpc/auth_gss/svcauth_gss.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c +2 -8
@@ -1132,17 +1132,11 @@ gss_read_verf(struct rpc_gss_wire_cred *gc,static void gss_free_in_token_pages (struct gssp_in_token *in_token) { -u32 inlen;int i; i =0 ; - inlen = in_token->page_len; -while (inlen) { -if (in_token->pages[i]) -put_page (in_token->pages[i]); - inlen -= inlen >PAGE_SIZE ?PAGE_SIZE : inlen; - } - +while (in_token->pages[i]) +put_page (in_token->pages[i++]);kfree (in_token->pages); in_token->pages =NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 267/473 selftests/kcmp: remove unused open mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Liaw <[email protected]>
[ Upstream commit eb59a58113717df04b8a8229befd8ab1e5dbf86e ]
Android bionic warns that open modes are ignored if O_CREAT or O_TMPFILE aren't specified. The permissions for the file are set above:
fd1 = open(kpath, O_RDWR | O_CREAT | O_TRUNC, 0644);
--- tools/testing/selftests/kcmp/kcmp_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kcmp/kcmp_test.c +1 -1
@@ -91,7 +91,7 @@ int main(int argc, char **argv)ksft_print_header ();ksft_set_plan (3 ); - fd2 =open (kpath,O_RDWR ,0644 ); + fd2 =open (kpath,O_RDWR );if (fd2 <0 ) {perror ("Can't open file" );ksft_exit_fail ();
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 268/473 RDMA/IPoIB: Fix format truncation compilation errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 49ca2b2ef3d003402584c68ae7b3055ba72e750a ]
Truncate the device name to store IPoIB VLAN name.
[leonro@5b4e8fba4ddd kernel]$ make -s -j 20 allmodconfig [leonro@5b4e8fba4ddd kernel]$ make -s -j 20 W=1 drivers/infiniband/ulp/ipoib/ drivers/infiniband/ulp/ipoib/ipoib_vlan.c: In function ‘ipoib_vlan_add’:drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:52: error: ‘%04x’ directive output may be truncated writing 4 bytes into a region of size between 0 and 15 [-Werror=format-truncation=]
187 | snprintf(intf_name, sizeof(intf_name), "%s.%04x",
| ^~~~drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:48: note: directive argument in the range [0, 65535]
187 | snprintf(intf_name, sizeof(intf_name), "%s.%04x",
| ^~~~~~~~~drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:9: note: ‘snprintf’ output between 6 and 21 bytes into a destination of size 16
187 | snprintf(intf_name, sizeof(intf_name), "%s.%04x",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 | ppriv->dev->name, pkey);
| ~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:244: drivers/infiniband/ulp/ipoib/ipoib_vlan.o] Error 1 make[6]: *** Waiting for unfinished jobs....
--- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +6 -2
@@ -184,8 +184,12 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) ppriv =ipoib_priv (pdev); -snprintf (intf_name,sizeof (intf_name),"%s.%04x" , - ppriv->dev->name, pkey); +/* If you increase IFNAMSIZ, update snprintf below +* to allow longer names. +*/ +BUILD_BUG_ON (IFNAMSIZ !=16 ); +snprintf (intf_name,sizeof (intf_name),"%.10s.%04x" , ppriv->dev->name, + pkey); ndev =ipoib_intf_alloc (ppriv->ca, ppriv->port, intf_name);if (IS_ERR (ndev)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 269/473 net: add pskb_may_pull_reason() helper
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 1fb2d41501f38192d8a19da585cd441cf8845697 ]
pskb_may_pull() can fail for two different reasons.
Provide pskb_may_pull_reason() helper to distinguish between these reasons.
It returns:
SKB_NOT_DROPPED_YET : SuccessSKB_DROP_REASON_PKT_TOO_SMALL : packet too smallSKB_DROP_REASON_NOMEM : skb->head could not be resized
Stable-dep-of: 8bd67ebb50c0 ("net: bridge: xmit: make sure we have at least eth header len bytes")
--- include/linux/skbuff.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
include/linux/skbuff.h +15 -4
@@ -2636,15 +2636,26 @@ void *skb_pull_data(struct sk_buff *skb, size_t len);void *__pskb_pull_tail (struct sk_buff *skb,int delta); -static inline bool pskb_may_pull (struct sk_buff *skb,unsigned int len) +static inline enum skb_drop_reason +pskb_may_pull_reason (struct sk_buff *skb,unsigned int len) {DEBUG_NET_WARN_ON_ONCE (len >INT_MAX );if (likely (len <=skb_headlen (skb))) -return true; +return SKB_NOT_DROPPED_YET ; +if (unlikely (len > skb->len)) -return false; -return __pskb_pull_tail (skb, len -skb_headlen (skb)) !=NULL ; +return SKB_DROP_REASON_PKT_TOO_SMALL ; + +if (unlikely (!__pskb_pull_tail (skb, len -skb_headlen (skb)))) +return SKB_DROP_REASON_NOMEM ; + +return SKB_NOT_DROPPED_YET ; +} + +static inline bool pskb_may_pull (struct sk_buff *skb,unsigned int len) +{ +return pskb_may_pull_reason (skb, len) ==SKB_NOT_DROPPED_YET ; }static inline void *pskb_pull (struct sk_buff *skb,unsigned int len)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 270/473 net: bridge: xmit: make sure we have at least eth header len bytes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 8bd67ebb50c0145fd2ca8681ab65eb7e8cde1afc ]
syzbot triggered an uninit value[1] error in bridge device's xmit path by sending a short (less than ETH_HLEN bytes) skb. To fix it check if we can actually pull that amount instead of assuming.
Tested with dropwatch:
drop at: br_dev_xmit+0xb93/0x12d0 [bridge] (0xffffffffc06739b3)
origin: software
timestamp: Mon May 13 11:31:53 2024 778214037 nsec
protocol: 0x88a8
length: 2
original length: 2
drop reason: PKT_TOO_SMALL
[1]
BUG: KMSAN: uninit-value in br_dev_xmit+0x61d/0x1cb0 net/bridge/br_device.c:65 br_dev_xmit+0x61d/0x1cb0 net/bridge/br_device.c:65 __netdev_start_xmit include/linux/netdevice.h:4903 [inline] netdev_start_xmit include/linux/netdevice.h:4917 [inline] xmit_one net/core/dev.c:3531 [inline] dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3547 __dev_queue_xmit+0x34db/0x5350 net/core/dev.c:4341 dev_queue_xmit include/linux/netdevice.h:3091 [inline] __bpf_tx_skb net/core/filter.c:2136 [inline] __bpf_redirect_common net/core/filter.c:2180 [inline] __bpf_redirect+0x14a6/0x1620 net/core/filter.c:2187 ____bpf_clone_redirect net/core/filter.c:2460 [inline] bpf_clone_redirect+0x328/0x470 net/core/filter.c:2432 ___bpf_prog_run+0x13fe/0xe0f0 kernel/bpf/core.c:1997 __bpf_prog_run512+0xb5/0xe0 kernel/bpf/core.c:2238 bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline] __bpf_prog_run include/linux/filter.h:657 [inline] bpf_prog_run include/linux/filter.h:664 [inline] bpf_test_run+0x499/0xc30 net/bpf/test_run.c:425 bpf_prog_test_run_skb+0x14ea/0x1f20 net/bpf/test_run.c:1058 bpf_prog_test_run+0x6b7/0xad0 kernel/bpf/syscall.c:4269 __sys_bpf+0x6aa/0xd90 kernel/bpf/syscall.c:5678 __do_sys_bpf kernel/bpf/syscall.c:5767 [inline] __se_sys_bpf kernel/bpf/syscall.c:5765 [inline] __x64_sys_bpf+0xa0/0xe0 kernel/bpf/syscall.c:5765 x64_sys_call+0x96b/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:322 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/bridge/br_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bridge/br_device.c +6 -0
@@ -27,6 +27,7 @@ EXPORT_SYMBOL_GPL(nf_br_ops);/* net device transmit always called with BH disabled */ netdev_tx_t br_dev_xmit (struct sk_buff *skb,struct net_device *dev) { +enum skb_drop_reason reason =pskb_may_pull_reason (skb,ETH_HLEN );struct net_bridge_mcast_port *pmctx_null =NULL ;struct net_bridge *br =netdev_priv (dev);struct net_bridge_mcast *brmctx = &br->multicast_ctx;
@@ -38,6 +39,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)const unsigned char *dest;u16 vid =0 ; +if (unlikely (reason !=SKB_NOT_DROPPED_YET )) { +kfree_skb_reason (skb, reason); +return NETDEV_TX_OK ; + } +memset (skb->cb,0 ,sizeof (struct br_input_skb_cb ));rcu_read_lock ();
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 271/473 selftests: net: bridge: increase IGMP/MLD exclude timeout membership interval
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 06080ea23095afe04a2cb7a8d05fab4311782623 ]
When running the bridge IGMP/MLD selftests on debug kernels we can get spurious errors when setting up the IGMP/MLD exclude timeout tests because the membership interval is just 3 seconds and the setup has 2 seconds of sleep plus various validations, the one second that is left is not enough. Increase the membership interval from 3 to 5 seconds to make room for the setup validation and 2 seconds of sleep.
--- tools/testing/selftests/net/forwarding/bridge_igmp.sh | 6 +++--- tools/testing/selftests/net/forwarding/bridge_mld.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/net/forwarding/bridge_igmp.sh +3 -3
@@ -481,10 +481,10 @@ v3exc_timeout_test() RET=0 local X=("192.0.2.20" "192.0.2.30") - # GMI should be 3 seconds + # GMI should be 5 seconds ip link set dev br0 type bridge mcast_query_interval 100 \ mcast_query_response_interval 100 \ - mcast_membership_interval 300 + mcast_membership_interval 500 v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP ip link set dev br0 type bridge mcast_query_interval 500 \
@@ -492,7 +492,7 @@ v3exc_timeout_test() mcast_membership_interval 1500 $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q - sleep 3 + sleep 5 bridge -j -d -s mdb show dev br0 \ | jq -e ".[].mdb[] | \ select(.grp == \"$TEST_GROUP\" and \
tools/testing/selftests/net/forwarding/bridge_mld.sh +3 -3
@@ -478,10 +478,10 @@ mldv2exc_timeout_test() RET=0 local X=("2001:db8:1::20" "2001:db8:1::30") - # GMI should be 3 seconds + # GMI should be 5 seconds ip link set dev br0 type bridge mcast_query_interval 100 \ mcast_query_response_interval 100 \ - mcast_membership_interval 300 + mcast_membership_interval 500 mldv2exclude_prepare $h1 ip link set dev br0 type bridge mcast_query_interval 500 \
@@ -489,7 +489,7 @@ mldv2exc_timeout_test() mcast_membership_interval 1500 $MZ $h1 -c 1 $MZPKT_ALLOW2 -q - sleep 3 + sleep 5 bridge -j -d -s mdb show dev br0 \ | jq -e ".[].mdb[] | \ select(.grp == \"$TEST_GROUP\" and \
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 272/473 net: bridge: mst: fix vlan use-after-free
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 3a7c1661ae1383364cd6092d851f5e5da64d476b ]
syzbot reported a suspicious rcu usage[1] in bridge's mst code. While fixing it I noticed that nothing prevents a vlan to be freed while walking the list from the same path (br forward delay timer). Fix the rcu usage and also make sure we are not accessing freed memory by making br_mst_vlan_set_state use rcu read lock.
[1]
WARNING: suspicious RCU usage
6.9.0-rc6-syzkaller #0 Not tainted
-----------------------------
net/bridge/br_private.h:1599 suspicious rcu_dereference_protected() usage!
...
stack backtrace: CPU: 1 PID: 8017 Comm: syz-executor.1 Not tainted 6.9.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 lockdep_rcu_suspicious+0x221/0x340 kernel/locking/lockdep.c:6712 nbp_vlan_group net/bridge/br_private.h:1599 [inline] br_mst_set_state+0x1ea/0x650 net/bridge/br_mst.c:105 br_set_state+0x28a/0x7b0 net/bridge/br_stp.c:47 br_forward_delay_timer_expired+0x176/0x440 net/bridge/br_stp_timer.c:88 call_timer_fn+0x18e/0x650 kernel/time/timer.c:1793 expire_timers kernel/time/timer.c:1844 [inline] __run_timers kernel/time/timer.c:2418 [inline] __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2429 run_timer_base kernel/time/timer.c:2438 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2448 __do_softirq+0x2c6/0x980 kernel/softirq.c:554 invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf2/0x1c0 kernel/softirq.c:633 irq_exit_rcu+0x9/0x30 kernel/softirq.c:645 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 </IRQ> <TASK> asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:lock_acquire+0x264/0x550 kernel/locking/lockdep.c:5758 Code: 2b 00 74 08 4c 89 f7 e8 ba d1 84 00 f6 44 24 61 02 0f 85 85 01 00 00 41 f7 c7 00 02 00 00 74 01 fb 48 c7 44 24 40 0e 36 e0 45 <4b> c7 44 25 00 00 00 00 00 43 c7 44 25 09 00 00 00 00 43 c7 44 25 RSP: 0018:ffffc90013657100 EFLAGS: 00000206 RAX: 0000000000000001 RBX: 1ffff920026cae2c RCX: 0000000000000001 RDX: dffffc0000000000 RSI: ffffffff8bcaca00 RDI: ffffffff8c1eaa60 RBP: ffffc90013657260 R08: ffffffff92efe507 R09: 1ffffffff25dfca0 R10: dffffc0000000000 R11: fffffbfff25dfca1 R12: 1ffff920026cae28 R13: dffffc0000000000 R14: ffffc90013657160 R15: 0000000000000246
--- net/bridge/br_mst.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/bridge/br_mst.c +10 -6
@@ -78,7 +78,7 @@ static void br_mst_vlan_set_state(struct net_bridge_port *p, struct net_bridge_v {struct net_bridge_vlan_group *vg =nbp_vlan_group (p); -if (v->state == state) +if (br_vlan_get_state (v) == state)return ;br_vlan_set_state (v, state);
@@ -100,11 +100,12 @@ int br_mst_set_state(struct net_bridge_port *p, u16 msti, u8 state, };struct net_bridge_vlan_group *vg;struct net_bridge_vlan *v; -int err; +int err =0 ; +rcu_read_lock (); vg =nbp_vlan_group (p);if (!vg) -return 0 ; + goto out;/* MSTI 0 (CST) state changes are notified via the regular * SWITCHDEV_ATTR_ID_PORT_STP_STATE.
@@ -112,17 +113,20 @@ int br_mst_set_state(struct net_bridge_port *p, u16 msti, u8 state,if (msti) { err =switchdev_port_attr_set (p->dev, &attr, extack);if (err && err != -EOPNOTSUPP ) -return err; + goto out; } -list_for_each_entry (v, &vg->vlan_list, vlist) { + err =0 ; +list_for_each_entry_rcu (v, &vg->vlan_list, vlist) {if (v->brvlan->msti != msti)continue ;br_mst_vlan_set_state (p, v, state); } -return 0 ; +out: +rcu_read_unlock (); +return err; }static void br_mst_vlan_sync_state (struct net_bridge_vlan *pv,u16 msti)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 273/473 net: qrtr: ns: Fix module refcnt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lew <[email protected]>
[ Upstream commit fd76e5ccc48f9f54eb44909dd7c0b924005f1582 ]
The qrtr protocol core logic and the qrtr nameservice are combined into a single module. Neither the core logic or nameservice provide much functionality by themselves; combining the two into a single module also prevents any possible issues that may stem from client modules loading inbetween qrtr and the ns.
Creating a socket takes two references to the module that owns the socket protocol. Since the ns needs to create the control socket, this creates a scenario where there are always two references to the qrtr module. This prevents the execution of 'rmmod' for qrtr.
To resolve this, forcefully put the module refcount for the socket opened by the nameservice.
--- net/qrtr/ns.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
net/qrtr/ns.c +27 -0
@@ -807,6 +807,24 @@ int qrtr_ns_init(void)if (ret <0 ) goto err_wq; +/* As the qrtr ns socket owner and creator is the same module, we have +* to decrease the qrtr module reference count to guarantee that it +* remains zero after the ns socket is created, otherwise, executing +* "rmmod" command is unable to make the qrtr module deleted after the +* qrtr module is inserted successfully. +* +* However, the reference count is increased twice in +* sock_create_kern(): one is to increase the reference count of owner +* of qrtr socket's proto_ops struct; another is to increment the +* reference count of owner of qrtr proto struct. Therefore, we must +* decrement the module reference count twice to ensure that it keeps +* zero after server's listening socket is created. Of course, we +* must bump the module reference count twice as well before the socket +* is closed. +*/ +module_put (qrtr_ns.sock->ops->owner); +module_put (qrtr_ns.sock->sk->sk_prot_creator->owner); +return 0 ; err_wq:
@@ -821,6 +839,15 @@ void qrtr_ns_remove(void) {cancel_work_sync (&qrtr_ns.work);destroy_workqueue (qrtr_ns.workqueue); + +/* sock_release() expects the two references that were put during +* qrtr_ns_init(). This function is only called during module remove, +* so try_stop_module() has already set the refcnt to 0. Use +* __module_get() instead of try_module_get() to successfully take two +* references. +*/ +__module_get (qrtr_ns.sock->ops->owner); +__module_get (qrtr_ns.sock->sk->sk_prot_creator->owner);sock_release (qrtr_ns.sock); }EXPORT_SYMBOL_GPL (qrtr_ns_remove);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 274/473 netrom: fix possible dead-lock in nr_rt_ioctl()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e03e7f20ebf7e1611d40d1fdc1bde900fd3335f6 ]
syzbot loves netrom, and found a possible deadlock in nr_rt_ioctl [1]
Make sure we always acquire nr_node_list_lock before nr_node_lock(nr_node)
[1]
WARNING: possible circular locking dependency detected 6.9.0-rc7-syzkaller-02147-g654de42f3fc6 #0 Not tainted
------------------------------------------------------
syz-executor350/5129 is trying to acquire lock:
ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: nr_node_lock include/net/netrom.h:152 [inline] ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: nr_dec_obs net/netrom/nr_route.c:464 [inline] ffff8880186e2070 (&nr_node->node_lock){+...}-{2:2}, at: nr_rt_ioctl+0x1bb/0x1090 net/netrom/nr_route.c:697
but task is already holding lock:
ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_dec_obs net/netrom/nr_route.c:462 [inline] ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_rt_ioctl+0x10a/0x1090 net/netrom/nr_route.c:697
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (nr_node_list_lock){+...}-{2:2}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_remove_node net/netrom/nr_route.c:299 [inline]
nr_del_node+0x4b4/0x820 net/netrom/nr_route.c:355
nr_rt_ioctl+0xa95/0x1090 net/netrom/nr_route.c:683
sock_do_ioctl+0x158/0x460 net/socket.c:1222
sock_ioctl+0x629/0x8e0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f-> #0 (&nr_node->node_lock){+...}-{2:2}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
__lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_node_lock include/net/netrom.h:152 [inline]
nr_dec_obs net/netrom/nr_route.c:464 [inline]
nr_rt_ioctl+0x1bb/0x1090 net/netrom/nr_route.c:697
sock_do_ioctl+0x158/0x460 net/socket.c:1222
sock_ioctl+0x629/0x8e0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7fother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(nr_node_list_lock);
lock(&nr_node->node_lock);
lock(nr_node_list_lock); lock(&nr_node->node_lock);
*** DEADLOCK ***
1 lock held by syz-executor350/5129:
#0: ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] #0: ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_dec_obs net/netrom/nr_route.c:462 [inline] #0: ffffffff8f7053b8 (nr_node_list_lock){+...}-{2:2}, at: nr_rt_ioctl+0x10a/0x1090 net/netrom/nr_route.c:697
stack backtrace: CPU: 0 PID: 5129 Comm: syz-executor350 Not tainted 6.9.0-rc7-syzkaller-02147-g654de42f3fc6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] nr_node_lock include/net/netrom.h:152 [inline] nr_dec_obs net/netrom/nr_route.c:464 [inline] nr_rt_ioctl+0x1bb/0x1090 net/netrom/nr_route.c:697 sock_do_ioctl+0x158/0x460 net/socket.c:1222 sock_ioctl+0x629/0x8e0 net/socket.c:1341 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:904 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/netrom/nr_route.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
net/netrom/nr_route.c +7 -12
@@ -285,22 +285,14 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,return 0 ; } -static inline void __nr_remove_node (struct nr_node *nr_node) +static void nr_remove_node_locked (struct nr_node *nr_node) { +lockdep_assert_held (&nr_node_list_lock); +hlist_del_init (&nr_node->node_node);nr_node_put (nr_node); } -#define nr_remove_node_locked (__node) \ - __nr_remove_node(__node) - -static void nr_remove_node (struct nr_node *nr_node) -{ -spin_lock_bh (&nr_node_list_lock); -__nr_remove_node (nr_node); -spin_unlock_bh (&nr_node_list_lock); -} -static inline void __nr_remove_neigh (struct nr_neigh *nr_neigh) {hlist_del_init (&nr_neigh->neigh_node);
@@ -339,6 +331,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct nreturn -EINVAL ; } +spin_lock_bh (&nr_node_list_lock);nr_node_lock (nr_node);for (i =0 ; i < nr_node->count; i++) {if (nr_node->routes[i].neighbour == nr_neigh) {
@@ -352,7 +345,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n nr_node->count--;if (nr_node->count ==0 ) { -nr_remove_node (nr_node); +nr_remove_node_locked (nr_node); }else {switch (i) {case 0 :
@@ -367,12 +360,14 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct nnr_node_put (nr_node); }nr_node_unlock (nr_node); +spin_unlock_bh (&nr_node_list_lock);return 0 ; } }nr_neigh_put (nr_neigh);nr_node_unlock (nr_node); +spin_unlock_bh (&nr_node_list_lock);nr_node_put (nr_node);return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 275/473 af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 581073f626e387d3e7eed55c48c8495584ead7ba ]
trafgen performance considerably sank on hosts with many cores after the blamed commit.
packet_read_pending() is very expensive, and calling it in af_packet fast path defeats Daniel intent in commit b013840810c2 ("packet: use percpu mmap tx frame pending refcount")
tpacket_destruct_skb() makes room for one packet, we can immediately wakeup a producer, no need to completely drain the tx ring.
--- net/packet/af_packet.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/packet/af_packet.c +1 -2
@@ -2528,8 +2528,7 @@ static void tpacket_destruct_skb(struct sk_buff *skb) ts =__packet_set_timestamp (po, ph, skb);__packet_set_status (po, ph,TP_STATUS_AVAILABLE | ts); -if (!packet_read_pending (&po->tx_ring)) -complete (&po->skb_completion); +complete (&po->skb_completion); }sock_wfree (skb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 276/473 sched/fair: Allow disabling sched_balance_newidle with sched_relax_domain_level
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitalii Bursov <[email protected]>
[ Upstream commit a1fd0b9d751f840df23ef0e75b691fc00cfd4743 ]
Change relax_domain_level checks so that it would be possible to include or exclude all domains from newidle balancing.
This matches the behavior described in the documentation:
-1 no request. use system default or follow request of others. 0 no search. 1 search siblings (hyperthreads in a core).
"2" enables levels 0 and 1, level_max excludes the last (level_max) level, and level_max+1 includes all levels.
--- kernel/cgroup/cpuset.c | 2 +- kernel/sched/topology.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/cgroup/cpuset.c +1 -1
@@ -2185,7 +2185,7 @@ bool current_cpuset_is_being_rebound(void)static int update_relax_domain_level (struct cpuset *cs,s64 val) {#ifdef CONFIG_SMP -if (val <-1 || val >= sched_domain_level_max) +if (val <-1 || val > sched_domain_level_max +1 )return -EINVAL ;#endif
kernel/sched/topology.c +1 -1
@@ -1436,7 +1436,7 @@ static void set_domain_attribute(struct sched_domain *sd, }else request = attr->relax_domain_level; -if (sd->level > request) { +if (sd->level >= request) {/* Turn off idle balance on this domain: */ sd->flags &= ~(SD_BALANCE_WAKE |SD_BALANCE_NEWIDLE ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 277/473 sched/core: Fix incorrect initialization of the burst parameter in cpu_max_write()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yu <[email protected]>
[ Upstream commit 49217ea147df7647cb89161b805c797487783fc0 ]
In the cgroup v2 CPU subsystem, assuming we have a cgroup named 'test', and we set cpu.max and cpu.max.burst:
# echo 1000000 > /sys/fs/cgroup/test/cpu.max
# echo 1000000 > /sys/fs/cgroup/test/cpu.max.burstthen we check cpu.max and cpu.max.burst:
# cat /sys/fs/cgroup/test/cpu.max
1000000 100000
# cat /sys/fs/cgroup/test/cpu.max.burst
1000000Next we set cpu.max again and check cpu.max and
cpu.max.burst:
# echo 2000000 > /sys/fs/cgroup/test/cpu.max
# cat /sys/fs/cgroup/test/cpu.max
2000000 100000 # cat /sys/fs/cgroup/test/cpu.max.burst
1000... we find that the cpu.max.burst value changed unexpectedly.
In cpu_max_write(), the unit of the burst value returned by tg_get_cfs_burst() is microseconds, while in cpu_max_write(), the burst unit used for calculation should be nanoseconds, which leads to the bug.
To fix it, get the burst value directly from tg->cfs_bandwidth.burst.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -11117,7 +11117,7 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of, {struct task_group *tg =css_tg (of_css (of));u64 period =tg_get_cfs_period (tg); -u64 burst =tg_get_cfs_burst (tg); +u64 burst = tg->cfs_bandwidth.burst;u64 quota;int ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 278/473 scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW major version > 5
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
[ Upstream commit c422fbd5cb58c9a078172ae1e9750971b738a197 ]
The qunipro_g4_sel clear is also needed for new platforms with major version > 5. Fix the version check to take this into account.
--- drivers/ufs/host/ufs-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/host/ufs-qcom.c +1 -1
@@ -227,7 +227,7 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host)ufs_qcom_cap_qunipro (host) ?QUNIPRO_SEL :0 , REG_UFS_CFG1); -if (host->hw_ver.major ==0x05 ) +if (host->hw_ver.major >=0x05 )ufshcd_rmwl (host->hba,QUNIPRO_G4_SEL ,0 ,REG_UFS_CFG0 ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 279/473 perf record: Delete session after stopping sideband thread
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 88ce0106a1f603bf360cb397e8fe293f8298fabb ]
The session has a header in it which contains a perf env with bpf_progs. The bpf_progs are accessed by the sideband thread and so the sideband thread must be stopped before the session is deleted, to avoid a use after free. This error was detected by AddressSanitizer in the following:
==2054673==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000161e00 at pc 0x55769289de54 bp 0x7f9df36d4ab0 sp 0x7f9df36d4aa8 READ of size 8 at 0x61d000161e00 thread T1
#0 0x55769289de53 in __perf_env__insert_bpf_prog_info util/env.c:42
#1 0x55769289dbb1 in perf_env__insert_bpf_prog_info util/env.c:29
#2 0x557692bbae29 in perf_env__add_bpf_info util/bpf-event.c:483
#3 0x557692bbb01a in bpf_event__sb_cb util/bpf-event.c:512
#4 0x5576928b75f4 in perf_evlist__poll_thread util/sideband_evlist.c:68
#5 0x7f9df96a63eb in start_thread nptl/pthread_create.c:444
#6 0x7f9df9726a4b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81 0x61d000161e00 is located 384 bytes inside of 2136-byte region [0x61d000161c80,0x61d0001624d8) freed by thread T0 here:
#0 0x7f9dfa6d7288 in __interceptor_free libsanitizer/asan/asan_malloc_linux.cpp:52
#1 0x557692978d50 in perf_session__delete util/session.c:319
#2 0x557692673959 in __cmd_record tools/perf/builtin-record.c:2884
#3 0x55769267a9f0 in cmd_record tools/perf/builtin-record.c:4259
#4 0x55769286710c in run_builtin tools/perf/perf.c:349
#5 0x557692867678 in handle_internal_command tools/perf/perf.c:402
#6 0x557692867a40 in run_argv tools/perf/perf.c:446
#7 0x557692867fae in main tools/perf/perf.c:562
#8 0x7f9df96456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58--- tools/perf/builtin-record.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +2 -2
@@ -2843,10 +2843,10 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) }#endif zstd_fini (&session->zstd_data); -perf_session__delete (session); -if (!opts->no_bpf_event)evlist__stop_sb_thread (rec->sb_evlist); + +perf_session__delete (session);return status; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 280/473 perf probe: Add missing libgen.h header needed for using basename()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 581037151910126a7934e369e4b6ac70eda9a703 ]
This prototype is obtained indirectly, by luck, from some other header in probe-event.c in most systems, but recently exploded on alpine:edge:
8 13.39 alpine:edge : FAIL gcc version 13.2.1 20240309 (Alpine 13.2.1_git20240309)
util/probe-event.c: In function 'convert_exec_to_group':
util/probe-event.c:225:16: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
225 | ptr1 = basename(exec_copy);
| ^~~~~~~~
util/probe-event.c:225:14: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
225 | ptr1 = basename(exec_copy);
| ^
cc1: all warnings being treated as errors
make[3]: *** [/git/perf-6.8.0/tools/build/Makefile.build:158: util] Error 2
Fix it by adding the libgen.h header where basename() is prototyped.
--- tools/perf/util/probe-event.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/probe-event.c +1 -0
@@ -11,6 +11,7 @@#include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#include <libgen.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h>
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 281/473 iio: core: Leave private pointer NULL when no private data supplied
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit f0245ab389330cbc1d187e358a5b890d9f5383db ]
In iio_device_alloc() when size of the private data is 0, the private pointer is calculated to point behind the valid data. Leave it NULL when no private data supplied.
--- drivers/iio/industrialio-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/industrialio-core.c +4 -2
@@ -1670,8 +1670,10 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)return NULL ; indio_dev = &iio_dev_opaque->indio_dev; - indio_dev->priv = (char *)iio_dev_opaque + -ALIGN (sizeof (struct iio_dev_opaque ),IIO_DMA_MINALIGN ); + +if (sizeof_priv) + indio_dev->priv = (char *)iio_dev_opaque + +ALIGN (sizeof (*iio_dev_opaque),IIO_DMA_MINALIGN ); indio_dev->dev.parent = parent; indio_dev->dev.type = &iio_device_type;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 282/473 greybus: lights: check return of get_channel_from_mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rui Miguel Silva <[email protected]>
[ Upstream commit a1ba19a1ae7cd1e324685ded4ab563e78fe68648 ]
If channel for the given node is not found we return null from get_channel_from_mode. Make sure we validate the return pointer before using it in two of the missing places.
This was originally reported in [0]:
Found by Linux Verification Center (linuxtesting.org) with SVACE.
[0] https://lore.kernel.org/all/[email protected]
--- drivers/staging/greybus/light.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/greybus/light.c +7 -1
@@ -147,6 +147,9 @@ static int __gb_lights_flash_brightness_set(struct gb_channel *channel) channel =get_channel_from_mode (channel->light,GB_CHANNEL_MODE_TORCH ); +if (!channel) +return -EINVAL ; +/* For not flash we need to convert brightness to intensity */ intensity = channel->intensity_uA.min + (channel->intensity_uA.step * channel->led->brightness);
@@ -549,7 +552,10 @@ static int gb_lights_light_v4l2_register(struct gb_light *light) } channel_flash =get_channel_from_mode (light,GB_CHANNEL_MODE_FLASH ); -WARN_ON (!channel_flash); +if (!channel_flash) { +dev_err (dev,"failed to get flash channel from mode\n" ); +return -EINVAL ; + } fled = &channel_flash->fled;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 283/473 f2fs: multidev: fix to recognize valid zero block address
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 33e62cd7b4c281cd737c62e5d8c4f0e602a8c5c5 ]
As reported by Yi Zhang in mailing list [1], kernel warning was catched during zbd/010 test as below:
./check zbd/010
zbd/010 (test gap zone support with F2FS) [failed]
runtime ... 3.752s
something found in dmesg:
[ 4378.146781] run blktests zbd/010 at 2024-02-18 11:31:13
[ 4378.192349] null_blk: module loaded
[ 4378.209860] null_blk: disk nullb0 created
[ 4378.413285] scsi_debug:sdebug_driver_probe: scsi_debug: trim
poll_queues to 0. poll_q/nr_hw = (0/1)
[ 4378.422334] scsi host15: scsi_debug: version 0191 [20210520]
dev_size_mb=1024, opts=0x0, submit_queues=1, statistics=0
[ 4378.434922] scsi 15:0:0:0: Direct-Access-ZBC Linux
scsi_debug 0191 PQ: 0 ANSI: 7
[ 4378.443343] scsi 15:0:0:0: Power-on or device reset occurred
[ 4378.449371] sd 15:0:0:0: Attached scsi generic sg5 type 20
[ 4378.449418] sd 15:0:0:0: [sdf] Host-managed zoned block device
...
(See '/mnt/tests/gitlab.com/api/v4/projects/19168116/repository/archive.zip/storage/blktests/blk/blktests/results/nodev/zbd/010.dmesg'WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51 CPU: 22 PID: 44011 Comm: fio Not tainted 6.8.0-rc3+ #1 RIP: 0010:iomap_iter+0x32b/0x350 Call Trace: <TASK> __iomap_dio_rw+0x1df/0x830 f2fs_file_read_iter+0x156/0x3d0 [f2fs] aio_read+0x138/0x210 io_submit_one+0x188/0x8c0 __x64_sys_io_submit+0x8c/0x1a0 do_syscall_64+0x86/0x170 entry_SYSCALL_64_after_hwframe+0x6e/0x76
Shinichiro Kawasaki helps to analyse this issue and proposes a potential fixing patch in [2].
Quoted from reply of Shinichiro Kawasaki:
"I confirmed that the trigger commit is dbf8e63f48af as Yi reported. I took a look in the commit, but it looks fine to me. So I thought the cause is not in the commit diff.
I found the WARN is printed when the f2fs is set up with multiple devices, and read requests are mapped to the very first block of the second device in the direct read path. In this case, f2fs_map_blocks() and f2fs_map_blocks_cached() modify map->m_pblk as the physical block address from each block device. It becomes zero when it is mapped to the first block of the device. However, f2fs_iomap_begin() assumes that map->m_pblk is the physical block address of the whole f2fs, across the all block devices. It compares map->m_pblk against NULL_ADDR == 0, then go into the unexpected branch and sets the invalid iomap->length. The WARN catches the invalid iomap->length.
This WARN is printed even for non-zoned block devices, by following steps.
- Create two (non-zoned) null_blk devices memory backed with 128MB size each:
nullb0 and nullb1.
# mkfs.f2fs /dev/nullb0 -c /dev/nullb1
# mount -t f2fs /dev/nullb0 "${mount_dir}"
# dd if=/dev/zero of="${mount_dir}/test.dat" bs=1M count=192
# dd if="${mount_dir}/test.dat" of=/dev/null bs=1M count=192 iflag=direct..."
So, the root cause of this issue is: when multi-devices feature is on, f2fs_map_blocks() may return zero blkaddr in non-primary device, which is a verified valid block address, however, f2fs_iomap_begin() treats it as an invalid block address, and then it triggers the warning in iomap framework code.
Finally, as discussed, we decide to use a more simple and direct way that checking (map.m_flags & F2FS_MAP_MAPPED) condition instead of (map.m_pblk != NULL_ADDR) to fix this issue.
Thanks a lot for the effort of Yi Zhang and Shinichiro Kawasaki on this issue.
[1] https://lore.kernel.org/linux-f2fs-devel/CAHj4cs-kfojYC9i0G73PRkYzcxCTex=-vugRFeP40g_URGvnfQ@mail.gmail.com/
[2] https://lore.kernel.org/linux-f2fs-devel/gngdj77k4picagsfdtiaa7gpgnup6fsgwzsltx6milmhegmjff@iax2n4wvrqye/
--- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/data.c +1 -1
@@ -4195,7 +4195,7 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,if (WARN_ON_ONCE (map.m_pblk ==COMPRESS_ADDR ))return -EINVAL ; -if (map.m_pblk !=NULL_ADDR ) { +if (map.m_flags &F2FS_MAP_MAPPED ) { iomap->length =blks_to_bytes (inode, map.m_len); iomap->type =IOMAP_MAPPED ; iomap->flags |=IOMAP_F_MERGED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 284/473 f2fs: fix to wait on page writeback in __clone_blkaddrs()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit d3876e34e7e789e2cbdd782360fef2a777391082 ]
In below race condition, dst page may become writeback status in __clone_blkaddrs(), it needs to wait writeback before update, fix it.
Thread A GC Thread
- f2fs_move_file_range
- filemap_write_and_wait_range(dst)
- gc_data_segment
- f2fs_down_write(dst)
- move_data_page
- set_page_writeback(dst_page)
- f2fs_submit_page_write
- f2fs_up_write(dst)
- f2fs_down_write(dst)
- __exchange_data_block
- __clone_blkaddrs
- f2fs_get_new_data_page
- memcpy_page
--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/file.c +3 -0
@@ -1314,6 +1314,9 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,f2fs_put_page (psrc,1 );return PTR_ERR (pdst); } + +f2fs_wait_on_page_writeback (pdst,DATA , true, true); +memcpy_page (pdst,0 , psrc,0 ,PAGE_SIZE );set_page_dirty (pdst);set_page_private_gcing (pdst);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 285/473 counter: linux/counter.h: fix Excess kernel-doc description warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 416bdb89605d960405178b9bf04df512d1ace1a3 ]
Remove the @priv: line to prevent the kernel-doc warning:
include/linux/counter.h:400: warning: Excess struct member 'priv' description in 'counter_device'
--- include/linux/counter.h | 1 - 1 file changed, 1 deletion(-)
include/linux/counter.h +0 -1
@@ -359,7 +359,6 @@ struct counter_ops {* @num_counts: number of Counts specified in @counts * @ext: optional array of Counter device extensions * @num_ext: number of Counter device extensions specified in @ext -* @priv: optional private data supplied by driver * @dev: internal device structure * @chrdev: internal character device structure * @events_list: list of current watching Counter events
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 286/473 perf annotate: Get rid of duplicate --group option item
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 374af9f1f06b5e991c810d2e4983d6f58df32136 ]
The options array in cmd_annotate() has duplicate --group options. It only needs one and let's get rid of the other.
$ perf annotate -h 2>&1 | grep group
--group Show event group information together
--group Show event group information together--- tools/perf/builtin-annotate.c | 2 -- 1 file changed, 2 deletions(-)
tools/perf/builtin-annotate.c +0 -2
@@ -571,8 +571,6 @@ int cmd_annotate(int argc, const char **argv) "Enable symbol demangling"),OPT_BOOLEAN (0 ,"demangle-kernel" , &symbol_conf.demangle_kernel,"Enable kernel symbol demangling" ), -OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group, -"Show event group information together" ),OPT_BOOLEAN (0 ,"show-total-period" , &symbol_conf.show_total_period,"Show a column with the sum of periods" ), OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 287/473 soundwire: cadence: fix invalid PDI offset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 8ee1b439b1540ae543149b15a2a61b9dff937d91 ]
For some reason, we add an offset to the PDI, presumably to skip the PDI0 and PDI1 which are reserved for BPT.
This code is however completely wrong and leads to an out-of-bounds access. We were just lucky so far since we used only a couple of PDIs and remained within the PDI array bounds.
A Fixes: tag is not provided since there are no known platforms where the out-of-bounds would be accessed, and the initial code had problems as well.
A follow-up patch completely removes this useless offset.
--- drivers/soundwire/cadence_master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/cadence_master.c +1 -1
@@ -1847,7 +1847,7 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,/* check if we found a PDI, else find in bi-directional */ if (!pdi) - pdi =cdns_find_pdi (cdns,2 , stream->num_bd, stream->bd, + pdi =cdns_find_pdi (cdns,0 , stream->num_bd, stream->bd, dai_id);if (pdi) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 288/473 dmaengine: idma64: Add check for dma_set_max_seg_size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 2b1c1cf08a0addb6df42f16b37133dc7a351de29 ]
As the possible failure of the dma_set_max_seg_size(), it should be better to check the return value of the dma_set_max_seg_size().
--- drivers/dma/idma64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/idma64.c +3 -1
@@ -594,7 +594,9 @@ static int idma64_probe(struct idma64_chip *chip) idma64->dma.dev = chip->sysdev; -dma_set_max_seg_size (idma64->dma.dev,IDMA64C_CTLH_BLOCK_TS_MASK ); + ret =dma_set_max_seg_size (idma64->dma.dev,IDMA64C_CTLH_BLOCK_TS_MASK ); +if (ret) +return ret; ret =dma_async_device_register (&idma64->dma);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 289/473 firmware: dmi-id: add a release callback function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit cf770af5645a41a753c55a053fa1237105b0964a ]
dmi_class uses kfree() as the .release function, but that now causes a warning with clang-16 as it violates control flow integrity (KCFI) rules:
drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
174 | .dev_release = (void(*)(struct device *)) kfree,
Add an explicit function to call kfree() instead.
--- drivers/firmware/dmi-id.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/firmware/dmi-id.c +6 -1
@@ -169,9 +169,14 @@ static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)return 0 ; } +static void dmi_dev_release (struct device *dev) +{ +kfree (dev); +} +static struct class dmi_class = { .name ="dmi" , - .dev_release = (void (*)(struct device *)) kfree, + .dev_release = dmi_dev_release, .dev_uevent = dmi_dev_uevent, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 290/473 serial: max3100: Lock port->lock when calling uart_handle_cts_change()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 77ab53371a2066fdf9b895246505f5ef5a4b5d47 ]
uart_handle_cts_change() has to be called with port lock taken, Since we run it in a separate work, the lock may not be taken at the time of running. Make sure that it's taken by explicitly doing that. Without it we got a splat:
WARNING: CPU: 0 PID: 10 at drivers/tty/serial/serial_core.c:3491 uart_handle_cts_change+0xa6/0xb0 ... Workqueue: max3100-0 max3100_work [max3100] RIP: 0010:uart_handle_cts_change+0xa6/0xb0 ... max3100_handlerx+0xc5/0x110 [max3100] max3100_work+0x12a/0x340 [max3100]
--- drivers/tty/serial/max3100.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/tty/serial/max3100.c +12 -1
@@ -213,7 +213,7 @@ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)return 0 ; } -static int max3100_handlerx (struct max3100_port *s,u16 rx) +static int max3100_handlerx_unlocked (struct max3100_port *s,u16 rx) {unsigned int ch, flg, status =0 ;int ret =0 , cts;
@@ -253,6 +253,17 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx)return ret; } +static int max3100_handlerx (struct max3100_port *s,u16 rx) +{ +unsigned long flags; +int ret; + +uart_port_lock_irqsave (&s->port, &flags); + ret =max3100_handlerx_unlocked (s, rx); +uart_port_unlock_irqrestore (&s->port, flags); +return ret; +} +static void max3100_work (struct work_struct *w) { struct max3100_port *s = container_of(w, struct max3100_port, work);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 291/473 serial: max3100: Update uart_driver_registered on driver removal
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 712a1fcb38dc7cac6da63ee79a88708fbf9c45ec ]
The removal of the last MAX3100 device triggers the removal of the driver. However, code doesn't update the respective global variable and after insmod — rmmod — insmod cycle the kernel oopses:
max3100 spi-PRP0001:01: max3100_probe: adding port 0
BUG: kernel NULL pointer dereference, address: 0000000000000408 ... RIP: 0010:serial_core_register_port+0xa0/0x840 ... max3100_probe+0x1b6/0x280 [max3100] spi_probe+0x8d/0xb0
Update the actual state so next time UART driver will be registered again.
Hugo also noticed, that the error path in the probe also affected by having the variable set, and not cleared. Instead of clearing it move the assignment after the successfull uart_register_driver() call.
--- drivers/tty/serial/max3100.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/max3100.c +3 -1
@@ -750,13 +750,14 @@ static int max3100_probe(struct spi_device *spi)mutex_lock (&max3100s_lock);if (!uart_driver_registered) { - uart_driver_registered =1 ; retval =uart_register_driver (&max3100_uart_driver);if (retval) {printk (KERN_ERR "Couldn't register max3100 uart driver\n" );mutex_unlock (&max3100s_lock);return retval; } + + uart_driver_registered =1 ; }for (i =0 ; i <MAX_MAX3100 ; i++)
@@ -842,6 +843,7 @@ static void max3100_remove(struct spi_device *spi) }pr_debug ("removing max3100 driver\n" );uart_unregister_driver (&max3100_uart_driver); + uart_driver_registered =0 ;mutex_unlock (&max3100s_lock); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 292/473 serial: max3100: Fix bitwise types
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit e60955dbecb97f080848a57524827e2db29c70fd ]
Sparse is not happy about misuse of bitwise types:
.../max3100.c:194:13: warning: incorrect type in assignment (different base types)
.../max3100.c:194:13: expected unsigned short [addressable] [usertype] etx
.../max3100.c:194:13: got restricted __be16 [usertype]
.../max3100.c:202:15: warning: cast to restricted __be16
Fix this by choosing proper types for the respective variables.
--- drivers/tty/serial/max3100.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/max3100.c +4 -1
@@ -45,6 +45,9 @@#include <linux/freezer.h> #include <linux/tty.h> #include <linux/tty_flip.h> +#include <linux/types.h> + +#include <asm/unaligned.h> #include <linux/serial_max3100.h>
@@ -191,7 +194,7 @@ static void max3100_timeout(struct timer_list *t)static int max3100_sr (struct max3100_port *s,u16 tx,u16 *rx) {struct spi_message message; -u16 etx, erx; +__be16 etx, erx;int status;struct spi_transfer tran = { .tx_buf = &etx,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 293/473 greybus: arche-ctrl: move device table to its right location
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 6a0b8c0da8d8d418cde6894a104cf74e6098ddfa ]
The arche-ctrl has two platform drivers and three of_device_id tables, but one table is only used for the the module loader, while the other two seem to be associated with their drivers.
This leads to a W=1 warning when the driver is built-in:
drivers/staging/greybus/arche-platform.c:623:34: error: 'arche_combined_id' defined but not used [-Werror=unused-const-variable=]
623 | static const struct of_device_id arche_combined_id[] = {
Drop the extra table and register both tables that are actually used as the ones for the module loader instead.
--- drivers/staging/greybus/arche-apb-ctrl.c | 1 + drivers/staging/greybus/arche-platform.c | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/staging/greybus/arche-apb-ctrl.c +1 -0
@@ -468,6 +468,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = { { .compatible = "usbffff,2", }, { }, }; +MODULE_DEVICE_TABLE (of, arche_apb_ctrl_of_match);static struct platform_driver arche_apb_ctrl_device_driver = { .probe = arche_apb_ctrl_probe,
drivers/staging/greybus/arche-platform.c +1 -8
@@ -620,14 +620,7 @@ static const struct of_device_id arche_platform_of_match[] = { { .compatible = "google,arche-platform", }, { }, }; - -static const struct of_device_id arche_combined_id[] = { -/* Use PID/VID of SVC device */ - { .compatible ="google,arche-platform" , }, - { .compatible ="usbffff,2" , }, - { }, -}; -MODULE_DEVICE_TABLE (of, arche_combined_id); +MODULE_DEVICE_TABLE (of, arche_platform_of_match);static struct platform_driver arche_platform_device_driver = { .probe = arche_platform_probe,
Signature · 1 line
2.43.0