Subject: [IPSEC]: Protect against BHs in xfrm_user_policy()

From: Patrick McHardy <[email-masked]>
Date: Sun, 03 Apr 2005 18:13:01 +0200

xfrm_user_policy() is called from ip_setsockopt with enabled
BHs, so it needs to protect against them when grabbing
xfrm_km_lock.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/04/03 17:36:10+02:00 [email-masked] 
#   [IPSEC]: Protect against BHs in xfrm_user_policy()
#   
#   Signed-off-by: Patrick McHardy <[email-masked]>
# 
# net/xfrm/xfrm_state.c
#   2005/04/03 17:36:00+02:00 [email-masked] +2 -2
#   [IPSEC]: Protect against BHs in xfrm_user_policy()
#   
#   Signed-off-by: Patrick McHardy <[email-masked]>
# 
diff -Nru a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
--- a/net/xfrm/xfrm_state.c	2005-04-03 18:04:38 +02:00
+++ b/net/xfrm/xfrm_state.c	2005-04-03 18:04:38 +02:00
@@ -878,14 +878,14 @@
 		goto out;
 
 	err = -EINVAL;
-	read_lock(&xfrm_km_lock);
+	read_lock_bh(&xfrm_km_lock);
 	list_for_each_entry(km, &xfrm_km_list, list) {
 		pol = km->compile_policy(sk->sk_family, optname, data,
 					 optlen, &err);
 		if (err >= 0)
 			break;
 	}
-	read_unlock(&xfrm_km_lock);
+	read_unlock_bh(&xfrm_km_lock);
 
 	if (err >= 0) {
 		xfrm_sk_policy_insert(sk, err, pol);