Skip to content

Commit f3009d0

Browse files
Dan CarpenterPaolo Abeni
authored andcommitted
net: atm: fix use after free in lec_send()
The ->send() operation frees skb so save the length before calling ->send() to avoid a use after free. Fixes: 1da177e4c3f4 ("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>
1 parent 559847f commit f3009d0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/atm/lec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ static void
181181
lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
182182
{
183183
struct net_device *dev = skb->dev;
184+
unsigned int len = skb->len;
184185

185186
ATM_SKB(skb)->vcc = vcc;
186187
atm_account_tx(vcc, skb);
@@ -191,7 +192,7 @@ lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
191192
}
192193

193194
dev->stats.tx_packets++;
194-
dev->stats.tx_bytes += skb->len;
195+
dev->stats.tx_bytes += len;
195196
}
196197

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

0 commit comments

Comments
 (0)