diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-03-14 10:53:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-14 13:10:29 -0400 |
commit | efc21d95067f658a20e51e24c4c86d68f23b7f7f (patch) | |
tree | 67836a34b5fd852007bfc3b0315e99ca767bc864 /drivers/net/vmxnet3 | |
parent | 888506a967fe428bd776d2b9f540393963fc5bdd (diff) |
vmxnet3: fix lock imbalance in vmxnet3_tq_xmit()
A recent bug fix rearranged the code in vmxnet3_tq_xmit() in a
way that left the error handling for oversized headers unlock
a lock that had not been taken yet. Gcc warns about the incorrect
use of the 'flags' variable because of that:
drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_tq_xmit.constprop':
include/linux/spinlock.h:246:3: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This changes the error handling path to 'goto' the end of the function
beyond the lock/unlock pair.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: cec05562fb1d ("vmxnet3: avoid calling pskb_may_pull with interrupts disabled")
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vmxnet3')
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_drv.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index fc895d0e85d9..b2348f67b00a 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -1022,14 +1022,16 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | |||
1022 | if (ctx.mss) { | 1022 | if (ctx.mss) { |
1023 | if (unlikely(ctx.eth_ip_hdr_size + ctx.l4_hdr_size > | 1023 | if (unlikely(ctx.eth_ip_hdr_size + ctx.l4_hdr_size > |
1024 | VMXNET3_MAX_TX_BUF_SIZE)) { | 1024 | VMXNET3_MAX_TX_BUF_SIZE)) { |
1025 | goto hdr_too_big; | 1025 | tq->stats.drop_oversized_hdr++; |
1026 | goto drop_pkt; | ||
1026 | } | 1027 | } |
1027 | } else { | 1028 | } else { |
1028 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1029 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1029 | if (unlikely(ctx.eth_ip_hdr_size + | 1030 | if (unlikely(ctx.eth_ip_hdr_size + |
1030 | skb->csum_offset > | 1031 | skb->csum_offset > |
1031 | VMXNET3_MAX_CSUM_OFFSET)) { | 1032 | VMXNET3_MAX_CSUM_OFFSET)) { |
1032 | goto hdr_too_big; | 1033 | tq->stats.drop_oversized_hdr++; |
1034 | goto drop_pkt; | ||
1033 | } | 1035 | } |
1034 | } | 1036 | } |
1035 | } | 1037 | } |
@@ -1123,8 +1125,6 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | |||
1123 | 1125 | ||
1124 | return NETDEV_TX_OK; | 1126 | return NETDEV_TX_OK; |
1125 | 1127 | ||
1126 | hdr_too_big: | ||
1127 | tq->stats.drop_oversized_hdr++; | ||
1128 | unlock_drop_pkt: | 1128 | unlock_drop_pkt: |
1129 | spin_unlock_irqrestore(&tq->tx_lock, flags); | 1129 | spin_unlock_irqrestore(&tq->tx_lock, flags); |
1130 | drop_pkt: | 1130 | drop_pkt: |