lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1322511796-6908-2-git-send-email-igorm@etf.rs>
Date:	Mon, 28 Nov 2011 21:23:16 +0100
From:	igorm@....rs
To:	netdev@...r.kernel.org
Cc:	eric.dumazet@...il.com, Igor Maravic <igorm@....rs>
Subject: [PATCH 1/1] netstamp_needed shouldn't be jump_label_key

From: Igor Maravic <igorm@....rs>

Problem with setting netstamp_needed as jump_label_key is that
it inc/dec, functions net_enable_timestamp/net_disable_timestamp,
are called from interrupts.

That can cause DEADLOCK, because jump_label_{inc, dec} are using mutex locking,
that may sleep.

Signed-off-by: Igor Maravic <igorm@....rs>

:100644 100644 d1f1071... 4d88cac... M	net/core/dev.c

diff --git a/net/core/dev.c b/net/core/dev.c
index d1f1071..4d88cac 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1442,29 +1442,29 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
 }
 EXPORT_SYMBOL(call_netdevice_notifiers);
 
-static struct jump_label_key netstamp_needed __read_mostly;
+static atomic_t netstamp_needed = ATOMIC_INIT(0);
 
 void net_enable_timestamp(void)
 {
-	jump_label_inc(&netstamp_needed);
+	atomic_inc(&netstamp_needed);
 }
 EXPORT_SYMBOL(net_enable_timestamp);
 
 void net_disable_timestamp(void)
 {
-	jump_label_dec(&netstamp_needed);
+	atomic_dec(&netstamp_needed);
 }
 EXPORT_SYMBOL(net_disable_timestamp);
 
 static inline void net_timestamp_set(struct sk_buff *skb)
 {
 	skb->tstamp.tv64 = 0;
-	if (static_branch(&netstamp_needed))
+	if (atomic_read(&netstamp_needed))
 		__net_timestamp(skb);
 }
 
 #define net_timestamp_check(COND, SKB)			\
-	if (static_branch(&netstamp_needed)) {		\
+	if (atomic_read(&netstamp_needed)) {		\
 		if ((COND) && !(SKB)->tstamp.tv64)	\
 			__net_timestamp(SKB);		\
 	}						\
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ