From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-zigbee-devel@lists.sourceforge.net,
Sergey Lapin <slapin@ossfans.org>,
netdev@vger.kernel.org
Subject: [PATCH 2/7] ieee802154: add locking for seq numbers
Date: Wed, 16 Sep 2009 02:13:00 +0400 [thread overview]
Message-ID: <1253052785-26190-3-git-send-email-dbaryshkov@gmail.com> (raw)
In-Reply-To: <1253052785-26190-2-git-send-email-dbaryshkov@gmail.com>
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
net/ieee802154/netlink.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index 2106ecb..ca767bd 100644
--- a/net/ieee802154/netlink.c
+++ b/net/ieee802154/netlink.c
@@ -35,6 +35,7 @@
#include <net/ieee802154_netdev.h>
static unsigned int ieee802154_seq_num;
+static DEFINE_SPINLOCK(ieee802154_seq_lock);
static struct genl_family ieee802154_coordinator_family = {
.id = GENL_ID_GENERATE,
@@ -57,12 +58,15 @@ static struct sk_buff *ieee802154_nl_create(int flags, u8 req)
{
void *hdr;
struct sk_buff *msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
+ unsigned long f;
if (!msg)
return NULL;
+ spin_lock_irqsave(&ieee802154_seq_lock, f);
hdr = genlmsg_put(msg, 0, ieee802154_seq_num++,
&ieee802154_coordinator_family, flags, req);
+ spin_unlock_irqrestore(&ieee802154_seq_lock, f);
if (!hdr) {
nlmsg_free(msg);
return NULL;
--
1.6.3.3
next prev parent reply other threads:[~2009-09-15 22:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-15 22:12 [GIT PULL 0/7] Small IEEE 802.15.4 updates Dmitry Eremin-Solenikov
2009-09-15 22:12 ` [PATCH 1/7] af_ieee802154: setsockopt optlen arg isn't __user Dmitry Eremin-Solenikov
2009-09-15 22:13 ` Dmitry Eremin-Solenikov [this message]
2009-09-15 22:13 ` [PATCH 3/7] ieee802154: add a helper to put the wpan_phy device Dmitry Eremin-Solenikov
2009-09-15 22:13 ` [PATCH 4/7] ieee802154: add wpan-phy iteration functions Dmitry Eremin-Solenikov
2009-09-15 22:13 ` [PATCH 5/7] ieee802154: merge nl802154 and wpan-class in single module Dmitry Eremin-Solenikov
2009-09-15 22:13 ` [PATCH 6/7] nl802154: split away MAC commands implementation Dmitry Eremin-Solenikov
2009-09-15 22:13 ` [PATCH 7/7] ieee802154: add LIST_PHY command support Dmitry Eremin-Solenikov
2009-09-16 6:44 ` [GIT PULL 0/7] Small IEEE 802.15.4 updates David 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=1253052785-26190-3-git-send-email-dbaryshkov@gmail.com \
--to=dbaryshkov@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-zigbee-devel@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=slapin@ossfans.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).