Skip to content

Commit 63c1f19

Browse files
qsnklassert
authored andcommitted
espintcp: fix skb leaks
A few error paths are missing a kfree_skb. Fixes: e27cca9 ("xfrm: add espintcp (RFC 8229)") Signed-off-by: Sabrina Dubroca <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent cfe8246 commit 63c1f19

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

net/ipv4/esp4.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,10 @@ static int esp_output_tcp_finish(struct xfrm_state *x, struct sk_buff *skb)
199199

200200
sk = esp_find_tcp_sk(x);
201201
err = PTR_ERR_OR_ZERO(sk);
202-
if (err)
202+
if (err) {
203+
kfree_skb(skb);
203204
goto out;
205+
}
204206

205207
bh_lock_sock(sk);
206208
if (sock_owned_by_user(sk))

net/ipv6/esp6.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ static int esp_output_tcp_finish(struct xfrm_state *x, struct sk_buff *skb)
216216

217217
sk = esp6_find_tcp_sk(x);
218218
err = PTR_ERR_OR_ZERO(sk);
219-
if (err)
219+
if (err) {
220+
kfree_skb(skb);
220221
goto out;
222+
}
221223

222224
bh_lock_sock(sk);
223225
if (sock_owned_by_user(sk))

net/xfrm/espintcp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ int espintcp_queue_out(struct sock *sk, struct sk_buff *skb)
171171
struct espintcp_ctx *ctx = espintcp_getctx(sk);
172172

173173
if (skb_queue_len(&ctx->out_queue) >=
174-
READ_ONCE(net_hotdata.max_backlog))
174+
READ_ONCE(net_hotdata.max_backlog)) {
175+
kfree_skb(skb);
175176
return -ENOBUFS;
177+
}
176178

177179
__skb_queue_tail(&ctx->out_queue, skb);
178180

0 commit comments

Comments
 (0)