netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>, netdev <netdev@oss.sgi.com>
Subject: [IPSEC]: Protect against BHs in xfrm_user_policy()
Date: Sun, 03 Apr 2005 18:13:01 +0200	[thread overview]
Message-ID: <4250160D.2040405@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

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


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 995 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/04/03 17:36:10+02:00 kaber@coreworks.de 
#   [IPSEC]: Protect against BHs in xfrm_user_policy()
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/xfrm/xfrm_state.c
#   2005/04/03 17:36:00+02:00 kaber@coreworks.de +2 -2
#   [IPSEC]: Protect against BHs in xfrm_user_policy()
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
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);

             reply	other threads:[~2005-04-03 16:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-03 16:13 Patrick McHardy [this message]
2005-04-04  1:20 ` [IPSEC]: Protect against BHs in xfrm_user_policy() Herbert Xu
2005-04-04  3:47   ` Patrick McHardy
2005-04-04  4:06     ` Herbert Xu
2005-04-04 11:55   ` Herbert Xu
2005-04-04 17:35     ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4250160D.2040405@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).