netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [AX.25] Fix locking of ax25 protocol function list.
@ 2006-07-10 23:09 Ralf Baechle
  2006-07-10 23:21 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ralf Baechle @ 2006-07-10 23:09 UTC (permalink / raw)
  To: David S. Miller, netdev, linux-hams

Delivery of AX.25 frame to the layer 3 protocols happens in softirq context
so locking needs to be bh-proof.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index 77ba07c..07ac020 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -66,10 +66,10 @@ #endif
 	protocol->pid  = pid;
 	protocol->func = func;
 
-	write_lock(&protocol_list_lock);
+	write_lock_bh(&protocol_list_lock);
 	protocol->next = protocol_list;
 	protocol_list  = protocol;
-	write_unlock(&protocol_list_lock);
+	write_unlock_bh(&protocol_list_lock);
 
 	return 1;
 }
@@ -80,16 +80,16 @@ void ax25_protocol_release(unsigned int 
 {
 	struct protocol_struct *s, *protocol;
 
-	write_lock(&protocol_list_lock);
+	write_lock_bh(&protocol_list_lock);
 	protocol = protocol_list;
 	if (protocol == NULL) {
-		write_unlock(&protocol_list_lock);
+		write_unlock_bh(&protocol_list_lock);
 		return;
 	}
 
 	if (protocol->pid == pid) {
 		protocol_list = protocol->next;
-		write_unlock(&protocol_list_lock);
+		write_unlock_bh(&protocol_list_lock);
 		kfree(protocol);
 		return;
 	}
@@ -98,14 +98,14 @@ void ax25_protocol_release(unsigned int 
 		if (protocol->next->pid == pid) {
 			s = protocol->next;
 			protocol->next = protocol->next->next;
-			write_unlock(&protocol_list_lock);
+			write_unlock_bh(&protocol_list_lock);
 			kfree(s);
 			return;
 		}
 
 		protocol = protocol->next;
 	}
-	write_unlock(&protocol_list_lock);
+	write_unlock_bh(&protocol_list_lock);
 }
 
 EXPORT_SYMBOL(ax25_protocol_release);
@@ -266,13 +266,13 @@ int ax25_protocol_is_registered(unsigned
 	struct protocol_struct *protocol;
 	int res = 0;
 
-	read_lock(&protocol_list_lock);
+	read_lock_bh(&protocol_list_lock);
 	for (protocol = protocol_list; protocol != NULL; protocol = protocol->next)
 		if (protocol->pid == pid) {
 			res = 1;
 			break;
 		}
-	read_unlock(&protocol_list_lock);
+	read_unlock_bh(&protocol_list_lock);
 
 	return res;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [AX.25] Fix locking of ax25 protocol function list.
  2006-07-10 23:09 [AX.25] Fix locking of ax25 protocol function list Ralf Baechle
@ 2006-07-10 23:21 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2006-07-10 23:21 UTC (permalink / raw)
  To: ralf; +Cc: netdev, linux-hams

From: Ralf Baechle <ralf@linux-mips.org>
Date: Tue, 11 Jul 2006 00:09:43 +0100

> Delivery of AX.25 frame to the layer 3 protocols happens in softirq context
> so locking needs to be bh-proof.
> 
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

Applied, thanks Ralf.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-10 23:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-10 23:09 [AX.25] Fix locking of ax25 protocol function list Ralf Baechle
2006-07-10 23:21 ` David Miller

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).