5.15.113-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 1/203 drm/mipi-dsi: Set the fwnode for mipi_dsi_device
In reply to Greg Kroah-HartmanFrom: Saravana Kannan <[email protected]>
[ Upstream commit a26cc2934331b57b5a7164bff344f0a2ec245fc0 ]
After commit 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust"), fw_devlink prints an error when consumer devices don't have their fwnode set. This used to be ignored silently.
Set the fwnode mipi_dsi_device so fw_devlink can find them and properly track their dependencies.
This fixes errors like this:
[ 0.334054] nwl-dsi 30a00000.mipi-dsi: Failed to create device link with regulator-lcd-1v8 [ 0.346964] nwl-dsi 30a00000.mipi-dsi: Failed to create device link with backlight-dsi
--- drivers/gpu/drm/drm_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_mipi_dsi.c +1 -1
@@ -221,7 +221,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,return dsi; } - dsi->dev.of_node = info->node; +device_set_node (&dsi->dev,of_fwnode_handle (info->node)); dsi->channel = info->channel;strlcpy (dsi->name, info->type,sizeof (dsi->name));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 10/203 netfilter: nf_tables: always release netdev hooks from notifier
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit dc1c9fd4a8bbe1e06add9053010b652449bfe411 ]
This reverts "netfilter: nf_tables: skip netdev events generated on netns removal".
The problem is that when a veth device is released, the veth release callback will also queue the peer netns device for removal.
Its possible that the peer netns is also slated for removal. In this case, the device memory is already released before the pre_exit hook of the peer netns runs:
BUG: KASAN: slab-use-after-free in nf_hook_entry_head+0x1b8/0x1d0 Read of size 8 at addr ffff88812c0124f0 by task kworker/u8:1/45 Workqueue: netns cleanup_net Call Trace: nf_hook_entry_head+0x1b8/0x1d0 __nf_unregister_net_hook+0x76/0x510 nft_netdev_unregister_hooks+0xa0/0x220 __nft_release_hook+0x184/0x490 nf_tables_pre_exit_net+0x12f/0x1b0 ..
Order is:
1. First netns is released, veth_dellink() queues peer netns device for removal
2. peer netns is queued for removal
3. peer netns device is released, unreg event is triggered
4. unreg event is ignored because netns is going down
5. pre_exit hook calls nft_netdev_unregister_hooks but device memory might be free'd already.
--- net/netfilter/nft_chain_filter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/netfilter/nft_chain_filter.c +6 -3
@@ -342,6 +342,12 @@ static void nft_netdev_event(unsigned long event, struct net_device *dev,return ; } +/* UNREGISTER events are also happening on netns exit. +* +* Although nf_tables core releases all tables/chains, only this event +* handler provides guarantee that hook->ops.dev is still accessible, +* so we cannot skip exiting net namespaces. +*/ __nft_release_basechain (ctx); }
@@ -360,9 +366,6 @@ static int nf_tables_netdev_event(struct notifier_block *this, event != NETDEV_CHANGENAME)return NOTIFY_DONE ; -if (!check_net (ctx.net)) -return NOTIFY_DONE ; - nft_net =nft_pernet (ctx.net);mutex_lock (&nft_net->commit_mutex);list_for_each_entry (table, &nft_net->tables, list) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 11/203 netfilter: conntrack: fix possible bug_on with enable_hooks=1
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit e72eeab542dbf4f544e389e64fa13b82a1b6d003 ]
I received a bug report (no reproducer so far) where we trip over
712 rcu_read_lock(); 713 ct_hook = rcu_dereference(nf_ct_hook); 714 BUG_ON(ct_hook == NULL); // here
In nf_conntrack_destroy().
First turn this BUG_ON into a WARN. I think it was triggered via enable_hooks=1 flag.
When this flag is turned on, the conntrack hooks are registered before nf_ct_hook pointer gets assigned.
This opens a short window where packets enter the conntrack machinery, can have skb->_nfct set up and a subsequent kfree_skb might occur before nf_ct_hook is set.
Call nf_conntrack_init_end() to set nf_ct_hook before we register the pernet ops.
--- net/netfilter/core.c | 6 ++++-- net/netfilter/nf_conntrack_standalone.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
net/netfilter/core.c +4 -2
@@ -675,9 +675,11 @@ void nf_conntrack_destroy(struct nf_conntrack *nfct)rcu_read_lock (); ct_hook =rcu_dereference (nf_ct_hook); -BUG_ON (ct_hook ==NULL ); - ct_hook->destroy (nfct); +if (ct_hook) + ct_hook->destroy (nfct);rcu_read_unlock (); + +WARN_ON (!ct_hook); }EXPORT_SYMBOL (nf_conntrack_destroy);
net/netfilter/nf_conntrack_standalone.c +2 -1
@@ -1229,11 +1229,12 @@ static int __init nf_conntrack_standalone_init(void) nf_conntrack_htable_size_user = nf_conntrack_htable_size;#endif +nf_conntrack_init_end (); + ret =register_pernet_subsys (&nf_conntrack_net_ops);if (ret <0 ) goto out_pernet; -nf_conntrack_init_end ();return 0 ; out_pernet:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 12/203 netlink: annotate accesses to nlk->cb_running
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit a939d14919b799e6fff8a9c80296ca229ba2f8a4 ]
Both netlink_recvmsg() and netlink_native_seq_show() read nlk->cb_running locklessly. Use READ_ONCE() there.
Add corresponding WRITE_ONCE() to netlink_dump() and __netlink_dump_start()
syzbot reported:
BUG: KCSAN: data-race in __netlink_dump_start / netlink_recvmsg
write to 0xffff88813ea4db59 of 1 bytes by task 28219 on cpu 0:
__netlink_dump_start+0x3af/0x4d0 net/netlink/af_netlink.c:2399 netlink_dump_start include/linux/netlink.h:308 [inline] rtnetlink_rcv_msg+0x70f/0x8c0 net/core/rtnetlink.c:6130 netlink_rcv_skb+0x126/0x220 net/netlink/af_netlink.c:2577 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6192 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x56f/0x640 net/netlink/af_netlink.c:1365 netlink_sendmsg+0x665/0x770 net/netlink/af_netlink.c:1942 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] sock_write_iter+0x1aa/0x230 net/socket.c:1138 call_write_iter include/linux/fs.h:1851 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x463/0x760 fs/read_write.c:584 ksys_write+0xeb/0x1a0 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x42/0x50 fs/read_write.c:646 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88813ea4db59 of 1 bytes by task 28222 on cpu 1:
netlink_recvmsg+0x3b4/0x730 net/netlink/af_netlink.c:2022 sock_recvmsg_nosec+0x4c/0x80 net/socket.c:1017 ____sys_recvmsg+0x2db/0x310 net/socket.c:2718 ___sys_recvmsg net/socket.c:2762 [inline] do_recvmmsg+0x2e5/0x710 net/socket.c:2856 __sys_recvmmsg net/socket.c:2935 [inline] __do_sys_recvmmsg net/socket.c:2958 [inline] __se_sys_recvmmsg net/socket.c:2951 [inline] __x64_sys_recvmmsg+0xe2/0x160 net/socket.c:2951 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x00 -> 0x01
--- net/netlink/af_netlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/netlink/af_netlink.c +4 -4
@@ -2000,7 +2000,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,skb_free_datagram (sk, skb); -if (nlk->cb_running && +if (READ_ONCE (nlk->cb_running) &&atomic_read (&sk->sk_rmem_alloc) <= sk->sk_rcvbuf /2 ) { ret =netlink_dump (sk);if (ret) {
@@ -2312,7 +2312,7 @@ static int netlink_dump(struct sock *sk)if (cb->done) cb->done (cb); - nlk->cb_running = false; +WRITE_ONCE (nlk->cb_running, false); module = cb->module; skb = cb->skb;mutex_unlock (nlk->cb_mutex);
@@ -2375,7 +2375,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, goto error_put; } - nlk->cb_running = true; +WRITE_ONCE (nlk->cb_running, true); nlk->dump_done_errno =INT_MAX ;mutex_unlock (nlk->cb_mutex);
@@ -2661,7 +2661,7 @@ static int netlink_native_seq_show(struct seq_file *seq, void *v) nlk->groups ? (u32 )nlk->groups[0 ] :0 ,sk_rmem_alloc_get (s),sk_wmem_alloc_get (s), - nlk->cb_running, +READ_ONCE (nlk->cb_running),refcount_read (&s->sk_refcnt),atomic_read (&s->sk_drops),sock_i_ino (s)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 13/203 net: annotate sk->sk_err write from do_recvmmsg()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit e05a5f510f26607616fecdd4ac136310c8bea56b ]
do_recvmmsg() can write to sk->sk_err from multiple threads.
As said before, many other points reading or writing sk_err need annotations.
--- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/socket.c +1 -1
@@ -2820,7 +2820,7 @@ static int do_recvmmsg(int fd, struct mmsghdr __user *mmsg,* error to return on the next call or if the * app asks about it using getsockopt(SO_ERROR). */ - sock->sk->sk_err = -err; +WRITE_ONCE (sock->sk->sk_err, -err); } out_put:fput_light (sock->file, fput_needed);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 14/203 net: deal with most data-races in sk_wait_event()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d0ac89f6f9879fae316c155de77b5173b3e2c9c9 ]
__condition is evaluated twice in sk_wait_event() macro.
First invocation is lockless, and reads can race with writes, as spotted by syzbot.
BUG: KCSAN: data-race in sk_stream_wait_connect / tcp_disconnect
write to 0xffff88812d83d6a0 of 4 bytes by task 9065 on cpu 1:
tcp_disconnect+0x2cd/0xdb0 inet_shutdown+0x19e/0x1f0 net/ipv4/af_inet.c:911 __sys_shutdown_sock net/socket.c:2343 [inline] __sys_shutdown net/socket.c:2355 [inline] __do_sys_shutdown net/socket.c:2363 [inline] __se_sys_shutdown+0xf8/0x140 net/socket.c:2361 __x64_sys_shutdown+0x31/0x40 net/socket.c:2361 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88812d83d6a0 of 4 bytes by task 9040 on cpu 0:
sk_stream_wait_connect+0x1de/0x3a0 net/core/stream.c:75 tcp_sendmsg_locked+0x2e4/0x2120 net/ipv4/tcp.c:1266 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1484 inet6_sendmsg+0x63/0x80 net/ipv6/af_inet6.c:651 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] __sys_sendto+0x246/0x300 net/socket.c:2142 __do_sys_sendto net/socket.c:2154 [inline] __se_sys_sendto net/socket.c:2150 [inline] __x64_sys_sendto+0x78/0x90 net/socket.c:2150 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x00000000 -> 0x00000068
--- net/core/stream.c | 12 ++++++------ net/ipv4/tcp_bpf.c | 2 +- net/llc/af_llc.c | 8 +++++--- net/smc/smc_close.c | 4 ++-- net/smc/smc_rx.c | 4 ++-- net/smc/smc_tx.c | 4 ++-- net/tipc/socket.c | 4 ++-- net/tls/tls_main.c | 3 ++- 8 files changed, 22 insertions(+), 19 deletions(-)
net/core/stream.c +6 -6
@@ -73,8 +73,8 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p)add_wait_queue (sk_sleep (sk), &wait); sk->sk_write_pending++; done =sk_wait_event (sk, timeo_p, - !sk->sk_err && - !((1 << sk->sk_state) & + !READ_ONCE (sk->sk_err) && + !((1 <<READ_ONCE (sk->sk_state)) & ~(TCPF_ESTABLISHED |TCPF_CLOSE_WAIT )), &wait);remove_wait_queue (sk_sleep (sk), &wait); sk->sk_write_pending--;
@@ -87,9 +87,9 @@ EXPORT_SYMBOL(sk_stream_wait_connect);* sk_stream_closing - Return 1 if we still have things to send in our buffers. * @sk: socket to verify */ -static inline int sk_stream_closing (struct sock *sk) +static int sk_stream_closing (const struct sock *sk) { -return (1 << sk->sk_state) & +return (1 <<READ_ONCE (sk->sk_state)) & (TCPF_FIN_WAIT1 |TCPF_CLOSING |TCPF_LAST_ACK ); }
@@ -142,8 +142,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); sk->sk_write_pending++; -sk_wait_event (sk, ¤t_timeo, sk->sk_err || - (sk->sk_shutdown &SEND_SHUTDOWN ) || +sk_wait_event (sk, ¤t_timeo,READ_ONCE (sk->sk_err) || + (READ_ONCE (sk->sk_shutdown) &SEND_SHUTDOWN ) || (sk_stream_memory_free (sk) && !vm_wait), &wait); sk->sk_write_pending--;
net/ipv4/tcp_bpf.c +1 -1
@@ -168,7 +168,7 @@ static int tcp_msg_wait_data(struct sock *sk, struct sk_psock *psock,sk_set_bit (SOCKWQ_ASYNC_WAITDATA , sk); ret =sk_wait_event (sk, &timeo, !list_empty (&psock->ingress_msg) || - !skb_queue_empty (&sk->sk_receive_queue), &wait); + !skb_queue_empty_lockless (&sk->sk_receive_queue), &wait);sk_clear_bit (SOCKWQ_ASYNC_WAITDATA , sk);remove_wait_queue (sk_sleep (sk), &wait);return ret;
net/llc/af_llc.c +5 -3
@@ -581,7 +581,8 @@ static int llc_ui_wait_for_disc(struct sock *sk, long timeout)add_wait_queue (sk_sleep (sk), &wait);while (1 ) { -if (sk_wait_event (sk, &timeout, sk->sk_state ==TCP_CLOSE , &wait)) +if (sk_wait_event (sk, &timeout, +READ_ONCE (sk->sk_state) ==TCP_CLOSE , &wait))break ; rc = -ERESTARTSYS ;if (signal_pending (current))
@@ -601,7 +602,8 @@ static bool llc_ui_wait_for_conn(struct sock *sk, long timeout)add_wait_queue (sk_sleep (sk), &wait);while (1 ) { -if (sk_wait_event (sk, &timeout, sk->sk_state !=TCP_SYN_SENT , &wait)) +if (sk_wait_event (sk, &timeout, +READ_ONCE (sk->sk_state) !=TCP_SYN_SENT , &wait))break ;if (signal_pending (current) || !timeout)break ;
@@ -620,7 +622,7 @@ static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout)while (1 ) { rc =0 ;if (sk_wait_event (sk, &timeout, - (sk->sk_shutdown &RCV_SHUTDOWN ) || + (READ_ONCE (sk->sk_shutdown) &RCV_SHUTDOWN ) || (!llc_data_accept_state (llc->state) && !llc->remote_busy_flag && !llc->p_flag), &wait))
net/smc/smc_close.c +2 -2
@@ -64,8 +64,8 @@ static void smc_close_stream_wait(struct smc_sock *smc, long timeout) rc =sk_wait_event (sk, &timeout, !smc_tx_prepared_sends (&smc->conn) || - sk->sk_err ==ECONNABORTED || - sk->sk_err ==ECONNRESET || +READ_ONCE (sk->sk_err) ==ECONNABORTED || +READ_ONCE (sk->sk_err) ==ECONNRESET || smc->conn.killed, &wait);if (rc)
net/smc/smc_rx.c +2 -2
@@ -204,9 +204,9 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo,sk_set_bit (SOCKWQ_ASYNC_WAITDATA , sk);add_wait_queue (sk_sleep (sk), &wait); rc =sk_wait_event (sk, timeo, - sk->sk_err || +READ_ONCE (sk->sk_err) || cflags->peer_conn_abort || - sk->sk_shutdown &RCV_SHUTDOWN || +READ_ONCE (sk->sk_shutdown) &RCV_SHUTDOWN || conn->killed ||fcrit (conn), &wait);
net/smc/smc_tx.c +2 -2
@@ -113,8 +113,8 @@ static int smc_tx_wait(struct smc_sock *smc, int flags)break ;/* at least 1 byte of free & no urgent data */ set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); sk_wait_event(sk, &timeo, - sk->sk_err || - (sk->sk_shutdown & SEND_SHUTDOWN) || + READ_ONCE(sk->sk_err) || + (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN) || smc_cdc_rxed_any_close(conn) || (atomic_read(&conn->sndbuf_space) && !conn->urg_tx_pend),
net/tipc/socket.c +2 -2
@@ -313,9 +313,9 @@ static void tsk_rej_rx_queue(struct sock *sk, int error)tipc_sk_respond (sk, skb, error); } -static bool tipc_sk_connected (struct sock *sk) +static bool tipc_sk_connected (const struct sock *sk) { -return sk->sk_state ==TIPC_ESTABLISHED ; +return READ_ONCE (sk->sk_state) ==TIPC_ESTABLISHED ; }/* tipc_sk_type_connectionless - check if the socket is datagram socket
net/tls/tls_main.c +2 -1
@@ -92,7 +92,8 @@ int wait_on_pending_writer(struct sock *sk, long *timeo)break ; } -if (sk_wait_event (sk, timeo, !sk->sk_write_pending, &wait)) +if (sk_wait_event (sk, timeo, + !READ_ONCE (sk->sk_write_pending), &wait))break ; }remove_wait_queue (sk_sleep (sk), &wait);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 15/203 net: add vlan_get_protocol_and_depth() helper
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 4063384ef762cc5946fc7a3f89879e76c6ec51e2 ]
Before blamed commit, pskb_may_pull() was used instead of skb_header_pointer() in __vlan_get_protocol() and friends.
Few callers depended on skb->head being populated with MAC header, syzbot caught one of them (skb_mac_gso_segment())
Add vlan_get_protocol_and_depth() to make the intent clearer and use it where sensible.
This is a more generic fix than commit e9d3f80935b6 ("net/af_packet: make sure to pull mac header") which was dealing with a similar issue.
kernel BUG at include/linux/skbuff.h:2655 !
invalid opcode: 0000 [#1] SMP KASAN
CPU: 0 PID: 1441 Comm: syz-executor199 Not tainted 6.1.24-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 RIP: 0010:__skb_pull include/linux/skbuff.h:2655 [inline] RIP: 0010:skb_mac_gso_segment+0x68f/0x6a0 net/core/gro.c:136 Code: fd 48 8b 5c 24 10 44 89 6b 70 48 c7 c7 c0 ae 0d 86 44 89 e6 e8 a1 91 d0 00 48 c7 c7 00 af 0d 86 48 89 de 31 d2 e8 d1 4a e9 ff <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 41 RSP: 0018:ffffc90001bd7520 EFLAGS: 00010286 RAX: ffffffff8469736a RBX: ffff88810f31dac0 RCX: ffff888115a18b00 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90001bd75e8 R08: ffffffff84697183 R09: fffff5200037adf9 R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000012 R13: 000000000000fee5 R14: 0000000000005865 R15: 000000000000fed7 FS: 000055555633f300(0000) GS:ffff8881f6a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000000 CR3: 0000000116fea000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> [<ffffffff847018dd>] __skb_gso_segment+0x32d/0x4c0 net/core/dev.c:3419 [<ffffffff8470398a>] skb_gso_segment include/linux/netdevice.h:4819 [inline] [<ffffffff8470398a>] validate_xmit_skb+0x3aa/0xee0 net/core/dev.c:3725 [<ffffffff84707042>] __dev_queue_xmit+0x1332/0x3300 net/core/dev.c:4313 [<ffffffff851a9ec7>] dev_queue_xmit+0x17/0x20 include/linux/netdevice.h:3029 [<ffffffff851b4a82>] packet_snd net/packet/af_packet.c:3111 [inline] [<ffffffff851b4a82>] packet_sendmsg+0x49d2/0x6470 net/packet/af_packet.c:3142 [<ffffffff84669a12>] sock_sendmsg_nosec net/socket.c:716 [inline] [<ffffffff84669a12>] sock_sendmsg net/socket.c:736 [inline] [<ffffffff84669a12>] __sys_sendto+0x472/0x5f0 net/socket.c:2139 [<ffffffff84669c75>] __do_sys_sendto net/socket.c:2151 [inline] [<ffffffff84669c75>] __se_sys_sendto net/socket.c:2147 [inline] [<ffffffff84669c75>] __x64_sys_sendto+0xe5/0x100 net/socket.c:2147 [<ffffffff8551d40f>] do_syscall_x64 arch/x86/entry/common.c:50 [inline] [<ffffffff8551d40f>] do_syscall_64+0x2f/0x50 arch/x86/entry/common.c:80 [<ffffffff85600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
--- drivers/net/tap.c | 4 ++-- include/linux/if_vlan.h | 17 +++++++++++++++++ net/bridge/br_forward.c | 2 +- net/core/dev.c | 2 +- net/packet/af_packet.c | 6 ++---- 5 files changed, 23 insertions(+), 8 deletions(-)
drivers/net/tap.c +2 -2
@@ -714,7 +714,7 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,/* Move network header to the right position for VLAN tagged packets */ if (eth_type_vlan (skb->protocol) && -__vlan_get_protocol (skb, skb->protocol, &depth) !=0 ) +vlan_get_protocol_and_depth (skb, skb->protocol, &depth) !=0 )skb_set_network_header (skb, depth);rcu_read_lock ();
@@ -1163,7 +1163,7 @@ static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp)/* Move network header to the right position for VLAN tagged packets */ if (eth_type_vlan (skb->protocol) && -__vlan_get_protocol (skb, skb->protocol, &depth) !=0 ) +vlan_get_protocol_and_depth (skb, skb->protocol, &depth) !=0 )skb_set_network_header (skb, depth);rcu_read_lock ();
include/linux/if_vlan.h +17 -0
@@ -626,6 +626,23 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)return __vlan_get_protocol (skb, skb->protocol,NULL ); } +/* This version of __vlan_get_protocol() also pulls mac header in skb->head */ +static inline __be16 vlan_get_protocol_and_depth (struct sk_buff *skb, +__be16 type,int *depth) +{ +int maclen; + + type =__vlan_get_protocol (skb, type, &maclen); + +if (type) { +if (!pskb_may_pull (skb, maclen)) + type =0 ; +else if (depth) + *depth = maclen; + } +return type; +} +/* A getter for the SKB protocol field which will handle VLAN tags consistently * whether VLAN acceleration is enabled or not. */
net/bridge/br_forward.c +1 -1
@@ -42,7 +42,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb eth_type_vlan(skb->protocol)) {int depth; -if (!__vlan_get_protocol (skb, skb->protocol, &depth)) +if (!vlan_get_protocol_and_depth (skb, skb->protocol, &depth)) goto drop;skb_set_network_header (skb, depth);
net/core/dev.c +1 -1
@@ -3314,7 +3314,7 @@ __be16 skb_network_protocol(struct sk_buff *skb, int *depth) type = eth->h_proto; } -return __vlan_get_protocol (skb, type, depth); +return vlan_get_protocol_and_depth (skb, type, depth); }/**
net/packet/af_packet.c +2 -4
@@ -1900,10 +1900,8 @@ static void packet_parse_headers(struct sk_buff *skb, struct socket *sock)/* Move network header to the right position for VLAN tagged packets */ if (likely (skb->dev->type ==ARPHRD_ETHER ) &ð_type_vlan (skb->protocol) && -__vlan_get_protocol (skb, skb->protocol, &depth) !=0 ) { -if (pskb_may_pull (skb, depth)) -skb_set_network_header (skb, depth); - } +vlan_get_protocol_and_depth (skb, skb->protocol, &depth) !=0 ) +skb_set_network_header (skb, depth);skb_probe_transport_header (skb); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 16/203 tcp: add annotations around sk->sk_shutdown accesses
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit e14cadfd80d76f01bfaa1a8d745b1db19b57d6be ]
Now sk->sk_shutdown is no longer a bitfield, we can add standard READ_ONCE()/WRITE_ONCE() annotations to silence KCSAN reports like the following:
BUG: KCSAN: data-race in tcp_disconnect / tcp_poll
write to 0xffff88814588582c of 1 bytes by task 3404 on cpu 1:
tcp_disconnect+0x4d6/0xdb0 net/ipv4/tcp.c:3121 __inet_stream_connect+0x5dd/0x6e0 net/ipv4/af_inet.c:715 inet_stream_connect+0x48/0x70 net/ipv4/af_inet.c:727 __sys_connect_file net/socket.c:2001 [inline] __sys_connect+0x19b/0x1b0 net/socket.c:2018 __do_sys_connect net/socket.c:2028 [inline] __se_sys_connect net/socket.c:2025 [inline] __x64_sys_connect+0x41/0x50 net/socket.c:2025 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88814588582c of 1 bytes by task 3374 on cpu 0:
tcp_poll+0x2e6/0x7d0 net/ipv4/tcp.c:562 sock_poll+0x253/0x270 net/socket.c:1383 vfs_poll include/linux/poll.h:88 [inline] io_poll_check_events io_uring/poll.c:281 [inline] io_poll_task_func+0x15a/0x820 io_uring/poll.c:333 handle_tw_list io_uring/io_uring.c:1184 [inline] tctx_task_work+0x1fe/0x4d0 io_uring/io_uring.c:1246 task_work_run+0x123/0x160 kernel/task_work.c:179 get_signal+0xe64/0xff0 kernel/signal.c:2635 arch_do_signal_or_restart+0x89/0x2a0 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6f/0xe0 kernel/entry/common.c:168 exit_to_user_mode_prepare+0x6c/0xb0 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x26/0x140 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x03 -> 0x00
--- net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 14 ++++++++------ net/ipv4/tcp_input.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-)
net/ipv4/af_inet.c +1 -1
@@ -890,7 +890,7 @@ int inet_shutdown(struct socket *sock, int how)EPOLLHUP, even on eg. unconnected UDP sockets -- RR */ fallthrough;default : - sk->sk_shutdown |= how; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown | how);if (sk->sk_prot->shutdown) sk->sk_prot->shutdown (sk, how);break ;
net/ipv4/tcp.c +8 -6
@@ -502,6 +502,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)__poll_t mask;struct sock *sk = sock->sk;const struct tcp_sock *tp =tcp_sk (sk); +u8 shutdown;int state;sock_poll_wait (file, sock, wait);
@@ -544,9 +545,10 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)* NOTE. Check for TCP_CLOSE is added. The goal is to prevent * blocking on fresh not-connected or disconnected socket. --ANK */ -if (sk->sk_shutdown ==SHUTDOWN_MASK || state ==TCP_CLOSE ) + shutdown =READ_ONCE (sk->sk_shutdown); +if (shutdown ==SHUTDOWN_MASK || state ==TCP_CLOSE ) mask |=EPOLLHUP ; -if (sk->sk_shutdown &RCV_SHUTDOWN ) +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLIN |EPOLLRDNORM |EPOLLRDHUP ;/* Connected or passive Fast Open socket? */
@@ -562,7 +564,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)if (tcp_stream_is_readable (sk, target)) mask |=EPOLLIN |EPOLLRDNORM ; -if (!(sk->sk_shutdown &SEND_SHUTDOWN )) { +if (!(shutdown &SEND_SHUTDOWN )) {if (__sk_stream_is_writeable (sk,1 )) { mask |=EPOLLOUT |EPOLLWRNORM ; }else {/* send SIGIO later */
@@ -2740,7 +2742,7 @@ void __tcp_close(struct sock *sk, long timeout)int data_was_unread =0 ;int state; - sk->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (sk->sk_shutdown,SHUTDOWN_MASK );if (sk->sk_state ==TCP_LISTEN ) {tcp_set_state (sk,TCP_CLOSE );
@@ -3006,7 +3008,7 @@ int tcp_disconnect(struct sock *sk, int flags)if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK ))inet_reset_saddr (sk); - sk->sk_shutdown =0 ; +WRITE_ONCE (sk->sk_shutdown,0 );sock_reset_flag (sk,SOCK_DONE ); tp->srtt_us =0 ; tp->mdev_us =jiffies_to_usecs (TCP_TIMEOUT_INIT );
@@ -4453,7 +4455,7 @@ void tcp_done(struct sock *sk)if (req)reqsk_fastopen_remove (sk, req, false); - sk->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (sk->sk_shutdown,SHUTDOWN_MASK );if (!sock_flag (sk,SOCK_DEAD )) sk->sk_state_change (sk);
net/ipv4/tcp_input.c +2 -2
@@ -4353,7 +4353,7 @@ void tcp_fin(struct sock *sk)inet_csk_schedule_ack (sk); - sk->sk_shutdown |=RCV_SHUTDOWN ; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown |RCV_SHUTDOWN );sock_set_flag (sk,SOCK_DONE );switch (sk->sk_state) {
@@ -6531,7 +6531,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)break ;tcp_set_state (sk,TCP_FIN_WAIT2 ); - sk->sk_shutdown |=SEND_SHUTDOWN ; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown |SEND_SHUTDOWN );sk_dst_confirm (sk);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 17/203 gve: Remove the code of clearing PBA bit
In reply to Greg Kroah-HartmanFrom: Ziwei Xiao <[email protected]>
[ Upstream commit f4c2e67c1773d2a2632381ee30e9139c1e744c16 ]
Clearing the PBA bit from the driver is race prone and it may lead to dropped interrupt events. This could potentially lead to the traffic being completely halted.
--- drivers/net/ethernet/google/gve/gve_main.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +0 -13
@@ -233,19 +233,6 @@ static int gve_napi_poll_dqo(struct napi_struct *napi, int budget)bool reschedule = false;int work_done =0 ; -/* Clear PCI MSI-X Pending Bit Array (PBA) -* -* This bit is set if an interrupt event occurs while the vector is -* masked. If this bit is set and we reenable the interrupt, it will -* fire again. Since we're just about to poll the queue state, we don't -* need it to fire again. -* -* Under high softirq load, it's possible that the interrupt condition -* is triggered twice before we got the chance to process it. -*/ -gve_write_irq_doorbell_dqo (priv, block, -GVE_ITR_NO_UPDATE_DQO |GVE_ITR_CLEAR_PBA_BIT_DQO ); -if (block->tx) reschedule |=gve_tx_poll_dqo (block,/*do_clean=*/ true);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 18/203 ipvlan:Fix out-of-bounds caused by unclear skb->cb
In reply to Greg Kroah-HartmanFrom: t.feng <[email protected]>
[ Upstream commit 90cbed5247439a966b645b34eb0a2e037836ea8e ]
If skb enqueue the qdisc, fq_skb_cb(skb)->time_to_send is changed which is actually skb->cb, and IPCB(skb_in)->opt will be used in __ip_options_echo. It is possible that memcpy is out of bounds and lead to stack overflow.
We should clear skb->cb before ip_local_out or ip6_local_out.
v2:
1. clean the stack info
2. use IPCB/IP6CB instead of skb->cb
crash on stable-5.10(reproduce in kasan kernel).
Stack info:
[ 2203.651571] BUG: KASAN: stack-out-of-bounds in __ip_options_echo+0x589/0x800 [ 2203.653327] Write of size 4 at addr ffff88811a388f27 by task swapper/3/0 [ 2203.655460] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Not tainted 5.10.0-60.18.0.50.h856.kasan.eulerosv2r11.x86_64 #1 [ 2203.655466] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-20181220_000000-szxrtosci10000 04/01/2014 [ 2203.655475] Call Trace: [ 2203.655481] <IRQ> [ 2203.655501] dump_stack+0x9c/0xd3 [ 2203.655514] print_address_description.constprop.0+0x19/0x170 [ 2203.655530] __kasan_report.cold+0x6c/0x84 [ 2203.655586] kasan_report+0x3a/0x50 [ 2203.655594] check_memory_region+0xfd/0x1f0 [ 2203.655601] memcpy+0x39/0x60 [ 2203.655608] __ip_options_echo+0x589/0x800 [ 2203.655654] __icmp_send+0x59a/0x960 [ 2203.655755] nf_send_unreach+0x129/0x3d0 [nf_reject_ipv4] [ 2203.655763] reject_tg+0x77/0x1bf [ipt_REJECT] [ 2203.655772] ipt_do_table+0x691/0xa40 [ip_tables] [ 2203.655821] nf_hook_slow+0x69/0x100 [ 2203.655828] __ip_local_out+0x21e/0x2b0 [ 2203.655857] ip_local_out+0x28/0x90 [ 2203.655868] ipvlan_process_v4_outbound+0x21e/0x260 [ipvlan] [ 2203.655931] ipvlan_xmit_mode_l3+0x3bd/0x400 [ipvlan] [ 2203.655967] ipvlan_queue_xmit+0xb3/0x190 [ipvlan] [ 2203.655977] ipvlan_start_xmit+0x2e/0xb0 [ipvlan] [ 2203.655984] xmit_one.constprop.0+0xe1/0x280 [ 2203.655992] dev_hard_start_xmit+0x62/0x100 [ 2203.656000] sch_direct_xmit+0x215/0x640 [ 2203.656028] __qdisc_run+0x153/0x1f0 [ 2203.656069] __dev_queue_xmit+0x77f/0x1030 [ 2203.656173] ip_finish_output2+0x59b/0xc20 [ 2203.656244] __ip_finish_output.part.0+0x318/0x3d0 [ 2203.656312] ip_finish_output+0x168/0x190 [ 2203.656320] ip_output+0x12d/0x220 [ 2203.656357] __ip_queue_xmit+0x392/0x880 [ 2203.656380] __tcp_transmit_skb+0x1088/0x11c0 [ 2203.656436] __tcp_retransmit_skb+0x475/0xa30 [ 2203.656505] tcp_retransmit_skb+0x2d/0x190 [ 2203.656512] tcp_retransmit_timer+0x3af/0x9a0 [ 2203.656519] tcp_write_timer_handler+0x3ba/0x510 [ 2203.656529] tcp_write_timer+0x55/0x180 [ 2203.656542] call_timer_fn+0x3f/0x1d0 [ 2203.656555] expire_timers+0x160/0x200 [ 2203.656562] run_timer_softirq+0x1f4/0x480 [ 2203.656606] __do_softirq+0xfd/0x402 [ 2203.656613] asm_call_irq_on_stack+0x12/0x20 [ 2203.656617] </IRQ> [ 2203.656623] do_softirq_own_stack+0x37/0x50 [ 2203.656631] irq_exit_rcu+0x134/0x1a0 [ 2203.656639] sysvec_apic_timer_interrupt+0x36/0x80 [ 2203.656646] asm_sysvec_apic_timer_interrupt+0x12/0x20 [ 2203.656654] RIP: 0010:default_idle+0x13/0x20 [ 2203.656663] Code: 89 f0 5d 41 5c 41 5d 41 5e c3 cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 0f 1f 44 00 00 0f 00 2d 9f 32 57 00 fb f4 <c3> cc cc cc cc 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 54 be 08 [ 2203.656668] RSP: 0018:ffff88810036fe78 EFLAGS: 00000256 [ 2203.656676] RAX: ffffffffaf2a87f0 RBX: ffff888100360000 RCX: ffffffffaf290191 [ 2203.656681] RDX: 0000000000098b5e RSI: 0000000000000004 RDI: ffff88811a3c4f60 [ 2203.656686] RBP: 0000000000000000 R08: 0000000000000001 R09: ffff88811a3c4f63 [ 2203.656690] R10: ffffed10234789ec R11: 0000000000000001 R12: 0000000000000003 [ 2203.656695] R13: ffff888100360000 R14: 0000000000000000 R15: 0000000000000000 [ 2203.656729] default_idle_call+0x5a/0x150 [ 2203.656735] cpuidle_idle_call+0x1c6/0x220 [ 2203.656780] do_idle+0xab/0x100 [ 2203.656786] cpu_startup_entry+0x19/0x20 [ 2203.656793] secondary_startup_64_no_verify+0xc2/0xcb
[ 2203.657409] The buggy address belongs to the page: [ 2203.658648] page:0000000027a9842f refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11a388 [ 2203.658665] flags: 0x17ffffc0001000(reserved|node=0|zone=2|lastcpupid=0x1fffff) [ 2203.658675] raw: 0017ffffc0001000 ffffea000468e208 ffffea000468e208 0000000000000000 [ 2203.658682] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 [ 2203.658686] page dumped because: kasan: bad access detected
To reproduce(ipvlan with IPVLAN_MODE_L3):
Env setting:
=======================================================
modprobe ipvlan ipvlan_default_mode=1
sysctl net.ipv4.conf.eth0.forwarding=1
iptables -t nat -A POSTROUTING -s 20.0.0.0/255.255.255.0 -o eth0 -j MASQUERADE
ip link add gw link eth0 type ipvlan
ip -4 addr add 20.0.0.254/24 dev gw
ip netns add net1
ip link add ipv1 link eth0 type ipvlan
ip link set ipv1 netns net1
ip netns exec net1 ip link set ipv1 up
ip netns exec net1 ip -4 addr add 20.0.0.4/24 dev ipv1
ip netns exec net1 route add default gw 20.0.0.254
ip netns exec net1 tc qdisc add dev ipv1 root netem loss 10% ifconfig gw up
iptables -t filter -A OUTPUT -p tcp --dport 8888 -j REJECT --reject-with icmp-port-unreachable
=======================================================
And then excute the shell(curl any address of eth0 can reach):
for((i=1;i<=100000;i++))
do
ip netns exec net1 curl x.x.x.x:8888
done
=======================================================
--- drivers/net/ipvlan/ipvlan_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ipvlan/ipvlan_core.c +6 -0
@@ -437,6 +437,9 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) goto err; }skb_dst_set (skb, &rt->dst); + +memset (IPCB (skb),0 ,sizeof (*IPCB (skb))); + err =ip_local_out (net, skb->sk, skb);if (unlikely (net_xmit_eval (err))) dev->stats.tx_errors++;
@@ -475,6 +478,9 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) goto err; }skb_dst_set (skb, dst); + +memset (IP6CB (skb),0 ,sizeof (*IP6CB (skb))); + err =ip6_local_out (net, skb->sk, skb);if (unlikely (net_xmit_eval (err))) dev->stats.tx_errors++;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 19/203 net: datagram: fix data-races in datagram_poll()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5bca1d081f44c9443e61841842ce4e9179d327b6 ]
datagram_poll() runs locklessly, we should add READ_ONCE() annotations while reading sk->sk_err, sk->sk_shutdown and sk->sk_state.
--- net/core/datagram.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/core/datagram.c +10 -5
@@ -799,18 +799,21 @@ __poll_t datagram_poll(struct file *file, struct socket *sock, {struct sock *sk = sock->sk;__poll_t mask; +u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ;/* exceptional events? */ -if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) +if (READ_ONCE (sk->sk_err) || + !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 ); -if (sk->sk_shutdown &RCV_SHUTDOWN ) + shutdown =READ_ONCE (sk->sk_shutdown); +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLRDHUP |EPOLLIN |EPOLLRDNORM ; -if (sk->sk_shutdown ==SHUTDOWN_MASK ) +if (shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ;/* readable? */
@@ -819,10 +822,12 @@ __poll_t datagram_poll(struct file *file, struct socket *sock,/* Connection-based need to check for termination and startup */ if (connection_based (sk)) { -if (sk->sk_state ==TCP_CLOSE ) +int state =READ_ONCE (sk->sk_state); + +if (state ==TCP_CLOSE ) mask |=EPOLLHUP ;/* connection hasn't started yet? */ -if (sk->sk_state ==TCP_SYN_SENT ) +if (state ==TCP_SYN_SENT )return mask; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 2/203 ARM: 9296/1: HP Jornada 7XX: fix kernel-doc warnings
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 46dd6078dbc7e363a8bb01209da67015a1538929 ]
Fix kernel-doc warnings from the kernel test robot:
jornada720_ssp.c:24: warning: Function parameter or member 'jornada_ssp_lock' not described in 'DEFINE_SPINLOCK' jornada720_ssp.c:24: warning: expecting prototype for arch/arm/mac(). Prototype was for DEFINE_SPINLOCK() instead jornada720_ssp.c:34: warning: Function parameter or member 'byte' not described in 'jornada_ssp_reverse' jornada720_ssp.c:57: warning: Function parameter or member 'byte' not described in 'jornada_ssp_byte' jornada720_ssp.c:85: warning: Function parameter or member 'byte' not described in 'jornada_ssp_inout'
--- arch/arm/mach-sa1100/jornada720_ssp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-sa1100/jornada720_ssp.c +4 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0-only -/** +/* * arch/arm/mac-sa1100/jornada720_ssp.c * * Copyright (C) 2006/2007 Kristoffer Ericson <[email protected]>
@@ -26,6 +26,7 @@ static unsigned long jornada_ssp_flags;/** * jornada_ssp_reverse - reverses input byte +* @byte: input byte to reverse * * we need to reverse all data we receive from the mcu due to its physical location * returns : 01110111 -> 11101110
@@ -46,6 +47,7 @@ EXPORT_SYMBOL(jornada_ssp_reverse);/** * jornada_ssp_byte - waits for ready ssp bus and sends byte +* @byte: input byte to transmit * * waits for fifo buffer to clear and then transmits, if it doesn't then we will * timeout after <timeout> rounds. Needs mcu running before its called.
@@ -77,6 +79,7 @@ EXPORT_SYMBOL(jornada_ssp_byte);/** * jornada_ssp_inout - decide if input is command or trading byte +* @byte: input byte to send (may be %TXDUMMY) * * returns : (jornada_ssp_byte(byte)) on success * : %-ETIMEDOUT on timeout failure
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 20/203 af_unix: Fix a data race of sk->sk_receive_queue->qlen.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 679ed006d416ea0cecfe24a99d365d1dea69c683 ]
KCSAN found a data race of sk->sk_receive_queue->qlen where recvmsg() updates qlen under the queue lock and sendmsg() checks qlen under unix_state_sock(), not the queue lock, so the reader side needs READ_ONCE().
BUG: KCSAN: data-race in __skb_try_recv_from_queue / unix_wait_for_peer
write (marked) to 0xffff888019fe7c68 of 4 bytes by task 49792 on cpu 0:
__skb_unlink include/linux/skbuff.h:2347 [inline] __skb_try_recv_from_queue+0x3de/0x470 net/core/datagram.c:197 __skb_try_recv_datagram+0xf7/0x390 net/core/datagram.c:263 __unix_dgram_recvmsg+0x109/0x8a0 net/unix/af_unix.c:2452 unix_dgram_recvmsg+0x94/0xa0 net/unix/af_unix.c:2549 sock_recvmsg_nosec net/socket.c:1019 [inline] ____sys_recvmsg+0x3a3/0x3b0 net/socket.c:2720 ___sys_recvmsg+0xc8/0x150 net/socket.c:2764 do_recvmmsg+0x182/0x560 net/socket.c:2858 __sys_recvmmsg net/socket.c:2937 [inline] __do_sys_recvmmsg net/socket.c:2960 [inline] __se_sys_recvmmsg net/socket.c:2953 [inline] __x64_sys_recvmmsg+0x153/0x170 net/socket.c:2953 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
read to 0xffff888019fe7c68 of 4 bytes by task 49793 on cpu 1:
skb_queue_len include/linux/skbuff.h:2127 [inline] unix_recvq_full net/unix/af_unix.c:229 [inline] unix_wait_for_peer+0x154/0x1a0 net/unix/af_unix.c:1445 unix_dgram_sendmsg+0x13bc/0x14b0 net/unix/af_unix.c:2048 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg+0x148/0x160 net/socket.c:747 ____sys_sendmsg+0x20e/0x620 net/socket.c:2503 ___sys_sendmsg+0xc6/0x140 net/socket.c:2557 __sys_sendmmsg+0x11d/0x370 net/socket.c:2643 __do_sys_sendmmsg net/socket.c:2672 [inline] __se_sys_sendmmsg net/socket.c:2669 [inline] __x64_sys_sendmmsg+0x58/0x70 net/socket.c:2669 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
value changed: 0x0000000b -> 0x00000001
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 49793 Comm: syz-executor.0 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -1307,7 +1307,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo) sched = !sock_flag (other,SOCK_DEAD ) && !(other->sk_shutdown &RCV_SHUTDOWN ) && -unix_recvq_full (other); +unix_recvq_full_lockless (other);unix_state_unlock (other);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 21/203 af_unix: Fix data races around sk->sk_shutdown.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e1d09c2c2f5793474556b60f83900e088d0d366d ]
KCSAN found a data race around sk->sk_shutdown where unix_release_sock() and unix_shutdown() update it under unix_state_lock(), OTOH unix_poll() and unix_dgram_poll() read it locklessly.
We need to annotate the writes and reads with WRITE_ONCE() and READ_ONCE().
BUG: KCSAN: data-race in unix_poll / unix_release_sock
write to 0xffff88800d0f8aec of 1 bytes by task 264 on cpu 0:
unix_release_sock+0x75c/0x910 net/unix/af_unix.c:631 unix_release+0x59/0x80 net/unix/af_unix.c:1042 __sock_release+0x7d/0x170 net/socket.c:653 sock_close+0x19/0x30 net/socket.c:1397 __fput+0x179/0x5e0 fs/file_table.c:321 ____fput+0x15/0x20 fs/file_table.c:349 task_work_run+0x116/0x1a0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x174/0x180 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:297 do_syscall_64+0x4b/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x72/0xdc
read to 0xffff88800d0f8aec of 1 bytes by task 222 on cpu 1:
unix_poll+0xa3/0x2a0 net/unix/af_unix.c:3170 sock_poll+0xcf/0x2b0 net/socket.c:1385 vfs_poll include/linux/poll.h:88 [inline] ep_item_poll.isra.0+0x78/0xc0 fs/eventpoll.c:855 ep_send_events fs/eventpoll.c:1694 [inline] ep_poll fs/eventpoll.c:1823 [inline] do_epoll_wait+0x6c4/0xea0 fs/eventpoll.c:2258 __do_sys_epoll_wait fs/eventpoll.c:2270 [inline] __se_sys_epoll_wait fs/eventpoll.c:2265 [inline] __x64_sys_epoll_wait+0xcc/0x190 fs/eventpoll.c:2265 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
value changed: 0x00 -> 0x03
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 222 Comm: dbus-broker Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
--- net/unix/af_unix.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
net/unix/af_unix.c +12 -8
@@ -538,7 +538,7 @@ static void unix_release_sock(struct sock *sk, int embrion)/* Clear state */ unix_state_lock (sk);sock_orphan (sk); - sk->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (sk->sk_shutdown,SHUTDOWN_MASK ); path = u->path; u->path.dentry =NULL ; u->path.mnt =NULL ;
@@ -563,7 +563,7 @@ static void unix_release_sock(struct sock *sk, int embrion)if (sk->sk_type ==SOCK_STREAM || sk->sk_type ==SOCK_SEQPACKET ) {unix_state_lock (skpair);/* No more writes */ - skpair->sk_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (skpair->sk_shutdown,SHUTDOWN_MASK );if (!skb_queue_empty (&sk->sk_receive_queue) || embrion) skpair->sk_err =ECONNRESET ;unix_state_unlock (skpair);
@@ -2894,7 +2894,7 @@ static int unix_shutdown(struct socket *sock, int mode) ++mode;unix_state_lock (sk); - sk->sk_shutdown |= mode; +WRITE_ONCE (sk->sk_shutdown, sk->sk_shutdown | mode); other =unix_peer (sk);if (other)sock_hold (other);
@@ -2914,7 +2914,7 @@ static int unix_shutdown(struct socket *sock, int mode)if (mode&SEND_SHUTDOWN ) peer_mode |=RCV_SHUTDOWN ;unix_state_lock (other); - other->sk_shutdown |= peer_mode; +WRITE_ONCE (other->sk_shutdown, other->sk_shutdown | peer_mode);unix_state_unlock (other); other->sk_state_change (other);if (peer_mode ==SHUTDOWN_MASK )
@@ -3046,16 +3046,18 @@ static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wa {struct sock *sk = sock->sk;__poll_t mask; +u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ; + shutdown =READ_ONCE (sk->sk_shutdown);/* exceptional events? */ if (sk->sk_err) mask |=EPOLLERR ; -if (sk->sk_shutdown ==SHUTDOWN_MASK ) +if (shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ; -if (sk->sk_shutdown &RCV_SHUTDOWN ) +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLRDHUP |EPOLLIN |EPOLLRDNORM ;/* readable? */
@@ -3089,18 +3091,20 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock,struct sock *sk = sock->sk, *other;unsigned int writable;__poll_t mask; +u8 shutdown;sock_poll_wait (file, sock, wait); mask =0 ; + shutdown =READ_ONCE (sk->sk_shutdown);/* exceptional events? */ if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 ); -if (sk->sk_shutdown &RCV_SHUTDOWN ) +if (shutdown &RCV_SHUTDOWN ) mask |=EPOLLRDHUP |EPOLLIN |EPOLLRDNORM ; -if (sk->sk_shutdown ==SHUTDOWN_MASK ) +if (shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ;/* readable? */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 22/203 drm/i915/dp: prevent potential div-by-zero
In reply to Greg Kroah-HartmanFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit 0ff80028e2702c7c3d78b69705dc47c1ccba8c39 ]
drm_dp_dsc_sink_max_slice_count() may return 0 if something goes wrong on the part of the DSC sink and its DPCD register. This null value may be later used as a divisor in intel_dsc_compute_params(), which will lead to an error.
In the unlikely event that this issue occurs, fix it by testing the return value of drm_dp_dsc_sink_max_slice_count() against zero.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/i915/display/intel_dp.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/display/intel_dp.c +5 -0
@@ -1231,6 +1231,11 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp, pipe_config->dsc.slice_count =drm_dp_dsc_sink_max_slice_count (intel_dp->dsc_dpcd, true); +if (!pipe_config->dsc.slice_count) { +drm_dbg_kms (&dev_priv->drm,"Unsupported Slice Count %d\n" , + pipe_config->dsc.slice_count); +return -EINVAL ; + } }else {u16 dsc_max_output_bpp;u8 dsc_dp_slice_count;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 23/203 fbdev: arcfb: Fix error handling in arcfb_probe()
In reply to Greg Kroah-HartmanFrom: Zongjie Li <[email protected]>
[ Upstream commit 5a6bef734247c7a8c19511664ff77634ab86f45b ]
Smatch complains that:arcfb_probe() warn: 'irq' from request_irq() not released on lines: 587.
Fix error handling in the arcfb_probe() function. If IO addresses are not provided or framebuffer registration fails, the code will jump to the err_addr or err_register_fb label to release resources. If IRQ request fails, previously allocated resources will be freed.
--- drivers/video/fbdev/arcfb.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/video/fbdev/arcfb.c +9 -6
@@ -523,7 +523,7 @@ static int arcfb_probe(struct platform_device *dev) info =framebuffer_alloc (sizeof (struct arcfb_par ), &dev->dev);if (!info) - goto err; + goto err_fb_alloc; info->screen_base = (char __iomem *)videomemory; info->fbops = &arcfb_ops;
@@ -535,7 +535,7 @@ static int arcfb_probe(struct platform_device *dev)if (!dio_addr || !cio_addr || !c2io_addr) {printk (KERN_WARNING "no IO addresses supplied\n" ); - goto err1; + goto err_addr; } par->dio_addr = dio_addr; par->cio_addr = cio_addr;
@@ -551,12 +551,12 @@ static int arcfb_probe(struct platform_device *dev)printk (KERN_INFO "arcfb: Failed req IRQ %d\n" , par->irq); retval = -EBUSY ; - goto err1; + goto err_addr; } } retval =register_framebuffer (info);if (retval <0 ) - goto err1; + goto err_register_fb;platform_set_drvdata (dev, info);fb_info (info,"Arc frame buffer device, using %dK of video memory\n" , videomemorysize >>10 );
@@ -580,9 +580,12 @@ static int arcfb_probe(struct platform_device *dev) }return 0 ; -err1: + +err_register_fb: +free_irq (par->irq, info); +err_addr:framebuffer_release (info); -err: +err_fb_alloc:vfree (videomemory);return retval; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 24/203 ext4: remove an unused variable warning with CONFIG_QUOTA=n
In reply to Greg Kroah-HartmanFrom: Austin Kim <[email protected]>
[ Upstream commit 3bbef91bdd2180c67407285ba160b023eb4d5306 ]
The 'enable_quota' variable is only used in an CONFIG_QUOTA. With CONFIG_QUOTA=n, compiler causes a harmless warning:
fs/ext4/super.c: In function ‘ext4_remount’:fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
[-Wunused-but-set-variable]
int enable_quota = 0;
^~~~~Move 'enable_quota' into the same #ifdef CONFIG_QUOTA block to remove an unused variable warning.
Stable-dep-of: a44be64bbecb ("ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled")
--- fs/ext4/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/super.c +3 -1
@@ -5742,10 +5742,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)struct ext4_sb_info *sbi =EXT4_SB (sb);unsigned long old_sb_flags, vfs_flags;struct ext4_mount_options old_opts; -int enable_quota =0 ;ext4_group_t g;int err =0 ;#ifdef CONFIG_QUOTA +int enable_quota =0 ;int i, j;char *to_free[EXT4_MAXQUOTAS ];#endif
@@ -5951,7 +5951,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) err = -EROFS ; goto restore_opts; } +#ifdef CONFIG_QUOTA enable_quota =1 ; +#endif } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 25/203 ext4: reflect error codes from ext4_multi_mount_protect() to its callers
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
[ Upstream commit 3b50d5018ed06a647bb26c44bb5ae74e59c903c7 ]
This will allow more fine-grained errno codes to be returned by the mount system call.
Stable-dep-of: a44be64bbecb ("ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled")
--- fs/ext4/mmp.c | 9 ++++++++- fs/ext4/super.c | 16 +++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-)
fs/ext4/mmp.c +8 -1
@@ -290,6 +290,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (mmp_block <le32_to_cpu (es->s_first_data_block) || mmp_block >=ext4_blocks_count (es)) {ext4_warning (sb,"Invalid MMP block in superblock" ); + retval = -EINVAL ; goto failed; }
@@ -315,6 +316,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (seq ==EXT4_MMP_SEQ_FSCK ) {dump_mmp_msg (sb, mmp,"fsck is running on the filesystem" ); + retval = -EBUSY ; goto failed; }
@@ -328,6 +330,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (schedule_timeout_interruptible (HZ * wait_time) !=0 ) {ext4_warning (sb,"MMP startup interrupted, failing mount\n" ); + retval = -ETIMEDOUT ; goto failed; }
@@ -338,6 +341,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (seq !=le32_to_cpu (mmp->mmp_seq)) {dump_mmp_msg (sb, mmp,"Device is already active on another node." ); + retval = -EBUSY ; goto failed; }
@@ -357,6 +361,7 @@ int ext4_multi_mount_protect(struct super_block *sb,*/ if (schedule_timeout_interruptible (HZ * wait_time) !=0 ) {ext4_warning (sb,"MMP startup interrupted, failing mount" ); + retval = -ETIMEDOUT ; goto failed; }
@@ -367,6 +372,7 @@ int ext4_multi_mount_protect(struct super_block *sb,if (seq !=le32_to_cpu (mmp->mmp_seq)) {dump_mmp_msg (sb, mmp,"Device is already active on another node." ); + retval = -EBUSY ; goto failed; }
@@ -383,6 +389,7 @@ int ext4_multi_mount_protect(struct super_block *sb,EXT4_SB (sb)->s_mmp_tsk =NULL ;ext4_warning (sb,"Unable to create kmmpd thread for %s." , sb->s_id); + retval = -ENOMEM ; goto failed; }
@@ -390,5 +397,5 @@ int ext4_multi_mount_protect(struct super_block *sb, failed:brelse (bh); -return 1 ; +return retval; }
fs/ext4/super.c +9 -7
@@ -4646,9 +4646,11 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)ext4_has_feature_orphan_present (sb) || ext4_has_feature_journal_needs_recovery(sb)); -if (ext4_has_feature_mmp (sb) && !sb_rdonly (sb)) -if (ext4_multi_mount_protect (sb,le64_to_cpu (es->s_mmp_block))) +if (ext4_has_feature_mmp (sb) && !sb_rdonly (sb)) { + err =ext4_multi_mount_protect (sb,le64_to_cpu (es->s_mmp_block)); +if (err) goto failed_mount3a; + }/* * The first inode we look at is the journal inode. Don't try
@@ -5945,12 +5947,12 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; sb->s_flags &= ~SB_RDONLY ; -if (ext4_has_feature_mmp (sb)) -if (ext4_multi_mount_protect (sb, -le64_to_cpu (es->s_mmp_block))) { - err = -EROFS ; +if (ext4_has_feature_mmp (sb)) { + err =ext4_multi_mount_protect (sb, +le64_to_cpu (es->s_mmp_block)); +if (err) goto restore_opts; - } + }#ifdef CONFIG_QUOTA enable_quota =1 ;#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 3/203 net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 27c1eaa07283b0c94becf8241f95368267cf558b ]
Should of_mdiobus_register() fail, a previous usb_get_dev() call should be undone as in the .disconnect function.
--- drivers/net/mdio/mdio-mvusb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/mdio/mdio-mvusb.c +10 -1
@@ -73,6 +73,7 @@ static int mvusb_mdio_probe(struct usb_interface *interface,struct device *dev = &interface->dev;struct mvusb_mdio *mvusb;struct mii_bus *mdio; +int ret; mdio =devm_mdiobus_alloc_size (dev,sizeof (*mvusb));if (!mdio)
@@ -93,7 +94,15 @@ static int mvusb_mdio_probe(struct usb_interface *interface, mdio->write = mvusb_mdio_write;usb_set_intfdata (interface, mvusb); -return of_mdiobus_register (mdio, dev->of_node); + ret =of_mdiobus_register (mdio, dev->of_node); +if (ret) + goto put_dev; + +return 0 ; + +put_dev: +usb_put_dev (mvusb->udev); +return ret; }static void mvusb_mdio_disconnect (struct usb_interface *interface)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 4/203 scsi: ufs: core: Fix I/O hang that occurs when BKOPS fails in W-LUN suspend
In reply to Greg Kroah-HartmanFrom: Keoseong Park <[email protected]>
[ Upstream commit 1a7edd041f2d252f251523ba3f2eaead076a8f8d ]
Even when urgent BKOPS fails, the consumer will get stuck in runtime suspend status. Like commit 1a5665fc8d7a ("scsi: ufs: core: WLUN suspend SSU/enter hibern8 fail recovery"), trigger the error handler and return -EBUSY to break the suspend.
--- drivers/scsi/ufs/ufshcd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +9 -1
@@ -8756,8 +8756,16 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)* that performance might be impacted. */ ret =ufshcd_urgent_bkops (hba); -if (ret) +if (ret) { +/* +* If return err in suspend flow, IO will hang. +* Trigger error handler and break suspend for +* error recovery. +*/ +ufshcd_force_error_recovery (hba); + ret = -EBUSY ; goto enable_scaling; + } }else {/* make sure that auto bkops is disabled */ ufshcd_disable_auto_bkops (hba);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 5/203 tick/broadcast: Make broadcast device replacement work correctly
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit f9d36cf445ffff0b913ba187a3eff78028f9b1fb ]
When a tick broadcast clockevent device is initialized for one shot mode then tick_broadcast_setup_oneshot() OR's the periodic broadcast mode cpumask into the oneshot broadcast cpumask.
This is required when switching from periodic broadcast mode to oneshot broadcast mode to ensure that CPUs which are waiting for periodic broadcast are woken up on the next tick.
But it is subtly broken, when an active broadcast device is replaced and the system is already in oneshot (NOHZ/HIGHRES) mode. Victor observed this and debugged the issue.
Then the OR of the periodic broadcast CPU mask is wrong as the periodic cpumask bits are sticky after tick_broadcast_enable() set it for a CPU unless explicitly cleared via tick_broadcast_disable().
That means that this sets all other CPUs which have tick broadcasting enabled at that point unconditionally in the oneshot broadcast mask.
If the affected CPUs were already idle and had their bits set in the oneshot broadcast mask then this does no harm. But for non idle CPUs which were not set this corrupts their state.
On their next invocation of tick_broadcast_enable() they observe the bit set, which indicates that the broadcast for the CPU is already set up. As a consequence they fail to update the broadcast event even if their earliest expiring timer is before the actually programmed broadcast event.
If the programmed broadcast event is far in the future, then this can cause stalls or trigger the hung task detector.
Avoid this by telling tick_broadcast_setup_oneshot() explicitly whether this is the initial switch over from periodic to oneshot broadcast which must take the periodic broadcast mask into account. In the case of initialization of a replacement device this prevents that the broadcast oneshot mask is modified.
There is a second problem with broadcast device replacement in this function. The broadcast device is only armed when the previous state of the device was periodic.
That is correct for the switch from periodic broadcast mode to oneshot broadcast mode as the underlying broadcast device could operate in oneshot state already due to lack of periodic state in hardware. In that case it is already armed to expire at the next tick.
For the replacement case this is wrong as the device is in shutdown state. That means that any already pending broadcast event will not be armed.
This went unnoticed because any CPU which goes idle will observe that the broadcast device has an expiry time of KTIME_MAX and therefore any CPUs next timer event will be earlier and cause a reprogramming of the broadcast device. But that does not guarantee that the events of the CPUs which were already in idle are delivered on time.
Fix this by arming the newly installed device for an immediate event which will reevaluate the per CPU expiry times and reprogram the broadcast device accordingly. This is simpler than caching the last expiry time in yet another place or saving it before the device exchange and handing it down to the setup function. Replacement of broadcast devices is not a frequent operation and usually happens once somewhere late in the boot process.
--- kernel/time/tick-broadcast.c | 120 +++++++++++++++++++++++++---------- 1 file changed, 88 insertions(+), 32 deletions(-)
kernel/time/tick-broadcast.c +88 -32
@@ -35,14 +35,15 @@ static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock);#ifdef CONFIG_TICK_ONESHOT static DEFINE_PER_CPU(struct clock_event_device *, tick_oneshot_wakeup_device); -static void tick_broadcast_setup_oneshot (struct clock_event_device *bc); +static void tick_broadcast_setup_oneshot (struct clock_event_device *bc,bool from_periodic);static void tick_broadcast_clear_oneshot (int cpu);static void tick_resume_broadcast_oneshot (struct clock_event_device *bc);# ifdef CONFIG_HOTPLUG_CPU static void tick_broadcast_oneshot_offline (unsigned int cpu);# endif #else -static inline void tick_broadcast_setup_oneshot (struct clock_event_device *bc) {BUG (); } +static inline void +tick_broadcast_setup_oneshot (struct clock_event_device *bc,bool from_periodic) {BUG (); }static inline void tick_broadcast_clear_oneshot (int cpu) { }static inline void tick_resume_broadcast_oneshot (struct clock_event_device *bc) { }# ifdef CONFIG_HOTPLUG_CPU
@@ -264,7 +265,7 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu)if (tick_broadcast_device.mode ==TICKDEV_MODE_PERIODIC )tick_broadcast_start_periodic (bc);else -tick_broadcast_setup_oneshot (bc); +tick_broadcast_setup_oneshot (bc, false); ret =1 ; }else {/*
@@ -500,7 +501,7 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)if (tick_broadcast_device.mode ==TICKDEV_MODE_PERIODIC )tick_broadcast_start_periodic (bc);else -tick_broadcast_setup_oneshot (bc); +tick_broadcast_setup_oneshot (bc, false); } } out:
@@ -1016,48 +1017,101 @@ static inline ktime_t tick_get_next_period(void)/** * tick_broadcast_setup_oneshot - setup the broadcast device */ -static void tick_broadcast_setup_oneshot (struct clock_event_device *bc) +static void tick_broadcast_setup_oneshot (struct clock_event_device *bc, +bool from_periodic) {int cpu =smp_processor_id (); +ktime_t nexttick =0 ;if (!bc)return ; -/* Set it up only once ! */ -if (bc->event_handler != tick_handle_oneshot_broadcast) { -int was_periodic =clockevent_state_periodic (bc); - - bc->event_handler = tick_handle_oneshot_broadcast; - +/* +* When the broadcast device was switched to oneshot by the first +* CPU handling the NOHZ change, the other CPUs will reach this +* code via hrtimer_run_queues() -> tick_check_oneshot_change() +* too. Set up the broadcast device only once! +*/ +if (bc->event_handler == tick_handle_oneshot_broadcast) {/* -* We must be careful here. There might be other CPUs -* waiting for periodic broadcast. We need to set the -* oneshot_mask bits for those and program the -* broadcast device to fire. +* The CPU which switched from periodic to oneshot mode +* set the broadcast oneshot bit for all other CPUs which +* are in the general (periodic) broadcast mask to ensure +* that CPUs which wait for the periodic broadcast are +* woken up. +* +* Clear the bit for the local CPU as the set bit would +* prevent the first tick_broadcast_enter() after this CPU +* switched to oneshot state to program the broadcast +* device. +* +* This code can also be reached via tick_broadcast_control(), +* but this cannot avoid the tick_broadcast_clear_oneshot() +* as that would break the periodic to oneshot transition of +* secondary CPUs. But that's harmless as the below only +* clears already cleared bits. */ +tick_broadcast_clear_oneshot (cpu); +return ; + } + + + bc->event_handler = tick_handle_oneshot_broadcast; + bc->next_event =KTIME_MAX ; + +/* +* When the tick mode is switched from periodic to oneshot it must +* be ensured that CPUs which are waiting for periodic broadcast +* get their wake-up at the next tick. This is achieved by ORing +* tick_broadcast_mask into tick_broadcast_oneshot_mask. +* +* For other callers, e.g. broadcast device replacement, +* tick_broadcast_oneshot_mask must not be touched as this would +* set bits for CPUs which are already NOHZ, but not idle. Their +* next tick_broadcast_enter() would observe the bit set and fail +* to update the expiry time and the broadcast event device. +*/ +if (from_periodic) {cpumask_copy (tmpmask, tick_broadcast_mask); +/* Remove the local CPU as it is obviously not idle */ cpumask_clear_cpu (cpu, tmpmask); -cpumask_or (tick_broadcast_oneshot_mask, - tick_broadcast_oneshot_mask, tmpmask); +cpumask_or (tick_broadcast_oneshot_mask, tick_broadcast_oneshot_mask, tmpmask); -if (was_periodic && !cpumask_empty (tmpmask)) { -ktime_t nextevt =tick_get_next_period (); +/* +* Ensure that the oneshot broadcast handler will wake the +* CPUs which are still waiting for periodic broadcast. +*/ + nexttick =tick_get_next_period (); +tick_broadcast_init_next_event (tmpmask, nexttick); -clockevents_switch_state (bc,CLOCK_EVT_STATE_ONESHOT ); -tick_broadcast_init_next_event (tmpmask, nextevt); -tick_broadcast_set_event (bc, cpu, nextevt); - }else - bc->next_event =KTIME_MAX ; - }else {/* -* The first cpu which switches to oneshot mode sets -* the bit for all other cpus which are in the general -* (periodic) broadcast mask. So the bit is set and -* would prevent the first broadcast enter after this -* to program the bc device. +* If the underlying broadcast clock event device is +* already in oneshot state, then there is nothing to do. +* The device was already armed for the next tick +* in tick_handle_broadcast_periodic() */ -tick_broadcast_clear_oneshot (cpu); +if (clockevent_state_oneshot (bc)) +return ; } + +/* +* When switching from periodic to oneshot mode arm the broadcast +* device for the next tick. +* +* If the broadcast device has been replaced in oneshot mode and +* the oneshot broadcast mask is not empty, then arm it to expire +* immediately in order to reevaluate the next expiring timer. +* @nexttick is 0 and therefore in the past which will cause the +* clockevent code to force an event. +* +* For both cases the programming can be avoided when the oneshot +* broadcast mask is empty. +* +* tick_broadcast_set_event() implicitly switches the broadcast +* device to oneshot state. +*/ +if (!cpumask_empty (tick_broadcast_oneshot_mask)) +tick_broadcast_set_event (bc, cpu, nexttick); }/*
@@ -1066,14 +1120,16 @@ static void tick_broadcast_setup_oneshot(struct clock_event_device *bc)void tick_broadcast_switch_to_oneshot (void ) {struct clock_event_device *bc; +enum tick_device_mode oldmode;unsigned long flags;raw_spin_lock_irqsave (&tick_broadcast_lock, flags); + oldmode = tick_broadcast_device.mode; tick_broadcast_device.mode =TICKDEV_MODE_ONESHOT ; bc = tick_broadcast_device.evtdev;if (bc) -tick_broadcast_setup_oneshot (bc); +tick_broadcast_setup_oneshot (bc, oldmode ==TICKDEV_MODE_PERIODIC );raw_spin_unlock_irqrestore (&tick_broadcast_lock, flags); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 6/203 linux/dim: Do nothing if no time delta between samples
In reply to Greg Kroah-HartmanFrom: Roy Novich <[email protected]>
[ Upstream commit 162bd18eb55adf464a0fa2b4144b8d61c75ff7c2 ]
Add return value for dim_calc_stats. This is an indication for the caller if curr_stats was assigned by the function. Avoid using curr_stats uninitialized over {rdma/net}_dim, when no time delta between samples. Coverity reported this potential use of an uninitialized variable.
--- include/linux/dim.h | 3 ++- lib/dim/dim.c | 5 +++-- lib/dim/net_dim.c | 3 ++- lib/dim/rdma_dim.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-)
include/linux/dim.h +2 -1
@@ -236,8 +236,9 @@ void dim_park_tired(struct dim *dim);* * Calculate the delta between two samples (in data rates). * Takes into consideration counter wrap-around. +* Returned boolean indicates whether curr_stats are reliable. */ -void dim_calc_stats (struct dim_sample *start,struct dim_sample *end, +bool dim_calc_stats (struct dim_sample *start,struct dim_sample *end,struct dim_stats *curr_stats);/**
lib/dim/dim.c +3 -2
@@ -54,7 +54,7 @@ void dim_park_tired(struct dim *dim) }EXPORT_SYMBOL (dim_park_tired); -void dim_calc_stats (struct dim_sample *start,struct dim_sample *end, +bool dim_calc_stats (struct dim_sample *start,struct dim_sample *end,struct dim_stats *curr_stats) {/* u32 holds up to 71 minutes, should be enough */
@@ -66,7 +66,7 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end, start->comp_ctr);if (!delta_us) -return ; +return false; curr_stats->ppms =DIV_ROUND_UP (npkts *USEC_PER_MSEC , delta_us); curr_stats->bpms =DIV_ROUND_UP (nbytes *USEC_PER_MSEC , delta_us);
@@ -79,5 +79,6 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end,else curr_stats->cpe_ratio =0 ; +return true; }EXPORT_SYMBOL (dim_calc_stats);
lib/dim/net_dim.c +2 -1
@@ -227,7 +227,8 @@ void net_dim(struct dim *dim, struct dim_sample end_sample) dim->start_sample.event_ctr);if (nevents <DIM_NEVENTS )break ; -dim_calc_stats (&dim->start_sample, &end_sample, &curr_stats); +if (!dim_calc_stats (&dim->start_sample, &end_sample, &curr_stats)) +break ;if (net_dim_decision (&curr_stats, dim)) { dim->state =DIM_APPLY_NEW_PROFILE ;schedule_work (&dim->work);
lib/dim/rdma_dim.c +2 -1
@@ -88,7 +88,8 @@ void rdma_dim(struct dim *dim, u64 completions) nevents = curr_sample->event_ctr - dim->start_sample.event_ctr;if (nevents <DIM_NEVENTS )break ; -dim_calc_stats (&dim->start_sample, curr_sample, &curr_stats); +if (!dim_calc_stats (&dim->start_sample, curr_sample, &curr_stats)) +break ;if (rdma_dim_decision (&curr_stats, dim)) { dim->state =DIM_APPLY_NEW_PROFILE ;schedule_work (&dim->work);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 7/203 net: stmmac: switch to use interrupt for hw crosstimestamping
In reply to Greg Kroah-HartmanFrom: Wong Vee Khee <[email protected]>
[ Upstream commit 76c16d3e19446deea98b7883f261758b96b8781a ]
Using current implementation of polling mode, there is high chances we will hit into timeout error when running phc2sys. Hence, update the implementation of hardware crosstimestamping to use the MAC interrupt service routine instead of polling for TSIS bit in the MAC Timestamp Interrupt Status register to be set.
Stable-dep-of: 8efbdbfa9938 ("net: stmmac: Initialize MAC_ONEUS_TIC_COUNTER register")
--- .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 25 ++++++++++++------- drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 3 ++- .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 +++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + .../ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 5 ++++ .../net/ethernet/stmicro/stmmac/stmmac_ptp.c | 12 +-------- include/linux/stmmac.h | 1 + 7 files changed, 30 insertions(+), 21 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +16 -9
@@ -298,6 +298,11 @@ static void get_arttime(struct mii_bus *mii, int intel_adhoc_addr, *art_time = ns; } +static int stmmac_cross_ts_isr (struct stmmac_priv *priv) +{ +return (readl (priv->ioaddr +GMAC_INT_STATUS ) &GMAC_INT_TSIE ); +} +static int intel_crosststamp (ktime_t *device,struct system_counterval_t *system,void *ctx)
@@ -313,8 +318,6 @@ static int intel_crosststamp(ktime_t *device,u32 num_snapshot;u32 gpio_value;u32 acr_value; -int ret; -u32 v;int i;if (!boot_cpu_has (X86_FEATURE_ART ))
@@ -328,6 +331,8 @@ static int intel_crosststamp(ktime_t *device,if (priv->plat->ext_snapshot_en)return -EBUSY ; + priv->plat->int_snapshot_en =1 ; +mutex_lock (&priv->aux_ts_lock);/* Enable Internal snapshot trigger */ acr_value =readl (ptpaddr +PTP_ACR );
@@ -347,6 +352,7 @@ static int intel_crosststamp(ktime_t *device,break ;default :mutex_unlock (&priv->aux_ts_lock); + priv->plat->int_snapshot_en =0 ;return -EINVAL ; }writel (acr_value, ptpaddr +PTP_ACR );
@@ -368,13 +374,12 @@ static int intel_crosststamp(ktime_t *device, gpio_value |=GMAC_GPO1 ;writel (gpio_value, ioaddr +GMAC_GPIO_STATUS ); -/* Poll for time sync operation done */ - ret =readl_poll_timeout (priv->ioaddr +GMAC_INT_STATUS , v, - (v &GMAC_INT_TSIE ),100 ,10000 ); - -if (ret == -ETIMEDOUT ) { -pr_err ("%s: Wait for time sync operation timeout\n" , __func__); -return ret; +/* Time sync done Indication - Interrupt method */ +if (!wait_event_interruptible_timeout (priv->tstamp_busy_wait, +stmmac_cross_ts_isr (priv), +HZ /100 )) { + priv->plat->int_snapshot_en =0 ; +return -ETIMEDOUT ; } num_snapshot = (readl(ioaddr + GMAC_TIMESTAMP_STATUS) &
@@ -392,6 +397,7 @@ static int intel_crosststamp(ktime_t *device, } system->cycles *= intel_priv->crossts_adj; + priv->plat->int_snapshot_en =0 ;return 0 ; }
@@ -576,6 +582,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, plat->has_crossts = true; plat->crosststamp = intel_crosststamp; + plat->int_snapshot_en =0 ;/* Setup MSI vector offset specific to Intel mGbE controller */ plat->msi_mac_vec =29 ;
drivers/net/ethernet/stmicro/stmmac/dwmac4.h +2 -1
@@ -150,7 +150,8 @@#define GMAC_PCS_IRQ_DEFAULT (GMAC_INT_RGSMIIS | GMAC_INT_PCS_LINK | \ GMAC_INT_PCS_ANE) -#define GMAC_INT_DEFAULT_ENABLE (GMAC_INT_PMT_EN | GMAC_INT_LPI_EN) +#define GMAC_INT_DEFAULT_ENABLE (GMAC_INT_PMT_EN | GMAC_INT_LPI_EN | \ + GMAC_INT_TSIE)enum dwmac4_irq_status { time_stamp_irq =0x00001000 ,
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +4 -0
@@ -23,6 +23,7 @@static void dwmac4_core_init (struct mac_device_info *hw,struct net_device *dev) { +struct stmmac_priv *priv =netdev_priv (dev);void __iomem *ioaddr = hw->pcsr;u32 value =readl (ioaddr +GMAC_CONFIG );
@@ -58,6 +59,9 @@ static void dwmac4_core_init(struct mac_device_info *hw, value |=GMAC_INT_FPE_EN ;writel (value, ioaddr +GMAC_INT_EN ); + +if (GMAC_INT_DEFAULT_ENABLE &GMAC_INT_TSIE ) +init_waitqueue_head (&priv->tstamp_busy_wait); } static void dwmac4_rx_queue_enable(struct mac_device_info *hw,
drivers/net/ethernet/stmicro/stmmac/stmmac.h +1 -0
@@ -265,6 +265,7 @@ struct stmmac_priv {spinlock_t ptp_lock;/* Protects auxiliary snapshot registers from concurrent access. */ struct mutex aux_ts_lock; +wait_queue_head_t tstamp_busy_wait;void __iomem *mmcaddr;void __iomem *ptpaddr;
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +5 -0
@@ -180,6 +180,11 @@ static void timestamp_interrupt(struct stmmac_priv *priv)u64 ptp_time;int i; +if (priv->plat->int_snapshot_en) { +wake_up (&priv->tstamp_busy_wait); +return ; + } + tsync_int =readl (priv->ioaddr +GMAC_INT_STATUS ) &GMAC_INT_TSIE ;if (!tsync_int)
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +1 -11
@@ -175,11 +175,10 @@ static int stmmac_enable(struct ptp_clock_info *ptp,struct stmmac_priv *priv = container_of(ptp, struct stmmac_priv, ptp_clock_ops);void __iomem *ptpaddr = priv->ptpaddr; -void __iomem *ioaddr = priv->hw->pcsr;struct stmmac_pps_cfg *cfg; -u32 intr_value, acr_value;int ret = -EOPNOTSUPP ;unsigned long flags; +u32 acr_value;switch (rq->type) {case PTP_CLK_REQ_PEROUT :
@@ -213,19 +212,10 @@ static int stmmac_enable(struct ptp_clock_info *ptp,netdev_dbg (priv->dev,"Auxiliary Snapshot %d enabled.\n" , priv->plat->ext_snapshot_num >>PTP_ACR_ATSEN_SHIFT ); -/* Enable Timestamp Interrupt */ - intr_value =readl (ioaddr +GMAC_INT_EN ); - intr_value |=GMAC_INT_TSIE ; -writel (intr_value, ioaddr +GMAC_INT_EN ); - }else {netdev_dbg (priv->dev,"Auxiliary Snapshot %d disabled.\n" , priv->plat->ext_snapshot_num >>PTP_ACR_ATSEN_SHIFT ); -/* Disable Timestamp Interrupt */ - intr_value =readl (ioaddr +GMAC_INT_EN ); - intr_value &= ~GMAC_INT_TSIE ; -writel (intr_value, ioaddr +GMAC_INT_EN ); }writel (acr_value, ptpaddr +PTP_ACR );mutex_unlock (&priv->aux_ts_lock);
include/linux/stmmac.h +1 -0
@@ -260,6 +260,7 @@ struct plat_stmmacenet_data {bool has_crossts;int int_snapshot_num;int ext_snapshot_num; +bool int_snapshot_en;bool ext_snapshot_en;bool multi_msi_en;int msi_mac_vec;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 8/203 net: stmmac: Initialize MAC_ONEUS_TIC_COUNTER register
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 8efbdbfa99381a017dd2c0f6375a7d80a8118b74 ]
Initialize MAC_ONEUS_TIC_COUNTER register with correct value derived from CSR clock, otherwise EEE is unstable on at least NXP i.MX8M Plus and Micrel KSZ9131RNX PHY, to the point where not even ARP request can be sent out.
i.MX 8M Plus Applications Processor Reference Manual, Rev. 1, 06/2021 11.7.6.1.34 One-microsecond Reference Timer (MAC_ONEUS_TIC_COUNTER) defines this register as:
"
This register controls the generation of the Reference time (1 microsecond tic) for all the LPI timers. This timer has to be programmed by the software initially.
...
The application must program this counter so that the number of clock cycles of CSR clock is 1us. (Subtract 1 from the value before programming). For example if the CSR clock is 100MHz then this field needs to be programmed to value 100 - 1 = 99 (which is 0x63).
This is required to generate the 1US events that are used to update some of the EEE related counters.
"
The reset value is 0x63 on i.MX8M Plus, which means expected CSR clock are 100 MHz. However, the i.MX8M Plus "enet_qos_root_clk" are 266 MHz instead, which means the LPI timers reach their count much sooner on this platform.
This is visible using a scope by monitoring e.g. exit from LPI mode on TX_CTL line from MAC to PHY. This should take 30us per STMMAC_DEFAULT_TWT_LS setting, during which the TX_CTL line transitions from tristate to low, and 30 us later from low to high. On i.MX8M Plus, this transition takes 11 us, which matches the 30us * 100/266 formula for misconfigured MAC_ONEUS_TIC_COUNTER register.
Configure MAC_ONEUS_TIC_COUNTER based on CSR clock, so that the LPI timers have correct 1us reference. This then fixes EEE on i.MX8M Plus with Micrel KSZ9131RNX PHY.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 5 +++++ 2 files changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac4.h +1 -0
@@ -181,6 +181,7 @@ enum power_event {#define GMAC4_LPI_CTRL_STATUS 0xd0#define GMAC4_LPI_TIMER_CTRL 0xd4#define GMAC4_LPI_ENTRY_TIMER 0xd8 +#define GMAC4_MAC_ONEUS_TIC_COUNTER 0xdc/* LPI control and status defines */ #define GMAC4_LPI_CTRL_STATUS_LPITCSE BIT(21)/* LPI Tx Clock Stop Enable */
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +5 -0
@@ -26,6 +26,7 @@ static void dwmac4_core_init(struct mac_device_info *hw,struct stmmac_priv *priv =netdev_priv (dev);void __iomem *ioaddr = hw->pcsr;u32 value =readl (ioaddr +GMAC_CONFIG ); +u32 clk_rate; value |=GMAC_CORE_INIT ;
@@ -48,6 +49,10 @@ static void dwmac4_core_init(struct mac_device_info *hw,writel (value, ioaddr +GMAC_CONFIG ); +/* Configure LPI 1us counter to number of CSR clock ticks in 1us - 1 */ + clk_rate =clk_get_rate (priv->plat->stmmac_clk); +writel ((clk_rate /1000000 ) -1 , ioaddr +GMAC4_MAC_ONEUS_TIC_COUNTER ); +/* Enable GMAC interrupts */ value =GMAC_INT_DEFAULT_ENABLE ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 9/203 net: Fix load-tearing on sk->sk_stamp in sock_recv_cmsgs().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit dfd9248c071a3710c24365897459538551cb7167 ]
KCSAN found a data race in sock_recv_cmsgs() where the read access to sk->sk_stamp needs READ_ONCE().
BUG: KCSAN: data-race in packet_recvmsg / packet_recvmsg
write (marked) to 0xffff88803c81f258 of 8 bytes by task 19171 on cpu 0:
sock_write_timestamp include/net/sock.h:2670 [inline] sock_recv_cmsgs include/net/sock.h:2722 [inline] packet_recvmsg+0xb97/0xd00 net/packet/af_packet.c:3489 sock_recvmsg_nosec net/socket.c:1019 [inline] sock_recvmsg+0x11a/0x130 net/socket.c:1040 sock_read_iter+0x176/0x220 net/socket.c:1118 call_read_iter include/linux/fs.h:1845 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x5e0/0x630 fs/read_write.c:470 ksys_read+0x163/0x1a0 fs/read_write.c:613 __do_sys_read fs/read_write.c:623 [inline] __se_sys_read fs/read_write.c:621 [inline] __x64_sys_read+0x41/0x50 fs/read_write.c:621 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
read to 0xffff88803c81f258 of 8 bytes by task 19183 on cpu 1:
sock_recv_cmsgs include/net/sock.h:2721 [inline] packet_recvmsg+0xb64/0xd00 net/packet/af_packet.c:3489 sock_recvmsg_nosec net/socket.c:1019 [inline] sock_recvmsg+0x11a/0x130 net/socket.c:1040 sock_read_iter+0x176/0x220 net/socket.c:1118 call_read_iter include/linux/fs.h:1845 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x5e0/0x630 fs/read_write.c:470 ksys_read+0x163/0x1a0 fs/read_write.c:613 __do_sys_read fs/read_write.c:623 [inline] __se_sys_read fs/read_write.c:621 [inline] __x64_sys_read+0x41/0x50 fs/read_write.c:621 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc
value changed: 0xffffffffc4653600 -> 0x0000000000000000
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 19183 Comm: syz-executor.5 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
--- include/net/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/sock.h +1 -1
@@ -2623,7 +2623,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,__sock_recv_ts_and_drops (msg, sk, skb); else if (unlikely(sock_flag(sk, SOCK_TIMESTAMP))) sock_write_timestamp(sk, skb->tstamp); - else if (unlikely(sk->sk_stamp == SK_DEFAULT_STAMP)) + else if (unlikely(sock_read_timestamp(sk) == SK_DEFAULT_STAMP)) sock_write_timestamp(sk, 0); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainercover 5.15.113-rc1 review
This is the start of the stable review cycle for the 5.15.113 release. There are 203 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, 24 May 2023 19:03:25 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.113-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.15.113-rc1
Ping Cheng <[email protected]>
HID: wacom: add three styli to wacom_intuos_get_tool_type
Ping Cheng <[email protected]>
HID: wacom: Add new Intuos Pro Small (PTH-460) device IDs
Jason Gerecke <[email protected]>
HID: wacom: Force pen out of prox if no events have been received in a while
Heiko Carstens <[email protected]>
s390/qdio: fix do_sqbs() inline assembly constraint
Ryusuke Konishi <[email protected]>
nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()
Michael Ellerman <[email protected]>
powerpc/64s/radix: Fix soft dirty tracking
Jerry Snitselaar <[email protected]>
tpm/tpm_tis: Disable interrupts for more Lenovo devices
Gaurav Batra <[email protected]>
powerpc/iommu: Incorrect DDW Table is referenced for SR-IOV device
Xiubo Li <[email protected]>
ceph: force updating the msg pointer in non-split case
George Kennedy <[email protected]>
vc_screen: reload load of struct vc_data pointer in vcs_write() to avoid UAF
Mario Limonciello <[email protected]>
thunderbolt: Clear registers properly when auto clear isn't in use
Krzysztof Kozlowski <[email protected]>
serial: qcom-geni: fix enabling deactivated interrupt
Andrew Davis <[email protected]>
serial: 8250_exar: Add support for USR298x PCI Modems
Vitaliy Tomin <[email protected]>
serial: Add support for Advantech PCI-1611U card
Ilya Leoshkevich <[email protected]>
statfs: enforce statfs[64] structure initialization
Chih-Yen Chang <[email protected]>
ksmbd: fix global-out-of-bounds in smb2_find_context_vals
Chih-Yen Chang <[email protected]>
ksmbd: fix wrong UserName check in session_user
Chih-Yen Chang <[email protected]>
ksmbd: allocate one more byte for implied bcc[0]
Gustav Johansson <[email protected]>
ksmbd: smb2: Allow messages padded to 8byte boundary
Bharath SM <[email protected]>
SMB3: drop reference to cfile before sending oplock break
Bharath SM <[email protected]>
SMB3: Close all deferred handles of inode in case of handle lease break
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Disable interrupts in probe error path
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Do not send EFLUSH command on TFD interrupt
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Clear listen-only bit if not explicitly requested
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Empty SRB buffer in probe
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Call request_irq() before enabling interrupts
Jimmy Assarsson <[email protected]>
can: kvaser_pciefd: Set CAN_STATE_STOPPED in kvaser_pciefd_stop()
Oliver Hartkopp <[email protected]>
can: isotp: recvmsg(): allow MSG_CMSG_COMPAT flag
Oliver Hartkopp <[email protected]>
can: j1939: recvmsg(): allow MSG_CMSG_COMPAT flag
Luke D. Jones <[email protected]>
ALSA: hda/realtek: Add quirk for 2nd ASUS GU603
Ai Chao <[email protected]>
ALSA: hda/realtek: Add a quirk for HP EliteDesk 805
Jeremy Soller <[email protected]>
ALSA: hda/realtek: Add quirk for Clevo L140AU
Nikhil Mahale <[email protected]>
ALSA: hda: Add NVIDIA codec IDs a3 through a7 to patch table
Takashi Iwai <[email protected]>
ALSA: hda: Fix Oops by 9.1 surround channel names
Mathias Nyman <[email protected]>
xhci: Fix incorrect tracking of free space on transfer rings
Mario Limonciello <[email protected]>
xhci-pci: Only run d3cold avoidance quirk for s2idle
Badhri Jagan Sridharan <[email protected]>
usb: typec: altmodes/displayport: fix pin_assignment_show
Konrad Gräfe <[email protected]>
usb: gadget: u_ether: Fix host MAC address case
Udipto Goswami <[email protected]>
usb: dwc3: debugfs: Resume dwc3 before accessing registers
Weitao Wang <[email protected]>
USB: UHCI: adjust zhaoxin UHCI controllers OverCurrent bit value
Maxime Bizon <[email protected]>
usb-storage: fix deadlock when a scsi command timeouts more than once
Alan Stern <[email protected]>
USB: usbtmc: Fix direction for 0-length ioctl control messages
Takashi Iwai <[email protected]>
ALSA: usb-audio: Add a sample rate workaround for Line6 Pod Go
Arnd Bergmann <[email protected]>
bridge: always declare tunnel functions
Florian Westphal <[email protected]>
netfilter: nft_set_rbtree: fix null deref on element insertion
Florian Westphal <[email protected]>
netfilter: nf_tables: fix nft_trans type confusion
Eric Dumazet <[email protected]>
vlan: fix a potential uninit-value in vlan_dev_hard_start_xmit()
Aleksandr Loktionov <[email protected]>
igb: fix bit_shift to be in [1..8] range
Marco Migliore <[email protected]>
net: dsa: mv88e6xxx: Fix mv88e6393x EPC write command offset
Christophe JAILLET <[email protected]>
cassini: Fix a memory leak in the error handling path of cas_init_one()
Michael Kelley <[email protected]>
scsi: storvsc: Don't pass unused PFNs to Hyper-V host
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: don't trust firmware n_channels
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: fix cancel_delayed_work_sync() deadlock
Johannes Berg <[email protected]>
wifi: mac80211: fix min center freq offset tracing
Florian Fainelli <[email protected]>
net: bcmgenet: Restore phy_stop() depending upon suspend/close
Florian Fainelli <[email protected]>
net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()
Vineeth Vijayan <[email protected]>
s390/cio: include subchannels without devices also for evaluation
Xin Long <[email protected]>
tipc: check the bearer min mtu properly when setting it by netlink
Xin Long <[email protected]>
tipc: do not update mtu if msg_max is too small in mtu negotiation
Xin Long <[email protected]>
tipc: add tipc_bearer_min_mtu to calculate min mtu
Feng Liu <[email protected]>
virtio_net: Fix error unwinding of XDP initialization
Parav Pandit <[email protected]>
virtio-net: Maintain reverse cleanup order
Dong Chenchen <[email protected]>
net: nsh: Use correct mac_offset to unwind gso skb in nsh_gso_segment()
Arnd Bergmann <[email protected]>
drm/exynos: fix g2d_open/close helper function definitions
Chuck Lever <[email protected]>
SUNRPC: Fix trace_svc_register() call site
NeilBrown <[email protected]>
SUNRPC: always free ctxt when freeing deferred request
Chuck Lever <[email protected]>
SUNRPC: Remove svc_rqst::rq_xprt_hlen
Chuck Lever <[email protected]>
SUNRPC: Remove dead code in svc_tcp_release_rqst()
Chuck Lever <[email protected]>
SUNRPC: Clean up svc_deferred_class trace events
Chuck Lever <[email protected]>
tracing: Introduce helpers to safely handle dynamic-sized sockaddrs
NeilBrown <[email protected]>
SUNRPC: double free xprt_ctxt while still in use
Duoming Zhou <[email protected]>
media: netup_unidvb: fix use-after-free at del_timer()
Jie Wang <[email protected]>
net: hns3: fix reset delay time to avoid configuration timeout
Jijie Shao <[email protected]>
net: hns3: fix sending pfc frames after reset issue
Jie Wang <[email protected]>
net: hns3: fix output information incomplete for dumping tx queue info with debugfs
Xin Long <[email protected]>
erspan: get the proto with the md version for collect_md
Doug Berger <[email protected]>
serial: 8250_bcm7271: fix leak in `brcmuart_probe`
Doug Berger <[email protected]>
serial: 8250_bcm7271: balance clk_enable calls
Ke Zhang <[email protected]>
serial: arc_uart: fix of_iomap leak in arc_serial_probe
Eric Dumazet <[email protected]>
tcp: fix possible sk_priority leak in tcp_v4_send_reset()
Zhuang Shengen <[email protected]>
vsock: avoid to close connected socket after the timeout
Ryan C. Underwood <[email protected]>
ALSA: hda/realtek: Apply HP B&O top speaker profile to Pavilion 15
Dan Carpenter <[email protected]>
ALSA: firewire-digi00x: prevent potential use after free
Grygorii Strashko <[email protected]>
net: phy: dp83867: add w/a for packet errors seen with short cables
Uwe Kleine-König <[email protected]>
net: fec: Better handle pm_runtime_get() failing in .remove()
Andrea Mayer <[email protected]>
selftets: seg6: disable rp_filter by default in srv6_end_dt4_l3vpn_test
Andrea Mayer <[email protected]>
selftests: seg6: disable DAD on IPv6 router cfg for srv6_end_dt4_l3vpn_test
Tobias Brunner <[email protected]>
af_key: Reject optional tunnel/BEET mode templates in outbound policies
Wyes Karny <[email protected]>
cpupower: Make TSC read per CPU for Mperf monitor
Shengjiu Wang <[email protected]>
ASoC: fsl_micfil: Fix error handler with pm_runtime_enable
Jianhua Lu <[email protected]>
dt-bindings: display/msm: dsi-controller-main: Document qcom, master-dsi and qcom, sync-dual-dsi
Marijn Suijten <[email protected]>
drm/msm/dpu: Remove duplicate register defines from INTF
Marijn Suijten <[email protected]>
drm/msm/dpu: Move non-MDP_TOP INTF_INTR offsets out of hwio header
Bjorn Andersson <[email protected]>
drm/msm/dpu: Add INTF_5 interrupts
Srinivas Kandagatla <[email protected]>
drm/msm/dp: unregister audio driver during unbind
Martin Willi <[email protected]>
Revert "Fix XFRM-I support for nested ESP tunnels"
Sabrina Dubroca <[email protected]>
xfrm: don't check the default policy if the policy allows the packet
Fae <[email protected]>
platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct
Jorge Lopez <[email protected]>
platform/x86: Move existing HP drivers to a new hp subdir
Daniel Houldsworth <[email protected]>
platform/x86: hp-wmi: Support touchpad on/off
Guilherme G. Piccoli <[email protected]>
parisc: Replace regular spinlock with spin_trylock on panic path
Qiang Ning <[email protected]>
mfd: dln2: Fix memory leak in dln2_probe()
Krzysztof Kozlowski <[email protected]>
soundwire: qcom: gracefully handle too many ports in DT
Alain Volmat <[email protected]>
phy: st: miphy28lp: use _poll_timeout functions for waits
Vicki Pfau <[email protected]>
Input: xpad - add constants for GIP interface numbers
Chunyan Zhang <[email protected]>
iommu/sprd: Release dma buffer to avoid memory leak
Tomas Krcka <[email protected]>
iommu/arm-smmu-v3: Acknowledge pri/event queue overflow if any
Arnd Bergmann <[email protected]>
clk: tegra20: fix gcc-7 constant overflow warning
Jia-Ju Bai <[email protected]>
fs/ntfs3: Fix a possible null-pointer dereference in ni_clear()
Edward Lo <[email protected]>
fs/ntfs3: Add length check in indx_get_root
Edward Lo <[email protected]>
fs/ntfs3: Validate MFT flags before replaying logs
Abdun Nihaal <[email protected]>
fs/ntfs3: Fix NULL dereference in ni_write_inode
Edward Lo <[email protected]>
fs/ntfs3: Enhance the attribute size check
Ye Bin <[email protected]>
fs/ntfs3: Fix NULL pointer dereference in 'ni_write_inode'
Manivannan Sadhasivam <[email protected]>
iommu/arm-smmu-qcom: Limit the SMR groups to 128
Gustavo A. R. Silva <[email protected]>
RDMA/core: Fix multiple -Warray-bounds warnings
Hao Zeng <[email protected]>
recordmcount: Fix memory leaks in the uwrite function
Josh Poimboeuf <[email protected]>
sched: Fix KCSAN noinstr violation
Rodríguez Barbarin, José Javier <[email protected]>
mcb-pci: Reallocate memory region to avoid memory overlapping
Tony Lindgren <[email protected]>
serial: 8250: Reinit port->pm on port specific driver unbind
Frank Wang <[email protected]>
usb: typec: tcpm: fix multiple times discover svids error
Jason Gerecke <[email protected]>
HID: wacom: generic: Set battery quirk only when we see battery data
Kevin Groeneveld <[email protected]>
spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3
Bastien Nocera <[email protected]>
HID: logitech-hidpp: Reconcile USB and Unifying serials
Bastien Nocera <[email protected]>
HID: logitech-hidpp: Don't use the USB serial for USB devices
Philipp Hortmann <[email protected]>
staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE
Min Li <[email protected]>
Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp
Hans de Goede <[email protected]>
Bluetooth: hci_bcm: Fall back to getting bdaddr from EFI if not set
Chethan T N <[email protected]>
Bluetooth: btintel: Add LE States quirk support
Simon Horman <[email protected]>
ipvs: Update width of source for ip_vs_sync_conn_options
Zhong Jinghua <[email protected]>
nbd: fix incomplete validation of ioctl arg
Nagarajan Maran <[email protected]>
wifi: ath11k: Fix SKB corruption in REO destination ring
Hans de Goede <[email protected]>
wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace
Chaitanya Kulkarni <[email protected]>
null_blk: Always check queue mode setting from configfs
Hyunwoo Kim <[email protected]>
wifi: iwlwifi: pcie: Fix integer overflow in iwl_write_to_user_buf
Daniel Gabay <[email protected]>
wifi: iwlwifi: pcie: fix possible NULL pointer dereference
Yafang <[email protected]>
bpf: Add preempt_count_{sub,add} into btf id deny list
Hao Zeng <[email protected]>
samples/bpf: Fix fout leak in hbm's run_bpf_prog
Chao Yu <[email protected]>
f2fs: fix to check readonly condition correctly
Chao Yu <[email protected]>
f2fs: fix to drop all dirty pages during umount() if cp_error is set
Ojaswin Mujoo <[email protected]>
ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
Kemeng Shi <[email protected]>
ext4: set goal start correctly in ext4_mb_normalize_request
Adrian Hunter <[email protected]>
scsi: ufs: ufs-pci: Add support for Intel Lunar Lake
Andreas Gruenbacher <[email protected]>
gfs2: Fix inode height consistency check
Zheng Wang <[email protected]>
scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition
Eli Cohen <[email protected]>
lib: cpu_rmap: Avoid use after free on rmap->obj array entries
Dmitry Bogdanov <[email protected]>
scsi: target: iscsit: Free cmds before session free
Nick Child <[email protected]>
net: Catch invalid index in XPS mapping
Nathan Chancellor <[email protected]>
net: pasemi: Fix return type of pasemi_mac_start_tx()
Maxim Korotkov <[email protected]>
bnxt: avoid overflow in bnxt_get_nvram_directory()
Justin Tee <[email protected]>
scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow
Jan Kara <[email protected]>
ext2: Check block size validity during mount
Hector Martin <[email protected]>
wifi: brcmfmac: cfg80211: Pass the PMK in binary instead of hex
Kumar Kartikeya Dwivedi <[email protected]>
bpf: Annotate data races in bpf_local_storage
Kees Cook <[email protected]>
wifi: ath: Silence memcpy run-time false positive warning
Laurent Pinchart <[email protected]>
media: Prefer designated initializers over memset for subdev pad ops
Mario Limonciello <[email protected]>
drm/amd: Fix an out of bounds error in BIOS parser
void0red <[email protected]>
ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
Tamir Duberstein <[email protected]>
ACPICA: Avoid undefined behavior: applying zero offset to null pointer
Douglas Anderson <[email protected]>
drm/msm/dp: Clean up handling of DP AUX interrupts
Nur Hussein <[email protected]>
drm/tegra: Avoid potential 32-bit integer overflow
Arnaud Pouliquen <[email protected]>
remoteproc: stm32_rproc: Add mutex protection for workqueue
Armin Wolf <[email protected]>
ACPI: EC: Fix oops when removing custom query handlers
Pierre Gondois <[email protected]>
firmware: arm_sdei: Fix sleep from invalid context BUG
Zheng Wang <[email protected]>
memstick: r592: Fix UAF bug in r592_remove due to race condition
harperchen <[email protected]>
media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish
harperchen <[email protected]>
media: cx23885: Fix a null-ptr-deref bug in buffer_prepare() and buffer_finish()
Konrad Dybcio <[email protected]>
arm64: dts: qcom: msm8996: Add missing DWC3 quirks
Alexander Stein <[email protected]>
regmap: cache: Return error in cache sync operations for REGCACHE_NONE
Rodrigo Siqueira <[email protected]>
drm/amd/display: Use DC_LOG_DC in the trasform pixel function
Jani Nikula <[email protected]>
drm/displayid: add displayid_get_header() and check bounds better
Tetsuo Handa <[email protected]>
fs: hfsplus: remove WARN_ON() from hfsplus_cat_{read,write}_inode()
Zqiang <[email protected]>
rcu: Protect rcu_print_task_exp_stall() ->exp_tasks access
Paul E. McKenney <[email protected]>
refscale: Move shutdown from wait_event() to wait_event_idle()
Theodore Ts'o <[email protected]>
ext4: allow ext4_get_group_info() to fail
Kemeng Shi <[email protected]>
ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set
Jan Kara <[email protected]>
ext4: fix lockdep warning when enabling MMP
Theodore Ts'o <[email protected]>
ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled
Theodore Ts'o <[email protected]>
ext4: reflect error codes from ext4_multi_mount_protect() to its callers
Austin Kim <[email protected]>
ext4: remove an unused variable warning with CONFIG_QUOTA=n
Zongjie Li <[email protected]>
fbdev: arcfb: Fix error handling in arcfb_probe()
Nikita Zhandarovich <[email protected]>
drm/i915/dp: prevent potential div-by-zero
Kuniyuki Iwashima <[email protected]>
af_unix: Fix data races around sk->sk_shutdown.
Kuniyuki Iwashima <[email protected]>
af_unix: Fix a data race of sk->sk_receive_queue->qlen.
Eric Dumazet <[email protected]>
net: datagram: fix data-races in datagram_poll()
t.feng <[email protected]>
ipvlan:Fix out-of-bounds caused by unclear skb->cb
Ziwei Xiao <[email protected]>
gve: Remove the code of clearing PBA bit
Eric Dumazet <[email protected]>
tcp: add annotations around sk->sk_shutdown accesses
Eric Dumazet <[email protected]>
net: add vlan_get_protocol_and_depth() helper
Eric Dumazet <[email protected]>
net: deal with most data-races in sk_wait_event()
Eric Dumazet <[email protected]>
net: annotate sk->sk_err write from do_recvmmsg()
Eric Dumazet <[email protected]>
netlink: annotate accesses to nlk->cb_running
Florian Westphal <[email protected]>
netfilter: conntrack: fix possible bug_on with enable_hooks=1
Florian Westphal <[email protected]>
netfilter: nf_tables: always release netdev hooks from notifier
Kuniyuki Iwashima <[email protected]>
net: Fix load-tearing on sk->sk_stamp in sock_recv_cmsgs().
Marek Vasut <[email protected]>
net: stmmac: Initialize MAC_ONEUS_TIC_COUNTER register
Wong Vee Khee <[email protected]>
net: stmmac: switch to use interrupt for hw crosstimestamping
Roy Novich <[email protected]>
linux/dim: Do nothing if no time delta between samples
Thomas Gleixner <[email protected]>
tick/broadcast: Make broadcast device replacement work correctly
Keoseong Park <[email protected]>
scsi: ufs: core: Fix I/O hang that occurs when BKOPS fails in W-LUN suspend
Christophe JAILLET <[email protected]>
net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
Randy Dunlap <[email protected]>
ARM: 9296/1: HP Jornada 7XX: fix kernel-doc warnings
Saravana Kannan <[email protected]>
drm/mipi-dsi: Set the fwnode for mipi_dsi_device
-------------
Diffstat:
.../bindings/display/msm/dsi-controller-main.yaml | 12 ++
MAINTAINERS | 4 +-
Makefile | 4 +-
arch/arm/mach-sa1100/jornada720_ssp.c | 5 +-
arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 +
arch/parisc/include/asm/pdc.h | 1 +
arch/parisc/kernel/firmware.c | 27 ++++-
arch/powerpc/kernel/dma-iommu.c | 4 +-
arch/powerpc/mm/book3s64/radix_pgtable.c | 4 +-
arch/powerpc/platforms/pseries/iommu.c | 13 +-
drivers/acpi/acpica/dbnames.c | 3 +
drivers/acpi/acpica/dswstate.c | 11 +-
drivers/acpi/ec.c | 1 +
drivers/base/regmap/regcache.c | 6 +
drivers/block/nbd.c | 6 +
drivers/block/null_blk/main.c | 5 +
drivers/bluetooth/btbcm.c | 47 +++++++-
drivers/bluetooth/btintel.c | 5 +-
drivers/char/tpm/tpm_tis.c | 16 +++
drivers/clk/tegra/clk-tegra20.c | 28 ++---
drivers/firmware/arm_sdei.c | 37 +++---
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 7 +-
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 5 +-
drivers/gpu/drm/drm_displayid.c | 17 ++-
drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
drivers/gpu/drm/exynos/exynos_drm_g2d.h | 4 +-
drivers/gpu/drm/i915/display/intel_dp.c | 5 +
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 11 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 1 +
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 5 -
drivers/gpu/drm/msm/disp/dpu1/dpu_hwio.h | 3 -
drivers/gpu/drm/msm/dp/dp_audio.c | 12 ++
drivers/gpu/drm/msm/dp/dp_audio.h | 2 +
drivers/gpu/drm/msm/dp/dp_aux.c | 80 ++++++-------
drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +-
drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +-
drivers/gpu/drm/msm/dp/dp_display.c | 1 +
drivers/gpu/drm/tegra/sor.c | 2 +-
drivers/hid/hid-logitech-hidpp.c | 53 ++++++++-
drivers/hid/wacom.h | 3 +
drivers/hid/wacom_sys.c | 2 +
drivers/hid/wacom_wac.c | 80 +++++++++----
drivers/infiniband/core/user_mad.c | 23 ++--
drivers/input/joystick/xpad.c | 5 +-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 19 ++-
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 16 ++-
drivers/iommu/sprd-iommu.c | 29 +++--
drivers/mcb/mcb-pci.c | 27 ++++-
drivers/media/pci/cx23885/cx23885-core.c | 4 +-
drivers/media/pci/cx23885/cx23885-video.c | 13 +-
drivers/media/pci/netup_unidvb/netup_unidvb_core.c | 2 +-
drivers/media/pci/tw68/tw68-video.c | 16 +--
drivers/media/platform/am437x/am437x-vpfe.c | 15 +--
drivers/media/platform/exynos4-is/fimc-capture.c | 7 +-
drivers/media/platform/ti-vpe/cal-video.c | 8 +-
drivers/media/platform/vsp1/vsp1_drm.c | 18 +--
drivers/media/platform/vsp1/vsp1_entity.c | 11 +-
drivers/media/usb/dvb-usb/cxusb-analog.c | 14 +--
drivers/memstick/host/r592.c | 2 +-
drivers/message/fusion/mptlan.c | 2 +
drivers/mfd/dln2.c | 1 +
drivers/net/can/kvaser_pciefd.c | 51 ++++----
drivers/net/dsa/mv88e6xxx/port.h | 2 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 +-
drivers/net/ethernet/freescale/fec_main.c | 15 ++-
drivers/net/ethernet/google/gve/gve_main.c | 13 --
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +-
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h | 1 +
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 ++-
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 +-
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 5 +
.../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 5 +-
drivers/net/ethernet/intel/igb/e1000_mac.c | 4 +-
drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 25 ++--
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 4 +-
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 9 ++
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
.../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 5 +
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 12 +-
drivers/net/ethernet/sun/cassini.c | 2 +
drivers/net/ipvlan/ipvlan_core.c | 6 +
drivers/net/mdio/mdio-mvusb.c | 11 +-
drivers/net/phy/dp83867.c | 22 +++-
drivers/net/tap.c | 4 +-
drivers/net/virtio_net.c | 61 +++++++---
drivers/net/wireless/ath/ath.h | 12 +-
drivers/net/wireless/ath/ath11k/dp_rx.c | 9 +-
drivers/net/wireless/ath/key.c | 2 +-
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +-
drivers/net/wireless/intel/iwlwifi/dvm/sta.c | 5 +-
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 10 ++
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 2 +-
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 3 +
drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +-
drivers/parisc/power.c | 16 ++-
drivers/phy/st/phy-miphy28lp.c | 42 ++-----
drivers/platform/x86/Kconfig | 42 +------
drivers/platform/x86/Makefile | 4 +-
drivers/platform/x86/hp/Kconfig | 63 ++++++++++
drivers/platform/x86/hp/Makefile | 10 ++
drivers/platform/x86/{ => hp}/hp-wmi.c | 21 ++--
drivers/platform/x86/{ => hp}/hp_accel.c | 2 +-
drivers/platform/x86/{ => hp}/tc1100-wmi.c | 0
drivers/remoteproc/stm32_rproc.c | 8 ++
drivers/s390/cio/device.c | 2 +
drivers/s390/cio/qdio.h | 2 +-
drivers/scsi/lpfc/lpfc_debugfs.c | 7 +-
drivers/scsi/storvsc_drv.c | 8 +-
drivers/scsi/ufs/ufshcd-pci.c | 1 +
drivers/scsi/ufs/ufshcd.c | 10 +-
drivers/soundwire/qcom.c | 3 +
drivers/spi/spi-imx.c | 24 +++-
drivers/staging/media/imx/imx-media-capture.c | 12 +-
drivers/staging/media/imx/imx-media-utils.c | 8 +-
drivers/staging/media/omap4iss/iss_video.c | 6 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 5 -
drivers/target/iscsi/iscsi_target.c | 6 +-
drivers/thunderbolt/nhi.c | 29 ++++-
drivers/thunderbolt/nhi_regs.h | 2 +
drivers/tty/serial/8250/8250_bcm7271.c | 7 +-
drivers/tty/serial/8250/8250_core.c | 1 +
drivers/tty/serial/8250/8250_exar.c | 17 +++
drivers/tty/serial/8250/8250_pci.c | 5 +
drivers/tty/serial/arc_uart.c | 7 +-
drivers/tty/serial/qcom_geni_serial.c | 9 +-
drivers/tty/vt/vc_screen.c | 11 +-
drivers/usb/class/usbtmc.c | 2 +
drivers/usb/dwc3/debugfs.c | 109 +++++++++++++++++
drivers/usb/gadget/function/u_ether.c | 3 +
drivers/usb/host/uhci-pci.c | 10 +-
drivers/usb/host/xhci-pci.c | 12 +-
drivers/usb/host/xhci-ring.c | 29 ++++-
drivers/usb/host/xhci.h | 2 +-
drivers/usb/storage/scsiglue.c | 28 +++--
drivers/usb/typec/altmodes/displayport.c | 4 +
drivers/usb/typec/tcpm/tcpm.c | 16 ++-
drivers/video/fbdev/arcfb.c | 15 ++-
fs/ceph/snap.c | 13 ++
fs/cifs/cifsglob.h | 4 +-
fs/cifs/file.c | 26 ++--
fs/cifs/smb1ops.c | 9 +-
fs/cifs/smb2ops.c | 7 +-
fs/ext2/ext2.h | 1 +
fs/ext2/super.c | 7 ++
fs/ext4/balloc.c | 18 ++-
fs/ext4/ext4.h | 15 +--
fs/ext4/ialloc.c | 12 +-
fs/ext4/mballoc.c | 131 +++++++++++++++------
fs/ext4/mmp.c | 39 ++++--
fs/ext4/super.c | 28 +++--
fs/f2fs/checkpoint.c | 12 +-
fs/f2fs/data.c | 3 +-
fs/f2fs/f2fs.h | 5 +
fs/f2fs/super.c | 2 +-
fs/gfs2/glops.c | 3 +-
fs/hfsplus/inode.c | 28 ++++-
fs/ksmbd/connection.c | 3 +-
fs/ksmbd/oplock.c | 5 +-
fs/ksmbd/oplock.h | 2 +-
fs/ksmbd/smb2misc.c | 5 +-
fs/ksmbd/smb2pdu.c | 19 ++-
fs/nilfs2/inode.c | 18 +++
fs/ntfs3/frecord.c | 5 +-
fs/ntfs3/fsntfs.c | 1 +
fs/ntfs3/index.c | 11 +-
fs/ntfs3/inode.c | 6 +
fs/ntfs3/record.c | 9 +-
fs/statfs.c | 4 +-
include/linux/cpuhotplug.h | 1 -
include/linux/dim.h | 3 +-
include/linux/if_vlan.h | 17 +++
include/linux/sched/task_stack.h | 2 +-
include/linux/stmmac.h | 1 +
include/linux/sunrpc/svc.h | 2 -
include/linux/sunrpc/svc_rdma.h | 2 +-
include/linux/sunrpc/svc_xprt.h | 2 +-
include/net/ip_vs.h | 6 +-
include/net/sock.h | 2 +-
include/trace/bpf_probe.h | 6 +
include/trace/events/sunrpc.h | 12 +-
include/trace/perf.h | 6 +
include/trace/trace_events.h | 55 ++++++++-
kernel/bpf/bpf_local_storage.c | 16 ++-
kernel/bpf/verifier.c | 4 +
kernel/rcu/refscale.c | 2 +-
kernel/rcu/tree_exp.h | 6 +-
kernel/time/tick-broadcast.c | 120 ++++++++++++++-----
lib/cpu_rmap.c | 5 +-
lib/dim/dim.c | 5 +-
lib/dim/net_dim.c | 3 +-
lib/dim/rdma_dim.c | 3 +-
net/8021q/vlan_dev.c | 4 +-
net/bluetooth/l2cap_core.c | 1 -
net/bridge/br_forward.c | 2 +-
net/bridge/br_private_tunnel.h | 8 +-
net/can/isotp.c | 2 +-
net/can/j1939/socket.c | 2 +-
net/core/datagram.c | 15 ++-
net/core/dev.c | 4 +-
net/core/stream.c | 12 +-
net/ipv4/af_inet.c | 2 +-
net/ipv4/tcp.c | 14 ++-
net/ipv4/tcp_bpf.c | 2 +-
net/ipv4/tcp_input.c | 4 +-
net/ipv4/tcp_ipv4.c | 5 +-
net/ipv6/ip6_gre.c | 13 +-
net/key/af_key.c | 12 +-
net/llc/af_llc.c | 8 +-
net/mac80211/trace.h | 2 +-
net/netfilter/core.c | 6 +-
net/netfilter/ipvs/ip_vs_sync.c | 2 +-
net/netfilter/nf_conntrack_standalone.c | 3 +-
net/netfilter/nf_tables_api.c | 4 +-
net/netfilter/nft_chain_filter.c | 9 +-
net/netfilter/nft_set_rbtree.c | 20 ++--
net/netlink/af_netlink.c | 8 +-
net/nsh/nsh.c | 8 +-
net/packet/af_packet.c | 6 +-
net/smc/smc_close.c | 4 +-
net/smc/smc_rx.c | 4 +-
net/smc/smc_tx.c | 4 +-
net/socket.c | 2 +-
net/sunrpc/svc.c | 2 +-
net/sunrpc/svc_xprt.c | 34 ++++--
net/sunrpc/svcsock.c | 41 +++----
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 12 +-
net/sunrpc/xprtrdma/svc_rdma_transport.c | 2 +-
net/tipc/bearer.c | 17 ++-
net/tipc/bearer.h | 3 +
net/tipc/link.c | 9 +-
net/tipc/socket.c | 4 +-
net/tipc/udp_media.c | 5 +-
net/tls/tls_main.c | 3 +-
net/unix/af_unix.c | 22 ++--
net/vmw_vsock/af_vsock.c | 2 +-
net/xfrm/xfrm_interface.c | 54 +--------
net/xfrm/xfrm_policy.c | 9 --
samples/bpf/hbm.c | 1 +
scripts/recordmcount.c | 6 +-
sound/firewire/digi00x/digi00x-stream.c | 4 +-
sound/pci/hda/hda_generic.c | 7 +-
sound/pci/hda/patch_hdmi.c | 5 +
sound/pci/hda/patch_realtek.c | 5 +-
sound/soc/fsl/fsl_micfil.c | 14 ++-
sound/usb/format.c | 1 +
.../cpupower/utils/idle_monitor/mperf_monitor.c | 31 +++--
.../selftests/net/srv6_end_dt4_l3vpn_test.sh | 17 ++-
250 files changed, 2035 insertions(+), 948 deletions(-)Greg Kroah-Hartman
maintainerPATCH 27/203 ext4: fix lockdep warning when enabling MMP
From: Jan Kara <[email protected]>
[ Upstream commit 949f95ff39bf188e594e7ecd8e29b82eb108f5bf ]
When we enable MMP in ext4_multi_mount_protect() during mount or remount, we end up calling sb_start_write() from write_mmp_block(). This triggers lockdep warning because freeze protection ranks above s_umount semaphore we are holding during mount / remount. The problem is harmless because we are guaranteed the filesystem is not frozen during mount / remount but still let's fix the warning by not grabbing freeze protection from ext4_multi_mount_protect().
--- fs/ext4/mmp.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
fs/ext4/mmp.c +21 -9
@@ -39,28 +39,36 @@ static void ext4_mmp_csum_set(struct super_block *sb, struct mmp_struct *mmp)* Write the MMP block using REQ_SYNC to try to get the block on-disk * faster. */ -static int write_mmp_block (struct super_block *sb,struct buffer_head *bh) +static int write_mmp_block_thawed (struct super_block *sb, +struct buffer_head *bh) {struct mmp_struct *mmp = (struct mmp_struct *)(bh->b_data); -/* -* We protect against freezing so that we don't create dirty buffers -* on frozen filesystem. -*/ -sb_start_write (sb);ext4_mmp_csum_set (sb, mmp);lock_buffer (bh); bh->b_end_io = end_buffer_write_sync;get_bh (bh);submit_bh (REQ_OP_WRITE ,REQ_SYNC |REQ_META |REQ_PRIO , bh);wait_on_buffer (bh); -sb_end_write (sb);if (unlikely (!buffer_uptodate (bh)))return -EIO ; -return 0 ; } +static int write_mmp_block (struct super_block *sb,struct buffer_head *bh) +{ +int err; + +/* +* We protect against freezing so that we don't create dirty buffers +* on frozen filesystem. +*/ +sb_start_write (sb); + err =write_mmp_block_thawed (sb, bh); +sb_end_write (sb); +return err; +} +/* * Read the MMP block. It _must_ be read from disk and hence we clear the * uptodate flag on the buffer.
@@ -352,7 +360,11 @@ int ext4_multi_mount_protect(struct super_block *sb, seq =mmp_new_seq (); mmp->mmp_seq =cpu_to_le32 (seq); - retval =write_mmp_block (sb, bh); +/* +* On mount / remount we are protected against fs freezing (by s_umount +* semaphore) and grabbing freeze protection upsets lockdep +*/ + retval =write_mmp_block_thawed (sb, bh);if (retval) goto failed;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 36/203 arm64: dts: qcom: msm8996: Add missing DWC3 quirks
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit d0af0537e28f6eace02deed63b585396de939213 ]
Add missing dwc3 quirks from msm-3.18. Unfortunately, none of them make dwc3-qcom 6af8800.usb: HS-PHY not in L2 go away.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -0
@@ -2595,8 +2595,11 @@ interrupts = <0 131 IRQ_TYPE_LEVEL_HIGH>; phys = <&hsusb_phy1>, <&ssusb_phy_0>; phy-names = "usb2-phy", "usb3-phy"; + snps,hird-threshold = /bits/ 8 <0>; snps,dis_u2_susphy_quirk; snps,dis_enblslpm_quirk; + snps,is-utmi-l1-suspend; + tx-fifo-resize; }; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 37/203 media: cx23885: Fix a null-ptr-deref bug in buffer_prepare() and buffer_finish()
In reply to Greg Kroah-HartmanFrom: harperchen <[email protected]>
[ Upstream commit 47e8b73bc35d7c54642f78e498697692f6358996 ]
When the driver calls cx23885_risc_buffer() to prepare the buffer, the function call dma_alloc_coherent may fail, resulting in a empty buffer risc->cpu. Later when we free the buffer or access the buffer, null ptr deref is triggered.
This bug is similar to the following one:
https://git.linuxtv.org/media_stage.git/commit/?id=2b064d91440b33fba5b452f2d1b31f13ae911d71.
We believe the bug can be also dynamically triggered from user side. Similarly, we fix this by checking the return value of cx23885_risc_buffer() and the value of risc->cpu before buffer free.
--- drivers/media/pci/cx23885/cx23885-core.c | 4 +++- drivers/media/pci/cx23885/cx23885-video.c | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/media/pci/cx23885/cx23885-core.c +3 -1
@@ -1325,7 +1325,9 @@ void cx23885_free_buffer(struct cx23885_dev *dev, struct cx23885_buffer *buf) {struct cx23885_riscmem *risc = &buf->risc; -dma_free_coherent (&dev->pci->dev, risc->size, risc->cpu, risc->dma); +if (risc->cpu) +dma_free_coherent (&dev->pci->dev, risc->size, risc->cpu, risc->dma); +memset (risc,0 ,sizeof (*risc)); }static void cx23885_tsport_reg_dump (struct cx23885_tsport *port)
drivers/media/pci/cx23885/cx23885-video.c +7 -6
@@ -342,6 +342,7 @@ static int queue_setup(struct vb2_queue *q,static int buffer_prepare (struct vb2_buffer *vb) { +int ret;struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb);struct cx23885_dev *dev = vb->vb2_queue->drv_priv; struct cx23885_buffer *buf =
@@ -358,12 +359,12 @@ static int buffer_prepare(struct vb2_buffer *vb)switch (dev->field) {case V4L2_FIELD_TOP : -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl,0 ,UNSET , buf->bpl,0 , dev->height);break ;case V4L2_FIELD_BOTTOM : -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl,UNSET ,0 , buf->bpl,0 , dev->height);break ;
@@ -391,21 +392,21 @@ static int buffer_prepare(struct vb2_buffer *vb) line0_offset =0 ; line1_offset = buf->bpl; } -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl, line0_offset, line1_offset, buf->bpl, buf->bpl, dev->height >>1 );break ;case V4L2_FIELD_SEQ_TB : -cx23885_risc_buffer (dev->pci, &buf->risc, + ret =cx23885_risc_buffer (dev->pci, &buf->risc, sgt->sgl,0 , buf->bpl * (dev->height >>1 ), buf->bpl,0 , dev->height >>1 );break ;case V4L2_FIELD_SEQ_BT : - cx23885_risc_buffer(dev->pci, &buf->risc, + ret = cx23885_risc_buffer(dev->pci, &buf->risc, sgt->sgl, buf->bpl * (dev->height >> 1), 0, buf->bpl, 0,
@@ -418,7 +419,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf, buf->vb.vb2_buf.index, dev->width, dev->height, dev->fmt->depth, dev->fmt->fourcc, (unsigned long)buf->risc.dma); -return 0 ; +return ret; }static void buffer_finish (struct vb2_buffer *vb)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 38/203 media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish
In reply to Greg Kroah-HartmanFrom: harperchen <[email protected]>
[ Upstream commit 1634b7adcc5bef645b3666fdd564e5952a9e24e0 ]
When the driver calls tw68_risc_buffer() to prepare the buffer, the function call dma_alloc_coherent may fail, resulting in a empty buffer buf->cpu. Later when we free the buffer or access the buffer, null ptr deref is triggered.
This bug is similar to the following one:
https://git.linuxtv.org/media_stage.git/commit/?id=2b064d91440b33fba5b452f2d1b31f13ae911d71.
We believe the bug can be also dynamically triggered from user side. Similarly, we fix this by checking the return value of tw68_risc_buffer() and the value of buf->cpu before buffer free.
--- drivers/media/pci/tw68/tw68-video.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/media/pci/tw68/tw68-video.c +9 -7
@@ -437,6 +437,7 @@ static void tw68_buf_queue(struct vb2_buffer *vb)*/ static int tw68_buf_prepare (struct vb2_buffer *vb) { +int ret;struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb);struct vb2_queue *vq = vb->vb2_queue;struct tw68_dev *dev =vb2_get_drv_priv (vq);
@@ -452,30 +453,30 @@ static int tw68_buf_prepare(struct vb2_buffer *vb) bpl = (dev->width * dev->fmt->depth) >>3 ;switch (dev->field) {case V4L2_FIELD_TOP : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,0 ,UNSET , bpl,0 , dev->height);break ;case V4L2_FIELD_BOTTOM : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,UNSET ,0 , bpl,0 , dev->height);break ;case V4L2_FIELD_SEQ_TB : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,0 , bpl * (dev->height >>1 ), bpl,0 , dev->height >>1 );break ;case V4L2_FIELD_SEQ_BT : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl, bpl * (dev->height >>1 ),0 , bpl,0 , dev->height >>1 );break ;case V4L2_FIELD_INTERLACED :default : -tw68_risc_buffer (dev->pci, buf, dma->sgl, + ret =tw68_risc_buffer (dev->pci, buf, dma->sgl,0 , bpl, bpl, bpl, dev->height >>1 );break ; } -return 0 ; +return ret; }static void tw68_buf_finish (struct vb2_buffer *vb)
@@ -485,7 +486,8 @@ static void tw68_buf_finish(struct vb2_buffer *vb)struct tw68_dev *dev =vb2_get_drv_priv (vq); struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb); -dma_free_coherent (&dev->pci->dev, buf->size, buf->cpu, buf->dma); +if (buf->cpu) +dma_free_coherent (&dev->pci->dev, buf->size, buf->cpu, buf->dma); }static int tw68_start_streaming (struct vb2_queue *q,unsigned int count)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 39/203 memstick: r592: Fix UAF bug in r592_remove due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 63264422785021704c39b38f65a78ab9e4a186d7 ]
In r592_probe, dev->detect_timer was bound with r592_detect_timer. In r592_irq function, the timer function will be invoked by mod_timer.
If we remove the module which will call hantro_release to make cleanup, there may be a unfinished work. The possible sequence is as follows, which will cause a typical UAF bug.
Fix it by canceling the work before cleanup in r592_remove.
CPU0 CPU1
|r592_detect_timer
r592_remove |
memstick_free_host|
put_device; |
kfree(host); |
|
| queue_work
| &host->media_checker //use--- drivers/memstick/host/r592.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memstick/host/r592.c +1 -1
@@ -829,7 +829,7 @@ static void r592_remove(struct pci_dev *pdev)/* Stop the processing thread. That ensures that we won't take any more requests */ kthread_stop (dev->io_thread); - +del_timer_sync (&dev->detect_timer);r592_enable_device (dev, false);while (!error && dev->req) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 40/203 firmware: arm_sdei: Fix sleep from invalid context BUG
In reply to Greg Kroah-HartmanFrom: Pierre Gondois <[email protected]>
[ Upstream commit d2c48b2387eb89e0bf2a2e06e30987cf410acad4 ]
Running a preempt-rt (v6.2-rc3-rt1) based kernel on an Ampere Altra triggers:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46
in_atomic(): 0, irqs_disabled(): 128, non_block: 0, pid: 24, name: cpuhp/0
preempt_count: 0, expected: 0
RCU nest depth: 0, expected: 0
3 locks held by cpuhp/0/24:
#0: ffffda30217c70d0 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun+0x5c/0x248
#1: ffffda30217c7120 (cpuhp_state-up){+.+.}-{0:0}, at: cpuhp_thread_fun+0x5c/0x248
#2: ffffda3021c711f0 (sdei_list_lock){....}-{3:3}, at: sdei_cpuhp_up+0x3c/0x130
irq event stamp: 36
hardirqs last enabled at (35): [<ffffda301e85b7bc>] finish_task_switch+0xb4/0x2b0
hardirqs last disabled at (36): [<ffffda301e812fec>] cpuhp_thread_fun+0x21c/0x248
softirqs last enabled at (0): [<ffffda301e80b184>] copy_process+0x63c/0x1ac0
softirqs last disabled at (0): [<0000000000000000>] 0x0
CPU: 0 PID: 24 Comm: cpuhp/0 Not tainted 5.19.0-rc3-rt5-[...]
Hardware name: WIWYNN Mt.Jade Server [...]
Call trace:
dump_backtrace+0x114/0x120
show_stack+0x20/0x70
dump_stack_lvl+0x9c/0xd8
dump_stack+0x18/0x34
__might_resched+0x188/0x228
rt_spin_lock+0x70/0x120
sdei_cpuhp_up+0x3c/0x130
cpuhp_invoke_callback+0x250/0xf08
cpuhp_thread_fun+0x120/0x248
smpboot_thread_fn+0x280/0x320
kthread+0x130/0x140
ret_from_fork+0x10/0x20sdei_cpuhp_up() is called in the STARTING hotplug section, which runs with interrupts disabled. Use a CPUHP_AP_ONLINE_DYN entry instead to execute the cpuhp cb later, with preemption enabled.
SDEI originally got its own cpuhp slot to allow interacting with perf. It got superseded by pNMI and this early slot is not relevant anymore. [1]
Some SDEI calls (e.g. SDEI_1_0_FN_SDEI_PE_MASK) take actions on the calling CPU. It is checked that preemption is disabled for them. _ONLINE cpuhp cb are executed in the 'per CPU hotplug thread'. Preemption is enabled in those threads, but their cpumask is limited to 1 CPU.
Move 'WARN_ON_ONCE(preemptible())' statements so that SDEI cpuhp cb don't trigger them.
Also add a check for the SDEI_1_0_FN_SDEI_PRIVATE_RESET SDEI call which acts on the calling CPU.
[1]:
https://lore.kernel.org/all/[email protected]/
--- drivers/firmware/arm_sdei.c | 37 ++++++++++++++++++++----------------- include/linux/cpuhotplug.h | 1 - 2 files changed, 20 insertions(+), 18 deletions(-)
drivers/firmware/arm_sdei.c +20 -17
@@ -43,6 +43,8 @@ static asmlinkage void (*sdei_firmware_call)(unsigned long function_id,/* entry point from firmware to arch asm code */ static unsigned long sdei_entry_point; +static int sdei_hp_state; +struct sdei_event {/* These three are protected by the sdei_list_lock */ struct list_head list;
@@ -301,8 +303,6 @@ int sdei_mask_local_cpu(void) {int err; -WARN_ON_ONCE (preemptible ()); - err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_PE_MASK ,0 ,0 ,0 ,0 ,0 ,NULL );if (err && err != -EIO ) { pr_warn_once("failed to mask CPU[%u]: %d\n",
@@ -315,6 +315,7 @@ int sdei_mask_local_cpu(void)static void _ipi_mask_cpu (void *ignored) { +WARN_ON_ONCE (preemptible ());sdei_mask_local_cpu (); }
@@ -322,8 +323,6 @@ int sdei_unmask_local_cpu(void) {int err; -WARN_ON_ONCE (preemptible ()); - err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_PE_UNMASK ,0 ,0 ,0 ,0 ,0 ,NULL );if (err && err != -EIO ) { pr_warn_once("failed to unmask CPU[%u]: %d\n",
@@ -336,6 +335,7 @@ int sdei_unmask_local_cpu(void)static void _ipi_unmask_cpu (void *ignored) { +WARN_ON_ONCE (preemptible ());sdei_unmask_local_cpu (); }
@@ -343,6 +343,8 @@ static void _ipi_private_reset(void *ignored) {int err; +WARN_ON_ONCE (preemptible ()); + err =invoke_sdei_fn (SDEI_1_0_FN_SDEI_PRIVATE_RESET ,0 ,0 ,0 ,0 ,0 ,NULL );if (err && err != -EIO )
@@ -389,8 +391,6 @@ static void _local_event_enable(void *data)int err;struct sdei_crosscall_args *arg = data; -WARN_ON_ONCE (preemptible ()); - err =sdei_api_event_enable (arg->event->event_num);sdei_cross_call_return (arg, err);
@@ -479,8 +479,6 @@ static void _local_event_unregister(void *data)int err;struct sdei_crosscall_args *arg = data; -WARN_ON_ONCE (preemptible ()); - err =sdei_api_event_unregister (arg->event->event_num);sdei_cross_call_return (arg, err);
@@ -561,8 +559,6 @@ static void _local_event_register(void *data)struct sdei_registered_event *reg;struct sdei_crosscall_args *arg = data; -WARN_ON (preemptible ()); - reg =per_cpu_ptr (arg->event->private_registered,smp_processor_id ()); err =sdei_api_event_register (arg->event->event_num, sdei_entry_point, reg,0 ,0 );
@@ -717,6 +713,8 @@ static int sdei_pm_notifier(struct notifier_block *nb, unsigned long action, {int rv; +WARN_ON_ONCE (preemptible ()); +switch (action) {case CPU_PM_ENTER : rv =sdei_mask_local_cpu ();
@@ -765,7 +763,7 @@ static int sdei_device_freeze(struct device *dev)int err;/* unregister private events */ -cpuhp_remove_state (CPUHP_AP_ARM_SDEI_STARTING ); +cpuhp_remove_state (sdei_entry_point); err =sdei_unregister_shared ();if (err)
@@ -786,12 +784,15 @@ static int sdei_device_thaw(struct device *dev)return err; } - err =cpuhp_setup_state (CPUHP_AP_ARM_SDEI_STARTING ,"SDEI" , + err =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"SDEI" , &sdei_cpuhp_up, &sdei_cpuhp_down); -if (err) +if (err <0 ) {pr_warn ("Failed to re-register CPU hotplug notifier...\n" ); +return err; + } -return err; + sdei_hp_state = err; +return 0 ; }static int sdei_device_restore (struct device *dev)
@@ -823,7 +824,7 @@ static int sdei_reboot_notifier(struct notifier_block *nb, unsigned long action,* We are going to reset the interface, after this there is no point * doing work when we take CPUs offline. */ -cpuhp_remove_state (CPUHP_AP_ARM_SDEI_STARTING ); +cpuhp_remove_state (sdei_hp_state);sdei_platform_reset ();
@@ -1003,13 +1004,15 @@ static int sdei_probe(struct platform_device *pdev) goto remove_cpupm; } - err =cpuhp_setup_state (CPUHP_AP_ARM_SDEI_STARTING ,"SDEI" , + err =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"SDEI" , &sdei_cpuhp_up, &sdei_cpuhp_down); -if (err) { +if (err <0 ) {pr_warn ("Failed to register CPU hotplug notifier...\n" ); goto remove_reboot; } + sdei_hp_state = err; +return 0 ; remove_reboot:
include/linux/cpuhotplug.h +0 -1
@@ -159,7 +159,6 @@ enum cpuhp_state {CPUHP_AP_PERF_X86_CSTATE_STARTING ,CPUHP_AP_PERF_XTENSA_STARTING ,CPUHP_AP_MIPS_OP_LOONGSON3_STARTING , -CPUHP_AP_ARM_SDEI_STARTING ,CPUHP_AP_ARM_VFP_STARTING ,CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING , CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 41/203 ACPI: EC: Fix oops when removing custom query handlers
In reply to Greg Kroah-HartmanFrom: Armin Wolf <[email protected]>
[ Upstream commit e5b492c6bb900fcf9722e05f4a10924410e170c1 ]
When removing custom query handlers, the handler might still be used inside the EC query workqueue, causing a kernel oops if the module holding the callback function was already unloaded.
Fix this by flushing the EC query workqueue when removing custom query handlers.
Tested on a Acer Travelmate 4002WLMi
--- drivers/acpi/ec.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/ec.c +1 -0
@@ -1101,6 +1101,7 @@ static void acpi_ec_remove_query_handlers(struct acpi_ec *ec,void acpi_ec_remove_query_handler (struct acpi_ec *ec,u8 query_bit) {acpi_ec_remove_query_handlers (ec, false, query_bit); +flush_workqueue (ec_query_wq); }EXPORT_SYMBOL_GPL (acpi_ec_remove_query_handler);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 42/203 remoteproc: stm32_rproc: Add mutex protection for workqueue
In reply to Greg Kroah-HartmanFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit 35bdafda40cc343ad2ba2cce105eba03a70241cc ]
The workqueue may execute late even after remoteproc is stopped or stopping, some resources (rpmsg device and endpoint) have been released in rproc_stop_subdevices(), then rproc_vq_interrupt() accessing these resources will cause kernel dump.
Call trace:
virtqueue_add_inbufvirtqueue_add_inbufrpmsg_recv_singlerpmsg_recv_donevring_interruptstm32_rproc_mb_vq_workprocess_one_workworker_thread
kthread
--- drivers/remoteproc/stm32_rproc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/remoteproc/stm32_rproc.c +8 -0
@@ -291,8 +291,16 @@ static void stm32_rproc_mb_vq_work(struct work_struct *work) struct stm32_mbox *mb = container_of(work, struct stm32_mbox, vq_work);struct rproc *rproc =dev_get_drvdata (mb->client.dev); +mutex_lock (&rproc->lock); + +if (rproc->state !=RPROC_RUNNING ) + goto unlock_mutex; +if (rproc_vq_interrupt (rproc, mb->vq_id) ==IRQ_NONE )dev_dbg (&rproc->dev,"no message found in vq%d\n" , mb->vq_id); + +unlock_mutex: +mutex_unlock (&rproc->lock); }static void stm32_rproc_mb_callback (struct mbox_client *cl,void *data)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 43/203 drm/tegra: Avoid potential 32-bit integer overflow
In reply to Greg Kroah-HartmanFrom: Nur Hussein <[email protected]>
[ Upstream commit 2429b3c529da29d4277d519bd66d034842dcd70c ]
In tegra_sor_compute_config(), the 32-bit value mode->clock is multiplied by 1000, and assigned to the u64 variable pclk. We can avoid a potential 32-bit integer overflow by casting mode->clock to u64 before we do the arithmetic and assignment.
--- drivers/gpu/drm/tegra/sor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/sor.c +1 -1
@@ -1153,7 +1153,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, struct drm_dp_link *link) {const u64 f =100000 , link_rate = link->rate *1000 ; -const u64 pclk = mode->clock *1000 ; +const u64 pclk = (u64 )mode->clock *1000 ;u64 input, output, watermark, num;struct tegra_sor_params params;u32 num_syms_per_line;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 44/203 drm/msm/dp: Clean up handling of DP AUX interrupts
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit b20566cdef05cd40d95f10869d2a7646f48b1bbe ]
The DP AUX interrupt handling was a bit of a mess.
* There were two functions (one for "native" transfers and one for "i2c" transfers) that were quite similar. It was hard to say how many of the differences between the two functions were on purpose and how many of them were just an accident of how they were coded.
* Each function sometimes used "else if" to test for error bits and sometimes didn't and again it was hard to say if this was on purpose or just an accident.
* The two functions wouldn't notice whether "unknown" bits were set. For instance, there seems to be a bit "DP_INTR_PLL_UNLOCKED" and if it was set there would be no indication.
* The two functions wouldn't notice if more than one error was set.
Let's fix this by being more consistent / explicit about what we're doing.
By design this could cause different handling for AUX transfers, though I'm not actually aware of any bug fixed as a result of this patch (this patch was created because we simply noticed how odd the old code was by code inspection). Specific notes here:
1. In the old native transfer case if we got "done + wrong address" we'd ignore the "wrong address" (because of the "else if"). Now we won't.
2. In the old native transfer case if we got "done + timeout" we'd ignore the "timeout" (because of the "else if"). Now we won't.
3. In the old native transfer case we'd see "nack_defer" and translate it to the error number for "nack". This differed from the i2c transfer case where "nack_defer" was given the error number for "nack_defer". This 100% can't matter because the only user of this error number treats "nack defer" the same as "nack", so it's clear that the difference between the "native" and "i2c" was pointless here.
4. In the old i2c transfer case if we got "done" plus any error besides "nack" or "defer" then we'd ignore the error. Now we don't.
5. If there is more than one error signaled by the hardware it's possible that we'll report a different one than we used to. I don't know if this matters. If someone is aware of a case this matters we should document it and change the code to make it explicit.
6. One quirk we keep (I don't know if this is important) is that in the i2c transfer case if we see "done + defer" we report that as a "nack". That seemed too intentional in the old code to just drop.
After this change we will add extra logging, including:
* A warning if we see more than one error bit set.
* A warning if we see an unexpected interrupt.
* A warning if we get an AUX transfer interrupt when shouldn't.
It actually turns out that as a result of this change then at boot we sometimes see an error:
[drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy
That means that, during init, we are seeing DP_INTR_PLL_UNLOCKED. For now I'm going to say that leaving this error reported in the logs is OK-ish and hopefully it will encourage someone to track down what's going on at init time.
One last note here is that this change renames one of the interrupt bits. The bit named "i2c done" clearly was used for native transfers being done too, so I renamed it to indicate this.
Patchwork: https://patchwork.freedesktop.org/patch/520658/
--- drivers/gpu/drm/msm/dp/dp_aux.c | 80 ++++++++++++----------------- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +- 3 files changed, 36 insertions(+), 48 deletions(-)
drivers/gpu/drm/msm/dp/dp_aux.c +34 -46
@@ -161,47 +161,6 @@ static ssize_t dp_aux_cmd_fifo_rx(struct dp_aux_private *aux,return i; } -static void dp_aux_native_handler (struct dp_aux_private *aux,u32 isr) -{ -if (isr &DP_INTR_AUX_I2C_DONE ) - aux->aux_error_num =DP_AUX_ERR_NONE ; -else if (isr &DP_INTR_WRONG_ADDR ) - aux->aux_error_num =DP_AUX_ERR_ADDR ; -else if (isr &DP_INTR_TIMEOUT ) - aux->aux_error_num =DP_AUX_ERR_TOUT ; -if (isr &DP_INTR_NACK_DEFER ) - aux->aux_error_num =DP_AUX_ERR_NACK ; -if (isr &DP_INTR_AUX_ERROR ) { - aux->aux_error_num =DP_AUX_ERR_PHY ; -dp_catalog_aux_clear_hw_interrupts (aux->catalog); - } -} - -static void dp_aux_i2c_handler (struct dp_aux_private *aux,u32 isr) -{ -if (isr &DP_INTR_AUX_I2C_DONE ) { -if (isr & (DP_INTR_I2C_NACK |DP_INTR_I2C_DEFER )) - aux->aux_error_num =DP_AUX_ERR_NACK ; -else - aux->aux_error_num =DP_AUX_ERR_NONE ; - }else { -if (isr &DP_INTR_WRONG_ADDR ) - aux->aux_error_num =DP_AUX_ERR_ADDR ; -else if (isr &DP_INTR_TIMEOUT ) - aux->aux_error_num =DP_AUX_ERR_TOUT ; -if (isr &DP_INTR_NACK_DEFER ) - aux->aux_error_num =DP_AUX_ERR_NACK_DEFER ; -if (isr &DP_INTR_I2C_NACK ) - aux->aux_error_num =DP_AUX_ERR_NACK ; -if (isr &DP_INTR_I2C_DEFER ) - aux->aux_error_num =DP_AUX_ERR_DEFER ; -if (isr &DP_INTR_AUX_ERROR ) { - aux->aux_error_num =DP_AUX_ERR_PHY ; -dp_catalog_aux_clear_hw_interrupts (aux->catalog); - } - } -} -static void dp_aux_update_offset_and_segment (struct dp_aux_private *aux,struct drm_dp_aux_msg *input_msg) {
@@ -410,13 +369,42 @@ void dp_aux_isr(struct drm_dp_aux *dp_aux)if (!isr)return ; -if (!aux->cmd_busy) +if (!aux->cmd_busy) { +DRM_ERROR ("Unexpected DP AUX IRQ %#010x when not busy\n" , isr);return ; + } -if (aux->native) -dp_aux_native_handler (aux, isr); -else -dp_aux_i2c_handler (aux, isr); +/* +* The logic below assumes only one error bit is set (other than "done" +* which can apparently be set at the same time as some of the other +* bits). Warn if more than one get set so we know we need to improve +* the logic. +*/ +if (hweight32 (isr & ~DP_INTR_AUX_XFER_DONE ) >1 ) +DRM_WARN ("Some DP AUX interrupts unhandled: %#010x\n" , isr); + +if (isr &DP_INTR_AUX_ERROR ) { + aux->aux_error_num =DP_AUX_ERR_PHY ; +dp_catalog_aux_clear_hw_interrupts (aux->catalog); + }else if (isr &DP_INTR_NACK_DEFER ) { + aux->aux_error_num =DP_AUX_ERR_NACK_DEFER ; + }else if (isr &DP_INTR_WRONG_ADDR ) { + aux->aux_error_num =DP_AUX_ERR_ADDR ; + }else if (isr &DP_INTR_TIMEOUT ) { + aux->aux_error_num =DP_AUX_ERR_TOUT ; + }else if (!aux->native && (isr &DP_INTR_I2C_NACK )) { + aux->aux_error_num =DP_AUX_ERR_NACK ; + }else if (!aux->native && (isr &DP_INTR_I2C_DEFER )) { +if (isr &DP_INTR_AUX_XFER_DONE ) + aux->aux_error_num =DP_AUX_ERR_NACK ; +else + aux->aux_error_num =DP_AUX_ERR_DEFER ; + }else if (isr &DP_INTR_AUX_XFER_DONE ) { + aux->aux_error_num =DP_AUX_ERR_NONE ; + }else { +DRM_WARN ("Unexpected interrupt: %#010x\n" , isr); +return ; + }complete (&aux->comp); }
drivers/gpu/drm/msm/dp/dp_catalog.c +1 -1
@@ -34,7 +34,7 @@#define MSM_DP_CONTROLLER_P0_SIZE 0x0400#define DP_INTERRUPT_STATUS1 \ - (DP_INTR_AUX_I2C_DONE| \ + (DP_INTR_AUX_XFER_DONE| \ DP_INTR_WRONG_ADDR | DP_INTR_TIMEOUT | \ DP_INTR_NACK_DEFER | DP_INTR_WRONG_DATA_CNT | \ DP_INTR_I2C_NACK | DP_INTR_I2C_DEFER | \
drivers/gpu/drm/msm/dp/dp_catalog.h +1 -1
@@ -13,7 +13,7 @@/* interrupts */ #define DP_INTR_HPD BIT(0) -#define DP_INTR_AUX_I2C_DONE BIT(3) +#define DP_INTR_AUX_XFER_DONE BIT(3)#define DP_INTR_WRONG_ADDR BIT(6)#define DP_INTR_TIMEOUT BIT(9)#define DP_INTR_NACK_DEFER BIT(12)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 45/203 ACPICA: Avoid undefined behavior: applying zero offset to null pointer
In reply to Greg Kroah-HartmanFrom: Tamir Duberstein <[email protected]>
[ Upstream commit 05bb0167c80b8f93c6a4e0451b7da9b96db990c2 ]
ACPICA commit 770653e3ba67c30a629ca7d12e352d83c2541b1e
Before this change we see the following UBSAN stack trace in Fuchsia:
#0 0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302 #1.2 0x000020d0f660777f in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d77f #1.1 0x000020d0f660777f in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d77f #1 0x000020d0f660777f in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d77f #2 0x000020d0f660b96d in handlepointer_overflow_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:809 <libclang_rt.asan.so>+0x4196d #3 0x000020d0f660b50d in compiler-rt/lib/ubsan/ubsan_handlers.cpp:815 <libclang_rt.asan.so>+0x4150d #4 0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302 #5 0x000021e4213e2369 in acpi_ds_call_control_method(struct acpi_thread_state*, struct acpi_walk_state*, union acpi_parse_object*) ../../third_party/acpica/source/components/dispatcher/dsmethod.c:605 <platform-bus-x86.so>+0x262369 #6 0x000021e421437fac in acpi_ps_parse_aml(struct acpi_walk_state*) ../../third_party/acpica/source/components/parser/psparse.c:550 <platform-bus-x86.so>+0x2b7fac #7 0x000021e4214464d2 in acpi_ps_execute_method(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/parser/psxface.c:244 <platform-bus-x86.so>+0x2c64d2 #8 0x000021e4213aa052 in acpi_ns_evaluate(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/namespace/nseval.c:250 <platform-bus-x86.so>+0x22a052 #9 0x000021e421413dd8 in acpi_ns_init_one_device(acpi_handle, u32, void*, void**) ../../third_party/acpica/source/components/namespace/nsinit.c:735 <platform-bus-x86.so>+0x293dd8 #10 0x000021e421429e98 in acpi_ns_walk_namespace(acpi_object_type, acpi_handle, u32, u32, acpi_walk_callback, acpi_walk_callback, void*, void**) ../../third_party/acpica/source/components/namespace/nswalk.c:298 <platform-bus-x86.so>+0x2a9e98 #11 0x000021e4214131ac in acpi_ns_initialize_devices(u32) ../../third_party/acpica/source/components/namespace/nsinit.c:268 <platform-bus-x86.so>+0x2931ac #12 0x000021e42147c40d in acpi_initialize_objects(u32) ../../third_party/acpica/source/components/utilities/utxfinit.c:304 <platform-bus-x86.so>+0x2fc40d #13 0x000021e42126d603 in acpi::acpi_impl::initialize_acpi(acpi::acpi_impl*) ../../src/devices/board/lib/acpi/acpi-impl.cc:224 <platform-bus-x86.so>+0xed603
Add a simple check that avoids incrementing a pointer by zero, but otherwise behaves as before. Note that our findings are against ACPICA 20221020, but the same code exists on master.
--- drivers/acpi/acpica/dswstate.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/acpi/acpica/dswstate.c +8 -3
@@ -576,9 +576,14 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,ACPI_FUNCTION_TRACE (ds_init_aml_walk); walk_state->parser_state.aml = - walk_state->parser_state.aml_start = aml_start; - walk_state->parser_state.aml_end = - walk_state->parser_state.pkg_end = aml_start + aml_length; + walk_state->parser_state.aml_start = + walk_state->parser_state.aml_end = + walk_state->parser_state.pkg_end = aml_start; +/* Avoid undefined behavior: applying zero offset to null pointer */ +if (aml_length !=0 ) { + walk_state->parser_state.aml_end += aml_length; + walk_state->parser_state.pkg_end += aml_length; + }/* The next_op of the next_walk will be the beginning of the method */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 28/203 ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set
In reply to Greg Kroah-HartmanFrom: Kemeng Shi <[email protected]>
[ Upstream commit 01e4ca29451760b9ac10b4cdc231c52150842643 ]
If EXT4_MB_HINT_GOAL_ONLY is set, ext4_mb_regular_allocator will only allocate blocks from ext4_mb_find_by_goal. Allow to find by goal in ext4_mb_find_by_goal if EXT4_MB_HINT_GOAL_ONLY is set or allocation with EXT4_MB_HINT_GOAL_ONLY set will always fail.
EXT4_MB_HINT_GOAL_ONLY is not used at all, so the problem is not found for now.
Stable-dep-of: 5354b2af3406 ("ext4: allow ext4_get_group_info() to fail")
--- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/mballoc.c +1 -1
@@ -2206,7 +2206,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,struct ext4_group_info *grp =ext4_get_group_info (ac->ac_sb, group);struct ext4_free_extent ex; -if (!(ac->ac_flags &EXT4_MB_HINT_TRY_GOAL )) +if (!(ac->ac_flags & (EXT4_MB_HINT_TRY_GOAL |EXT4_MB_HINT_GOAL_ONLY )))return 0 ;if (grp->bb_free ==0 )return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 46/203 ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
In reply to Greg Kroah-HartmanFrom: void0red <[email protected]>
[ Upstream commit ae5a0eccc85fc960834dd66e3befc2728284b86c ]
ACPICA commit 0d5f467d6a0ba852ea3aad68663cbcbd43300fd4
ACPI_ALLOCATE_ZEROED may fails, object_info might be null and will cause null pointer dereference later.
--- drivers/acpi/acpica/dbnames.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpica/dbnames.c +3 -0
@@ -652,6 +652,9 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg) object_info =ACPI_ALLOCATE_ZEROED (sizeof (struct acpi_object_info )); +if (!object_info) +return (AE_NO_MEMORY ); +/* Walk the namespace from the root */ (void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 47/203 drm/amd: Fix an out of bounds error in BIOS parser
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit d116db180decec1b21bba31d2ff495ac4d8e1b83 ]
The array is hardcoded to 8 in atomfirmware.h, but firmware provides a bigger one sometimes. Deferencing the larger array causes an out of bounds error.
commit 4fc1ba4aa589 ("drm/amd/display: fix array index out of bound error in bios parser") fixed some of this, but there are two other cases not covered by it. Fix those as well.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2 -5
@@ -406,11 +406,8 @@ static enum bp_result get_gpio_i2c_info( info->i2c_slave_address = record->i2c_slave_addr;/* TODO: check how to get register offset for en, Y, etc. */ - info->gpio_info.clk_a_register_index = -le16_to_cpu ( - header->gpio_pin[table_index].data_a_reg_index); - info->gpio_info.clk_a_shift = - header->gpio_pin[table_index].gpio_bitshift; + info->gpio_info.clk_a_register_index =le16_to_cpu (pin->data_a_reg_index); + info->gpio_info.clk_a_shift = pin->gpio_bitshift;return BP_RESULT_OK ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 48/203 media: Prefer designated initializers over memset for subdev pad ops
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit e3a69496a1cde364c74a600d7a370179b58aed29 ]
Structures passed to subdev pad operations are all zero-initialized, but not always with the same kind of code constructs. While most drivers used designated initializers, which zero all the fields that are not specified, when declaring variables, some use memset(). Those two methods lead to the same end result, and, depending on compiler optimizations, may even be completely equivalent, but they're not consistent.
Improve coding style consistency by using designated initializers instead of calling memset(). Where applicable, also move the variables to inner scopes of for loops to ensure correct initialization in all iterations.
--- drivers/media/platform/am437x/am437x-vpfe.c | 15 ++++++++------- .../media/platform/exynos4-is/fimc-capture.c | 7 ++++--- drivers/media/platform/ti-vpe/cal-video.c | 8 ++++---- drivers/media/platform/vsp1/vsp1_drm.c | 18 +++++++++--------- drivers/media/platform/vsp1/vsp1_entity.c | 11 +++++------ drivers/media/usb/dvb-usb/cxusb-analog.c | 14 +++++++------- drivers/staging/media/imx/imx-media-capture.c | 12 ++++++------ drivers/staging/media/imx/imx-media-utils.c | 8 ++++---- drivers/staging/media/omap4iss/iss_video.c | 6 +++--- 9 files changed, 50 insertions(+), 49 deletions(-)
drivers/media/platform/am437x/am437x-vpfe.c +8 -7
@@ -1499,7 +1499,9 @@ static int vpfe_enum_size(struct file *file, void *priv, struct v4l2_frmsizeenum *fsize) {struct vpfe_device *vpfe =video_drvdata (file); -struct v4l2_subdev_frame_size_enum fse; +struct v4l2_subdev_frame_size_enum fse = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };struct v4l2_subdev *sd = vpfe->current_subdev->sd;struct vpfe_fmt *fmt;int ret;
@@ -1514,11 +1516,9 @@ static int vpfe_enum_size(struct file *file, void *priv,memset (fsize->reserved,0x0 ,sizeof (fsize->reserved)); -memset (&fse,0x0 ,sizeof (fse)); fse.index = fsize->index; fse.pad =0 ; fse.code = fmt->code; - fse.which =V4L2_SUBDEV_FORMAT_ACTIVE ; ret =v4l2_subdev_call (sd, pad, enum_frame_size,NULL , &fse);if (ret)return ret;
@@ -2146,7 +2146,6 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier, {struct vpfe_device *vpfe =container_of (notifier->v4l2_dev, struct vpfe_device, v4l2_dev); -struct v4l2_subdev_mbus_code_enum mbus_code;struct vpfe_subdev_info *sdinfo;struct vpfe_fmt *fmt;int ret =0 ;
@@ -2173,9 +2172,11 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier, vpfe->num_active_fmt =0 ;for (j =0 , i =0 ; (ret != -EINVAL ); ++j) { -memset (&mbus_code,0 ,sizeof (mbus_code)); - mbus_code.index = j; - mbus_code.which =V4L2_SUBDEV_FORMAT_ACTIVE ; +struct v4l2_subdev_mbus_code_enum mbus_code = { + .index = j, + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; + ret =v4l2_subdev_call (subdev, pad, enum_mbus_code,NULL , &mbus_code);if (ret)
drivers/media/platform/exynos4-is/fimc-capture.c +4 -3
@@ -763,7 +763,10 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,struct fimc_dev *fimc = ctx->fimc_dev;struct fimc_pipeline *p =to_fimc_pipeline (fimc->vid_cap.ve.pipe);struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR ]; -struct v4l2_subdev_format sfmt; +struct v4l2_subdev_format sfmt = { + .which = set ?V4L2_SUBDEV_FORMAT_ACTIVE + :V4L2_SUBDEV_FORMAT_TRY , + };struct v4l2_mbus_framefmt *mf = &sfmt.format;struct media_entity *me;struct fimc_fmt *ffmt;
@@ -774,9 +777,7 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,if (WARN_ON (!sd || !tfmt))return -EINVAL ; -memset (&sfmt,0 ,sizeof (sfmt)); sfmt.format = *tfmt; - sfmt.which = set ?V4L2_SUBDEV_FORMAT_ACTIVE :V4L2_SUBDEV_FORMAT_TRY ; me =fimc_pipeline_get_head (&sd->entity);
drivers/media/platform/ti-vpe/cal-video.c +4 -4
@@ -814,7 +814,6 @@ static const struct v4l2_file_operations cal_fops = {static int cal_ctx_v4l2_init_formats (struct cal_ctx *ctx) { -struct v4l2_subdev_mbus_code_enum mbus_code;struct v4l2_mbus_framefmt mbus_fmt;const struct cal_format_info *fmtinfo;unsigned int i, j, k;
@@ -829,10 +828,11 @@ static int cal_ctx_v4l2_init_formats(struct cal_ctx *ctx) ctx->num_active_fmt =0 ;for (j =0 , i =0 ; ; ++j) { +struct v4l2_subdev_mbus_code_enum mbus_code = { + .index = j, + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; -memset (&mbus_code,0 ,sizeof (mbus_code)); - mbus_code.index = j; - mbus_code.which =V4L2_SUBDEV_FORMAT_ACTIVE ; ret =v4l2_subdev_call (ctx->phy->source, pad, enum_mbus_code,NULL , &mbus_code);if (ret == -EINVAL )
drivers/media/platform/vsp1/vsp1_drm.c +9 -9
@@ -66,7 +66,9 @@ static int vsp1_du_insert_uif(struct vsp1_device *vsp1, struct vsp1_entity *prev, unsigned int prev_pad, struct vsp1_entity *next, unsigned int next_pad) { - struct v4l2_subdev_format format; + struct v4l2_subdev_format format = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };int ret;if (!uif) {
@@ -82,8 +84,6 @@ static int vsp1_du_insert_uif(struct vsp1_device *vsp1, prev->sink = uif; prev->sink_pad =UIF_PAD_SINK ; -memset (&format,0 ,sizeof (format)); - format.which =V4L2_SUBDEV_FORMAT_ACTIVE ; format.pad = prev_pad; ret =v4l2_subdev_call (&prev->subdev, pad, get_fmt,NULL , &format);
@@ -118,8 +118,12 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1,struct vsp1_entity *uif, unsigned int brx_input) { - struct v4l2_subdev_selection sel; -struct v4l2_subdev_format format; + struct v4l2_subdev_selection sel = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; +struct v4l2_subdev_format format = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };const struct v4l2_rect *crop;int ret;
@@ -129,8 +133,6 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1,*/ crop = &vsp1->drm->inputs[rpf->entity.index].crop; -memset (&format,0 ,sizeof (format)); - format.which =V4L2_SUBDEV_FORMAT_ACTIVE ; format.pad =RWPF_PAD_SINK ; format.format.width = crop->width + crop->left; format.format.height = crop->height + crop->top;
@@ -147,8 +149,6 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1, __func__, format.format.width, format.format.height, format.format.code, rpf->entity.index); -memset (&sel,0 ,sizeof (sel)); - sel.which =V4L2_SUBDEV_FORMAT_ACTIVE ; sel.pad =RWPF_PAD_SINK ; sel.target =V4L2_SEL_TGT_CROP ; sel.r = *crop;
drivers/media/platform/vsp1/vsp1_entity.c +5 -6
@@ -184,15 +184,14 @@ vsp1_entity_get_pad_selection(struct vsp1_entity *entity,int vsp1_entity_init_cfg (struct v4l2_subdev *subdev,struct v4l2_subdev_state *sd_state) { -struct v4l2_subdev_format format;unsigned int pad;for (pad =0 ; pad < subdev->entity.num_pads -1 ; ++pad) { -memset (&format,0 ,sizeof (format)); - - format.pad = pad; - format.which = sd_state ?V4L2_SUBDEV_FORMAT_TRY - :V4L2_SUBDEV_FORMAT_ACTIVE ; +struct v4l2_subdev_format format = { + .pad = pad, + .which = sd_state ?V4L2_SUBDEV_FORMAT_TRY + :V4L2_SUBDEV_FORMAT_ACTIVE , + };v4l2_subdev_call (subdev, pad, set_fmt, sd_state, &format); }
drivers/media/usb/dvb-usb/cxusb-analog.c +7 -7
@@ -1014,7 +1014,10 @@ static int cxusb_medion_try_s_fmt_vid_cap(struct file *file, {struct dvb_usb_device *dvbdev =video_drvdata (file);struct cxusb_medion_dev *cxdev = dvbdev->priv; -struct v4l2_subdev_format subfmt; +struct v4l2_subdev_format subfmt = { + .which = isset ?V4L2_SUBDEV_FORMAT_ACTIVE : +V4L2_SUBDEV_FORMAT_TRY , + };u32 field;int ret;
@@ -1024,9 +1027,6 @@ static int cxusb_medion_try_s_fmt_vid_cap(struct file *file, field =vb2_start_streaming_called (&cxdev->videoqueue) ? cxdev->field_order :cxusb_medion_field_order (cxdev); -memset (&subfmt,0 ,sizeof (subfmt)); - subfmt.which = isset ?V4L2_SUBDEV_FORMAT_ACTIVE : -V4L2_SUBDEV_FORMAT_TRY ; subfmt.format.width = f->fmt.pix.width & ~1 ; subfmt.format.height = f->fmt.pix.height & ~1 ; subfmt.format.code =MEDIA_BUS_FMT_FIXED ;
@@ -1464,7 +1464,9 @@ int cxusb_medion_analog_init(struct dvb_usb_device *dvbdev) .buf = tuner_analog_msg_data, .len = sizeof(tuner_analog_msg_data) }; -struct v4l2_subdev_format subfmt; +struct v4l2_subdev_format subfmt = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };int ret;/* switch tuner to analog mode so IF demod will become accessible */
@@ -1507,8 +1509,6 @@ int cxusb_medion_analog_init(struct dvb_usb_device *dvbdev)v4l2_subdev_call (cxdev->tuner, video, s_std, cxdev->norm);v4l2_subdev_call (cxdev->cx25840, video, s_std, cxdev->norm); -memset (&subfmt,0 ,sizeof (subfmt)); - subfmt.which =V4L2_SUBDEV_FORMAT_ACTIVE ; subfmt.format.width = cxdev->width; subfmt.format.height = cxdev->height; subfmt.format.code =MEDIA_BUS_FMT_FIXED ;
drivers/staging/media/imx/imx-media-capture.c +6 -6
@@ -501,14 +501,14 @@ static int capture_legacy_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a) {struct capture_priv *priv =video_drvdata (file); -struct v4l2_subdev_frame_interval fi; +struct v4l2_subdev_frame_interval fi = { + .pad = priv->src_sd_pad, + };int ret;if (a->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE )return -EINVAL ; -memset (&fi,0 ,sizeof (fi)); - fi.pad = priv->src_sd_pad; ret =v4l2_subdev_call (priv->src_sd, video, g_frame_interval, &fi);if (ret <0 )return ret;
@@ -523,14 +523,14 @@ static int capture_legacy_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) {struct capture_priv *priv =video_drvdata (file); -struct v4l2_subdev_frame_interval fi; +struct v4l2_subdev_frame_interval fi = { + .pad = priv->src_sd_pad, + };int ret;if (a->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE )return -EINVAL ; -memset (&fi,0 ,sizeof (fi)); - fi.pad = priv->src_sd_pad; fi.interval = a->parm.capture.timeperframe; ret =v4l2_subdev_call (priv->src_sd, video, s_frame_interval, &fi);if (ret <0 )
drivers/staging/media/imx/imx-media-utils.c +4 -4
@@ -432,15 +432,15 @@ int imx_media_init_cfg(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state) {struct v4l2_mbus_framefmt *mf_try; -struct v4l2_subdev_format format;unsigned int pad;int ret;for (pad =0 ; pad < sd->entity.num_pads; pad++) { -memset (&format,0 ,sizeof (format)); +struct v4l2_subdev_format format = { + .pad = pad, + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + }; - format.pad = pad; - format.which =V4L2_SUBDEV_FORMAT_ACTIVE ; ret =v4l2_subdev_call (sd, pad, get_fmt,NULL , &format);if (ret)continue ;
drivers/staging/media/omap4iss/iss_video.c +3 -3
@@ -244,7 +244,9 @@ static int __iss_video_get_format(struct iss_video *video, struct v4l2_mbus_framefmt *format) { - struct v4l2_subdev_format fmt; + struct v4l2_subdev_format fmt = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + };struct v4l2_subdev *subdev;u32 pad;int ret;
@@ -253,9 +255,7 @@ __iss_video_get_format(struct iss_video *video,if (!subdev)return -EINVAL ; -memset (&fmt,0 ,sizeof (fmt)); fmt.pad = pad; - fmt.which =V4L2_SUBDEV_FORMAT_ACTIVE ;mutex_lock (&video->mutex); ret =v4l2_subdev_call (subdev, pad, get_fmt,NULL , &fmt);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 49/203 wifi: ath: Silence memcpy run-time false positive warning
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit bfcc8ba45eb87bfaaff900bbad2b87b204899d41 ]
The memcpy() in ath_key_config() was attempting to write across neighboring struct members in struct ath_keyval. Introduce a wrapping struct_group, kv_values, to be the addressable target of the memcpy without overflowing an individual member. Silences the false positive run-time warning:
memcpy: detected field-spanning write (size 32) of single field "hk.kv_val" at drivers/net/wireless/ath/key.c:506 (size 16)
--- drivers/net/wireless/ath/ath.h | 12 +++++++----- drivers/net/wireless/ath/key.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath.h +7 -5
@@ -96,11 +96,13 @@ struct ath_keyval {u8 kv_type;u8 kv_pad;u16 kv_len; -u8 kv_val[16 ];/* TK */ -u8 kv_mic[8 ];/* Michael MIC key */ -u8 kv_txmic[8 ];/* Michael MIC TX key (used only if the hardware -* supports both MIC keys in the same key cache entry; -* in that case, kv_mic is the RX key) */ +struct_group (kv_values, + u8 kv_val[16]; /* TK */ +u8 kv_mic[8 ];/* Michael MIC key */ +u8 kv_txmic[8 ];/* Michael MIC TX key (used only if the hardware +* supports both MIC keys in the same key cache entry; +* in that case, kv_mic is the RX key) */ + ); };enum ath_cipher {
drivers/net/wireless/ath/key.c +1 -1
@@ -503,7 +503,7 @@ int ath_key_config(struct ath_common *common, hk.kv_len = key->keylen;if (key->keylen) -memcpy (hk.kv_val, key->key, key->keylen); +memcpy (&hk.kv_values, key->key, key->keylen);if (!(key->flags &IEEE80211_KEY_FLAG_PAIRWISE )) {switch (vif->type) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 50/203 bpf: Annotate data races in bpf_local_storage
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 0a09a2f933c73dc76ab0b72da6855f44342a8903 ]
There are a few cases where hlist_node is checked to be unhashed without holding the lock protecting its modification. In this case, one must use hlist_unhashed_lockless to avoid load tearing and KCSAN reports. Fix this by using lockless variant in places not protected by the lock.
Since this is not prompted by any actual KCSAN reports but only from code review, I have not included a fixes tag.
--- kernel/bpf/bpf_local_storage.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
kernel/bpf/bpf_local_storage.c +13 -3
@@ -48,11 +48,21 @@ owner_storage(struct bpf_local_storage_map *smap, void *owner)return map->ops->map_owner_storage_ptr (owner); } +static bool selem_linked_to_storage_lockless (const struct bpf_local_storage_elem *selem) +{ +return !hlist_unhashed_lockless (&selem->snode); +} +static bool selem_linked_to_storage (const struct bpf_local_storage_elem *selem) {return !hlist_unhashed (&selem->snode); } +static bool selem_linked_to_map_lockless (const struct bpf_local_storage_elem *selem) +{ +return !hlist_unhashed_lockless (&selem->map_node); +} +static bool selem_linked_to_map (const struct bpf_local_storage_elem *selem) {return !hlist_unhashed (&selem->map_node);
@@ -142,7 +152,7 @@ static void __bpf_selem_unlink_storage(struct bpf_local_storage_elem *selem)bool free_local_storage = false;unsigned long flags; -if (unlikely (!selem_linked_to_storage (selem))) +if (unlikely (!selem_linked_to_storage_lockless (selem)))/* selem has already been unlinked from sk */ return ;
@@ -170,7 +180,7 @@ void bpf_selem_unlink_map(struct bpf_local_storage_elem *selem)struct bpf_local_storage_map_bucket *b;unsigned long flags; -if (unlikely (!selem_linked_to_map (selem))) +if (unlikely (!selem_linked_to_map_lockless (selem)))/* selem has already be unlinked from smap */ return ;
@@ -373,7 +383,7 @@ bpf_local_storage_update(void *owner, struct bpf_local_storage_map *smap, err =check_flags (old_sdata, map_flags);if (err)return ERR_PTR (err); -if (old_sdata &&selem_linked_to_storage (SELEM (old_sdata))) { +if (old_sdata &&selem_linked_to_storage_lockless (SELEM (old_sdata))) {copy_map_value_locked (&smap->map, old_sdata->data, value, false);return old_sdata;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 51/203 wifi: brcmfmac: cfg80211: Pass the PMK in binary instead of hex
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
[ Upstream commit 89b89e52153fda2733562776c7c9d9d3ebf8dd6d ]
Apparently the hex passphrase mechanism does not work on newer chips/firmware (e.g. BCM4387). It seems there was a simple way of passing it in binary all along, so use that and avoid the hexification.
OpenBSD has been doing it like this from the beginning, so this should work on all chips.
Also clear the structure before setting the PMK. This was leaking uninitialized stack contents to the device.
--- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +7 -6
@@ -1350,13 +1350,14 @@ static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len) {struct brcmf_pub *drvr = ifp->drvr;struct brcmf_wsec_pmk_le pmk; -int i, err; +int err; + +memset (&pmk,0 ,sizeof (pmk)); -/* convert to firmware key format */ - pmk.key_len =cpu_to_le16 (pmk_len <<1 ); - pmk.flags =cpu_to_le16 (BRCMF_WSEC_PASSPHRASE ); -for (i =0 ; i < pmk_len; i++) -snprintf (&pmk.key[2 * i],3 ,"%02x" , pmk_data[i]); +/* pass pmk directly */ + pmk.key_len =cpu_to_le16 (pmk_len); + pmk.flags =cpu_to_le16 (0 ); +memcpy (pmk.key, pmk_data, pmk_len);/* store psk in firmware */ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 52/203 ext2: Check block size validity during mount
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 62aeb94433fcec80241754b70d0d1836d5926b0a ]
Check that log of block size stored in the superblock has sensible value. Otherwise the shift computing the block size can overflow leading to undefined behavior.
--- fs/ext2/ext2.h | 1 + fs/ext2/super.c | 7 +++++++ 2 files changed, 8 insertions(+)
fs/ext2/ext2.h +1 -0
@@ -179,6 +179,7 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)#define EXT2_MIN_BLOCK_SIZE 1024#define EXT2_MAX_BLOCK_SIZE 4096#define EXT2_MIN_BLOCK_LOG_SIZE 10 +#define EXT2_MAX_BLOCK_LOG_SIZE 16#define EXT2_BLOCK_SIZE (s) ((s)->s_blocksize)#define EXT2_ADDR_PER_BLOCK (s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))#define EXT2_BLOCK_SIZE_BITS (s) ((s)->s_blocksize_bits)
fs/ext2/super.c +7 -0
@@ -947,6 +947,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount; } +if (le32_to_cpu (es->s_log_block_size) > + (EXT2_MAX_BLOCK_LOG_SIZE -BLOCK_SIZE_BITS )) { +ext2_msg (sb,KERN_ERR , +"Invalid log block size: %u" , +le32_to_cpu (es->s_log_block_size)); + goto failed_mount; + } blocksize =BLOCK_SIZE <<le32_to_cpu (sbi->s_es->s_log_block_size);if (test_opt (sb,DAX )) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 53/203 scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow
In reply to Greg Kroah-HartmanFrom: Justin Tee <[email protected]>
[ Upstream commit c6087b82a9146826564a55c5ca0164cac40348f5 ]
A static code analysis tool flagged the possibility of buffer overflow when using copy_from_user() for a debugfs entry.
Currently, it is possible that copy_from_user() copies more bytes than what would fit in the mybuf char array. Add a min() restriction check between sizeof(mybuf) - 1 and nbytes passed from the userspace buffer to protect against buffer overflow.
--- drivers/scsi/lpfc/lpfc_debugfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +5 -2
@@ -2157,10 +2157,13 @@ lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf,char mybuf[64 ];char *pbuf;int i; +size_t bsize;memset (mybuf,0 ,sizeof (mybuf)); -if (copy_from_user (mybuf, buf, nbytes)) + bsize =min (nbytes, (sizeof (mybuf) -1 )); + +if (copy_from_user (mybuf, buf, bsize))return -EFAULT ; pbuf = &mybuf[0 ];
@@ -2181,7 +2184,7 @@ lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf, qp->lock_conflict.wq_access = 0; } } -return nbytes; +return bsize; }#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 54/203 bnxt: avoid overflow in bnxt_get_nvram_directory()
In reply to Greg Kroah-HartmanFrom: Maxim Korotkov <[email protected]>
[ Upstream commit 7c6dddc239abe660598c49ec95ea0ed6399a4b2a ]
The value of an arithmetic expression is subject
of possible overflow due to a failure to cast operands to a larger data type before performing arithmetic. Used macro for multiplication instead operator for avoiding overflow.
Found by Security Code and Linux Verification
Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -1
@@ -2709,7 +2709,7 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data)if (rc)return rc; - buflen = dir_entries * entry_length; + buflen =mul_u32_u32 (dir_entries, entry_length); buf =hwrm_req_dma_slice (bp, req, buflen, &dma_handle);if (!buf) {hwrm_req_drop (bp, req);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 55/203 net: pasemi: Fix return type of pasemi_mac_start_tx()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit c8384d4a51e7cb0e6587f3143f29099f202c5de1 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A warning in clang aims to catch these at compile time, which reveals:
drivers/net/ethernet/pasemi/pasemi_mac.c:1665:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = pasemi_mac_start_tx,
^~~~~~~~~~~~~~~~~~~
1 error generated.
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of pasemi_mac_start_tx() to match the prototype's to resolve the warning. While PowerPC does not currently implement support for kCFI, it could in the future, which means this warning becomes a fatal CFI failure at run time.
--- drivers/net/ethernet/pasemi/pasemi_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pasemi/pasemi_mac.c +1 -1
@@ -1423,7 +1423,7 @@ static void pasemi_mac_queue_csdesc(const struct sk_buff *skb,write_dma_reg (PAS_DMA_TXCHAN_INCR (txring->chan.chno),2 ); } -static int pasemi_mac_start_tx (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t pasemi_mac_start_tx (struct sk_buff *skb,struct net_device *dev) {struct pasemi_mac *const mac =netdev_priv (dev);struct pasemi_mac_txring *const txring =tx_ring (mac);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 29/203 ext4: allow ext4_get_group_info() to fail
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
[ Upstream commit 5354b2af34064a4579be8bc0e2f15a7b70f14b5f ]
Previously, ext4_get_group_info() would treat an invalid group number as BUG(), since in theory it should never happen. However, if a malicious attaker (or fuzzer) modifies the superblock via the block device while it is the file system is mounted, it is possible for s_first_data_block to get set to a very large number. In that case, when calculating the block group of some block number (such as the starting block of a preallocation region), could result in an underflow and very large block group number. Then the BUG_ON check in ext4_get_group_info() would fire, resutling in a denial of service attack that can be triggered by root or someone with write access to the block device.
For a quality of implementation perspective, it's best that even if the system administrator does something that they shouldn't, that it will not trigger a BUG. So instead of BUG'ing, ext4_get_group_info() will call ext4_error and return NULL. We also add fallback code in all of the callers of ext4_get_group_info() that it might NULL.
Also, since ext4_get_group_info() was already borderline to be an inline function, un-inline it. The results in a next reduction of the compiled text size of ext4 by roughly 2k.
--- fs/ext4/balloc.c | 18 ++++++++++++- fs/ext4/ext4.h | 15 ++--------- fs/ext4/ialloc.c | 12 ++++++--- fs/ext4/mballoc.c | 64 +++++++++++++++++++++++++++++++++++++++-------- fs/ext4/super.c | 2 ++ 5 files changed, 82 insertions(+), 29 deletions(-)
fs/ext4/balloc.c +17 -1
@@ -319,6 +319,22 @@ static ext4_fsblk_t ext4_valid_block_bitmap_padding(struct super_block *sb,return (next_zero_bit < bitmap_size ? next_zero_bit :0 ); } +struct ext4_group_info *ext4_get_group_info (struct super_block *sb, +ext4_group_t group) +{ +struct ext4_group_info **grp_info; +long indexv, indexh; + +if (unlikely (group >=EXT4_SB (sb)->s_groups_count)) { +ext4_error (sb,"invalid group %u" , group); +return NULL ; + } + indexv = group >> (EXT4_DESC_PER_BLOCK_BITS (sb)); + indexh = group & ((EXT4_DESC_PER_BLOCK (sb)) -1 ); + grp_info =sbi_array_rcu_deref (EXT4_SB (sb), s_group_info, indexv); +return grp_info[indexh]; +} +/* * Return the block number which was discovered to be invalid, or 0 if * the block bitmap is valid.
@@ -393,7 +409,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,if (buffer_verified (bh))return 0 ; -if (EXT4_MB_GRP_BBITMAP_CORRUPT (grp)) +if (!grp ||EXT4_MB_GRP_BBITMAP_CORRUPT (grp))return -EFSCORRUPTED ;ext4_lock_group (sb, block_group);
fs/ext4/ext4.h +2 -13
@@ -2699,6 +2699,8 @@ extern void ext4_check_blocks_bitmap(struct super_block *);extern struct ext4_group_desc *ext4_get_group_desc (struct super_block * sb,ext4_group_t block_group,struct buffer_head ** bh); +extern struct ext4_group_info *ext4_get_group_info (struct super_block *sb, +ext4_group_t group);extern int ext4_should_retry_alloc (struct super_block *sb,int *retries); extern struct buffer_head *ext4_read_block_bitmap_nowait(struct super_block *sb,
@@ -3346,19 +3348,6 @@ static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size) raw_inode->i_size_high =cpu_to_le32 (i_size >>32 ); } -static inline -struct ext4_group_info *ext4_get_group_info (struct super_block *sb, -ext4_group_t group) -{ -struct ext4_group_info **grp_info; -long indexv, indexh; -BUG_ON (group >=EXT4_SB (sb)->s_groups_count); - indexv = group >> (EXT4_DESC_PER_BLOCK_BITS (sb)); - indexh = group & ((EXT4_DESC_PER_BLOCK (sb)) -1 ); - grp_info =sbi_array_rcu_deref (EXT4_SB (sb), s_group_info, indexv); -return grp_info[indexh]; -} -/* * Reading s_groups_count requires using smp_rmb() afterwards. See * the locking protocol documented in the comments of ext4_group_add()
fs/ext4/ialloc.c +8 -4
@@ -91,7 +91,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,if (buffer_verified (bh))return 0 ; -if (EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) +if (!grp ||EXT4_MB_GRP_IBITMAP_CORRUPT (grp))return -EFSCORRUPTED ;ext4_lock_group (sb, block_group);
@@ -293,7 +293,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) }if (!(sbi->s_mount_state &EXT4_FC_REPLAY )) { grp =ext4_get_group_info (sb, block_group); -if (unlikely (EXT4_MB_GRP_IBITMAP_CORRUPT (grp))) { +if (!grp ||unlikely (EXT4_MB_GRP_IBITMAP_CORRUPT (grp))) { fatal = -EFSCORRUPTED ; goto error_return; }
@@ -1048,7 +1048,7 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,* Skip groups with already-known suspicious inode * tables */ -if (EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) +if (!grp ||EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) goto next_group; }
@@ -1186,6 +1186,10 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,if (!(sbi->s_mount_state &EXT4_FC_REPLAY )) { grp =ext4_get_group_info (sb, group); +if (!grp) { + err = -EFSCORRUPTED ; + goto out; + }down_read (&grp->alloc_sem);/* * protect vs itable * lazyinit
@@ -1529,7 +1533,7 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, } gdp =ext4_get_group_desc (sb, group, &group_desc_bh); -if (!gdp) +if (!gdp || !grp) goto out;/*
fs/ext4/mballoc.c +53 -11
215 lines not on this page · raw message
fs/ext4/super.c +2 -0
@@ -1017,6 +1017,8 @@ void ext4_mark_group_bitmap_corrupted(struct super_block *sb,struct ext4_group_desc *gdp =ext4_get_group_desc (sb, group,NULL );int ret; +if (!grp || !gdp) +return ;if (flags &EXT4_GROUP_INFO_BBITMAP_CORRUPT ) { ret =ext4_test_and_set_bit (EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT , &grp->bb_state);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 30/203 refscale: Move shutdown from wait_event() to wait_event_idle()
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 6bc6e6b27524304aadb9c04611ddb1c84dd7617a ]
The ref_scale_shutdown() kthread/function uses wait_event() to wait for the refscale test to complete. However, although the read-side tests are normally extremely fast, there is no law against specifying a very large value for the refscale.loops module parameter or against having a slow read-side primitive. Either way, this might well trigger the hung-task timeout.
This commit therefore replaces those wait_event() calls with calls to wait_event_idle(), which do not trigger the hung-task timeout.
--- kernel/rcu/refscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/refscale.c +1 -1
@@ -777,7 +777,7 @@ ref_scale_cleanup(void)static int ref_scale_shutdown (void *arg) { -wait_event (shutdown_wq, shutdown_start); +wait_event_idle (shutdown_wq, shutdown_start);smp_mb ();// Wake before output. ref_scale_cleanup ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 31/203 rcu: Protect rcu_print_task_exp_stall() ->exp_tasks access
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit 3c1566bca3f8349f12b75d0a2d5e4a20ad6262ec ]
For kernels built with CONFIG_PREEMPT_RCU=y, the following scenario can result in a NULL-pointer dereference:
CPU1 CPU2rcu_preempt_deferred_qs_irqrestore rcu_print_task_exp_stall
if (special.b.blocked) READ_ONCE(rnp->exp_tasks) != NULL
raw_spin_lock_rcu_node
np = rcu_next_node_entry(t, rnp)
if (&t->rcu_node_entry == rnp->exp_tasks)
WRITE_ONCE(rnp->exp_tasks, np)
....
raw_spin_unlock_irqrestore_rcu_node
raw_spin_lock_irqsave_rcu_node
t = list_entry(rnp->exp_tasks->prev,
struct task_struct, rcu_node_entry)
(if rnp->exp_tasks is NULL, this
will dereference a NULL pointer)The problem is that CPU2 accesses the rcu_node structure's->exp_tasks field without holding the rcu_node structure's ->lock and CPU2 did not observe CPU1's change to rcu_node structure's ->exp_tasks in time. Therefore, if CPU1 sets rcu_node structure's->exp_tasks pointer to NULL, then CPU2 might dereference that NULL pointer.
This commit therefore holds the rcu_node structure's ->lock while accessing that structure's->exp_tasks field.
[ paulmck: Apply Frederic Weisbecker feedback. ]
--- kernel/rcu/tree_exp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/rcu/tree_exp.h +4 -2
@@ -708,9 +708,11 @@ static int rcu_print_task_exp_stall(struct rcu_node *rnp)int ndetected =0 ;struct task_struct *t; -if (!READ_ONCE (rnp->exp_tasks)) -return 0 ;raw_spin_lock_irqsave_rcu_node (rnp, flags); +if (!rnp->exp_tasks) { +raw_spin_unlock_irqrestore_rcu_node (rnp, flags); +return 0 ; + } t =list_entry (rnp->exp_tasks->prev, struct task_struct, rcu_node_entry);list_for_each_entry_continue (t, &rnp->blkd_tasks, rcu_node_entry) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 32/203 fs: hfsplus: remove WARN_ON() from hfsplus_cat_{read,write}_inode()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 81b21c0f0138ff5a499eafc3eb0578ad2a99622c ]
syzbot is hitting WARN_ON() in hfsplus_cat_{read,write}_inode(), for crafted filesystem image can contain bogus length. There conditions are not kernel bugs that can justify kernel to panic.
Message-Id: <[email protected]>
--- fs/hfsplus/inode.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
fs/hfsplus/inode.c +23 -5
@@ -509,7 +509,11 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)if (type ==HFSPLUS_FOLDER ) {struct hfsplus_cat_folder *folder = &entry.folder; -WARN_ON (fd->entrylength <sizeof (struct hfsplus_cat_folder )); +if (fd->entrylength <sizeof (struct hfsplus_cat_folder )) { +pr_err ("bad catalog folder entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd->bnode, &entry, fd->entryoffset,sizeof (struct hfsplus_cat_folder ));hfsplus_get_perms (inode, &folder->permissions,1 );
@@ -529,7 +533,11 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd) }else if (type ==HFSPLUS_FILE ) {struct hfsplus_cat_file *file = &entry.file; -WARN_ON (fd->entrylength <sizeof (struct hfsplus_cat_file )); +if (fd->entrylength <sizeof (struct hfsplus_cat_file )) { +pr_err ("bad catalog file entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd->bnode, &entry, fd->entryoffset,sizeof (struct hfsplus_cat_file ));
@@ -560,6 +568,7 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)pr_err ("bad catalog entry used to create inode\n" ); res = -EIO ; } +out:return res; }
@@ -568,6 +577,7 @@ int hfsplus_cat_write_inode(struct inode *inode)struct inode *main_inode = inode;struct hfs_find_data fd;hfsplus_cat_entry entry; +int res =0 ;if (HFSPLUS_IS_RSRC (inode)) main_inode =HFSPLUS_I (inode)->rsrc_inode;
@@ -586,7 +596,11 @@ int hfsplus_cat_write_inode(struct inode *inode)if (S_ISDIR (main_inode->i_mode)) {struct hfsplus_cat_folder *folder = &entry.folder; -WARN_ON (fd.entrylength <sizeof (struct hfsplus_cat_folder )); +if (fd.entrylength <sizeof (struct hfsplus_cat_folder )) { +pr_err ("bad catalog folder entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd.bnode, &entry, fd.entryoffset,sizeof (struct hfsplus_cat_folder ));/* simple node checks? */
@@ -611,7 +625,11 @@ int hfsplus_cat_write_inode(struct inode *inode) }else {struct hfsplus_cat_file *file = &entry.file; -WARN_ON (fd.entrylength <sizeof (struct hfsplus_cat_file )); +if (fd.entrylength <sizeof (struct hfsplus_cat_file )) { +pr_err ("bad catalog file entry\n" ); + res = -EIO ; + goto out; + }hfs_bnode_read (fd.bnode, &entry, fd.entryoffset,sizeof (struct hfsplus_cat_file ));hfsplus_inode_write_fork (inode, &file->data_fork);
@@ -632,7 +650,7 @@ int hfsplus_cat_write_inode(struct inode *inode)set_bit (HFSPLUS_I_CAT_DIRTY , &HFSPLUS_I (inode)->flags); out:hfs_find_exit (&fd); -return 0 ; +return res; }int hfsplus_fileattr_get (struct dentry *dentry,struct fileattr *fa)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 33/203 drm/displayid: add displayid_get_header() and check bounds better
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit 5bacecc3c56131c31f18b23d366f2184328fd9cf ]
Add a helper to get a pointer to struct displayid_header. To be pedantic, add buffer overflow checks to not touch the base if that itself would overflow.
--- drivers/gpu/drm/drm_displayid.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_displayid.c +16 -1
@@ -7,13 +7,28 @@#include <drm/drm_edid.h> #include <drm/drm_print.h> +static const struct displayid_header * +displayid_get_header (const u8 *displayid,int length,int index) +{ +const struct displayid_header *base; + +if (sizeof (*base) > length - index) +return ERR_PTR (-EINVAL ); + + base = (const struct displayid_header *)&displayid[index]; + +return base; +} +static int validate_displayid (const u8 *displayid,int length,int idx) {int i, dispid_length;u8 csum =0 ;const struct displayid_header *base; - base = (const struct displayid_header *)&displayid[idx]; + base =displayid_get_header (displayid, length, idx); +if (IS_ERR (base)) +return PTR_ERR (base);DRM_DEBUG_KMS ("base revision 0x%x, length %d, %d %d\n" , base->rev, base->bytes, base->prod_id, base->ext_count);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 34/203 drm/amd/display: Use DC_LOG_DC in the trasform pixel function
In reply to Greg Kroah-HartmanFrom: Rodrigo Siqueira <[email protected]>
[ Upstream commit 7222f5841ff49709ca666b05ff336776e0664a20 ]
[Why & How]
DC now uses a new commit sequence which is more robust since it addresses cases where we need to reorganize pipes based on planes and other parameters. As a result, this new commit sequence reset the DC state by cleaning plane states and re-creating them accordingly with the need. For this reason, the dce_transform_set_pixel_storage_depth can be invoked after a plane state is destroyed and before its re-creation. In this situation and on DCE devices, DC will hit a condition that will trigger a dmesg log that looks like this:
Console: switching to colour frame buffer device 240x67
------------[ cut here ]------------ [..] Hardware name: System manufacturer System Product Name/PRIME X370-PRO, BIOS 5603 07/28/2020 RIP: 0010:dce_transform_set_pixel_storage_depth+0x3f8/0x480 [amdgpu] [..] RSP: 0018:ffffc9000202b850 EFLAGS: 00010293 RAX: ffffffffa081d100 RBX: ffff888110790000 RCX: 000000000000000c RDX: ffff888100bedbf8 RSI: 0000000000001a50 RDI: ffff88810463c900 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000007 R10: 0000000000000001 R11: 0000000000000f00 R12: ffff88810f500010 R13: ffff888100bedbf8 R14: ffff88810f515688 R15: 0000000000000000 FS: 00007ff0159249c0(0000) GS:ffff88840e940000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ff01528e550 CR3: 0000000002a10000 CR4: 00000000003506e0 Call Trace: <TASK> ? dm_write_reg_func+0x21/0x80 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] dc_stream_set_dither_option+0xfb/0x130 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] amdgpu_dm_crtc_configure_crc_source+0x10b/0x190 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] amdgpu_dm_atomic_commit_tail+0x20a8/0x2a90 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] ? free_unref_page_commit+0x98/0x170 ? free_unref_page+0xcc/0x150 commit_tail+0x94/0x120 drm_atomic_helper_commit+0x10f/0x140 drm_atomic_commit+0x94/0xc0 ? drm_plane_get_damage_clips.cold+0x1c/0x1c drm_client_modeset_commit_atomic+0x203/0x250 drm_client_modeset_commit_locked+0x56/0x150 drm_client_modeset_commit+0x21/0x40 drm_fb_helper_lastclose+0x42/0x70 amdgpu_driver_lastclose_kms+0xa/0x10 [amdgpu 340dadd3f7c8cf4be11cf0bdc850245e99abe0e8] drm_release+0xda/0x110 __fput+0x89/0x240 task_work_run+0x5c/0x90 do_exit+0x333/0xae0 do_group_exit+0x2d/0x90 __x64_sys_exit_group+0x14/0x20 do_syscall_64+0x5b/0x80 ? exit_to_user_mode_prepare+0x1e/0x140 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ff016ceaca1 Code: Unable to access opcode bytes at RIP 0x7ff016ceac77. RSP: 002b:00007ffe7a2357e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007ff016e15a00 RCX: 00007ff016ceaca1 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffffffffffffff78 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff016e15a00 R13: 0000000000000000 R14: 00007ff016e1aee8 R15: 00007ff016e1af00 </TASK>
Since this issue only happens in a transition state on DC, this commit replace BREAK_TO_DEBUGGER with DC_LOG_DC.
--- drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +2 -3
@@ -1009,7 +1009,7 @@ static void dce_transform_set_pixel_storage_depth( color_depth =COLOR_DEPTH_101010 ; pixel_depth =0 ; expan_mode =1 ; -BREAK_TO_DEBUGGER (); +DC_LOG_DC ("The pixel depth %d is not valid, set COLOR_DEPTH_101010 instead." , depth);break ; }
@@ -1023,8 +1023,7 @@ static void dce_transform_set_pixel_storage_depth(if (!(xfm_dce->lb_pixel_depth_supported & depth)) {/*we should use unsupported capabilities * unless it is required by w/a*/ -DC_LOG_WARNING ("%s: Capability not supported" , - __func__); +DC_LOG_DC ("%s: Capability not supported" , __func__); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 35/203 regmap: cache: Return error in cache sync operations for REGCACHE_NONE
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit fd883d79e4dcd2417c2b80756f22a2ff03b0f6e0 ]
There is no sense in doing a cache sync on REGCACHE_NONE regmaps. Instead of panicking the kernel due to missing cache_ops, return an error to client driver.
--- drivers/base/regmap/regcache.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/base/regmap/regcache.c +6 -0
@@ -343,6 +343,9 @@ int regcache_sync(struct regmap *map)const char *name;bool bypass; +if (WARN_ON (map->cache_type ==REGCACHE_NONE )) +return -EINVAL ; +BUG_ON (!map->cache_ops); map->lock (map->lock_arg);
@@ -412,6 +415,9 @@ int regcache_sync_region(struct regmap *map, unsigned int min,const char *name;bool bypass; +if (WARN_ON (map->cache_type ==REGCACHE_NONE )) +return -EINVAL ; +BUG_ON (!map->cache_ops); map->lock (map->lock_arg);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 26/203 ext4: dont clear SB_RDONLY when remounting r/w until quota is re-enabled
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
[ Upstream commit a44be64bbecb15a452496f60db6eacfee2b59c79 ]
When a file system currently mounted read/only is remounted read/write, if we clear the SB_RDONLY flag too early, before the quota is initialized, and there is another process/thread constantly attempting to create a directory, it's possible to trigger the
WARN_ON_ONCE(dquot_initialize_needed(inode));
in ext4_xattr_block_set(), with the following stack trace:
WARNING: CPU: 0 PID: 5338 at fs/ext4/xattr.c:2141 ext4_xattr_block_set+0x2ef2/0x3680
RIP: 0010:ext4_xattr_block_set+0x2ef2/0x3680 fs/ext4/xattr.c:2141
Call Trace:
ext4_xattr_set_handle+0xcd4/0x15c0 fs/ext4/xattr.c:2458
ext4_initxattrs+0xa3/0x110 fs/ext4/xattr_security.c:44
security_inode_init_security+0x2df/0x3f0 security/security.c:1147
__ext4_new_inode+0x347e/0x43d0 fs/ext4/ialloc.c:1324
ext4_mkdir+0x425/0xce0 fs/ext4/namei.c:2992
vfs_mkdir+0x29d/0x450 fs/namei.c:4038
do_mkdirat+0x264/0x520 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4074--- fs/ext4/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/super.c +5 -1
@@ -5746,6 +5746,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)struct ext4_mount_options old_opts;ext4_group_t g;int err =0 ; +int enable_rw =0 ;#ifdef CONFIG_QUOTA int enable_quota =0 ;int i, j;
@@ -5946,7 +5947,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)if (err) goto restore_opts; - sb->s_flags &= ~SB_RDONLY ; + enable_rw =1 ;if (ext4_has_feature_mmp (sb)) { err =ext4_multi_mount_protect (sb,le64_to_cpu (es->s_mmp_block));
@@ -6005,6 +6006,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)if (!test_opt (sb,BLOCK_VALIDITY ) && sbi->s_system_blks)ext4_release_system_zone (sb); +if (enable_rw) + sb->s_flags &= ~SB_RDONLY ; +if (!ext4_has_feature_mmp (sb) ||sb_rdonly (sb))ext4_stop_mmpd (sbi);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 57/203 scsi: target: iscsit: Free cmds before session free
In reply to Greg Kroah-HartmanFrom: Dmitry Bogdanov <[email protected]>
[ Upstream commit d8990b5a4d065f38f35d69bcd627ec5a7f8330ca ]
Commands from recovery entries are freed after session has been closed. That leads to use-after-free at command free or NPE with such call trace:
Time2Retain timer expired for SID: 1, cleaning up iSCSI session.
BUG: kernel NULL pointer dereference, address: 0000000000000140 RIP: 0010:sbitmap_queue_clear+0x3a/0xa0 Call Trace: target_release_cmd_kref+0xd1/0x1f0 [target_core_mod] transport_generic_free_cmd+0xd1/0x180 [target_core_mod] iscsit_free_cmd+0x53/0xd0 [iscsi_target_mod] iscsit_free_connection_recovery_entries+0x29d/0x320 [iscsi_target_mod] iscsit_close_session+0x13a/0x140 [iscsi_target_mod] iscsit_check_post_dataout+0x440/0x440 [iscsi_target_mod] call_timer_fn+0x24/0x140
Move cleanup of recovery enrties to before session freeing.
--- drivers/target/iscsi/iscsi_target.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/target/iscsi/iscsi_target.c +3 -3
@@ -4387,6 +4387,9 @@ int iscsit_close_session(struct iscsi_session *sess, bool can_sleep)iscsit_stop_time2retain_timer (sess);spin_unlock_bh (&se_tpg->session_lock); +if (sess->sess_ops->ErrorRecoveryLevel ==2 ) +iscsit_free_connection_recovery_entries (sess); +/* * transport_deregister_session_configfs() will clear the * struct se_node_acl->nacl_sess pointer now as a iscsi_np process context
@@ -4410,9 +4413,6 @@ int iscsit_close_session(struct iscsi_session *sess, bool can_sleep)transport_deregister_session (sess->se_sess); -if (sess->sess_ops->ErrorRecoveryLevel ==2 ) -iscsit_free_connection_recovery_entries (sess); -iscsit_free_all_ooo_cmdsns (sess);spin_lock_bh (&se_tpg->session_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 66/203 samples/bpf: Fix fout leak in hbms run_bpf_prog
In reply to Greg Kroah-HartmanFrom: Hao Zeng <[email protected]>
[ Upstream commit 23acb14af1914010dd0aae1bbb7fab28bf518b8e ]
Fix fout being fopen'ed but then not subsequently fclose'd. In the affected branch, fout is otherwise going out of scope.
--- samples/bpf/hbm.c | 1 + 1 file changed, 1 insertion(+)
samples/bpf/hbm.c +1 -0
@@ -308,6 +308,7 @@ static int run_bpf_prog(char *prog, int cg_id) fout =fopen (fname,"w" );fprintf (fout,"id:%d\n" , cg_id);fprintf (fout,"ERROR: Could not lookup queue_stats\n" ); +fclose (fout); }else if (stats_flag && qstats.lastPacketTime > qstats.firstPacketTime) { long long delta_us = (qstats.lastPacketTime -
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 67/203 bpf: Add preempt_count_{sub,add} into btf id deny list
In reply to Greg Kroah-HartmanFrom: Yafang <[email protected]>
[ Upstream commit c11bd046485d7bf1ca200db0e7d0bdc4bafdd395 ]
The recursion check in __bpf_prog_enter* and __bpf_prog_exit* leave preempt_count_{sub,add} unprotected. When attaching trampoline to them we get panic as follows,
[ 867.843050] BUG: TASK stack guard page was hit at 0000000009d325cf (stack is 0000000046a46a15..00000000537e7b28) [ 867.843064] stack guard page: 0000 [#1] PREEMPT SMP NOPTI [ 867.843067] CPU: 8 PID: 11009 Comm: trace Kdump: loaded Not tainted 6.2.0+ #4 [ 867.843100] Call Trace: [ 867.843101] <TASK> [ 867.843104] asm_exc_int3+0x3a/0x40 [ 867.843108] RIP: 0010:preempt_count_sub+0x1/0xa0 [ 867.843135] __bpf_prog_enter_recur+0x17/0x90 [ 867.843148] bpf_trampoline_6442468108_0+0x2e/0x1000 [ 867.843154] ? preempt_count_sub+0x1/0xa0 [ 867.843157] preempt_count_sub+0x5/0xa0 [ 867.843159] ? migrate_enable+0xac/0xf0 [ 867.843164] __bpf_prog_exit_recur+0x2d/0x40 [ 867.843168] bpf_trampoline_6442468108_0+0x55/0x1000 ... [ 867.843788] preempt_count_sub+0x5/0xa0 [ 867.843793] ? migrate_enable+0xac/0xf0 [ 867.843829] __bpf_prog_exit_recur+0x2d/0x40 [ 867.843837] BUG: IRQ stack guard page was hit at 0000000099bd8228 (stack is 00000000b23e2bc4..000000006d95af35) [ 867.843841] BUG: IRQ stack guard page was hit at 000000005ae07924 (stack is 00000000ffd69623..0000000014eb594c) [ 867.843843] BUG: IRQ stack guard page was hit at 00000000028320f0 (stack is 00000000034b6438..0000000078d1bcec) [ 867.843842] bpf_trampoline_6442468108_0+0x55/0x1000
...
That is because in __bpf_prog_exit_recur, the preempt_count_{sub,add} are called after prog->active is decreased.
Fixing this by adding these two functions into btf ids deny list.
--- kernel/bpf/verifier.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/verifier.c +4 -0
@@ -13645,6 +13645,10 @@ BTF_ID(func, migrate_enable)#if !definedCONFIG_PREEMPT_RCU && !definedCONFIG_TINY_RCU BTF_ID(func, rcu_read_unlock_strict)#endif +#if defined(CONFIG_DEBUG_PREEMPT ) || defined(CONFIG_TRACE_PREEMPT_TOGGLE ) +BTF_ID(func, preempt_count_add) +BTF_ID(func, preempt_count_sub) +#endif BTF_SET_END (btf_id_deny) static int check_attach_btf_id(struct bpf_verifier_env *env)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 68/203 wifi: iwlwifi: pcie: fix possible NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Daniel Gabay <[email protected]>
[ Upstream commit b655b9a9f8467684cfa8906713d33b71ea8c8f54 ]
It is possible that iwl_pci_probe() will fail and free the trans, then afterwards iwl_pci_remove() will be called and crash by trying to access trans which is already freed, fix it.
iwlwifi 0000:01:00.0: Detected crf-id 0xa5a5a5a2, cnv-id 0xa5a5a5a2
wfpm id 0xa5a5a5a2 iwlwifi 0000:01:00.0: Can't find a correct rfid for crf id 0x5a2 ... BUG: kernel NULL pointer dereference, address: 0000000000000028 ... RIP: 0010:iwl_pci_remove+0x12/0x30 [iwlwifi] pci_device_remove+0x3e/0xb0 device_release_driver_internal+0x103/0x1f0 driver_detach+0x4c/0x90 bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 pci_unregister_driver+0x40/0x90 iwl_pci_unregister_driver+0x15/0x20 [iwlwifi] __exit_compat+0x9/0x98 [iwlwifi] __x64_sys_delete_module+0x147/0x260
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +3 -0
@@ -1380,6 +1380,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) {struct iwl_trans *trans =pci_get_drvdata (pdev); +if (!trans) +return ; +iwl_drv_stop (trans->drv);iwl_trans_pcie_free (trans);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 69/203 wifi: iwlwifi: pcie: Fix integer overflow in iwl_write_to_user_buf
In reply to Greg Kroah-HartmanFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit 58d1b717879bfeabe09b35e41ad667c79933eb2e ]
An integer overflow occurs in the iwl_write_to_user_buf() function, which is called by the iwl_dbgfs_monitor_data_read() function.
static bool iwl_write_to_user_buf(char __user *user_buf, ssize_t count,
void *buf, ssize_t *size, ssize_t *bytes_copied)
{
int buf_size_left = count - *bytes_copied;
buf_size_left = buf_size_left - (buf_size_left % sizeof(u32));
if (*size > buf_size_left)
*size = buf_size_left;If the user passes a SIZE_MAX value to the "ssize_t count" parameter, the ssize_t count parameter is assigned to "int buf_size_left". Then compare "*size" with "buf_size_left" . Here, "buf_size_left" is a negative number, so "*size" is assigned "buf_size_left" and goes into the third argument of the copy_to_user function, causing a heap overflow.
This is not a security vulnerability because iwl_dbgfs_monitor_data_read() is a debugfs operation with 0400 privileges.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 -1
@@ -2778,7 +2778,7 @@ static bool iwl_write_to_user_buf(char __user *user_buf, ssize_t count, void *buf, ssize_t *size, ssize_t *bytes_copied) { - int buf_size_left = count - *bytes_copied; + ssize_t buf_size_left = count - *bytes_copied; buf_size_left = buf_size_left - (buf_size_left %sizeof (u32));if (*size > buf_size_left)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 70/203 null_blk: Always check queue mode setting from configfs
In reply to Greg Kroah-HartmanFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit 63f8793ee60513a09f110ea460a6ff2c33811cdb ]
Make sure to check device queue mode in the null_validate_conf() and return error for NULL_Q_RQ as we don't allow legacy I/O path, without this patch we get OOPs when queue mode is set to 1 from configfs, following are repro steps :-
modprobe null_blk nr_devices=0
mkdir config/nullb/nullb0
echo 1 > config/nullb/nullb0/memory_backed
echo 4096 > config/nullb/nullb0/blocksize
echo 20480 > config/nullb/nullb0/size
echo 1 > config/nullb/nullb0/queue_mode
echo 1 > config/nullb/nullb0/power
Entering kdb (current=0xffff88810acdd080, pid 2372) on processor 42 Oops: (null) due to oops @ 0xffffffffc041c329
CPU: 42 PID: 2372 Comm: sh Tainted: G O N 6.3.0-rc5lblk+ #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:null_add_dev.part.0+0xd9/0x720 [null_blk] Code: 01 00 00 85 d2 0f 85 a1 03 00 00 48 83 bb 08 01 00 00 00 0f 85 f7 03 00 00 80 bb 62 01 00 00 00 48 8b 75 20 0f 85 6d 02 00 00 <48> 89 6e 60 48 8b 75 20 bf 06 00 00 00 e8 f5 37 2c c1 48 8b 75 20 RSP: 0018:ffffc900052cbde0 EFLAGS: 00010246 RAX: 0000000000000001 RBX: ffff88811084d800 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888100042e00 RBP: ffff8881053d8200 R08: ffffc900052cbd68 R09: ffff888105db2000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000002 R13: ffff888104765200 R14: ffff88810eec1748 R15: ffff88810eec1740 FS: 00007fd445fd1740(0000) GS:ffff8897dfc80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000060 CR3: 0000000166a00000 CR4: 0000000000350ee0 DR0: ffffffff8437a488 DR1: ffffffff8437a489 DR2: ffffffff8437a48a DR3: ffffffff8437a48b DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: <TASK> nullb_device_power_store+0xd1/0x120 [null_blk] configfs_write_iter+0xb4/0x120 vfs_write+0x2ba/0x3c0 ksys_write+0x5f/0xe0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7fd4460c57a7 Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 RSP: 002b:00007ffd3792a4a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fd4460c57a7 RDX: 0000000000000002 RSI: 000055b43c02e4c0 RDI: 0000000000000001 RBP: 000055b43c02e4c0 R08: 000000000000000a R09: 00007fd44615b4e0 R10: 00007fd44615b3e0 R11: 0000000000000246 R12: 0000000000000002 R13: 00007fd446198520 R14: 0000000000000002 R15: 00007fd446198700 </TASK>
--- drivers/block/null_blk/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/block/null_blk/main.c +5 -0
@@ -1744,6 +1744,11 @@ static int null_init_tag_set(struct nullb *nullb, struct blk_mq_tag_set *set)static int null_validate_conf (struct nullb_device *dev) { +if (dev->queue_mode ==NULL_Q_RQ ) { +pr_err ("legacy IO path is no longer available\n" ); +return -EINVAL ; + } + dev->blocksize =round_down (dev->blocksize,512 ); dev->blocksize = clamp_t(unsigned int, dev->blocksize, 512, 4096);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 71/203 wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit ef16799640865f937719f0771c93be5dca18adc6 ]
A received TKIP key may be up to 32 bytes because it may contain MIC rx/tx keys too. These are not used by iwl and copying these over overflows the iwl_keyinfo.key field.
Add a check to not copy more data to iwl_keyinfo.key then will fit.
This fixes backtraces like this one:
memcpy: detected field-spanning write (size 32) of single field "sta_cmd.key.key" at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 (size 16)
WARNING: CPU: 1 PID: 946 at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 iwlagn_send_sta_key+0x375/0x390 [iwldvm] <snip> Hardware name: Dell Inc. Latitude E6430/0H3MT5, BIOS A21 05/08/2017 RIP: 0010:iwlagn_send_sta_key+0x375/0x390 [iwldvm] <snip> Call Trace: <TASK> iwl_set_dynamic_key+0x1f0/0x220 [iwldvm] iwlagn_mac_set_key+0x1e4/0x280 [iwldvm] drv_set_key+0xa4/0x1b0 [mac80211] ieee80211_key_enable_hw_accel+0xa8/0x2d0 [mac80211] ieee80211_key_replace+0x22d/0x8e0 [mac80211] <snip>
--- drivers/net/wireless/intel/iwlwifi/dvm/sta.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/dvm/sta.c +4 -1
@@ -1086,6 +1086,7 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv, {__le16 key_flags;struct iwl_addsta_cmd sta_cmd; +size_t to_copy;int i;spin_lock_bh (&priv->sta_lock);
@@ -1105,7 +1106,9 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv, sta_cmd.key.tkip_rx_tsc_byte2 = tkip_iv32;for (i =0 ; i <5 ; i++) sta_cmd.key.tkip_rx_ttak[i] =cpu_to_le16 (tkip_p1k[i]); -memcpy (sta_cmd.key.key, keyconf->key, keyconf->keylen); +/* keyconf may contain MIC rx/tx keys which iwl does not use */ + to_copy =min_t (size_t,sizeof (sta_cmd.key.key), keyconf->keylen); +memcpy (sta_cmd.key.key, keyconf->key, to_copy);break ;case WLAN_CIPHER_SUITE_WEP104 : key_flags |=STA_KEY_FLG_KEY_SIZE_MSK ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 72/203 wifi: ath11k: Fix SKB corruption in REO destination ring
In reply to Greg Kroah-HartmanFrom: Nagarajan Maran <[email protected]>
[ Upstream commit f9fff67d2d7ca6fa8066132003a3deef654c55b1 ]
While running traffics for a long time, randomly an RX descriptor filled with value "0" from REO destination ring is received. This descriptor which is invalid causes the wrong SKB (SKB stored in the IDR lookup with buffer id "0") to be fetched which in turn causes SKB memory corruption issue and the same leads to crash after some time.
Changed the start id for idr allocation to "1" and the buffer id "0" is reserved for error validation. Introduced Sanity check to validate the descriptor, before processing the SKB.
Crash Signature :
Unable to handle kernel paging request at virtual address 3f004900 PC points to "b15_dma_inv_range+0x30/0x50" LR points to "dma_cache_maint_page+0x8c/0x128".
The Backtrace obtained is as follows:
[<8031716c>] (b15_dma_inv_range) from [<80313a4c>] (dma_cache_maint_page+0x8c/0x128)
[<80313a4c>] (dma_cache_maint_page) from [<80313b90>] (__dma_page_dev_to_cpu+0x28/0xcc) [<80313b90>] (__dma_page_dev_to_cpu) from [<7fb5dd68>] (ath11k_dp_process_rx+0x1e8/0x4a4 [ath11k]) [<7fb5dd68>] (ath11k_dp_process_rx [ath11k]) from [<7fb53c20>] (ath11k_dp_service_srng+0xb0/0x2ac [ath11k]) [<7fb53c20>] (ath11k_dp_service_srng [ath11k]) from [<7f67bba4>] (ath11k_pci_ext_grp_napi_poll+0x1c/0x78 [ath11k_pci]) [<7f67bba4>] (ath11k_pci_ext_grp_napi_poll [ath11k_pci]) from [<807d5cf4>] (__napi_poll+0x28/0xb8) [<807d5cf4>] (__napi_poll) from [<807d5f28>] (net_rx_action+0xf0/0x280)
[<807d5f28>] (net_rx_action) from [<80302148>] (__do_softirq+0xd0/0x280)
[<80302148>] (__do_softirq) from [<80320408>] (irq_exit+0x74/0xd4)
[<80320408>] (irq_exit) from [<803638a4>] (__handle_domain_irq+0x90/0xb4)
[<803638a4>] (__handle_domain_irq) from [<805bedec>] (gic_handle_irq+0x58/0x90)
[<805bedec>] (gic_handle_irq) from [<80301a78>] (__irq_svc+0x58/0x8c)
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +6 -3
@@ -354,10 +354,10 @@ int ath11k_dp_rxbufs_replenish(struct ath11k_base *ab, int mac_id, goto fail_free_skb;spin_lock_bh (&rx_ring->idr_lock); - buf_id =idr_alloc (&rx_ring->bufs_idr, skb,0 , - rx_ring->bufs_max *3 ,GFP_ATOMIC ); + buf_id =idr_alloc (&rx_ring->bufs_idr, skb,1 , + (rx_ring->bufs_max *3 ) +1 ,GFP_ATOMIC );spin_unlock_bh (&rx_ring->idr_lock); -if (buf_id <0 ) +if (buf_id <=0 ) goto fail_dma_unmap; desc =ath11k_hal_srng_src_get_next_entry (ab, srng);
@@ -2602,6 +2602,9 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id, cookie); mac_id =FIELD_GET (DP_RXDMA_BUF_COOKIE_PDEV_ID , cookie); +if (unlikely (buf_id ==0 )) +continue ; + ar = ab->pdevs[mac_id].ar; rx_ring = &ar->dp.rx_refill_buf_ring;spin_lock_bh (&rx_ring->idr_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 73/203 nbd: fix incomplete validation of ioctl arg
In reply to Greg Kroah-HartmanFrom: Zhong Jinghua <[email protected]>
[ Upstream commit 55793ea54d77719a071b1ccc05a05056e3b5e009 ]
We tested and found an alarm caused by nbd_ioctl arg without verification. The UBSAN warning calltrace like below:
UBSAN: Undefined behaviour in fs/buffer.c:1709:35 signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long long int' CPU: 3 PID: 2523 Comm: syz-executor.0 Not tainted 4.19.90 #1 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x3f0 arch/arm64/kernel/time.c:78 show_stack+0x28/0x38 arch/arm64/kernel/traps.c:158 __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x170/0x1dc lib/dump_stack.c:118 ubsan_epilogue+0x18/0xb4 lib/ubsan.c:161 handle_overflow+0x188/0x1dc lib/ubsan.c:192 __ubsan_handle_sub_overflow+0x34/0x44 lib/ubsan.c:206 __block_write_full_page+0x94c/0xa20 fs/buffer.c:1709 block_write_full_page+0x1f0/0x280 fs/buffer.c:2934 blkdev_writepage+0x34/0x40 fs/block_dev.c:607 __writepage+0x68/0xe8 mm/page-writeback.c:2305 write_cache_pages+0x44c/0xc70 mm/page-writeback.c:2240 generic_writepages+0xdc/0x148 mm/page-writeback.c:2329 blkdev_writepages+0x2c/0x38 fs/block_dev.c:2114 do_writepages+0xd4/0x250 mm/page-writeback.c:2344
The reason for triggering this warning is __block_write_full_page() -> i_size_read(inode) - 1 overflow.inode->i_size is assigned in __nbd_ioctl() -> nbd_set_size() -> bytesize. We think it is necessary to limit the size of arg to prevent errors.
Moreover, __nbd_ioctl() -> nbd_add_socket(), arg will be cast to int. Assuming the value of arg is 0x80000000000000001) (on a 64-bit machine), it will become 1 after the coercion, which will return unexpected results.
Fix it by adding checks to prevent passing in too large numbers.
--- drivers/block/nbd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/block/nbd.c +6 -0
@@ -326,6 +326,9 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,if (blksize <512 || blksize >PAGE_SIZE || !is_power_of_2 (blksize))return -EINVAL ; +if (bytesize <0 ) +return -EINVAL ; + nbd->config->bytesize = bytesize; nbd->config->blksize_bits =__ffs (blksize);
@@ -1048,6 +1051,9 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,struct nbd_sock *nsock;int err; +/* Arg will be cast to int, check it to avoid overflow */ +if (arg >INT_MAX ) +return -EINVAL ; sock =nbd_get_socket (nbd, arg, &err);if (!sock)return err;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 74/203 ipvs: Update width of source for ip_vs_sync_conn_options
In reply to Greg Kroah-HartmanFrom: Simon Horman <[email protected]>
[ Upstream commit e3478c68f6704638d08f437cbc552ca5970c151a ]
In ip_vs_sync_conn_v0() copy is made to struct ip_vs_sync_conn_options. That structure looks like this:
struct ip_vs_sync_conn_options {
struct ip_vs_seq in_seq;
struct ip_vs_seq out_seq;
};The source of the copy is the in_seq field of struct ip_vs_conn. Whose type is struct ip_vs_seq. Thus we can see that the source - is not as wide as the amount of data copied, which is the width of struct ip_vs_sync_conn_option.
The copy is safe because the next field in is another struct ip_vs_seq. Make use of struct_group() to annotate this.
Flagged by gcc-13 as:
In file included from ./include/linux/string.h:254,
from ./include/linux/bitmap.h:11,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/paravirt.h:17,
from ./arch/x86/include/asm/cpuid.h:62,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/timex.h:5,
from ./include/linux/timex.h:67,
from ./include/linux/time32.h:13,
from ./include/linux/time.h:60,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:13,
from net/netfilter/ipvs/ip_vs_sync.c:38:
In function 'fortify_memcpy_chk',
inlined from 'ip_vs_sync_conn_v0' at net/netfilter/ipvs/ip_vs_sync.c:606:3:
./include/linux/fortify-string.h:529:25: error: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
529 | __read_overflow2_field(q_size_field, size);
|Compile tested only.
--- include/net/ip_vs.h | 6 ++++-- net/netfilter/ipvs/ip_vs_sync.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
include/net/ip_vs.h +4 -2
@@ -549,8 +549,10 @@ struct ip_vs_conn {*/ struct ip_vs_app *app;/* bound ip_vs_app object */ void *app_data;/* Application private data */ -struct ip_vs_seq in_seq;/* incoming seq. struct */ -struct ip_vs_seq out_seq;/* outgoing seq. struct */ +struct_group (sync_conn_opt, + struct ip_vs_seq in_seq; /* incoming seq. struct */ +struct ip_vs_seq out_seq;/* outgoing seq. struct */ + );const struct ip_vs_pe *pe;char *pe_data;
net/netfilter/ipvs/ip_vs_sync.c +1 -1
@@ -603,7 +603,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,if (cp->flags &IP_VS_CONN_F_SEQ_MASK ) {struct ip_vs_sync_conn_options *opt = (struct ip_vs_sync_conn_options *)&s[1 ]; -memcpy (opt, &cp->in_seq,sizeof (*opt)); +memcpy (opt, &cp->sync_conn_opt,sizeof (*opt)); } m->nr_conns++;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 75/203 Bluetooth: btintel: Add LE States quirk support
In reply to Greg Kroah-HartmanFrom: Chethan T N <[email protected]>
[ Upstream commit 77f542b10c535c9a93bf8afdd2665524935807c2 ]
Basically all Intel controllers support both Central/Peripheral LE states.
This patch enables the LE States quirk by default on all Solar and Magnertor Intel controllers.
--- drivers/bluetooth/btintel.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bluetooth/btintel.c +2 -3
@@ -2381,9 +2381,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)*/ set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); -/* Valid LE States quirk for GfP */ -if (INTEL_HW_VARIANT (ver_tlv.cnvi_bt) ==0x18 ) -set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); +/* Apply LE States quirk from solar onwards */ +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks);/* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 58/203 lib: cpu_rmap: Avoid use after free on rmap->obj array entries
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
[ Upstream commit 4e0473f1060aa49621d40a113afde24818101d37 ]
When calling irq_set_affinity_notifier() with NULL at the notify argument, it will cause freeing of the glue pointer in the corresponding array entry but will leave the pointer in the array. A subsequent call to free_irq_cpu_rmap() will try to free this entry again leading to possible use after free.
Fix that by setting NULL to the array entry and checking that we have non-zero at the array entry when iterating over the array in free_irq_cpu_rmap().
The current code does not suffer from this since there are no cases where irq_set_affinity_notifier(irq, NULL) (note the NULL passed for the notify arg) is called, followed by a call to free_irq_cpu_rmap() so we don't hit and issue. Subsequent patches in this series excersize this flow, hence the required fix.
--- lib/cpu_rmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/cpu_rmap.c +4 -1
@@ -232,7 +232,8 @@ void free_irq_cpu_rmap(struct cpu_rmap *rmap)for (index =0 ; index < rmap->used; index++) { glue = rmap->obj[index]; -irq_set_affinity_notifier (glue->notify.irq,NULL ); +if (glue) +irq_set_affinity_notifier (glue->notify.irq,NULL ); }cpu_rmap_put (rmap);
@@ -268,6 +269,7 @@ static void irq_cpu_rmap_release(struct kref *ref) container_of(ref, struct irq_glue, notify.kref);cpu_rmap_put (glue->rmap); + glue->rmap->obj[glue->index] =NULL ;kfree (glue); }
@@ -297,6 +299,7 @@ int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq) rc =irq_set_affinity_notifier (irq, &glue->notify);if (rc) {cpu_rmap_put (glue->rmap); + rmap->obj[glue->index] =NULL ;kfree (glue); }return rc;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 76/203 Bluetooth: hci_bcm: Fall back to getting bdaddr from EFI if not set
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 0d218c3642b9ccf71f44987cd03c19320f3bd918 ]
On some devices the BCM Bluetooth adapter does not have a valid bdaddr set.
btbcm.c currently sets HCI_QUIRK_INVALID_BDADDR to indicate when this is the case. But this requires users to manual setup a btaddr, by doing e.g.:
btmgmt -i hci0 public-addr 'B0:F1:EC:82:1D:B3'
Which means that Bluetooth will not work out of the box on such devices. To avoid this (where possible) hci_bcm sets: HCI_QUIRK_USE_BDADDR_PROPERTY which tries to get the bdaddr from devicetree.
But this only works on devicetree platforms. On UEFI based platforms there is a special Broadcom UEFI variable which when present contains the devices bdaddr, just like how there is another UEFI variable which contains wifi nvram contents including the wifi MAC address.
Add support for getting the bdaddr from this Broadcom UEFI variable, so that Bluetooth will work OOTB for users on devices where this UEFI variable is present.
This fixes Bluetooth not working on for example Asus T100HA 2-in-1s.
--- drivers/bluetooth/btbcm.c | 47 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-)
drivers/bluetooth/btbcm.c +44 -3
@@ -6,6 +6,7 @@* Copyright (C) 2015 Intel Corporation */ +#include <linux/efi.h> #include <linux/module.h> #include <linux/firmware.h> #include <linux/dmi.h>
@@ -33,6 +34,43 @@/* For kmalloc-ing the fw-name array instead of putting it on the stack */ typedef char bcm_fw_name [BCM_FW_NAME_LEN ]; +#ifdef CONFIG_EFI +static int btbcm_set_bdaddr_from_efi (struct hci_dev *hdev) +{ +efi_guid_t guid =EFI_GUID (0x74b00bd9 ,0x805a ,0x4d61 ,0xb5 ,0x1f , +0x43 ,0x26 ,0x81 ,0x23 ,0xd1 ,0x13 ); +bdaddr_t efi_bdaddr, bdaddr; +efi_status_t status; +unsigned long len; +int ret; + +if (!efi_rt_services_supported (EFI_RT_SUPPORTED_GET_VARIABLE )) +return -EOPNOTSUPP ; + + len =sizeof (efi_bdaddr); + status = efi.get_variable (L"BDADDR" , &guid,NULL , &len, &efi_bdaddr); +if (status !=EFI_SUCCESS ) +return -ENXIO ; + +if (len !=sizeof (efi_bdaddr)) +return -EIO ; + +baswap (&bdaddr, &efi_bdaddr); + + ret =btbcm_set_bdaddr (hdev, &bdaddr); +if (ret) +return ret; + +bt_dev_info (hdev,"BCM: Using EFI device address (%pMR)" , &bdaddr); +return 0 ; +} +#else +static int btbcm_set_bdaddr_from_efi (struct hci_dev *hdev) +{ +return -EOPNOTSUPP ; +} +#endif +int btbcm_check_bdaddr (struct hci_dev *hdev) {struct hci_rp_read_bd_addr *bda;
@@ -86,9 +124,12 @@ int btbcm_check_bdaddr(struct hci_dev *hdev) !bacmp(&bda->bdaddr, BDADDR_BCM4345C5) || !bacmp(&bda->bdaddr, BDADDR_BCM43430A0) || !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) { -bt_dev_info (hdev,"BCM: Using default device address (%pMR)" , - &bda->bdaddr); -set_bit (HCI_QUIRK_INVALID_BDADDR , &hdev->quirks); +/* Try falling back to BDADDR EFI variable */ +if (btbcm_set_bdaddr_from_efi (hdev) !=0 ) { +bt_dev_info (hdev,"BCM: Using default device address (%pMR)" , + &bda->bdaddr); +set_bit (HCI_QUIRK_INVALID_BDADDR , &hdev->quirks); + } }kfree_skb (skb);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 77/203 Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp
In reply to Greg Kroah-HartmanFrom: Min Li <[email protected]>
[ Upstream commit 25e97f7b1866e6b8503be349eeea44bb52d661ce ]
conn->chan_lock isn't acquired before l2cap_get_chan_by_scid, if l2cap_get_chan_by_scid returns NULL, then 'bad unlock balance' is triggered.
--- net/bluetooth/l2cap_core.c | 1 - 1 file changed, 1 deletion(-)
net/bluetooth/l2cap_core.c +0 -1
@@ -4694,7 +4694,6 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, chan =l2cap_get_chan_by_scid (conn, scid);if (!chan) { -mutex_unlock (&conn->chan_lock);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 78/203 staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE
In reply to Greg Kroah-HartmanFrom: Philipp Hortmann <[email protected]>
[ Upstream commit fda2093860df4812d69052a8cf4997e53853a340 ]
Replace macro RTL_PCI_DEVICE with PCI_DEVICE to get rid of rtl819xp_ops which is empty.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3 -3
@@ -49,9 +49,9 @@ static const struct rtl819x_ops rtl819xp_ops = { };static struct pci_device_id rtl8192_pci_id_tbl[] = { - {RTL_PCI_DEVICE (0x10ec ,0x8192 , rtl819xp_ops)}, - {RTL_PCI_DEVICE (0x07aa ,0x0044 , rtl819xp_ops)}, - {RTL_PCI_DEVICE (0x07aa ,0x0047 , rtl819xp_ops)}, + {PCI_DEVICE (0x10ec ,0x8192 )}, + {PCI_DEVICE (0x07aa ,0x0044 )}, + {PCI_DEVICE (0x07aa ,0x0047 )}, {} };
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -5
@@ -55,11 +55,6 @@#define IS_HARDWARE_TYPE_8192SE (_priv) \ (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192SE) -#define RTL_PCI_DEVICE (vend, dev, cfg) \ - .vendor = (vend), .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ - .driver_data = (kernel_ulong_t)&(cfg) -#define TOTAL_CAM_ENTRY 32#define CAM_CONTENT_COUNT 8
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 79/203 HID: logitech-hidpp: Dont use the USB serial for USB devices
In reply to Greg Kroah-HartmanFrom: Bastien Nocera <[email protected]>
[ Upstream commit 7ad1fe0da0fa91bf920b79ab05ae97bfabecc4f4 ]
For devices that support the 0x0003 feature (Device Information) version 4, set the serial based on the output of that feature, rather than relying on the usbhid code setting the USB serial.
This should allow the serial when connected through USB to (nearly) match the one when connected through a unifying receiver.
For example, on the serials on a G903 wired/wireless mouse:
- Unifying: 4067-e8-ce-cd-45
- USB before patch: 017C385C3837
- USB after patch: c086-e8-ce-cd-45
--- drivers/hid/hid-logitech-hidpp.c | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/hid/hid-logitech-hidpp.c +51 -0
@@ -928,6 +928,55 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)return 0 ; } +/* -------------------------------------------------------------------------- */ +/* 0x0003: Device Information */ +/* -------------------------------------------------------------------------- */ + +#define HIDPP_PAGE_DEVICE_INFORMATION 0x0003 + +#define CMD_GET_DEVICE_INFO 0x00 + +static int hidpp_get_serial (struct hidpp_device *hidpp,u32 *serial) +{ +struct hidpp_report response; +u8 feature_type; +u8 feature_index; +int ret; + + ret =hidpp_root_get_feature (hidpp,HIDPP_PAGE_DEVICE_INFORMATION , + &feature_index, + &feature_type); +if (ret) +return ret; + + ret =hidpp_send_fap_command_sync (hidpp, feature_index, +CMD_GET_DEVICE_INFO , +NULL ,0 , &response); +if (ret) +return ret; + +/* See hidpp_unifying_get_serial() */ + *serial = *((u32 *)&response.rap.params[1 ]); +return 0 ; +} + +static int hidpp_serial_init (struct hidpp_device *hidpp) +{ +struct hid_device *hdev = hidpp->hid_dev; +u32 serial; +int ret; + + ret =hidpp_get_serial (hidpp, &serial); +if (ret) +return ret; + +snprintf (hdev->uniq,sizeof (hdev->uniq),"%04x-%4phD" , + hdev->product, &serial); +dbg_hid ("HID++ DeviceInformation: Got serial: %s\n" , hdev->uniq); + +return 0 ; +} +/* -------------------------------------------------------------------------- */ /* 0x0005: GetDeviceNameType */ /* -------------------------------------------------------------------------- */
@@ -4141,6 +4190,8 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)if (hidpp->quirks &HIDPP_QUIRK_UNIFYING )hidpp_unifying_init (hidpp); +else if (hid_is_usb (hidpp->hid_dev)) +hidpp_serial_init (hidpp); connected =hidpp_root_get_protocol_version (hidpp) ==0 ;atomic_set (&hidpp->connected, connected);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 80/203 HID: logitech-hidpp: Reconcile USB and Unifying serials
In reply to Greg Kroah-HartmanFrom: Bastien Nocera <[email protected]>
[ Upstream commit 5b3691d15e04b6d5a32c915577b8dbc5cfb56382 ]
Now that USB HID++ devices can gather a serial number that matches the one that would be gathered when connected through a Unifying receiver, remove the last difference by dropping the product ID as devices usually have different product IDs when connected through USB or Unifying.
For example, on the serials on a G903 wired/wireless mouse:
- Unifying before patch: 4067-e8-ce-cd-45
- USB before patch: c086-e8-ce-cd-45
- Unifying and USB after patch: e8-ce-cd-45
--- drivers/hid/hid-logitech-hidpp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/hid/hid-logitech-hidpp.c +2 -4
@@ -834,8 +834,7 @@ static int hidpp_unifying_init(struct hidpp_device *hidpp)if (ret)return ret; -snprintf (hdev->uniq,sizeof (hdev->uniq),"%04x-%4phD" , - hdev->product, &serial); +snprintf (hdev->uniq,sizeof (hdev->uniq),"%4phD" , &serial);dbg_hid ("HID++ Unifying: Got serial: %s\n" , hdev->uniq); name =hidpp_unifying_get_name (hidpp);
@@ -970,8 +969,7 @@ static int hidpp_serial_init(struct hidpp_device *hidpp)if (ret)return ret; -snprintf (hdev->uniq,sizeof (hdev->uniq),"%04x-%4phD" , - hdev->product, &serial); +snprintf (hdev->uniq,sizeof (hdev->uniq),"%4phD" , &serial);dbg_hid ("HID++ DeviceInformation: Got serial: %s\n" , hdev->uniq);return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 81/203 spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3
In reply to Greg Kroah-HartmanFrom: Kevin Groeneveld <[email protected]>
[ Upstream commit 87c614175bbf28d3fd076dc2d166bac759e41427 ]
When using gpio based chip select the cs value can go outside the range 0 – 3. The various MX51_ECSPI_* macros did not take this into consideration resulting in possible corruption of the configuration.
For example for any cs value over 3 the SCLKPHA bits would not be set and other values in the register possibly corrupted.
One way to fix this is to just mask the cs bits to 2 bits. This still allows all 4 native chip selects to work as well as gpio chip selects (which can use any of the 4 chip select configurations).
--- drivers/spi/spi-imx.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/spi/spi-imx.c +18 -6
@@ -247,6 +247,18 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,return true; } +/* +* Note the number of natively supported chip selects for MX51 is 4. Some +* devices may have less actual SS pins but the register map supports 4. When +* using gpio chip selects the cs values passed into the macros below can go +* outside the range 0 - 3. We therefore need to limit the cs value to avoid +* corrupting bits outside the allocated locations. +* +* The simplest way to do this is to just mask the cs bits to 2 bits. This +* still allows all 4 native chip selects to work as well as gpio chip selects +* (which can use any of the 4 chip select configurations). +*/ +#define MX51_ECSPI_CTRL 0x08#define MX51_ECSPI_CTRL_ENABLE (1 << 0)#define MX51_ECSPI_CTRL_XCH (1 << 2)
@@ -255,16 +267,16 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,#define MX51_ECSPI_CTRL_DRCTL (drctl) ((drctl) << 16)#define MX51_ECSPI_CTRL_POSTDIV_OFFSET 8#define MX51_ECSPI_CTRL_PREDIV_OFFSET 12 -#define MX51_ECSPI_CTRL_CS (cs) ((cs) << 18) +#define MX51_ECSPI_CTRL_CS (cs) ((cs & 3) << 18)#define MX51_ECSPI_CTRL_BL_OFFSET 20#define MX51_ECSPI_CTRL_BL_MASK (0xfff << 20)#define MX51_ECSPI_CONFIG 0x0c -#define MX51_ECSPI_CONFIG_SCLKPHA (cs) (1 << ((cs) + 0)) -#define MX51_ECSPI_CONFIG_SCLKPOL (cs) (1 << ((cs) + 4)) -#define MX51_ECSPI_CONFIG_SBBCTRL (cs) (1 << ((cs) + 8)) -#define MX51_ECSPI_CONFIG_SSBPOL (cs) (1 << ((cs) + 12)) -#define MX51_ECSPI_CONFIG_SCLKCTL (cs) (1 << ((cs) + 20)) +#define MX51_ECSPI_CONFIG_SCLKPHA (cs) (1 << ((cs & 3) + 0)) +#define MX51_ECSPI_CONFIG_SCLKPOL (cs) (1 << ((cs & 3) + 4)) +#define MX51_ECSPI_CONFIG_SBBCTRL (cs) (1 << ((cs & 3) + 8)) +#define MX51_ECSPI_CONFIG_SSBPOL (cs) (1 << ((cs & 3) + 12)) +#define MX51_ECSPI_CONFIG_SCLKCTL (cs) (1 << ((cs & 3) + 20))#define MX51_ECSPI_INT 0x10#define MX51_ECSPI_INT_TEEN (1 << 0)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 82/203 HID: wacom: generic: Set battery quirk only when we see battery data
In reply to Greg Kroah-HartmanFrom: Jason Gerecke <[email protected]>
[ Upstream commit bea407a427baa019758f29f4d31b26f008bb8cc6 ]
Some devices will include battery status usages in the HID descriptor but we won't see that battery data for one reason or another. For example, AES sensors won't send battery data unless an AES pen is in proximity. If a user does not have an AES pen but instead only interacts with the AES touchscreen with their fingers then there is no need for us to create a battery object. Similarly, if a family of peripherals shares the same HID descriptor between wired-only and wireless-capable SKUs, users of the former may never see a battery event and will not want a power_supply object created.
--- drivers/hid/wacom_wac.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-)
drivers/hid/wacom_wac.c +11 -22
@@ -1925,18 +1925,7 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,static void wacom_wac_battery_usage_mapping (struct hid_device *hdev,struct hid_field *field,struct hid_usage *usage) { -struct wacom *wacom =hid_get_drvdata (hdev); -struct wacom_wac *wacom_wac = &wacom->wacom_wac; -struct wacom_features *features = &wacom_wac->features; -unsigned equivalent_usage =wacom_equivalent_usage (usage->hid); - -switch (equivalent_usage) { -case HID_DG_BATTERYSTRENGTH : -case WACOM_HID_WD_BATTERY_LEVEL : -case WACOM_HID_WD_BATTERY_CHARGING : - features->quirks |=WACOM_QUIRK_BATTERY ; -break ; - } +return ; } static void wacom_wac_battery_event(struct hid_device *hdev, struct hid_field *field,
@@ -1957,18 +1946,21 @@ static void wacom_wac_battery_event(struct hid_device *hdev, struct hid_field *f wacom_wac->hid_data.bat_connected =1 ; wacom_wac->hid_data.bat_status =WACOM_POWER_SUPPLY_STATUS_AUTO ; } + wacom_wac->features.quirks |=WACOM_QUIRK_BATTERY ;break ;case WACOM_HID_WD_BATTERY_LEVEL : value = value *100 / (field->logical_maximum - field->logical_minimum); wacom_wac->hid_data.battery_capacity = value; wacom_wac->hid_data.bat_connected =1 ; wacom_wac->hid_data.bat_status =WACOM_POWER_SUPPLY_STATUS_AUTO ; + wacom_wac->features.quirks |=WACOM_QUIRK_BATTERY ;break ;case WACOM_HID_WD_BATTERY_CHARGING : wacom_wac->hid_data.bat_charging = value; wacom_wac->hid_data.ps_connected = value; wacom_wac->hid_data.bat_connected =1 ; wacom_wac->hid_data.bat_status =WACOM_POWER_SUPPLY_STATUS_AUTO ; + wacom_wac->features.quirks |=WACOM_QUIRK_BATTERY ;break ; } }
@@ -1984,18 +1976,15 @@ static void wacom_wac_battery_report(struct hid_device *hdev, {struct wacom *wacom =hid_get_drvdata (hdev);struct wacom_wac *wacom_wac = &wacom->wacom_wac; -struct wacom_features *features = &wacom_wac->features; -if (features->quirks &WACOM_QUIRK_BATTERY ) { -int status = wacom_wac->hid_data.bat_status; -int capacity = wacom_wac->hid_data.battery_capacity; -bool charging = wacom_wac->hid_data.bat_charging; -bool connected = wacom_wac->hid_data.bat_connected; -bool powered = wacom_wac->hid_data.ps_connected; +int status = wacom_wac->hid_data.bat_status; +int capacity = wacom_wac->hid_data.battery_capacity; +bool charging = wacom_wac->hid_data.bat_charging; +bool connected = wacom_wac->hid_data.bat_connected; +bool powered = wacom_wac->hid_data.ps_connected; -wacom_notify_battery (wacom_wac, status, capacity, charging, - connected, powered); - } +wacom_notify_battery (wacom_wac, status, capacity, charging, + connected, powered); } static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 83/203 usb: typec: tcpm: fix multiple times discover svids error
In reply to Greg Kroah-HartmanFrom: Frank Wang <[email protected]>
[ Upstream commit dac3b192107b978198e89ec0f77375738352e0c8 ]
PD3.0 Spec 6.4.4.3.2 say that only Responder supports 12 or more SVIDs, the Discover SVIDs Command Shall be executed multiple times until a Discover SVIDs VDO is returned ending either with a SVID value of 0x0000 in the last part of the last VDO or with a VDO containing two SVIDs with values of 0x0000.
In the current implementation, if the last VDO does not find that the Discover SVIDs Command would be executed multiple times even if the Responder SVIDs are less than 12, and we found some odd dockers just meet this case. So fix it.
--- drivers/usb/typec/tcpm/tcpm.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +15 -1
@@ -1506,7 +1506,21 @@ static bool svdm_consume_svids(struct tcpm_port *port, const u32 *p, int cnt) pmdata->svids[pmdata->nsvids++] = svid;tcpm_log (port,"SVID %d: 0x%x" , pmdata->nsvids, svid); } -return true; + +/* +* PD3.0 Spec 6.4.4.3.2: The SVIDs are returned 2 per VDO (see Table +* 6-43), and can be returned maximum 6 VDOs per response (see Figure +* 6-19). If the Respondersupports 12 or more SVID then the Discover +* SVIDs Command Shall be executed multiple times until a Discover +* SVIDs VDO is returned ending either with a SVID value of 0x0000 in +* the last part of the last VDO or with a VDO containing two SVIDs +* with values of 0x0000. +* +* However, some odd dockers support SVIDs less than 12 but without +* 0x0000 in the last VDO, so we need to break the Discover SVIDs +* request and return false here. +*/ +return cnt ==7 ; abort:tcpm_log (port,"SVID_DISCOVERY_MAX(%d) too low!" ,SVID_DISCOVERY_MAX );return false;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 84/203 serial: 8250: Reinit port->pm on port specific driver unbind
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 04e82793f068d2f0ffe62fcea03d007a8cdc16a7 ]
When we unbind a serial port hardware specific 8250 driver, the generic serial8250 driver takes over the port. After that we see an oops about 10 seconds later. This can produce the following at least on some TI SoCs:
Unhandled fault: imprecise external abort (0x1406)
Internal error: : 1406 [#1] SMP ARM
Turns out that we may still have the serial port hardware specific driver port->pm in use, and serial8250_pm() tries to call it after the port specific driver is gone:
serial8250_pm [8250_base] from uart_change_pm+0x54/0x8c [serial_base] uart_change_pm [serial_base] from uart_hangup+0x154/0x198 [serial_base] uart_hangup [serial_base] from __tty_hangup.part.0+0x328/0x37c __tty_hangup.part.0 from disassociate_ctty+0x154/0x20c disassociate_ctty from do_exit+0x744/0xaacdo_exit from do_group_exit+0x40/0x8cdo_group_exit from __wake_up_parent+0x0/0x1c
Let's fix the issue by calling serial8250_set_defaults() in serial8250_unregister_port(). This will set the port back to using the serial8250 default functions, and sets the port->pm to point to serial8250_pm.
--- drivers/tty/serial/8250/8250_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/8250/8250_core.c +1 -0
@@ -1156,6 +1156,7 @@ void serial8250_unregister_port(int line) uart->port.type =PORT_UNKNOWN ; uart->port.dev = &serial8250_isa_devs->dev; uart->capabilities =0 ; +serial8250_init_port (uart);serial8250_apply_quirks (uart);uart_add_one_port (&serial8250_reg, &uart->port); }else {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 85/203 mcb-pci: Reallocate memory region to avoid memory overlapping
In reply to Greg Kroah-HartmanFrom: Rodríguez Barbarin, José Javier <[email protected]>
[ Upstream commit 9be24faadd085c284890c3afcec7a0184642315a ]
mcb-pci requests a fixed-size memory region to parse the chameleon table, however, if the chameleon table is smaller that the allocated region, it could overlap with the IP Cores' memory regions.
After parsing the chameleon table, drop/reallocate the memory region with the actual chameleon table size.
--- drivers/mcb/mcb-pci.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/mcb/mcb-pci.c +25 -2
@@ -31,7 +31,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) {struct resource *res;struct priv *priv; -int ret; +int ret, table_size;unsigned long flags; priv =devm_kzalloc (&pdev->dev,sizeof (struct priv ),GFP_KERNEL );
@@ -90,7 +90,30 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (ret <0 ) goto out_mcb_bus; -dev_dbg (&pdev->dev,"Found %d cells\n" , ret); + table_size = ret; + +if (table_size <CHAM_HEADER_SIZE ) { +/* Release the previous resources */ +devm_iounmap (&pdev->dev, priv->base); +devm_release_mem_region (&pdev->dev, priv->mapbase,CHAM_HEADER_SIZE ); + +/* Then, allocate it again with the actual chameleon table size */ + res =devm_request_mem_region (&pdev->dev, priv->mapbase, + table_size, +KBUILD_MODNAME ); +if (!res) { +dev_err (&pdev->dev,"Failed to request PCI memory\n" ); + ret = -EBUSY ; + goto out_mcb_bus; + } + + priv->base =devm_ioremap (&pdev->dev, priv->mapbase, table_size); +if (!priv->base) { +dev_err (&pdev->dev,"Cannot ioremap\n" ); + ret = -ENOMEM ; + goto out_mcb_bus; + } + }mcb_bus_add_devices (priv->bus);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 59/203 scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit f486893288f3e9b171b836f43853a6426515d800 ]
mptlan_probe() calls mpt_register_lan_device() which initializes the &priv->post_buckets_task workqueue. A call to mpt_lan_wake_post_buckets_task() will subsequently start the work.
During driver unload in mptlan_remove() the following race may occur:
CPU0 CPU1
|mpt_lan_post_receive_buckets_work()
mptlan_remove() |
free_netdev() |
kfree(dev); |
|
| dev->mtu
| //useFix this by finishing the work prior to cleaning up in mptlan_remove().
[mkp: we really should remove mptlan instead of attempting to fix it]
--- drivers/message/fusion/mptlan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/message/fusion/mptlan.c +2 -0
@@ -1427,7 +1427,9 @@ mptlan_remove(struct pci_dev *pdev) {MPT_ADAPTER *ioc =pci_get_drvdata (pdev);struct net_device *dev = ioc->netdev; +struct mpt_lan_priv *priv =netdev_priv (dev); +cancel_delayed_work_sync (&priv->post_buckets_task);if (dev !=NULL ) {unregister_netdev (dev);free_netdev (dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 60/203 gfs2: Fix inode height consistency check
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit cfcdb5bad34f600aed7613c3c1a5e618111f77b7 ]
The maximum allowed height of an inode's metadata tree depends on the filesystem block size; it is lower for bigger-block filesystems. When reading in an inode, make sure that the height doesn't exceed the maximum allowed height.
Arrays like sd_heightsize are sized to be big enough for any filesystem block size; they will often be slightly bigger than what's needed for a specific filesystem.
--- fs/gfs2/glops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/glops.c +2 -1
@@ -394,6 +394,7 @@ static int inode_go_demote_ok(const struct gfs2_glock *gl)static int gfs2_dinode_in (struct gfs2_inode *ip,const void *buf) { +struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode);const struct gfs2_dinode *str = buf;struct timespec64 atime;u16 height, depth;
@@ -440,7 +441,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)/* i_diskflags and i_eattr must be set before gfs2_set_inode_flags() */ gfs2_set_inode_flags (inode); height =be16_to_cpu (str->di_height); -if (unlikely (height >GFS2_MAX_META_HEIGHT )) +if (unlikely (height > sdp->sd_max_height)) goto corrupt; ip->i_height = (u8 )height;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 61/203 scsi: ufs: ufs-pci: Add support for Intel Lunar Lake
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
[ Upstream commit 0a07d3c7a1d205b47d9f3608ff4e9d1065d63b6d ]
Add PCI ID to support Intel Lunar Lake, same as MTL.
--- drivers/scsi/ufs/ufshcd-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/ufs/ufshcd-pci.c +1 -0
@@ -596,6 +596,7 @@ static const struct pci_device_id ufshcd_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x51FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, { PCI_VDEVICE(INTEL, 0x54FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, { PCI_VDEVICE(INTEL, 0x7E47), (kernel_ulong_t)&ufs_intel_mtl_hba_vops }, + { PCI_VDEVICE(INTEL, 0xA847), (kernel_ulong_t)&ufs_intel_mtl_hba_vops }, { } /* terminate list */ };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 62/203 ext4: set goal start correctly in ext4_mb_normalize_request
In reply to Greg Kroah-HartmanFrom: Kemeng Shi <[email protected]>
[ Upstream commit b07ffe6927c75d99af534d685282ea188d9f71a6 ]
We need to set ac_g_ex to notify the goal start used in ext4_mb_find_by_goal. Set ac_g_ex instead of ac_f_ex in ext4_mb_normalize_request.
Besides we should assure goal start is in range [first_data_block, blocks_count) as ext4_mb_initialize_context does.
[ Added a check to make sure size is less than ar->pright; otherwise
we could end up passing an underflowed value of ar->pright - size to ext4_get_group_no_and_offset(), which will trigger a BUG_ON later on.
- TYT ]
--- fs/ext4/mballoc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
fs/ext4/mballoc.c +10 -6
@@ -4045,6 +4045,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, struct ext4_allocation_request *ar) {struct ext4_sb_info *sbi =EXT4_SB (ac->ac_sb); +struct ext4_super_block *es = sbi->s_es;int bsbits, max;ext4_lblk_t end;loff_t size, start_off;
@@ -4225,18 +4226,21 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, ac->ac_g_ex.fe_len =EXT4_NUM_B2C (sbi, size);/* define goal start in order to merge */ -if (ar->pright && (ar->lright == (start + size))) { +if (ar->pright && (ar->lright == (start + size)) && + ar->pright >= size && + ar->pright - size >=le32_to_cpu (es->s_first_data_block)) {/* merge to the right */ ext4_get_group_no_and_offset (ac->ac_sb, ar->pright - size, - &ac->ac_f_ex.fe_group, - &ac->ac_f_ex.fe_start); + &ac->ac_g_ex.fe_group, + &ac->ac_g_ex.fe_start); ac->ac_flags |=EXT4_MB_HINT_TRY_GOAL ; } -if (ar->pleft && (ar->lleft +1 == start)) { +if (ar->pleft && (ar->lleft +1 == start) && + ar->pleft +1 <ext4_blocks_count (es)) {/* merge to the left */ ext4_get_group_no_and_offset (ac->ac_sb, ar->pleft +1 , - &ac->ac_f_ex.fe_group, - &ac->ac_f_ex.fe_start); + &ac->ac_g_ex.fe_group, + &ac->ac_g_ex.fe_start); ac->ac_flags |=EXT4_MB_HINT_TRY_GOAL ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 63/203 ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
In reply to Greg Kroah-HartmanFrom: Ojaswin Mujoo <[email protected]>
[ Upstream commit 93cdf49f6eca5e23f6546b8f28457b2e6a6961d9 ]
When the length of best extent found is less than the length of goal extent we need to make sure that the best extent atleast covers the start of the original request. This is done by adjusting the ac_b_ex.fe_logical (logical start) of the extent.
While doing so, the current logic sometimes results in the best extent's logical range overflowing the goal extent. Since this best extent is later added to the inode preallocation list, we have a possibility of introducing overlapping preallocations. This is discussed in detail here [1].
As per Jan's suggestion, to fix this, replace the existing logic with the below logic for adjusting best extent as it keeps fragmentation in check while ensuring logical range of best extent doesn't overflow out of goal extent:
1. Check if best extent can be kept at end of goal range and still cover original start.
2. Else, check if best extent can be kept at start of goal range and still cover original start.
3. Else, keep the best extent at start of original request.
Also, add a few extra BUG_ONs that might help catch errors faster.
[1] https://lore.kernel.org/r/[email protected]
--- fs/ext4/mballoc.c | 49 ++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 18 deletions(-)
fs/ext4/mballoc.c +31 -18
@@ -4333,6 +4333,7 @@ static void ext4_mb_use_inode_pa(struct ext4_allocation_context *ac,BUG_ON (start < pa->pa_pstart);BUG_ON (end > pa->pa_pstart +EXT4_C2B (sbi, pa->pa_len));BUG_ON (pa->pa_free < len); +BUG_ON (ac->ac_b_ex.fe_len <=0 ); pa->pa_free -= len;mb_debug (ac->ac_sb,"use %llu/%d from inode pa %p\n" , start, len, pa);
@@ -4662,10 +4663,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) pa = ac->ac_pa;if (ac->ac_b_ex.fe_len < ac->ac_g_ex.fe_len) { -int winl; -int wins; -int win; -int offs; +int new_bex_start; +int new_bex_end;/* we can't allocate as much as normalizer wants. * so, found space must get proper lstart
@@ -4673,26 +4672,40 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)BUG_ON (ac->ac_g_ex.fe_logical > ac->ac_o_ex.fe_logical);BUG_ON (ac->ac_g_ex.fe_len < ac->ac_o_ex.fe_len); -/* we're limited by original request in that -* logical block must be covered any way -* winl is window we can move our chunk within */ - winl = ac->ac_o_ex.fe_logical - ac->ac_g_ex.fe_logical; +/* +* Use the below logic for adjusting best extent as it keeps +* fragmentation in check while ensuring logical range of best +* extent doesn't overflow out of goal extent: +* +* 1. Check if best ex can be kept at end of goal and still +* cover original start +* 2. Else, check if best ex can be kept at start of goal and +* still cover original start +* 3. Else, keep the best ex at start of original request. +*/ + new_bex_end = ac->ac_g_ex.fe_logical + +EXT4_C2B (sbi, ac->ac_g_ex.fe_len); + new_bex_start = new_bex_end -EXT4_C2B (sbi, ac->ac_b_ex.fe_len); +if (ac->ac_o_ex.fe_logical >= new_bex_start) + goto adjust_bex; -/* also, we should cover whole original request */ - wins =EXT4_C2B (sbi, ac->ac_b_ex.fe_len - ac->ac_o_ex.fe_len); + new_bex_start = ac->ac_g_ex.fe_logical; + new_bex_end = + new_bex_start +EXT4_C2B (sbi, ac->ac_b_ex.fe_len); +if (ac->ac_o_ex.fe_logical < new_bex_end) + goto adjust_bex; -/* the smallest one defines real window */ - win =min (winl, wins); + new_bex_start = ac->ac_o_ex.fe_logical; + new_bex_end = + new_bex_start +EXT4_C2B (sbi, ac->ac_b_ex.fe_len); - offs = ac->ac_o_ex.fe_logical % -EXT4_C2B (sbi, ac->ac_b_ex.fe_len); -if (offs && offs < win) - win = offs; +adjust_bex: + ac->ac_b_ex.fe_logical = new_bex_start; - ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - -EXT4_NUM_B2C (sbi, win);BUG_ON (ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical);BUG_ON (ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); +BUG_ON (new_bex_end > (ac->ac_g_ex.fe_logical + +EXT4_C2B (sbi, ac->ac_g_ex.fe_len))); }/* preallocation can change ac_b_ex, thus we store actually
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 64/203 f2fs: fix to drop all dirty pages during umount() if cp_error is set
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit c9b3649a934d131151111354bcbb638076f03a30 ]
xfstest generic/361 reports a bug as below:
f2fs_bug_on(sbi, sbi->fsync_node_num);
kernel BUG at fs/f2fs/super.c:1627!
RIP: 0010:f2fs_put_super+0x3a8/0x3b0 Call Trace: generic_shutdown_super+0x8c/0x1b0 kill_block_super+0x2b/0x60 kill_f2fs_super+0x87/0x110 deactivate_locked_super+0x39/0x80 deactivate_super+0x46/0x50 cleanup_mnt+0x109/0x170 __cleanup_mnt+0x16/0x20 task_work_run+0x65/0xa0 exit_to_user_mode_prepare+0x175/0x190 syscall_exit_to_user_mode+0x25/0x50 do_syscall_64+0x4c/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc
During umount(), if cp_error is set, f2fs_wait_on_all_pages() should not stop waiting all F2FS_WB_CP_DATA pages to be writebacked, otherwise, fsync_node_num can be non-zero after f2fs_wait_on_all_pages() causing this bug.
In this case, to avoid deadloop in f2fs_wait_on_all_pages(), it needs to drop all dirty pages rather than redirtying them.
--- fs/f2fs/checkpoint.c | 12 ++++++++++-- fs/f2fs/data.c | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-)
fs/f2fs/checkpoint.c +10 -2
@@ -312,8 +312,15 @@ static int __f2fs_write_meta_page(struct page *page,trace_f2fs_writepage (page,META ); -if (unlikely (f2fs_cp_error (sbi))) +if (unlikely (f2fs_cp_error (sbi))) { +if (is_sbi_flag_set (sbi,SBI_IS_CLOSE )) { +ClearPageUptodate (page); +dec_page_count (sbi,F2FS_DIRTY_META ); +unlock_page (page); +return 0 ; + } goto redirty_out; + }if (unlikely (is_sbi_flag_set (sbi,SBI_POR_DOING ))) goto redirty_out;if (wbc->for_reclaim && page->index <GET_SUM_BLOCK (sbi,0 ))
@@ -1298,7 +1305,8 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type)if (!get_pages (sbi, type))break ; -if (unlikely (f2fs_cp_error (sbi))) +if (unlikely (f2fs_cp_error (sbi) && + !is_sbi_flag_set (sbi,SBI_IS_CLOSE )))break ;if (type ==F2FS_DIRTY_META )
fs/f2fs/data.c +2 -1
@@ -2764,7 +2764,8 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,* don't drop any dirty dentry pages for keeping lastest * directory structure. */ -if (S_ISDIR (inode->i_mode)) +if (S_ISDIR (inode->i_mode) && + !is_sbi_flag_set (sbi,SBI_IS_CLOSE )) goto redirty_out; goto out; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 65/203 f2fs: fix to check readonly condition correctly
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit d78dfefcde9d311284434560d69c0478c55a657e ]
With below case, it can mount multi-device image w/ rw option, however one of secondary device is set as ro, later update will cause panic, so let's introduce f2fs_dev_is_readonly(), and check multi-devices rw status in f2fs_remount() w/ it in order to avoid such inconsistent mount status.
mkfs.f2fs -c /dev/zram1 /dev/zram0 -f
blockdev --setro /dev/zram1
mount -t f2fs dev/zram0 /mnt/f2fs
mount: /mnt/f2fs: WARNING: source write-protected, mounted read-only. mount -t f2fs -o remount,rw mnt/f2fs
dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=8192
kernel BUG at fs/f2fs/inline.c:258!
RIP: 0010:f2fs_write_inline_data+0x23e/0x2d0 [f2fs] Call Trace: f2fs_write_single_data_page+0x26b/0x9f0 [f2fs] f2fs_write_cache_pages+0x389/0xa60 [f2fs] __f2fs_write_data_pages+0x26b/0x2d0 [f2fs] f2fs_write_data_pages+0x2e/0x40 [f2fs] do_writepages+0xd3/0x1b0 __writeback_single_inode+0x5b/0x420 writeback_sb_inodes+0x236/0x5a0 __writeback_inodes_wb+0x56/0xf0 wb_writeback+0x2a3/0x490 wb_do_writeback+0x2b2/0x330 wb_workfn+0x6a/0x260 process_one_work+0x270/0x5e0 worker_thread+0x52/0x3e0 kthread+0xf4/0x120 ret_from_fork+0x29/0x50
--- fs/f2fs/f2fs.h | 5 +++++ fs/f2fs/super.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +5 -0
@@ -4284,6 +4284,11 @@ static inline bool f2fs_hw_is_readonly(struct f2fs_sb_info *sbi)return false; } +static inline bool f2fs_dev_is_readonly (struct f2fs_sb_info *sbi) +{ +return f2fs_sb_has_readonly (sbi) ||f2fs_hw_is_readonly (sbi); +} +static inline bool f2fs_lfs_mode (struct f2fs_sb_info *sbi) {return F2FS_OPTION (sbi).fs_mode ==FS_MODE_LFS ;
fs/f2fs/super.c +1 -1
@@ -2225,7 +2225,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)if (f2fs_readonly (sb) && (*flags &SB_RDONLY )) goto skip; -if (f2fs_sb_has_readonly (sbi) && !(*flags &SB_RDONLY )) { +if (f2fs_dev_is_readonly (sbi) && !(*flags &SB_RDONLY )) { err = -EROFS ; goto restore_opts; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 56/203 net: Catch invalid index in XPS mapping
In reply to Greg Kroah-HartmanFrom: Nick Child <[email protected]>
[ Upstream commit 5dd0dfd55baec0742ba8f5625a0dd064aca7db16 ]
When setting the XPS value of a TX queue, warn the user once if the index of the queue is greater than the number of allocated TX queues.
Previously, this scenario went uncaught. In the best case, it resulted in unnecessary allocations. In the worst case, it resulted in out-of-bounds memory references through calls to netdev_get_tx_queue( dev, index). Therefore, it is important to inform the user but not worth returning an error and risk downing the netdevice.
--- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/dev.c +2 -0
@@ -2574,6 +2574,8 @@ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask,struct xps_map *map, *new_map;unsigned int nr_ids; +WARN_ON_ONCE (index >= dev->num_tx_queues); +if (dev->num_tc) {/* Do not allow XPS on subordinate device directly */ num_tc = dev->num_tc;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 87/203 recordmcount: Fix memory leaks in the uwrite function
In reply to Greg Kroah-HartmanFrom: Hao Zeng <[email protected]>
[ Upstream commit fa359d068574d29e7d2f0fdd0ebe4c6a12b5cfb9 ]
Common realloc mistake: 'file_append' nulled but not freed upon failure
--- scripts/recordmcount.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/recordmcount.c +5 -1
@@ -102,6 +102,7 @@ static ssize_t uwrite(void const *const buf, size_t const count) {size_t cnt = count;off_t idx =0 ; +void *p =NULL ; file_updated =1 ;
@@ -109,7 +110,10 @@ static ssize_t uwrite(void const *const buf, size_t const count)off_t aoffset = (file_ptr + count) - file_end;if (aoffset > file_append_size) { - file_append =realloc (file_append, aoffset); + p =realloc (file_append, aoffset); +if (!p) +free (file_append); + file_append = p; file_append_size = aoffset; }if (!file_append) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 96/203 clk: tegra20: fix gcc-7 constant overflow warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit b4a2adbf3586efa12fe78b9dec047423e01f3010 ]
Older gcc versions get confused by comparing a u32 value to a negative constant in a switch()/case block:
drivers/clk/tegra/clk-tegra20.c: In function 'tegra20_clk_measure_input_freq':drivers/clk/tegra/clk-tegra20.c:581:2: error: case label does not reduce to an integer constant
case OSC_CTRL_OSC_FREQ_12MHZ:
^~~~drivers/clk/tegra/clk-tegra20.c:593:2: error: case label does not reduce to an integer constant
case OSC_CTRL_OSC_FREQ_26MHZ:
Make the constants unsigned instead.
--- drivers/clk/tegra/clk-tegra20.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/clk/tegra/clk-tegra20.c +14 -14
@@ -18,24 +18,24 @@#define MISC_CLK_ENB 0x48#define OSC_CTRL 0x50 -#define OSC_CTRL_OSC_FREQ_MASK (3<<30) -#define OSC_CTRL_OSC_FREQ_13MHZ (0<<30) -#define OSC_CTRL_OSC_FREQ_19_2MHZ (1<<30) -#define OSC_CTRL_OSC_FREQ_12MHZ (2<<30) -#define OSC_CTRL_OSC_FREQ_26MHZ (3<<30) -#define OSC_CTRL_MASK (0x3f2 | OSC_CTRL_OSC_FREQ_MASK) - -#define OSC_CTRL_PLL_REF_DIV_MASK (3<<28) -#define OSC_CTRL_PLL_REF_DIV_1 (0<<28) -#define OSC_CTRL_PLL_REF_DIV_2 (1<<28) -#define OSC_CTRL_PLL_REF_DIV_4 (2<<28) +#define OSC_CTRL_OSC_FREQ_MASK (3u<<30) +#define OSC_CTRL_OSC_FREQ_13MHZ (0u<<30) +#define OSC_CTRL_OSC_FREQ_19_2MHZ (1u<<30) +#define OSC_CTRL_OSC_FREQ_12MHZ (2u<<30) +#define OSC_CTRL_OSC_FREQ_26MHZ (3u<<30) +#define OSC_CTRL_MASK (0x3f2u | OSC_CTRL_OSC_FREQ_MASK) + +#define OSC_CTRL_PLL_REF_DIV_MASK (3u<<28) +#define OSC_CTRL_PLL_REF_DIV_1 (0u<<28) +#define OSC_CTRL_PLL_REF_DIV_2 (1u<<28) +#define OSC_CTRL_PLL_REF_DIV_4 (2u<<28)#define OSC_FREQ_DET 0x58 -#define OSC_FREQ_DET_TRIG (1<<31) +#define OSC_FREQ_DET_TRIG (1u<<31)#define OSC_FREQ_DET_STATUS 0x5c -#define OSC_FREQ_DET_BUSY (1<<31) -#define OSC_FREQ_DET_CNT_MASK 0xFFFF +#define OSC_FREQ_DET_BUSYu (1<<31) +#define OSC_FREQ_DET_CNT_MASK 0xFFFFu#define TEGRA20_CLK_PERIPH_BANKS 3
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 97/203 iommu/arm-smmu-v3: Acknowledge pri/event queue overflow if any
In reply to Greg Kroah-HartmanFrom: Tomas Krcka <[email protected]>
[ Upstream commit 67ea0b7ce41844eae7c10bb04dfe66a23318c224 ]
When an overflow occurs in the PRI queue, the SMMU toggles the overflow flag in the PROD register. To exit the overflow condition, the PRI thread is supposed to acknowledge it by toggling this flag in the CONS register. Unacknowledged overflow causes the queue to stop adding anything new.
Currently, the priq thread always writes the CONS register back to the SMMU after clearing the queue.
The writeback is not necessary if the OVFLG in the PROD register has not been changed, no overflow has occured.
This commit checks the difference of the overflow flag between CONS and PROD register. If it's different, toggles the OVACKFLG flag in the CONS register and write it to the SMMU.
The situation is similar for the event queue.
The acknowledge register is also toggled after clearing the event queue but never propagated to the hardware. This would only be done the next time when executing evtq thread.
Unacknowledged event queue overflow doesn't affect the event queue, because the SMMU still adds elements to that queue when the overflow condition is active.
But it feel nicer to keep SMMU in sync when possible, so use the same way here as well.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +14 -5
@@ -154,6 +154,18 @@ static void queue_inc_cons(struct arm_smmu_ll_queue *q) q->cons =Q_OVF (q->cons) |Q_WRP (q, cons) |Q_IDX (q, cons); } +static void queue_sync_cons_ovf (struct arm_smmu_queue *q) +{ +struct arm_smmu_ll_queue *llq = &q->llq; + +if (likely (Q_OVF (llq->prod) ==Q_OVF (llq->cons))) +return ; + + llq->cons =Q_OVF (llq->prod) |Q_WRP (llq, llq->cons) | +Q_IDX (llq, llq->cons); +queue_sync_cons_out (q); +} +static int queue_sync_prod_in (struct arm_smmu_queue *q) {u32 prod;
@@ -1564,8 +1576,7 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev) }while (!queue_empty (llq));/* Sync our overflow flag, as we believe we're up to speed */ - llq->cons =Q_OVF (llq->prod) |Q_WRP (llq, llq->cons) | -Q_IDX (llq, llq->cons); +queue_sync_cons_ovf (q);return IRQ_HANDLED ; }
@@ -1623,9 +1634,7 @@ static irqreturn_t arm_smmu_priq_thread(int irq, void *dev) }while (!queue_empty (llq));/* Sync our overflow flag, as we believe we're up to speed */ - llq->cons =Q_OVF (llq->prod) |Q_WRP (llq, llq->cons) | -Q_IDX (llq, llq->cons); -queue_sync_cons_out (q); +queue_sync_cons_ovf (q);return IRQ_HANDLED ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 98/203 iommu/sprd: Release dma buffer to avoid memory leak
In reply to Greg Kroah-HartmanFrom: Chunyan Zhang <[email protected]>
[ Upstream commit 9afea57384d4ae7b2034593eac7fa76c7122762a ]
When attaching to a domain, the driver would alloc a DMA buffer which is used to store address mapping table, and it need to be released when the IOMMU domain is freed.
--- drivers/iommu/sprd-iommu.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/iommu/sprd-iommu.c +22 -7
@@ -151,13 +151,6 @@ static struct iommu_domain *sprd_iommu_domain_alloc(unsigned int domain_type)return &dom->domain; } -static void sprd_iommu_domain_free (struct iommu_domain *domain) -{ -struct sprd_iommu_domain *dom =to_sprd_domain (domain); - -kfree (dom); -} -static void sprd_iommu_first_vpn (struct sprd_iommu_domain *dom) {struct sprd_iommu_device *sdev = dom->sdev;
@@ -230,6 +223,28 @@ static void sprd_iommu_hw_en(struct sprd_iommu_device *sdev, bool en)sprd_iommu_update_bits (sdev, reg_cfg, mask,0 , val); } +static void sprd_iommu_cleanup (struct sprd_iommu_domain *dom) +{ +size_t pgt_size; + +/* Nothing need to do if the domain hasn't been attached */ +if (!dom->sdev) +return ; + + pgt_size =sprd_iommu_pgt_size (&dom->domain); +dma_free_coherent (dom->sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa); + dom->sdev =NULL ; +sprd_iommu_hw_en (dom->sdev, false); +} + +static void sprd_iommu_domain_free (struct iommu_domain *domain) +{ +struct sprd_iommu_domain *dom =to_sprd_domain (domain); + +sprd_iommu_cleanup (dom); +kfree (dom); +} +static int sprd_iommu_attach_device (struct iommu_domain *domain,struct device *dev) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 99/203 Input: xpad - add constants for GIP interface numbers
In reply to Greg Kroah-HartmanFrom: Vicki Pfau <[email protected]>
[ Upstream commit f9b2e603c6216824e34dc9a67205d98ccc9a41ca ]
Wired GIP devices present multiple interfaces with the same USB identification other than the interface number. This adds constants for differentiating two of them and uses them where appropriate
--- drivers/input/joystick/xpad.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/input/joystick/xpad.c +4 -1
@@ -493,6 +493,9 @@ struct xboxone_init_packet { } +#define GIP_WIRED_INTF_DATA 0 +#define GIP_WIRED_INTF_AUDIO 1 +/* * This packet is required for all Xbox One pads with 2015 * or later firmware installed (or present from the factory).
@@ -1821,7 +1824,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id }if (xpad->xtype ==XTYPE_XBOXONE && - intf->cur_altsetting->desc.bInterfaceNumber !=0 ) { + intf->cur_altsetting->desc.bInterfaceNumber !=GIP_WIRED_INTF_DATA ) {/* * The Xbox One controller lists three interfaces all with the * same interface class, subclass and protocol. Differentiate by
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 100/203 phy: st: miphy28lp: use _poll_timeout functions for waits
In reply to Greg Kroah-HartmanFrom: Alain Volmat <[email protected]>
[ Upstream commit e3be4dd2c8d8aabfd2c3127d0e2e5754d3ae82d6 ]
This commit introduces _poll_timeout functions usage instead of wait loops waiting for a status bit.
--- drivers/phy/st/phy-miphy28lp.c | 42 ++++++++-------------------------- 1 file changed, 10 insertions(+), 32 deletions(-)
drivers/phy/st/phy-miphy28lp.c +10 -32
@@ -9,6 +9,7 @@#include <linux/platform_device.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/of.h>
@@ -484,19 +485,11 @@ static inline void miphy28lp_pcie_config_gen(struct miphy28lp_phy *miphy_phy)static inline int miphy28lp_wait_compensation (struct miphy28lp_phy *miphy_phy) { -unsigned long finish = jiffies +5 *HZ ;u8 val;/* Waiting for Compensation to complete */ -do { - val =readb_relaxed (miphy_phy->base +MIPHY_COMP_FSM_6 ); - -if (time_after_eq (jiffies, finish)) -return -EBUSY ; -cpu_relax (); - }while (!(val &COMP_DONE )); - -return 0 ; +return readb_relaxed_poll_timeout (miphy_phy->base +MIPHY_COMP_FSM_6 , + val, val &COMP_DONE ,1 ,5 *USEC_PER_SEC ); }
@@ -805,7 +798,6 @@ static inline void miphy28lp_configure_usb3(struct miphy28lp_phy *miphy_phy)static inline int miphy_is_ready (struct miphy28lp_phy *miphy_phy) { -unsigned long finish = jiffies +5 *HZ ;u8 mask =HFC_PLL |HFC_RDY ;u8 val;
@@ -816,21 +808,14 @@ static inline int miphy_is_ready(struct miphy28lp_phy *miphy_phy)if (miphy_phy->type ==PHY_TYPE_SATA ) mask |=PHY_RDY ; -do { - val =readb_relaxed (miphy_phy->base +MIPHY_STATUS_1 ); -if ((val & mask) != mask) -cpu_relax (); -else -return 0 ; - }while (!time_after_eq (jiffies, finish)); - -return -EBUSY ; +return readb_relaxed_poll_timeout (miphy_phy->base +MIPHY_STATUS_1 , + val, (val & mask) == mask,1 , +5 *USEC_PER_SEC ); }static int miphy_osc_is_ready (struct miphy28lp_phy *miphy_phy) {struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; -unsigned long finish = jiffies +5 *HZ ;u32 val;if (!miphy_phy->osc_rdy)
@@ -839,17 +824,10 @@ static int miphy_osc_is_ready(struct miphy28lp_phy *miphy_phy)if (!miphy_phy->syscfg_reg[SYSCFG_STATUS ])return -EINVAL ; -do { -regmap_read (miphy_dev->regmap, - miphy_phy->syscfg_reg[SYSCFG_STATUS ], &val); - -if ((val &MIPHY_OSC_RDY ) !=MIPHY_OSC_RDY ) -cpu_relax (); -else -return 0 ; - }while (!time_after_eq (jiffies, finish)); - -return -EBUSY ; +return regmap_read_poll_timeout (miphy_dev->regmap, + miphy_phy->syscfg_reg[SYSCFG_STATUS ], + val, val &MIPHY_OSC_RDY ,1 , +5 *USEC_PER_SEC ); } static int miphy28lp_get_resource_byname(struct device_node *child,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 101/203 soundwire: qcom: gracefully handle too many ports in DT
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 2367e0ecb498764e95cfda691ff0828f7d25f9a4 ]
There are two issues related to the number of ports coming from Devicetree when exceeding in total QCOM_SDW_MAX_PORTS. Both lead to incorrect memory accesses:
1. With DTS having too big value of input or output ports, the driver, when copying port parameters from local/stack arrays into 'pconfig' array in 'struct qcom_swrm_ctrl', will iterate over their sizes.
2. If DTS also has too many parameters for these ports (e.g. qcom,ports-sinterval-low), the driver will overflow buffers on the stack when reading these properties from DTS.
Add a sanity check so incorrect DTS will not cause kernel memory corruption.
--- drivers/soundwire/qcom.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/soundwire/qcom.c +3 -0
@@ -1142,6 +1142,9 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl) ctrl->num_dout_ports = val; nports = ctrl->num_dout_ports + ctrl->num_din_ports; +if (nports >QCOM_SDW_MAX_PORTS ) +return -EINVAL ; +/* Valid port numbers are from 1-14, so mask out port 0 explicitly */ set_bit (0 , &ctrl->dout_port_mask);set_bit (0 , &ctrl->din_port_mask);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 102/203 mfd: dln2: Fix memory leak in dln2_probe()
In reply to Greg Kroah-HartmanFrom: Qiang Ning <[email protected]>
[ Upstream commit 96da8f148396329ba769246cb8ceaa35f1ddfc48 ]
When dln2_setup_rx_urbs() in dln2_probe() fails, error out_free forgets to call usb_put_dev() to decrease the refcount of dln2->usb_dev.
Fix this by adding usb_put_dev() in the error handling code of dln2_probe().
--- drivers/mfd/dln2.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/dln2.c +1 -0
@@ -836,6 +836,7 @@ static int dln2_probe(struct usb_interface *interface,dln2_stop_rx_urbs (dln2); out_free: +usb_put_dev (dln2->usb_dev);dln2_free (dln2);return ret;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 103/203 parisc: Replace regular spinlock with spin_trylock on panic path
In reply to Greg Kroah-HartmanFrom: Guilherme G. Piccoli <[email protected]>
[ Upstream commit 829632dae8321787525ee37dc4828bbe6edafdae ]
The panic notifiers' callbacks execute in an atomic context, with interrupts/preemption disabled, and all CPUs not running the panic function are off, so it's very dangerous to wait on a regular spinlock, there's a risk of deadlock.
Refactor the panic notifier of parisc/power driver to make use of spin_trylock - for that, we've added a second version of the soft-power function. Also, some comments were reorganized and trailing white spaces, useless header inclusion and blank lines were removed.
--- arch/parisc/include/asm/pdc.h | 1 + arch/parisc/kernel/firmware.c | 27 +++++++++++++++++++++++---- drivers/parisc/power.c | 16 ++++++++++------ 3 files changed, 34 insertions(+), 10 deletions(-)
arch/parisc/include/asm/pdc.h +1 -0
@@ -81,6 +81,7 @@ int pdc_do_firm_test_reset(unsigned long ftc_bitmap);int pdc_do_reset (void );int pdc_soft_power_info (unsigned long *power_reg);int pdc_soft_power_button (int sw_control); +int pdc_soft_power_button_panic (int sw_control);void pdc_io_reset (void );void pdc_io_reset_devices (void );int pdc_iodc_getc (void );
arch/parisc/kernel/firmware.c +23 -4
@@ -1158,15 +1158,18 @@ int __init pdc_soft_power_info(unsigned long *power_reg) }/* -* pdc_soft_power_button - Control the soft power button behaviour -* @sw_control: 0 for hardware control, 1 for software control +* pdc_soft_power_button{_panic} - Control the soft power button behaviour +* @sw_control: 0 for hardware control, 1 for software control * * * This PDC function places the soft power button under software or * hardware control. -* Under software control the OS may control to when to allow to shut -* down the system. Under hardware control pressing the power button +* Under software control the OS may control to when to allow to shut +* down the system. Under hardware control pressing the power button * powers off the system immediately. +* +* The _panic version relies on spin_trylock to prevent deadlock +* on panic path. */ int pdc_soft_power_button (int sw_control) {
@@ -1180,6 +1183,22 @@ int pdc_soft_power_button(int sw_control)return retval; } +int pdc_soft_power_button_panic (int sw_control) +{ +int retval; +unsigned long flags; + +if (!spin_trylock_irqsave (&pdc_lock, flags)) { +pr_emerg ("Couldn't enable soft power button\n" ); +return -EBUSY ;/* ignored by the panic notifier */ + } + + retval =mem_pdc_call (PDC_SOFT_POWER ,PDC_SOFT_POWER_ENABLE ,__pa (pdc_result), sw_control); +spin_unlock_irqrestore (&pdc_lock, flags); + +return retval; +} +/* * pdc_io_reset - Hack to avoid overlapping range registers of Bridges devices. * Primarily a problem on T600 (which parisc-linux doesn't support) but
drivers/parisc/power.c +10 -6
@@ -37,7 +37,6 @@#include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> -#include <linux/notifier.h> #include <linux/panic_notifier.h> #include <linux/reboot.h> #include <linux/sched/signal.h>
@@ -175,16 +174,21 @@ static void powerfail_interrupt(int code, void *x) -/* parisc_panic_event() is called by the panic handler. -* As soon as a panic occurs, our tasklets above will not be -* executed any longer. This function then re-enables the -* soft-power switch and allows the user to switch off the system +/* +* parisc_panic_event() is called by the panic handler. +* +* As soon as a panic occurs, our tasklets above will not +* be executed any longer. This function then re-enables +* the soft-power switch and allows the user to switch off +* the system. We rely in pdc_soft_power_button_panic() +* since this version spin_trylocks (instead of regular +* spinlock), preventing deadlocks on panic path. */ static int parisc_panic_event (struct notifier_block *this,unsigned long event,void *ptr) {/* re-enable the soft-power switch */ -pdc_soft_power_button (0 ); +pdc_soft_power_button_panic (0 );return NOTIFY_DONE ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 104/203 platform/x86: hp-wmi: Support touchpad on/off
In reply to Greg Kroah-HartmanFrom: Daniel Houldsworth <[email protected]>
[ Upstream commit 401199ffa9b69baf3fd1f9ad082aa65c10910585 ]
Add scancodes reported by the touchpad on/off button. The actual disabling and enabling is done in hardware, and this just reports that change to userspace.
Stable-dep-of: decab2825c3e ("platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct")
--- drivers/platform/x86/hp-wmi.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/platform/x86/hp-wmi.c +11 -9
@@ -154,15 +154,17 @@ struct bios_rfkill2_state { };static const struct key_entry hp_wmi_keymap[] = { - {KE_KEY ,0x02 , {KEY_BRIGHTNESSUP } }, - {KE_KEY ,0x03 , {KEY_BRIGHTNESSDOWN } }, - {KE_KEY ,0x20e6 , {KEY_PROG1 } }, - {KE_KEY ,0x20e8 , {KEY_MEDIA } }, - {KE_KEY ,0x2142 , {KEY_MEDIA } }, - {KE_KEY ,0x213b , {KEY_INFO } }, - {KE_KEY ,0x2169 , {KEY_ROTATE_DISPLAY } }, - {KE_KEY ,0x216a , {KEY_SETUP } }, - {KE_KEY ,0x231b , {KEY_HELP } }, + {KE_KEY ,0x02 , {KEY_BRIGHTNESSUP } }, + {KE_KEY ,0x03 , {KEY_BRIGHTNESSDOWN } }, + {KE_KEY ,0x20e6 , {KEY_PROG1 } }, + {KE_KEY ,0x20e8 , {KEY_MEDIA } }, + {KE_KEY ,0x2142 , {KEY_MEDIA } }, + {KE_KEY ,0x213b , {KEY_INFO } }, + {KE_KEY ,0x2169 , {KEY_ROTATE_DISPLAY } }, + {KE_KEY ,0x216a , {KEY_SETUP } }, + {KE_KEY ,0x21a9 , {KEY_TOUCHPAD_OFF } }, + {KE_KEY ,0x121a9 , {KEY_TOUCHPAD_ON } }, + {KE_KEY ,0x231b , {KEY_HELP } }, {KE_END ,0 } };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 105/203 platform/x86: Move existing HP drivers to a new hp subdir
In reply to Greg Kroah-HartmanFrom: Jorge Lopez <[email protected]>
[ Upstream commit 6e9b8992b122cb12688bd259fc99e67d1be234eb ]
The purpose of this patch is to provide a central location where all HP related drivers are found. HP drivers will recide under drivers/platform/x86/hp directory.
Introduce changes to Kconfig file to list all HP driver under "HP X86 Platform Specific Device Drivers" menu option. Additional changes include update MAINTAINERS file to indicate hp related drivers new path.
Stable-dep-of: decab2825c3e ("platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct")
---
MAINTAINERS | 4 +-
drivers/platform/x86/Kconfig | 42 +--------------
drivers/platform/x86/Makefile | 4 +-
drivers/platform/x86/hp/Kconfig | 63 ++++++++++++++++++++++
drivers/platform/x86/hp/Makefile | 10 ++++
drivers/platform/x86/{ => hp}/hp-wmi.c | 0
drivers/platform/x86/{ => hp}/hp_accel.c | 2 +-
drivers/platform/x86/{ => hp}/tc1100-wmi.c | 0
8 files changed, 78 insertions(+), 47 deletions(-)
create mode 100644 drivers/platform/x86/hp/Kconfig
create mode 100644 drivers/platform/x86/hp/Makefile
rename drivers/platform/x86/{ => hp}/hp-wmi.c (100%)
rename drivers/platform/x86/{ => hp}/hp_accel.c (99%)
rename drivers/platform/x86/{ => hp}/tc1100-wmi.c (100%)MAINTAINERS +2 -2
@@ -8568,7 +8568,7 @@ F: drivers/net/wireless/intersil/hostap/ HP COMPAQ TC1100 TABLET WMI EXTRAS DRIVER L: [email protected] S: Orphan -F: drivers/platform/x86/tc1100-wmi.c +F: drivers/platform/x86/hp/tc1100-wmi.c HPET: High Precision Event Timers driver M: Clemens Ladisch <[email protected]>
@@ -10838,7 +10838,7 @@ M: Eric Piel <[email protected]> S: Maintained F: Documentation/misc-devices/lis3lv02d.rst F: drivers/misc/lis3lv02d/ -F: drivers/platform/x86/hp_accel.c +F: drivers/platform/x86/hp/hp_accel.c LIST KUNIT TEST M: David Gow <[email protected]>
drivers/platform/x86/Kconfig +1 -41
54 lines not on this page · raw message
drivers/platform/x86/Makefile +1 -3
@@ -52,9 +52,7 @@ obj-$(CONFIG_FUJITSU_TABLET) += fujitsu-tablet.o obj-$(CONFIG_GPD_POCKET_FAN) += gpd-pocket-fan.o # Hewlett Packard -obj-$(CONFIG_HP_ACCEL) += hp_accel.o -obj-$(CONFIG_HP_WMI) += hp-wmi.o -obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o +obj-$(CONFIG_X86_PLATFORM_DRIVERS_HP) += hp/ # Hewlett Packard Enterprise obj-$(CONFIG_UV_SYSFS) += uv_sysfs.o
drivers/platform/x86/hp/Kconfig new file +63 -0
63 lines not on this page · raw message
drivers/platform/x86/hp/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for linux/drivers/platform/x86/hp +# HP x86 Platform-Specific Drivers +# + +# Hewlett Packard +obj-$(CONFIG_HP_ACCEL) += hp_accel.o +obj-$(CONFIG_HP_WMI) += hp-wmi.o +obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
drivers/platform/x86/hp/hp-wmi.c renamed from drivers/platform/x86/hp-wmi.c +0 -0
drivers/platform/x86/hp/hp_accel.c renamed from drivers/platform/x86/hp_accel.c +1 -1
@@ -26,7 +26,7 @@#include <linux/acpi.h> #include <linux/i8042.h> #include <linux/serio.h> -#include "../../misc/lis3lv02d/lis3lv02d.h" +#include "../../../misc/lis3lv02d/lis3lv02d.h" /* Delayed LEDs infrastructure ------------------------------------ */
drivers/platform/x86/hp/tc1100-wmi.c renamed from drivers/platform/x86/tc1100-wmi.c +0 -0
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 88/203 RDMA/core: Fix multiple -Warray-bounds warnings
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit aa4d540b4150052ae3b36d286b9c833a961ce291 ]
GCC-13 (and Clang)[1] does not like to access a partially allocated object, since it cannot reason about it for bounds checking.
In this case 140 bytes are allocated for an object of type struct ib_umad_packet:
packet = kzalloc(sizeof(*packet) + IB_MGMT_RMPP_HDR, GFP_KERNEL);
However, notice that sizeof(*packet) is only 104 bytes:
struct ib_umad_packet {
struct ib_mad_send_buf * msg; /* 0 8 */
struct ib_mad_recv_wc * recv_wc; /* 8 8 */
struct list_head list; /* 16 16 */
int length; /* 32 4 */
/* XXX 4 bytes hole, try to pack */
struct ib_user_mad mad __attribute__((__aligned__(8))); /* 40 64 */
/* size: 104, cachelines: 2, members: 5 */
/* sum members: 100, holes: 1, sum holes: 4 */
/* forced alignments: 1, forced holes: 1, sum forced holes: 4 */
/* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));and 36 bytes extra bytes are allocated for a flexible-array member in struct ib_user_mad:
include/rdma/ib_mad.h:
120 enum {
...
123 IB_MGMT_RMPP_HDR = 36,
... }
struct ib_user_mad {
struct ib_user_mad_hdr hdr; /* 0 64 */
/* --- cacheline 1 boundary (64 bytes) --- */
__u64 data[] __attribute__((__aligned__(8))); /* 64 0 */
/* size: 64, cachelines: 1, members: 2 */
/* forced alignments: 1 */
} __attribute__((__aligned__(8)));So we have sizeof(*packet) + IB_MGMT_RMPP_HDR == 140 bytes
Then the address of the flex-array member (for which only 36 bytes were allocated) is casted and copied into a pointer to struct ib_rmpp_mad, which, in turn, is of size 256 bytes:
rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data;
struct ib_rmpp_mad {
struct ib_mad_hdr mad_hdr; /* 0 24 */
struct ib_rmpp_hdr rmpp_hdr; /* 24 12 */
u8 data[220]; /* 36 220 *//* size: 256, cachelines: 4, members: 3 */ };
The thing is that those 36 bytes allocated for flex-array member data in struct ib_user_mad onlly account for the size of both struct ib_mad_hdr and struct ib_rmpp_hdr, but nothing is left for array u8 data[220]. So, the compiler is legitimately complaining about accessing an object for which not enough memory was allocated.
Apparently, the only members of struct ib_rmpp_mad that are relevant (that are actually being used) in function ib_umad_write() are mad_hdr and rmpp_hdr. So, instead of casting packet->mad.data to (struct ib_rmpp_mad *) create a new structure
struct ib_rmpp_mad_hdr {
struct ib_mad_hdr mad_hdr;
struct ib_rmpp_hdr rmpp_hdr;
} __packed;and cast packet->mad.data to (struct ib_rmpp_mad_hdr *).
Notice that
IB_MGMT_RMPP_HDR == sizeof(struct ib_rmpp_mad_hdr) == 36 bytes
Refactor the rest of the code, accordingly.
Fix the following warnings seen under GCC-13 and -Warray-bounds:drivers/infiniband/core/user_mad.c:564:50: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=] drivers/infiniband/core/user_mad.c:566:42: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=] drivers/infiniband/core/user_mad.c:618:25: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=] drivers/infiniband/core/user_mad.c:622:44: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=]
--- drivers/infiniband/core/user_mad.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/infiniband/core/user_mad.c +14 -9
@@ -131,6 +131,11 @@ struct ib_umad_packet {struct ib_user_mad mad; }; +struct ib_rmpp_mad_hdr { +struct ib_mad_hdr mad_hdr; +struct ib_rmpp_hdr rmpp_hdr; +} __packed; +#define CREATE_TRACE_POINTS #include <trace/events/ib_umad.h>
@@ -494,11 +499,11 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, size_t count, loff_t *pos) { struct ib_umad_file *file = filp->private_data; +struct ib_rmpp_mad_hdr *rmpp_mad_hdr;struct ib_umad_packet *packet;struct ib_mad_agent *agent;struct rdma_ah_attr ah_attr;struct ib_ah *ah; -struct ib_rmpp_mad *rmpp_mad;__be64 *tid;int ret, data_len, hdr_len, copy_offset, rmpp_active;u8 base_version;
@@ -506,7 +511,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,if (count <hdr_size (file) +IB_MGMT_RMPP_HDR )return -EINVAL ; - packet =kzalloc (sizeof *packet +IB_MGMT_RMPP_HDR ,GFP_KERNEL ); + packet =kzalloc (sizeof (*packet) +IB_MGMT_RMPP_HDR ,GFP_KERNEL );if (!packet)return -ENOMEM ;
@@ -560,13 +565,13 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, goto err_up; } - rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data; - hdr_len =ib_get_mad_data_offset (rmpp_mad->mad_hdr.mgmt_class); + rmpp_mad_hdr = (struct ib_rmpp_mad_hdr *)packet->mad.data; + hdr_len =ib_get_mad_data_offset (rmpp_mad_hdr->mad_hdr.mgmt_class); -if (ib_is_mad_class_rmpp (rmpp_mad->mad_hdr.mgmt_class) +if (ib_is_mad_class_rmpp (rmpp_mad_hdr->mad_hdr.mgmt_class) &&ib_mad_kernel_rmpp_agent (agent)) { copy_offset =IB_MGMT_RMPP_HDR ; - rmpp_active =ib_get_rmpp_flags (&rmpp_mad->rmpp_hdr) & + rmpp_active =ib_get_rmpp_flags (&rmpp_mad_hdr->rmpp_hdr) &IB_MGMT_RMPP_FLAG_ACTIVE ; }else { copy_offset =IB_MGMT_MAD_HDR ;
@@ -615,12 +620,12 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, tid = &((struct ib_mad_hdr *) packet->msg->mad)->tid; *tid =cpu_to_be64 (((u64 ) agent->hi_tid) <<32 | (be64_to_cpup (tid) &0xffffffff )); - rmpp_mad->mad_hdr.tid = *tid; + rmpp_mad_hdr->mad_hdr.tid = *tid; }if (!ib_mad_kernel_rmpp_agent (agent) - &&ib_is_mad_class_rmpp (rmpp_mad->mad_hdr.mgmt_class) - && (ib_get_rmpp_flags (&rmpp_mad->rmpp_hdr) &IB_MGMT_RMPP_FLAG_ACTIVE )) { + &&ib_is_mad_class_rmpp (rmpp_mad_hdr->mad_hdr.mgmt_class) + && (ib_get_rmpp_flags (&rmpp_mad_hdr->rmpp_hdr) &IB_MGMT_RMPP_FLAG_ACTIVE )) {spin_lock_irq (&file->send_lock);list_add_tail (&packet->list, &file->send_list);spin_unlock_irq (&file->send_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 106/203 platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct
In reply to Greg Kroah-HartmanFrom: Fae <[email protected]>
[ Upstream commit decab2825c3ef9b154c6f76bce40872ffb41c36f ]
Fixes micmute key of HP Envy X360 ey0xxx.
--- drivers/platform/x86/hp/hp-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/hp/hp-wmi.c +1 -0
@@ -156,6 +156,7 @@ struct bios_rfkill2_state {static const struct key_entry hp_wmi_keymap[] = { {KE_KEY ,0x02 , {KEY_BRIGHTNESSUP } }, {KE_KEY ,0x03 , {KEY_BRIGHTNESSDOWN } }, + {KE_KEY ,0x270 , {KEY_MICMUTE } }, {KE_KEY ,0x20e6 , {KEY_PROG1 } }, {KE_KEY ,0x20e8 , {KEY_MEDIA } }, {KE_KEY ,0x2142 , {KEY_MEDIA } },
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 107/203 xfrm: dont check the default policy if the policy allows the packet
In reply to Greg Kroah-HartmanFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit 430cac487400494c19a8b85299e979bb07b4671f ]
The current code doesn't let a simple "allow" policy counteract a default policy blocking all incoming packets:
ip x p setdefault in block
ip x p a src 192.168.2.1/32 dst 192.168.2.2/32 dir in action allow
At this stage, we have an allow policy (with or without transforms) for this packet. It doesn't matter what the default policy says, since the policy we looked up lets the packet through. The case of a blocking policy is already handled separately, so we can remove this check.
--- net/xfrm/xfrm_policy.c | 6 ------ 1 file changed, 6 deletions(-)
net/xfrm/xfrm_policy.c +0 -6
@@ -3636,12 +3636,6 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, } xfrm_nr = ti; -if (net->xfrm.policy_default[dir] ==XFRM_USERPOLICY_BLOCK && - !xfrm_nr) { -XFRM_INC_STATS (net,LINUX_MIB_XFRMINNOSTATES ); - goto reject; - } -if (npols >1 ) {xfrm_tmpl_sort (stp, tpp, xfrm_nr, family); tpp = stp;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 108/203 Revert "Fix XFRM-I support for nested ESP tunnels"
In reply to Greg Kroah-HartmanFrom: Martin Willi <[email protected]>
[ Upstream commit 5fc46f94219d1d103ffb5f0832be9da674d85a73 ]
This reverts commit b0355dbbf13c0052931dd14c38c789efed64d3de.
The reverted commit clears the secpath on packets received via xfrm interfaces to support nested IPsec tunnels. This breaks Netfilter policy matching using xt_policy in the FORWARD chain, as the secpath is missing during forwarding. Additionally, Benedict Wong reports that it breaks Transport-in-Tunnel mode.
Fix this regression by reverting the commit until we have a better approach for nested IPsec tunnels.
--- net/xfrm/xfrm_interface.c | 54 +++------------------------------------ net/xfrm/xfrm_policy.c | 3 --- 2 files changed, 4 insertions(+), 53 deletions(-)
net/xfrm/xfrm_interface.c +4 -50
@@ -207,52 +207,6 @@ static void xfrmi_scrub_packet(struct sk_buff *skb, bool xnet) skb->mark =0 ; } -static int xfrmi_input (struct sk_buff *skb,int nexthdr,__be32 spi, -int encap_type,unsigned short family) -{ -struct sec_path *sp; - - sp =skb_sec_path (skb); -if (sp && (sp->len || sp->olen) && - !xfrm_policy_check (NULL ,XFRM_POLICY_IN , skb, family)) - goto discard; - -XFRM_SPI_SKB_CB (skb)->family = family; -if (family ==AF_INET ) { -XFRM_SPI_SKB_CB (skb)->daddroff = offsetof(struct iphdr , daddr); -XFRM_TUNNEL_SKB_CB (skb)->tunnel.ip4 =NULL ; - }else { -XFRM_SPI_SKB_CB (skb)->daddroff = offsetof(struct ipv6hdr , daddr); -XFRM_TUNNEL_SKB_CB (skb)->tunnel.ip6 =NULL ; - } - -return xfrm_input (skb, nexthdr, spi, encap_type); -discard: -kfree_skb (skb); -return 0 ; -} - -static int xfrmi4_rcv (struct sk_buff *skb) -{ -return xfrmi_input (skb,ip_hdr (skb)->protocol,0 ,0 ,AF_INET ); -} - -static int xfrmi6_rcv (struct sk_buff *skb) -{ -return xfrmi_input (skb,skb_network_header (skb)[IP6CB (skb)->nhoff], -0 ,0 ,AF_INET6 ); -} - -static int xfrmi4_input (struct sk_buff *skb,int nexthdr,__be32 spi,int encap_type) -{ -return xfrmi_input (skb, nexthdr, spi, encap_type,AF_INET ); -} - -static int xfrmi6_input (struct sk_buff *skb,int nexthdr,__be32 spi,int encap_type) -{ -return xfrmi_input (skb, nexthdr, spi, encap_type,AF_INET6 ); -} -static int xfrmi_rcv_cb (struct sk_buff *skb,int err) {const struct xfrm_mode *inner_mode;
@@ -820,8 +774,8 @@ static struct pernet_operations xfrmi_net_ops = { };static struct xfrm6_protocol xfrmi_esp6_protocol__read_mostly = { - .handler = xfrmi6_rcv, - .input_handler = xfrmi6_input, + .handler = xfrm6_rcv, + .input_handler = xfrm_input, .cb_handler = xfrmi_rcv_cb, .err_handler = xfrmi6_err, .priority =10 ,
@@ -871,8 +825,8 @@ static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {#endif static struct xfrm4_protocol xfrmi_esp4_protocol__read_mostly = { - .handler = xfrmi4_rcv, - .input_handler = xfrmi4_input, + .handler = xfrm4_rcv, + .input_handler = xfrm_input, .cb_handler = xfrmi_rcv_cb, .err_handler = xfrmi4_err, .priority =10 ,
net/xfrm/xfrm_policy.c +0 -3
@@ -3663,9 +3663,6 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, goto reject; } -if (if_id) -secpath_reset (skb); -xfrm_pols_put (pols, npols);return 1 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 109/203 drm/msm/dp: unregister audio driver during unbind
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 85c636284cb63b7740b4ae98881ace92158068d3 ]
while binding the code always registers a audio driver, however there is no corresponding unregistration done in unbind. This leads to multiple redundant audio platform devices if dp_display_bind and dp_display_unbind happens multiple times during startup. On X13s platform this resulted in 6 to 9 audio codec device instead of just 3 codec devices for 3 dp ports.
Fix this by unregistering codecs on unbind.
Patchwork: https://patchwork.freedesktop.org/patch/533324/
--- drivers/gpu/drm/msm/dp/dp_audio.c | 12 ++++++++++++ drivers/gpu/drm/msm/dp/dp_audio.h | 2 ++ drivers/gpu/drm/msm/dp/dp_display.c | 1 + 3 files changed, 15 insertions(+)
drivers/gpu/drm/msm/dp/dp_audio.c +12 -0
@@ -577,6 +577,18 @@ static struct hdmi_codec_pdata codec_data = { .i2s = 1, }; +void dp_unregister_audio_driver (struct device *dev,struct dp_audio *dp_audio) +{ +struct dp_audio_private *audio_priv; + + audio_priv = container_of(dp_audio, struct dp_audio_private, dp_audio); + +if (audio_priv->audio_pdev) { +platform_device_unregister (audio_priv->audio_pdev); + audio_priv->audio_pdev =NULL ; + } +} +int dp_register_audio_driver (struct device *dev,struct dp_audio *dp_audio) {
drivers/gpu/drm/msm/dp/dp_audio.h +2 -0
@@ -53,6 +53,8 @@ struct dp_audio *dp_audio_get(struct platform_device *pdev,int dp_register_audio_driver (struct device *dev,struct dp_audio *dp_audio); +void dp_unregister_audio_driver (struct device *dev,struct dp_audio *dp_audio); +/** * dp_audio_put() *
drivers/gpu/drm/msm/dp/dp_display.c +1 -0
@@ -267,6 +267,7 @@ static void dp_display_unbind(struct device *dev, struct device *master,kthread_stop (dp->ev_tsk);dp_power_client_deinit (dp->power); +dp_unregister_audio_driver (dev, dp->audio);dp_aux_unregister (dp->aux); priv->dp =NULL ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 110/203 drm/msm/dpu: Add INTF_5 interrupts
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 148e852f290fe8be9fa69953bee2f958befd65d4 ]
SC8180x has the eDP controller wired up to INTF_5, so add the interrupt register block for this interface to the list.
Stable-dep-of: e9d9ce5462fe ("drm/msm/dpu: Move non-MDP_TOP INTF_INTR offsets out of hwio header")
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 6 ++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 1 + 2 files changed, 7 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c +6 -0
@@ -20,6 +20,7 @@#define MDP_INTF_2_OFF 0x6B000#define MDP_INTF_3_OFF 0x6B800#define MDP_INTF_4_OFF 0x6C000 +#define MDP_INTF_5_OFF 0x6C800#define MDP_AD4_0_OFF 0x7C000#define MDP_AD4_1_OFF 0x7D000#define MDP_AD4_INTR_EN_OFF 0x41c
@@ -87,6 +88,11 @@ static const struct dpu_intr_reg dpu_intr_set[] = {MDP_INTF_4_OFF +INTF_INTR_EN ,MDP_INTF_4_OFF +INTF_INTR_STATUS }, + { +MDP_INTF_5_OFF +INTF_INTR_CLEAR , +MDP_INTF_5_OFF +INTF_INTR_EN , +MDP_INTF_5_OFF +INTF_INTR_STATUS + }, {MDP_AD4_0_OFF +MDP_AD4_INTR_CLEAR_OFF , MDP_AD4_0_OFF + MDP_AD4_INTR_EN_OFF,
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h +1 -0
@@ -22,6 +22,7 @@ enum dpu_hw_intr_reg {MDP_INTF2_INTR ,MDP_INTF3_INTR ,MDP_INTF4_INTR , +MDP_INTF5_INTR ,MDP_AD4_0_INTR ,MDP_AD4_1_INTR , MDP_INTF0_7xxx_INTR,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 111/203 drm/msm/dpu: Move non-MDP_TOP INTF_INTR offsets out of hwio header
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit e9d9ce5462fecdeefec87953de71df4d025cbc72 ]
These offsets do not fall under the MDP TOP block and do not fit the comment right above. Move them to dpu_hw_interrupts.c next to the repsective MDP_INTF_x_OFF interrupt block offsets.
Patchwork: https://patchwork.freedesktop.org/patch/534203/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 5 ++++- drivers/gpu/drm/msm/disp/dpu1/dpu_hwio.h | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c +4 -1
@@ -12,7 +12,7 @@/** * Register offsets in MDSS register file for the interrupt registers -* w.r.t. to the MDP base +* w.r.t. the MDP base */ #define MDP_SSPP_TOP0_OFF 0x0#define MDP_INTF_0_OFF 0x6A000
@@ -21,6 +21,9 @@#define MDP_INTF_3_OFF 0x6B800#define MDP_INTF_4_OFF 0x6C000#define MDP_INTF_5_OFF 0x6C800 +#define INTF_INTR_EN 0x1c0 +#define INTF_INTR_STATUS 0x1c4 +#define INTF_INTR_CLEAR 0x1c8#define MDP_AD4_0_OFF 0x7C000#define MDP_AD4_1_OFF 0x7D000#define MDP_AD4_INTR_EN_OFF 0x41c
drivers/gpu/drm/msm/disp/dpu1/dpu_hwio.h +0 -3
@@ -20,9 +20,6 @@#define HIST_INTR_EN 0x01c#define HIST_INTR_STATUS 0x020#define HIST_INTR_CLEAR 0x024 -#define INTF_INTR_EN 0x1C0 -#define INTF_INTR_STATUS 0x1C4 -#define INTF_INTR_CLEAR 0x1C8#define SPLIT_DISPLAY_EN 0x2F4#define SPLIT_DISPLAY_UPPER_PIPE_CTRL 0x2F8#define DSPP_IGC_COLOR0_RAM_LUTN 0x300
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 112/203 drm/msm/dpu: Remove duplicate register defines from INTF
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 202c044203ac5860e3025169105368d99f9bc6a2 ]
The INTF_FRAME_LINE_COUNT_EN, INTF_FRAME_COUNT and INTF_LINE_COUNT registers are already defined higher up, in the right place when sorted numerically.
Patchwork: https://patchwork.freedesktop.org/patch/534231/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0 -5
@@ -53,11 +53,6 @@#define INTF_TPG_RGB_MAPPING 0x11C#define INTF_PROG_FETCH_START 0x170#define INTF_PROG_ROT_START 0x174 - -#define INTF_FRAME_LINE_COUNT_EN 0x0A8 -#define INTF_FRAME_COUNT 0x0AC -#define INTF_LINE_COUNT 0x0B0 -#define INTF_MUX 0x25C static const struct dpu_intf_cfg *_intf_offset(enum dpu_intf intf,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 113/203 dt-bindings: display/msm: dsi-controller-main: Document qcom, master-dsi and qcom, sync-dual-dsi
In reply to Greg Kroah-HartmanFrom: Jianhua Lu <[email protected]>
[ Upstream commit ca29699a57ecee6084a4056f5bfd6f11dd359a71 ]
This fixes warning:
sm8250-xiaomi-elish-csot.dtb: dsi@ae94000: Unevaluated properties are not allowed ('qcom,master-dsi', 'qcom,sync-dual-dsi' were unexpected)
Patchwork: https://patchwork.freedesktop.org/patch/534306/
--- .../bindings/display/msm/dsi-controller-main.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml +12 -0
@@ -64,6 +64,18 @@ properties: Indicates if the DSI controller is driving a panel which needs 2 DSI links. + qcom,master-dsi: + type: boolean + description: | + Indicates if the DSI controller is the master DSI controller when + qcom,dual-dsi-mode enabled. + + qcom,sync-dual-dsi: + type: boolean + description: | + Indicates if the DSI controller needs to sync the other DSI controller + with MIPI DCS commands when qcom,dual-dsi-mode enabled. + assigned-clocks: minItems: 2 maxItems: 2
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 114/203 ASoC: fsl_micfil: Fix error handler with pm_runtime_enable
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 17955aba7877a4494d8093ae5498e19469b01d57 ]
There is error message when defer probe happens:
fsl-micfil-dai 30ca0000.micfil: Unbalanced pm_runtime_enable!
Fix the error handler with pm_runtime_enable and add fsl_micfil_remove() for pm_runtime_disable.
--- sound/soc/fsl/fsl_micfil.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
sound/soc/fsl/fsl_micfil.c +13 -1
@@ -763,7 +763,7 @@ static int fsl_micfil_probe(struct platform_device *pdev) ret =devm_snd_dmaengine_pcm_register (&pdev->dev,NULL ,0 );if (ret) {dev_err (&pdev->dev,"failed to pcm register\n" ); -return ret; + goto err_pm_disable; } ret = devm_snd_soc_register_component(&pdev->dev, &fsl_micfil_component,
@@ -771,9 +771,20 @@ static int fsl_micfil_probe(struct platform_device *pdev)if (ret) {dev_err (&pdev->dev,"failed to register component %s\n" , fsl_micfil_component.name); + goto err_pm_disable; }return ret; + +err_pm_disable: +pm_runtime_disable (&pdev->dev); + +return ret; +} + +static void fsl_micfil_remove (struct platform_device *pdev) +{ +pm_runtime_disable (&pdev->dev); }static int __maybe_unused fsl_micfil_runtime_suspend (struct device *dev)
@@ -834,6 +845,7 @@ static const struct dev_pm_ops fsl_micfil_pm_ops = {static struct platform_driver fsl_micfil_driver = { .probe = fsl_micfil_probe, + .remove_new = fsl_micfil_remove, .driver = { .name ="fsl-micfil-dai" , .pm = &fsl_micfil_pm_ops,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 115/203 cpupower: Make TSC read per CPU for Mperf monitor
In reply to Greg Kroah-HartmanFrom: Wyes Karny <[email protected]>
[ Upstream commit c2adb1877b76fc81ae041e1db1a6ed2078c6746b ]
System-wide TSC read could cause a drift in C0 percentage calculation. Because if first TSC is read and then one by one mperf is read for all cpus, this introduces drift between mperf reading of later CPUs and TSC reading. To lower this drift read TSC per CPU and also just after mperf read. This technique improves C0 percentage calculation in Mperf monitor.
Before fix: (System 100% busy)
| Mperf || RAPL || Idle_Stats PKG|CORE| CPU| C0 | Cx | Freq || pack | core || POLL | C1 | C2 0| 0| 0| 87.15| 12.85| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 0| 256| 84.62| 15.38| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 1| 1| 87.15| 12.85| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 1| 257| 84.08| 15.92| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 2| 2| 86.61| 13.39| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 2| 258| 83.26| 16.74| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 3| 3| 86.61| 13.39| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 3| 259| 83.60| 16.40| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 4| 4| 86.33| 13.67| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 4| 260| 83.33| 16.67| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 5| 5| 86.06| 13.94| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 5| 261| 83.05| 16.95| 2695||168659003|3970468|| 0.00| 0.00| 0.00 0| 6| 6| 85.51| 14.49| 2695||168659003|3970468|| 0.00| 0.00| 0.00
After fix: (System 100% busy)
| Mperf || RAPL || Idle_Stats PKG|CORE| CPU| C0 | Cx | Freq || pack | core || POLL | C1 | C2 0| 0| 0| 98.03| 1.97| 2415||163295480|3811189|| 0.00| 0.00| 0.00 0| 0| 256| 98.50| 1.50| 2394||163295480|3811189|| 0.00| 0.00| 0.00 0| 1| 1| 99.99| 0.01| 2401||163295480|3811189|| 0.00| 0.00| 0.00 0| 1| 257| 99.99| 0.01| 2375||163295480|3811189|| 0.00| 0.00| 0.00 0| 2| 2| 99.99| 0.01| 2401||163295480|3811189|| 0.00| 0.00| 0.00 0| 2| 258|100.00| 0.00| 2401||163295480|3811189|| 0.00| 0.00| 0.00 0| 3| 3|100.00| 0.00| 2401||163295480|3811189|| 0.00| 0.00| 0.00 0| 3| 259| 99.99| 0.01| 2435||163295480|3811189|| 0.00| 0.00| 0.00 0| 4| 4|100.00| 0.00| 2401||163295480|3811189|| 0.00| 0.00| 0.00 0| 4| 260|100.00| 0.00| 2435||163295480|3811189|| 0.00| 0.00| 0.00 0| 5| 5| 99.99| 0.01| 2401||163295480|3811189|| 0.00| 0.00| 0.00 0| 5| 261|100.00| 0.00| 2435||163295480|3811189|| 0.00| 0.00| 0.00 0| 6| 6|100.00| 0.00| 2401||163295480|3811189|| 0.00| 0.00| 0.00 0| 6| 262|100.00| 0.00| 2435||163295480|3811189|| 0.00| 0.00| 0.00
--- .../utils/idle_monitor/mperf_monitor.c | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-)
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c +14 -17
@@ -70,8 +70,8 @@ static int max_freq_mode;*/ static unsigned long max_frequency; -static unsigned long long tsc_at_measure_start; -static unsigned long long tsc_at_measure_end; +static unsigned long long *tsc_at_measure_start; +static unsigned long long *tsc_at_measure_end;static unsigned long long *mperf_previous_count;static unsigned long long *aperf_previous_count;static unsigned long long *mperf_current_count;
@@ -169,7 +169,7 @@ static int mperf_get_count_percent(unsigned int id, double *percent, aperf_diff = aperf_current_count[cpu] - aperf_previous_count[cpu];if (max_freq_mode ==MAX_FREQ_TSC_REF ) { - tsc_diff = tsc_at_measure_end - tsc_at_measure_start; + tsc_diff = tsc_at_measure_end[cpu] - tsc_at_measure_start[cpu]; *percent =100.0 * mperf_diff / tsc_diff;dprint ("%s: TSC Ref - mperf_diff: %llu, tsc_diff: %llu\n" , mperf_cstates[id].name, mperf_diff, tsc_diff);
@@ -206,7 +206,7 @@ static int mperf_get_count_freq(unsigned int id, unsigned long long *count,if (max_freq_mode ==MAX_FREQ_TSC_REF ) {/* Calculate max_freq from TSC count */ - tsc_diff = tsc_at_measure_end - tsc_at_measure_start; + tsc_diff = tsc_at_measure_end[cpu] - tsc_at_measure_start[cpu]; time_diff =timespec_diff_us (time_start, time_end); max_frequency = tsc_diff / time_diff; }
@@ -225,33 +225,27 @@ static int mperf_get_count_freq(unsigned int id, unsigned long long *count,static int mperf_start (void ) {int cpu; -unsigned long long dbg;clock_gettime (CLOCK_REALTIME , &time_start); -mperf_get_tsc (&tsc_at_measure_start); -for (cpu =0 ; cpu < cpu_count; cpu++) +for (cpu =0 ; cpu < cpu_count; cpu++) { +mperf_get_tsc (&tsc_at_measure_start[cpu]);mperf_init_stats (cpu); + } -mperf_get_tsc (&dbg); -dprint ("TSC diff: %llu\n" , dbg - tsc_at_measure_start);return 0 ; }static int mperf_stop (void ) { -unsigned long long dbg;int cpu; -for (cpu =0 ; cpu < cpu_count; cpu++) +for (cpu =0 ; cpu < cpu_count; cpu++) {mperf_measure_stats (cpu); +mperf_get_tsc (&tsc_at_measure_end[cpu]); + } -mperf_get_tsc (&tsc_at_measure_end);clock_gettime (CLOCK_REALTIME , &time_end); - -mperf_get_tsc (&dbg); -dprint ("TSC diff: %llu\n" , dbg - tsc_at_measure_end); -return 0 ; }
@@ -353,7 +347,8 @@ struct cpuidle_monitor *mperf_register(void) aperf_previous_count =calloc (cpu_count,sizeof (unsigned long long )); mperf_current_count =calloc (cpu_count,sizeof (unsigned long long )); aperf_current_count =calloc (cpu_count,sizeof (unsigned long long )); - + tsc_at_measure_start =calloc (cpu_count,sizeof (unsigned long long )); + tsc_at_measure_end =calloc (cpu_count,sizeof (unsigned long long )); mperf_monitor.name_len =strlen (mperf_monitor.name);return &mperf_monitor; }
@@ -364,6 +359,8 @@ void mperf_unregister(void)free (aperf_previous_count);free (mperf_current_count);free (aperf_current_count); +free (tsc_at_measure_start); +free (tsc_at_measure_end);free (is_valid); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 89/203 iommu/arm-smmu-qcom: Limit the SMR groups to 128
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 12261134732689b7e30c59db9978f81230965181 ]
Some platforms support more than 128 stream matching groups than what is defined by the ARM SMMU architecture specification. But due to some unknown reasons, those additional groups don't exhibit the same behavior as the architecture supported ones.
For instance, the additional groups will not detect the quirky behavior of some firmware versions intercepting writes to S2CR register, thus skipping the quirk implemented in the driver and causing boot crash.
So let's limit the groups to 128 for now until the issue with those groups are fixed and issue a notice to users in that case.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +15 -1
@@ -247,12 +247,26 @@ static int qcom_smmu_init_context(struct arm_smmu_domain *smmu_domain,static int qcom_smmu_cfg_probe (struct arm_smmu_device *smmu) { -unsigned int last_s2cr =ARM_SMMU_GR0_S2CR (smmu->num_mapping_groups -1 );struct qcom_smmu *qsmmu =to_qcom_smmu (smmu); +unsigned int last_s2cr;u32 reg;u32 smr;int i; +/* +* Some platforms support more than the Arm SMMU architected maximum of +* 128 stream matching groups. For unknown reasons, the additional +* groups don't exhibit the same behavior as the architected registers, +* so limit the groups to 128 until the behavior is fixed for the other +* groups. +*/ +if (smmu->num_mapping_groups >128 ) { +dev_notice (smmu->dev,"\tLimiting the stream matching groups to 128\n" ); + smmu->num_mapping_groups =128 ; + } + + last_s2cr =ARM_SMMU_GR0_S2CR (smmu->num_mapping_groups -1 ); +/* * With some firmware versions writes to S2CR of type FAULT are * ignored, and writing BYPASS will end up written as FAULT in the
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 116/203 af_key: Reject optional tunnel/BEET mode templates in outbound policies
In reply to Greg Kroah-HartmanFrom: Tobias Brunner <[email protected]>
[ Upstream commit cf3128a7aca55b2eefb68281d44749c683bdc96f ]
xfrm_state_find() uses encap_family of the current template with the passed local and remote addresses to find a matching state. If an optional tunnel or BEET mode template is skipped in a mixed-family scenario, there could be a mismatch causing an out-of-bounds read as the addresses were not replaced to match the family of the next template.
While there are theoretical use cases for optional templates in outbound policies, the only practical one is to skip IPComp states in inbound policies if uncompressed packets are received that are handled by an implicitly created IPIP state instead.
--- net/key/af_key.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/key/af_key.c +8 -4
@@ -1940,7 +1940,8 @@ static u32 gen_reqid(struct net *net) }static int -parse_ipsecrequest (struct xfrm_policy *xp,struct sadb_x_ipsecrequest *rq) +parse_ipsecrequest (struct xfrm_policy *xp,struct sadb_x_policy *pol, +struct sadb_x_ipsecrequest *rq) {struct net *net =xp_net (xp);struct xfrm_tmpl *t = xp->xfrm_vec + xp->xfrm_nr;
@@ -1958,9 +1959,12 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq)if ((mode =pfkey_mode_to_xfrm (rq->sadb_x_ipsecrequest_mode)) <0 )return -EINVAL ; t->mode = mode; -if (rq->sadb_x_ipsecrequest_level ==IPSEC_LEVEL_USE ) +if (rq->sadb_x_ipsecrequest_level ==IPSEC_LEVEL_USE ) { +if ((mode ==XFRM_MODE_TUNNEL || mode ==XFRM_MODE_BEET ) && + pol->sadb_x_policy_dir ==IPSEC_DIR_OUTBOUND ) +return -EINVAL ; t->optional =1 ; -else if (rq->sadb_x_ipsecrequest_level ==IPSEC_LEVEL_UNIQUE ) { + }else if (rq->sadb_x_ipsecrequest_level ==IPSEC_LEVEL_UNIQUE ) { t->reqid = rq->sadb_x_ipsecrequest_reqid;if (t->reqid >IPSEC_MANUAL_REQID_MAX ) t->reqid =0 ;
@@ -2002,7 +2006,7 @@ parse_ipsecrequests(struct xfrm_policy *xp, struct sadb_x_policy *pol) rq->sadb_x_ipsecrequest_len < sizeof(*rq))return -EINVAL ; -if ((err =parse_ipsecrequest (xp, rq)) <0 ) +if ((err =parse_ipsecrequest (xp, pol, rq)) <0 )return err; len -= rq->sadb_x_ipsecrequest_len; rq = (void *)((u8 *)rq + rq->sadb_x_ipsecrequest_len);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 90/203 fs/ntfs3: Fix NULL pointer dereference in ni_write_inode
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit db2a3cc6a3481076da6344cc62a80a4e2525f36f ]
Syzbot found the following issue:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000016
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000010af56000
[0000000000000016] pgd=08000001090da003, p4d=08000001090da003, pud=08000001090ce003, pmd=0000000000000000
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 3036 Comm: syz-executor206 Not tainted 6.0.0-rc6-syzkaller-17739-g16c9f284e746 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : is_rec_inuse fs/ntfs3/ntfs.h:313 [inline] pc : ni_write_inode+0xac/0x798 fs/ntfs3/frecord.c:3232 lr : ni_write_inode+0xa0/0x798 fs/ntfs3/frecord.c:3226
sp : ffff8000126c3800
x29: ffff8000126c3860 x28: 0000000000000000 x27: ffff0000c8b02000
x26: ffff0000c7502320 x25: ffff0000c7502288 x24: 0000000000000000
x23: ffff80000cbec91c x22: ffff0000c8b03000 x21: ffff0000c8b02000
x20: 0000000000000001 x19: ffff0000c75024d8 x18: 00000000000000c0
x17: ffff80000dd1b198 x16: ffff80000db59158 x15: ffff0000c4b6b500
x14: 00000000000000b8 x13: 0000000000000000 x12: ffff0000c4b6b500
x11: ff80800008be1b60 x10: 0000000000000000 x9 : ffff0000c4b6b500 x8 : 0000000000000000 x7 : ffff800008be1b50 x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000 x2 : 0000000000000008 x1 : 0000000000000001 x0 : 0000000000000000
Call trace: is_rec_inuse fs/ntfs3/ntfs.h:313 [inline] ni_write_inode+0xac/0x798 fs/ntfs3/frecord.c:3232 ntfs_evict_inode+0x54/0x84 fs/ntfs3/inode.c:1744 evict+0xec/0x334 fs/inode.c:665 iput_final fs/inode.c:1748 [inline] iput+0x2c4/0x324 fs/inode.c:1774 ntfs_new_inode+0x7c/0xe0 fs/ntfs3/fsntfs.c:1660 ntfs_create_inode+0x20c/0xe78 fs/ntfs3/inode.c:1278 ntfs_create+0x54/0x74 fs/ntfs3/namei.c:100 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x804/0x11c4 fs/namei.c:3688 do_filp_open+0xdc/0x1b8 fs/namei.c:3718 do_sys_openat2+0xb8/0x22c fs/open.c:1311 do_sys_open fs/open.c:1327 [inline] __do_sys_openat fs/open.c:1343 [inline] __se_sys_openat fs/open.c:1338 [inline] __arm64_sys_openat+0xb0/0xe0 fs/open.c:1338 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall arch/arm64/kernel/syscall.c:52 [inline] el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654 el0t_64_sync+0x18c/0x190 Code: 97dafee4 340001b4 f9401328 2a1f03e0 (79402d14) ---[ end trace 0000000000000000 ]---
Above issue may happens as follows:ntfs_new_inode
mi_init
mi->mrec = kmalloc(sbi->record_size, GFP_NOFS); -->failed to allocate memory
if (!mi->mrec)
return -ENOMEM;
iput
iput_final
evict
ntfs_evict_inode
ni_write_inode
is_rec_inuse(ni->mi.mrec)-> As 'ni->mi.mrec' is NULL trigger NULL-ptr-derefTo solve above issue if new inode failed make inode bad before call 'iput()' in 'ntfs_new_inode()'.
--- fs/ntfs3/fsntfs.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/fsntfs.c +1 -0
@@ -1686,6 +1686,7 @@ struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, bool dir) out:if (err) { +make_bad_inode (inode);iput (inode); ni =ERR_PTR (err); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 91/203 fs/ntfs3: Enhance the attribute size check
In reply to Greg Kroah-HartmanFrom: Edward Lo <[email protected]>
[ Upstream commit 4f082a7531223a438c757bb20e304f4c941c67a8 ]
This combines the overflow and boundary check so that all attribute size will be properly examined while enumerating them.
[ 169.181521] BUG: KASAN: slab-out-of-bounds in run_unpack+0x2e3/0x570 [ 169.183161] Read of size 1 at addr ffff8880094b6240 by task mount/247 [ 169.184046] [ 169.184925] CPU: 0 PID: 247 Comm: mount Not tainted 6.0.0-rc7+ #3 [ 169.185908] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 169.187066] Call Trace: [ 169.187492] <TASK> [ 169.188049] dump_stack_lvl+0x49/0x63 [ 169.188495] print_report.cold+0xf5/0x689 [ 169.188964] ? run_unpack+0x2e3/0x570 [ 169.189331] kasan_report+0xa7/0x130 [ 169.189714] ? run_unpack+0x2e3/0x570 [ 169.190079] __asan_load1+0x51/0x60 [ 169.190634] run_unpack+0x2e3/0x570 [ 169.191290] ? run_pack+0x840/0x840 [ 169.191569] ? run_lookup_entry+0xb3/0x1f0 [ 169.192443] ? mi_enum_attr+0x20a/0x230 [ 169.192886] run_unpack_ex+0xad/0x3e0 [ 169.193276] ? run_unpack+0x570/0x570 [ 169.193557] ? ni_load_mi+0x80/0x80 [ 169.193889] ? debug_smp_processor_id+0x17/0x20 [ 169.194236] ? mi_init+0x4a/0x70 [ 169.194496] attr_load_runs_vcn+0x166/0x1c0 [ 169.194851] ? attr_data_write_resident+0x250/0x250 [ 169.195188] mi_read+0x133/0x2c0 [ 169.195481] ntfs_iget5+0x277/0x1780 [ 169.196017] ? call_rcu+0x1c7/0x330 [ 169.196392] ? ntfs_get_block_bmap+0x70/0x70 [ 169.196708] ? evict+0x223/0x280 [ 169.197014] ? __kmalloc+0x33/0x540 [ 169.197305] ? wnd_init+0x15b/0x1b0 [ 169.197599] ntfs_fill_super+0x1026/0x1ba0 [ 169.197994] ? put_ntfs+0x1d0/0x1d0 [ 169.198299] ? vsprintf+0x20/0x20 [ 169.198583] ? mutex_unlock+0x81/0xd0 [ 169.198930] ? set_blocksize+0x95/0x150 [ 169.199269] get_tree_bdev+0x232/0x370 [ 169.199750] ? put_ntfs+0x1d0/0x1d0 [ 169.200094] ntfs_fs_get_tree+0x15/0x20 [ 169.200431] vfs_get_tree+0x4c/0x130 [ 169.200714] path_mount+0x654/0xfe0 [ 169.201067] ? putname+0x80/0xa0 [ 169.201358] ? finish_automount+0x2e0/0x2e0 [ 169.201965] ? putname+0x80/0xa0 [ 169.202445] ? kmem_cache_free+0x1c4/0x440 [ 169.203075] ? putname+0x80/0xa0 [ 169.203414] do_mount+0xd6/0xf0 [ 169.203719] ? path_mount+0xfe0/0xfe0 [ 169.203977] ? __kasan_check_write+0x14/0x20 [ 169.204382] __x64_sys_mount+0xca/0x110 [ 169.204711] do_syscall_64+0x3b/0x90 [ 169.205059] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 169.205571] RIP: 0033:0x7f67a80e948a [ 169.206327] Code: 48 8b 0d 11 fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 008 [ 169.208296] RSP: 002b:00007ffddf020f58 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 [ 169.209253] RAX: ffffffffffffffda RBX: 000055e2547a6060 RCX: 00007f67a80e948a [ 169.209777] RDX: 000055e2547a6260 RSI: 000055e2547a62e0 RDI: 000055e2547aeaf0 [ 169.210342] RBP: 0000000000000000 R08: 000055e2547a6280 R09: 0000000000000020 [ 169.210843] R10: 00000000c0ed0000 R11: 0000000000000202 R12: 000055e2547aeaf0 [ 169.211307] R13: 000055e2547a6260 R14: 0000000000000000 R15: 00000000ffffffff [ 169.211913] </TASK> [ 169.212304] [ 169.212680] Allocated by task 0: [ 169.212963] (stack is not available) [ 169.213200] [ 169.213472] The buggy address belongs to the object at ffff8880094b5e00 [ 169.213472] which belongs to the cache UDP of size 1152 [ 169.214095] The buggy address is located 1088 bytes inside of [ 169.214095] 1152-byte region [ffff8880094b5e00, ffff8880094b6280) [ 169.214639] [ 169.215004] The buggy address belongs to the physical page: [ 169.215766] page:000000002e324c8c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x94b4 [ 169.218412] head:000000002e324c8c order:2 compound_mapcount:0 compound_pincount:0 [ 169.219078] flags: 0xfffffc0010200(slab|head|node=0|zone=1|lastcpupid=0x1fffff) [ 169.220272] raw: 000fffffc0010200 0000000000000000 dead000000000122 ffff888002409b40 [ 169.221006] raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000 [ 169.222320] page dumped because: kasan: bad access detected [ 169.222922] [ 169.223119] Memory state around the buggy address: [ 169.224056] ffff8880094b6100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.224908] ffff8880094b6180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.225677] >ffff8880094b6200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.226445] ^ [ 169.227055] ffff8880094b6280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.227638] ffff8880094b6300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
--- fs/ntfs3/record.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
fs/ntfs3/record.c +2 -7
@@ -220,11 +220,6 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)return NULL ; } -if (off + asize < off) { -/* overflow check */ -return NULL ; - } - attr =Add2Ptr (attr, asize); off += asize; }
@@ -247,8 +242,8 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)if ((t32 &0xf ) || (t32 >0x100 ))return NULL ; -/* Check boundary. */ -if (off + asize > used) +/* Check overflow and boundary. */ +if (off + asize < off || off + asize > used)return NULL ;/* Check size of attribute. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 92/203 fs/ntfs3: Fix NULL dereference in ni_write_inode
In reply to Greg Kroah-HartmanFrom: Abdun Nihaal <[email protected]>
[ Upstream commit 8dae4f6341e335a09575be60b4fdf697c732a470 ]
Syzbot reports a NULL dereference in ni_write_inode. When creating a new inode, if allocation fails in mi_init function (called in mi_format_new function), mi->mrec is set to NULL. In the error path of this inode creation, mi->mrec is later dereferenced in ni_write_inode.
Add a NULL check to prevent NULL dereference.
--- fs/ntfs3/frecord.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ntfs3/frecord.c +3 -0
@@ -3189,6 +3189,9 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint)return 0 ; } +if (!ni->mi.mrec) + goto out; +if (is_rec_inuse (ni->mi.mrec) && !(sbi->flags &NTFS_FLAGS_LOG_REPLAYING ) && inode->i_nlink) {bool modified = false;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 93/203 fs/ntfs3: Validate MFT flags before replaying logs
In reply to Greg Kroah-HartmanFrom: Edward Lo <[email protected]>
[ Upstream commit 98bea253aa28ad8be2ce565a9ca21beb4a9419e5 ]
Log load and replay is part of the metadata handle flow during mount operation. The $MFT record will be loaded and used while replaying logs. However, a malformed $MFT record, say, has RECORD_FLAG_DIR flag set and contains an ATTR_ROOT attribute will misguide kernel to treat it as a directory, and try to free the allocated resources when the corresponding inode is freed, which will cause an invalid kfree because the memory hasn't actually been allocated.
[ 101.368647] BUG: KASAN: invalid-free in kvfree+0x2c/0x40 [ 101.369457] [ 101.369986] CPU: 0 PID: 198 Comm: mount Not tainted 6.0.0-rc7+ #5 [ 101.370529] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 101.371362] Call Trace: [ 101.371795] <TASK> [ 101.372157] dump_stack_lvl+0x49/0x63 [ 101.372658] print_report.cold+0xf5/0x689 [ 101.373022] ? ni_write_inode+0x754/0xd90 [ 101.373378] ? kvfree+0x2c/0x40 [ 101.373698] kasan_report_invalid_free+0x77/0xf0 [ 101.374058] ? kvfree+0x2c/0x40 [ 101.374352] ? kvfree+0x2c/0x40 [ 101.374668] __kasan_slab_free+0x189/0x1b0 [ 101.374992] ? kvfree+0x2c/0x40 [ 101.375271] kfree+0x168/0x3b0 [ 101.375717] kvfree+0x2c/0x40 [ 101.376002] indx_clear+0x26/0x60 [ 101.376316] ni_clear+0xc5/0x290 [ 101.376661] ntfs_evict_inode+0x45/0x70 [ 101.377001] evict+0x199/0x280 [ 101.377432] iput.part.0+0x286/0x320 [ 101.377819] iput+0x32/0x50 [ 101.378166] ntfs_loadlog_and_replay+0x143/0x320 [ 101.378656] ? ntfs_bio_fill_1+0x510/0x510 [ 101.378968] ? iput.part.0+0x286/0x320 [ 101.379367] ntfs_fill_super+0xecb/0x1ba0 [ 101.379729] ? put_ntfs+0x1d0/0x1d0 [ 101.380046] ? vsprintf+0x20/0x20 [ 101.380542] ? mutex_unlock+0x81/0xd0 [ 101.380914] ? set_blocksize+0x95/0x150 [ 101.381597] get_tree_bdev+0x232/0x370 [ 101.382254] ? put_ntfs+0x1d0/0x1d0 [ 101.382699] ntfs_fs_get_tree+0x15/0x20 [ 101.383094] vfs_get_tree+0x4c/0x130 [ 101.383675] path_mount+0x654/0xfe0 [ 101.384203] ? putname+0x80/0xa0 [ 101.384540] ? finish_automount+0x2e0/0x2e0 [ 101.384943] ? putname+0x80/0xa0 [ 101.385362] ? kmem_cache_free+0x1c4/0x440 [ 101.385968] ? putname+0x80/0xa0 [ 101.386666] do_mount+0xd6/0xf0 [ 101.387228] ? path_mount+0xfe0/0xfe0 [ 101.387585] ? __kasan_check_write+0x14/0x20 [ 101.387979] __x64_sys_mount+0xca/0x110 [ 101.388436] do_syscall_64+0x3b/0x90 [ 101.388757] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 101.389289] RIP: 0033:0x7fa0f70e948a [ 101.390048] Code: 48 8b 0d 11 fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 008 [ 101.391297] RSP: 002b:00007ffc24fdecc8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 [ 101.391988] RAX: ffffffffffffffda RBX: 000055932c183060 RCX: 00007fa0f70e948a [ 101.392494] RDX: 000055932c183260 RSI: 000055932c1832e0 RDI: 000055932c18bce0 [ 101.393053] RBP: 0000000000000000 R08: 000055932c183280 R09: 0000000000000020 [ 101.393577] R10: 00000000c0ed0000 R11: 0000000000000202 R12: 000055932c18bce0 [ 101.394044] R13: 000055932c183260 R14: 0000000000000000 R15: 00000000ffffffff [ 101.394747] </TASK> [ 101.395402] [ 101.396047] Allocated by task 198: [ 101.396724] kasan_save_stack+0x26/0x50 [ 101.397400] __kasan_slab_alloc+0x6d/0x90 [ 101.397974] kmem_cache_alloc_lru+0x192/0x5a0 [ 101.398524] ntfs_alloc_inode+0x23/0x70 [ 101.399137] alloc_inode+0x3b/0xf0 [ 101.399534] iget5_locked+0x54/0xa0 [ 101.400026] ntfs_iget5+0xaf/0x1780 [ 101.400414] ntfs_loadlog_and_replay+0xe5/0x320 [ 101.400883] ntfs_fill_super+0xecb/0x1ba0 [ 101.401313] get_tree_bdev+0x232/0x370 [ 101.401774] ntfs_fs_get_tree+0x15/0x20 [ 101.402224] vfs_get_tree+0x4c/0x130 [ 101.402673] path_mount+0x654/0xfe0 [ 101.403160] do_mount+0xd6/0xf0 [ 101.403537] __x64_sys_mount+0xca/0x110 [ 101.404058] do_syscall_64+0x3b/0x90 [ 101.404333] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 101.404816] [ 101.405067] The buggy address belongs to the object at ffff888008cc9ea0 [ 101.405067] which belongs to the cache ntfs_inode_cache of size 992 [ 101.406171] The buggy address is located 232 bytes inside of [ 101.406171] 992-byte region [ffff888008cc9ea0, ffff888008cca280) [ 101.406995] [ 101.408559] The buggy address belongs to the physical page: [ 101.409320] page:00000000dccf19dd refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8cc8 [ 101.410654] head:00000000dccf19dd order:2 compound_mapcount:0 compound_pincount:0 [ 101.411533] flags: 0xfffffc0010200(slab|head|node=0|zone=1|lastcpupid=0x1fffff) [ 101.412665] raw: 000fffffc0010200 0000000000000000 dead000000000122 ffff888003695140 [ 101.413209] raw: 0000000000000000 00000000800e000e 00000001ffffffff 0000000000000000 [ 101.413799] page dumped because: kasan: bad access detected [ 101.414213] [ 101.414427] Memory state around the buggy address: [ 101.414991] ffff888008cc9e80: fc fc fc fc 00 00 00 00 00 00 00 00 00 00 00 00 [ 101.415785] ffff888008cc9f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 101.416933] >ffff888008cc9f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 101.417857] ^ [ 101.418566] ffff888008cca000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 101.419704] ffff888008cca080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
--- fs/ntfs3/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ntfs3/inode.c +6 -0
@@ -98,6 +98,12 @@ static struct inode *ntfs_read_mft(struct inode *inode,/* Record should contain $I30 root. */ is_dir = rec->flags &RECORD_FLAG_DIR ; +/* MFT_REC_MFT is not a dir */ +if (is_dir && ino ==MFT_REC_MFT ) { + err = -EINVAL ; + goto out; + } + inode->i_generation =le16_to_cpu (rec->seq);/* Enumerate all struct Attributes MFT. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 94/203 fs/ntfs3: Add length check in indx_get_root
In reply to Greg Kroah-HartmanFrom: Edward Lo <[email protected]>
[ Upstream commit 08e8cf5f2d9ec383a2e339a2711b62a54ff3fba0 ]
This adds a length check to guarantee the retrieved index root is legit.
[ 162.459513] BUG: KASAN: use-after-free in hdr_find_e.isra.0+0x10c/0x320 [ 162.460176] Read of size 2 at addr ffff8880037bca99 by task mount/243 [ 162.460851] [ 162.461252] CPU: 0 PID: 243 Comm: mount Not tainted 6.0.0-rc7 #42 [ 162.461744] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 162.462609] Call Trace: [ 162.462954] <TASK> [ 162.463276] dump_stack_lvl+0x49/0x63 [ 162.463822] print_report.cold+0xf5/0x689 [ 162.464608] ? unwind_get_return_address+0x3a/0x60 [ 162.465766] ? hdr_find_e.isra.0+0x10c/0x320 [ 162.466975] kasan_report+0xa7/0x130 [ 162.467506] ? _raw_spin_lock_irq+0xc0/0xf0 [ 162.467998] ? hdr_find_e.isra.0+0x10c/0x320 [ 162.468536] __asan_load2+0x68/0x90 [ 162.468923] hdr_find_e.isra.0+0x10c/0x320 [ 162.469282] ? cmp_uints+0xe0/0xe0 [ 162.469557] ? cmp_sdh+0x90/0x90 [ 162.469864] ? ni_find_attr+0x214/0x300 [ 162.470217] ? ni_load_mi+0x80/0x80 [ 162.470479] ? entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 162.470931] ? ntfs_bread_run+0x190/0x190 [ 162.471307] ? indx_get_root+0xe4/0x190 [ 162.471556] ? indx_get_root+0x140/0x190 [ 162.471833] ? indx_init+0x1e0/0x1e0 [ 162.472069] ? fnd_clear+0x115/0x140 [ 162.472363] ? _raw_spin_lock_irqsave+0x100/0x100 [ 162.472731] indx_find+0x184/0x470 [ 162.473461] ? sysvec_apic_timer_interrupt+0x57/0xc0 [ 162.474429] ? indx_find_buffer+0x2d0/0x2d0 [ 162.474704] ? do_syscall_64+0x3b/0x90 [ 162.474962] dir_search_u+0x196/0x2f0 [ 162.475381] ? ntfs_nls_to_utf16+0x450/0x450 [ 162.475661] ? ntfs_security_init+0x3d6/0x440 [ 162.475906] ? is_sd_valid+0x180/0x180 [ 162.476191] ntfs_extend_init+0x13f/0x2c0 [ 162.476496] ? ntfs_fix_post_read+0x130/0x130 [ 162.476861] ? iput.part.0+0x286/0x320 [ 162.477325] ntfs_fill_super+0x11e0/0x1b50 [ 162.477709] ? put_ntfs+0x1d0/0x1d0 [ 162.477970] ? vsprintf+0x20/0x20 [ 162.478258] ? set_blocksize+0x95/0x150 [ 162.478538] get_tree_bdev+0x232/0x370 [ 162.478789] ? put_ntfs+0x1d0/0x1d0 [ 162.479038] ntfs_fs_get_tree+0x15/0x20 [ 162.479374] vfs_get_tree+0x4c/0x130 [ 162.479729] path_mount+0x654/0xfe0 [ 162.480124] ? putname+0x80/0xa0 [ 162.480484] ? finish_automount+0x2e0/0x2e0 [ 162.480894] ? putname+0x80/0xa0 [ 162.481467] ? kmem_cache_free+0x1c4/0x440 [ 162.482280] ? putname+0x80/0xa0 [ 162.482714] do_mount+0xd6/0xf0 [ 162.483264] ? path_mount+0xfe0/0xfe0 [ 162.484782] ? __kasan_check_write+0x14/0x20 [ 162.485593] __x64_sys_mount+0xca/0x110 [ 162.486024] do_syscall_64+0x3b/0x90 [ 162.486543] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 162.487141] RIP: 0033:0x7f9d374e948a [ 162.488324] Code: 48 8b 0d 11 fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 008 [ 162.489728] RSP: 002b:00007ffe30e73d18 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5 [ 162.490971] RAX: ffffffffffffffda RBX: 0000561cdb43a060 RCX: 00007f9d374e948a [ 162.491669] RDX: 0000561cdb43a260 RSI: 0000561cdb43a2e0 RDI: 0000561cdb442af0 [ 162.492050] RBP: 0000000000000000 R08: 0000561cdb43a280 R09: 0000000000000020 [ 162.492459] R10: 00000000c0ed0000 R11: 0000000000000206 R12: 0000561cdb442af0 [ 162.493183] R13: 0000561cdb43a260 R14: 0000000000000000 R15: 00000000ffffffff [ 162.493644] </TASK> [ 162.493908] [ 162.494214] The buggy address belongs to the physical page: [ 162.494761] page:000000003e38a3d5 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x37bc [ 162.496064] flags: 0xfffffc0000000(node=0|zone=1|lastcpupid=0x1fffff) [ 162.497278] raw: 000fffffc0000000 ffffea00000df1c8 ffffea00000df008 0000000000000000 [ 162.498928] raw: 0000000000000000 0000000000240000 00000000ffffffff 0000000000000000 [ 162.500542] page dumped because: kasan: bad access detected [ 162.501057] [ 162.501242] Memory state around the buggy address: [ 162.502230] ffff8880037bc980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 162.502977] ffff8880037bca00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 162.503522] >ffff8880037bca80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 162.503963] ^ [ 162.504370] ffff8880037bcb00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 162.504766] ffff8880037bcb80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
--- fs/ntfs3/index.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/ntfs3/index.c +10 -1
@@ -934,6 +934,7 @@ struct INDEX_ROOT *indx_get_root(struct ntfs_index *indx, struct ntfs_inode *ni,struct ATTR_LIST_ENTRY *le =NULL ;struct ATTRIB *a;const struct INDEX_NAMES *in = &s_index_names[indx->type]; +struct INDEX_ROOT *root =NULL ; a =ni_find_attr (ni,NULL , &le,ATTR_ROOT , in->name, in->name_len,NULL , mi);
@@ -943,7 +944,15 @@ struct INDEX_ROOT *indx_get_root(struct ntfs_index *indx, struct ntfs_inode *ni,if (attr) *attr = a; -return resident_data_ex (a,sizeof (struct INDEX_ROOT )); + root =resident_data_ex (a,sizeof (struct INDEX_ROOT )); + +/* length check */ +if (root && offsetof(struct INDEX_ROOT , ihdr) +le32_to_cpu (root->ihdr.used) > +le32_to_cpu (a->res.data_size)) { +return NULL ; + } + +return root; } static int indx_write(struct ntfs_index *indx, struct ntfs_inode *ni,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 95/203 fs/ntfs3: Fix a possible null-pointer dereference in ni_clear()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit ec275bf9693d19cc0fdce8436f4c425ced86f6e7 ]
In a previous commit c1006bd13146, ni->mi.mrec in ni_write_inode() could be NULL, and thus a NULL check is added for this variable.
However, in the same call stack, ni->mi.mrec can be also dereferenced in ni_clear():
ntfs_evict_inode(inode)
ni_write_inode(inode, ...)
ni = ntfs_i(inode);
is_rec_inuse(ni->mi.mrec) -> Add a NULL check by previous commit
ni_clear(ntfs_i(inode))
is_rec_inuse(ni->mi.mrec) -> No checkThus, a possible null-pointer dereference may exist in ni_clear(). To fix it, a NULL check is added in this function.
--- fs/ntfs3/frecord.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/frecord.c +1 -1
@@ -101,7 +101,7 @@ void ni_clear(struct ntfs_inode *ni) {struct rb_node *node; -if (!ni->vfs_inode.i_nlink &&is_rec_inuse (ni->mi.mrec)) +if (!ni->vfs_inode.i_nlink && ni->mi.mrec &&is_rec_inuse (ni->mi.mrec))ni_delete_all (ni);al_destroy (ni);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 86/203 sched: Fix KCSAN noinstr violation
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit e0b081d17a9f4e5c0cbb0e5fbeb1abe3de0f7e4e ]
With KCSAN enabled, end_of_stack() can get out-of-lined. Force it inline.
Fixes the following warnings:
vmlinux.o: warning: objtool: check_stackleak_irqoff+0x2b: call to end_of_stack() leaves .noinstr.text section
--- include/linux/sched/task_stack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/sched/task_stack.h +1 -1
@@ -23,7 +23,7 @@ static __always_inline void *task_stack_page(const struct task_struct *task)#define setup_thread_stack (new,old) do { } while(0) -static inline unsigned long *end_of_stack (const struct task_struct *task) +static __always_inline unsigned long *end_of_stack (const struct task_struct *task) {#ifdef CONFIG_STACK_GROWSUP return (unsigned long *)((unsigned long )task->stack +THREAD_SIZE ) -1 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 118/203 selftets: seg6: disable rp_filter by default in srv6_end_dt4_l3vpn_test
In reply to Greg Kroah-HartmanFrom: Andrea Mayer <[email protected]>
[ Upstream commit f97b8401e0deb46ad1e4245c21f651f64f55aaa6 ]
On some distributions, the rp_filter is automatically set (=1) by default on a netdev basis (also on VRFs).
In an SRv6 End.DT4 behavior, decapsulated IPv4 packets are routed using the table associated with the VRF bound to that tunnel. During lookup operations, the rp_filter can lead to packet loss when activated on the VRF.
Therefore, we chose to make this selftest more robust by explicitly disabling the rp_filter during tests (as it is automatically set by some Linux distributions).
--- .../testing/selftests/net/srv6_end_dt4_l3vpn_test.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh +6 -5
@@ -258,6 +258,12 @@ setup_hs() # set the networking for the host ip netns add ${hsname} + + # disable the rp_filter otherwise the kernel gets confused about how + # to route decap ipv4 packets. + ip netns exec ${rtname} sysctl -wq net.ipv4.conf.all.rp_filter=0 + ip netns exec ${rtname} sysctl -wq net.ipv4.conf.default.rp_filter=0 + ip -netns ${hsname} link add veth0 type veth peer name ${rtveth} ip -netns ${hsname} link set ${rtveth} netns ${rtname} ip -netns ${hsname} addr add ${IPv4_HS_NETWORK}.${hs}/24 dev veth0
@@ -276,11 +282,6 @@ setup_hs() ip netns exec ${rtname} sysctl -wq net.ipv4.conf.${rtveth}.proxy_arp=1 - # disable the rp_filter otherwise the kernel gets confused about how - # to route decap ipv4 packets. - ip netns exec ${rtname} sysctl -wq net.ipv4.conf.all.rp_filter=0 - ip netns exec ${rtname} sysctl -wq net.ipv4.conf.${rtveth}.rp_filter=0 - ip netns exec ${rtname} sh -c "echo 1 > /proc/sys/net/vrf/strict_mode" }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 127/203 serial: 8250_bcm7271: fix leak in `brcmuart_probe`
In reply to Greg Kroah-HartmanFrom: Doug Berger <[email protected]>
[ Upstream commit f264f2f6f4788dc031cef60a0cf2881902736709 ]
Smatch reports:drivers/tty/serial/8250/8250_bcm7271.c:1120 brcmuart_probe() warn:
'baud_mux_clk' from clk_prepare_enable() not released on lines: 1032.
The issue is fixed by using a managed clock.
--- drivers/tty/serial/8250/8250_bcm7271.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_bcm7271.c +1 -1
@@ -1016,7 +1016,7 @@ static int brcmuart_probe(struct platform_device *pdev)of_property_read_u32 (np,"clock-frequency" , &clk_rate);/* See if a Baud clock has been specified */ - baud_mux_clk =of_clk_get_by_name (np,"sw_baud" ); + baud_mux_clk =devm_clk_get (dev,"sw_baud" );if (IS_ERR (baud_mux_clk)) {if (PTR_ERR (baud_mux_clk) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 128/203 erspan: get the proto with the md version for collect_md
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit d80fc101d2eb9b3188c228d61223890aeea480a4 ]
In commit 20704bd1633d ("erspan: build the header with the right proto according to erspan_ver"), it gets the proto with t->parms.erspan_ver, but t->parms.erspan_ver is not used by collect_md branch, and instead it should get the proto with md->version for collect_md.
Thanks to Kevin for pointing this out.
--- net/ipv6/ip6_gre.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/ipv6/ip6_gre.c +8 -5
@@ -1015,12 +1015,14 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,ntohl (tun_id),ntohl (md->u.index), truncate, false); + proto =htons (ETH_P_ERSPAN ); }else if (md->version ==2 ) {erspan_build_header_v2 (skb,ntohl (tun_id), md->u.md2.dir,get_hwid (&md->u.md2), truncate, false); + proto =htons (ETH_P_ERSPAN2 ); }else { goto tx_err; }
@@ -1043,24 +1045,25 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,break ; } -if (t->parms.erspan_ver ==1 ) +if (t->parms.erspan_ver ==1 ) {erspan_build_header (skb,ntohl (t->parms.o_key), t->parms.index, truncate, false); -else if (t->parms.erspan_ver ==2 ) + proto =htons (ETH_P_ERSPAN ); + }else if (t->parms.erspan_ver ==2 ) {erspan_build_header_v2 (skb,ntohl (t->parms.o_key), t->parms.dir, t->parms.hwid, truncate, false); -else + proto =htons (ETH_P_ERSPAN2 ); + }else { goto tx_err; + } fl6.daddr = t->parms.raddr; }/* Push GRE header. */ - proto = (t->parms.erspan_ver ==1 ) ?htons (ETH_P_ERSPAN ) - :htons (ETH_P_ERSPAN2 );gre_build_header (skb,8 ,TUNNEL_SEQ , proto,0 ,htonl (atomic_fetch_inc (&t->o_seqno)));/* TooBig packet may have updated dst->dev's mtu */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 129/203 net: hns3: fix output information incomplete for dumping tx queue info with debugfs
In reply to Greg Kroah-HartmanFrom: Jie Wang <[email protected]>
[ Upstream commit 89f6bfb071182f05d7188c255b0e7251c3806f16 ]
In function hns3_dump_tx_queue_info, The print buffer is not enough when the tx BD number is configured to 32760. As a result several BD information wouldn't be displayed.
So fix it by increasing the tx queue print buffer length.
--- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +1 -1
@@ -123,7 +123,7 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = { .name = "tx_bd_queue", .cmd = HNAE3_DBG_CMD_TX_BD, .dentry = HNS3_DBG_DENTRY_TX_BD, - .buf_len = HNS3_DBG_READ_LEN_4MB, + .buf_len = HNS3_DBG_READ_LEN_5MB, .init = hns3_dbg_bd_file_init, }, {
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.h +1 -0
@@ -8,6 +8,7 @@#define HNS3_DBG_READ_LEN_128KB 0x20000#define HNS3_DBG_READ_LEN_1MB 0x100000#define HNS3_DBG_READ_LEN_4MB 0x400000 +#define HNS3_DBG_READ_LEN_5MB 0x500000#define HNS3_DBG_WRITE_LEN 1024#define HNS3_DBG_DATA_STR_LEN 32
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 130/203 net: hns3: fix sending pfc frames after reset issue
In reply to Greg Kroah-HartmanFrom: Jijie Shao <[email protected]>
[ Upstream commit f14db07064727dd3bc0906c77a6d2759c1bbb395 ]
To prevent the system from abnormally sending PFC frames after an abnormal reset. The hns3 driver notifies the firmware to disable pfc before reset.
--- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 +++++++++------ .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 ++-- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 5 +++++ 3 files changed, 16 insertions(+), 8 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +9 -6
@@ -8134,12 +8134,15 @@ static void hclge_ae_stop(struct hnae3_handle *handle)/* If it is not PF reset or FLR, the firmware will disable the MAC, * so it only need to stop phy here. */ -if (test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state) && - hdev->reset_type !=HNAE3_FUNC_RESET && - hdev->reset_type !=HNAE3_FLR_RESET ) { -hclge_mac_stop_phy (hdev); -hclge_update_link_status (hdev); -return ; +if (test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) { +hclge_pfc_pause_en_cfg (hdev,HCLGE_PFC_TX_RX_DISABLE , +HCLGE_PFC_DISABLE ); +if (hdev->reset_type !=HNAE3_FUNC_RESET && + hdev->reset_type !=HNAE3_FLR_RESET ) { +hclge_mac_stop_phy (hdev); +hclge_update_link_status (hdev); +return ; + } }hclge_reset_tqp (handle);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +2 -2
@@ -171,8 +171,8 @@ int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx)return hclge_cmd_send (&hdev->hw, &desc,1 ); } -static int hclge_pfc_pause_en_cfg (struct hclge_dev *hdev,u8 tx_rx_bitmap, -u8 pfc_bitmap) +int hclge_pfc_pause_en_cfg (struct hclge_dev *hdev,u8 tx_rx_bitmap, +u8 pfc_bitmap) {struct hclge_desc desc;struct hclge_pfc_en_cmd *pfc = (struct hclge_pfc_en_cmd *)desc.data;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +5 -0
@@ -155,6 +155,9 @@ struct hclge_bp_to_qs_map_cmd {u32 rsvd1; }; +#define HCLGE_PFC_DISABLE 0 +#define HCLGE_PFC_TX_RX_DISABLE 0 +struct hclge_pfc_en_cmd {u8 tx_rx_en_bitmap;u8 pri_en_bitmap;
@@ -226,6 +229,8 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc);void hclge_tm_pfc_info_update (struct hclge_dev *hdev);int hclge_tm_dwrr_cfg (struct hclge_dev *hdev);int hclge_tm_init_hw (struct hclge_dev *hdev,bool init); +int hclge_pfc_pause_en_cfg (struct hclge_dev *hdev,u8 tx_rx_bitmap, +u8 pfc_bitmap);int hclge_mac_pause_en_cfg (struct hclge_dev *hdev,bool tx,bool rx);int hclge_pause_addr_cfg (struct hclge_dev *hdev,const u8 *mac_addr);void hclge_pfc_rx_stats_get (struct hclge_dev *hdev,u64 *stats);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 131/203 net: hns3: fix reset delay time to avoid configuration timeout
In reply to Greg Kroah-HartmanFrom: Jie Wang <[email protected]>
[ Upstream commit 814d0c786068e858d889ada3153bff82f64223ad ]
Currently the hns3 vf function reset delays 5000ms before vf rebuild process. In product applications, this delay is too long for application configurations and causes configuration timeout.
According to the tests, 500ms delay is enough for reset process except PF FLR. So this patch modifies delay to 500ms in these scenarios.
--- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +4 -1
@@ -1885,7 +1885,10 @@ static int hclgevf_reset_wait(struct hclgevf_dev *hdev)* might happen in case reset assertion was made by PF. Yes, this also * means we might end up waiting bit more even for VF reset. */ -msleep (5000 ); +if (hdev->reset_type ==HNAE3_VF_FULL_RESET ) +msleep (5000 ); +else +msleep (500 );return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 132/203 media: netup_unidvb: fix use-after-free at del_timer()
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 0f5bb36bf9b39a2a96e730bf4455095b50713f63 ]
When Universal DVB card is detaching, netup_unidvb_dma_fini() uses del_timer() to stop dma->timeout timer. But when timer handler netup_unidvb_dma_timeout() is running, del_timer() could not stop it. As a result, the use-after-free bug could happen. The process is shown below:
(cleanup routine) | (timer routine)
| mod_timer(&dev->tx_sim_timer, ..)
netup_unidvb_finidev() | (wait a time)
netup_unidvb_dma_fini() | netup_unidvb_dma_timeout()
del_timer(&dma->timeout); |
| ndev->pci_dev->dev //USEFix by changing del_timer() to del_timer_sync().
--- drivers/media/pci/netup_unidvb/netup_unidvb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c +1 -1
@@ -697,7 +697,7 @@ static void netup_unidvb_dma_fini(struct netup_unidvb_dev *ndev, int num)netup_unidvb_dma_enable (dma,0 );msleep (50 );cancel_work_sync (&dma->work); -del_timer (&dma->timeout); +del_timer_sync (&dma->timeout); }static int netup_unidvb_dma_setup (struct netup_unidvb_dev *ndev)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 133/203 SUNRPC: double free xprt_ctxt while still in use
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
[ Upstream commit eb8d3a2c809abd73ab0a060fe971d6b9019aa3c1 ]
When an RPC request is deferred, the rq_xprt_ctxt pointer is moved out of the svc_rqst into the svc_deferred_req.
When the deferred request is revisited, the pointer is copied into the new svc_rqst - and also remains in the svc_deferred_req.
In the (rare?) case that the request is deferred a second time, the old svc_deferred_req is reused - it still has all the correct content. However in that case the rq_xprt_ctxt pointer is NOT cleared so that when xpo_release_xprt is called, the ctxt is freed (UDP) or possible added to a free list (RDMA).
When the deferred request is revisited for a second time, it will reference this ctxt which may be invalid, and the free the object a second time which is likely to oops.
So change svc_defer() to *always* clear rq_xprt_ctxt, and assert that the value is now stored in the svc_deferred_req.
--- net/sunrpc/svc_xprt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/svc_xprt.c +2 -1
@@ -1214,13 +1214,14 @@ static struct cache_deferred_req *svc_defer(struct cache_req *req) dr->argslen = rqstp->rq_arg.len >>2 ; dr->xprt_hlen = rqstp->rq_xprt_hlen; dr->xprt_ctxt = rqstp->rq_xprt_ctxt; - rqstp->rq_xprt_ctxt =NULL ;/* back up head to the start of the buffer and copy */ skip = rqstp->rq_arg.len - rqstp->rq_arg.head[0 ].iov_len;memcpy (dr->args, rqstp->rq_arg.head[0 ].iov_base - skip, dr->argslen <<2 ); } +WARN_ON_ONCE (rqstp->rq_xprt_ctxt != dr->xprt_ctxt); + rqstp->rq_xprt_ctxt =NULL ;trace_svc_defer (rqstp);svc_xprt_get (rqstp->rq_xprt); dr->xprt = rqstp->rq_xprt;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 134/203 tracing: Introduce helpers to safely handle dynamic-sized sockaddrs
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit d07c9ad622474616e94572e59e725c2c4a494fb4 ]
Enable a struct sockaddr to be stored in a trace record as a dynamically-sized field. The common cases are AF_INET and AF_INET6 which are different sizes, and are vastly smaller than a struct sockaddr_storage.
These are safer because, when used properly, the size of the sockaddr destination field in each trace record is now guaranteed to be the same as the source address that is being copied into it.
Stable-dep-of: 948f072ada23 ("SUNRPC: always free ctxt when freeing deferred request")
--- include/trace/bpf_probe.h | 6 ++++ include/trace/perf.h | 6 ++++ include/trace/trace_events.h | 55 ++++++++++++++++++++++++++++++++++-- 3 files changed, 65 insertions(+), 2 deletions(-)
include/trace/bpf_probe.h +6 -0
@@ -21,6 +21,9 @@#undef __get_bitmask#define __get_bitmask (field) (char *)__get_dynamic_array(field) +#undef __get_sockaddr +#define __get_sockaddr (field) ((struct sockaddr *)__get_dynamic_array(field)) +#undef __get_rel_dynamic_array#define __get_rel_dynamic_array (field) \ ((void *)(&__entry->__rel_loc_##field) + \
@@ -37,6 +40,9 @@#undef __get_rel_bitmask#define __get_rel_bitmask (field) (char *)__get_rel_dynamic_array(field) +#undef __get_rel_sockaddr +#define __get_rel_sockaddr (field) ((struct sockaddr *)__get_rel_dynamic_array(field)) +#undef __perf_count#define __perf_count (c) (c)
include/trace/perf.h +6 -0
@@ -21,6 +21,9 @@#undef __get_bitmask#define __get_bitmask (field) (char *)__get_dynamic_array(field) +#undef __get_sockaddr +#define __get_sockaddr (field) ((struct sockaddr *)__get_dynamic_array(field)) +#undef __get_rel_dynamic_array#define __get_rel_dynamic_array (field) \ ((void *)__entry + \
@@ -38,6 +41,9 @@#undef __get_rel_bitmask#define __get_rel_bitmask (field) (char *)__get_rel_dynamic_array(field) +#undef __get_rel_sockaddr +#define __get_rel_sockaddr (field) ((struct sockaddr *)__get_rel_dynamic_array(field)) +#undef __perf_count#define __perf_count (c) (__count = (c))
include/trace/trace_events.h +53 -2
128 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 135/203 SUNRPC: Clean up svc_deferred_class trace events
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 45cb7955c180a2a34d291e68938250c4f9bd294f ]
Replace the temporary fix from commit 4d5004451ab2 ("SUNRPC: Fix the svc_deferred_event trace class") with the use of __sockaddr and friends, which is the preferred solution (but only available in 5.18 and newer).
Stable-dep-of: 948f072ada23 ("SUNRPC: always free ctxt when freeing deferred request")
--- include/trace/events/sunrpc.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
include/trace/events/sunrpc.h +4 -5
@@ -1923,19 +1923,18 @@ DECLARE_EVENT_CLASS(svc_deferred_event,TP_STRUCT__entry (__field (const void *,dr )__field (u32, xid) -__array (__u8, addr,INET6_ADDRSTRLEN +10 ) + __sockaddr(addr, dr->addrlen) ),TP_fast_assign ( __entry->dr = dr; __entry->xid =be32_to_cpu (*(__be32 *)(dr->args + (dr->xprt_hlen>>2 ))); -snprintf (__entry->addr,sizeof (__entry->addr) -1 , -"%pISpc" , (struct sockaddr *)&dr->addr); +__assign_sockaddr (addr, &dr->addr, dr->addrlen); ), -TP_printk ("addr=%s dr=%p xid=0x%08x" , __entry->addr, __entry->dr, - __entry->xid) +TP_printk ("addr=%pISpc dr=%p xid=0x%08x" ,__get_sockaddr (addr), + __entry->dr, __entry->xid) );#define DEFINE_SVC_DEFERRED_EVENT (name) \
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 136/203 SUNRPC: Remove dead code in svc_tcp_release_rqst()
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 4af8b42e5629b97bdde287d5d6c250535d324676 ]
Clean up: svc_tcp_sendto() always sets rq_xprt_ctxt to NULL.
Stable-dep-of: 948f072ada23 ("SUNRPC: always free ctxt when freeing deferred request")
--- net/sunrpc/svcsock.c | 9 --------- 1 file changed, 9 deletions(-)
net/sunrpc/svcsock.c +0 -9
@@ -117,15 +117,6 @@ static void svc_reclassify_socket(struct socket *sock)*/ static void svc_tcp_release_rqst (struct svc_rqst *rqstp) { -struct sk_buff *skb = rqstp->rq_xprt_ctxt; - -if (skb) { -struct svc_sock *svsk = - container_of(rqstp->rq_xprt, struct svc_sock, sk_xprt); - - rqstp->rq_xprt_ctxt =NULL ; -skb_free_datagram_locked (svsk->sk_sk, skb); - } }/**
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 119/203 net: fec: Better handle pm_runtime_get() failing in .remove()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit f816b9829b19394d318e01953aa3b2721bca040d ]
In the (unlikely) event that pm_runtime_get() (disguised as pm_runtime_resume_and_get()) fails, the remove callback returned an error early. The problem with this is that the driver core ignores the error value and continues removing the device. This results in a resource leak. Worse the devm allocated resources are freed and so if a callback of the driver is called later the register mapping is already gone which probably results in a crash.
--- drivers/net/ethernet/freescale/fec_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +11 -4
@@ -4054,9 +4054,11 @@ fec_drv_remove(struct platform_device *pdev)struct device_node *np = pdev->dev.of_node;int ret; - ret =pm_runtime_resume_and_get (&pdev->dev); + ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) -return ret; +dev_err (&pdev->dev, +"Failed to resume device in remove callback (%pe)\n" , +ERR_PTR (ret));cancel_work_sync (&fep->tx_timeout_work);fec_ptp_stop (pdev);
@@ -4069,8 +4071,13 @@ fec_drv_remove(struct platform_device *pdev)of_phy_deregister_fixed_link (np);of_node_put (fep->phy_node); -clk_disable_unprepare (fep->clk_ahb); -clk_disable_unprepare (fep->clk_ipg); +/* After pm_runtime_get_sync() failed, the clks are still off, so skip +* disabling them again. +*/ +if (ret >=0 ) { +clk_disable_unprepare (fep->clk_ahb); +clk_disable_unprepare (fep->clk_ipg); + }pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 137/203 SUNRPC: Remove svc_rqst::rq_xprt_hlen
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 983084b2672c593959e3148d6a17c8b920797dde ]
Clean up: This field is now always set to zero.
Stable-dep-of: 948f072ada23 ("SUNRPC: always free ctxt when freeing deferred request")
--- include/linux/sunrpc/svc.h | 2 -- include/trace/events/sunrpc.h | 3 +-- net/sunrpc/svc_xprt.c | 10 ++++------ net/sunrpc/svcsock.c | 2 -- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 1 - 5 files changed, 5 insertions(+), 13 deletions(-)
include/linux/sunrpc/svc.h +0 -2
@@ -246,7 +246,6 @@ struct svc_rqst {void * rq_xprt_ctxt;/* transport specific context ptr */ struct svc_deferred_req *rq_deferred;/* deferred request we are replaying */ -size_t rq_xprt_hlen;/* xprt header len */ struct xdr_buf rq_arg;struct xdr_stream rq_arg_stream;struct xdr_stream rq_res_stream;
@@ -386,7 +385,6 @@ struct svc_deferred_req {size_t daddrlen;void *xprt_ctxt;struct cache_deferred_req handle; -size_t xprt_hlen;int argslen;__be32 args[]; };
include/trace/events/sunrpc.h +1 -2
@@ -1928,8 +1928,7 @@ DECLARE_EVENT_CLASS(svc_deferred_event,TP_fast_assign ( __entry->dr = dr; - __entry->xid =be32_to_cpu (*(__be32 *)(dr->args + - (dr->xprt_hlen>>2 ))); + __entry->xid =be32_to_cpu (*(__be32 *)dr->args);__assign_sockaddr (addr, &dr->addr, dr->addrlen); ),
net/sunrpc/svc_xprt.c +4 -6
@@ -1212,7 +1212,6 @@ static struct cache_deferred_req *svc_defer(struct cache_req *req) dr->addrlen = rqstp->rq_addrlen; dr->daddr = rqstp->rq_daddr; dr->argslen = rqstp->rq_arg.len >>2 ; - dr->xprt_hlen = rqstp->rq_xprt_hlen; dr->xprt_ctxt = rqstp->rq_xprt_ctxt;/* back up head to the start of the buffer and copy */
@@ -1241,22 +1240,21 @@ static noinline int svc_deferred_recv(struct svc_rqst *rqstp)trace_svc_defer_recv (dr);/* setup iov_base past transport header */ - rqstp->rq_arg.head[0 ].iov_base = dr->args + (dr->xprt_hlen>>2 ); + rqstp->rq_arg.head[0 ].iov_base = dr->args;/* The iov_len does not include the transport header bytes */ - rqstp->rq_arg.head[0 ].iov_len = (dr->argslen<<2 ) - dr->xprt_hlen; + rqstp->rq_arg.head[0 ].iov_len = dr->argslen <<2 ; rqstp->rq_arg.page_len =0 ;/* The rq_arg.len includes the transport header bytes */ - rqstp->rq_arg.len = dr->argslen<<2 ; + rqstp->rq_arg.len = dr->argslen <<2 ; rqstp->rq_prot = dr->prot;memcpy (&rqstp->rq_addr, &dr->addr, dr->addrlen); rqstp->rq_addrlen = dr->addrlen;/* Save off transport header len in case we get deferred again */ - rqstp->rq_xprt_hlen = dr->xprt_hlen; rqstp->rq_daddr = dr->daddr; rqstp->rq_respages = rqstp->rq_pages; rqstp->rq_xprt_ctxt = dr->xprt_ctxt;svc_xprt_received (rqstp->rq_xprt); -return (dr->argslen<<2 ) - dr->xprt_hlen; +return dr->argslen <<2 ; }
net/sunrpc/svcsock.c +0 -2
@@ -250,8 +250,6 @@ static ssize_t svc_tcp_read_msg(struct svc_rqst *rqstp, size_t buflen,ssize_t len;size_t t; - rqstp->rq_xprt_hlen =0 ; -clear_bit (XPT_DATA , &svsk->sk_xprt.xpt_flags);for (i =0 , t =0 ; t < buflen; i++, t +=PAGE_SIZE ) {
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +0 -1
@@ -826,7 +826,6 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) goto out_err;if (ret ==0 ) goto out_drop; - rqstp->rq_xprt_hlen =0 ;if (svc_rdma_is_reverse_direction_reply (xprt, ctxt)) goto out_backchannel;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 138/203 SUNRPC: always free ctxt when freeing deferred request
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
[ Upstream commit 948f072ada23e0a504c5e4d7d71d4c83bd0785ec ]
Since the ->xprt_ctxt pointer was added to svc_deferred_req, it has not been sufficient to use kfree() to free a deferred request. We may need to free the ctxt as well.
As freeing the ctxt is all that ->xpo_release_rqst() does, we repurpose it to explicit do that even when the ctxt is not stored in an rqst. So we now have ->xpo_release_ctxt() which is given an xprt and a ctxt, which may have been taken either from an rqst or from a dreq. The caller is now responsible for clearing that pointer after the call to ->xpo_release_ctxt.
We also clear dr->xprt_ctxt when the ctxt is moved into a new rqst when revisiting a deferred request. This ensures there is only one pointer to the ctxt, so the risk of double freeing in future is reduced. The new code in svc_xprt_release which releases both the ctxt and any rq_deferred depends on this.
--- include/linux/sunrpc/svc_rdma.h | 2 +- include/linux/sunrpc/svc_xprt.h | 2 +- net/sunrpc/svc_xprt.c | 23 +++++++++++++----- net/sunrpc/svcsock.c | 30 +++++++++++++----------- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 11 ++++----- net/sunrpc/xprtrdma/svc_rdma_transport.c | 2 +- 6 files changed, 41 insertions(+), 29 deletions(-)
include/linux/sunrpc/svc_rdma.h +1 -1
@@ -176,7 +176,7 @@ extern struct svc_rdma_recv_ctxt *extern void svc_rdma_recv_ctxt_put (struct svcxprt_rdma *rdma,struct svc_rdma_recv_ctxt *ctxt);extern void svc_rdma_flush_recv_queues (struct svcxprt_rdma *rdma); -extern void svc_rdma_release_rqst (struct svc_rqst *rqstp); +extern void svc_rdma_release_ctxt (struct svc_xprt *xprt,void *ctxt);extern int svc_rdma_recvfrom (struct svc_rqst *);/* svc_rdma_rw.c */
include/linux/sunrpc/svc_xprt.h +1 -1
@@ -23,7 +23,7 @@ struct svc_xprt_ops {int (*xpo_sendto)(struct svc_rqst *);int (*xpo_result_payload)(struct svc_rqst *,unsigned int ,unsigned int ); -void (*xpo_release_rqst)(struct svc_rqst *); +void (*xpo_release_ctxt)(struct svc_xprt *xprt,void *ctxt);void (*xpo_detach)(struct svc_xprt *);void (*xpo_free)(struct svc_xprt *);void (*xpo_secure_port)(struct svc_rqst *rqstp);
net/sunrpc/svc_xprt.c +17 -6
@@ -530,13 +530,23 @@ void svc_reserve(struct svc_rqst *rqstp, int space) }EXPORT_SYMBOL_GPL (svc_reserve); +static void free_deferred (struct svc_xprt *xprt,struct svc_deferred_req *dr) +{ +if (!dr) +return ; + + xprt->xpt_ops->xpo_release_ctxt (xprt, dr->xprt_ctxt); +kfree (dr); +} +static void svc_xprt_release (struct svc_rqst *rqstp) {struct svc_xprt *xprt = rqstp->rq_xprt; - xprt->xpt_ops->xpo_release_rqst (rqstp); + xprt->xpt_ops->xpo_release_ctxt (xprt, rqstp->rq_xprt_ctxt); + rqstp->rq_xprt_ctxt =NULL ; -kfree (rqstp->rq_deferred); +free_deferred (xprt, rqstp->rq_deferred); rqstp->rq_deferred =NULL ;pagevec_release (&rqstp->rq_pvec);
@@ -1054,7 +1064,7 @@ static void svc_delete_xprt(struct svc_xprt *xprt)spin_unlock_bh (&serv->sv_lock);while ((dr =svc_deferred_dequeue (xprt)) !=NULL ) -kfree (dr); +free_deferred (xprt, dr);call_xpt_users (xprt);svc_xprt_put (xprt);
@@ -1166,8 +1176,8 @@ static void svc_revisit(struct cache_deferred_req *dreq, int too_many)if (too_many ||test_bit (XPT_DEAD , &xprt->xpt_flags)) {spin_unlock (&xprt->xpt_lock);trace_svc_defer_drop (dr); +free_deferred (xprt, dr);svc_xprt_put (xprt); -kfree (dr);return ; } dr->xprt =NULL ;
@@ -1212,14 +1222,13 @@ static struct cache_deferred_req *svc_defer(struct cache_req *req) dr->addrlen = rqstp->rq_addrlen; dr->daddr = rqstp->rq_daddr; dr->argslen = rqstp->rq_arg.len >>2 ; - dr->xprt_ctxt = rqstp->rq_xprt_ctxt;/* back up head to the start of the buffer and copy */ skip = rqstp->rq_arg.len - rqstp->rq_arg.head[0 ].iov_len;memcpy (dr->args, rqstp->rq_arg.head[0 ].iov_base - skip, dr->argslen <<2 ); } -WARN_ON_ONCE (rqstp->rq_xprt_ctxt != dr->xprt_ctxt); + dr->xprt_ctxt = rqstp->rq_xprt_ctxt; rqstp->rq_xprt_ctxt =NULL ;trace_svc_defer (rqstp);svc_xprt_get (rqstp->rq_xprt);
@@ -1253,6 +1262,8 @@ static noinline int svc_deferred_recv(struct svc_rqst *rqstp) rqstp->rq_daddr = dr->daddr; rqstp->rq_respages = rqstp->rq_pages; rqstp->rq_xprt_ctxt = dr->xprt_ctxt; + + dr->xprt_ctxt =NULL ;svc_xprt_received (rqstp->rq_xprt);return dr->argslen <<2 ; }
net/sunrpc/svcsock.c +16 -14
@@ -111,27 +111,27 @@ static void svc_reclassify_socket(struct socket *sock)#endif /** -* svc_tcp_release_rqst - Release transport-related resources -* @rqstp: request structure with resources to be released +* svc_tcp_release_ctxt - Release transport-related resources +* @xprt: the transport which owned the context +* @ctxt: the context from rqstp->rq_xprt_ctxt or dr->xprt_ctxt * */ -static void svc_tcp_release_rqst (struct svc_rqst *rqstp) +static void svc_tcp_release_ctxt (struct svc_xprt *xprt,void *ctxt) { }/** -* svc_udp_release_rqst - Release transport-related resources -* @rqstp: request structure with resources to be released +* svc_udp_release_ctxt - Release transport-related resources +* @xprt: the transport which owned the context +* @ctxt: the context from rqstp->rq_xprt_ctxt or dr->xprt_ctxt * */ -static void svc_udp_release_rqst (struct svc_rqst *rqstp) +static void svc_udp_release_ctxt (struct svc_xprt *xprt,void *ctxt) { -struct sk_buff *skb = rqstp->rq_xprt_ctxt; +struct sk_buff *skb = ctxt; -if (skb) { - rqstp->rq_xprt_ctxt =NULL ; +if (skb)consume_skb (skb); - } }union svc_pktinfo_u {
@@ -559,7 +559,8 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)unsigned int sent;int err; -svc_udp_release_rqst (rqstp); +svc_udp_release_ctxt (xprt, rqstp->rq_xprt_ctxt); + rqstp->rq_xprt_ctxt =NULL ;svc_set_cmsg_data (rqstp, cmh);
@@ -628,7 +629,7 @@ static const struct svc_xprt_ops svc_udp_ops = { .xpo_recvfrom = svc_udp_recvfrom, .xpo_sendto = svc_udp_sendto, .xpo_result_payload = svc_sock_result_payload, - .xpo_release_rqst = svc_udp_release_rqst, + .xpo_release_ctxt = svc_udp_release_ctxt, .xpo_detach = svc_sock_detach, .xpo_free = svc_sock_free, .xpo_has_wspace = svc_udp_has_wspace,
@@ -1156,7 +1157,8 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp)unsigned int sent;int err; -svc_tcp_release_rqst (rqstp); +svc_tcp_release_ctxt (xprt, rqstp->rq_xprt_ctxt); + rqstp->rq_xprt_ctxt =NULL ;atomic_inc (&svsk->sk_sendqlen);mutex_lock (&xprt->xpt_mutex);
@@ -1201,7 +1203,7 @@ static const struct svc_xprt_ops svc_tcp_ops = { .xpo_recvfrom = svc_tcp_recvfrom, .xpo_sendto = svc_tcp_sendto, .xpo_result_payload = svc_sock_result_payload, - .xpo_release_rqst = svc_tcp_release_rqst, + .xpo_release_ctxt = svc_tcp_release_ctxt, .xpo_detach = svc_tcp_sock_detach, .xpo_free = svc_sock_free, .xpo_has_wspace = svc_tcp_has_wspace,
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +5 -6
@@ -239,21 +239,20 @@ void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma, }/** -* svc_rdma_release_rqst - Release transport-specific per-rqst resources -* @rqstp: svc_rqst being released +* svc_rdma_release_ctxt - Release transport-specific per-rqst resources +* @xprt: the transport which owned the context +* @vctxt: the context from rqstp->rq_xprt_ctxt or dr->xprt_ctxt * * Ensure that the recv_ctxt is released whether or not a Reply * was sent. For example, the client could close the connection, * or svc_process could drop an RPC, before the Reply is sent. */ -void svc_rdma_release_rqst (struct svc_rqst *rqstp) +void svc_rdma_release_ctxt (struct svc_xprt *xprt,void *vctxt) { -struct svc_rdma_recv_ctxt *ctxt = rqstp->rq_xprt_ctxt; -struct svc_xprt *xprt = rqstp->rq_xprt; +struct svc_rdma_recv_ctxt *ctxt = vctxt;struct svcxprt_rdma *rdma = container_of(xprt, struct svcxprt_rdma, sc_xprt); - rqstp->rq_xprt_ctxt =NULL ;if (ctxt)svc_rdma_recv_ctxt_put (rdma, ctxt); }
net/sunrpc/xprtrdma/svc_rdma_transport.c +1 -1
@@ -81,7 +81,7 @@ static const struct svc_xprt_ops svc_rdma_ops = { .xpo_recvfrom = svc_rdma_recvfrom, .xpo_sendto = svc_rdma_sendto, .xpo_result_payload = svc_rdma_result_payload, - .xpo_release_rqst = svc_rdma_release_rqst, + .xpo_release_ctxt = svc_rdma_release_ctxt, .xpo_detach = svc_rdma_detach, .xpo_free = svc_rdma_free, .xpo_has_wspace = svc_rdma_has_wspace,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 139/203 SUNRPC: Fix trace_svc_register() call site
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 07a27305938559fb35f7a46fb90a5e37728bdee6 ]
The trace event recorded incorrect values for the registered family, protocol, and port because the arguments are in the wrong order.
--- net/sunrpc/svc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/svc.c +1 -1
@@ -1024,7 +1024,7 @@ static int __svc_register(struct net *net, const char *progname,#endif } -trace_svc_register (progname, version, protocol, port, family, error); +trace_svc_register (progname, version, family, protocol, port, error);return error; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 140/203 drm/exynos: fix g2d_open/close helper function definitions
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 2ef0785b30bd6549ddbc124979f1b6596e065ae2 ]
The empty stub functions are defined as global functions, which causes a warning because of missing prototypes:
drivers/gpu/drm/exynos/exynos_drm_g2d.h:37:5: error: no previous prototype for 'g2d_open' drivers/gpu/drm/exynos/exynos_drm_g2d.h:42:5: error: no previous prototype for 'g2d_close'
Mark them as 'static inline' to avoid the warning and to make them behave as intended.
--- drivers/gpu/drm/exynos/exynos_drm_g2d.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_g2d.h +2 -2
@@ -34,11 +34,11 @@ static inline int exynos_g2d_exec_ioctl(struct drm_device *dev, void *data, return -ENODEV; } -int g2d_open (struct drm_device *drm_dev,struct drm_file *file) +static inline int g2d_open (struct drm_device *drm_dev,struct drm_file *file) {return 0 ; } -void g2d_close (struct drm_device *drm_dev,struct drm_file *file) +static inline void g2d_close (struct drm_device *drm_dev,struct drm_file *file) { }#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 141/203 net: nsh: Use correct mac_offset to unwind gso skb in nsh_gso_segment()
In reply to Greg Kroah-HartmanFrom: Dong Chenchen <[email protected]>
[ Upstream commit c83b49383b595be50647f0c764a48c78b5f3c4f8 ]
As the call trace shows, skb_panic was caused by wrong skb->mac_header in nsh_gso_segment():
invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 3 PID: 2737 Comm: syz Not tainted 6.3.0-next-20230505 #1 RIP: 0010:skb_panic+0xda/0xe0 call Trace: skb_push+0x91/0xa0 nsh_gso_segment+0x4f3/0x570 skb_mac_gso_segment+0x19e/0x270 __skb_gso_segment+0x1e8/0x3c0 validate_xmit_skb+0x452/0x890 validate_xmit_skb_list+0x99/0xd0 sch_direct_xmit+0x294/0x7c0 __dev_queue_xmit+0x16f0/0x1d70 packet_xmit+0x185/0x210 packet_snd+0xc15/0x1170 packet_sendmsg+0x7b/0xa0 sock_sendmsg+0x14f/0x160
The root cause is:nsh_gso_segment() use skb->network_header - nhoff to reset mac_header in skb_gso_error_unwind() if inner-layer protocol gso fails. However, skb->network_header may be reset by inner-layer protocol gso function e.g. mpls_gso_segment. skb->mac_header reset by the inaccurate network_header will be larger than skb headroom.
nsh_gso_segment
nhoff = skb->network_header - skb->mac_header;
__skb_pull(skb,nsh_len)
skb_mac_gso_segment
mpls_gso_segment
skb_reset_network_header(skb);//skb->network_header+=nsh_len
return -EINVAL;
skb_gso_error_unwind
skb_push(skb, nsh_len);
skb->mac_header = skb->network_header - nhoff;
// skb->mac_header > skb->headroom, cause skb_push panicUse correct mac_offset to restore mac_header and get rid of nhoff.
--- net/nsh/nsh.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/nsh/nsh.c +3 -5
@@ -77,13 +77,12 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, netdev_features_t features) {struct sk_buff *segs =ERR_PTR (-EINVAL ); +u16 mac_offset = skb->mac_header;unsigned int nsh_len, mac_len;__be16 proto; -int nhoff;skb_reset_network_header (skb); - nhoff = skb->network_header - skb->mac_header; mac_len = skb->mac_len;if (unlikely (!pskb_may_pull (skb,NSH_BASE_HDR_LEN )))
@@ -108,15 +107,14 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, segs =skb_mac_gso_segment (skb, features);if (IS_ERR_OR_NULL (segs)) {skb_gso_error_unwind (skb,htons (ETH_P_NSH ), nsh_len, - skb->network_header - nhoff, - mac_len); + mac_offset, mac_len); goto out; }for (skb = segs; skb; skb = skb->next) { skb->protocol =htons (ETH_P_NSH );__skb_push (skb, nsh_len); -skb_set_mac_header (skb, -nhoff); + skb->mac_header = mac_offset; skb->network_header = skb->mac_header + mac_len; skb->mac_len = mac_len; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 142/203 virtio-net: Maintain reverse cleanup order
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 27369c9c2b722617063d6b80c758ab153f1d95d4 ]
To easily audit the code, better to keep the device stop() sequence to be mirror of the device open() sequence.
Stable-dep-of: 5306623a9826 ("virtio_net: Fix error unwinding of XDP initialization")
--- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
@@ -1999,9 +1999,9 @@ static int virtnet_close(struct net_device *dev)cancel_delayed_work_sync (&vi->refill);for (i =0 ; i < vi->max_queue_pairs; i++) { +virtnet_napi_tx_disable (&vi->sq[i].napi);napi_disable (&vi->rq[i].napi);xdp_rxq_info_unreg (&vi->rq[i].xdp_rxq); -virtnet_napi_tx_disable (&vi->sq[i].napi); }return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 143/203 virtio_net: Fix error unwinding of XDP initialization
In reply to Greg Kroah-HartmanFrom: Feng Liu <[email protected]>
[ Upstream commit 5306623a9826aa7d63b32c6a3803c798a765474d ]
When initializing XDP in virtnet_open(), some rq xdp initialization may hit an error causing net device open failed. However, previous rqs have already initialized XDP and enabled NAPI, which is not the expected behavior. Need to roll back the previous rq initialization to avoid leaks in error unwinding of init code.
Also extract helper functions of disable and enable queue pairs. Use newly introduced disable helper function in error unwinding and virtnet_close. Use enable helper function in virtnet_open.
--- drivers/net/virtio_net.c | 61 +++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 17 deletions(-)
drivers/net/virtio_net.c +44 -17
@@ -1604,6 +1604,38 @@ static int virtnet_poll(struct napi_struct *napi, int budget)return received; } +static void virtnet_disable_queue_pair (struct virtnet_info *vi,int qp_index) +{ +virtnet_napi_tx_disable (&vi->sq[qp_index].napi); +napi_disable (&vi->rq[qp_index].napi); +xdp_rxq_info_unreg (&vi->rq[qp_index].xdp_rxq); +} + +static int virtnet_enable_queue_pair (struct virtnet_info *vi,int qp_index) +{ +struct net_device *dev = vi->dev; +int err; + + err =xdp_rxq_info_reg (&vi->rq[qp_index].xdp_rxq, dev, qp_index, + vi->rq[qp_index].napi.napi_id); +if (err <0 ) +return err; + + err =xdp_rxq_info_reg_mem_model (&vi->rq[qp_index].xdp_rxq, +MEM_TYPE_PAGE_SHARED ,NULL ); +if (err <0 ) + goto err_xdp_reg_mem_model; + +virtnet_napi_enable (vi->rq[qp_index].vq, &vi->rq[qp_index].napi); +virtnet_napi_tx_enable (vi, vi->sq[qp_index].vq, &vi->sq[qp_index].napi); + +return 0 ; + +err_xdp_reg_mem_model: +xdp_rxq_info_unreg (&vi->rq[qp_index].xdp_rxq); +return err; +} +static int virtnet_open (struct net_device *dev) {struct virtnet_info *vi =netdev_priv (dev);
@@ -1617,22 +1649,20 @@ static int virtnet_open(struct net_device *dev)if (!try_fill_recv (vi, &vi->rq[i],GFP_KERNEL ))schedule_delayed_work (&vi->refill,0 ); - err =xdp_rxq_info_reg (&vi->rq[i].xdp_rxq, dev, i, vi->rq[i].napi.napi_id); + err =virtnet_enable_queue_pair (vi, i);if (err <0 ) -return err; - - err =xdp_rxq_info_reg_mem_model (&vi->rq[i].xdp_rxq, -MEM_TYPE_PAGE_SHARED ,NULL ); -if (err <0 ) { -xdp_rxq_info_unreg (&vi->rq[i].xdp_rxq); -return err; - } - -virtnet_napi_enable (vi->rq[i].vq, &vi->rq[i].napi); -virtnet_napi_tx_enable (vi, vi->sq[i].vq, &vi->sq[i].napi); + goto err_enable_qp; }return 0 ; + +err_enable_qp: +disable_delayed_refill (vi); +cancel_delayed_work_sync (&vi->refill); + +for (i--; i >=0 ; i--) +virtnet_disable_queue_pair (vi, i); +return err; }static int virtnet_poll_tx (struct napi_struct *napi,int budget)
@@ -1998,11 +2028,8 @@ static int virtnet_close(struct net_device *dev)/* Make sure refill_work doesn't re-enable napi! */ cancel_delayed_work_sync (&vi->refill); -for (i =0 ; i < vi->max_queue_pairs; i++) { -virtnet_napi_tx_disable (&vi->sq[i].napi); -napi_disable (&vi->rq[i].napi); -xdp_rxq_info_unreg (&vi->rq[i].xdp_rxq); - } +for (i =0 ; i < vi->max_queue_pairs; i++) +virtnet_disable_queue_pair (vi, i);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 144/203 tipc: add tipc_bearer_min_mtu to calculate min mtu
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 3ae6d66b605be604644d4bb5708a7ffd9cf1abe8 ]
As different media may requires different min mtu, and even the same media with different net family requires different min mtu, add tipc_bearer_min_mtu() to calculate min mtu accordingly.
This API will be used to check the new mtu when doing the link mtu negotiation in the next patch.
Stable-dep-of: 56077b56cd3f ("tipc: do not update mtu if msg_max is too small in mtu negotiation")
--- net/tipc/bearer.c | 13 +++++++++++++ net/tipc/bearer.h | 3 +++ net/tipc/udp_media.c | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-)
net/tipc/bearer.c +13 -0
@@ -541,6 +541,19 @@ int tipc_bearer_mtu(struct net *net, u32 bearer_id)return mtu; } +int tipc_bearer_min_mtu (struct net *net,u32 bearer_id) +{ +int mtu =TIPC_MIN_BEARER_MTU ; +struct tipc_bearer *b; + +rcu_read_lock (); + b =bearer_get (net, bearer_id); +if (b) + mtu += b->encap_hlen; +rcu_read_unlock (); +return mtu; +} +/* tipc_bearer_xmit_skb - sends buffer to destination over bearer */ void tipc_bearer_xmit_skb(struct net *net, u32 bearer_id,
net/tipc/bearer.h +3 -0
@@ -146,6 +146,7 @@ struct tipc_media {* @identity: array index of this bearer within TIPC bearer array * @disc: ptr to link setup request * @net_plane: network plane ('A' through 'H') currently associated with bearer +* @encap_hlen: encap headers length * @up: bearer up flag (bit 0) * @refcnt: tipc_bearer reference counter *
@@ -170,6 +171,7 @@ struct tipc_bearer {u32 identity;struct tipc_discoverer *disc;char net_plane; +u16 encap_hlen;unsigned long up;refcount_t refcnt; };
@@ -232,6 +234,7 @@ int tipc_bearer_setup(void);void tipc_bearer_cleanup (void );void tipc_bearer_stop (struct net *net);int tipc_bearer_mtu (struct net *net,u32 bearer_id); +int tipc_bearer_min_mtu (struct net *net,u32 bearer_id);bool tipc_bearer_bcast_support (struct net *net,u32 bearer_id); void tipc_bearer_xmit_skb(struct net *net, u32 bearer_id, struct sk_buff *skb,
net/tipc/udp_media.c +3 -2
@@ -738,8 +738,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, udp_conf.local_ip.s_addr = local.ipv4.s_addr; udp_conf.use_udp_checksums = false; ub->ifindex = dev->ifindex; -if (tipc_mtu_bad (dev,sizeof (struct iphdr ) + -sizeof (struct udphdr ))) { + b->encap_hlen =sizeof (struct iphdr ) +sizeof (struct udphdr ); +if (tipc_mtu_bad (dev, b->encap_hlen)) { err = -EINVAL ; goto err; }
@@ -760,6 +760,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, else udp_conf.local_ip6 = local.ipv6; ub->ifindex = dev->ifindex; + b->encap_hlen =sizeof (struct ipv6hdr ) +sizeof (struct udphdr ); b->mtu =1280 ;#endif }else {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 145/203 tipc: do not update mtu if msg_max is too small in mtu negotiation
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 56077b56cd3fb78e1c8619e29581ba25a5c55e86 ]
When doing link mtu negotiation, a malicious peer may send Activate msg with a very small mtu, e.g. 4 in Shuang's testing, without checking for the minimum mtu, l->mtu will be set to 4 in tipc_link_proto_rcv(), then n->links[bearer_id].mtu is set to 4294967228, which is a overflow of '4 - INT_H_SIZE - EMSG_OVERHEAD' in tipc_link_mss().
With tipc_link.mtu = 4, tipc_link_xmit() kept printing the warning:
tipc: Too large msg, purging xmit list 1 5 0 40 4!
tipc: Too large msg, purging xmit list 1 15 0 60 4!
And with tipc_link_entry.mtu 4294967228, a huge skb was allocated in named_distribute(), and when purging it in tipc_link_xmit(), a crash was even caused:
general protection fault, probably for non-canonical address 0x2100001011000dd: 0000 [#1] PREEMPT SMP PTI CPU: 0 PID: 0 Comm: swapper/0 Kdump: loaded Not tainted 6.3.0.neta #19 RIP: 0010:kfree_skb_list_reason+0x7e/0x1f0 Call Trace: <IRQ> skb_release_data+0xf9/0x1d0 kfree_skb_reason+0x40/0x100 tipc_link_xmit+0x57a/0x740 [tipc] tipc_node_xmit+0x16c/0x5c0 [tipc] tipc_named_node_up+0x27f/0x2c0 [tipc] tipc_node_write_unlock+0x149/0x170 [tipc] tipc_rcv+0x608/0x740 [tipc] tipc_udp_recv+0xdc/0x1f0 [tipc] udp_queue_rcv_one_skb+0x33e/0x620 udp_unicast_rcv_skb.isra.72+0x75/0x90 __udp4_lib_rcv+0x56d/0xc20 ip_protocol_deliver_rcu+0x100/0x2d0
This patch fixes it by checking the new mtu against tipc_bearer_min_mtu(), and not updating mtu if it is too small.
--- net/tipc/link.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/tipc/link.c +6 -3
@@ -2199,7 +2199,7 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,struct tipc_msg *hdr =buf_msg (skb);struct tipc_gap_ack_blks *ga =NULL ;bool reply =msg_probe (hdr), retransmitted = false; -u32 dlen =msg_data_sz (hdr), glen =0 ; +u32 dlen =msg_data_sz (hdr), glen =0 , msg_max;u16 peers_snd_nxt =msg_next_sent (hdr);u16 peers_tol =msg_link_tolerance (hdr);u16 peers_prio =msg_linkprio (hdr);
@@ -2238,6 +2238,9 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,switch (mtyp) {case RESET_MSG :case ACTIVATE_MSG : + msg_max =msg_max_pkt (hdr); +if (msg_max <tipc_bearer_min_mtu (l->net, l->bearer_id)) +break ;/* Complete own link name with peer's interface name */ if_name =strrchr (l->name,':' ) +1 ;if (sizeof (l->name) - (if_name - l->name) <=TIPC_MAX_IF_NAME )
@@ -2282,8 +2285,8 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, l->peer_session =msg_session (hdr); l->in_session = true; l->peer_bearer_id =msg_bearer_id (hdr); -if (l->mtu >msg_max_pkt (hdr)) - l->mtu =msg_max_pkt (hdr); +if (l->mtu > msg_max) + l->mtu = msg_max;break ;case STATE_MSG :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 146/203 tipc: check the bearer min mtu properly when setting it by netlink
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 35a089b5d793d2bfd2cc7cfa6104545184de2ce7 ]
Checking the bearer min mtu with tipc_udp_mtu_bad() only works for IPv4 UDP bearer, and IPv6 UDP bearer has a different value for the min mtu. This patch checks with encap_hlen + TIPC_MIN_BEARER_MTU for min mtu, which works for both IPv4 and IPv6 UDP bearer.
Note that tipc_udp_mtu_bad() is still used to check media min mtu in __tipc_nl_media_set(), as m->mtu currently is only used by the IPv4 UDP bearer as its default mtu value.
--- net/tipc/bearer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/tipc/bearer.c +2 -2
@@ -1151,8 +1151,8 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)return -EINVAL ; }#ifdef CONFIG_TIPC_MEDIA_UDP -if (tipc_udp_mtu_bad (nla_get_u32 - (props[TIPC_NLA_PROP_MTU ]))) { +if (nla_get_u32 (props[TIPC_NLA_PROP_MTU ]) < + b->encap_hlen +TIPC_MIN_BEARER_MTU ) {NL_SET_ERR_MSG (info->extack,"MTU value is out-of-range" );return -EINVAL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 120/203 net: phy: dp83867: add w/a for packet errors seen with short cables
In reply to Greg Kroah-HartmanFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 0b01db274028f5acd207332686ffc92ac77491ac ]
Introduce the W/A for packet errors seen with short cables (<1m) between two DP83867 PHYs.
The W/A recommended by DM requires FFE Equalizer Configuration tuning by writing value 0x0E81 to DSP_FFE_CFG register (0x012C), surrounded by hard and soft resets as follows:
write_reg(0x001F, 0x8000); //hard resetwrite_reg(DSP_FFE_CFG, 0x0E81);write_reg(0x001F, 0x4000); //soft reset
Since DP83867 PHY DM says "Changing this register to 0x0E81, will not affect Long Cable performance.", enable the W/A by default.
--- drivers/net/phy/dp83867.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/net/phy/dp83867.c +21 -1
@@ -41,6 +41,7 @@#define DP83867_STRAP_STS1 0x006E#define DP83867_STRAP_STS2 0x006f#define DP83867_RGMIIDCTL 0x0086 +#define DP83867_DSP_FFE_CFG 0x012c#define DP83867_RXFCFG 0x0134#define DP83867_RXFPMD1 0x0136#define DP83867_RXFPMD2 0x0137
@@ -841,8 +842,27 @@ static int dp83867_phy_reset(struct phy_device *phydev)usleep_range (10 ,20 ); -return phy_modify (phydev,MII_DP83867_PHYCTRL , + err =phy_modify (phydev,MII_DP83867_PHYCTRL ,DP83867_PHYCR_FORCE_LINK_GOOD ,0 ); +if (err <0 ) +return err; + +/* Configure the DSP Feedforward Equalizer Configuration register to +* improve short cable (< 1 meter) performance. This will not affect +* long cable performance. +*/ + err =phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_DSP_FFE_CFG , +0x0e81 ); +if (err <0 ) +return err; + + err =phy_write (phydev,DP83867_CTRL ,DP83867_SW_RESTART ); +if (err <0 ) +return err; + +usleep_range (10 ,20 ); + +return 0 ; }static void dp83867_link_change_notify (struct phy_device *phydev)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 121/203 ALSA: firewire-digi00x: prevent potential use after free
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c0e72058d5e21982e61a29de6b098f7c1f0db498 ]
This code was supposed to return an error code if init_stream() failed, but it instead freed dg00x->rx_stream and returned success. This potentially leads to a use after free.
--- sound/firewire/digi00x/digi00x-stream.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/firewire/digi00x/digi00x-stream.c +3 -1
@@ -259,8 +259,10 @@ int snd_dg00x_stream_init_duplex(struct snd_dg00x *dg00x)return err; err =init_stream (dg00x, &dg00x->tx_stream); -if (err <0 ) +if (err <0 ) {destroy_stream (dg00x, &dg00x->rx_stream); +return err; + } err =amdtp_domain_init (&dg00x->domain);if (err <0 ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 122/203 ALSA: hda/realtek: Apply HP B&O top speaker profile to Pavilion 15
In reply to Greg Kroah-HartmanFrom: Ryan C. Underwood <[email protected]>
[ Upstream commit 92553ee03166ef8fa978e7683f9f4af30c9c4e6b ]
The Pavilion 15 line has B&O top speakers similar to the x360 and applying the same profile produces good sound. Without this, the sound would be tinny and underpowered without either applying model=alc295-hp-x360 or booting another OS first.
--- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +1 -1
@@ -9008,7 +9008,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x802f ,"HP Z240" ,ALC221_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x8077 ,"HP" ,ALC256_FIXUP_HP_HEADSET_MIC ),SND_PCI_QUIRK (0x103c ,0x8158 ,"HP" ,ALC256_FIXUP_HP_HEADSET_MIC ), -SND_PCI_QUIRK (0x103c ,0x820d ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ), +SND_PCI_QUIRK (0x103c ,0x820d ,"HP Pavilion 15" ,ALC295_FIXUP_HP_X360 ),SND_PCI_QUIRK (0x103c ,0x8256 ,"HP" ,ALC221_FIXUP_HP_FRONT_MIC ),SND_PCI_QUIRK (0x103c ,0x827e ,"HP x360" ,ALC295_FIXUP_HP_X360 ), SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Signature · 1 line
2.39.2