6.6.57-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 141/213 ice: Flush FDB entries before reset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wojciech Drewek <[email protected]>
[ Upstream commit fbcb968a98ac0b71f5a2bda2751d7a32d201f90d ]
Triggering the reset while in switchdev mode causes errors[1]. Rules are already removed by this time because switch content is flushed in case of the reset. This means that rules were deleted from HW but SW still thinks they exist so when we get SWITCHDEV_FDB_DEL_TO_DEVICE notification we try to delete not existing rule.
We can avoid these errors by clearing the rules early in the reset flow before they are removed from HW. Switchdev API will get notified that the rule was removed so we won't get SWITCHDEV_FDB_DEL_TO_DEVICE notification. Remove unnecessary ice_clear_sw_switch_recipes.
[1]
ice 0000:01:00.0: Failed to delete FDB forward rule, err: -2 ice 0000:01:00.0: Failed to delete FDB guard rule, err: -2
--- .../net/ethernet/intel/ice/ice_eswitch_br.c | 5 +++- .../net/ethernet/intel/ice/ice_eswitch_br.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 24 +++---------------- 3 files changed, 8 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/ice/ice_eswitch_br.c +4 -1
@@ -582,10 +582,13 @@ ice_eswitch_br_switchdev_event(struct notifier_block *nb,return NOTIFY_DONE ; } -static void ice_eswitch_br_fdb_flush (struct ice_esw_br *bridge) +void ice_eswitch_br_fdb_flush (struct ice_esw_br *bridge) {struct ice_esw_br_fdb_entry *entry, *tmp; +if (!bridge) +return ; +list_for_each_entry_safe (entry, tmp, &bridge->fdb_list, list)ice_eswitch_br_fdb_entry_notify_and_cleanup (bridge, entry); }
drivers/net/ethernet/intel/ice/ice_eswitch_br.h +1 -0
@@ -116,5 +116,6 @@ void ice_eswitch_br_offloads_deinit(struct ice_pf *pf);int ice_eswitch_br_offloads_init (struct ice_pf *pf); +void ice_eswitch_br_fdb_flush (struct ice_esw_br *bridge);#endif /* _ICE_ESWITCH_BR_H_ */
drivers/net/ethernet/intel/ice/ice_main.c +3 -21
@@ -518,25 +518,6 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked) pf->vf_agg_node[node].num_vsis =0 ; } -/** -* ice_clear_sw_switch_recipes - clear switch recipes -* @pf: board private structure -* -* Mark switch recipes as not created in sw structures. There are cases where -* rules (especially advanced rules) need to be restored, either re-read from -* hardware or added again. For example after the reset. 'recp_created' flag -* prevents from doing that and need to be cleared upfront. -*/ -static void ice_clear_sw_switch_recipes (struct ice_pf *pf) -{ -struct ice_sw_recipe *recp; -u8 i; - - recp = pf->hw.switch_info->recp_list; -for (i =0 ; i <ICE_MAX_NUM_RECIPES ; i++) - recp[i].recp_created = false; -} -/** * ice_prepare_for_reset - prep for reset * @pf: board private structure
@@ -573,8 +554,9 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)mutex_unlock (&pf->vfs.table_lock);if (ice_is_eswitch_mode_switchdev (pf)) { -if (reset_type !=ICE_RESET_PFR ) -ice_clear_sw_switch_recipes (pf); +rtnl_lock (); +ice_eswitch_br_fdb_flush (pf->eswitch.br_offloads->bridge); +rtnl_unlock (); }/* release ADQ specific HW and SW resources */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/213 i40e: Fix macvlan leak by synchronizing access to mac_filter_hash
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Loktionov <[email protected]>
[ Upstream commit dac6c7b3d33756d6ce09f00a96ea2ecd79fae9fb ]
This patch addresses a macvlan leak issue in the i40e driver caused by concurrent access to vsi->mac_filter_hash. The leak occurs when multiple threads attempt to modify the mac_filter_hash simultaneously, leading to inconsistent state and potential memory leaks.
To fix this, we now wrap the calls to i40e_del_mac_filter() and zeroing vf->default_lan_addr.addr with spin_lock/unlock_bh(&vsi->mac_filter_hash_lock), ensuring atomic operations and preventing concurrent access.
Additionally, we add lockdep_assert_held(&vsi->mac_filter_hash_lock) in i40e_add_mac_filter() to help catch similar issues in the future.
Reproduction steps:
1. Spawn VFs and configure port vlan on them.
2. Trigger concurrent macvlan operations (e.g., adding and deleting portvlan and/or mac filters).
3. Observe the potential memory leak and inconsistent state in the mac_filter_hash.
This synchronization ensures the integrity of the mac_filter_hash and prevents the described leak.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
@@ -1744,6 +1744,7 @@ struct i40e_mac_filter *i40e_add_mac_filter(struct i40e_vsi *vsi,struct hlist_node *h;int bkt; +lockdep_assert_held (&vsi->mac_filter_hash_lock);if (vsi->info.pvid)return i40e_add_filter (vsi, macaddr,le16_to_cpu (vsi->info.pvid));
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -0
@@ -2219,8 +2219,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) vfres->vsi_res[0 ].qset_handle =le16_to_cpu (vsi->info.qs_handle[0 ]);if (!(vf->driver_caps &VIRTCHNL_VF_OFFLOAD_USO ) && !vf->pf_set_mac) { +spin_lock_bh (&vsi->mac_filter_hash_lock);i40e_del_mac_filter (vsi, vf->default_lan_addr.addr);eth_zero_addr (vf->default_lan_addr.addr); +spin_unlock_bh (&vsi->mac_filter_hash_lock); }ether_addr_copy (vfres->vsi_res[0 ].default_mac_addr, vf->default_lan_addr.addr);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 143/213 igb: Do not bring the device up after non-fatal error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
[ Upstream commit 330a699ecbfc9c26ec92c6310686da1230b4e7eb ]
Commit 004d25060c78 ("igb: Fix igb_down hung on surprise removal") changed igb_io_error_detected() to ignore non-fatal pcie errors in order to avoid hung task that can happen when igb_down() is called multiple times. This caused an issue when processing transient non-fatal errors. igb_io_resume(), which is called after igb_io_error_detected(), assumes that device is brought down by igb_io_error_detected() if the interface is up. This resulted in panic with stacktrace below.
[ T3256] igb 0000:09:00.0 haeth0: igb: haeth0 NIC Link is Down
[ T292] pcieport 0000:00:1c.5: AER: Uncorrected (Non-Fatal) error received: 0000:09:00.0 [ T292] igb 0000:09:00.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Requester ID) [ T292] igb 0000:09:00.0: device [8086:1537] error status/mask=00004000/00000000 [ T292] igb 0000:09:00.0: [14] CmpltTO [ 200.105524,009][ T292] igb 0000:09:00.0: AER: TLP Header: 00000000 00000000 00000000 00000000 [ T292] pcieport 0000:00:1c.5: AER: broadcast error_detected message [ T292] igb 0000:09:00.0: Non-correctable non-fatal error reported. [ T292] pcieport 0000:00:1c.5: AER: broadcast mmio_enabled message [ T292] pcieport 0000:00:1c.5: AER: broadcast resume message [ T292] ------------[ cut here ]------------ [ T292] kernel BUG at net/core/dev.c:6539! [ T292] invalid opcode: 0000 [#1] PREEMPT SMP [ T292] RIP: 0010:napi_enable+0x37/0x40 [ T292] Call Trace: [ T292] <TASK> [ T292] ? die+0x33/0x90 [ T292] ? do_trap+0xdc/0x110 [ T292] ? napi_enable+0x37/0x40 [ T292] ? do_error_trap+0x70/0xb0 [ T292] ? napi_enable+0x37/0x40 [ T292] ? napi_enable+0x37/0x40 [ T292] ? exc_invalid_op+0x4e/0x70 [ T292] ? napi_enable+0x37/0x40 [ T292] ? asm_exc_invalid_op+0x16/0x20 [ T292] ? napi_enable+0x37/0x40 [ T292] igb_up+0x41/0x150 [ T292] igb_io_resume+0x25/0x70 [ T292] report_resume+0x54/0x70 [ T292] ? report_frozen_detected+0x20/0x20 [ T292] pci_walk_bus+0x6c/0x90 [ T292] ? aer_print_port_info+0xa0/0xa0 [ T292] pcie_do_recovery+0x22f/0x380 [ T292] aer_process_err_devices+0x110/0x160 [ T292] aer_isr+0x1c1/0x1e0 [ T292] ? disable_irq_nosync+0x10/0x10 [ T292] irq_thread_fn+0x1a/0x60 [ T292] irq_thread+0xe3/0x1a0 [ T292] ? irq_set_affinity_notifier+0x120/0x120 [ T292] ? irq_affinity_notify+0x100/0x100 [ T292] kthread+0xe2/0x110 [ T292] ? kthread_complete_and_exit+0x20/0x20 [ T292] ret_from_fork+0x2d/0x50 [ T292] ? kthread_complete_and_exit+0x20/0x20 [ T292] ret_from_fork_asm+0x11/0x20 [ T292] </TASK>
To fix this issue igb_io_resume() checks if the interface is running and the device is not down this means igb_io_error_detected() did not bring the device down and there is no need to bring it up.
--- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +4 -0
@@ -9672,6 +9672,10 @@ static void igb_io_resume(struct pci_dev *pdev)struct igb_adapter *adapter =netdev_priv (netdev);if (netif_running (netdev)) { +if (!test_bit (__IGB_DOWN, &adapter->state)) { +dev_dbg (&pdev->dev,"Resuming from non-fatal error, do nothing.\n" ); +return ; + }if (igb_up (adapter)) {dev_err (&pdev->dev,"igb_up failed after reset\n" );return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/213 e1000e: change I219 (19) devices to ADP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Lifshits <[email protected]>
[ Upstream commit 9d9e5347b035412daa844f884b94a05bac94f864 ]
Sporadic issues, such as PHY access loss, have been observed on I219 (19) devices. It was found that these devices have hardware more closely related to ADP than MTP and the issues were caused by taking MTP-specific flows.
Change the MAC and board types of these devices from MTP to ADP to correctly reflect the LAN hardware, and flows, of these devices.
--- drivers/net/ethernet/intel/e1000e/hw.h | 4 ++-- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000e/hw.h +2 -2
@@ -108,8 +108,8 @@ struct e1000_hw;#define E1000_DEV_ID_PCH_RPL_I219_V22 0x0DC8#define E1000_DEV_ID_PCH_MTP_I219_LM18 0x550A#define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B -#define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C -#define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D +#define E1000_DEV_ID_PCH_ADP_I219_LM19 0x550C +#define E1000_DEV_ID_PCH_ADP_I219_V19 0x550D#define E1000_DEV_ID_PCH_LNP_I219_LM20 0x550E#define E1000_DEV_ID_PCH_LNP_I219_V20 0x550F#define E1000_DEV_ID_PCH_LNP_I219_LM21 0x5510
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
@@ -7899,10 +7899,10 @@ static const struct pci_device_id e1000_pci_tbl[] = { { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM19), board_pch_adp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V19), board_pch_adp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_mtp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_mtp }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_mtp }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_mtp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_mtp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_mtp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_mtp },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/213 net/sched: accept TCA_STAB only for root qdisc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3cb7cf1540ddff5473d6baeb530228d19bc97b8a ]
Most qdiscs maintain their backlog using qdisc_pkt_len(skb) on the assumption it is invariant between the enqueue() and dequeue() handlers.
Unfortunately syzbot can crash a host rather easily using a TBF + SFQ combination, with an STAB on SFQ [1]
We can't support TCA_STAB on arbitrary level, this would require to maintain per-qdisc storage.
[1]
[ 88.796496] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 88.798611] #PF: supervisor read access in kernel mode [ 88.799014] #PF: error_code(0x0000) - not-present page [ 88.799506] PGD 0 P4D 0 [ 88.799829] Oops: Oops: 0000 [#1] SMP NOPTI [ 88.800569] CPU: 14 UID: 0 PID: 2053 Comm: b371744477 Not tainted 6.12.0-rc1-virtme #1117 [ 88.801107] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 88.801779] RIP: 0010:sfq_dequeue (net/sched/sch_sfq.c:272 net/sched/sch_sfq.c:499) sch_sfq [ 88.802544] Code: 0f b7 50 12 48 8d 04 d5 00 00 00 00 48 89 d6 48 29 d0 48 8b 91 c0 01 00 00 48 c1 e0 03 48 01 c2 66 83 7a 1a 00 7e c0 48 8b 3a <4c> 8b 07 4c 89 02 49 89 50 08 48 c7 47 08 00 00 00 00 48 c7 07 00
All code
========
0: 0f b7 50 12 movzwl 0x12(%rax),%edx
4: 48 8d 04 d5 00 00 00 lea 0x0(,%rdx,8),%rax
b: 00
c: 48 89 d6 mov %rdx,%rsi f: 48 29 d0 sub %rdx,%rax 12: 48 8b 91 c0 01 00 00 mov 0x1c0(%rcx),%rdx 19: 48 c1 e0 03 shl $0x3,%rax 1d: 48 01 c2 add %rax,%rdx 20: 66 83 7a 1a 00 cmpw $0x0,0x1a(%rdx) 25: 7e c0 jle 0xffffffffffffffe7 27: 48 8b 3a mov (%rdx),%rdi 2a:* 4c 8b 07 mov (%rdi),%r8 <-- trapping instruction 2d: 4c 89 02 mov %r8,(%rdx) 30: 49 89 50 08 mov %rdx,0x8(%r8) 34: 48 c7 47 08 00 00 00 movq $0x0,0x8(%rdi) 3b: 00 3c: 48 rex.W 3d: c7 .byte 0xc7 3e: 07 (bad) ...
Code starting with the faulting instruction
===========================================
0: 4c 8b 07 mov (%rdi),%r8 3: 4c 89 02 mov %r8,(%rdx) 6: 49 89 50 08 mov %rdx,0x8(%r8) a: 48 c7 47 08 00 00 00 movq $0x0,0x8(%rdi) 11: 00 12: 48 rex.W 13: c7 .byte 0xc7 14: 07 (bad) ... [ 88.803721] RSP: 0018:ffff9a1f892b7d58 EFLAGS: 00000206 [ 88.804032] RAX: 0000000000000000 RBX: ffff9a1f8420c800 RCX: ffff9a1f8420c800 [ 88.804560] RDX: ffff9a1f81bc1440 RSI: 0000000000000000 RDI: 0000000000000000 [ 88.805056] RBP: ffffffffc04bb0e0 R08: 0000000000000001 R09: 00000000ff7f9a1f [ 88.805473] R10: 000000000001001b R11: 0000000000009a1f R12: 0000000000000140 [ 88.806194] R13: 0000000000000001 R14: ffff9a1f886df400 R15: ffff9a1f886df4ac [ 88.806734] FS: 00007f445601a740(0000) GS:ffff9a2e7fd80000(0000) knlGS:0000000000000000 [ 88.807225] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 88.807672] CR2: 0000000000000000 CR3: 000000050cc46000 CR4: 00000000000006f0 [ 88.808165] Call Trace: [ 88.808459] <TASK> [ 88.808710] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434) [ 88.809261] ? page_fault_oops (arch/x86/mm/fault.c:715) [ 88.809561] ? exc_page_fault (./arch/x86/include/asm/irqflags.h:26 ./arch/x86/include/asm/irqflags.h:87 ./arch/x86/include/asm/irqflags.h:147 arch/x86/mm/fault.c:1489 arch/x86/mm/fault.c:1539) [ 88.809806] ? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:623) [ 88.810074] ? sfq_dequeue (net/sched/sch_sfq.c:272 net/sched/sch_sfq.c:499) sch_sfq [ 88.810411] sfq_reset (net/sched/sch_sfq.c:525) sch_sfq [ 88.810671] qdisc_reset (./include/linux/skbuff.h:2135 ./include/linux/skbuff.h:2441 ./include/linux/skbuff.h:3304 ./include/linux/skbuff.h:3310 net/sched/sch_generic.c:1036) [ 88.810950] tbf_reset (./include/linux/timekeeping.h:169 net/sched/sch_tbf.c:334) sch_tbf [ 88.811208] qdisc_reset (./include/linux/skbuff.h:2135 ./include/linux/skbuff.h:2441 ./include/linux/skbuff.h:3304 ./include/linux/skbuff.h:3310 net/sched/sch_generic.c:1036) [ 88.811484] netif_set_real_num_tx_queues (./include/linux/spinlock.h:396 ./include/net/sch_generic.h:768 net/core/dev.c:2958) [ 88.811870] __tun_detach (drivers/net/tun.c:590 drivers/net/tun.c:673) [ 88.812271] tun_chr_close (drivers/net/tun.c:702 drivers/net/tun.c:3517) [ 88.812505] __fput (fs/file_table.c:432 (discriminator 1)) [ 88.812735] task_work_run (kernel/task_work.c:230) [ 88.813016] do_exit (kernel/exit.c:940) [ 88.813372] ? trace_hardirqs_on (kernel/trace/trace_preemptirq.c:58 (discriminator 4)) [ 88.813639] ? handle_mm_fault (./arch/x86/include/asm/irqflags.h:42 ./arch/x86/include/asm/irqflags.h:97 ./arch/x86/include/asm/irqflags.h:155 ./include/linux/memcontrol.h:1022 ./include/linux/memcontrol.h:1045 ./include/linux/memcontrol.h:1052 mm/memory.c:5928 mm/memory.c:6088) [ 88.813867] do_group_exit (kernel/exit.c:1070) [ 88.814138] __x64_sys_exit_group (kernel/exit.c:1099) [ 88.814490] x64_sys_call (??:?) [ 88.814791] do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1) arch/x86/entry/common.c:83 (discriminator 1)) [ 88.815012] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) [ 88.815495] RIP: 0033:0x7f44560f1975
--- include/net/sch_generic.h | 1 - net/sched/sch_api.c | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-)
include/net/sch_generic.h +0 -1
@@ -845,7 +845,6 @@ static inline void qdisc_calculate_pkt_len(struct sk_buff *skb,static inline int qdisc_enqueue (struct sk_buff *skb,struct Qdisc *sch,struct sk_buff **to_free) { -qdisc_calculate_pkt_len (skb, sch);return sch->enqueue (skb, sch, to_free); }
net/sched/sch_api.c +6 -1
@@ -593,7 +593,6 @@ void __qdisc_calculate_pkt_len(struct sk_buff *skb, pkt_len =1 ;qdisc_skb_cb (skb)->pkt_len = pkt_len; } -EXPORT_SYMBOL (__qdisc_calculate_pkt_len);void qdisc_warn_nonwc (const char *txt,struct Qdisc *qdisc) {
@@ -1172,6 +1171,12 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,return -EINVAL ; } +if (new && + !(parent->flags &TCQ_F_MQROOT ) && +rcu_access_pointer (new->stab)) { +NL_SET_ERR_MSG (extack,"STAB not supported on a non root" ); +return -EINVAL ; + } err = cops->graft (parent, cl, new, &old, extack);if (err)return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/213 net: ibm: emac: mal: fix wrong goto
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 08c8acc9d8f3f70d62dd928571368d5018206490 ]
dcr_map is called in the previous if and therefore needs to be unmapped.
--- drivers/net/ethernet/ibm/emac/mal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/emac/mal.c +1 -1
@@ -578,7 +578,7 @@ static int mal_probe(struct platform_device *ofdev)printk (KERN_ERR "%pOF: Support for 405EZ not enabled!\n" , ofdev->dev.of_node); err = -ENODEV ; - goto fail; + goto fail_unmap;#endif }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/213 btrfs: zoned: fix missing RCU locking in error message when loading zone info
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit fe4cd7ed128fe82ab9fe4f9fc8a73d4467699787 ]
At btrfs_load_zone_info() we have an error path that is dereferencing the name of a device which is a RCU string but we are not holding a RCU read lock, which is incorrect.
Fix this by using btrfs_err_in_rcu() instead of btrfs_err().
The problem is there since commit 08e11a3db098 ("btrfs: zoned: load zone's allocation offset"), back then at btrfs_load_block_group_zone_info() but then later on that code was factored out into the helper btrfs_load_zone_info() by commit 09a46725cc84 ("btrfs: zoned: factor out per-zone logic from btrfs_load_block_group_zone_info").
--- fs/btrfs/zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/zoned.c +1 -1
@@ -1357,7 +1357,7 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,switch (zone.cond) {case BLK_ZONE_COND_OFFLINE :case BLK_ZONE_COND_READONLY : -btrfs_err (fs_info, +btrfs_err_in_rcu (fs_info,"zoned: offline/readonly zone %llu on device %s (devid %llu)" , (info->physical >> device->zone_info->zone_size_shift),rcu_str_deref (device->name), device->devid);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/213 sctp: ensure sk_state is set to CLOSED if hashing fails in sctp_listen_start
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 4d5c70e6155d5eae198bade4afeab3c1b15073b6 ]
If hashing fails in sctp_listen_start(), the socket remains in the LISTENING state, even though it was not added to the hash table. This can lead to a scenario where a socket appears to be listening without actually being accessible.
This patch ensures that if the hashing operation fails, the sk_state is set back to CLOSED before returning an error.
Note that there is no need to undo the autobind operation if hashing fails, as the bind port can still be used for next listen() call on the same socket.
--- net/sctp/socket.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
net/sctp/socket.c +13 -5
@@ -8525,6 +8525,7 @@ static int sctp_listen_start(struct sock *sk, int backlog)struct sctp_endpoint *ep = sp->ep;struct crypto_shash *tfm =NULL ;char alg[32 ]; +int err;/* Allocate HMAC for generating cookie. */ if (!sp->hmac && sp->sctp_hmac_alg) {
@@ -8552,18 +8553,25 @@ static int sctp_listen_start(struct sock *sk, int backlog)inet_sk_set_state (sk,SCTP_SS_LISTENING );if (!ep->base.bind_addr.port) {if (sctp_autobind (sk)) { -inet_sk_set_state (sk,SCTP_SS_CLOSED ); -return -EAGAIN ; + err = -EAGAIN ; + goto err; } }else {if (sctp_get_port (sk,inet_sk (sk)->inet_num)) { -inet_sk_set_state (sk,SCTP_SS_CLOSED ); -return -EADDRINUSE ; + err = -EADDRINUSE ; + goto err; } }WRITE_ONCE (sk->sk_max_ack_backlog, backlog); -return sctp_hash_endpoint (ep); + err =sctp_hash_endpoint (ep); +if (err) + goto err; + +return 0 ; +err: +inet_sk_set_state (sk,SCTP_SS_CLOSED ); +return err; }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/213 netfilter: xtables: avoid NFPROTO_UNSPEC where needed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 0bfcb7b71e735560077a42847f69597ec7dcc326 ]
syzbot managed to call xt_cluster match via ebtables:
WARNING: CPU: 0 PID: 11 at net/netfilter/xt_cluster.c:72 xt_cluster_mt+0x196/0x780 [..] ebt_do_table+0x174b/0x2a40
Module registers to NFPROTO_UNSPEC, but it assumes ipv4/ipv6 packet processing. As this is only useful to restrict locally terminating TCP/UDP traffic, register this for ipv4 and ipv6 family only.
Pablo points out that this is a general issue, direct users of the set/getsockopt interface can call into targets/matches that were only intended for use with ip(6)tables.
Check all UNSPEC matches and targets for similar issues:
- matches and targets are fine except if they assume skb_network_header() is valid -- this is only true when called from inet layer: ip(6) stack pulls the ip/ipv6 header into linear data area.
- targets that return XT_CONTINUE or other xtables verdicts must be restricted too, they are incompatbile with the ebtables traverser, e.g. EBT_CONTINUE is a completely different value than XT_CONTINUE.
Most matches/targets are changed to register for NFPROTO_IPV4/IPV6, as they are provided for use by ip(6)tables.
The MARK target is also used by arptables, so register for NFPROTO_ARP too.
While at it, bail out if connbytes fails to enable the corresponding conntrack family.
This change passes the selftests in iptables.git.
--- net/netfilter/xt_CHECKSUM.c | 33 ++++++---- net/netfilter/xt_CLASSIFY.c | 16 ++++- net/netfilter/xt_CONNSECMARK.c | 36 +++++++---- net/netfilter/xt_CT.c | 106 +++++++++++++++++++++------------ net/netfilter/xt_IDLETIMER.c | 59 ++++++++++++------ net/netfilter/xt_LED.c | 39 ++++++++---- net/netfilter/xt_NFLOG.c | 36 +++++++---- net/netfilter/xt_RATEEST.c | 39 ++++++++---- net/netfilter/xt_SECMARK.c | 27 ++++++++- net/netfilter/xt_TRACE.c | 35 +++++++---- net/netfilter/xt_addrtype.c | 15 ++++- net/netfilter/xt_cluster.c | 33 ++++++---- net/netfilter/xt_connbytes.c | 4 +- net/netfilter/xt_connlimit.c | 39 ++++++++---- net/netfilter/xt_connmark.c | 28 ++++++++- net/netfilter/xt_mark.c | 42 +++++++++---- 16 files changed, 422 insertions(+), 165 deletions(-)
net/netfilter/xt_CHECKSUM.c +23 -10
@@ -63,24 +63,37 @@ static int checksum_tg_check(const struct xt_tgchk_param *par)return 0 ; } -static struct xt_target checksum_tg_reg__read_mostly = { - .name ="CHECKSUM" , - .family =NFPROTO_UNSPEC , - .target = checksum_tg, - .targetsize =sizeof (struct xt_CHECKSUM_info ), - .table ="mangle" , - .checkentry = checksum_tg_check, - .me =THIS_MODULE , +static struct xt_target checksum_tg_reg[]__read_mostly = { + { + .name ="CHECKSUM" , + .family =NFPROTO_IPV4 , + .target = checksum_tg, + .targetsize =sizeof (struct xt_CHECKSUM_info ), + .table ="mangle" , + .checkentry = checksum_tg_check, + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="CHECKSUM" , + .family =NFPROTO_IPV6 , + .target = checksum_tg, + .targetsize =sizeof (struct xt_CHECKSUM_info ), + .table ="mangle" , + .checkentry = checksum_tg_check, + .me =THIS_MODULE , + }, +#endif };static int __init checksum_tg_init (void ) { -return xt_register_target (&checksum_tg_reg); +return xt_register_targets (checksum_tg_reg,ARRAY_SIZE (checksum_tg_reg)); } static void __exit checksum_tg_exit(void) { -xt_unregister_target (&checksum_tg_reg); +xt_unregister_targets (checksum_tg_reg,ARRAY_SIZE (checksum_tg_reg)); }module_init (checksum_tg_init);
net/netfilter/xt_CLASSIFY.c +14 -2
@@ -38,9 +38,9 @@ static struct xt_target classify_tg_reg[] __read_mostly = { { .name = "CLASSIFY", .revision = 0, - .family = NFPROTO_UNSPEC, + .family = NFPROTO_IPV4, .hooks = (1 <<NF_INET_LOCAL_OUT ) | (1 <<NF_INET_FORWARD ) | - (1 << NF_INET_POST_ROUTING), + (1 << NF_INET_POST_ROUTING), .target = classify_tg, .targetsize = sizeof(struct xt_classify_target_info), .me = THIS_MODULE,
@@ -54,6 +54,18 @@ static struct xt_target classify_tg_reg[] __read_mostly = { .targetsize = sizeof(struct xt_classify_target_info), .me = THIS_MODULE, }, +#if IS_ENABLED (CONFIG_IP6_NF_IPTABLES ) + { + .name = "CLASSIFY", + .revision = 0, + .family = NFPROTO_IPV6, + .hooks = (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_FORWARD) | + (1 << NF_INET_POST_ROUTING), + .target = classify_tg, + .targetsize = sizeof(struct xt_classify_target_info), + .me = THIS_MODULE, + }, +#endif };static int __init classify_tg_init (void )
net/netfilter/xt_CONNSECMARK.c +25 -11
@@ -114,25 +114,39 @@ static void connsecmark_tg_destroy(const struct xt_tgdtor_param *par)nf_ct_netns_put (par->net, par->family); } -static struct xt_target connsecmark_tg_reg__read_mostly = { - .name ="CONNSECMARK" , - .revision =0 , - .family =NFPROTO_UNSPEC , - .checkentry = connsecmark_tg_check, - .destroy = connsecmark_tg_destroy, - .target = connsecmark_tg, - .targetsize =sizeof (struct xt_connsecmark_target_info ), - .me =THIS_MODULE , +static struct xt_target connsecmark_tg_reg[]__read_mostly = { + { + .name ="CONNSECMARK" , + .revision =0 , + .family =NFPROTO_IPV4 , + .checkentry = connsecmark_tg_check, + .destroy = connsecmark_tg_destroy, + .target = connsecmark_tg, + .targetsize =sizeof (struct xt_connsecmark_target_info ), + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="CONNSECMARK" , + .revision =0 , + .family =NFPROTO_IPV6 , + .checkentry = connsecmark_tg_check, + .destroy = connsecmark_tg_destroy, + .target = connsecmark_tg, + .targetsize =sizeof (struct xt_connsecmark_target_info ), + .me =THIS_MODULE , + }, +#endif };static int __init connsecmark_tg_init (void ) { -return xt_register_target (&connsecmark_tg_reg); +return xt_register_targets (connsecmark_tg_reg,ARRAY_SIZE (connsecmark_tg_reg)); } static void __exit connsecmark_tg_exit(void) { -xt_unregister_target (&connsecmark_tg_reg); +xt_unregister_targets (connsecmark_tg_reg,ARRAY_SIZE (connsecmark_tg_reg)); }module_init (connsecmark_tg_init);
net/netfilter/xt_CT.c +69 -37
142 lines not on this page · raw message
net/netfilter/xt_IDLETIMER.c +40 -19
68 lines not on this page · raw message
net/netfilter/xt_LED.c +27 -12
@@ -175,26 +175,41 @@ static void led_tg_destroy(const struct xt_tgdtor_param *par)kfree (ledinternal); } -static struct xt_target led_tg_reg__read_mostly = { - .name ="LED" , - .revision =0 , - .family =NFPROTO_UNSPEC , - .target = led_tg, - .targetsize =sizeof (struct xt_led_info ), - .usersize = offsetof(struct xt_led_info , internal_data), - .checkentry = led_tg_check, - .destroy = led_tg_destroy, - .me =THIS_MODULE , +static struct xt_target led_tg_reg[]__read_mostly = { + { + .name ="LED" , + .revision =0 , + .family =NFPROTO_IPV4 , + .target = led_tg, + .targetsize =sizeof (struct xt_led_info ), + .usersize = offsetof(struct xt_led_info , internal_data), + .checkentry = led_tg_check, + .destroy = led_tg_destroy, + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="LED" , + .revision =0 , + .family =NFPROTO_IPV6 , + .target = led_tg, + .targetsize =sizeof (struct xt_led_info ), + .usersize = offsetof(struct xt_led_info , internal_data), + .checkentry = led_tg_check, + .destroy = led_tg_destroy, + .me =THIS_MODULE , + }, +#endif };static int __init led_tg_init (void ) { -return xt_register_target (&led_tg_reg); +return xt_register_targets (led_tg_reg,ARRAY_SIZE (led_tg_reg)); } static void __exit led_tg_exit(void) { -xt_unregister_target (&led_tg_reg); +xt_unregister_targets (led_tg_reg,ARRAY_SIZE (led_tg_reg)); }module_init (led_tg_init);
net/netfilter/xt_NFLOG.c +25 -11
@@ -64,25 +64,39 @@ static void nflog_tg_destroy(const struct xt_tgdtor_param *par)nf_logger_put (par->family,NF_LOG_TYPE_ULOG ); } -static struct xt_target nflog_tg_reg__read_mostly = { - .name ="NFLOG" , - .revision =0 , - .family =NFPROTO_UNSPEC , - .checkentry = nflog_tg_check, - .destroy = nflog_tg_destroy, - .target = nflog_tg, - .targetsize =sizeof (struct xt_nflog_info ), - .me =THIS_MODULE , +static struct xt_target nflog_tg_reg[]__read_mostly = { + { + .name ="NFLOG" , + .revision =0 , + .family =NFPROTO_IPV4 , + .checkentry = nflog_tg_check, + .destroy = nflog_tg_destroy, + .target = nflog_tg, + .targetsize =sizeof (struct xt_nflog_info ), + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="NFLOG" , + .revision =0 , + .family =NFPROTO_IPV4 , + .checkentry = nflog_tg_check, + .destroy = nflog_tg_destroy, + .target = nflog_tg, + .targetsize =sizeof (struct xt_nflog_info ), + .me =THIS_MODULE , + }, +#endif };static int __init nflog_tg_init (void ) { -return xt_register_target (&nflog_tg_reg); +return xt_register_targets (nflog_tg_reg,ARRAY_SIZE (nflog_tg_reg)); } static void __exit nflog_tg_exit(void) { -xt_unregister_target (&nflog_tg_reg); +xt_unregister_targets (nflog_tg_reg,ARRAY_SIZE (nflog_tg_reg)); }module_init (nflog_tg_init);
net/netfilter/xt_RATEEST.c +27 -12
@@ -179,16 +179,31 @@ static void xt_rateest_tg_destroy(const struct xt_tgdtor_param *par)xt_rateest_put (par->net, info->est); } -static struct xt_target xt_rateest_tg_reg__read_mostly = { - .name ="RATEEST" , - .revision =0 , - .family =NFPROTO_UNSPEC , - .target = xt_rateest_tg, - .checkentry = xt_rateest_tg_checkentry, - .destroy = xt_rateest_tg_destroy, - .targetsize =sizeof (struct xt_rateest_target_info ), - .usersize = offsetof(struct xt_rateest_target_info , est), - .me =THIS_MODULE , +static struct xt_target xt_rateest_tg_reg[]__read_mostly = { + { + .name ="RATEEST" , + .revision =0 , + .family =NFPROTO_IPV4 , + .target = xt_rateest_tg, + .checkentry = xt_rateest_tg_checkentry, + .destroy = xt_rateest_tg_destroy, + .targetsize =sizeof (struct xt_rateest_target_info ), + .usersize = offsetof(struct xt_rateest_target_info , est), + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="RATEEST" , + .revision =0 , + .family =NFPROTO_IPV6 , + .target = xt_rateest_tg, + .checkentry = xt_rateest_tg_checkentry, + .destroy = xt_rateest_tg_destroy, + .targetsize =sizeof (struct xt_rateest_target_info ), + .usersize = offsetof(struct xt_rateest_target_info , est), + .me =THIS_MODULE , + }, +#endif };static __net_init int xt_rateest_net_init (struct net *net)
@@ -214,12 +229,12 @@ static int __init xt_rateest_tg_init(void)if (err)return err; -return xt_register_target (&xt_rateest_tg_reg); +return xt_register_targets (xt_rateest_tg_reg,ARRAY_SIZE (xt_rateest_tg_reg)); } static void __exit xt_rateest_tg_fini(void) { -xt_unregister_target (&xt_rateest_tg_reg); +xt_unregister_targets (xt_rateest_tg_reg,ARRAY_SIZE (xt_rateest_tg_reg));unregister_pernet_subsys (&xt_rateest_net_ops); }
net/netfilter/xt_SECMARK.c +25 -2
@@ -157,7 +157,7 @@ static struct xt_target secmark_tg_reg[] __read_mostly = { { .name = "SECMARK", .revision = 0, - .family = NFPROTO_UNSPEC, + .family = NFPROTO_IPV4, .checkentry = secmark_tg_check_v0, .destroy = secmark_tg_destroy, .target = secmark_tg_v0,
@@ -167,7 +167,7 @@ static struct xt_target secmark_tg_reg[] __read_mostly = { { .name = "SECMARK", .revision = 1, - .family = NFPROTO_UNSPEC, + .family = NFPROTO_IPV4, .checkentry = secmark_tg_check_v1, .destroy = secmark_tg_destroy, .target = secmark_tg_v1,
@@ -175,6 +175,29 @@ static struct xt_target secmark_tg_reg[] __read_mostly = { .usersize = offsetof(struct xt_secmark_target_info_v1, secid), .me = THIS_MODULE, }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name = "SECMARK", + .revision = 0, + .family = NFPROTO_IPV6, + .checkentry = secmark_tg_check_v0, + .destroy = secmark_tg_destroy, + .target = secmark_tg_v0, + .targetsize = sizeof(struct xt_secmark_target_info), + .me = THIS_MODULE, + }, + { + .name = "SECMARK", + .revision = 1, + .family = NFPROTO_IPV6, + .checkentry = secmark_tg_check_v1, + .destroy = secmark_tg_destroy, + .target = secmark_tg_v1, + .targetsize = sizeof(struct xt_secmark_target_info_v1), + .usersize = offsetof(struct xt_secmark_target_info_v1, secid), + .me = THIS_MODULE, + }, +#endif }; static int __init secmark_tg_init(void)
net/netfilter/xt_TRACE.c +24 -11
@@ -29,25 +29,38 @@ trace_tg(struct sk_buff *skb, const struct xt_action_param *par)return XT_CONTINUE ; } -static struct xt_target trace_tg_reg__read_mostly = { - .name ="TRACE" , - .revision =0 , - .family =NFPROTO_UNSPEC , - .table ="raw" , - .target = trace_tg, - .checkentry = trace_tg_check, - .destroy = trace_tg_destroy, - .me =THIS_MODULE , +static struct xt_target trace_tg_reg[]__read_mostly = { + { + .name ="TRACE" , + .revision =0 , + .family =NFPROTO_IPV4 , + .table ="raw" , + .target = trace_tg, + .checkentry = trace_tg_check, + .destroy = trace_tg_destroy, + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="TRACE" , + .revision =0 , + .family =NFPROTO_IPV6 , + .table ="raw" , + .target = trace_tg, + .checkentry = trace_tg_check, + .destroy = trace_tg_destroy, + }, +#endif };static int __init trace_tg_init (void ) { -return xt_register_target (&trace_tg_reg); +return xt_register_targets (trace_tg_reg,ARRAY_SIZE (trace_tg_reg)); } static void __exit trace_tg_exit(void) { -xt_unregister_target (&trace_tg_reg); +xt_unregister_targets (trace_tg_reg,ARRAY_SIZE (trace_tg_reg)); }module_init (trace_tg_init);
net/netfilter/xt_addrtype.c +13 -2
@@ -208,13 +208,24 @@ static struct xt_match addrtype_mt_reg[] __read_mostly = { }, { .name = "addrtype", - .family = NFPROTO_UNSPEC, + .family = NFPROTO_IPV4, .revision = 1, .match = addrtype_mt_v1, .checkentry = addrtype_mt_checkentry_v1, .matchsize = sizeof(struct xt_addrtype_info_v1), .me = THIS_MODULE - } + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name = "addrtype", + .family = NFPROTO_IPV6, + .revision = 1, + .match = addrtype_mt_v1, + .checkentry = addrtype_mt_checkentry_v1, + .matchsize = sizeof(struct xt_addrtype_info_v1), + .me = THIS_MODULE + }, +#endif }; static int __init addrtype_mt_init(void)
net/netfilter/xt_cluster.c +23 -10
@@ -146,24 +146,37 @@ static void xt_cluster_mt_destroy(const struct xt_mtdtor_param *par)nf_ct_netns_put (par->net, par->family); } -static struct xt_match xt_cluster_match__read_mostly = { - .name ="cluster" , - .family =NFPROTO_UNSPEC , - .match = xt_cluster_mt, - .checkentry = xt_cluster_mt_checkentry, - .matchsize =sizeof (struct xt_cluster_match_info ), - .destroy = xt_cluster_mt_destroy, - .me =THIS_MODULE , +static struct xt_match xt_cluster_match[]__read_mostly = { + { + .name ="cluster" , + .family =NFPROTO_IPV4 , + .match = xt_cluster_mt, + .checkentry = xt_cluster_mt_checkentry, + .matchsize =sizeof (struct xt_cluster_match_info ), + .destroy = xt_cluster_mt_destroy, + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="cluster" , + .family =NFPROTO_IPV6 , + .match = xt_cluster_mt, + .checkentry = xt_cluster_mt_checkentry, + .matchsize =sizeof (struct xt_cluster_match_info ), + .destroy = xt_cluster_mt_destroy, + .me =THIS_MODULE , + }, +#endif };static int __init xt_cluster_mt_init (void ) { -return xt_register_match (&xt_cluster_match); +return xt_register_matches (xt_cluster_match,ARRAY_SIZE (xt_cluster_match)); } static void __exit xt_cluster_mt_fini(void) { -xt_unregister_match (&xt_cluster_match); +xt_unregister_matches (xt_cluster_match,ARRAY_SIZE (xt_cluster_match)); }MODULE_AUTHOR ("Pablo Neira Ayuso <[email protected]>" );
net/netfilter/xt_connbytes.c +3 -1
@@ -111,9 +111,11 @@ static int connbytes_mt_check(const struct xt_mtchk_param *par)return -EINVAL ; ret =nf_ct_netns_get (par->net, par->family); -if (ret <0 ) +if (ret <0 ) {pr_info_ratelimited ("cannot load conntrack support for proto=%u\n" , par->family); +return ret; + }/* * This filter cannot function correctly unless connection tracking
net/netfilter/xt_connlimit.c +27 -12
@@ -106,26 +106,41 @@ static void connlimit_mt_destroy(const struct xt_mtdtor_param *par)nf_conncount_destroy (par->net, par->family, info->data); } -static struct xt_match connlimit_mt_reg__read_mostly = { - .name ="connlimit" , - .revision =1 , - .family =NFPROTO_UNSPEC , - .checkentry = connlimit_mt_check, - .match = connlimit_mt, - .matchsize =sizeof (struct xt_connlimit_info ), - .usersize = offsetof(struct xt_connlimit_info , data), - .destroy = connlimit_mt_destroy, - .me =THIS_MODULE , +static struct xt_match connlimit_mt_reg[]__read_mostly = { + { + .name ="connlimit" , + .revision =1 , + .family =NFPROTO_IPV4 , + .checkentry = connlimit_mt_check, + .match = connlimit_mt, + .matchsize =sizeof (struct xt_connlimit_info ), + .usersize = offsetof(struct xt_connlimit_info , data), + .destroy = connlimit_mt_destroy, + .me =THIS_MODULE , + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name ="connlimit" , + .revision =1 , + .family =NFPROTO_IPV6 , + .checkentry = connlimit_mt_check, + .match = connlimit_mt, + .matchsize =sizeof (struct xt_connlimit_info ), + .usersize = offsetof(struct xt_connlimit_info , data), + .destroy = connlimit_mt_destroy, + .me =THIS_MODULE , + }, +#endif };static int __init connlimit_mt_init (void ) { -return xt_register_match (&connlimit_mt_reg); +return xt_register_matches (connlimit_mt_reg,ARRAY_SIZE (connlimit_mt_reg)); } static void __exit connlimit_mt_exit(void) { -xt_unregister_match (&connlimit_mt_reg); +xt_unregister_matches (connlimit_mt_reg,ARRAY_SIZE (connlimit_mt_reg)); }module_init (connlimit_mt_init);
net/netfilter/xt_connmark.c +25 -3
@@ -151,7 +151,7 @@ static struct xt_target connmark_tg_reg[] __read_mostly = { { .name = "CONNMARK", .revision = 1, - .family = NFPROTO_UNSPEC, + .family = NFPROTO_IPV4, .checkentry = connmark_tg_check, .target = connmark_tg, .targetsize = sizeof(struct xt_connmark_tginfo1),
@@ -161,13 +161,35 @@ static struct xt_target connmark_tg_reg[] __read_mostly = { { .name = "CONNMARK", .revision = 2, - .family = NFPROTO_UNSPEC, + .family = NFPROTO_IPV4, .checkentry = connmark_tg_check, .target = connmark_tg_v2, .targetsize = sizeof(struct xt_connmark_tginfo2), .destroy = connmark_tg_destroy, .me = THIS_MODULE, - } + }, +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) + { + .name = "CONNMARK", + .revision = 1, + .family = NFPROTO_IPV6, + .checkentry = connmark_tg_check, + .target = connmark_tg, + .targetsize = sizeof(struct xt_connmark_tginfo1), + .destroy = connmark_tg_destroy, + .me = THIS_MODULE, + }, + { + .name = "CONNMARK", + .revision = 2, + .family = NFPROTO_IPV6, + .checkentry = connmark_tg_check, + .target = connmark_tg_v2, + .targetsize = sizeof(struct xt_connmark_tginfo2), + .destroy = connmark_tg_destroy, + .me = THIS_MODULE, + }, +#endif }; static struct xt_match connmark_mt_reg __read_mostly = {
net/netfilter/xt_mark.c +32 -10
64 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/213 netfilter: fib: check correct rtable in vrf setups
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 05ef7055debc804e8083737402127975e7244fc4 ]
We need to init l3mdev unconditionally, else main routing table is searched and incorrect result is returned unless strict (iif keyword) matching is requested.
Next patch adds a selftest for this.
--- net/ipv4/netfilter/nft_fib_ipv4.c | 4 +--- net/ipv6/netfilter/nft_fib_ipv6.c | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-)
net/ipv4/netfilter/nft_fib_ipv4.c +1 -3
@@ -66,6 +66,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, .flowi4_scope = RT_SCOPE_UNIVERSE, .flowi4_iif = LOOPBACK_IFINDEX, .flowi4_uid = sock_net_uid(nft_net(pkt), NULL), + .flowi4_l3mdev = l3mdev_master_ifindex_rcu(nft_in(pkt)), };const struct net_device *oif;const struct net_device *found;
@@ -84,9 +85,6 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,else oif =NULL ; -if (priv->flags &NFTA_FIB_F_IIF ) - fl4.flowi4_l3mdev =l3mdev_master_ifindex_rcu (oif); -if (nft_hook (pkt) ==NF_INET_PRE_ROUTING &&nft_fib_is_loopback (pkt->skb,nft_in (pkt))) {nft_fib_store_result (dest, priv,nft_in (pkt));
net/ipv6/netfilter/nft_fib_ipv6.c +3 -2
@@ -41,8 +41,6 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,if (ipv6_addr_type (&fl6->daddr) &IPV6_ADDR_LINKLOCAL ) { lookup_flags |=RT6_LOOKUP_F_IFACE ; fl6->flowi6_oif =get_ifindex (dev ? dev : pkt->skb->dev); - }else if (priv->flags &NFTA_FIB_F_IIF ) { - fl6->flowi6_l3mdev =l3mdev_master_ifindex_rcu (dev); }if (ipv6_addr_type (&fl6->saddr) &IPV6_ADDR_UNICAST )
@@ -75,6 +73,8 @@ static u32 __nft_fib6_eval_type(const struct nft_fib *priv,else if (priv->flags &NFTA_FIB_F_OIF ) dev =nft_out (pkt); + fl6.flowi6_l3mdev =l3mdev_master_ifindex_rcu (dev); +nft_fib6_flowi_init (&fl6, priv, pkt, dev, iph);if (dev &&nf_ipv6_chk_addr (nft_net (pkt), &fl6.daddr, dev, true))
@@ -165,6 +165,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs, .flowi6_iif = LOOPBACK_IFINDEX, .flowi6_proto = pkt->tprot, .flowi6_uid = sock_net_uid(nft_net(pkt), NULL), + .flowi6_l3mdev = l3mdev_master_ifindex_rcu(nft_in(pkt)), };struct rt6_info *rt;int lookup_flags;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/213 net: do not delay dst_entries_add() in dst_release()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ac888d58869bb99753e7652be19a151df9ecb35d ]
dst_entries_add() uses per-cpu data that might be freed at netns dismantle from ip6_route_net_exit() calling dst_entries_destroy()
Before ip6_route_net_exit() can be called, we release all the dsts associated with this netns, via calls to dst_release(), which waits an rcu grace period before calling dst_destroy()
dst_entries_add() use in dst_destroy() is racy, because dst_entries_destroy() could have been called already.
Decrementing the number of dsts must happen sooner.
Notes:
1) in CONFIG_XFRM case, dst_destroy() can call dst_release_immediate(child), this might also cause UAF if the child does not have DST_NOCOUNT set.
IPSEC maintainers might take a look and see how to address this.
2) There is also discussion about removing this count of dst, which might happen in future kernels.
--- net/core/dst.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
net/core/dst.c +12 -5
@@ -109,9 +109,6 @@ struct dst_entry *dst_destroy(struct dst_entry * dst) child = xdst->child; }#endif -if (!(dst->flags &DST_NOCOUNT )) -dst_entries_add (dst->ops,-1 ); -if (dst->ops->destroy) dst->ops->destroy (dst);netdev_put (dst->dev, &dst->dev_tracker);
@@ -161,17 +158,27 @@ void dst_dev_put(struct dst_entry *dst) }EXPORT_SYMBOL (dst_dev_put); +static void dst_count_dec (struct dst_entry *dst) +{ +if (!(dst->flags &DST_NOCOUNT )) +dst_entries_add (dst->ops,-1 ); +} +void dst_release (struct dst_entry *dst) { -if (dst &&rcuref_put (&dst->__rcuref)) +if (dst &&rcuref_put (&dst->__rcuref)) { +dst_count_dec (dst);call_rcu_hurry (&dst->rcu_head, dst_destroy_rcu); + } }EXPORT_SYMBOL (dst_release);void dst_release_immediate (struct dst_entry *dst) { -if (dst &&rcuref_put (&dst->__rcuref)) +if (dst &&rcuref_put (&dst->__rcuref)) { +dst_count_dec (dst);dst_destroy (dst); + } }EXPORT_SYMBOL (dst_release_immediate);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/213 rtnetlink: Add bulk registration helpers for rtnetlink message handlers.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 07cc7b0b942bf55ef1a471470ecda8d2a6a6541f ]
Before commit addf9b90de22 ("net: rtnetlink: use rcu to free rtnl message handlers"), once rtnl_msg_handlers[protocol] was allocated, the following rtnl_register_module() for the same protocol never failed.
However, after the commit, rtnl_msg_handler[protocol][msgtype] needs to be allocated in each rtnl_register_module(), so each call could fail.
Many callers of rtnl_register_module() do not handle the returned error, and we need to add many error handlings.
To handle that easily, let's add wrapper functions for bulk registration of rtnetlink message handlers.
Stable-dep-of: 78b7b991838a ("vxlan: Handle error of rtnl_register_module().")
--- include/net/rtnetlink.h | 17 +++++++++++++++++ net/core/rtnetlink.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+)
include/net/rtnetlink.h +17 -0
@@ -27,6 +27,15 @@ static inline enum rtnl_kinds rtnl_msgtype_kind(int msgtype)return msgtype &RTNL_KIND_MASK ; } +struct rtnl_msg_handler { +struct module *owner; +int protocol; +int msgtype; +rtnl_doit_func doit; +rtnl_dumpit_func dumpit; +int flags; +}; +void rtnl_register (int protocol,int msgtype,rtnl_doit_func ,rtnl_dumpit_func ,unsigned int flags); int rtnl_register_module(struct module *owner, int protocol, int msgtype,
@@ -34,6 +43,14 @@ int rtnl_register_module(struct module *owner, int protocol, int msgtype,int rtnl_unregister (int protocol,int msgtype);void rtnl_unregister_all (int protocol); +int __rtnl_register_many (const struct rtnl_msg_handler *handlers,int n); +void __rtnl_unregister_many (const struct rtnl_msg_handler *handlers,int n); + +#define rtnl_register_many (handlers) \ + __rtnl_register_many(handlers, ARRAY_SIZE(handlers)) +#define rtnl_unregister_many (handlers) \ + __rtnl_unregister_many(handlers, ARRAY_SIZE(handlers)) +static inline int rtnl_msg_family (const struct nlmsghdr *nlh) {if (nlmsg_len (nlh) >=sizeof (struct rtgenmsg ))
net/core/rtnetlink.c +29 -0
@@ -389,6 +389,35 @@ void rtnl_unregister_all(int protocol) }EXPORT_SYMBOL_GPL (rtnl_unregister_all); +int __rtnl_register_many (const struct rtnl_msg_handler *handlers,int n) +{ +const struct rtnl_msg_handler *handler; +int i, err; + +for (i =0 , handler = handlers; i < n; i++, handler++) { + err =rtnl_register_internal (handler->owner, handler->protocol, + handler->msgtype, handler->doit, + handler->dumpit, handler->flags); +if (err) { +__rtnl_unregister_many (handlers, i); +break ; + } + } + +return err; +} +EXPORT_SYMBOL_GPL (__rtnl_register_many); + +void __rtnl_unregister_many (const struct rtnl_msg_handler *handlers,int n) +{ +const struct rtnl_msg_handler *handler; +int i; + +for (i = n -1 , handler = handlers + n -1 ; i >=0 ; i--, handler--) +rtnl_unregister (handler->protocol, handler->msgtype); +} +EXPORT_SYMBOL_GPL (__rtnl_unregister_many); +static LIST_HEAD (link_ops);static const struct rtnl_link_ops *rtnl_link_ops_get (const char *kind)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/213 vxlan: Handle error of rtnl_register_module().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 78b7b991838a4a6baeaad934addc4db2c5917eb8 ]
Since introduced, vxlan_vnifilter_init() has been ignoring the returned value of rtnl_register_module(), which could fail silently.
Handling the error allows users to view a module as an all-or-nothing thing in terms of the rtnetlink functionality. This prevents syzkaller from reporting spurious errors from its tests, where OOM often occurs and module is automatically loaded.
Let's handle the errors by rtnl_register_many().
--- drivers/net/vxlan/vxlan_core.c | 6 +++++- drivers/net/vxlan/vxlan_private.h | 2 +- drivers/net/vxlan/vxlan_vnifilter.c | 19 +++++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/vxlan/vxlan_core.c +5 -1
@@ -4819,9 +4819,13 @@ static int __init vxlan_init_module(void)if (rc) goto out4; -vxlan_vnifilter_init (); + rc =vxlan_vnifilter_init (); +if (rc) + goto out5;return 0 ; +out5: +rtnl_link_unregister (&vxlan_link_ops); out4:unregister_switchdev_notifier (&vxlan_switchdev_notifier_block); out3:
drivers/net/vxlan/vxlan_private.h +1 -1
@@ -202,7 +202,7 @@ int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,int vxlan_vnigroup_init (struct vxlan_dev *vxlan);void vxlan_vnigroup_uninit (struct vxlan_dev *vxlan); -void vxlan_vnifilter_init (void ); +int vxlan_vnifilter_init (void );void vxlan_vnifilter_uninit (void ); void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni, struct vxlan_vni_node *vninode,
drivers/net/vxlan/vxlan_vnifilter.c +9 -10
@@ -992,19 +992,18 @@ static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,return err; } -void vxlan_vnifilter_init (void ) +static const struct rtnl_msg_handler vxlan_vnifilter_rtnl_msg_handlers[] = { + {THIS_MODULE ,PF_BRIDGE ,RTM_GETTUNNEL ,NULL , vxlan_vnifilter_dump,0 }, + {THIS_MODULE ,PF_BRIDGE ,RTM_NEWTUNNEL , vxlan_vnifilter_process,NULL ,0 }, + {THIS_MODULE ,PF_BRIDGE ,RTM_DELTUNNEL , vxlan_vnifilter_process,NULL ,0 }, +}; + +int vxlan_vnifilter_init (void ) { -rtnl_register_module (THIS_MODULE ,PF_BRIDGE ,RTM_GETTUNNEL ,NULL , - vxlan_vnifilter_dump,0 ); -rtnl_register_module (THIS_MODULE ,PF_BRIDGE ,RTM_NEWTUNNEL , - vxlan_vnifilter_process,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_BRIDGE ,RTM_DELTUNNEL , - vxlan_vnifilter_process,NULL ,0 ); +return rtnl_register_many (vxlan_vnifilter_rtnl_msg_handlers); }void vxlan_vnifilter_uninit (void ) { -rtnl_unregister (PF_BRIDGE ,RTM_GETTUNNEL ); -rtnl_unregister (PF_BRIDGE ,RTM_NEWTUNNEL ); -rtnl_unregister (PF_BRIDGE ,RTM_DELTUNNEL ); +rtnl_unregister_many (vxlan_vnifilter_rtnl_msg_handlers); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/213 bridge: Handle error of rtnl_register_module().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit cba5e43b0b757734b1e79f624d93a71435e31136 ]
Since introduced, br_vlan_rtnl_init() has been ignoring the returned value of rtnl_register_module(), which could fail silently.
Handling the error allows users to view a module as an all-or-nothing thing in terms of the rtnetlink functionality. This prevents syzkaller from reporting spurious errors from its tests, where OOM often occurs and module is automatically loaded.
Let's handle the errors by rtnl_register_many().
--- net/bridge/br_netlink.c | 6 +++++- net/bridge/br_private.h | 5 +++-- net/bridge/br_vlan.c | 19 +++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-)
net/bridge/br_netlink.c +5 -1
@@ -1905,7 +1905,10 @@ int __init br_netlink_init(void) {int err; -br_vlan_rtnl_init (); + err =br_vlan_rtnl_init (); +if (err) + goto out; +rtnl_af_register (&br_af_ops); err =rtnl_link_register (&br_link_ops);
@@ -1916,6 +1919,7 @@ int __init br_netlink_init(void) out_af:rtnl_af_unregister (&br_af_ops); +out:return err; }
net/bridge/br_private.h +3 -2
@@ -1547,7 +1547,7 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v,void br_vlan_port_event (struct net_bridge_port *p,unsigned long event);int br_vlan_bridge_event (struct net_device *dev,unsigned long event,void *ptr); -void br_vlan_rtnl_init (void ); +int br_vlan_rtnl_init (void );void br_vlan_rtnl_uninit (void ); void br_vlan_notify(const struct net_bridge *br, const struct net_bridge_port *p,
@@ -1778,8 +1778,9 @@ static inline int br_vlan_bridge_event(struct net_device *dev,return 0 ; } -static inline void br_vlan_rtnl_init (void ) +static inline int br_vlan_rtnl_init (void ) { +return 0 ; }static inline void br_vlan_rtnl_uninit (void )
net/bridge/br_vlan.c +9 -10
@@ -2296,19 +2296,18 @@ static int br_vlan_rtm_process(struct sk_buff *skb, struct nlmsghdr *nlh,return err; } -void br_vlan_rtnl_init (void ) +static const struct rtnl_msg_handler br_vlan_rtnl_msg_handlers[] = { + {THIS_MODULE ,PF_BRIDGE ,RTM_NEWVLAN , br_vlan_rtm_process,NULL ,0 }, + {THIS_MODULE ,PF_BRIDGE ,RTM_DELVLAN , br_vlan_rtm_process,NULL ,0 }, + {THIS_MODULE ,PF_BRIDGE ,RTM_GETVLAN ,NULL , br_vlan_rtm_dump,0 }, +}; + +int br_vlan_rtnl_init (void ) { -rtnl_register_module (THIS_MODULE ,PF_BRIDGE ,RTM_GETVLAN ,NULL , - br_vlan_rtm_dump,0 ); -rtnl_register_module (THIS_MODULE ,PF_BRIDGE ,RTM_NEWVLAN , - br_vlan_rtm_process,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_BRIDGE ,RTM_DELVLAN , - br_vlan_rtm_process,NULL ,0 ); +return rtnl_register_many (br_vlan_rtnl_msg_handlers); }void br_vlan_rtnl_uninit (void ) { -rtnl_unregister (PF_BRIDGE ,RTM_GETVLAN ); -rtnl_unregister (PF_BRIDGE ,RTM_NEWVLAN ); -rtnl_unregister (PF_BRIDGE ,RTM_DELVLAN ); +rtnl_unregister_many (br_vlan_rtnl_msg_handlers); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/213 mctp: Handle error of rtnl_register_module().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit d51705614f668254cc5def7490df76f9680b4659 ]
Since introduced, mctp has been ignoring the returned value of rtnl_register_module(), which could fail silently.
Handling the error allows users to view a module as an all-or-nothing thing in terms of the rtnetlink functionality. This prevents syzkaller from reporting spurious errors from its tests, where OOM often occurs and module is automatically loaded.
Let's handle the errors by rtnl_register_many().
--- include/net/mctp.h | 2 +- net/mctp/af_mctp.c | 6 +++++- net/mctp/device.c | 30 ++++++++++++++++++------------ net/mctp/neigh.c | 31 +++++++++++++++++++------------ net/mctp/route.c | 33 +++++++++++++++++++++++---------- 5 files changed, 66 insertions(+), 36 deletions(-)
include/net/mctp.h +1 -1
@@ -293,7 +293,7 @@ void mctp_neigh_remove_dev(struct mctp_dev *mdev);int mctp_routes_init (void );void mctp_routes_exit (void ); -void mctp_device_init (void ); +int mctp_device_init (void );void mctp_device_exit (void );#endif /* __NET_MCTP_H */
net/mctp/af_mctp.c +5 -1
@@ -676,10 +676,14 @@ static __init int mctp_init(void)if (rc) goto err_unreg_routes; -mctp_device_init (); + rc =mctp_device_init (); +if (rc) + goto err_unreg_neigh;return 0 ; +err_unreg_neigh: +mctp_neigh_exit (); err_unreg_routes:mctp_routes_exit (); err_unreg_proto:
net/mctp/device.c +18 -12
@@ -524,25 +524,31 @@ static struct notifier_block mctp_dev_nb = { .priority = ADDRCONF_NOTIFY_PRIORITY, }; -void __init mctp_device_init (void ) +static const struct rtnl_msg_handler mctp_device_rtnl_msg_handlers[] = { + {THIS_MODULE ,PF_MCTP ,RTM_NEWADDR , mctp_rtm_newaddr,NULL ,0 }, + {THIS_MODULE ,PF_MCTP ,RTM_DELADDR , mctp_rtm_deladdr,NULL ,0 }, + {THIS_MODULE ,PF_MCTP ,RTM_GETADDR ,NULL , mctp_dump_addrinfo,0 }, +}; + +int __init mctp_device_init (void ) { -register_netdevice_notifier (&mctp_dev_nb); +int err; -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_GETADDR , -NULL , mctp_dump_addrinfo,0 ); -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_NEWADDR , - mctp_rtm_newaddr,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_DELADDR , - mctp_rtm_deladdr,NULL ,0 ); +register_netdevice_notifier (&mctp_dev_nb);rtnl_af_register (&mctp_af_ops); + + err =rtnl_register_many (mctp_device_rtnl_msg_handlers); +if (err) { +rtnl_af_unregister (&mctp_af_ops); +unregister_netdevice_notifier (&mctp_dev_nb); + } + +return err; } void __exit mctp_device_exit(void) { +rtnl_unregister_many (mctp_device_rtnl_msg_handlers);rtnl_af_unregister (&mctp_af_ops); -rtnl_unregister (PF_MCTP ,RTM_DELADDR ); -rtnl_unregister (PF_MCTP ,RTM_NEWADDR ); -rtnl_unregister (PF_MCTP ,RTM_GETADDR ); -unregister_netdevice_notifier (&mctp_dev_nb); }
net/mctp/neigh.c +19 -12
@@ -322,22 +322,29 @@ static struct pernet_operations mctp_net_ops = { .exit = mctp_neigh_net_exit, }; +static const struct rtnl_msg_handler mctp_neigh_rtnl_msg_handlers[] = { + {THIS_MODULE ,PF_MCTP ,RTM_NEWNEIGH , mctp_rtm_newneigh,NULL ,0 }, + {THIS_MODULE ,PF_MCTP ,RTM_DELNEIGH , mctp_rtm_delneigh,NULL ,0 }, + {THIS_MODULE ,PF_MCTP ,RTM_GETNEIGH ,NULL , mctp_rtm_getneigh,0 }, +}; +int __init mctp_neigh_init (void ) { -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_NEWNEIGH , - mctp_rtm_newneigh,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_DELNEIGH , - mctp_rtm_delneigh,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_GETNEIGH , -NULL , mctp_rtm_getneigh,0 ); - -return register_pernet_subsys (&mctp_net_ops); +int err; + + err =register_pernet_subsys (&mctp_net_ops); +if (err) +return err; + + err =rtnl_register_many (mctp_neigh_rtnl_msg_handlers); +if (err) +unregister_pernet_subsys (&mctp_net_ops); + +return err; } -void __exit mctp_neigh_exit(void) +void mctp_neigh_exit (void ) { +rtnl_unregister_many (mctp_neigh_rtnl_msg_handlers);unregister_pernet_subsys (&mctp_net_ops); -rtnl_unregister (PF_MCTP ,RTM_GETNEIGH ); -rtnl_unregister (PF_MCTP ,RTM_DELNEIGH ); -rtnl_unregister (PF_MCTP ,RTM_NEWNEIGH ); }
net/mctp/route.c +23 -10
@@ -1410,26 +1410,39 @@ static struct pernet_operations mctp_net_ops = { .exit = mctp_routes_net_exit, }; +static const struct rtnl_msg_handler mctp_route_rtnl_msg_handlers[] = { + {THIS_MODULE ,PF_MCTP ,RTM_NEWROUTE , mctp_newroute,NULL ,0 }, + {THIS_MODULE ,PF_MCTP ,RTM_DELROUTE , mctp_delroute,NULL ,0 }, + {THIS_MODULE ,PF_MCTP ,RTM_GETROUTE ,NULL , mctp_dump_rtinfo,0 }, +}; +int __init mctp_routes_init (void ) { +int err; +dev_add_pack (&mctp_packet_type); -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_GETROUTE , -NULL , mctp_dump_rtinfo,0 ); -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_NEWROUTE , - mctp_newroute,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_MCTP ,RTM_DELROUTE , - mctp_delroute,NULL ,0 ); + err =register_pernet_subsys (&mctp_net_ops); +if (err) + goto err_pernet; + + err =rtnl_register_many (mctp_route_rtnl_msg_handlers); +if (err) + goto err_rtnl; -return register_pernet_subsys (&mctp_net_ops); +return 0 ; + +err_rtnl: +unregister_pernet_subsys (&mctp_net_ops); +err_pernet: +dev_remove_pack (&mctp_packet_type); +return err; }void mctp_routes_exit (void ) { +rtnl_unregister_many (mctp_route_rtnl_msg_handlers);unregister_pernet_subsys (&mctp_net_ops); -rtnl_unregister (PF_MCTP ,RTM_DELROUTE ); -rtnl_unregister (PF_MCTP ,RTM_NEWROUTE ); -rtnl_unregister (PF_MCTP ,RTM_GETROUTE );dev_remove_pack (&mctp_packet_type); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/213 rtnetlink: change nlk->cb_mutex role
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e39951d965bf58b5aba7f61dc1140dcb8271af22 ]
In commit af65bdfce98d ("[NETLINK]: Switch cb_lock spinlock to mutex and allow to override it"), Patrick McHardy used a common mutex to protect both nlk->cb and the dump() operations.
The override is used for rtnl dumps, registered with rntl_register() and rntl_register_module().
We want to be able to opt-out some dump() operations to not acquire RTNL, so we need to protect nlk->cb with a per socket mutex.
This patch renames nlk->cb_def_mutex to nlk->nl_cb_mutex
The optional pointer to the mutex used to protect dump() call is stored in nlk->dump_cb_mutex
Stable-dep-of: 5be2062e3080 ("mpls: Handle error of rtnl_register_module().")
--- net/netlink/af_netlink.c | 32 ++++++++++++++++++-------------- net/netlink/af_netlink.h | 5 +++-- 2 files changed, 21 insertions(+), 16 deletions(-)
net/netlink/af_netlink.c +18 -14
@@ -636,7 +636,7 @@ static struct proto netlink_proto = { };static int __netlink_create (struct net *net,struct socket *sock, -struct mutex *cb_mutex,int protocol, +struct mutex *dump_cb_mutex,int protocol,int kern) {struct sock *sk;
@@ -651,15 +651,11 @@ static int __netlink_create(struct net *net, struct socket *sock,sock_init_data (sock, sk); nlk =nlk_sk (sk); -if (cb_mutex) { - nlk->cb_mutex = cb_mutex; - }else { - nlk->cb_mutex = &nlk->cb_def_mutex; -mutex_init (nlk->cb_mutex); -lockdep_set_class_and_name (nlk->cb_mutex, +mutex_init (&nlk->nl_cb_mutex); +lockdep_set_class_and_name (&nlk->nl_cb_mutex, nlk_cb_mutex_keys + protocol, nlk_cb_mutex_key_strings[protocol]); - } + nlk->dump_cb_mutex = dump_cb_mutex;init_waitqueue_head (&nlk->wait); sk->sk_destruct = netlink_sock_destruct;
@@ -2211,7 +2207,7 @@ static int netlink_dump(struct sock *sk, bool lock_taken)int alloc_size;if (!lock_taken) -mutex_lock (nlk->cb_mutex); +mutex_lock (&nlk->nl_cb_mutex);if (!nlk->cb_running) { err = -EINVAL ; goto errout_skb;
@@ -2263,14 +2259,22 @@ static int netlink_dump(struct sock *sk, bool lock_taken)netlink_skb_set_owner_r (skb, sk);if (nlk->dump_done_errno >0 ) { +struct mutex *extra_mutex = nlk->dump_cb_mutex; + cb->extack = &extack; + +if (extra_mutex) +mutex_lock (extra_mutex); nlk->dump_done_errno = cb->dump (skb, cb); +if (extra_mutex) +mutex_unlock (extra_mutex); + cb->extack =NULL ; }if (nlk->dump_done_errno >0 ||skb_tailroom (skb) <nlmsg_total_size (sizeof (nlk->dump_done_errno))) { -mutex_unlock (nlk->cb_mutex); +mutex_unlock (&nlk->nl_cb_mutex);if (sk_filter (sk, skb))kfree_skb (skb);
@@ -2304,13 +2308,13 @@ static int netlink_dump(struct sock *sk, bool lock_taken)WRITE_ONCE (nlk->cb_running, false); module = cb->module; skb = cb->skb; -mutex_unlock (nlk->cb_mutex); +mutex_unlock (&nlk->nl_cb_mutex);module_put (module);consume_skb (skb);return 0 ; errout_skb: -mutex_unlock (nlk->cb_mutex); +mutex_unlock (&nlk->nl_cb_mutex);kfree_skb (skb);return err; }
@@ -2333,7 +2337,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, } nlk =nlk_sk (sk); -mutex_lock (nlk->cb_mutex); +mutex_lock (&nlk->nl_cb_mutex);/* A dump is in progress... */ if (nlk->cb_running) { ret = -EBUSY ;
@@ -2384,7 +2388,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,module_put (control->module); error_unlock:sock_put (sk); -mutex_unlock (nlk->cb_mutex); +mutex_unlock (&nlk->nl_cb_mutex); error_free:kfree_skb (skb);return ret;
net/netlink/af_netlink.h +3 -2
@@ -39,8 +39,9 @@ struct netlink_sock {bool cb_running;int dump_done_errno;struct netlink_callback cb; -struct mutex *cb_mutex; -struct mutex cb_def_mutex; +struct mutex nl_cb_mutex; + +struct mutex *dump_cb_mutex;void (*netlink_rcv)(struct sk_buff *skb);int (*netlink_bind)(struct net *net,int group);void (*netlink_unbind)(struct net *net,int group);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/213 rtnetlink: add RTNL_FLAG_DUMP_UNLOCKED flag
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 386520e0ecc01004d3a29c70c5a77d4bbf8a8420 ]
Similarly to RTNL_FLAG_DOIT_UNLOCKED, this new flag allows dump operations registered via rtnl_register() or rtnl_register_module() to opt-out from RTNL protection.
Stable-dep-of: 5be2062e3080 ("mpls: Handle error of rtnl_register_module().")
--- include/linux/netlink.h | 2 ++ include/net/rtnetlink.h | 1 + net/core/rtnetlink.c | 2 ++ net/netlink/af_netlink.c | 3 +++ 4 files changed, 8 insertions(+)
include/linux/netlink.h +2 -0
@@ -289,6 +289,7 @@ struct netlink_callback {u16 answer_flags;u32 min_dump_alloc;unsigned int prev_seq, seq; +int flags;bool strict_check;union {u8 ctx[48 ];
@@ -321,6 +322,7 @@ struct netlink_dump_control {void *data;struct module *module;u32 min_dump_alloc; +int flags; }; int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
include/net/rtnetlink.h +1 -0
@@ -12,6 +12,7 @@ typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);enum rtnl_link_flags {RTNL_FLAG_DOIT_UNLOCKED =BIT (0 ),RTNL_FLAG_BULK_DEL_SUPPORTED =BIT (1 ), +RTNL_FLAG_DUMP_UNLOCKED =BIT (2 ), };enum rtnl_kinds {
net/core/rtnetlink.c +2 -0
@@ -6405,6 +6405,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, } owner = link->owner; dumpit = link->dumpit; + flags = link->flags;if (type ==RTM_GETLINK -RTM_BASE ) min_dump_alloc =rtnl_calcit (skb, nlh);
@@ -6422,6 +6423,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, .dump = dumpit, .min_dump_alloc = min_dump_alloc, .module = owner, + .flags = flags, }; err =netlink_dump_start (rtnl, skb, nlh, &c);/* netlink_dump_start() will keep a reference on
net/netlink/af_netlink.c +3 -0
@@ -2263,6 +2263,8 @@ static int netlink_dump(struct sock *sk, bool lock_taken) cb->extack = &extack; +if (cb->flags &RTNL_FLAG_DUMP_UNLOCKED ) + extra_mutex =NULL ;if (extra_mutex)mutex_lock (extra_mutex); nlk->dump_done_errno = cb->dump (skb, cb);
@@ -2357,6 +2359,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, cb->data = control->data; cb->module = control->module; cb->min_dump_alloc = control->min_dump_alloc; + cb->flags = control->flags; cb->skb = skb; cb->strict_check =nlk_test_bit (STRICT_CHK ,NETLINK_CB (skb).sk);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/213 mpls: no longer hold RTNL in mpls_netconf_dump_devconf()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e0f89d2864b062b027196925ea19f94b2ce50d6a ]
- Use for_each_netdev_dump() to no longer rely
on net->dev_index_head hash table.
- No longer care of net->dev_base_seq
- Fix return value at the end of a dump,
so that NLMSG_DONE can be appended to current skb, saving one recvmsg() system call.
- No longer grab RTNL, RCU protection is enough,
afer adding one READ_ONCE(mdev->input_enabled)
in mpls_netconf_fill_devconf()
Stable-dep-of: 5be2062e3080 ("mpls: Handle error of rtnl_register_module().")
--- net/mpls/af_mpls.c | 59 +++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 37 deletions(-)
net/mpls/af_mpls.c +22 -37
@@ -1154,7 +1154,7 @@ static int mpls_netconf_fill_devconf(struct sk_buff *skb, struct mpls_dev *mdev,if ((all || type ==NETCONFA_INPUT ) &&nla_put_s32 (skb,NETCONFA_INPUT , - mdev->input_enabled) <0 ) +READ_ONCE (mdev->input_enabled)) <0 ) goto nla_put_failure;nlmsg_end (skb, nlh);
@@ -1303,11 +1303,12 @@ static int mpls_netconf_dump_devconf(struct sk_buff *skb, {const struct nlmsghdr *nlh = cb->nlh;struct net *net =sock_net (skb->sk); -struct hlist_head *head; +struct { +unsigned long ifindex; + } *ctx = (void *)cb->ctx;struct net_device *dev;struct mpls_dev *mdev; -int idx, s_idx; -int h, s_h; +int err =0 ;if (cb->strict_check) {struct netlink_ext_ack *extack = cb->extack;
@@ -1324,40 +1325,23 @@ static int mpls_netconf_dump_devconf(struct sk_buff *skb, } } - s_h = cb->args[0 ]; - s_idx = idx = cb->args[1 ]; - -for (h = s_h; h <NETDEV_HASHENTRIES ; h++, s_idx =0 ) { - idx =0 ; - head = &net->dev_index_head[h]; -rcu_read_lock (); - cb->seq = net->dev_base_seq; -hlist_for_each_entry_rcu (dev, head, index_hlist) { -if (idx < s_idx) - goto cont; - mdev =mpls_dev_get (dev); -if (!mdev) - goto cont; -if (mpls_netconf_fill_devconf (skb, mdev, -NETLINK_CB (cb->skb).portid, - nlh->nlmsg_seq, -RTM_NEWNETCONF , -NLM_F_MULTI , -NETCONFA_ALL ) <0 ) { -rcu_read_unlock (); - goto done; - } -nl_dump_check_consistent (cb,nlmsg_hdr (skb)); -cont: - idx++; - } -rcu_read_unlock (); +rcu_read_lock (); +for_each_netdev_dump (net, dev, ctx->ifindex) { + mdev =mpls_dev_get (dev); +if (!mdev) +continue ; + err =mpls_netconf_fill_devconf (skb, mdev, +NETLINK_CB (cb->skb).portid, + nlh->nlmsg_seq, +RTM_NEWNETCONF , +NLM_F_MULTI , +NETCONFA_ALL ); +if (err <0 ) +break ; } -done: - cb->args[0 ] = h; - cb->args[1 ] = idx; +rcu_read_unlock (); -return skb->len; +return err; }#define MPLS_PERDEV_SYSCTL_OFFSET (field) \
@@ -2771,7 +2755,8 @@ static int __init mpls_init(void) mpls_getroute, mpls_dump_routes, 0);rtnl_register_module (THIS_MODULE ,PF_MPLS ,RTM_GETNETCONF , mpls_netconf_get_devconf, - mpls_netconf_dump_devconf,0 ); + mpls_netconf_dump_devconf, +RTNL_FLAG_DUMP_UNLOCKED ); err =ipgre_tunnel_encap_add_mpls_ops ();if (err)pr_err ("Can't add mpls over gre tunnel ops\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/213 mpls: Handle error of rtnl_register_module().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 5be2062e3080e3ff6707816caa445ec0c6eaacf7 ]
Since introduced, mpls_init() has been ignoring the returned value of rtnl_register_module(), which could fail silently.
Handling the error allows users to view a module as an all-or-nothing thing in terms of the rtnetlink functionality. This prevents syzkaller from reporting spurious errors from its tests, where OOM often occurs and module is automatically loaded.
Let's handle the errors by rtnl_register_many().
--- net/mpls/af_mpls.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
net/mpls/af_mpls.c +21 -11
@@ -2729,6 +2729,15 @@ static struct rtnl_af_ops mpls_af_ops __read_mostly = { .get_stats_af_size = mpls_get_stats_af_size, }; +static const struct rtnl_msg_handler mpls_rtnl_msg_handlers[] __initdata_or_module = { + {THIS_MODULE ,PF_MPLS ,RTM_NEWROUTE , mpls_rtm_newroute,NULL ,0 }, + {THIS_MODULE ,PF_MPLS ,RTM_DELROUTE , mpls_rtm_delroute,NULL ,0 }, + {THIS_MODULE ,PF_MPLS ,RTM_GETROUTE , mpls_getroute, mpls_dump_routes,0 }, + {THIS_MODULE ,PF_MPLS ,RTM_GETNETCONF , + mpls_netconf_get_devconf, mpls_netconf_dump_devconf, +RTNL_FLAG_DUMP_UNLOCKED }, +}; +static int __init mpls_init (void ) {int err;
@@ -2747,24 +2756,25 @@ static int __init mpls_init(void)rtnl_af_register (&mpls_af_ops); -rtnl_register_module (THIS_MODULE ,PF_MPLS ,RTM_NEWROUTE , - mpls_rtm_newroute,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_MPLS ,RTM_DELROUTE , - mpls_rtm_delroute,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_MPLS ,RTM_GETROUTE , - mpls_getroute, mpls_dump_routes,0 ); -rtnl_register_module (THIS_MODULE ,PF_MPLS ,RTM_GETNETCONF , - mpls_netconf_get_devconf, - mpls_netconf_dump_devconf, -RTNL_FLAG_DUMP_UNLOCKED ); - err =ipgre_tunnel_encap_add_mpls_ops (); + err =rtnl_register_many (mpls_rtnl_msg_handlers);if (err) + goto out_unregister_rtnl_af; + + err =ipgre_tunnel_encap_add_mpls_ops (); +if (err) {pr_err ("Can't add mpls over gre tunnel ops\n" ); + goto out_unregister_rtnl; + } err =0 ; out:return err; +out_unregister_rtnl: +rtnl_unregister_many (mpls_rtnl_msg_handlers); +out_unregister_rtnl_af: +rtnl_af_unregister (&mpls_af_ops); +dev_remove_pack (&mpls_packet_type); out_unregister_pernet:unregister_pernet_subsys (&mpls_net_ops); goto out;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/213 phonet: no longer hold RTNL in route_dumpit()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 58a4ff5d77b187086eb12d41d613749420947f19 ]
route_dumpit() already relies on RCU, RTNL is not needed.
Also change return value at the end of a dump. This allows NLMSG_DONE to be appended to the current skb at the end of a dump, saving a couple of recvmsg() system calls.
Stable-dep-of: b5e837c86041 ("phonet: Handle error of rtnl_register_module().")
--- net/phonet/pn_netlink.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
net/phonet/pn_netlink.c +9 -8
@@ -178,7 +178,7 @@ static int fill_route(struct sk_buff *skb, struct net_device *dev, u8 dst, rtm->rtm_type =RTN_UNICAST ; rtm->rtm_flags =0 ;if (nla_put_u8 (skb,RTA_DST , dst) || -nla_put_u32 (skb,RTA_OIF , dev->ifindex)) +nla_put_u32 (skb,RTA_OIF ,READ_ONCE (dev->ifindex))) goto nla_put_failure;nlmsg_end (skb, nlh);return 0 ;
@@ -263,6 +263,7 @@ static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh,static int route_dumpit (struct sk_buff *skb,struct netlink_callback *cb) {struct net *net =sock_net (skb->sk); +int err =0 ;u8 addr;rcu_read_lock ();
@@ -272,16 +273,16 @@ static int route_dumpit(struct sk_buff *skb, struct netlink_callback *cb)if (!dev)continue ; -if (fill_route (skb, dev, addr <<2 ,NETLINK_CB (cb->skb).portid, - cb->nlh->nlmsg_seq,RTM_NEWROUTE ) <0 ) - goto out; + err =fill_route (skb, dev, addr <<2 , +NETLINK_CB (cb->skb).portid, + cb->nlh->nlmsg_seq,RTM_NEWROUTE ); +if (err <0 ) +break ; } - -out:rcu_read_unlock (); cb->args[0 ] = addr; -return skb->len; +return err; }int __init phonet_netlink_register (void )
@@ -301,6 +302,6 @@ int __init phonet_netlink_register(void)rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_DELROUTE , route_doit,NULL ,0 );rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_GETROUTE , -NULL , route_dumpit,0 ); +NULL , route_dumpit,RTNL_FLAG_DUMP_UNLOCKED );return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/213 phonet: Handle error of rtnl_register_module().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit b5e837c86041bef60f36cf9f20a641a30764379a ]
Before commit addf9b90de22 ("net: rtnetlink: use rcu to free rtnl message handlers"), once the first rtnl_register_module() allocated rtnl_msg_handlers[PF_PHONET], the following calls never failed.
However, after the commit, rtnl_register_module() could fail silently to allocate rtnl_msg_handlers[PF_PHONET][msgtype] and requires error handling for each call.
Handling the error allows users to view a module as an all-or-nothing thing in terms of the rtnetlink functionality. This prevents syzkaller from reporting spurious errors from its tests, where OOM often occurs and module is automatically loaded.
Let's use rtnl_register_many() to handle the errors easily.
--- net/phonet/pn_netlink.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
net/phonet/pn_netlink.c +11 -17
@@ -285,23 +285,17 @@ static int route_dumpit(struct sk_buff *skb, struct netlink_callback *cb)return err; } +static const struct rtnl_msg_handler phonet_rtnl_msg_handlers[] __initdata_or_module = { + {THIS_MODULE ,PF_PHONET ,RTM_NEWADDR , addr_doit,NULL ,0 }, + {THIS_MODULE ,PF_PHONET ,RTM_DELADDR , addr_doit,NULL ,0 }, + {THIS_MODULE ,PF_PHONET ,RTM_GETADDR ,NULL , getaddr_dumpit,0 }, + {THIS_MODULE ,PF_PHONET ,RTM_NEWROUTE , route_doit,NULL ,0 }, + {THIS_MODULE ,PF_PHONET ,RTM_DELROUTE , route_doit,NULL ,0 }, + {THIS_MODULE ,PF_PHONET ,RTM_GETROUTE ,NULL , route_dumpit, +RTNL_FLAG_DUMP_UNLOCKED }, +}; +int __init phonet_netlink_register (void ) { -int err =rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_NEWADDR , - addr_doit,NULL ,0 ); -if (err) -return err; - -/* Further rtnl_register_module() cannot fail */ -rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_DELADDR , - addr_doit,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_GETADDR , -NULL , getaddr_dumpit,0 ); -rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_NEWROUTE , - route_doit,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_DELROUTE , - route_doit,NULL ,0 ); -rtnl_register_module (THIS_MODULE ,PF_PHONET ,RTM_GETROUTE , -NULL , route_dumpit,RTNL_FLAG_DUMP_UNLOCKED ); -return 0 ; +return rtnl_register_many (phonet_rtnl_msg_handlers); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/213 ppp: fix ppp_async_encode() illegal access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 40dddd4b8bd08a69471efd96107a4e1c73fabefc ]
syzbot reported an issue in ppp_async_encode() [1]
In this case, pppoe_sendmsg() is called with a zero size. Then ppp_async_encode() is called with an empty skb.
BUG: KMSAN: uninit-value in ppp_async_encode drivers/net/ppp/ppp_async.c:545 [inline] BUG: KMSAN: uninit-value in ppp_async_push+0xb4f/0x2660 drivers/net/ppp/ppp_async.c:675 ppp_async_encode drivers/net/ppp/ppp_async.c:545 [inline] ppp_async_push+0xb4f/0x2660 drivers/net/ppp/ppp_async.c:675 ppp_async_send+0x130/0x1b0 drivers/net/ppp/ppp_async.c:634 ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2280 [inline] ppp_input+0x1f1/0xe60 drivers/net/ppp/ppp_generic.c:2304 pppoe_rcv_core+0x1d3/0x720 drivers/net/ppp/pppoe.c:379 sk_backlog_rcv+0x13b/0x420 include/net/sock.h:1113 __release_sock+0x1da/0x330 net/core/sock.c:3072 release_sock+0x6b/0x250 net/core/sock.c:3626 pppoe_sendmsg+0x2b8/0xb90 drivers/net/ppp/pppoe.c:903 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4092 [inline] slab_alloc_node mm/slub.c:4135 [inline] kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4187 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:587 __alloc_skb+0x363/0x7b0 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1322 [inline] sock_wmalloc+0xfe/0x1a0 net/core/sock.c:2732 pppoe_sendmsg+0x3a7/0xb90 drivers/net/ppp/pppoe.c:867 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 1 UID: 0 PID: 5411 Comm: syz.1.14 Not tainted 6.12.0-rc1-syzkaller-00165-g360c1f1f24c6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
--- drivers/net/ppp/ppp_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ppp/ppp_async.c +1 -1
@@ -541,7 +541,7 @@ ppp_async_encode(struct asyncppp *ap)* and 7 (code-reject) must be sent as though no options * had been negotiated. */ - islcp = proto ==PPP_LCP &&1 <= data[2 ] && data[2 ] <=7 ; + islcp = proto ==PPP_LCP && count >=3 &&1 <= data[2 ] && data[2 ] <=7 ;if (i ==0 ) {if (islcp)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/213 slip: make slhc_remember() more robust against malicious packets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7d3fce8cbe3a70a1c7c06c9b53696be5d5d8dd5c ]
syzbot found that slhc_remember() was missing checks against malicious packets [1].
slhc_remember() only checked the size of the packet was at least 20, which is not good enough.
We need to make sure the packet includes the IPv4 and TCP header that are supposed to be carried.
Add iph and th pointers to make the code more readable.
[1]
BUG: KMSAN: uninit-value in slhc_remember+0x2e8/0x7b0 drivers/net/slip/slhc.c:666 slhc_remember+0x2e8/0x7b0 drivers/net/slip/slhc.c:666 ppp_receive_nonmp_frame+0xe45/0x35e0 drivers/net/ppp/ppp_generic.c:2455 ppp_receive_frame drivers/net/ppp/ppp_generic.c:2372 [inline] ppp_do_recv+0x65f/0x40d0 drivers/net/ppp/ppp_generic.c:2212 ppp_input+0x7dc/0xe60 drivers/net/ppp/ppp_generic.c:2327 pppoe_rcv_core+0x1d3/0x720 drivers/net/ppp/pppoe.c:379 sk_backlog_rcv+0x13b/0x420 include/net/sock.h:1113 __release_sock+0x1da/0x330 net/core/sock.c:3072 release_sock+0x6b/0x250 net/core/sock.c:3626 pppoe_sendmsg+0x2b8/0xb90 drivers/net/ppp/pppoe.c:903 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4091 [inline] slab_alloc_node mm/slub.c:4134 [inline] kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4186 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:587 __alloc_skb+0x363/0x7b0 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1322 [inline] sock_wmalloc+0xfe/0x1a0 net/core/sock.c:2732 pppoe_sendmsg+0x3a7/0xb90 drivers/net/ppp/pppoe.c:867 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 0 UID: 0 PID: 5460 Comm: syz.2.33 Not tainted 6.12.0-rc2-syzkaller-00006-g87d6aab2389e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
--- drivers/net/slip/slhc.c | 57 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 23 deletions(-)
drivers/net/slip/slhc.c +34 -23
@@ -643,46 +643,57 @@ slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)int slhc_remember (struct slcompress *comp,unsigned char *icp,int isize) { -struct cstate *cs; -unsigned ihl; - +const struct tcphdr *th;unsigned char index; +struct iphdr *iph; +struct cstate *cs; +unsigned int ihl; -if (isize <20 ) { -/* The packet is shorter than a legal IP header */ +/* The packet is shorter than a legal IP header. +* Also make sure isize is positive. +*/ +if (isize < (int )sizeof (struct iphdr )) { +runt: comp->sls_i_runt++; -return slhc_toss ( comp ); +return slhc_toss (comp); } + iph = (struct iphdr *)icp;/* Peek at the IP header's IHL field to find its length */ - ihl = icp[0 ] &0xf ; -if (ihl <20 /4 ){ -/* The IP header length field is too small */ - comp->sls_i_runt++; -return slhc_toss ( comp ); - } - index = icp[9 ]; - icp[9 ] =IPPROTO_TCP ; + ihl = iph->ihl; +/* The IP header length field is too small, +* or packet is shorter than the IP header followed +* by minimal tcp header. +*/ +if (ihl <5 || isize < ihl *4 +sizeof (struct tcphdr )) + goto runt; + + index = iph->protocol; + iph->protocol =IPPROTO_TCP ;if (ip_fast_csum (icp, ihl)) {/* Bad IP header checksum; discard */ comp->sls_i_badcheck++; -return slhc_toss ( comp ); +return slhc_toss (comp); } -if (index > comp->rslot_limit) { +if (index > comp->rslot_limit) { comp->sls_i_error++;return slhc_toss (comp); } - + th = (struct tcphdr *)(icp + ihl *4 ); +if (th->doff <sizeof (struct tcphdr ) /4 ) + goto runt; +if (isize < ihl *4 + th->doff *4 ) + goto runt;/* Update local state */ cs = &comp->rstate[comp->recv_current = index]; comp->flags &=~SLF_TOSS ; -memcpy (&cs->cs_ip,icp,20 ); -memcpy (&cs->cs_tcp,icp + ihl*4 ,20 ); +memcpy (&cs->cs_ip, iph,sizeof (*iph)); +memcpy (&cs->cs_tcp, th,sizeof (*th));if (ihl >5 ) -memcpy (cs->cs_ipopt, icp +sizeof (struct iphdr ), (ihl -5 ) *4 ); -if (cs->cs_tcp.doff >5 ) -memcpy (cs->cs_tcpopt, icp + ihl*4 +sizeof (struct tcphdr ), (cs->cs_tcp.doff -5 ) *4 ); - cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2 ; +memcpy (cs->cs_ipopt, &iph[1 ], (ihl -5 ) *4 ); +if (th->doff >5 ) +memcpy (cs->cs_tcpopt, &th[1 ], (th->doff -5 ) *4 ); + cs->cs_hsize = ihl*2 + th->doff*2 ; cs->initialized = true;/* Put headers back on packet * Neither header checksum is recalculated
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/213 rcu/nocb: Make IRQs disablement symmetric
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit b913c3fe685e0aec80130975b0f330fd709ff324 ]
Currently IRQs are disabled on call_rcu() and then depending on the context:
* If the CPU is in nocb mode:
- If the callback is enqueued in the bypass list, IRQs are re-enabled implictly by rcu_nocb_try_bypass()
- If the callback is enqueued in the normal list, IRQs are re-enabled implicitly by __call_rcu_nocb_wake()
* If the CPU is NOT in nocb mode, IRQs are reenabled explicitly from call_rcu()
This makes the code a bit hard to follow, especially as it interleaves with nocb locking.
To make the IRQ flags coverage clearer and also in order to prepare for moving all the nocb enqueue code to its own function, always re-enable the IRQ flags explicitly from call_rcu().
Stable-dep-of: f7345ccc62a4 ("rcu/nocb: Fix rcuog wake-up from offline softirq")
--- kernel/rcu/tree.c | 9 ++++++--- kernel/rcu/tree_nocb.h | 20 +++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-)
kernel/rcu/tree.c +6 -3
@@ -2727,8 +2727,10 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in) }check_cb_ovld (rdp); -if (rcu_nocb_try_bypass (rdp, head, &was_alldone, flags, lazy)) +if (rcu_nocb_try_bypass (rdp, head, &was_alldone, flags, lazy)) { +local_irq_restore (flags);return ;// Enqueued onto ->nocb_bypass, so just leave. + }// If no-CBs CPU gets here, rcu_nocb_try_bypass() acquired ->nocb_lock. rcu_segcblist_enqueue (&rdp->cblist, head);if (__is_kvfree_rcu_offset ((unsigned long )func))
@@ -2746,8 +2748,8 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)__call_rcu_nocb_wake (rdp, was_alldone, flags);/* unlocks */ }else {__call_rcu_core (rdp, head, flags); -local_irq_restore (flags); } +local_irq_restore (flags); }#ifdef CONFIG_RCU_LAZY
@@ -4626,8 +4628,9 @@ void rcutree_migrate_callbacks(int cpu)__call_rcu_nocb_wake (my_rdp, true, flags); }else {rcu_nocb_unlock (my_rdp);/* irqs remain disabled. */ -raw_spin_unlock_irqrestore_rcu_node (my_rnp, flags); +raw_spin_unlock_rcu_node (my_rnp);/* irqs remain disabled. */ } +local_irq_restore (flags);if (needwake)rcu_gp_kthread_wake ();lockdep_assert_irqs_enabled ();
kernel/rcu/tree_nocb.h +9 -11
@@ -516,9 +516,7 @@ static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,// 2. Both of these conditions are met: // a. The bypass list previously had only lazy CBs, and: // b. The new CB is non-lazy. -if (ncbs && (!bypass_is_lazy || lazy)) { -local_irq_restore (flags); - }else { +if (!ncbs || (bypass_is_lazy && !lazy)) {// No-CBs GP kthread might be indefinitely asleep, if so, wake. rcu_nocb_lock (rdp);// Rare during call_rcu() flood. if (!rcu_segcblist_pend_cbs (&rdp->cblist)) {
@@ -528,7 +526,7 @@ static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp, }else {trace_rcu_nocb_wake (rcu_state.name, rdp->cpu,TPS ("FirstBQnoWake" )); -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp); } }return true;// Callback already enqueued.
@@ -554,7 +552,7 @@ static void __call_rcu_nocb_wake(struct rcu_data *rdp, bool was_alldone,// If we are being polled or there is no kthread, just leave. t =READ_ONCE (rdp->nocb_gp_kthread);if (rcu_nocb_poll || !t) { -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp);trace_rcu_nocb_wake (rcu_state.name, rdp->cpu,TPS ("WakeNotPoll" ));return ;
@@ -567,17 +565,17 @@ static void __call_rcu_nocb_wake(struct rcu_data *rdp, bool was_alldone, rdp->qlen_last_fqs_check = len;// Only lazy CBs in bypass list if (lazy_len && bypass_len == lazy_len) { -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp);wake_nocb_gp_defer (rdp,RCU_NOCB_WAKE_LAZY ,TPS ("WakeLazy" )); }else if (!irqs_disabled_flags (flags)) {/* ... if queue was empty ... */ -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp);wake_nocb_gp (rdp, false);trace_rcu_nocb_wake (rcu_state.name, rdp->cpu,TPS ("WakeEmpty" )); }else { -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp);wake_nocb_gp_defer (rdp,RCU_NOCB_WAKE ,TPS ("WakeEmptyIsDeferred" )); }
@@ -595,15 +593,15 @@ static void __call_rcu_nocb_wake(struct rcu_data *rdp, bool was_alldone,if ((rdp->nocb_cb_sleep || !rcu_segcblist_ready_cbs (&rdp->cblist)) && !timer_pending (&rdp->nocb_timer)) { -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp);wake_nocb_gp_defer (rdp,RCU_NOCB_WAKE_FORCE ,TPS ("WakeOvfIsDeferred" )); }else { -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp);trace_rcu_nocb_wake (rcu_state.name, rdp->cpu,TPS ("WakeNot" )); } }else { -rcu_nocb_unlock_irqrestore (rdp, flags); +rcu_nocb_unlock (rdp);trace_rcu_nocb_wake (rcu_state.name, rdp->cpu,TPS ("WakeNot" )); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/213 rcu/nocb: Fix rcuog wake-up from offline softirq
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit f7345ccc62a4b880cf76458db5f320725f28e400 ]
After a CPU has set itself offline and before it eventually calls rcutree_report_cpu_dead(), there are still opportunities for callbacks to be enqueued, for example from a softirq. When that happens on NOCB, the rcuog wake-up is deferred through an IPI to an online CPU in order not to call into the scheduler and risk arming the RT-bandwidth after hrtimers have been migrated out and disabled.
But performing a synchronized IPI from a softirq is buggy as reported in the following scenario:
WARNING: CPU: 1 PID: 26 at kernel/smp.c:633 smp_call_function_single
Modules linked in: rcutorture torture
CPU: 1 UID: 0 PID: 26 Comm: migration/1 Not tainted 6.11.0-rc1-00012-g9139f93209d1 #1
Stopper: multi_cpu_stop+0x0/0x320 <- __stop_cpus+0xd0/0x120
RIP: 0010:smp_call_function_single
<IRQ>
swake_up_one_online
__call_rcu_nocb_wake
__call_rcu_common
? rcu_torture_one_read
call_timer_fn
__run_timers
run_timer_softirq
handle_softirqs
irq_exit_rcu
? tick_handle_periodic
sysvec_apic_timer_interrupt
</IRQ>Fix this with forcing deferred rcuog wake up through the NOCB timer when the CPU is offline. The actual wake up will happen from rcutree_report_cpu_dead().
--- kernel/rcu/tree_nocb.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/rcu/tree_nocb.h +7 -1
@@ -568,13 +568,19 @@ static void __call_rcu_nocb_wake(struct rcu_data *rdp, bool was_alldone,rcu_nocb_unlock (rdp);wake_nocb_gp_defer (rdp,RCU_NOCB_WAKE_LAZY ,TPS ("WakeLazy" )); - }else if (!irqs_disabled_flags (flags)) { + }else if (!irqs_disabled_flags (flags) &&cpu_online (rdp->cpu)) {/* ... if queue was empty ... */ rcu_nocb_unlock (rdp);wake_nocb_gp (rdp, false);trace_rcu_nocb_wake (rcu_state.name, rdp->cpu,TPS ("WakeEmpty" )); }else { +/* +* Don't do the wake-up upfront on fragile paths. +* Also offline CPUs can't call swake_up_one_online() from +* (soft-)IRQs. Rely on the final deferred wake-up from +* rcutree_report_cpu_dead() +*/ rcu_nocb_unlock (rdp);wake_nocb_gp_defer (rdp,RCU_NOCB_WAKE ,TPS ("WakeEmptyIsDeferred" ));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/213 HID: mcp2200: added driver for GPIOs of MCP2200
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Roith <[email protected]>
[ Upstream commit 740329d7120f8608ead64b0f3417c02ca1d6b32f ]
Added a gpiochip compatible driver to control the 8 GPIOs of the MCP2200 by using the HID interface.
Using GPIOs with alternative functions (GP0<->SSPND, GP1<->USBCFG, GP6<->RXLED, GP7<->TXLED) will reset the functions, if set (unset by default).
The driver was tested while also using the UART of the chip. Setting and reading the GPIOs has no effect on the UART communication. However, a reset is triggered after the CONFIGURE command. If the GPIO Direction is constantly changed, this will affect the communication at low baud rates. This is a hardware problem of the MCP2200 and is not caused by the driver.
--- drivers/hid/Kconfig | 9 + drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-mcp2200.c | 392 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 403 insertions(+) create mode 100644 drivers/hid/hid-mcp2200.c
drivers/hid/Kconfig +9 -0
@@ -1300,6 +1300,15 @@ config HID_ALPS Say Y here if you have a Alps touchpads over i2c-hid or usbhid and want support for its special functionalities. +config HID_MCP2200 + tristate "Microchip MCP2200 HID USB-to-GPIO bridge" + depends on USB_HID && GPIOLIB + help + Provides GPIO functionality over USB-HID through MCP2200 device. + + To compile this driver as a module, choose M here: the module + will be called hid-mcp2200.ko. + config HID_MCP2221 tristate "Microchip MCP2221 HID USB-to-I2C/SMbus host support" depends on USB_HID && I2C
drivers/hid/Makefile +1 -0
@@ -79,6 +79,7 @@ obj-$(CONFIG_HID_LOGITECH_HIDPP) += hid-logitech-hidpp.o obj-$(CONFIG_HID_MACALLY) += hid-macally.o obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o obj-$(CONFIG_HID_MALTRON) += hid-maltron.o +obj-$(CONFIG_HID_MCP2200) += hid-mcp2200.o obj-$(CONFIG_HID_MCP2221) += hid-mcp2221.o obj-$(CONFIG_HID_MAYFLASH) += hid-mf.o obj-$(CONFIG_HID_MEGAWORLD_FF) += hid-megaworld.o
drivers/hid/hid-ids.h +1 -0
@@ -907,6 +907,7 @@#define USB_DEVICE_ID_PICK16F1454 0x0042#define USB_DEVICE_ID_PICK16F1454_V2 0xf2f7#define USB_DEVICE_ID_LUXAFOR 0xf372 +#define USB_DEVICE_ID_MCP2200 0x00df#define USB_DEVICE_ID_MCP2221 0x00dd#define USB_VENDOR_ID_MICROSOFT 0x045e
drivers/hid/hid-mcp2200.c new file +392 -0
392 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/213 HID: i2c-hid: Remove I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV quirk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit bd008acdac45011f2246ec2518ef19c2da9e6008 ]
Re-trying the power-on command on failure on all devices should not be a problem, drop the I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV quirk and simply retry power-on on all devices.
Stable-dep-of: 26dd6a5667f5 ("HID: i2c-hid: Skip SET_POWER SLEEP for Cirque touchpad on system suspend")
--- drivers/hid/i2c-hid/i2c-hid-core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/hid/i2c-hid/i2c-hid-core.c +1 -5
@@ -44,7 +44,6 @@#include "i2c-hid.h" /* quirks to control the device */ -#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5)
@@ -119,8 +118,6 @@ static const struct i2c_hid_quirks {__u16 idProduct;__u32 quirks; } i2c_hid_quirks[] = { - {USB_VENDOR_ID_WEIDA ,HID_ANY_ID , - I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV }, {I2C_VENDOR_ID_HANTICK ,I2C_PRODUCT_ID_HANTICK_5288 , I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, { I2C_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_VOYO_WINPAD_A15,
@@ -389,8 +386,7 @@ static int i2c_hid_set_power(struct i2c_hid *ihid, int power_state)* The call will get a return value (EREMOTEIO) but device will be * triggered and activated. After that, it goes like a normal device. */ -if (power_state ==I2C_HID_PWR_ON && - ihid->quirks &I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV ) { +if (power_state ==I2C_HID_PWR_ON ) { ret =i2c_hid_set_power_command (ihid,I2C_HID_PWR_ON );/* Device was already activated */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/213 HID: i2c-hid: Renumber I2C_HID_QUIRK_ defines
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 7d7a252842ecafb9b4541dc8470907e97bc6df62 ]
The quirks variable and the I2C_HID_QUIRK_ defines are never used / exported outside of the i2c-hid code renumber them to start at BIT(0) again.
Stable-dep-of: 26dd6a5667f5 ("HID: i2c-hid: Skip SET_POWER SLEEP for Cirque touchpad on system suspend")
--- drivers/hid/i2c-hid/i2c-hid-core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hid/i2c-hid/i2c-hid-core.c +5 -5
@@ -44,11 +44,11 @@#include "i2c-hid.h" /* quirks to control the device */ -#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) -#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) -#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) -#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) -#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(7) +#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(0) +#define I2C_HID_QUIRK_BOGUS_IRQ BIT(1) +#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(2) +#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(3) +#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(4)/* Command opcodes */ #define I2C_HID_OPCODE_RESET 0x01
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/213 HID: i2c-hid: Skip SET_POWER SLEEP for Cirque touchpad on system suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
[ Upstream commit 26dd6a5667f500c5d991f90a9ac5998a71afaf5c ]
There's a Cirque touchpad that wakes system up without anything touched the touchpad. The input report is empty when this happens. The reason is stated in HID over I2C spec, 7.2.8.2:
"If the DEVICE wishes to wake the HOST from its low power state, it can issue a wake by asserting the interrupt."
This is fine if OS can put system back to suspend by identifying input wakeup count stays the same on resume, like Chrome OS Dark Resume [0]. But for regular distro such policy is lacking.
Though the change doesn't bring any impact on power consumption for touchpad is minimal, other i2c-hid device may depends on SLEEP control power. So use a quirk to limit the change scope.
[0] https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/power_manager/docs/dark_resume.md
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/i2c-hid/i2c-hid-core.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/hid/hid-ids.h +3 -0
@@ -298,6 +298,9 @@#define USB_VENDOR_ID_CIDC 0x1677 +#define I2C_VENDOR_ID_CIRQUE 0x0488 +#define I2C_PRODUCT_ID_CIRQUE_1063 0x1063 +#define USB_VENDOR_ID_CJTOUCH 0x24b8#define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020 0x0020#define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040 0x0040
drivers/hid/i2c-hid/i2c-hid-core.c +5 -1
@@ -49,6 +49,7 @@#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(2)#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(3)#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(4) +#define I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND BIT(5)/* Command opcodes */ #define I2C_HID_OPCODE_RESET 0x01
@@ -130,6 +131,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_RESET_ON_RESUME }, {USB_VENDOR_ID_ITE ,I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 , I2C_HID_QUIRK_BAD_INPUT_SIZE }, + { I2C_VENDOR_ID_CIRQUE, I2C_PRODUCT_ID_CIRQUE_1063, + I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND },/* * Sending the wakeup after reset actually break ELAN touchscreen controller */
@@ -945,7 +948,8 @@ static int i2c_hid_core_suspend(struct i2c_hid *ihid, bool force_poweroff)return ret;/* Save some power */ -i2c_hid_set_power (ihid,I2C_HID_PWR_SLEEP ); +if (!(ihid->quirks &I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND )) +i2c_hid_set_power (ihid,I2C_HID_PWR_SLEEP );disable_irq (client->irq);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/213 HID: asus: add ROG Ally N-Key ID and keycodes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luke D. Jones <[email protected]>
[ Upstream commit 08b50c6b0b0940a304b481346cc187d489c6a751 ]
A handful of buttons on the ROG Ally are not actually part of the xpad device and are instead keyboard keys (a typical use of the MCU that asus uses). We attach a group of F<num> key codes which aren't used much and which the handheld community has already accepted as defaults here.
--- drivers/hid/hid-asus.c | 8 +++++++- drivers/hid/hid-ids.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/hid/hid-asus.c +7 -1
@@ -881,7 +881,10 @@ static int asus_input_mapping(struct hid_device *hdev,case 0xb3 :asus_map_key_clear (KEY_PROG3 );break ;/* Fn+Left next aura */ case 0x6a :asus_map_key_clear (KEY_F13 );break ;/* Screenpad toggle */ case 0x4b :asus_map_key_clear (KEY_F14 );break ;/* Arrows/Pg-Up/Dn toggle */ - +case 0xa5 :asus_map_key_clear (KEY_F15 );break ;/* ROG Ally left back */ +case 0xa6 :asus_map_key_clear (KEY_F16 );break ;/* ROG Ally QAM button */ +case 0xa7 :asus_map_key_clear (KEY_F17 );break ;/* ROG Ally ROG long-press */ +case 0xa8 :asus_map_key_clear (KEY_F18 );break ;/* ROG Ally ROG long-press-release */ default :/* ASUS lazily declares 256 usages, ignore the rest,
@@ -1273,6 +1276,9 @@ static const struct hid_device_id asus_devices[] = { {HID_USB_DEVICE (USB_VENDOR_ID_ASUSTEK ,USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3 ), QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, +USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY ), + QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD ), QUIRK_ROG_CLAYMORE_II_KEYBOARD },
drivers/hid/hid-ids.h +1 -0
@@ -208,6 +208,7 @@#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD 0x1866#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2 0x19b6#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3 0x1a30 +#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY 0x1abe#define USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD 0x196b#define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD 0x1869
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/213 HID: asus: add ROG Z13 lightbar
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luke D. Jones <[email protected]>
[ Upstream commit e901f10adb1f387fff1082297065a0da0191b83d ]
Add init of the lightbar which is a small panel on the back of the ASUS ROG Z13 and uses the same MCU as keyboards.
--- drivers/hid/hid-asus.c | 3 +++ drivers/hid/hid-ids.h | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-asus.c +3 -0
@@ -1276,6 +1276,9 @@ static const struct hid_device_id asus_devices[] = { {HID_USB_DEVICE (USB_VENDOR_ID_ASUSTEK ,USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3 ), QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, +USB_DEVICE_ID_ASUSTEK_ROG_Z13_LIGHTBAR ), + QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY ), QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
drivers/hid/hid-ids.h +1 -0
@@ -208,6 +208,7 @@#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD 0x1866#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2 0x19b6#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3 0x1a30 +#define USB_DEVICE_ID_ASUSTEK_ROG_Z13_LIGHTBAR 0x18c6#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY 0x1abe#define USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD 0x196b#define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD 0x1869
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/213 hid-asus: add ROG Ally X prod ID to quirk list
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luke D. Jones <[email protected]>
[ Upstream commit d1aa95e86f178dc597e80228cd9bd81fc3510f34 ]
The new ASUS ROG Ally X functions almost exactly the same as the previous model, so we can use the same quirks.
--- drivers/hid/hid-asus.c | 3 +++ drivers/hid/hid-ids.h | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-asus.c +3 -0
@@ -1282,6 +1282,9 @@ static const struct hid_device_id asus_devices[] = { {HID_USB_DEVICE (USB_VENDOR_ID_ASUSTEK ,USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY ), QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, +USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X ), + QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD ), QUIRK_ROG_CLAYMORE_II_KEYBOARD },
drivers/hid/hid-ids.h +1 -0
@@ -210,6 +210,7 @@#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3 0x1a30#define USB_DEVICE_ID_ASUSTEK_ROG_Z13_LIGHTBAR 0x18c6#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY 0x1abe +#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X 0x1b4c#define USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD 0x196b#define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD 0x1869
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/213 wifi: mac80211: Avoid address calculations via out of bounds array indexing
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kenton Groombridge <[email protected]>
[ Upstream commit 2663d0462eb32ae7c9b035300ab6b1523886c718 ]
req->n_channels must be set before req->channels[] can be used.
This patch fixes one of the issues encountered in [1].
[ 83.964255] UBSAN: array-index-out-of-bounds in net/mac80211/scan.c:364:4 [ 83.964258] index 0 is out of range for type 'struct ieee80211_channel *[]' [...] [ 83.964264] Call Trace: [ 83.964267] <TASK> [ 83.964269] dump_stack_lvl+0x3f/0xc0 [ 83.964274] __ubsan_handle_out_of_bounds+0xec/0x110 [ 83.964278] ieee80211_prep_hw_scan+0x2db/0x4b0 [ 83.964281] __ieee80211_start_scan+0x601/0x990 [ 83.964291] nl80211_trigger_scan+0x874/0x980 [ 83.964295] genl_family_rcv_msg_doit+0xe8/0x160 [ 83.964298] genl_rcv_msg+0x240/0x270
[...]
[1] https://bugzilla.kernel.org/show_bug.cgi?id=218810
--- net/mac80211/scan.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
net/mac80211/scan.c +9 -8
@@ -346,7 +346,8 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata)struct cfg80211_scan_request *req;struct cfg80211_chan_def chandef;u8 bands_used =0 ; -int i, ielen, n_chans; +int i, ielen; +u32 *n_chans;u32 flags =0 ; req = rcu_dereference_protected(local->scan_req,
@@ -356,34 +357,34 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata)return false;if (ieee80211_hw_check (&local->hw,SINGLE_SCAN_ON_ALL_BANDS )) { + local->hw_scan_req->req.n_channels = req->n_channels; +for (i =0 ; i < req->n_channels; i++) { local->hw_scan_req->req.channels[i] = req->channels[i]; bands_used |=BIT (req->channels[i]->band); } - - n_chans = req->n_channels; }else {do {if (local->hw_scan_band ==NUM_NL80211_BANDS )return false; - n_chans =0 ; + n_chans = &local->hw_scan_req->req.n_channels; + *n_chans =0 ;for (i =0 ; i < req->n_channels; i++) {if (req->channels[i]->band != local->hw_scan_band)continue ; - local->hw_scan_req->req.channels[n_chans] = + local->hw_scan_req->req.channels[(*n_chans)++] = req->channels[i]; - n_chans++; + bands_used |=BIT (req->channels[i]->band); } local->hw_scan_band++; - }while (!n_chans); + }while (!*n_chans); } - local->hw_scan_req->req.n_channels = n_chans;ieee80211_prepare_scan_chandef (&chandef, req->scan_width);if (req->flags &NL80211_SCAN_FLAG_MIN_PREQ_CONTENT )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/213 hwmon: intel-m10-bmc-hwmon: relabel Columbiaville to CVL Die Temperature
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Colberg <[email protected]>
[ Upstream commit a017616fafc6b2a6b3043bf46f6381ef2611c188 ]
Consistently use CVL instead of Columbiaville, since CVL is already being used in all other sensor labels for the Intel N6000 card.
Message-ID: <[email protected]>
--- drivers/hwmon/intel-m10-bmc-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/intel-m10-bmc-hwmon.c +1 -1
@@ -358,7 +358,7 @@ static const struct m10bmc_sdata n6000bmc_temp_tbl[] = { { 0x4f0, 0x4f4, 0x4f8, 0x52c, 0x0, 500, "Board Top Near FPGA Temperature" }, { 0x4fc, 0x500, 0x504, 0x52c, 0x0, 500, "Board Bottom Near CVL Temperature" }, { 0x508, 0x50c, 0x510, 0x52c, 0x0, 500, "Board Top East Near VRs Temperature" }, - { 0x514, 0x518, 0x51c, 0x52c, 0x0, 500, "Columbiaville Die Temperature" }, + { 0x514, 0x518, 0x51c, 0x52c, 0x0, 500, "CVL Die Temperature" }, { 0x520, 0x524, 0x528, 0x52c, 0x0, 500, "Board Rear Side Temperature" }, { 0x530, 0x534, 0x538, 0x52c, 0x0, 500, "Board Front Side Temperature" }, { 0x53c, 0x540, 0x544, 0x0, 0x0, 500, "QSFP1 Case Temperature" },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/213 hwmon: (tmp513) Add missing dependency on REGMAP_I2C
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 193bc02c664999581a1f38c152f379fce91afc0c ]
0-day reports:
drivers/hwmon/tmp513.c:162:21: error:
variable 'tmp51x_regmap_config' has initializer but incomplete type
162 | static const struct regmap_config tmp51x_regmap_config = {
| ^
struct regmap_config is only available if REGMAP is enabled. Add the missing Kconfig dependency to fix the problem.
--- drivers/hwmon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/Kconfig +1 -0
@@ -2137,6 +2137,7 @@ config SENSORS_TMP464 config SENSORS_TMP513 tristate "Texas Instruments TMP513 and compatibles" depends on I2C + select REGMAP_I2C help If you say yes here you get support for Texas Instruments TMP512, and TMP513 temperature and power supply sensor chips.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/213 hwmon: (mc34vr500) Add missing dependency on REGMAP_I2C
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
[ Upstream commit 56c77c0f4a7c9043e7d1d94e0aace264361e6717 ]
This driver requires REGMAP_I2C to be selected in order to get access to regmap_config and devm_regmap_init_i2c. Add the missing dependency.
Message-ID: <[email protected]>
--- drivers/hwmon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/Kconfig +1 -0
@@ -1200,6 +1200,7 @@ config SENSORS_MAX31790 config SENSORS_MC34VR500 tristate "NXP MC34VR500 hardware monitoring driver" depends on I2C + select REGMAP_I2C help If you say yes here you get support for the temperature and input voltage sensors of the NXP MC34VR500.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/213 hwmon: (adm9240) Add missing dependency on REGMAP_I2C
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
[ Upstream commit 14849a2ec175bb8a2280ce20efe002bb19f1e274 ]
This driver requires REGMAP_I2C to be selected in order to get access to regmap_config and devm_regmap_init_i2c. Add the missing dependency.
Message-ID: <[email protected]>
--- drivers/hwmon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/Kconfig +1 -0
@@ -174,6 +174,7 @@ config SENSORS_ADM9240 tristate "Analog Devices ADM9240 and compatibles" depends on I2C select HWMON_VID + select REGMAP_I2C help If you say yes here you get support for Analog Devices ADM9240, Dallas DS1780, National Semiconductor LM81 sensor chips.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/213 hwmon: (adt7470) Add missing dependency on REGMAP_I2C
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
[ Upstream commit b6abcc19566509ab4812bd5ae5df46515d0c1d70 ]
This driver requires REGMAP_I2C to be selected in order to get access to regmap_config and devm_regmap_init_i2c. Add the missing dependency.
Message-ID: <[email protected]>
--- drivers/hwmon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/Kconfig +1 -0
@@ -236,6 +236,7 @@ config SENSORS_ADT7462 config SENSORS_ADT7470 tristate "Analog Devices ADT7470" depends on I2C + select REGMAP_I2C help If you say yes here you get support for the Analog Devices ADT7470 temperature monitoring chips.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 179/213 HID: amd_sfh: Switch to device-managed dmam_alloc_coherent()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Basavaraj Natikar <[email protected]>
commit c56f9ecb7fb6a3a90079c19eb4c8daf3bbf514b3 upstream.
Using the device-managed version allows to simplify clean-up in probe() error path.
Additionally, this device-managed ensures proper cleanup, which helps to resolve memory errors, page faults, btrfs going read-only, and btrfs disk corruption.
--- drivers/hid/amd-sfh-hid/amd_sfh_client.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_client.c +3 -11
@@ -236,9 +236,9 @@ int amd_sfh_hid_client_init(struct amd_m cl_data->in_data = in_data;for (i =0 ; i < cl_data->num_hid_devices; i++) { - in_data->sensor_virt_addr[i] =dma_alloc_coherent (dev,sizeof (int ) *8 , - &cl_data->sensor_dma_addr[i], -GFP_KERNEL ); + in_data->sensor_virt_addr[i] =dmam_alloc_coherent (dev,sizeof (int ) *8 , + &cl_data->sensor_dma_addr[i], +GFP_KERNEL );if (!in_data->sensor_virt_addr[i]) { rc = -ENOMEM ; goto cleanup;
@@ -331,7 +331,6 @@ cleanup:int amd_sfh_hid_client_deinit (struct amd_mp2_dev *privdata) {struct amdtp_cl_data *cl_data = privdata->cl_data; -struct amd_input_data *in_data = cl_data->in_data;int i, status;for (i =0 ; i < cl_data->num_hid_devices; i++) {
@@ -351,12 +350,5 @@ int amd_sfh_hid_client_deinit(struct amdcancel_delayed_work_sync (&cl_data->work_buffer);amdtp_hid_remove (cl_data); -for (i =0 ; i < cl_data->num_hid_devices; i++) { -if (in_data->sensor_virt_addr[i]) { -dma_free_coherent (&privdata->pdev->dev,8 *sizeof (int ), - in_data->sensor_virt_addr[i], - cl_data->sensor_dma_addr[i]); - } - }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 180/213 HID: multitouch: Add support for lenovo Y9000P Touchpad
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: He Lugang <[email protected]>
commit 251efae73bd46b097deec4f9986d926813aed744 upstream.
The 2024 Lenovo Y9000P which use GT7868Q chip also needs a fixup. The information of the chip is as follows:
I2C HID v1.00 Mouse [GXTP5100:00 27C6:01E0]
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/hid/hid-ids.h +1 -0
@@ -505,6 +505,7 @@#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100#define I2C_VENDOR_ID_GOODIX 0x27c6 +#define I2C_DEVICE_ID_GOODIX_01E0 0x01e0#define I2C_DEVICE_ID_GOODIX_01E8 0x01e8#define I2C_DEVICE_ID_GOODIX_01E9 0x01e9#define I2C_DEVICE_ID_GOODIX_01F0 0x01f0
drivers/hid/hid-multitouch.c +6 -2
@@ -1447,7 +1447,8 @@ static __u8 *mt_report_fixup(struct hid_ {if (hdev->vendor ==I2C_VENDOR_ID_GOODIX && (hdev->product ==I2C_DEVICE_ID_GOODIX_01E8 || - hdev->product ==I2C_DEVICE_ID_GOODIX_01E9 )) { + hdev->product ==I2C_DEVICE_ID_GOODIX_01E9 || + hdev->product ==I2C_DEVICE_ID_GOODIX_01E0 )) {if (rdesc[607 ] ==0x15 ) { rdesc[607 ] =0x25 ; dev_info(
@@ -2068,7 +2069,10 @@ static const struct hid_device_id mt_dev I2C_DEVICE_ID_GOODIX_01E8) }, { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU,HID_DEVICE (BUS_I2C ,HID_GROUP_ANY ,I2C_VENDOR_ID_GOODIX , - I2C_DEVICE_ID_GOODIX_01E8) }, + I2C_DEVICE_ID_GOODIX_01E9) }, + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU, +HID_DEVICE (BUS_I2C ,HID_GROUP_ANY ,I2C_VENDOR_ID_GOODIX , + I2C_DEVICE_ID_GOODIX_01E0) }, /* GoodTouch panels */ { .driver_data = MT_CLS_NSMU,
Greg Kroah-Hartman
maintainerPATCH 181/213 HID: plantronics: Workaround for an unexcepted opposite volume key
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wade Wang <[email protected]>
commit 87b696209007b7c4ef7bdfe39ea0253404a43770 upstream.
Some Plantronics headset as the below send an unexcept opposite volume key's HID report for each volume key press after 200ms, like unecepted Volume Up Key following Volume Down key pressed by user. This patch adds a quirk to hid-plantronics for these devices, which will ignore the second unexcepted opposite volume key if it happens within 220ms from the last one that was handled.
Plantronics EncorePro 500 Series (047f:431e)
Plantronics Blackwire_3325 Series (047f:430c)The patch was tested on the mentioned model, it shouldn't affect other models, however, this quirk might be needed for them too. Auto-repeat (when a key is held pressed) is not affected per test result.
--- drivers/hid/hid-ids.h | 2 ++ drivers/hid/hid-plantronics.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)
drivers/hid/hid-ids.h +2 -0
@@ -1033,6 +1033,8 @@#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES 0xc057#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES 0xc058 +#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES 0x430c +#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES 0x431e#define USB_VENDOR_ID_PANASONIC 0x04da#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
drivers/hid/hid-plantronics.c +23 -0
@@ -38,8 +38,10 @@ (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)#define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0) +#define PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS BIT(1)#define PLT_DOUBLE_KEY_TIMEOUT 5/* ms */ +#define PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT 220/* ms */ struct plt_drv_data {unsigned long device_type;
@@ -137,6 +139,21 @@ static int plantronics_event(struct hid_ drv_data->last_volume_key_ts = cur_ts; } +if (drv_data->quirks &PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS ) { +unsigned long prev_ts, cur_ts; + +/* Usages are filtered in plantronics_usages. */ + +if (!value)/* Handle key presses only. */ +return 0 ; + + prev_ts = drv_data->last_volume_key_ts; + cur_ts = jiffies; +if (jiffies_to_msecs (cur_ts - prev_ts) <=PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT ) +return 1 ;/* Ignore the followed opposite volume key. */ + + drv_data->last_volume_key_ts = cur_ts; + }return 0 ; }
@@ -210,6 +227,12 @@ static const struct hid_device_id plantr {HID_USB_DEVICE (USB_VENDOR_ID_PLANTRONICS , USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES), .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS }, + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, + USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES), + .driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS }, + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, + USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES), + .driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS }, { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, { } };
Greg Kroah-Hartman
maintainerPATCH 182/213 Revert "usb: yurex: Replace snprintf() with the safer scnprintf() variant"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 71c717cd8a2e180126932cc6851ff21c1d04d69a upstream.
This reverts commit 86b20af11e84c26ae3fde4dcc4f490948e3f8035.
This patch leads to passing 0 to simple_read_from_buffer() as a fifth argument, turning the read method into a nop. The change is fundamentally flawed, as it breaks the driver.
--- drivers/usb/misc/yurex.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/usb/misc/yurex.c +8 -11
@@ -34,8 +34,6 @@#define YUREX_BUF_SIZE 8#define YUREX_WRITE_TIMEOUT (HZ*2) -#define MAX_S64_STRLEN 20/* {-}922337203685477580{7,8} */ -/* table of devices that work with this driver */ static struct usb_device_id yurex_table[] = { {USB_DEVICE (YUREX_VENDOR_ID ,YUREX_PRODUCT_ID ) },
@@ -403,7 +401,8 @@ static ssize_t yurex_read(struct file *f {struct usb_yurex *dev;int len =0 ; -char in_buffer[MAX_S64_STRLEN ]; +char in_buffer[20 ]; +unsigned long flags; dev = file->private_data;
@@ -413,16 +412,14 @@ static ssize_t yurex_read(struct file *freturn -ENODEV ; } -if (WARN_ON_ONCE (dev->bbu >S64_MAX || dev->bbu <S64_MIN )) { -mutex_unlock (&dev->io_mutex); -return -EIO ; - } - -spin_lock_irq (&dev->lock); -scnprintf (in_buffer,MAX_S64_STRLEN ,"%lld\n" , dev->bbu); -spin_unlock_irq (&dev->lock); +spin_lock_irqsave (&dev->lock, flags); + len =snprintf (in_buffer,20 ,"%lld\n" , dev->bbu); +spin_unlock_irqrestore (&dev->lock, flags);mutex_unlock (&dev->io_mutex); +if (WARN_ON_ONCE (len >=sizeof (in_buffer))) +return -EIO ; +return simple_read_from_buffer (buffer, count, ppos, in_buffer, len); }
Greg Kroah-Hartman
maintainerPATCH 183/213 usb: dwc3: core: Stop processing of pending events if controller is halted
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvarasu Ganesan <[email protected]>
commit 0d410e8913f5cffebcca79ffdd596009d4a13a28 upstream.
This commit addresses an issue where events were being processed when the controller was in a halted state. To fix this issue by stop processing the events as the event count was considered stale or invalid when the controller was halted.
--- drivers/usb/dwc3/core.c | 22 +++++++++++++++++++--- drivers/usb/dwc3/core.h | 4 ---- drivers/usb/dwc3/gadget.c | 11 ----------- 3 files changed, 19 insertions(+), 18 deletions(-)
drivers/usb/dwc3/core.c +19 -3
@@ -533,6 +533,7 @@ static int dwc3_alloc_event_buffers(struint dwc3_event_buffers_setup (struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +u32 reg;if (!dwc->ev_buf)return 0 ;
@@ -545,8 +546,10 @@ int dwc3_event_buffers_setup(struct dwc3 upper_32_bits(evt->dma));dwc3_writel (dwc->regs,DWC3_GEVNTSIZ (0 ),DWC3_GEVNTSIZ_SIZE (evt->length)); -dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ),0 ); +/* Clear any stale event */ + reg =dwc3_readl (dwc->regs,DWC3_GEVNTCOUNT (0 )); +dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ), reg);return 0 ; }
@@ -573,7 +576,10 @@ void dwc3_event_buffers_cleanup(struct ddwc3_writel (dwc->regs,DWC3_GEVNTADRHI (0 ),0 );dwc3_writel (dwc->regs,DWC3_GEVNTSIZ (0 ),DWC3_GEVNTSIZ_INTMASK |DWC3_GEVNTSIZ_SIZE (0 )); -dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ),0 ); + +/* Clear any stale event */ + reg =dwc3_readl (dwc->regs,DWC3_GEVNTCOUNT (0 )); +dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ), reg); }static void dwc3_core_num_eps (struct dwc3 *dwc)
@@ -2254,7 +2260,11 @@ static int dwc3_runtime_resume(struct deswitch (dwc->current_dr_role) {case DWC3_GCTL_PRTCAP_DEVICE : -dwc3_gadget_process_pending_events (dwc); +if (dwc->pending_events) { +pm_runtime_put (dwc->dev); + dwc->pending_events = false; +enable_irq (dwc->irq_gadget); + }break ;case DWC3_GCTL_PRTCAP_HOST :default :
@@ -2341,6 +2351,12 @@ static void dwc3_complete(struct devicestatic const struct dev_pm_ops dwc3_dev_pm_ops = {SET_SYSTEM_SLEEP_PM_OPS (dwc3_suspend, dwc3_resume) .complete = dwc3_complete, + +/* +* Runtime suspend halts the controller on disconnection. It relies on +* platforms with custom connection notification to start the controller +* again. +*/ SET_RUNTIME_PM_OPS (dwc3_runtime_suspend, dwc3_runtime_resume, dwc3_runtime_idle) };
drivers/usb/dwc3/core.h +0 -4
@@ -1643,7 +1643,6 @@ static inline void dwc3_otg_host_init(st#if !IS_ENABLED (CONFIG_USB_DWC3_HOST )int dwc3_gadget_suspend (struct dwc3 *dwc);int dwc3_gadget_resume (struct dwc3 *dwc); -void dwc3_gadget_process_pending_events (struct dwc3 *dwc);#else static inline int dwc3_gadget_suspend (struct dwc3 *dwc) {
@@ -1655,9 +1654,6 @@ static inline int dwc3_gadget_resume(str return 0; } -static inline void dwc3_gadget_process_pending_events (struct dwc3 *dwc) -{ -}#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */ #if IS_ENABLED (CONFIG_USB_DWC3_ULPI )
drivers/usb/dwc3/gadget.c +0 -11
@@ -4741,14 +4741,3 @@ int dwc3_gadget_resume(struct dwc3 *dwc)return dwc3_gadget_soft_connect (dwc); } - -void dwc3_gadget_process_pending_events (struct dwc3 *dwc) -{ -if (dwc->pending_events) { -dwc3_interrupt (dwc->irq_gadget, dwc->ev_buf); -dwc3_thread_interrupt (dwc->irq_gadget, dwc->ev_buf); -pm_runtime_put (dwc->dev); - dwc->pending_events = false; -enable_irq (dwc->irq_gadget); - } -}
Greg Kroah-Hartman
maintainerPATCH 184/213 usb: xhci: Fix problem with xhci resume from suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Alberto Reguero <[email protected]>
commit d44238d8254a36249d576c96473269dbe500f5e4 upstream.
I have a ASUS PN51 S mini pc that has two xhci devices. One from AMD, and other from ASMEDIA. The one from ASMEDIA have problems when resume from suspend, and keep broken until unplug the power cord. I use this kernel parameter: xhci-hcd.quirks=128 and then it works ok. I make a path to reset only the ASMEDIA xhci.
--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/xhci-pci.c +5 -0
@@ -73,6 +73,7 @@#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242#define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142 +#define PCI_DEVICE_ID_ASMEDIA_3042_XHCI 0x3042#define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242#define PCI_DEVICE_ID_CADENCE 0x17CD
@@ -516,6 +517,10 @@ static void xhci_pci_quirks(struct devic pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; +if (pdev->vendor ==PCI_VENDOR_ID_ASMEDIA && + pdev->device ==PCI_DEVICE_ID_ASMEDIA_3042_XHCI ) + xhci->quirks |=XHCI_RESET_ON_RESUME ; +if (pdev->vendor ==PCI_VENDOR_ID_TI && pdev->device ==0x8241 ) xhci->quirks |=XHCI_LIMIT_ENDPOINT_INTERVAL_7 ;
Greg Kroah-Hartman
maintainerPATCH 185/213 usb: storage: ignore bogus device raised by JieLi BR21 USB sound chip
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
commit a6555cb1cb69db479d0760e392c175ba32426842 upstream.
JieLi tends to use SCSI via USB Mass Storage to implement their own proprietary commands instead of implementing another USB interface. Enumerating it as a generic mass storage device will lead to a Hardware Error sense key get reported.
Ignore this bogus device to prevent appearing a unusable sdX device file.
--- drivers/usb/storage/unusual_devs.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/storage/unusual_devs.h +11 -0
@@ -2423,6 +2423,17 @@ UNUSUAL_DEV( 0xc251, 0x4003, 0x0100, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE), +/* +* Reported by Icenowy Zheng <[email protected]> +* This is an interface for vendor-specific cryptic commands instead +* of real USB storage device. +*/ +UNUSUAL_DEV (0xe5b7 ,0x0811 ,0x0100 ,0x0100 , +"ZhuHai JieLi Technology" , +"JieLi BR21" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_IGNORE_DEVICE ), +/* Reported by Andrew Simmons <[email protected]> */ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, "DataStor",
Greg Kroah-Hartman
maintainerPATCH 186/213 usb: gadget: core: force synchronous registration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit df9158826b00e53f42c67d62c887a84490d80a0a upstream.
Registering a gadget driver is expected to complete synchronously and immediately after calling driver_register() this function checks that the driver has bound so as to return an error.
Set PROBE_FORCE_SYNCHRONOUS to ensure this is the case even when asynchronous probing is set as the default.
--- drivers/usb/gadget/udc/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/udc/core.c +1 -0
@@ -1671,6 +1671,7 @@ int usb_gadget_register_driver_owner(str driver->driver.bus = &gadget_bus_type; driver->driver.owner = owner; driver->driver.mod_name = mod_name; + driver->driver.probe_type =PROBE_FORCE_SYNCHRONOUS ; ret =driver_register (&driver->driver);if (ret) { pr_warn("%s: driver registration failed: %d\n",
Greg Kroah-Hartman
maintainerPATCH 187/213 hid: intel-ish-hid: Fix uninitialized variable rv in ish_fw_xfer_direct_dma
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SurajSonawane2415 <[email protected]>
commit d41bff05a61fb539f21e9bf0d39fac77f457434e upstream.
Fix the uninitialized symbol 'rv' in the function ish_fw_xfer_direct_dma to resolve the following warning from the smatch tool:drivers/hid/intel-ish-hid/ishtp-fw-loader.c:714 ish_fw_xfer_direct_dma()
error: uninitialized symbol 'rv'.
Initialize 'rv' to 0 to prevent undefined behavior from uninitialized access.
--- drivers/hid/intel-ish-hid/ishtp-fw-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/intel-ish-hid/ishtp-fw-loader.c +1 -1
@@ -635,7 +635,7 @@ static int ish_fw_xfer_direct_dma(structconst struct firmware *fw, const struct shim_fw_info fw_info) { - int rv; + int rv = 0;void *dma_buf;dma_addr_t dma_buf_phy;u32 fragment_offset, fragment_size, payload_max_size;
Greg Kroah-Hartman
maintainerPATCH 188/213 drm/v3d: Stop the active perfmon before being destroyed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
commit 7d1fd3638ee3a9f9bca4785fffb638ca19120718 upstream.
When running kmscube with one or more performance monitors enabled via GALLIUM_HUD, the following kernel panic can occur:
[ 55.008324] Unable to handle kernel paging request at virtual address 00000000052004a4 [ 55.008368] Mem abort info: [ 55.008377] ESR = 0x0000000096000005 [ 55.008387] EC = 0x25: DABT (current EL), IL = 32 bits [ 55.008402] SET = 0, FnV = 0 [ 55.008412] EA = 0, S1PTW = 0 [ 55.008421] FSC = 0x05: level 1 translation fault [ 55.008434] Data abort info: [ 55.008442] ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 [ 55.008455] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 55.008467] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 55.008481] user pgtable: 4k pages, 39-bit VAs, pgdp=00000001046c6000 [ 55.008497] [00000000052004a4] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 [ 55.008525] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP [ 55.008542] Modules linked in: rfcomm [...] vc4 v3d snd_soc_hdmi_codec drm_display_helper gpu_sched drm_shmem_helper cec drm_dma_helper drm_kms_helper i2c_brcmstb drm drm_panel_orientation_quirks snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd backlight [ 55.008799] CPU: 2 PID: 166 Comm: v3d_bin Tainted: G C 6.6.47+rpt-rpi-v8 #1 Debian 1:6.6.47-1+rpt1 [ 55.008824] Hardware name: Raspberry Pi 4 Model B Rev 1.5 (DT) [ 55.008838] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 55.008855] pc : __mutex_lock.constprop.0+0x90/0x608 [ 55.008879] lr : __mutex_lock.constprop.0+0x58/0x608 [ 55.008895] sp : ffffffc080673cf0 [ 55.008904] x29: ffffffc080673cf0 x28: 0000000000000000 x27: ffffff8106188a28 [ 55.008926] x26: ffffff8101e78040 x25: ffffff8101baa6c0 x24: ffffffd9d989f148 [ 55.008947] x23: ffffffda1c2a4008 x22: 0000000000000002 x21: ffffffc080673d38 [ 55.008968] x20: ffffff8101238000 x19: ffffff8104f83188 x18: 0000000000000000 [ 55.008988] x17: 0000000000000000 x16: ffffffda1bd04d18 x15: 00000055bb08bc90 [ 55.009715] x14: 0000000000000000 x13: 0000000000000000 x12: ffffffda1bd4cbb0 [ 55.010433] x11: 00000000fa83b2da x10: 0000000000001a40 x9 : ffffffda1bd04d04 [ 55.011162] x8 : ffffff8102097b80 x7 : 0000000000000000 x6 : 00000000030a5857 [ 55.011880] x5 : 00ffffffffffffff x4 : 0300000005200470 x3 : 0300000005200470 [ 55.012598] x2 : ffffff8101238000 x1 : 0000000000000021 x0 : 0300000005200470 [ 55.013292] Call trace: [ 55.013959] __mutex_lock.constprop.0+0x90/0x608 [ 55.014646] __mutex_lock_slowpath+0x1c/0x30 [ 55.015317] mutex_lock+0x50/0x68 [ 55.015961] v3d_perfmon_stop+0x40/0xe0 [v3d] [ 55.016627] v3d_bin_job_run+0x10c/0x2d8 [v3d] [ 55.017282] drm_sched_main+0x178/0x3f8 [gpu_sched] [ 55.017921] kthread+0x11c/0x128 [ 55.018554] ret_from_fork+0x10/0x20 [ 55.019168] Code: f9400260 f1001c1f 54001ea9 927df000 (b9403401) [ 55.019776] ---[ end trace 0000000000000000 ]--- [ 55.020411] note: v3d_bin[166] exited with preempt_count 1
This issue arises because, upon closing the file descriptor (which happens when we interrupt kmscube), the active performance monitor is not stopped. Although all perfmons are destroyed in v3d_perfmon_close_file(), the active performance monitor's pointer (v3d->active_perfmon) is still retained.
If kmscube is run again, the driver will attempt to stop the active performance monitor using the stale pointer in v3d->active_perfmon. However, this pointer is no longer valid because the previous process has already terminated, and all performance monitors associated with it have been destroyed and freed.
To fix this, when the active performance monitor belongs to a given process, explicitly stop it before destroying and freeing it.
--- drivers/gpu/drm/v3d/v3d_perfmon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/v3d/v3d_perfmon.c +8 -1
@@ -103,6 +103,11 @@ void v3d_perfmon_open_file(struct v3d_fistatic int v3d_perfmon_idr_del (int id,void *elem,void *data) {struct v3d_perfmon *perfmon = elem; +struct v3d_dev *v3d = (struct v3d_dev *)data; + +/* If the active perfmon is being destroyed, stop it first */ +if (perfmon == v3d->active_perfmon) +v3d_perfmon_stop (v3d, perfmon, false);v3d_perfmon_put (perfmon);
@@ -111,8 +116,10 @@ static int v3d_perfmon_idr_del(int id, vvoid v3d_perfmon_close_file (struct v3d_file_priv *v3d_priv) { +struct v3d_dev *v3d = v3d_priv->v3d; +mutex_lock (&v3d_priv->perfmon.lock); -idr_for_each (&v3d_priv->perfmon.idr, v3d_perfmon_idr_del,NULL ); +idr_for_each (&v3d_priv->perfmon.idr, v3d_perfmon_idr_del, v3d);idr_destroy (&v3d_priv->perfmon.idr);mutex_unlock (&v3d_priv->perfmon.lock);mutex_destroy (&v3d_priv->perfmon.lock);
Greg Kroah-Hartman
maintainerPATCH 189/213 drm/vc4: Stop the active perfmon before being destroyed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
commit 0b2ad4f6f2bec74a5287d96cb2325a5e11706f22 upstream.
Upon closing the file descriptor, the active performance monitor is not stopped. Although all perfmons are destroyed in vc4_perfmon_close_file(), the active performance monitor's pointer (vc4->active_perfmon) is still retained.
If we open a new file descriptor and submit a few jobs with performance monitors, the driver will attempt to stop the active performance monitor using the stale pointer in vc4->active_perfmon. However, this pointer is no longer valid because the previous process has already terminated, and all performance monitors associated with it have been destroyed and freed.
To fix this, when the active performance monitor belongs to a given process, explicitly stop it before destroying and freeing it.
--- drivers/gpu/drm/vc4/vc4_perfmon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_perfmon.c +6 -1
@@ -116,6 +116,11 @@ void vc4_perfmon_open_file(struct vc4_fistatic int vc4_perfmon_idr_del (int id,void *elem,void *data) {struct vc4_perfmon *perfmon = elem; +struct vc4_dev *vc4 = (struct vc4_dev *)data; + +/* If the active perfmon is being destroyed, stop it first */ +if (perfmon == vc4->active_perfmon) +vc4_perfmon_stop (vc4, perfmon, false);vc4_perfmon_put (perfmon);
@@ -130,7 +135,7 @@ void vc4_perfmon_close_file(struct vc4_freturn ;mutex_lock (&vc4file->perfmon.lock); -idr_for_each (&vc4file->perfmon.idr, vc4_perfmon_idr_del,NULL ); +idr_for_each (&vc4file->perfmon.idr, vc4_perfmon_idr_del, vc4);idr_destroy (&vc4file->perfmon.idr);mutex_unlock (&vc4file->perfmon.lock);mutex_destroy (&vc4file->perfmon.lock);
Greg Kroah-Hartman
maintainerPATCH 190/213 drm/i915/hdcp: fix connector refcounting
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 4cc2718f621a6a57a02581125bb6d914ce74d23b upstream.
We acquire a connector reference before scheduling an HDCP prop work, and expect the work function to release the reference.
However, if the work was already queued, it won't be queued multiple times, and the reference is not dropped.
Release the reference immediately if the work was already queued.
--- drivers/gpu/drm/i915/display/intel_hdcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +7 -3
@@ -1005,7 +1005,8 @@ static void intel_hdcp_update_value(stru hdcp->value = value;if (update_property) {drm_connector_get (&connector->base); -queue_work (i915->unordered_wq, &hdcp->prop_work); +if (!queue_work (i915->unordered_wq, &hdcp->prop_work)) +drm_connector_put (&connector->base); } }
@@ -2480,7 +2481,8 @@ void intel_hdcp_update_pipe(struct intelmutex_lock (&hdcp->mutex); hdcp->value =DRM_MODE_CONTENT_PROTECTION_DESIRED ;drm_connector_get (&connector->base); -queue_work (i915->unordered_wq, &hdcp->prop_work); +if (!queue_work (i915->unordered_wq, &hdcp->prop_work)) +drm_connector_put (&connector->base);mutex_unlock (&hdcp->mutex); }
@@ -2497,7 +2499,9 @@ void intel_hdcp_update_pipe(struct intel*/ if (!desired_and_not_enabled && !content_protection_type_changed) {drm_connector_get (&connector->base); -queue_work (i915->unordered_wq, &hdcp->prop_work); +if (!queue_work (i915->unordered_wq, &hdcp->prop_work)) +drm_connector_put (&connector->base); + } }
Greg Kroah-Hartman
maintainerPATCH 191/213 Bluetooth: hci_conn: Fix UAF in hci_enhanced_setup_sync
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
commit 18fd04ad856df07733f5bb07e7f7168e7443d393 upstream.
This checks if the ACL connection remains valid as it could be destroyed while hci_enhanced_setup_sync is pending on cmd_sync leading to the following trace:
BUG: KASAN: slab-use-after-free in hci_enhanced_setup_sync+0x91b/0xa60 Read of size 1 at addr ffff888002328ffd by task kworker/u5:2/37 CPU: 0 UID: 0 PID: 37 Comm: kworker/u5:2 Not tainted 6.11.0-rc6-01300-g810be445d8d6 #7099 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-2.fc40 04/01/2014 Workqueue: hci0 hci_cmd_sync_work Call Trace: <TASK> dump_stack_lvl+0x5d/0x80 ? hci_enhanced_setup_sync+0x91b/0xa60 print_report+0x152/0x4c0 ? hci_enhanced_setup_sync+0x91b/0xa60 ? __virt_addr_valid+0x1fa/0x420 ? hci_enhanced_setup_sync+0x91b/0xa60 kasan_report+0xda/0x1b0 ? hci_enhanced_setup_sync+0x91b/0xa60 hci_enhanced_setup_sync+0x91b/0xa60 ? __pfx_hci_enhanced_setup_sync+0x10/0x10 ? __pfx___mutex_lock+0x10/0x10 hci_cmd_sync_work+0x1c2/0x330 process_one_work+0x7d9/0x1360 ? __pfx_lock_acquire+0x10/0x10 ? __pfx_process_one_work+0x10/0x10 ? assign_work+0x167/0x240 worker_thread+0x5b7/0xf60 ? __kthread_parkme+0xac/0x1c0 ? __pfx_worker_thread+0x10/0x10 ? __pfx_worker_thread+0x10/0x10 kthread+0x293/0x360 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2f/0x70 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Allocated by task 34: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 __kasan_kmalloc+0x8f/0xa0 __hci_conn_add+0x187/0x17d0 hci_connect_sco+0x2e1/0xb90 sco_sock_connect+0x2a2/0xb80 __sys_connect+0x227/0x2a0 __x64_sys_connect+0x6d/0xb0 do_syscall_64+0x71/0x140 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 37: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x60 __kasan_slab_free+0x101/0x160 kfree+0xd0/0x250 device_release+0x9a/0x210 kobject_put+0x151/0x280 hci_conn_del+0x448/0xbf0 hci_abort_conn_sync+0x46f/0x980 hci_cmd_sync_work+0x1c2/0x330 process_one_work+0x7d9/0x1360 worker_thread+0x5b7/0xf60 kthread+0x293/0x360 ret_from_fork+0x2f/0x70 ret_from_fork_asm+0x1a/0x30
--- net/bluetooth/hci_conn.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/hci_conn.c +3 -0
@@ -290,6 +290,9 @@ static int hci_enhanced_setup_sync(struckfree (conn_handle); +if (!hci_conn_valid (hdev, conn)) +return -ECANCELED ; +bt_dev_dbg (hdev,"hcon %p" , conn);configure_datapath_sync (hdev, &conn->codec);
Greg Kroah-Hartman
maintainerPATCH 192/213 scsi: wd33c93: Dont use stale scsi_pointer value
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Palmer <[email protected]>
commit 9023ed8d91eb1fcc93e64dc4962f7412b1c4cbec upstream.
A regression was introduced with commit dbb2da557a6a ("scsi: wd33c93:
Move the SCSI pointer to private command data") which results in an oops in wd33c93_intr(). That commit added the scsi_pointer variable and initialized it from hostdata->connected. However, during selection, hostdata->connected is not yet valid. Fix this by getting the current scsi_pointer from hostdata->selecting.
--- drivers/scsi/wd33c93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/wd33c93.c +1 -1
@@ -831,7 +831,7 @@ wd33c93_intr(struct Scsi_Host *instance)/* construct an IDENTIFY message with correct disconnect bit */ hostdata->outgoing_msg[0 ] =IDENTIFY (0 , cmd->device->lun); -if (scsi_pointer->phase) +if (WD33C93_scsi_pointer (cmd)->phase) hostdata->outgoing_msg[0 ] |=0x40 ;if (hostdata->sync_stat[cmd->device->id] ==SS_FIRST ) {
Greg Kroah-Hartman
maintainerPATCH 193/213 scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
commit d5130c5a093257aa4542aaded8034ef116a7624a upstream.
Replace manual offset calculations for response_upiu and prd_table in ufshcd_init_lrb() with pre-calculated offsets already stored in the utp_transfer_req_desc structure. The pre-calculated offsets are set differently in ufshcd_host_memory_configure() based on the UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk, ensuring correct alignment and access.
--- drivers/ufs/core/ufshcd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ufs/core/ufshcd.c +2 -3
@@ -2804,9 +2804,8 @@ static void ufshcd_init_lrb(struct ufs_hstruct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr;dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr + i *ufshcd_get_ucd_size (hba); -u16 response_offset = offsetof(struct utp_transfer_cmd_desc , - response_upiu); -u16 prdt_offset = offsetof(struct utp_transfer_cmd_desc , prd_table); +u16 response_offset =le16_to_cpu (utrdlp[i].response_upiu_offset); +u16 prdt_offset =le16_to_cpu (utrdlp[i].prd_table_offset); lrb->utr_descriptor_ptr = utrdlp + i; lrb->utrd_dma_addr = hba->utrdl_dma_addr +
Greg Kroah-Hartman
maintainerPATCH 194/213 mptcp: fallback when MPTCP opts are dropped after 1st data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 119d51e225febc8152476340a880f5415a01e99e upstream.
As reported by Christoph [1], before this patch, an MPTCP connection was wrongly reset when a host received a first data packet with MPTCP options after the 3wHS, but got the next ones without.
According to the MPTCP v1 specs [2], a fallback should happen in this case, because the host didn't receive a DATA_ACK from the other peer, nor receive data for more than the initial window which implies a DATA_ACK being received by the other peer.
The patch here re-uses the same logic as the one used in other places:
by looking at allow_infinite_fallback, which is disabled at the creation of an additional subflow. It's not looking at the first DATA_ACK (or implying one received from the other side) as suggested by the RFC, but it is in continuation with what was already done, which is safer, and it fixes the reported issue. The next step, looking at this first DATA_ACK, is tracked in [4].
This patch has been validated using the following Packetdrill script:
0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
// 3WHS is OK
+0.0 < S 0:0(0) win 65535 <mss 1460, sackOK, nop, nop, nop, wscale 6, mpcapable v1 flags[flag_h] nokey>
+0.0 > S. 0:0(0) ack 1 <mss 1460, nop, nop, sackOK, nop, wscale 8, mpcapable v1 flags[flag_h] key[skey]>
+0.1 < . 1:1(0) ack 1 win 2048 <mpcapable v1 flags[flag_h] key[ckey=2, skey]>
+0 accept(3, ..., ...) = 4
// Data from the client with valid MPTCP options (no DATA_ACK: normal)
+0.1 < P. 1:501(500) ack 1 win 2048 <mpcapable v1 flags[flag_h] key[skey, ckey] mpcdatalen 500, nop, nop> // From here, the MPTCP options will be dropped by a middlebox
+0.0 > . 1:1(0) ack 501 <dss dack8=501 dll=0 nocs>
+0.1 read(4, ..., 500) = 500
+0 write(4, ..., 100) = 100
// The server replies with data, still thinking MPTCP is being used
+0.0 > P. 1:101(100) ack 501 <dss dack8=501 dsn8=1 ssn=1 dll=100 nocs, nop, nop>
// But the client already did a fallback to TCP, because the two previous packets have been received without MPTCP options
+0.1 < . 501:501(0) ack 101 win 2048
+0.0 < P. 501:601(100) ack 101 win 2048
// The server should fallback to TCP, not reset: it didn't get a DATA_ACK, nor data for more than the initial window
+0.0 > . 101:101(0) ack 601
Note that this script requires Packetdrill with MPTCP support, see [3].
--- net/mptcp/subflow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/subflow.c +1 -1
@@ -1247,7 +1247,7 @@ static bool subflow_can_fallback(structelse if (READ_ONCE (msk->csum_enabled))return !subflow->valid_csum_seen;else -return !subflow->fully_established; +return READ_ONCE (msk->allow_infinite_fallback); }static void mptcp_subflow_fail (struct mptcp_sock *msk,struct sock *ssk)
Greg Kroah-Hartman
maintainerPATCH 195/213 ata: libata: avoid superfluous disk spin down + spin up during hibernation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit a38719e3157118428e34fbd45b0d0707a5877784 upstream.
A user reported that commit aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop") introduced a spin down + immediate spin up of the disk both when entering and when resuming from hibernation. This behavior was not there before, and causes an increased latency both when entering and when resuming from hibernation.
Hibernation is done by three consecutive PM events, in the following order:
1) PM_EVENT_FREEZE
2) PM_EVENT_THAW
3) PM_EVENT_HIBERNATE
Commit aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop") modified ata_eh_handle_port_suspend() to call ata_dev_power_set_standby() (which spins down the disk), for both event PM_EVENT_FREEZE and event PM_EVENT_HIBERNATE.
Documentation/driver-api/pm/devices.rst, section "Entering Hibernation", explicitly mentions that PM_EVENT_FREEZE does not have to be put the device in a low-power state, and actually recommends not doing so. Thus, let's not spin down the disk on PM_EVENT_FREEZE. (The disk will instead be spun down during the subsequent PM_EVENT_HIBERNATE event.)
This way, PM_EVENT_FREEZE will behave as it did before commit aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop"), while PM_EVENT_HIBERNATE will continue to spin down the disk.
This will avoid the superfluous spin down + spin up when entering and resuming from hibernation, while still making sure that the disk is spun down before actually entering hibernation.
--- drivers/ata/libata-eh.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/ata/libata-eh.c +14 -4
@@ -4049,10 +4049,20 @@ static void ata_eh_handle_port_suspend(sWARN_ON (ap->pflags &ATA_PFLAG_SUSPENDED ); -/* Set all devices attached to the port in standby mode */ -ata_for_each_link (link, ap,HOST_FIRST ) { -ata_for_each_dev (dev, link,ENABLED ) -ata_dev_power_set_standby (dev); +/* +* We will reach this point for all of the PM events: +* PM_EVENT_SUSPEND (if runtime pm, PM_EVENT_AUTO will also be set) +* PM_EVENT_FREEZE, and PM_EVENT_HIBERNATE. +* +* We do not want to perform disk spin down for PM_EVENT_FREEZE. +* (Spin down will be performed by the subsequent PM_EVENT_HIBERNATE.) +*/ +if (!(ap->pm_mesg.event &PM_EVENT_FREEZE )) { +/* Set all devices attached to the port in standby mode */ +ata_for_each_link (link, ap,HOST_FIRST ) { +ata_for_each_dev (dev, link,ENABLED ) +ata_dev_power_set_standby (dev); + } }/*
Greg Kroah-Hartman
maintainerPATCH 196/213 net: explicitly clear the sk pointer, when pf->create fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
commit 631083143315d1b192bd7d915b967b37819e88ea upstream.
We have recently noticed the exact same KASAN splat as in commit 6cd4a78d962b ("net: do not leave a dangling sk pointer, when socket creation fails"). The problem is that commit did not fully address the problem, as some pf->create implementations do not use sk_common_release in their error paths.
For example, we can use the same reproducer as in the above commit, but changing ping to arping. arping uses AF_PACKET socket and if packet_create fails, it will just sk_free the allocated sk object.
While we could chase all the pf->create implementations and make sure they NULL the freed sk object on error from the socket, we can't guarantee future protocols will not make the same mistake.
So it is easier to just explicitly NULL the sk pointer upon return from pf->create in __sock_create. We do know that pf->create always releases the allocated sk object on error, so if the pointer is not NULL, it is definitely dangling.
--- net/socket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/socket.c +6 -1
@@ -1569,8 +1569,13 @@ int __sock_create(struct net *net, int frcu_read_unlock (); err = pf->create (net, sock, protocol, kern); -if (err <0 ) +if (err <0 ) { +/* ->create should release the allocated sock->sk object on error +* but it may leave the dangling pointer +*/ + sock->sk =NULL ; goto out_module_put; + }/* * Now to bump the refcnt of the [loadable] module that owns this
Greg Kroah-Hartman
maintainerPATCH 197/213 net: Fix an unsafe loop on the list
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Kovaleva <[email protected]>
commit 1dae9f1187189bc09ff6d25ca97ead711f7e26f9 upstream.
The kernel may crash when deleting a genetlink family if there are still listeners for that family:
Oops: Kernel access of bad area, sig: 11 [#1] ... NIP [c000000000c080bc] netlink_update_socket_mc+0x3c/0xc0 LR [c000000000c0f764] __netlink_clear_multicast_users+0x74/0xc0 Call Trace: __netlink_clear_multicast_users+0x74/0xc0 genl_unregister_family+0xd4/0x2d0
Change the unsafe loop on the list to a safe one, because inside the loop there is an element removal from this list.
--- include/net/sock.h | 2 ++ net/netlink/af_netlink.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
include/net/sock.h +2 -0
@@ -902,6 +902,8 @@ static inline void sk_add_bind2_node(str hlist_for_each_entry(__sk, list, sk_bind_node)#define sk_for_each_bound_bhash2 (__sk, list) \ hlist_for_each_entry(__sk, list, sk_bind2_node) +#define sk_for_each_bound_safe (__sk, tmp, list) \ + hlist_for_each_entry_safe(__sk, tmp, list, sk_bind_node)/** * sk_for_each_entry_offset_rcu - iterate over a list at a given struct offset
net/netlink/af_netlink.c +2 -1
@@ -2143,8 +2143,9 @@ void __netlink_clear_multicast_users(str {struct sock *sk;struct netlink_table *tbl = &nl_table[ksk->sk_protocol]; +struct hlist_node *tmp; -sk_for_each_bound (sk, &tbl->mc_list) +sk_for_each_bound_safe (sk, tmp, &tbl->mc_list)netlink_update_socket_mc (nlk_sk (sk), group,0 ); }
Greg Kroah-Hartman
maintainerPATCH 198/213 net: dsa: lan9303: ensure chip reset and wait for READY status
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anatolij Gustschin <[email protected]>
commit 5c14e51d2d7df49fe0d4e64a12c58d2542f452ff upstream.
Accessing device registers seems to be not reliable, the chip revision is sometimes detected wrongly (0 instead of expected 1).
Ensure that the chip reset is performed via reset GPIO and then wait for 'Device Ready' status in HW_CFG register before doing any register initializations.
--- drivers/net/dsa/lan9303-core.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/net/dsa/lan9303-core.c +29 -0
@@ -6,6 +6,7 @@#include <linux/module.h> #include <linux/gpio/consumer.h> #include <linux/regmap.h> +#include <linux/iopoll.h> #include <linux/mutex.h> #include <linux/mii.h> #include <linux/of.h>
@@ -839,6 +840,8 @@ static void lan9303_handle_reset(structif (!chip->reset_gpio)return ; +gpiod_set_value_cansleep (chip->reset_gpio,1 ); +if (chip->reset_duration !=0 )msleep (chip->reset_duration);
@@ -864,8 +867,34 @@ static int lan9303_disable_processing(ststatic int lan9303_check_device (struct lan9303 *chip) {int ret; +int err;u32 reg; +/* In I2C-managed configurations this polling loop will clash with +* switch's reading of EEPROM right after reset and this behaviour is +* not configurable. While lan9303_read() already has quite long retry +* timeout, seems not all cases are being detected as arbitration error. +* +* According to datasheet, EEPROM loader has 30ms timeout (in case of +* missing EEPROM). +* +* Loading of the largest supported EEPROM is expected to take at least +* 5.9s. +*/ + err =read_poll_timeout (lan9303_read, ret, + !ret && reg &LAN9303_HW_CFG_READY , +20000 ,6000000 , false, + chip->regmap,LAN9303_HW_CFG , ®); +if (ret) { +dev_err (chip->dev,"failed to read HW_CFG reg: %pe\n" , +ERR_PTR (ret)); +return ret; + } +if (err) { +dev_err (chip->dev,"HW_CFG not ready: 0x%08x\n" , reg); +return err; + } + ret =lan9303_read (chip->regmap,LAN9303_CHIP_REV , ®);if (ret) { dev_err(chip->dev, "failed to read chip revision register: %d\n",
Greg Kroah-Hartman
maintainerPATCH 199/213 net: phy: Remove LED entry from LEDs list on unregister
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Marangi <[email protected]>
commit f50b5d74c68e551667e265123659b187a30fe3a5 upstream.
Commit c938ab4da0eb ("net: phy: Manual remove LEDs to ensure correct ordering") correctly fixed a problem with using devm_ but missed removing the LED entry from the LEDs list.
This cause kernel panic on specific scenario where the port for the PHY is torn down and up and the kmod for the PHY is removed.
On setting the port down the first time, the assosiacted LEDs are correctly unregistered. The associated kmod for the PHY is now removed. The kmod is now added again and the port is now put up, the associated LED are registered again.
On putting the port down again for the second time after these step, the LED list now have 4 elements. With the first 2 already unregistered previously and the 2 new one registered again.
This cause a kernel panic as the first 2 element should have been removed.
Fix this by correctly removing the element when LED is unregistered.
--- drivers/net/phy/phy_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/phy/phy_device.c +3 -2
@@ -3082,10 +3082,11 @@ static __maybe_unused int phy_led_hw_is_static void phy_leds_unregister (struct phy_device *phydev) { -struct phy_led *phyled; +struct phy_led *phyled, *tmp; -list_for_each_entry (phyled, &phydev->leds, list) { +list_for_each_entry_safe (phyled, tmp, &phydev->leds, list) {led_classdev_unregister (&phyled->led_cdev); +list_del (&phyled->list); } }
Greg Kroah-Hartman
maintainerPATCH 200/213 mptcp: handle consistently DSS corruption
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit e32d262c89e2b22cb0640223f953b548617ed8a6 upstream.
Bugged peer implementation can send corrupted DSS options, consistently hitting a few warning in the data path. Use DEBUG_NET assertions, to avoid the splat on some builds and handle consistently the error, dumping related MIBs and performing fallback and/or reset according to the subflow type.
--- net/mptcp/mib.c | 2 ++ net/mptcp/mib.h | 2 ++ net/mptcp/protocol.c | 24 +++++++++++++++++++++--- net/mptcp/subflow.c | 4 +++- 4 files changed, 28 insertions(+), 4 deletions(-)
net/mptcp/mib.c +2 -0
@@ -26,6 +26,8 @@ static const struct snmp_mib mptcp_snmp_SNMP_MIB_ITEM ("MPJoinAckRx" ,MPTCP_MIB_JOINACKRX ),SNMP_MIB_ITEM ("MPJoinAckHMacFailure" ,MPTCP_MIB_JOINACKMAC ),SNMP_MIB_ITEM ("DSSNotMatching" ,MPTCP_MIB_DSSNOMATCH ), +SNMP_MIB_ITEM ("DSSCorruptionFallback" ,MPTCP_MIB_DSSCORRUPTIONFALLBACK ), +SNMP_MIB_ITEM ("DSSCorruptionReset" ,MPTCP_MIB_DSSCORRUPTIONRESET ),SNMP_MIB_ITEM ("InfiniteMapTx" ,MPTCP_MIB_INFINITEMAPTX ),SNMP_MIB_ITEM ("InfiniteMapRx" ,MPTCP_MIB_INFINITEMAPRX ), SNMP_MIB_ITEM("DSSNoMatchTCP", MPTCP_MIB_DSSTCPMISMATCH),
net/mptcp/mib.h +2 -0
@@ -19,6 +19,8 @@ enum linux_mptcp_mib_field {MPTCP_MIB_JOINACKRX ,/* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC ,/* HMAC was wrong on ACK + MP_JOIN */ MPTCP_MIB_DSSNOMATCH ,/* Received a new mapping that did not match the previous one */ +MPTCP_MIB_DSSCORRUPTIONFALLBACK ,/* DSS corruption detected, fallback */ +MPTCP_MIB_DSSCORRUPTIONRESET ,/* DSS corruption detected, MPJ subflow reset */ MPTCP_MIB_INFINITEMAPTX ,/* Sent an infinite mapping */ MPTCP_MIB_INFINITEMAPRX ,/* Received an infinite mapping */ MPTCP_MIB_DSSTCPMISMATCH, /* DSS-mapping did not map with TCP's sequence numbers */
net/mptcp/protocol.c +21 -3
@@ -620,6 +620,18 @@ static bool mptcp_check_data_fin(structreturn ret; } +static void mptcp_dss_corruption (struct mptcp_sock *msk,struct sock *ssk) +{ +if (READ_ONCE (msk->allow_infinite_fallback)) { +MPTCP_INC_STATS (sock_net (ssk), +MPTCP_MIB_DSSCORRUPTIONFALLBACK ); +mptcp_do_fallback (ssk); + }else { +MPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_DSSCORRUPTIONRESET ); +mptcp_subflow_reset (ssk); + } +} +static bool __mptcp_move_skbs_from_subflow (struct mptcp_sock *msk,struct sock *ssk,unsigned int *bytes)
@@ -692,10 +704,16 @@ static bool __mptcp_move_skbs_from_subfl moved += len; seq += len; -if (WARN_ON_ONCE (map_remaining < len)) -break ; +if (unlikely (map_remaining < len)) { +DEBUG_NET_WARN_ON_ONCE (1 ); +mptcp_dss_corruption (msk, ssk); + } }else { -WARN_ON_ONCE (!fin); +if (unlikely (!fin)) { +DEBUG_NET_WARN_ON_ONCE (1 ); +mptcp_dss_corruption (msk, ssk); + } +sk_eat_skb (ssk, skb); done = true; }
net/mptcp/subflow.c +3 -1
@@ -944,8 +944,10 @@ static bool skb_is_fully_mapped(struct sunsigned int skb_consumed; skb_consumed =tcp_sk (ssk)->copied_seq -TCP_SKB_CB (skb)->seq; -if (WARN_ON_ONCE (skb_consumed >= skb->len)) +if (unlikely (skb_consumed >= skb->len)) { +DEBUG_NET_WARN_ON_ONCE (1 );return true; + }return skb->len - skb_consumed <= subflow->map_data_len -mptcp_subflow_get_map_offset (subflow);
Greg Kroah-Hartman
maintainerPATCH 201/213 mptcp: pm: do not remove closing subflows
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit db0a37b7ac27d8ca27d3dc676a16d081c16ec7b9 upstream.
In a previous fix, the in-kernel path-manager has been modified not to retrigger the removal of a subflow if it was already closed, e.g. when the initial subflow is removed, but kept in the subflows list.
To be complete, this fix should also skip the subflows that are in any closing state: mptcp_close_ssk() will initiate the closure, but the switch to the TCP_CLOSE state depends on the other peer.
--- net/mptcp/pm_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/pm_netlink.c +2 -1
@@ -864,7 +864,8 @@ static void mptcp_pm_nl_rm_addr_or_subflint how =RCV_SHUTDOWN |SEND_SHUTDOWN ;u8 id =subflow_get_local_id (subflow); -if (inet_sk_state_load (ssk) ==TCP_CLOSE ) +if ((1 <<inet_sk_state_load (ssk)) & + (TCPF_FIN_WAIT1 |TCPF_FIN_WAIT2 |TCPF_CLOSING |TCPF_CLOSE ))continue ;if (rm_type ==MPTCP_MIB_RMADDR && remote_id != rm_id)continue ;
Greg Kroah-Hartman
maintainerPATCH 202/213 device-dax: correct pgoff align in dax_set_mapping()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kun(llfl) <[email protected]>
commit 7fcbd9785d4c17ea533c42f20a9083a83f301fa6 upstream.
pgoff should be aligned using ALIGN_DOWN() instead of ALIGN(). Otherwise, vmf->address not aligned to fault_size will be aligned to the next alignment, that can result in memory failure getting the wrong address.
It's a subtle situation that only can be observed in page_mapped_in_vma() after the page is page fault handled by dev_dax_huge_fault. Generally, there is little chance to perform page_mapped_in_vma in dev-dax's page unless in specific error injection to the dax device to trigger an MCE - memory-failure. In that case, page_mapped_in_vma() will be triggered to determine which task is accessing the failure address and kill that task in the end.
We used self-developed dax device (which is 2M aligned mapping) , to perform error injection to random address. It turned out that error injected to non-2M-aligned address was causing endless MCE until panic. Because page_mapped_in_vma() kept resulting wrong address and the task accessing the failure address was never killed properly:
[ 3783.719419] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3784.049006] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3784.049190] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3784.448042] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3784.448186] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3784.792026] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3784.792179] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3785.162502] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3785.162633] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3785.461116] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3785.461247] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3785.764730] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3785.764859] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3786.042128] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3786.042259] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3786.464293] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3786.464423] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3786.818090] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3786.818217] Memory failure: 0x200c9742: recovery action for dax page: Recovered [ 3787.085297] mce: Uncorrected hardware memory error in user-access at 200c9742380 [ 3787.085424] Memory failure: 0x200c9742: recovery action for dax page:
Recovered
It took us several weeks to pinpoint this problem, but we eventually used bpftrace to trace the page fault and mce address and successfully identified the issue.
Joao added:
; Likely we never reproduce in production because we always pin : device-dax regions in the region align they provide (Qemu does : similarly with prealloc in hugetlb/file backed memory). I think this : bug requires that we touch *unpinned* device-dax regions unaligned to : the device-dax selected alignment (page size i.e. 4K/2M/1G)
--- drivers/dax/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dax/device.c +1 -1
@@ -86,7 +86,7 @@ static void dax_set_mapping(struct vm_fa nr_pages =1 ; pgoff =linear_page_index (vmf->vma, -ALIGN (vmf->address, fault_size)); +ALIGN_DOWN (vmf->address, fault_size));for (i =0 ; i < nr_pages; i++) {struct page *page =pfn_to_page (pfn_t_to_pfn (pfn) + i);
Greg Kroah-Hartman
maintainerPATCH 203/213 nouveau/dmem: Fix vulnerability in migrate_to_ram upon copy error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonatan Maman <[email protected]>
commit 835745a377a4519decd1a36d6b926e369b3033e2 upstream.
The nouveau_dmem_copy_one function ensures that the copy push command is sent to the device firmware but does not track whether it was executed successfully.
In the case of a copy error (e.g., firmware or hardware failure), the copy push command will be sent via the firmware channel, and nouveau_dmem_copy_one will likely report success, leading to the migrate_to_ram function returning a dirty HIGH_USER page to the user.
This can result in a security vulnerability, as a HIGH_USER page that may contain sensitive or corrupted data could be returned to the user.
To prevent this vulnerability, we allocate a zero page. Thus, in case of an error, a non-dirty (zero) page will be returned to the user.
--- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_dmem.c +1 -1
@@ -193,7 +193,7 @@ static vm_fault_t nouveau_dmem_migrate_tif (!spage || !(src &MIGRATE_PFN_MIGRATE )) goto done; - dpage =alloc_page_vma (GFP_HIGHUSER , vmf->vma, vmf->address); + dpage =alloc_page_vma (GFP_HIGHUSER | __GFP_ZERO, vmf->vma, vmf->address);if (!dpage) goto done;
Greg Kroah-Hartman
maintainerPATCH 204/213 powercap: intel_rapl_tpmi: Fix bogus register reading
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit 91e8f835a7eda4ba2c0c4002a3108a0e3b22d34e upstream.
The TPMI_RAPL_REG_DOMAIN_INFO value needs to be multiplied by 8 to get the register offset.
--- drivers/powercap/intel_rapl_tpmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/powercap/intel_rapl_tpmi.c +1 -1
@@ -192,7 +192,7 @@ static int parse_one_domain(struct tpmi_pr_warn (FW_BUG "System domain must support Domain Info register\n" );return -ENODEV ; } - tpmi_domain_info =readq (trp->base + offset +TPMI_RAPL_REG_DOMAIN_INFO ); + tpmi_domain_info =readq (trp->base + offset +TPMI_RAPL_REG_DOMAIN_INFO *8 );if (!(tpmi_domain_info &TPMI_RAPL_DOMAIN_ROOT ))return 0 ; domain_type =RAPL_DOMAIN_PLATFORM ;
Greg Kroah-Hartman
maintainerPATCH 205/213 selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Donet Tom <[email protected]>
commit 76503e1fa1a53ef041a120825d5ce81c7fe7bdd7 upstream.
The hmm2 double_map test was failing due to an incorrect buffer->mirror size. The buffer->mirror size was 6, while buffer->ptr size was 6 * PAGE_SIZE. The test failed because the kernel's copy_to_user function was attempting to copy a 6 * PAGE_SIZE buffer to buffer->mirror. Since the size of buffer->mirror was incorrect, copy_to_user failed.
This patch corrects the buffer->mirror size to 6 * PAGE_SIZE.
Test Result without this patch
==============================
# RUN hmm2.hmm2_device_private.double_map ...
# hmm-tests.c:1680:double_map:Expected ret (-14) == 0 (0) # double_map: Test terminated by assertion
# FAIL hmm2.hmm2_device_private.double_map
not ok 53 hmm2.hmm2_device_private.double_map
Test Result with this patch
===========================
# RUN hmm2.hmm2_device_private.double_map ...
# OK hmm2.hmm2_device_private.double_map
ok 53 hmm2.hmm2_device_private.double_map
--- tools/testing/selftests/mm/hmm-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/hmm-tests.c +1 -1
@@ -1657,7 +1657,7 @@ TEST_F(hmm2, double_map) buffer->fd =-1 ; buffer->size = size; - buffer->mirror =malloc (npages); + buffer->mirror =malloc (size);ASSERT_NE (buffer->mirror,NULL );/* Reserve a range of addresses. */
Greg Kroah-Hartman
maintainerPATCH 206/213 selftests/rseq: Fix mm_cid test failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Desnoyers <[email protected]>
commit a0cc649353bb726d4aa0db60dce467432197b746 upstream.
Adapt the rseq.c/rseq.h code to follow GNU C library changes introduced by:
glibc commit 2e456ccf0c34 ("Linux: Make __rseq_size useful for feature detection (bug 31965)")
Without this fix, rseq selftests for mm_cid fail:
./run_param_test.sh
Default parameters
Running test spinlock
Running compare-twice test spinlock
Running mm_cid test spinlock
Error: cpu id getter unavailable
--- tools/testing/selftests/rseq/rseq.c | 110 ++++++++++++++++++++++++------------ tools/testing/selftests/rseq/rseq.h | 10 --- 2 files changed, 77 insertions(+), 43 deletions(-)
tools/testing/selftests/rseq/rseq.c +75 -35
@@ -60,12 +60,6 @@ unsigned int rseq_size = -1U;/* Flags used during rseq registration. */ unsigned int rseq_flags; -/* -* rseq feature size supported by the kernel. 0 if the registration was -* unsuccessful. -*/ -unsigned int rseq_feature_size =-1U ; -static int rseq_ownership;static int rseq_reg_success;/* At least one rseq registration has succeded. */
@@ -111,6 +105,43 @@ int rseq_available(void) } } +/* The rseq areas need to be at least 32 bytes. */ +static +unsigned int get_rseq_min_alloc_size (void ) +{ +unsigned int alloc_size = rseq_size; + +if (alloc_size <ORIG_RSEQ_ALLOC_SIZE ) + alloc_size =ORIG_RSEQ_ALLOC_SIZE ; +return alloc_size; +} + +/* +* Return the feature size supported by the kernel. +* +* Depending on the value returned by getauxval(AT_RSEQ_FEATURE_SIZE): +* +* 0: Return ORIG_RSEQ_FEATURE_SIZE (20) +* > 0: Return the value from getauxval(AT_RSEQ_FEATURE_SIZE). +* +* It should never return a value below ORIG_RSEQ_FEATURE_SIZE. +*/ +static +unsigned int get_rseq_kernel_feature_size (void ) +{ +unsigned long auxv_rseq_feature_size, auxv_rseq_align; + + auxv_rseq_align =getauxval (AT_RSEQ_ALIGN ); +assert (!auxv_rseq_align || auxv_rseq_align <=RSEQ_THREAD_AREA_ALLOC_SIZE ); + + auxv_rseq_feature_size =getauxval (AT_RSEQ_FEATURE_SIZE ); +assert (!auxv_rseq_feature_size || auxv_rseq_feature_size <=RSEQ_THREAD_AREA_ALLOC_SIZE ); +if (auxv_rseq_feature_size) +return auxv_rseq_feature_size; +else +return ORIG_RSEQ_FEATURE_SIZE ; +} +int rseq_register_current_thread (void ) {int rc;
@@ -119,7 +150,7 @@ int rseq_register_current_thread(void)/* Treat libc's ownership as a successful registration. */ return 0 ; } - rc =sys_rseq (&__rseq_abi, rseq_size,0 ,RSEQ_SIG ); + rc =sys_rseq (&__rseq_abi,get_rseq_min_alloc_size (),0 ,RSEQ_SIG );if (rc) {if (RSEQ_READ_ONCE (rseq_reg_success)) {/* Incoherent success/failure within process. */
@@ -140,28 +171,12 @@ int rseq_unregister_current_thread(void)/* Treat libc's ownership as a successful unregistration. */ return 0 ; } - rc =sys_rseq (&__rseq_abi, rseq_size,RSEQ_ABI_FLAG_UNREGISTER ,RSEQ_SIG ); + rc =sys_rseq (&__rseq_abi,get_rseq_min_alloc_size (),RSEQ_ABI_FLAG_UNREGISTER ,RSEQ_SIG );if (rc)return -1 ;return 0 ; } -static -unsigned int get_rseq_feature_size (void ) -{ -unsigned long auxv_rseq_feature_size, auxv_rseq_align; - - auxv_rseq_align =getauxval (AT_RSEQ_ALIGN ); -assert (!auxv_rseq_align || auxv_rseq_align <=RSEQ_THREAD_AREA_ALLOC_SIZE ); - - auxv_rseq_feature_size =getauxval (AT_RSEQ_FEATURE_SIZE ); -assert (!auxv_rseq_feature_size || auxv_rseq_feature_size <=RSEQ_THREAD_AREA_ALLOC_SIZE ); -if (auxv_rseq_feature_size) -return auxv_rseq_feature_size; -else -return ORIG_RSEQ_FEATURE_SIZE ; -} -static __attribute__((constructor))void rseq_init (void ) {
@@ -178,28 +193,54 @@ void rseq_init(void) }if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p && *libc_rseq_size_p !=0 ) { +unsigned int libc_rseq_size; +/* rseq registration owned by glibc */ rseq_offset = *libc_rseq_offset_p; - rseq_size = *libc_rseq_size_p; + libc_rseq_size = *libc_rseq_size_p; rseq_flags = *libc_rseq_flags_p; - rseq_feature_size =get_rseq_feature_size (); -if (rseq_feature_size > rseq_size) - rseq_feature_size = rseq_size; + +/* +* Previous versions of glibc expose the value +* 32 even though the kernel only supported 20 +* bytes initially. Therefore treat 32 as a +* special-case. glibc 2.40 exposes a 20 bytes +* __rseq_size without using getauxval(3) to +* query the supported size, while still allocating a 32 +* bytes area. Also treat 20 as a special-case. +* +* Special-cases are handled by using the following +* value as active feature set size: +* +* rseq_size = min(32, get_rseq_kernel_feature_size()) +*/ +switch (libc_rseq_size) { +case ORIG_RSEQ_FEATURE_SIZE : + fallthrough; +case ORIG_RSEQ_ALLOC_SIZE : + { +unsigned int rseq_kernel_feature_size =get_rseq_kernel_feature_size (); + +if (rseq_kernel_feature_size <ORIG_RSEQ_ALLOC_SIZE ) + rseq_size = rseq_kernel_feature_size; +else + rseq_size =ORIG_RSEQ_ALLOC_SIZE ; +break ; + } +default : +/* Otherwise just use the __rseq_size from libc as rseq_size. */ + rseq_size = libc_rseq_size; +break ; + }return ; } rseq_ownership =1 ;if (!rseq_available ()) { rseq_size =0 ; - rseq_feature_size =0 ;return ; } rseq_offset = (void *)&__rseq_abi -rseq_thread_pointer (); rseq_flags =0 ; - rseq_feature_size =get_rseq_feature_size (); -if (rseq_feature_size ==ORIG_RSEQ_FEATURE_SIZE ) - rseq_size =ORIG_RSEQ_ALLOC_SIZE ; -else - rseq_size =RSEQ_THREAD_AREA_ALLOC_SIZE ; } static __attribute__((destructor))
@@ -209,7 +250,6 @@ void rseq_exit(void)return ; rseq_offset =0 ; rseq_size =-1U ; - rseq_feature_size =-1U ; rseq_ownership =0 ; }
tools/testing/selftests/rseq/rseq.h +2 -8
@@ -68,12 +68,6 @@ extern unsigned int rseq_size;/* Flags used during rseq registration. */ extern unsigned int rseq_flags; -/* -* rseq feature size supported by the kernel. 0 if the registration was -* unsuccessful. -*/ -extern unsigned int rseq_feature_size; -enum rseq_mo {RSEQ_MO_RELAXED =0 ,RSEQ_MO_CONSUME =1 ,/* Unused */
@@ -193,7 +187,7 @@ static inline uint32_t rseq_current_cpu(static inline bool rseq_node_id_available (void ) { - return (int) rseq_feature_size >= rseq_offsetofend(struct rseq_abi, node_id); + return (int) rseq_size >= rseq_offsetofend(struct rseq_abi, node_id); }/*
@@ -207,7 +201,7 @@ static inline uint32_t rseq_current_nodestatic inline bool rseq_mm_cid_available (void ) { - return (int) rseq_feature_size >= rseq_offsetofend(struct rseq_abi, mm_cid); + return (int) rseq_size >= rseq_offsetofend(struct rseq_abi, mm_cid); }static inline uint32_t rseq_current_mm_cid (void )
Greg Kroah-Hartman
maintainerPATCH 207/213 btrfs: split remaining space to discard in chunks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Stefani <[email protected]>
commit a99fcb0158978ed332009449b484e5f3ca2d7df4 upstream.
Per Qu Wenruo in case we have a very large disk, e.g. 8TiB device, mostly empty although we will do the split according to our super block locations, the last super block ends at 256G, we can submit a huge discard for the range [256G, 8T), causing a large delay.
Split the space left to discard based on BTRFS_MAX_DISCARD_CHUNK_SIZE in preparation of introduction of cancellation points to trim. The value of the chunk size is arbitrary, it can be higher or derived from actual device capabilities but we can't easily read that using bio_discard_limit().
--- fs/btrfs/extent-tree.c | 19 +++++++++++++++---- fs/btrfs/volumes.h | 6 ++++++ 2 files changed, 21 insertions(+), 4 deletions(-)
fs/btrfs/extent-tree.c +15 -4
@@ -1303,13 +1303,24 @@ static int btrfs_issue_discard(struct bl bytes_left = end - start; } -if (bytes_left) { +while (bytes_left) { +u64 bytes_to_discard =min (BTRFS_MAX_DISCARD_CHUNK_SIZE , bytes_left); + ret =blkdev_issue_discard (bdev, start >>SECTOR_SHIFT , - bytes_left >>SECTOR_SHIFT , + bytes_to_discard >>SECTOR_SHIFT ,GFP_NOFS ); -if (!ret) - *discarded_bytes += bytes_left; + +if (ret) { +if (ret != -EOPNOTSUPP ) +break ; +continue ; + } + + start += bytes_to_discard; + bytes_left -= bytes_to_discard; + *discarded_bytes += bytes_to_discard; } +return ret; }
fs/btrfs/volumes.h +6 -0
@@ -15,6 +15,12 @@#define BTRFS_MAX_DATA_CHUNK_SIZE (10ULL * SZ_1G) +/* +* Arbitratry maximum size of one discard request to limit potentially long time +* spent in blkdev_issue_discard(). +*/ +#define BTRFS_MAX_DISCARD_CHUNK_SIZE (SZ_1G) +extern struct mutex uuid_mutex;#define BTRFS_STRIPE_LEN SZ_64K
Greg Kroah-Hartman
maintainerPATCH 208/213 kthread: unpark only parked kthread
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit 214e01ad4ed7158cab66498810094fac5d09b218 upstream.
Calling into kthread unparking unconditionally is mostly harmless when the kthread is already unparked. The wake up is then simply ignored because the target is not in TASK_PARKED state.
However if the kthread is per CPU, the wake up is preceded by a call to kthread_bind() which expects the task to be inactive and in TASK_PARKED state, which obviously isn't the case if it is unparked.
As a result, calling kthread_stop() on an unparked per-cpu kthread triggers such a warning:
WARNING: CPU: 0 PID: 11 at kernel/kthread.c:525 __kthread_bind_mask kernel/kthread.c:525 <TASK> kthread_stop+0x17a/0x630 kernel/kthread.c:707 destroy_workqueue+0x136/0xc40 kernel/workqueue.c:5810 wg_destruct+0x1e2/0x2e0 drivers/net/wireguard/device.c:257 netdev_run_todo+0xe1a/0x1000 net/core/dev.c:10693 default_device_exit_batch+0xa14/0xa90 net/core/dev.c:11769 ops_exit_list net/core/net_namespace.c:178 [inline] cleanup_net+0x89d/0xcc0 net/core/net_namespace.c:640 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK>
Fix this with skipping unecessary unparking while stopping a kthread.
--- kernel/kthread.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/kthread.c +2 -0
@@ -622,6 +622,8 @@ void kthread_unpark(struct task_struct * {struct kthread *kthread =to_kthread (k); +if (!test_bit (KTHREAD_SHOULD_PARK , &kthread->flags)) +return ;/* * Newly created kthread was parked when the CPU was offline. * The binding was lost and we need to set it again.
Greg Kroah-Hartman
maintainerPATCH 209/213 fs/proc/kcore.c: allow translation of physical memory addresses
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Gordeev <[email protected]>
commit 3d5854d75e3187147613130561b58f0b06166172 upstream.
When /proc/kcore is read an attempt to read the first two pages results in HW-specific page swap on s390 and another (so called prefix) pages are accessed instead. That leads to a wrong read.
Allow architecture-specific translation of memory addresses using kc_xlate_dev_mem_ptr() and kc_unxlate_dev_mem_ptr() callbacks similarily to /dev/mem xlate_dev_mem_ptr() and unxlate_dev_mem_ptr() callbacks. That way an architecture can deal with specific physical memory ranges.
Re-use the existing /dev/mem callback implementation on s390, which handles the described prefix pages swapping correctly.
For other architectures the default callback is basically NOP. It is expected the condition (vaddr == __va(__pa(vaddr))) always holds true for KCORE_RAM memory type.
--- arch/s390/include/asm/io.h | 2 ++ fs/proc/kcore.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-)
arch/s390/include/asm/io.h +2 -0
@@ -16,8 +16,10 @@#include <asm/pci_io.h> #define xlate_dev_mem_ptr xlate_dev_mem_ptr +#define kc_xlate_dev_mem_ptr xlate_dev_mem_ptrvoid *xlate_dev_mem_ptr (phys_addr_t phys);#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr +#define kc_unxlate_dev_mem_ptr unxlate_dev_mem_ptrvoid unxlate_dev_mem_ptr (phys_addr_t phys,void *addr);#define IO_SPACE_LIMIT 0
fs/proc/kcore.c +34 -2
@@ -50,6 +50,20 @@ static struct proc_dir_entry *proc_root_#define kc_offset_to_vaddr (o) ((o) + PAGE_OFFSET)#endif +#ifndef kc_xlate_dev_mem_ptr +#define kc_xlate_dev_mem_ptr kc_xlate_dev_mem_ptr +static inline void *kc_xlate_dev_mem_ptr (phys_addr_t phys) +{ +return __va (phys); +} +#endif +#ifndef kc_unxlate_dev_mem_ptr +#define kc_unxlate_dev_mem_ptr kc_unxlate_dev_mem_ptr +static inline void kc_unxlate_dev_mem_ptr (phys_addr_t phys,void *virt) +{ +} +#endif +static LIST_HEAD (kclist_head);static DECLARE_RWSEM (kclist_lock);static int kcore_need_update =1 ;
@@ -471,6 +485,8 @@ static ssize_t read_kcore_iter(struct kiwhile (buflen) {struct page *page;unsigned long pfn; +phys_addr_t phys; +void *__start;/* * If this is the first iteration or the address is not within
@@ -537,7 +553,8 @@ static ssize_t read_kcore_iter(struct ki }break ;case KCORE_RAM : - pfn =__pa (start) >>PAGE_SHIFT ; + phys =__pa (start); + pfn = phys >>PAGE_SHIFT ; page =pfn_to_online_page (pfn);/*
@@ -556,13 +573,28 @@ static ssize_t read_kcore_iter(struct ki fallthrough;case KCORE_VMEMMAP :case KCORE_TEXT : +if (m->type ==KCORE_RAM ) { + __start =kc_xlate_dev_mem_ptr (phys); +if (!__start) { + ret = -ENOMEM ; +if (iov_iter_zero (tsz, iter) != tsz) + ret = -EFAULT ; + goto out; + } + }else { + __start = (void *)start; + } +/* * Sadly we must use a bounce buffer here to be able to * make use of copy_from_kernel_nofault(), as these * memory regions might not always be mapped on all * architectures. */ -if (copy_from_kernel_nofault (buf, (void *)start, tsz)) { + ret =copy_from_kernel_nofault (buf, __start, tsz); +if (m->type ==KCORE_RAM ) +kc_unxlate_dev_mem_ptr (phys, __start); +if (ret) {if (iov_iter_zero (tsz, iter) != tsz) { ret = -EFAULT ; goto out;
Greg Kroah-Hartman
maintainerPATCH 210/213 secretmem: disable memfd_secret() if arch cannot set direct map
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick Roy <[email protected]>
commit 532b53cebe58f34ce1c0f34d866f5c0e335c53c6 upstream.
Return -ENOSYS from memfd_secret() syscall if !can_set_direct_map(). This is the case for example on some arm64 configurations, where marking 4k PTEs in the direct map not present can only be done if the direct map is set up at 4k granularity in the first place (as ARM's break-before-make semantics do not easily allow breaking apart large/gigantic pages).
More precisely, on arm64 systems with !can_set_direct_map(), set_direct_map_invalid_noflush() is a no-op, however it returns success
(0) instead of an error. This means that memfd_secret will seemingly "work" (e.g. syscall succeeds, you can mmap the fd and fault in pages), but it does not actually achieve its goal of removing its memory from the direct map.
Note that with this patch, memfd_secret() will start erroring on systems where can_set_direct_map() returns false (arm64 with CONFIG_RODATA_FULL_DEFAULT_ENABLED=n, CONFIG_DEBUG_PAGEALLOC=n and CONFIG_KFENCE=n), but that still seems better than the current silent failure. Since CONFIG_RODATA_FULL_DEFAULT_ENABLED defaults to 'y', most arm64 systems actually have a working memfd_secret() and aren't be affected.
Quoted 1 line
From going through the iterations of the original
memfd_secretpatch
series, it seems that disabling the syscall in these scenarios was the intended behavior [1] (preferred over having set_direct_map_invalid_noflush return an error as that would result in SIGBUSes at page-fault time), however the check for it got dropped between v16 [2] and v17 [3], when secretmem moved away from CMA allocations.
[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/[email protected]/#t
[3]: https://lore.kernel.org/lkml/[email protected]/
--- mm/secretmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/secretmem.c +2 -2
@@ -238,7 +238,7 @@ SYSCALL_DEFINE1(memfd_secret, unsigned i/* make sure local flags do not confict with global fcntl.h */ BUILD_BUG_ON (SECRETMEM_FLAGS_MASK &O_CLOEXEC ); -if (!secretmem_enable) +if (!secretmem_enable || !can_set_direct_map ())return -ENOSYS ;if (flags & ~(SECRETMEM_FLAGS_MASK |O_CLOEXEC ))
@@ -280,7 +280,7 @@ static struct file_system_type secretmemstatic int __init secretmem_init (void ) { -if (!secretmem_enable) +if (!secretmem_enable || !can_set_direct_map ())return 0 ; secretmem_mnt =kern_mount (&secretmem_fs);
Greg Kroah-Hartman
maintainerPATCH 211/213 net: ethernet: cortina: Restore TSO support
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit 2942dfab630444d46aaa37fb7d629b620abbf6ba upstream.
An earlier commit deleted the TSO support in the Cortina Gemini driver because the driver was confusing gso_size and MTU, probably because what the Linux kernel calls "gso_size" was called "MTU" in the datasheet.
Restore the functionality properly reading the gso_size from the skbuff.
Tested with iperf3, running a server on a different machine and client on the device with the cortina gemini ethernet:
Connecting to host 192.168.1.2, port 5201 60008000.ethernet-port eth0: segment offloading mss = 05ea len=1c8a 60008000.ethernet-port eth0: segment offloading mss = 05ea len=1c8a 60008000.ethernet-port eth0: segment offloading mss = 05ea len=27da 60008000.ethernet-port eth0: segment offloading mss = 05ea len=0b92 60008000.ethernet-port eth0: segment offloading mss = 05ea len=2bda (...)
(The hardware MSS 0x05ea here includes the ethernet headers.)
If I disable all segment offloading on the receiving host and dump packets using tcpdump -xx like this:
ethtool -K enp2s0 gro off gso off tso off
tcpdump -xx -i enp2s0 host 192.168.1.136
I get segmented packages such as this when running iperf3:
23:16:54.024139 IP OpenWrt.lan.59168 > Fecusia.targus-getdata1:
Flags [.], seq 1486:2934, ack 1, win 4198,
options [nop,nop,TS val 3886192908 ecr 3601341877], length 1448
0x0000: fc34 9701 a0c6 14d6 4da8 3c4f 0800 4500 0x0010: 05dc 16a0 4000 4006 9aa1 c0a8 0188 c0a8 0x0020: 0102 e720 1451 ff25 9822 4c52 29cf 8010 0x0030: 1066 ac8c 0000 0101 080a e7a2 990c d6a8 (...) 0x05c0: 5e49 e109 fe8c 4617 5e18 7a82 7eae d647 0x05d0: e8ee ae64 dc88 c897 3f8a 07a4 3a33 6b1b 0x05e0: 3501 a30f 2758 cc44 4b4a
Several such packets often follow after each other verifying the segmentation into 0x05a8 (1448) byte packages also on the reveiving end. As can be seen, the ethernet frames are 0x05ea (1514) in size.
Performance with iperf3 before this patch: ~15.5 Mbit/s Performance with iperf3 after this patch: ~175 Mbit/s
This was running a 60 second test (twice) the best measurement was 179 Mbit/s.
For comparison if I run iperf3 with UDP I get around 1.05 Mbit/s both before and after this patch.
While this is a gigabit ethernet interface, the CPU is a cheap D-Link DIR-685 router (based on the ARMv5 Faraday FA526 at ~50 MHz), and the software is not supposed to drive traffic, as the device has a DSA chip, so this kind of numbers can be expected.
--- drivers/net/ethernet/cortina/gemini.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/net/ethernet/cortina/gemini.c +19 -4
@@ -79,7 +79,8 @@ MODULE_PARM_DESC(debug, "Debug level (0=#define GMAC0_IRQ4_8 (GMAC0_MIB_INT_BIT | GMAC0_RX_OVERRUN_INT_BIT)#define GMAC_OFFLOAD_FEATURES (NETIF_F_SG | NETIF_F_IP_CSUM | \ - NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM) + NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | \ + NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)/** * struct gmac_queue_page - page buffer per-page info
@@ -1148,13 +1149,25 @@ static int gmac_map_tx_bufs(struct net_dskb_frag_t *skb_frag;dma_addr_t mapping;void *buffer; +u16 mss;int ret; -/* TODO: implement proper TSO using MTU in word3 */ word1 = skb->len; word3 =SOF_BIT ; -if (skb->len >=ETH_FRAME_LEN ) { + mss =skb_shinfo (skb)->gso_size; +if (mss) { +/* This means we are dealing with TCP and skb->len is the +* sum total of all the segments. The TSO will deal with +* chopping this up for us. +*/ +/* The accelerator needs the full frame size here */ + mss +=skb_tcp_all_headers (skb); +netdev_dbg (netdev,"segment offloading mss = %04x len=%04x\n" , + mss, skb->len); + word1 |=TSS_MTU_ENABLE_BIT ; + word3 |= mss; + }else if (skb->len >=ETH_FRAME_LEN ) {/* Hardware offloaded checksumming isn't working on frames * bigger than 1514 bytes. A hypothesis about this is that the * checksum buffer is only 1518 bytes, so when the frames get
@@ -1169,7 +1182,9 @@ static int gmac_map_tx_bufs(struct net_dreturn ret; } word1 |=TSS_BYPASS_BIT ; - }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { + } + +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {int tcp =0 ;/* We do not switch off the checksumming on non TCP/UDP
Greg Kroah-Hartman
maintainerPATCH 212/213 e1000e: fix force smbus during suspend flow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Lifshits <[email protected]>
commit 76a0a3f9cc2fbd0e56671706bb74a9a988397898 upstream.
Commit 861e8086029e ("e1000e: move force SMBUS from enable ulp function to avoid PHY loss issue") resolved a PHY access loss during suspend on Meteor Lake consumer platforms, but it affected corporate systems incorrectly.
A better fix, working for both consumer and corporate systems, was proposed in commit bfd546a552e1 ("e1000e: move force SMBUS near the end of enable_ulp function"). However, it introduced a regression on older devices, such as [8086:15B8], [8086:15F9], [8086:15BE].
This patch aims to fix the secondary regression, by limiting the scope of the changes to Meteor Lake platforms only.
--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 73 ++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/e1000e/ich8lan.c +53 -20
@@ -1109,6 +1109,46 @@ static s32 e1000_platform_pm_pch_lpt(str }/** +* e1000e_force_smbus - Force interfaces to transition to SMBUS mode. +* @hw: pointer to the HW structure +* +* Force the MAC and the PHY to SMBUS mode. Assumes semaphore already +* acquired. +* +* Return: 0 on success, negative errno on failure. +**/ +static s32 e1000e_force_smbus (struct e1000_hw *hw) +{ +u16 smb_ctrl =0 ; +u32 ctrl_ext; +s32 ret_val; + +/* Switching PHY interface always returns MDI error +* so disable retry mechanism to avoid wasting time +*/ +e1000e_disable_phy_retry (hw); + +/* Force SMBus mode in the PHY */ + ret_val =e1000_read_phy_reg_hv_locked (hw,CV_SMB_CTRL , &smb_ctrl); +if (ret_val) { +e1000e_enable_phy_retry (hw); +return ret_val; + } + + smb_ctrl |=CV_SMB_CTRL_FORCE_SMBUS ; +e1000_write_phy_reg_hv_locked (hw,CV_SMB_CTRL , smb_ctrl); + +e1000e_enable_phy_retry (hw); + +/* Force SMBus mode in the MAC */ + ctrl_ext =er32 (CTRL_EXT ); + ctrl_ext |=E1000_CTRL_EXT_FORCE_SMBUS ; +ew32 (CTRL_EXT , ctrl_ext); + +return 0 ; +} + +/** * e1000_enable_ulp_lpt_lp - configure Ultra Low Power mode for LynxPoint-LP * @hw: pointer to the HW structure * @to_sx: boolean indicating a system power state transition to Sx
@@ -1165,6 +1205,14 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000if (ret_val) goto out; +if (hw->mac.type != e1000_pch_mtp) { + ret_val =e1000e_force_smbus (hw); +if (ret_val) { +e_dbg ("Failed to force SMBUS: %d\n" , ret_val); + goto release; + } + } +/* Si workaround for ULP entry flow on i127/rev6 h/w. Enable * LPLU and disable Gig speed when entering ULP */
@@ -1225,27 +1273,12 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000 } release: -/* Switching PHY interface always returns MDI error -* so disable retry mechanism to avoid wasting time -*/ -e1000e_disable_phy_retry (hw); - -/* Force SMBus mode in PHY */ - ret_val =e1000_read_phy_reg_hv_locked (hw,CV_SMB_CTRL , &phy_reg); -if (ret_val) { -e1000e_enable_phy_retry (hw); - hw->phy.ops.release (hw); - goto out; +if (hw->mac.type == e1000_pch_mtp) { + ret_val =e1000e_force_smbus (hw); +if (ret_val) +e_dbg ("Failed to force SMBUS over MTL system: %d\n" , + ret_val); } - phy_reg |=CV_SMB_CTRL_FORCE_SMBUS ; -e1000_write_phy_reg_hv_locked (hw,CV_SMB_CTRL , phy_reg); - -e1000e_enable_phy_retry (hw); - -/* Force SMBus mode in MAC */ - mac_reg =er32 (CTRL_EXT ); - mac_reg |=E1000_CTRL_EXT_FORCE_SMBUS ; -ew32 (CTRL_EXT , mac_reg); hw->phy.ops.release (hw); out:
Greg Kroah-Hartman
maintainerPATCH 213/213 scsi: Revert "scsi: sd: Do not repeat the starting disk message"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit da3e19ef0b3de0aa4b25595bdc214c02a04f19b8 upstream.
This reverts commit 7a6bbc2829d4ab592c7e440a6f6f5deb3cd95db4.
The offending commit tried to suppress a double "Starting disk" message for some drivers, but instead started spamming the log with bogus messages every five seconds:
[ 311.798956] sd 0:0:0:0: [sda] Starting disk [ 316.919103] sd 0:0:0:0: [sda] Starting disk [ 322.040775] sd 0:0:0:0: [sda] Starting disk [ 327.161140] sd 0:0:0:0: [sda] Starting disk [ 332.281352] sd 0:0:0:0: [sda] Starting disk [ 337.401878] sd 0:0:0:0: [sda] Starting disk [ 342.521527] sd 0:0:0:0: [sda] Starting disk [ 345.850401] sd 0:0:0:0: [sda] Starting disk [ 350.967132] sd 0:0:0:0: [sda] Starting disk [ 356.090454] sd 0:0:0:0: [sda] Starting disk ...
on machines that do not actually stop the disk on runtime suspend (e.g. the Qualcomm sc8280xp CRD with UFS).
Let's just revert for now to address the regression.
--- drivers/scsi/sd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/sd.c +3 -2
@@ -3955,6 +3955,8 @@ static int sd_resume(struct device *dev) {struct scsi_disk *sdkp =dev_get_drvdata (dev); +sd_printk (KERN_NOTICE , sdkp,"Starting disk\n" ); +if (opal_unlock_from_suspend (sdkp->opal_dev)) {sd_printk (KERN_NOTICE , sdkp,"OPAL unlock failed\n" );return -EIO ;
@@ -3971,13 +3973,12 @@ static int sd_resume_common(struct devicif (!sdkp)/* E.g.: runtime resume at the start of sd_probe() */ return 0 ; -sd_printk (KERN_NOTICE , sdkp,"Starting disk\n" ); -if (!sd_do_start_stop (sdkp->device, runtime)) { sdkp->suspended = false;return 0 ; } +sd_printk (KERN_NOTICE , sdkp,"Starting disk\n" ); ret =sd_start_stop_device (sdkp,1 );if (!ret) {sd_resume (dev);
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.57 release. There are 213 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 16 Oct 2024 14:09:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.57-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Am 14.10.2024 um 16:18 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.6.57 release. There are 213 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.57 release. There are 213 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 16 Oct 2024 14:09:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.57-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.6:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 116 pass, 0 failLinux version: 6.6.57-rc1-g8a7bf87a1018
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.57 release. There are 213 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 16 Oct 2024 14:09:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.57-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
The S390 build broke on the stable-rc linux-6.6.y branch due to following build warnings / errors.
First seen on v6.6.56-214-g8a7bf87a1018
GOOD: v6.6.56
BAD: v6.6.56-214-g8a7bf87a1018
Bisection points to,
d38c79a1f30ba78448cc58d5dee31c636e16112d
s390/traps: Handle early warnings gracefully
[ Upstream commit 3c4d0ae0671827f4b536cc2d26f8b9c54584ccc5 ]
List of regressions,
* s390, build
- clang-19-allnoconfig
- clang-19-defconfig
- clang-19-tinyconfig
- clang-nightly-allnoconfig
- clang-nightly-defconfig
- clang-nightly-tinyconfig
- gcc-13-allmodconfig
- gcc-13-allnoconfig
- gcc-13-defconfig
- gcc-13-tinyconfig
- gcc-8-allnoconfig
- gcc-8-defconfig-fe40093d
- gcc-8-tinyconfig
Build log:
-------arch/s390/kernel/early.c: In function '__do_early_pgm_check':arch/s390/kernel/early.c:177:30: error: implicit declaration of function 'get_lowcore'; did you mean 'S390_lowcore'? [-Werror=implicit-function-declaration]
177 | struct lowcore *lc = get_lowcore();
| ^~~~~~~~~~~
| S390_lowcorearch/s390/kernel/early.c:177:30: warning: initialization of 'struct lowcore *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
cc1: some warnings being treated as errors
make[5]: *** [scripts/Makefile.build:243: arch/s390/kernel/early.o] Error 1
Build log link:
---------
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2nQwi03QYzWjrOZMpsvCF31N0Oc/
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.6.y/build/v6.6.56-214-g8a7bf87a1018/testrun/25432877/suite/build/test/gcc-13-defconfig/log
metadata:
----
git describe: v6.6.56-214-g8a7bf87a1018
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git sha: 8a7bf87a1018a21d9dbbc5a794cb9a4fb3243aa0
kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2nQwi03QYzWjrOZMpsvCF31N0Oc/config
build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2nQwi03QYzWjrOZMpsvCF31N0Oc/
toolchain: clang-19 and gcc-13
config: defconfig
arch: S390
Steps to reproduce:
-------
# tuxmake --runtime podman --target-arch s390 --toolchain gcc-13 --kconfig defconfig
--
Linaro LKFT
https://lkft.linaro.org
Heiko Carstens
maintainerQuoted 24 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.57 release. There are 213 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 16 Oct 2024 14:09:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.57-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
The S390 build broke on the stable-rc linux-6.6.y branch due to following build warnings / errors.
Quoted 8 lines
First seen on v6.6.56-214-g8a7bf87a1018
GOOD: v6.6.56
BAD: v6.6.56-214-g8a7bf87a1018Bisection points to,
d38c79a1f30ba78448cc58d5dee31c636e16112d
s390/traps: Handle early warnings gracefully[ Upstream commit 3c4d0ae0671827f4b536cc2d26f8b9c54584ccc5 ]
Thanks for reporting; just drop this patch please.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.57 release. There are 213 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 16 Oct 2024 14:09:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.57-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah