Skip to content

Commit

Permalink
net: atm: fix use after free in lec_send()
Browse files Browse the repository at this point in the history
The ->send() operation frees skb so save the length before calling
->send() to avoid a use after free.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/c751531d-4af4-42fe-affe-6104b34b791d@stanley.mountain
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Dan Carpenter authored and Paolo Abeni committed Mar 20, 2025
1 parent 559847f commit f3009d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/atm/lec.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ static void
lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
unsigned int len = skb->len;

ATM_SKB(skb)->vcc = vcc;
atm_account_tx(vcc, skb);
Expand All @@ -191,7 +192,7 @@ lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
}

dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
dev->stats.tx_bytes += len;
}

static void lec_tx_timeout(struct net_device *dev, unsigned int txqueue)
Expand Down

0 comments on commit f3009d0

Please sign in to comment.