All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: kladit@t-online.de (Klaus Dittrich), greg@kroah.com
Cc: linux mailing-list <linux-kernel@vger.kernel.org>
Subject: [PATCH] kobject hotplug: don't let SEQNUM overwrite other vars (was Re: usb hotplug $DEVICE empty)
Date: Thu, 28 Oct 2004 21:24:15 -0700	[thread overview]
Message-ID: <52pt32ywwg.fsf@topspin.com> (raw)
In-Reply-To: <20041027115943.GA1674@xeon2.local.here> (Klaus Dittrich's message of "Wed, 27 Oct 2004 13:59:43 +0200")

I think this trivial patch should fix this for you.  (Greg, not sure
if you have this already -- it's not in Linus's tree yet in any case)

Prevent SEQNUM from overwriting kset-specific hotplug environment vars.

Signed-off-by: Roland Dreier <roland@topspin.com>

Index: linux-bk/lib/kobject_uevent.c
===================================================================
--- linux-bk.orig/lib/kobject_uevent.c	2004-10-28 21:20:10.000000000 -0700
+++ linux-bk/lib/kobject_uevent.c	2004-10-28 21:21:10.000000000 -0700
@@ -258,6 +258,13 @@
 	envp [i++] = scratch;
 	scratch += sprintf(scratch, "SUBSYSTEM=%s", name) + 1;
 
+	spin_lock(&sequence_lock);
+	seq = ++hotplug_seqnum;
+	spin_unlock(&sequence_lock);
+
+	envp [i++] = scratch;
+	scratch += sprintf(scratch, "SEQNUM=%lld", (long long)seq) + 1;
+
 	if (hotplug_ops->hotplug) {
 		/* have the kset specific function add its stuff */
 		retval = hotplug_ops->hotplug (kset, kobj,
@@ -270,13 +277,6 @@
 		}
 	}
 
-	spin_lock(&sequence_lock);
-	seq = ++hotplug_seqnum;
-	spin_unlock(&sequence_lock);
-
-	envp [i++] = scratch;
-	scratch += sprintf(scratch, "SEQNUM=%lld", (long long)seq) + 1;
-
 	pr_debug ("%s: %s %s seq=%lld %s %s %s %s %s\n",
 		  __FUNCTION__, argv[0], argv[1], (long long)seq,
 		  envp[0], envp[1], envp[2], envp[3], envp[4]);

  reply	other threads:[~2004-10-29  4:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-27 11:59 usb hotplug $DEVICE empty Klaus Dittrich
2004-10-29  4:24 ` Roland Dreier [this message]
2004-10-29  4:38   ` [PATCH] kobject hotplug: don't let SEQNUM overwrite other vars (was Re: usb hotplug $DEVICE empty) Greg KH
2004-10-29 18:44     ` [PATCH] kobject hotplug: don't let SEQNUM overwrite other vars Roland Dreier

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=52pt32ywwg.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=greg@kroah.com \
    --cc=kladit@t-online.de \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.