aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee802154/netlink.c')
-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 @@
35#include <net/ieee802154_netdev.h> 35#include <net/ieee802154_netdev.h>
36 36
37static unsigned int ieee802154_seq_num; 37static unsigned int ieee802154_seq_num;
38static DEFINE_SPINLOCK(ieee802154_seq_lock);
38 39
39static struct genl_family ieee802154_coordinator_family = { 40static struct genl_family ieee802154_coordinator_family = {
40 .id = GENL_ID_GENERATE, 41 .id = GENL_ID_GENERATE,
@@ -57,12 +58,15 @@ static struct sk_buff *ieee802154_nl_create(int flags, u8 req)
57{ 58{
58 void *hdr; 59 void *hdr;
59 struct sk_buff *msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); 60 struct sk_buff *msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
61 unsigned long f;
60 62
61 if (!msg) 63 if (!msg)
62 return NULL; 64 return NULL;
63 65
66 spin_lock_irqsave(&ieee802154_seq_lock, f);
64 hdr = genlmsg_put(msg, 0, ieee802154_seq_num++, 67 hdr = genlmsg_put(msg, 0, ieee802154_seq_num++,
65 &ieee802154_coordinator_family, flags, req); 68 &ieee802154_coordinator_family, flags, req);
69 spin_unlock_irqrestore(&ieee802154_seq_lock, f);
66 if (!hdr) { 70 if (!hdr) {
67 nlmsg_free(msg); 71 nlmsg_free(msg);
68 return NULL; 72 return NULL;