All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] Use netdev_priv in NETROM and ROSE
@ 2005-01-30 21:21 Ralf Baechle DL5RB
       [not found] ` <20050131030602Z8225224-1340+2359@linux-mips.org>
  2005-02-15 17:58 ` David S. Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Ralf Baechle DL5RB @ 2005-01-30 21:21 UTC (permalink / raw)
  To: linux-hams; +Cc: netdev

Convert the NETROM and ROSE protocol stacks to use netdev_priv().

 netrom/nr_dev.c |    8 ++++----
 rose/rose_dev.c |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

Index: bk-afu/net/netrom/nr_dev.c
===================================================================
--- bk-afu.orig/net/netrom/nr_dev.c
+++ bk-afu/net/netrom/nr_dev.c
@@ -46,7 +46,7 @@
 
 int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 
 	if (!netif_running(dev)) {
 		stats->rx_errors++;
@@ -73,7 +73,7 @@
 static int nr_rebuild_header(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 	struct sk_buff *skbn;
 	unsigned char *bp = skb->data;
 	int len;
@@ -186,7 +186,7 @@
 
 static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 	dev_kfree_skb(skb);
 	stats->tx_errors++;
 	return 0;
@@ -194,7 +194,7 @@
 
 static struct net_device_stats *nr_get_stats(struct net_device *dev)
 {
-	return (struct net_device_stats *)dev->priv;
+	return netdev_priv(dev);
 }
 
 void nr_setup(struct net_device *dev)
Index: bk-afu/net/rose/rose_dev.c
===================================================================
--- bk-afu.orig/net/rose/rose_dev.c
+++ bk-afu/net/rose/rose_dev.c
@@ -57,7 +57,7 @@
 static int rose_rebuild_header(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 	unsigned char *bp = (unsigned char *)skb->data;
 	struct sk_buff *skbn;
 
@@ -117,7 +117,7 @@
 
 static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 
 	if (!netif_running(dev)) {
 		printk(KERN_ERR "ROSE: rose_xmit - called when iface is down\n");
@@ -130,7 +130,7 @@
 
 static struct net_device_stats *rose_get_stats(struct net_device *dev)
 {
-	return (struct net_device_stats *)dev->priv;
+	return netdev_priv(dev);
 }
 
 void rose_setup(struct net_device *dev)

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

* NETROM locking, was: Re: [PATCH 1/9] Use netdev_priv in NETROM and ROSE
       [not found] ` <20050131030602Z8225224-1340+2359@linux-mips.org>
@ 2005-01-31  4:33   ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2005-01-31  4:33 UTC (permalink / raw)
  To: Kevin; +Cc: linux-hams

On Sun, Jan 30, 2005 at 07:05:49PM -0800, Kevin wrote:

> Message-Id: <20050131030602Z8225224-1340+2359@linux-mips.org>

Your mailer seems to be sending out mails without message ID.  Seems like
time to fix it ;-)

> Will this fix this?
> kernel: net/netrom/nr_in.c:77: spin_lock(net/core/sock.c:ca9f2860) already
> locked by net/netrom/af_netrom.c/176
> kernel: net/netrom/af_netrom.c:914: spin_unlock(net/core/sock.c:ca9f2860)
> not locked

No.  Try below patch from Alan Cox which should solve your issue and a
minor security hole in AF_ROSE.

73 de DL5RB op Ralf

 netrom/nr_in.c    |   11 +----------
 rose/rose_route.c |    3 ++-
 2 files changed, 3 insertions(+), 11 deletions(-)

Index: bk-afu/net/netrom/nr_in.c
===================================================================
--- bk-afu.orig/net/netrom/nr_in.c	2005-01-29 23:05:54.000000000 +0000
+++ bk-afu/net/netrom/nr_in.c	2005-01-31 04:23:37.098462856 +0000
@@ -74,7 +74,6 @@
 static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
 	int frametype)
 {
-	bh_lock_sock(sk);
 	switch (frametype) {
 	case NR_CONNACK: {
 		nr_cb *nr = nr_sk(sk);
@@ -103,8 +102,6 @@
 	default:
 		break;
 	}
-	bh_unlock_sock(sk);
-
 	return 0;
 }
 
@@ -116,7 +113,6 @@
 static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
 	int frametype)
 {
-	bh_lock_sock(sk);
 	switch (frametype) {
 	case NR_CONNACK | NR_CHOKE_FLAG:
 		nr_disconnect(sk, ECONNRESET);
@@ -132,8 +128,6 @@
 	default:
 		break;
 	}
-	bh_unlock_sock(sk);
-
 	return 0;
 }
 
@@ -154,7 +148,6 @@
 	nr = skb->data[18];
 	ns = skb->data[17];
 
-	bh_lock_sock(sk);
 	switch (frametype) {
 	case NR_CONNREQ:
 		nr_write_internal(sk, NR_CONNACK);
@@ -265,12 +258,10 @@
 	default:
 		break;
 	}
-	bh_unlock_sock(sk);
-
 	return queued;
 }
 
-/* Higher level upcall for a LAPB frame */
+/* Higher level upcall for a LAPB frame - called with sk locked */
 int nr_process_rx_frame(struct sock *sk, struct sk_buff *skb)
 {
 	nr_cb *nr = nr_sk(sk);
Index: bk-afu/net/rose/rose_route.c
===================================================================
--- bk-afu.orig/net/rose/rose_route.c	2005-01-29 23:05:54.000000000 +0000
+++ bk-afu/net/rose/rose_route.c	2005-01-31 04:23:37.111460880 +0000
@@ -727,7 +727,8 @@
 		}
 		if (rose_route.mask > 10) /* Mask can't be more than 10 digits */
 			return -EINVAL;
-
+		if(rose_route.ndigis > 8) /* No more than 8 digipeats */
+			return -EINVAL;
 		err = rose_add_node(&rose_route, dev);
 		dev_put(dev);
 		return err;

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

* Re: [PATCH 1/9] Use netdev_priv in NETROM and ROSE
  2005-01-30 21:21 [PATCH 1/9] Use netdev_priv in NETROM and ROSE Ralf Baechle DL5RB
       [not found] ` <20050131030602Z8225224-1340+2359@linux-mips.org>
@ 2005-02-15 17:58 ` David S. Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David S. Miller @ 2005-02-15 17:58 UTC (permalink / raw)
  To: Ralf Baechle DL5RB; +Cc: linux-hams, netdev

On Sun, 30 Jan 2005 21:21:47 +0000
Ralf Baechle DL5RB <ralf@linux-mips.org> wrote:

> Convert the NETROM and ROSE protocol stacks to use netdev_priv().

Applied, thanks Ralf.

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

* [PATCH 1/9] Use netdev_priv in NETROM and ROSE
@ 2005-01-30 21:21 Ralf Baechle DL5RB
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle DL5RB @ 2005-01-30 21:21 UTC (permalink / raw)
  To: linux-hams; +Cc: netdev

Convert the NETROM and ROSE protocol stacks to use netdev_priv().

 netrom/nr_dev.c |    8 ++++----
 rose/rose_dev.c |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

Index: bk-afu/net/netrom/nr_dev.c
===================================================================
--- bk-afu.orig/net/netrom/nr_dev.c
+++ bk-afu/net/netrom/nr_dev.c
@@ -46,7 +46,7 @@
 
 int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 
 	if (!netif_running(dev)) {
 		stats->rx_errors++;
@@ -73,7 +73,7 @@
 static int nr_rebuild_header(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 	struct sk_buff *skbn;
 	unsigned char *bp = skb->data;
 	int len;
@@ -186,7 +186,7 @@
 
 static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 	dev_kfree_skb(skb);
 	stats->tx_errors++;
 	return 0;
@@ -194,7 +194,7 @@
 
 static struct net_device_stats *nr_get_stats(struct net_device *dev)
 {
-	return (struct net_device_stats *)dev->priv;
+	return netdev_priv(dev);
 }
 
 void nr_setup(struct net_device *dev)
Index: bk-afu/net/rose/rose_dev.c
===================================================================
--- bk-afu.orig/net/rose/rose_dev.c
+++ bk-afu/net/rose/rose_dev.c
@@ -57,7 +57,7 @@
 static int rose_rebuild_header(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 	unsigned char *bp = (unsigned char *)skb->data;
 	struct sk_buff *skbn;
 
@@ -117,7 +117,7 @@
 
 static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+	struct net_device_stats *stats = netdev_priv(dev);
 
 	if (!netif_running(dev)) {
 		printk(KERN_ERR "ROSE: rose_xmit - called when iface is down\n");
@@ -130,7 +130,7 @@
 
 static struct net_device_stats *rose_get_stats(struct net_device *dev)
 {
-	return (struct net_device_stats *)dev->priv;
+	return netdev_priv(dev);
 }
 
 void rose_setup(struct net_device *dev)

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

end of thread, other threads:[~2005-02-15 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-30 21:21 [PATCH 1/9] Use netdev_priv in NETROM and ROSE Ralf Baechle DL5RB
     [not found] ` <20050131030602Z8225224-1340+2359@linux-mips.org>
2005-01-31  4:33   ` NETROM locking, was: " Ralf Baechle
2005-02-15 17:58 ` David S. Miller
  -- strict thread matches above, loose matches on Subject: below --
2005-01-30 21:21 Ralf Baechle DL5RB

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.