Re: [PATCH net] net/sched: cls_flow: pin file with get_file_rcu before reading f_cred
From: Jakub Kicinski
Date: Sun Nov 15 2026 - 14:08:32 EST
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