Skip to content

Commit

Permalink
xfrm: ipcomp: Call pskb_may_pull in ipcomp_input
Browse files Browse the repository at this point in the history
If a malformed packet is received there may not be enough data
to pull.  This isn't a problem in practice because the caller
has already done xfrm_parse_spi which in effect does the same
thing.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Herbert Xu committed Mar 21, 2025
1 parent 9b00eb9 commit 39a3f23
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/xfrm/xfrm_ipcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
int err = -ENOMEM;
struct ip_comp_hdr *ipch;

if (!pskb_may_pull(skb, sizeof(*ipch)))
return -EINVAL;

if (skb_linearize_cow(skb))
goto out;

Expand Down

0 comments on commit 39a3f23

Please sign in to comment.