ax25: join the return paths that free skb

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ilpo Järvinen 2008-12-14 23:17:26 -08:00 коммит произвёл David S. Miller
Родитель ebad5c0984
Коммит 0eae1b98cf
1 изменённых файлов: 15 добавлений и 26 удалений

Просмотреть файл

@ -200,19 +200,15 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
skb_reset_transport_header(skb); skb_reset_transport_header(skb);
if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
kfree_skb(skb); goto free;
return 0;
}
/* /*
* Parse the address header. * Parse the address header.
*/ */
if (ax25_addr_parse(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL) { if (ax25_addr_parse(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL)
kfree_skb(skb); goto free;
return 0;
}
/* /*
* Ours perhaps ? * Ours perhaps ?
@ -239,10 +235,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
ax25_send_to_raw(&dest, skb, skb->data[1]); ax25_send_to_raw(&dest, skb, skb->data[1]);
if (!mine && ax25cmp(&dest, (ax25_address *)dev->broadcast) != 0) { if (!mine && ax25cmp(&dest, (ax25_address *)dev->broadcast) != 0)
kfree_skb(skb); goto free;
return 0;
}
/* Now we are pointing at the pid byte */ /* Now we are pointing at the pid byte */
switch (skb->data[1]) { switch (skb->data[1]) {
@ -301,10 +295,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
* If not, should we DM the incoming frame (except DMs) or * If not, should we DM the incoming frame (except DMs) or
* silently ignore them. For now we stay quiet. * silently ignore them. For now we stay quiet.
*/ */
if (ax25_dev->values[AX25_VALUES_CONMODE] == 0) { if (ax25_dev->values[AX25_VALUES_CONMODE] == 0)
kfree_skb(skb); goto free;
return 0;
}
/* LAPB */ /* LAPB */
@ -339,8 +331,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
if ((*skb->data & ~AX25_PF) != AX25_DM && mine) if ((*skb->data & ~AX25_PF) != AX25_DM && mine)
ax25_return_dm(dev, &src, &dest, &dp); ax25_return_dm(dev, &src, &dest, &dp);
kfree_skb(skb); goto free;
return 0;
} }
/* b) received SABM(E) */ /* b) received SABM(E) */
@ -372,15 +363,12 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
sk->sk_ack_backlog++; sk->sk_ack_backlog++;
bh_unlock_sock(sk); bh_unlock_sock(sk);
} else { } else {
if (!mine) { if (!mine)
kfree_skb(skb); goto free;
return 0;
}
if ((ax25 = ax25_create_cb()) == NULL) { if ((ax25 = ax25_create_cb()) == NULL) {
ax25_return_dm(dev, &src, &dest, &dp); ax25_return_dm(dev, &src, &dest, &dp);
kfree_skb(skb); goto free;
return 0;
} }
ax25_fillin_cb(ax25, ax25_dev); ax25_fillin_cb(ax25, ax25_dev);
@ -436,9 +424,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
if (!sock_flag(sk, SOCK_DEAD)) if (!sock_flag(sk, SOCK_DEAD))
sk->sk_data_ready(sk, skb->len); sk->sk_data_ready(sk, skb->len);
sock_put(sk); sock_put(sk);
} else } else {
free:
kfree_skb(skb); kfree_skb(skb);
}
return 0; return 0;
} }