Skip to content

Commit 8b06a24

Browse files
antonyantonyklassert
authored andcommitted
xfrm: fix possible derferencing in error path
Fix derferencing pointer when xfrm_policy_lookup_bytype returns an error. Fixes: 63b21ca ("xfrm: introduce forwarding of ICMP Error messages") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/kernel-janitors/[email protected]/ Signed-off-by: Antony Antony <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent bccb798 commit 8b06a24

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/xfrm/xfrm_policy.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,6 +3593,8 @@ xfrm_policy *xfrm_in_fwd_icmp(struct sk_buff *skb,
35933593
return pol;
35943594

35953595
pol = xfrm_policy_lookup(net, &fl1, family, XFRM_POLICY_FWD, if_id);
3596+
if (IS_ERR(pol))
3597+
pol = NULL;
35963598
}
35973599

35983600
return pol;

0 commit comments

Comments
 (0)