* [PATCH] net/llc: fix UBSAN array-index-out-of-bounds in llc_conn_state_process
@ 2026-05-15 17:49 Kartik Nair
0 siblings, 0 replies; only message in thread
From: Kartik Nair @ 2026-05-15 17:49 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: horms, netdev, linux-kernel, syzbot+628f93722c08dc5aabe0,
Kartik Nair
When a timer fires while the socket is owned by a user, the timer event
is deferred to the backlog via __sk_add_backlog(). By the time the
backlog drains, llc->state may have been set to LLC_CONN_OUT_OF_SVC (0)
by socket teardown. llc_conn_state_process() then calls llc_conn_service()
which computes llc_offset_table[state - 1] = llc_offset_table[-1],
triggering UBSAN array-index-out-of-bounds.
llc_process_tmr_ev() already guards against LLC_CONN_OUT_OF_SVC for the
direct path, but this guard is bypassed when sock_owned_by_user() is true
and the event is queued to the backlog. By the time the backlog drains,
teardown may have set state to 0.
The direct path already handles this case, so the same check belongs
in the consumer too.
Reported-by: syzbot+628f93722c08dc5aabe0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=628f93722c08dc5aabe0
Signed-off-by: Kartik Nair <contact.kartikn@gmail.com>
---
net/llc/llc_conn.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 1bd6c5f56c52..1fe666b7ec1f 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -65,6 +65,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
struct llc_sock *llc = llc_sk(skb->sk);
struct llc_conn_state_ev *ev = llc_conn_ev(skb);
+ if (unlikely(llc->state == LLC_CONN_OUT_OF_SVC)) {
+ kfree_skb(skb);
+ return -ENOTCONN;
+ }
+
ev->ind_prim = ev->cfm_prim = 0;
/*
* Send event to state machine
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-15 17:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15 17:49 [PATCH] net/llc: fix UBSAN array-index-out-of-bounds in llc_conn_state_process Kartik Nair
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox