aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2008-02-13 06:17:58 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-15 10:51:51 -0500
commit9f30c768c00fd0f0a2ab37ef29d8c8c5a7abdf2e (patch)
tree21bc24feb0f220c372d30469a47ca640fba75368
parenta1a98b72dbd17e53cd92b8e78f404525ebcfd981 (diff)
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> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/hamradio/mkiss.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index cfcd15af501e..30c9b3b0d131 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -289,7 +289,6 @@ static void ax_bump(struct mkiss *ax)
289 *ax->rbuff &= ~0x20; 289 *ax->rbuff &= ~0x20;
290 } 290 }
291 } 291 }
292 spin_unlock_bh(&ax->buflock);
293 292
294 count = ax->rcount; 293 count = ax->rcount;
295 294
@@ -297,17 +296,17 @@ static void ax_bump(struct mkiss *ax)
297 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", 296 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
298 ax->dev->name); 297 ax->dev->name);
299 ax->stats.rx_dropped++; 298 ax->stats.rx_dropped++;
299 spin_unlock_bh(&ax->buflock);
300 return; 300 return;
301 } 301 }
302 302
303 spin_lock_bh(&ax->buflock);
304 memcpy(skb_put(skb,count), ax->rbuff, count); 303 memcpy(skb_put(skb,count), ax->rbuff, count);
305 spin_unlock_bh(&ax->buflock);
306 skb->protocol = ax25_type_trans(skb, ax->dev); 304 skb->protocol = ax25_type_trans(skb, ax->dev);
307 netif_rx(skb); 305 netif_rx(skb);
308 ax->dev->last_rx = jiffies; 306 ax->dev->last_rx = jiffies;
309 ax->stats.rx_packets++; 307 ax->stats.rx_packets++;
310 ax->stats.rx_bytes += count; 308 ax->stats.rx_bytes += count;
309 spin_unlock_bh(&ax->buflock);
311} 310}
312 311
313static void kiss_unesc(struct mkiss *ax, unsigned char s) 312static void kiss_unesc(struct mkiss *ax, unsigned char s)