summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2009-09-10 18:02:30 +0400
committerDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2009-09-15 18:25:16 +0400
commitc4835d81efb1795eb8bbeb40b73d74e5c04b1257 (patch)
tree7d53e4752110d011d750baed1314f01afb374a78 /net
parent066fc51275cef94d1624fd58bb3065d050a6f17e (diff)
downloadlinux-stable-c4835d81efb1795eb8bbeb40b73d74e5c04b1257.tar.gz
linux-stable-c4835d81efb1795eb8bbeb40b73d74e5c04b1257.tar.bz2
linux-stable-c4835d81efb1795eb8bbeb40b73d74e5c04b1257.zip
ieee802154: add locking for seq numbers
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/ieee802154/netlink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index 2106ecbf0308..ca767bde17a4 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;