xfrm: Take xfrm_state_lock in xfrm_migrate_state_find
A comment on xfrm_migrate_state_find() says that xfrm_state_lock is held. This is apparently not the case, but we need it to traverse through the state lists. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
35ea790d78
commit
8c0cba22e1
1 changed files with 8 additions and 5 deletions
|
@ -1215,11 +1215,12 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* net->xfrm.xfrm_state_lock is held */
|
||||
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net)
|
||||
{
|
||||
unsigned int h;
|
||||
struct xfrm_state *x;
|
||||
struct xfrm_state *x = NULL;
|
||||
|
||||
spin_lock_bh(&net->xfrm.xfrm_state_lock);
|
||||
|
||||
if (m->reqid) {
|
||||
h = xfrm_dst_hash(net, &m->old_daddr, &m->old_saddr,
|
||||
|
@ -1236,7 +1237,7 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n
|
|||
m->old_family))
|
||||
continue;
|
||||
xfrm_state_hold(x);
|
||||
return x;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
h = xfrm_src_hash(net, &m->old_daddr, &m->old_saddr,
|
||||
|
@ -1251,11 +1252,13 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n
|
|||
m->old_family))
|
||||
continue;
|
||||
xfrm_state_hold(x);
|
||||
return x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
spin_unlock_bh(&net->xfrm.xfrm_state_lock);
|
||||
|
||||
return x;
|
||||
}
|
||||
EXPORT_SYMBOL(xfrm_migrate_state_find);
|
||||
|
||||
|
|
Loading…
Reference in a new issue