espintcp: fix skb leaks
A few error paths are missing a kfree_skb.
Fixes: e27cca96cd
("xfrm: add espintcp (RFC 8229)")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
cfe82469a0
commit
63c1f19a3b
|
@ -199,8 +199,10 @@ static int esp_output_tcp_finish(struct xfrm_state *x, struct sk_buff *skb)
|
|||
|
||||
sk = esp_find_tcp_sk(x);
|
||||
err = PTR_ERR_OR_ZERO(sk);
|
||||
if (err)
|
||||
if (err) {
|
||||
kfree_skb(skb);
|
||||
goto out;
|
||||
}
|
||||
|
||||
bh_lock_sock(sk);
|
||||
if (sock_owned_by_user(sk))
|
||||
|
|
|
@ -216,8 +216,10 @@ static int esp_output_tcp_finish(struct xfrm_state *x, struct sk_buff *skb)
|
|||
|
||||
sk = esp6_find_tcp_sk(x);
|
||||
err = PTR_ERR_OR_ZERO(sk);
|
||||
if (err)
|
||||
if (err) {
|
||||
kfree_skb(skb);
|
||||
goto out;
|
||||
}
|
||||
|
||||
bh_lock_sock(sk);
|
||||
if (sock_owned_by_user(sk))
|
||||
|
|
|
@ -171,8 +171,10 @@ int espintcp_queue_out(struct sock *sk, struct sk_buff *skb)
|
|||
struct espintcp_ctx *ctx = espintcp_getctx(sk);
|
||||
|
||||
if (skb_queue_len(&ctx->out_queue) >=
|
||||
READ_ONCE(net_hotdata.max_backlog))
|
||||
READ_ONCE(net_hotdata.max_backlog)) {
|
||||
kfree_skb(skb);
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
__skb_queue_tail(&ctx->out_queue, skb);
|
||||
|
||||
|
|
Loading…
Reference in New Issue