Skip to content

Commit 6a13f5a

Browse files
Florian Westphalklassert
authored andcommitted
xfrm: policy: fix null dereference
Julian Wiedmann says: > + if (!xfrm_pol_hold_rcu(ret)) Coverity spotted that ^^^ needs a s/ret/pol fix-up: > CID 1599386: Null pointer dereferences (FORWARD_NULL) > Passing null pointer "ret" to "xfrm_pol_hold_rcu", which dereferences it. Ditch the bogus 'ret' variable. Fixes: 563d5ca ("xfrm: switch migrate to xfrm_policy_lookup_bytype") Reported-by: Julian Wiedmann <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/ Signed-off-by: Florian Westphal <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 69716a3 commit 6a13f5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/xfrm/xfrm_policy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4429,7 +4429,7 @@ EXPORT_SYMBOL_GPL(xfrm_audit_policy_delete);
44294429
static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *sel,
44304430
u8 dir, u8 type, struct net *net, u32 if_id)
44314431
{
4432-
struct xfrm_policy *pol, *ret = NULL;
4432+
struct xfrm_policy *pol;
44334433
struct flowi fl;
44344434

44354435
memset(&fl, 0, sizeof(fl));
@@ -4465,7 +4465,7 @@ static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *
44654465
if (IS_ERR_OR_NULL(pol))
44664466
goto out_unlock;
44674467

4468-
if (!xfrm_pol_hold_rcu(ret))
4468+
if (!xfrm_pol_hold_rcu(pol))
44694469
pol = NULL;
44704470
out_unlock:
44714471
rcu_read_unlock();

0 commit comments

Comments
 (0)