提交 8dff7c29 编写于 作者: I Ingo Molnar 提交者: David S. Miller

[XFRM]: fix softirq-unsafe xfrm typemap->lock use

xfrm typemap->lock may be used in softirq context, so all write_lock()
uses must be softirq-safe.
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a76e07ac
...@@ -57,12 +57,12 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family) ...@@ -57,12 +57,12 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family)
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
typemap = afinfo->type_map; typemap = afinfo->type_map;
write_lock(&typemap->lock); write_lock_bh(&typemap->lock);
if (likely(typemap->map[type->proto] == NULL)) if (likely(typemap->map[type->proto] == NULL))
typemap->map[type->proto] = type; typemap->map[type->proto] = type;
else else
err = -EEXIST; err = -EEXIST;
write_unlock(&typemap->lock); write_unlock_bh(&typemap->lock);
xfrm_policy_put_afinfo(afinfo); xfrm_policy_put_afinfo(afinfo);
return err; return err;
} }
...@@ -78,12 +78,12 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family) ...@@ -78,12 +78,12 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
typemap = afinfo->type_map; typemap = afinfo->type_map;
write_lock(&typemap->lock); write_lock_bh(&typemap->lock);
if (unlikely(typemap->map[type->proto] != type)) if (unlikely(typemap->map[type->proto] != type))
err = -ENOENT; err = -ENOENT;
else else
typemap->map[type->proto] = NULL; typemap->map[type->proto] = NULL;
write_unlock(&typemap->lock); write_unlock_bh(&typemap->lock);
xfrm_policy_put_afinfo(afinfo); xfrm_policy_put_afinfo(afinfo);
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册