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:
@@ -1215,11 +1215,12 @@ out:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* net->xfrm.xfrm_state_lock is held */
|
|
||||||
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net)
|
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net)
|
||||||
{
|
{
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
struct xfrm_state *x;
|
struct xfrm_state *x = NULL;
|
||||||
|
|
||||||
|
spin_lock_bh(&net->xfrm.xfrm_state_lock);
|
||||||
|
|
||||||
if (m->reqid) {
|
if (m->reqid) {
|
||||||
h = xfrm_dst_hash(net, &m->old_daddr, &m->old_saddr,
|
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))
|
m->old_family))
|
||||||
continue;
|
continue;
|
||||||
xfrm_state_hold(x);
|
xfrm_state_hold(x);
|
||||||
return x;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
h = xfrm_src_hash(net, &m->old_daddr, &m->old_saddr,
|
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))
|
m->old_family))
|
||||||
continue;
|
continue;
|
||||||
xfrm_state_hold(x);
|
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);
|
EXPORT_SYMBOL(xfrm_migrate_state_find);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user