netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Jeff Garzik <jeff@garzik.org>, David Miller <davem@davemloft.net>
Cc: Jann Traschewski <jann@gmx.de>,
	Ralf Baechle <ralf@linux-mips.org>,
	netdev@vger.kernel.org
Subject: [PATCH][AX25] mkiss: ax_bump() locking fix
Date: Wed, 13 Feb 2008 11:17:58 +0000	[thread overview]
Message-ID: <20080213111758.GA2867@ff.dom.local> (raw)
In-Reply-To: <20080206074529.GC4496@ff.dom.local>

Hi,

This is unchanged patch previously sent here for testing.
I think it should be applied.

Thanks,
Jarek P.

---------------->

Subject: [PATCH][AX25] mkiss: ax_bump() locking fix

According to one of OOPSes reported by Jann softirq can break
while skb is prepared for netif_rx. The report isn't complete,
so the real reason of the later bug could be different, but
IMHO this locking break in ax_bump is unsafe and unnecessary.

Reported-and-tested-by: Jann Traschewski <jann@gmx.de>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

---

 drivers/net/hamradio/mkiss.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index cfcd15a..30c9b3b 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -289,7 +289,6 @@ static void ax_bump(struct mkiss *ax)
 			*ax->rbuff &= ~0x20;
 		}
  	}
-	spin_unlock_bh(&ax->buflock);
 
 	count = ax->rcount;
 
@@ -297,17 +296,17 @@ static void ax_bump(struct mkiss *ax)
 		printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
 		       ax->dev->name);
 		ax->stats.rx_dropped++;
+		spin_unlock_bh(&ax->buflock);
 		return;
 	}
 
-	spin_lock_bh(&ax->buflock);
 	memcpy(skb_put(skb,count), ax->rbuff, count);
-	spin_unlock_bh(&ax->buflock);
 	skb->protocol = ax25_type_trans(skb, ax->dev);
 	netif_rx(skb);
 	ax->dev->last_rx = jiffies;
 	ax->stats.rx_packets++;
 	ax->stats.rx_bytes += count;
+	spin_unlock_bh(&ax->buflock);
 }
 
 static void kiss_unesc(struct mkiss *ax, unsigned char s)

  parent reply	other threads:[~2008-02-13 11:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <00f201c8694a$2770f630$453c822c@dg8ngn>
     [not found] ` <cd9157050802071100m76a742bbyb18f4448d8ec436b@mail.gmail.com>
2008-02-06  7:45   ` [BUG][AX25] Fwd: SMP with AX.25 Jarek Poplawski
2008-02-06  8:15     ` [PATCH][AX25] " Jarek Poplawski
2008-02-06  9:14       ` [PATCH][AX25] ax25_ds_timer: use mod_timer instead of add_timer Jarek Poplawski
2008-02-10 18:23         ` Jann Traschewski
2008-02-12  5:38         ` David Miller
2008-02-12  5:37       ` [PATCH][AX25] Fwd: SMP with AX.25 David Miller
2008-02-06  9:30     ` [BUG][AX25] " Jarek Poplawski
2008-02-07 12:07     ` Jarek Poplawski
2008-02-07 19:34     ` Jarek Poplawski
2008-02-07 19:35     ` Jarek Poplawski
2008-02-07 20:34       ` Jarek Poplawski
2008-02-13 11:17     ` Jarek Poplawski [this message]
2008-02-15 15:53       ` [PATCH][AX25] mkiss: ax_bump() locking fix Jeff Garzik
2008-02-13 11:56     ` [PATCH][AX25] ax25_out: check skb for NULL in ax25_kick() Jarek Poplawski
2008-02-14  0:49       ` Jann Traschewski
2008-03-09  9:02         ` Pidoux
2008-03-09 14:30           ` Jarek Poplawski
2008-03-09 17:34             ` Jann Traschewski
2008-03-09 18:03               ` Jarek Poplawski
2008-03-24  5:03             ` David Miller
2008-02-18  6:31       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080213111758.GA2867@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jann@gmx.de \
    --cc=jeff@garzik.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).