Skip to content

Commit 252aa9d

Browse files
committed
Revert "NET: Fix locking issues in PPP, 6pack, mkiss and strip line disciplines."
This reverts commit adeab1a. As Alan Cox explained, the TTY layer changes that went recently to get rid of the tty->low_latency stuff fixes this already, and even for -stable it's the ->low_latency changes that should go in to fix this, rather than this patch. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8660c12 commit 252aa9d

File tree

5 files changed

+44
-68
lines changed

5 files changed

+44
-68
lines changed

drivers/net/hamradio/6pack.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,13 @@ static DEFINE_RWLOCK(disc_data_lock);
398398

399399
static struct sixpack *sp_get(struct tty_struct *tty)
400400
{
401-
unsigned long flags;
402401
struct sixpack *sp;
403402

404-
read_lock_irqsave(&disc_data_lock, flags);
403+
read_lock(&disc_data_lock);
405404
sp = tty->disc_data;
406405
if (sp)
407406
atomic_inc(&sp->refcnt);
408-
read_unlock_irqrestore(&disc_data_lock, flags);
407+
read_unlock(&disc_data_lock);
409408

410409
return sp;
411410
}
@@ -689,13 +688,12 @@ static int sixpack_open(struct tty_struct *tty)
689688
*/
690689
static void sixpack_close(struct tty_struct *tty)
691690
{
692-
unsigned long flags;
693691
struct sixpack *sp;
694692

695-
write_lock_irqsave(&disc_data_lock, flags);
693+
write_lock(&disc_data_lock);
696694
sp = tty->disc_data;
697695
tty->disc_data = NULL;
698-
write_unlock_irqrestore(&disc_data_lock, flags);
696+
write_unlock(&disc_data_lock);
699697
if (!sp)
700698
return;
701699

drivers/net/hamradio/mkiss.c

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,15 @@ static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc,
244244
/* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
245245
static void ax_bump(struct mkiss *ax)
246246
{
247-
unsigned long flags;
248247
struct sk_buff *skb;
249248
int count;
250249

251-
spin_lock_irqsave(&ax->buflock, flags);
250+
spin_lock_bh(&ax->buflock);
252251
if (ax->rbuff[0] > 0x0f) {
253252
if (ax->rbuff[0] & 0x80) {
254253
if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
255254
ax->dev->stats.rx_errors++;
256-
spin_unlock_irqrestore(&ax->buflock, flags);
255+
spin_unlock_bh(&ax->buflock);
257256

258257
return;
259258
}
@@ -268,7 +267,7 @@ static void ax_bump(struct mkiss *ax)
268267
} else if (ax->rbuff[0] & 0x20) {
269268
if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
270269
ax->dev->stats.rx_errors++;
271-
spin_unlock_irqrestore(&ax->buflock, flags);
270+
spin_unlock_bh(&ax->buflock);
272271
return;
273272
}
274273
if (ax->crcmode != CRC_MODE_FLEX && ax->crcauto) {
@@ -295,7 +294,7 @@ static void ax_bump(struct mkiss *ax)
295294
printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
296295
ax->dev->name);
297296
ax->dev->stats.rx_dropped++;
298-
spin_unlock_irqrestore(&ax->buflock, flags);
297+
spin_unlock_bh(&ax->buflock);
299298
return;
300299
}
301300

@@ -304,13 +303,11 @@ static void ax_bump(struct mkiss *ax)
304303
netif_rx(skb);
305304
ax->dev->stats.rx_packets++;
306305
ax->dev->stats.rx_bytes += count;
307-
spin_unlock_irqrestore(&ax->buflock, flags);
306+
spin_unlock_bh(&ax->buflock);
308307
}
309308

310309
static void kiss_unesc(struct mkiss *ax, unsigned char s)
311310
{
312-
unsigned long flags;
313-
314311
switch (s) {
315312
case END:
316313
/* drop keeptest bit = VSV */
@@ -337,18 +334,18 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s)
337334
break;
338335
}
339336

340-
spin_lock_irqsave(&ax->buflock, flags);
337+
spin_lock_bh(&ax->buflock);
341338
if (!test_bit(AXF_ERROR, &ax->flags)) {
342339
if (ax->rcount < ax->buffsize) {
343340
ax->rbuff[ax->rcount++] = s;
344-
spin_unlock_irqrestore(&ax->buflock, flags);
341+
spin_unlock_bh(&ax->buflock);
345342
return;
346343
}
347344

348345
ax->dev->stats.rx_over_errors++;
349346
set_bit(AXF_ERROR, &ax->flags);
350347
}
351-
spin_unlock_irqrestore(&ax->buflock, flags);
348+
spin_unlock_bh(&ax->buflock);
352349
}
353350

354351
static int ax_set_mac_address(struct net_device *dev, void *addr)
@@ -370,7 +367,6 @@ static void ax_changedmtu(struct mkiss *ax)
370367
{
371368
struct net_device *dev = ax->dev;
372369
unsigned char *xbuff, *rbuff, *oxbuff, *orbuff;
373-
unsigned long flags;
374370
int len;
375371

376372
len = dev->mtu * 2;
@@ -396,7 +392,7 @@ static void ax_changedmtu(struct mkiss *ax)
396392
return;
397393
}
398394

399-
spin_lock_irqsave(&ax->buflock, flags);
395+
spin_lock_bh(&ax->buflock);
400396

401397
oxbuff = ax->xbuff;
402398
ax->xbuff = xbuff;
@@ -427,7 +423,7 @@ static void ax_changedmtu(struct mkiss *ax)
427423
ax->mtu = dev->mtu + 73;
428424
ax->buffsize = len;
429425

430-
spin_unlock_irqrestore(&ax->buflock, flags);
426+
spin_unlock_bh(&ax->buflock);
431427

432428
kfree(oxbuff);
433429
kfree(orbuff);
@@ -437,7 +433,6 @@ static void ax_changedmtu(struct mkiss *ax)
437433
static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
438434
{
439435
struct mkiss *ax = netdev_priv(dev);
440-
unsigned long flags;
441436
unsigned char *p;
442437
int actual, count;
443438

@@ -454,7 +449,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
454449

455450
p = icp;
456451

457-
spin_lock_irqsave(&ax->buflock, flags);
452+
spin_lock_bh(&ax->buflock);
458453
if ((*p & 0x0f) != 0) {
459454
/* Configuration Command (kissparms(1).
460455
* Protocol spec says: never append CRC.
@@ -484,7 +479,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
484479
ax->crcauto = (cmd ? 0 : 1);
485480
printk(KERN_INFO "mkiss: %s: crc mode %s %d\n", ax->dev->name, (len) ? "set to" : "is", cmd);
486481
}
487-
spin_unlock_irqrestore(&ax->buflock, flags);
482+
spin_unlock_bh(&ax->buflock);
488483
netif_start_queue(dev);
489484

490485
return;
@@ -517,7 +512,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
517512
count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
518513
}
519514
}
520-
spin_unlock_irqrestore(&ax->buflock, flags);
515+
spin_unlock_bh(&ax->buflock);
521516

522517
set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
523518
actual = ax->tty->ops->write(ax->tty, ax->xbuff, count);
@@ -709,14 +704,13 @@ static DEFINE_RWLOCK(disc_data_lock);
709704

710705
static struct mkiss *mkiss_get(struct tty_struct *tty)
711706
{
712-
unsigned long flags;
713707
struct mkiss *ax;
714708

715-
read_lock_irqsave(&disc_data_lock, flags);
709+
read_lock(&disc_data_lock);
716710
ax = tty->disc_data;
717711
if (ax)
718712
atomic_inc(&ax->refcnt);
719-
read_unlock_irqrestore(&disc_data_lock, flags);
713+
read_unlock(&disc_data_lock);
720714

721715
return ax;
722716
}
@@ -815,13 +809,12 @@ static int mkiss_open(struct tty_struct *tty)
815809

816810
static void mkiss_close(struct tty_struct *tty)
817811
{
818-
unsigned long flags;
819812
struct mkiss *ax;
820813

821-
write_lock_irqsave(&disc_data_lock, flags);
814+
write_lock(&disc_data_lock);
822815
ax = tty->disc_data;
823816
tty->disc_data = NULL;
824-
write_unlock_irqrestore(&disc_data_lock, flags);
817+
write_unlock(&disc_data_lock);
825818

826819
if (!ax)
827820
return;

drivers/net/ppp_async.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,13 @@ static DEFINE_RWLOCK(disc_data_lock);
132132

133133
static struct asyncppp *ap_get(struct tty_struct *tty)
134134
{
135-
unsigned long flags;
136135
struct asyncppp *ap;
137136

138-
read_lock_irqsave(&disc_data_lock, flags);
137+
read_lock(&disc_data_lock);
139138
ap = tty->disc_data;
140139
if (ap != NULL)
141140
atomic_inc(&ap->refcnt);
142-
read_unlock_irqrestore(&disc_data_lock, flags);
143-
141+
read_unlock(&disc_data_lock);
144142
return ap;
145143
}
146144

@@ -217,13 +215,12 @@ ppp_asynctty_open(struct tty_struct *tty)
217215
static void
218216
ppp_asynctty_close(struct tty_struct *tty)
219217
{
220-
unsigned long flags;
221218
struct asyncppp *ap;
222219

223-
write_lock_irqsave(&disc_data_lock, flags);
220+
write_lock_irq(&disc_data_lock);
224221
ap = tty->disc_data;
225222
tty->disc_data = NULL;
226-
write_unlock_irqrestore(&disc_data_lock, flags);
223+
write_unlock_irq(&disc_data_lock);
227224
if (!ap)
228225
return;
229226

drivers/net/ppp_synctty.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,13 @@ static DEFINE_RWLOCK(disc_data_lock);
182182

183183
static struct syncppp *sp_get(struct tty_struct *tty)
184184
{
185-
unsigned long flags;
186185
struct syncppp *ap;
187186

188-
read_lock_irqsave(&disc_data_lock, flags);
187+
read_lock(&disc_data_lock);
189188
ap = tty->disc_data;
190189
if (ap != NULL)
191190
atomic_inc(&ap->refcnt);
192-
read_unlock_irqrestore(&disc_data_lock, flags);
193-
191+
read_unlock(&disc_data_lock);
194192
return ap;
195193
}
196194

@@ -264,13 +262,12 @@ ppp_sync_open(struct tty_struct *tty)
264262
static void
265263
ppp_sync_close(struct tty_struct *tty)
266264
{
267-
unsigned long flags;
268265
struct syncppp *ap;
269266

270-
write_lock_irqsave(&disc_data_lock, flags);
267+
write_lock_irq(&disc_data_lock);
271268
ap = tty->disc_data;
272269
tty->disc_data = NULL;
273-
write_unlock_irqrestore(&disc_data_lock, flags);
270+
write_unlock_irq(&disc_data_lock);
274271
if (!ap)
275272
return;
276273

0 commit comments

Comments
 (0)