Skip to content

Commit

Permalink
netpoll: Fix missing TXQ unlock and and OOPS.
Browse files Browse the repository at this point in the history
The VLAN tag handling code in netpoll_send_skb_on_dev() has two problems.

1) It exits without unlocking the TXQ.

2) It then tries to queue a NULL skb to npinfo->txq.

Reported-by: Ahmed Tamrawi <atamrawi@iastate.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jan 3, 2014
1 parent 469bdce commit aca5f58
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,22 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
!vlan_hw_offload_capable(netif_skb_features(skb),
skb->vlan_proto)) {
skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb));
if (unlikely(!skb))
break;
if (unlikely(!skb)) {
/* This is actually a packet drop, but we
* don't want the code at the end of this
* function to try and re-queue a NULL skb.
*/
status = NETDEV_TX_OK;
goto unlock_txq;
}
skb->vlan_tci = 0;
}

status = ops->ndo_start_xmit(skb, dev);
if (status == NETDEV_TX_OK)
txq_trans_update(txq);
}
unlock_txq:
__netif_tx_unlock(txq);

if (status == NETDEV_TX_OK)
Expand Down

0 comments on commit aca5f58

Please sign in to comment.