netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: "YOSHIFUJI Hideaki / _$B5HF#1QL@" <yoshfuji@linux-ipv6.org>
Cc: sasa@balabit.hu, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org
Subject: Re: Problem with __check_and_rekey
Date: Tue, 12 Aug 2003 06:53:46 -0700	[thread overview]
Message-ID: <20030812065347.331e9066.davem@redhat.com> (raw)
In-Reply-To: <20030812.225527.35784879.yoshfuji@linux-ipv6.org>

On Tue, 12 Aug 2003 22:55:27 +0900 (JST)
YOSHIFUJI Hideaki / _$B5HF#1QL@ <yoshfuji@linux-ipv6.org> wrote:

> > +               local_bh_disable();
> >                 tp->write_seq = secure_tcp_sequence_number(sk->saddr, sk->daddr,
> >                                                            sk->sport, usin->sin_port);
> > +               local_bh_enable();
> 
> You must forgot braces.
> But anyway, I can't find these lines in linux-2.4.21 (or even in 2.6.x).
> Are you sure you're working on the vanilla kernel?

It doesn't matter, a proper fix was put into drivers/char/random.c
already.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1019.3.9 -> 1.1019.3.10
#	drivers/char/random.c	1.17    -> 1.18   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/28	olof@austin.ibm.com	1.1019.3.10
# [RANDOM]: Fix SMP deadlock in __check_and_rekey().
# --------------------------------------------
#
diff -Nru a/drivers/char/random.c b/drivers/char/random.c
--- a/drivers/char/random.c	Tue Aug 12 06:56:52 2003
+++ b/drivers/char/random.c	Tue Aug 12 06:56:52 2003
@@ -251,6 +251,8 @@
 #include <linux/random.h>
 #include <linux/poll.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
 
 #include <asm/processor.h>
 #include <asm/uaccess.h>
@@ -2069,7 +2071,7 @@
 static struct keydata *__check_and_rekey(time_t time)
 {
 	struct keydata *keyptr;
-	spin_lock(&ip_lock);
+	spin_lock_bh(&ip_lock);
 	keyptr = &ip_keydata[ip_cnt&1];
 	if (!keyptr->rekey_time || (time - keyptr->rekey_time) > REKEY_INTERVAL) {
 		keyptr = &ip_keydata[1^(ip_cnt&1)];
@@ -2079,7 +2081,7 @@
 		mb();
 		ip_cnt++;
 	}
-	spin_unlock(&ip_lock);
+	spin_unlock_bh(&ip_lock);
 	return keyptr;
 }
 

  reply	other threads:[~2003-08-12 13:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-12 13:20 Problem with __check_and_rekey SZALAY Attila
2003-08-12 13:55 ` YOSHIFUJI Hideaki / 吉藤英明
2003-08-12 13:53   ` David S. Miller [this message]
2003-08-12 14:09     ` YOSHIFUJI Hideaki / 吉藤英明
2003-08-12 14:05   ` SZALAY Attila
2003-08-12 14:03     ` 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=20030812065347.331e9066.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    --cc=sasa@balabit.hu \
    --cc=yoshfuji@linux-ipv6.org \
    /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).