Skip to content

Commit

Permalink
Revert "NET: Fix locking issues in PPP, 6pack, mkiss and strip line d…
Browse files Browse the repository at this point in the history
…isciplines."

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>
  • Loading branch information
David S. Miller committed Jul 14, 2009
1 parent 8660c12 commit 252aa9d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 68 deletions.
10 changes: 4 additions & 6 deletions drivers/net/hamradio/6pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,13 @@ static DEFINE_RWLOCK(disc_data_lock);

static struct sixpack *sp_get(struct tty_struct *tty)
{
unsigned long flags;
struct sixpack *sp;

read_lock_irqsave(&disc_data_lock, flags);
read_lock(&disc_data_lock);
sp = tty->disc_data;
if (sp)
atomic_inc(&sp->refcnt);
read_unlock_irqrestore(&disc_data_lock, flags);
read_unlock(&disc_data_lock);

return sp;
}
Expand Down Expand Up @@ -689,13 +688,12 @@ static int sixpack_open(struct tty_struct *tty)
*/
static void sixpack_close(struct tty_struct *tty)
{
unsigned long flags;
struct sixpack *sp;

write_lock_irqsave(&disc_data_lock, flags);
write_lock(&disc_data_lock);
sp = tty->disc_data;
tty->disc_data = NULL;
write_unlock_irqrestore(&disc_data_lock, flags);
write_unlock(&disc_data_lock);
if (!sp)
return;

Expand Down
41 changes: 17 additions & 24 deletions drivers/net/hamradio/mkiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,15 @@ static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc,
/* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
static void ax_bump(struct mkiss *ax)
{
unsigned long flags;
struct sk_buff *skb;
int count;

spin_lock_irqsave(&ax->buflock, flags);
spin_lock_bh(&ax->buflock);
if (ax->rbuff[0] > 0x0f) {
if (ax->rbuff[0] & 0x80) {
if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
ax->dev->stats.rx_errors++;
spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);

return;
}
Expand All @@ -268,7 +267,7 @@ static void ax_bump(struct mkiss *ax)
} else if (ax->rbuff[0] & 0x20) {
if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
ax->dev->stats.rx_errors++;
spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);
return;
}
if (ax->crcmode != CRC_MODE_FLEX && ax->crcauto) {
Expand All @@ -295,7 +294,7 @@ static void ax_bump(struct mkiss *ax)
printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
ax->dev->name);
ax->dev->stats.rx_dropped++;
spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);
return;
}

Expand All @@ -304,13 +303,11 @@ static void ax_bump(struct mkiss *ax)
netif_rx(skb);
ax->dev->stats.rx_packets++;
ax->dev->stats.rx_bytes += count;
spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);
}

static void kiss_unesc(struct mkiss *ax, unsigned char s)
{
unsigned long flags;

switch (s) {
case END:
/* drop keeptest bit = VSV */
Expand All @@ -337,18 +334,18 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s)
break;
}

spin_lock_irqsave(&ax->buflock, flags);
spin_lock_bh(&ax->buflock);
if (!test_bit(AXF_ERROR, &ax->flags)) {
if (ax->rcount < ax->buffsize) {
ax->rbuff[ax->rcount++] = s;
spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);
return;
}

ax->dev->stats.rx_over_errors++;
set_bit(AXF_ERROR, &ax->flags);
}
spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);
}

static int ax_set_mac_address(struct net_device *dev, void *addr)
Expand All @@ -370,7 +367,6 @@ static void ax_changedmtu(struct mkiss *ax)
{
struct net_device *dev = ax->dev;
unsigned char *xbuff, *rbuff, *oxbuff, *orbuff;
unsigned long flags;
int len;

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

spin_lock_irqsave(&ax->buflock, flags);
spin_lock_bh(&ax->buflock);

oxbuff = ax->xbuff;
ax->xbuff = xbuff;
Expand Down Expand Up @@ -427,7 +423,7 @@ static void ax_changedmtu(struct mkiss *ax)
ax->mtu = dev->mtu + 73;
ax->buffsize = len;

spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);

kfree(oxbuff);
kfree(orbuff);
Expand All @@ -437,7 +433,6 @@ static void ax_changedmtu(struct mkiss *ax)
static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
{
struct mkiss *ax = netdev_priv(dev);
unsigned long flags;
unsigned char *p;
int actual, count;

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

p = icp;

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

return;
Expand Down Expand Up @@ -517,7 +512,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
}
}
spin_unlock_irqrestore(&ax->buflock, flags);
spin_unlock_bh(&ax->buflock);

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

static struct mkiss *mkiss_get(struct tty_struct *tty)
{
unsigned long flags;
struct mkiss *ax;

read_lock_irqsave(&disc_data_lock, flags);
read_lock(&disc_data_lock);
ax = tty->disc_data;
if (ax)
atomic_inc(&ax->refcnt);
read_unlock_irqrestore(&disc_data_lock, flags);
read_unlock(&disc_data_lock);

return ax;
}
Expand Down Expand Up @@ -815,13 +809,12 @@ static int mkiss_open(struct tty_struct *tty)

static void mkiss_close(struct tty_struct *tty)
{
unsigned long flags;
struct mkiss *ax;

write_lock_irqsave(&disc_data_lock, flags);
write_lock(&disc_data_lock);
ax = tty->disc_data;
tty->disc_data = NULL;
write_unlock_irqrestore(&disc_data_lock, flags);
write_unlock(&disc_data_lock);

if (!ax)
return;
Expand Down
11 changes: 4 additions & 7 deletions drivers/net/ppp_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,13 @@ static DEFINE_RWLOCK(disc_data_lock);

static struct asyncppp *ap_get(struct tty_struct *tty)
{
unsigned long flags;
struct asyncppp *ap;

read_lock_irqsave(&disc_data_lock, flags);
read_lock(&disc_data_lock);
ap = tty->disc_data;
if (ap != NULL)
atomic_inc(&ap->refcnt);
read_unlock_irqrestore(&disc_data_lock, flags);

read_unlock(&disc_data_lock);
return ap;
}

Expand Down Expand Up @@ -217,13 +215,12 @@ ppp_asynctty_open(struct tty_struct *tty)
static void
ppp_asynctty_close(struct tty_struct *tty)
{
unsigned long flags;
struct asyncppp *ap;

write_lock_irqsave(&disc_data_lock, flags);
write_lock_irq(&disc_data_lock);
ap = tty->disc_data;
tty->disc_data = NULL;
write_unlock_irqrestore(&disc_data_lock, flags);
write_unlock_irq(&disc_data_lock);
if (!ap)
return;

Expand Down
11 changes: 4 additions & 7 deletions drivers/net/ppp_synctty.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,13 @@ static DEFINE_RWLOCK(disc_data_lock);

static struct syncppp *sp_get(struct tty_struct *tty)
{
unsigned long flags;
struct syncppp *ap;

read_lock_irqsave(&disc_data_lock, flags);
read_lock(&disc_data_lock);
ap = tty->disc_data;
if (ap != NULL)
atomic_inc(&ap->refcnt);
read_unlock_irqrestore(&disc_data_lock, flags);

read_unlock(&disc_data_lock);
return ap;
}

Expand Down Expand Up @@ -264,13 +262,12 @@ ppp_sync_open(struct tty_struct *tty)
static void
ppp_sync_close(struct tty_struct *tty)
{
unsigned long flags;
struct syncppp *ap;

write_lock_irqsave(&disc_data_lock, flags);
write_lock_irq(&disc_data_lock);
ap = tty->disc_data;
tty->disc_data = NULL;
write_unlock_irqrestore(&disc_data_lock, flags);
write_unlock_irq(&disc_data_lock);
if (!ap)
return;

Expand Down
Loading

0 comments on commit 252aa9d

Please sign in to comment.