Skip to content

Commit 8154214

Browse files
committed
net: atm: fix /proc/net/atm/lec handling
jira VULN-71952 cve CVE-2025-38180 commit-author Eric Dumazet <edumazet@google.com> commit d03b79f /proc/net/atm/lec must ensure safety against dev_lec[] changes. It appears it had dev_put() calls without prior dev_hold(), leading to imbalance and UAF. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com> # Minor atm contributor Link: https://patch.msgid.link/20250618140844.1686882-3-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit d03b79f) Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
1 parent 4045acc commit 8154214

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

net/atm/lec.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,6 @@ static void *lec_itf_walk(struct lec_state *state, loff_t *l)
928928
v = (dev && netdev_priv(dev)) ?
929929
lec_priv_walk(state, l, netdev_priv(dev)) : NULL;
930930
if (!v && dev) {
931-
dev_put(dev);
932931
/* Partial state reset for the next time we get called */
933932
dev = NULL;
934933
}
@@ -952,6 +951,7 @@ static void *lec_seq_start(struct seq_file *seq, loff_t *pos)
952951
{
953952
struct lec_state *state = seq->private;
954953

954+
mutex_lock(&lec_mutex);
955955
state->itf = 0;
956956
state->dev = NULL;
957957
state->locked = NULL;
@@ -969,8 +969,9 @@ static void lec_seq_stop(struct seq_file *seq, void *v)
969969
if (state->dev) {
970970
spin_unlock_irqrestore(&state->locked->lec_arp_lock,
971971
state->flags);
972-
dev_put(state->dev);
972+
state->dev = NULL;
973973
}
974+
mutex_unlock(&lec_mutex);
974975
}
975976

976977
static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos)

0 commit comments

Comments
 (0)