diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2014-02-19 07:33:24 -0500 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2014-02-20 08:30:04 -0500 |
commit | 8c0cba22e196122d26c92980943474eb53db8deb (patch) | |
tree | 2a2488f1e88bc9b15d1ead0d884aa20b8afd4697 | |
parent | 35ea790d7883dd660208f78eae50ebfd6b8bd14a (diff) |
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>
-rw-r--r-- | net/xfrm/xfrm_state.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 97d117b80ba4..c101023be3d2 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1215,11 +1215,12 @@ out: | |||
1215 | return NULL; | 1215 | return NULL; |
1216 | } | 1216 | } |
1217 | 1217 | ||
1218 | /* net->xfrm.xfrm_state_lock is held */ | ||
1219 | struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net) | 1218 | struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net) |
1220 | { | 1219 | { |
1221 | unsigned int h; | 1220 | unsigned int h; |
1222 | struct xfrm_state *x; | 1221 | struct xfrm_state *x = NULL; |
1222 | |||
1223 | spin_lock_bh(&net->xfrm.xfrm_state_lock); | ||
1223 | 1224 | ||
1224 | if (m->reqid) { | 1225 | if (m->reqid) { |
1225 | h = xfrm_dst_hash(net, &m->old_daddr, &m->old_saddr, | 1226 | 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 | |||
1236 | m->old_family)) | 1237 | m->old_family)) |
1237 | continue; | 1238 | continue; |
1238 | xfrm_state_hold(x); | 1239 | xfrm_state_hold(x); |
1239 | return x; | 1240 | break; |
1240 | } | 1241 | } |
1241 | } else { | 1242 | } else { |
1242 | h = xfrm_src_hash(net, &m->old_daddr, &m->old_saddr, | 1243 | 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 | |||
1251 | m->old_family)) | 1252 | m->old_family)) |
1252 | continue; | 1253 | continue; |
1253 | xfrm_state_hold(x); | 1254 | xfrm_state_hold(x); |
1254 | return x; | 1255 | break; |
1255 | } | 1256 | } |
1256 | } | 1257 | } |
1257 | 1258 | ||
1258 | return NULL; | 1259 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); |
1260 | |||
1261 | return x; | ||
1259 | } | 1262 | } |
1260 | EXPORT_SYMBOL(xfrm_migrate_state_find); | 1263 | EXPORT_SYMBOL(xfrm_migrate_state_find); |
1261 | 1264 | ||