Re: [PATCH net] net/sched: cls_flow: pin file with get_file_rcu before reading f_cred

From
Jakub Kicinski <kuba@kernel.org>
Date
2026-11-15 19:08:27
Also in
lkml, stable
Reply to
Tristan Madani, 2026-11-11
On Wed, 11 Nov 2026 15:31:06 +0000 Tristan Madani wrote:
flow_get_skuid() and flow_get_skgid() read sk->sk_socket->file->f_cred
without holding a reference to the file. Since the file slab uses
SLAB_TYPESAFE_BY_RCU, a concurrent close() may free and recycle the file
object, causing stale credential data to be read through f_cred.
Missing annotations. Please also make sure you include the answer to
the questions from the bug discovery bot in the commit message of v2.
Otherwise it will ask you again.

net/sched/cls_flow.c:217:32: warning: incorrect type in argument 1 (different address spaces)
net/sched/cls_flow.c:217:32:    expected struct file [noderef] __rcu **f
net/sched/cls_flow.c:217:32:    got struct file **
net/sched/cls_flow.c:235:32: warning: incorrect type in argument 1 (different address spaces)
net/sched/cls_flow.c:235:32:    expected struct file [noderef] __rcu **f
net/sched/cls_flow.c:235:32:    got struct file **
-- 
pw-bot: cr
Thread (4 messages) 4 messages, 3 authors, last reply 7h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help