Skip to content

Commit

Permalink
[XFRM]: fix softirq-unsafe xfrm typemap->lock use
Browse files Browse the repository at this point in the history
xfrm typemap->lock may be used in softirq context, so all write_lock()
uses must be softirq-safe.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ingo Molnar authored and David S. Miller committed Apr 30, 2006
1 parent a76e07a commit 8dff7c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family)
return -EAFNOSUPPORT;
typemap = afinfo->type_map;

write_lock(&typemap->lock);
write_lock_bh(&typemap->lock);
if (likely(typemap->map[type->proto] == NULL))
typemap->map[type->proto] = type;
else
err = -EEXIST;
write_unlock(&typemap->lock);
write_unlock_bh(&typemap->lock);
xfrm_policy_put_afinfo(afinfo);
return err;
}
Expand All @@ -78,12 +78,12 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
return -EAFNOSUPPORT;
typemap = afinfo->type_map;

write_lock(&typemap->lock);
write_lock_bh(&typemap->lock);
if (unlikely(typemap->map[type->proto] != type))
err = -ENOENT;
else
typemap->map[type->proto] = NULL;
write_unlock(&typemap->lock);
write_unlock_bh(&typemap->lock);
xfrm_policy_put_afinfo(afinfo);
return err;
}
Expand Down

0 comments on commit 8dff7c2

Please sign in to comment.