From: Dmitry Eremin-Solenikov Date: Thu, 10 Sep 2009 14:02:30 +0000 (+0400) Subject: ieee802154: add locking for seq numbers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c4835d81efb1795eb8bbeb40b73d74e5c04b1257;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ieee802154: add locking for seq numbers Signed-off-by: Dmitry Eremin-Solenikov --- 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 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;