aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAntony Antony <antony.antony@secunet.com>2024-04-10 19:27:12 +0200
committerSteffen Klassert <steffen.klassert@secunet.com>2024-04-11 10:23:36 +0200
commit8b06a24bb625728ac709f2c69405eb01025687e1 (patch)
tree80fe3b654fda6a874bdb3e1a957c8556a4589976 /net
parentbccb798e07f8bb8b91212fe8ed1e421685449076 (diff)
downloadlinux-8b06a24bb625728ac709f2c69405eb01025687e1.tar.gz
xfrm: fix possible derferencing in error path
Fix derferencing pointer when xfrm_policy_lookup_bytype returns an error. Fixes: 63b21caba17e ("xfrm: introduce forwarding of ICMP Error messages") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/kernel-janitors/f6ef0d0d-96de-4e01-9dc3-c1b3a6338653@moroto.mountain/ Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_policy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 6affe5cd85d8f1..53d8fabfa68580 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -3593,6 +3593,8 @@ xfrm_policy *xfrm_in_fwd_icmp(struct sk_buff *skb,
return pol;
pol = xfrm_policy_lookup(net, &fl1, family, XFRM_POLICY_FWD, if_id);
+ if (IS_ERR(pol))
+ pol = NULL;
}
return pol;