aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/brocade
diff options
context:
space:
mode:
authorRasesh Mody <rmody@brocade.com>2013-12-17 20:07:38 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-18 00:30:34 -0500
commit96e31adf8d73f10bd2b616a17bd8af0d53e9da33 (patch)
tree1465a56068a7fdc123b2be2142e4f67cbe4466d3 /drivers/net/ethernet/brocade
parent17a30a14db09dfe9d3302f8a2d50571b0d94b144 (diff)
bna: Add NULL Check Before Dereferencing TCB
Currently we already check to see whether the BNAD_TXQ_TX_STARTED cleared. But if the tcb structure which contains this flag is also already freed by that time, we would dereference the NULL pointer. This patch is to check tcb for NULL pointer, before dereferencing it. Signed-off-by: Rasesh Mody <rmody@brocade.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/brocade')
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 7d818de66e53..e31937a9177d 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -2958,21 +2958,21 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
2958 } 2958 }
2959 2959
2960 tcb = bnad->tx_info[0].tcb[txq_id]; 2960 tcb = bnad->tx_info[0].tcb[txq_id];
2961 q_depth = tcb->q_depth;
2962 prod = tcb->producer_index;
2963
2964 unmap_q = tcb->unmap_q;
2965 2961
2966 /* 2962 /*
2967 * Takes care of the Tx that is scheduled between clearing the flag 2963 * Takes care of the Tx that is scheduled between clearing the flag
2968 * and the netif_tx_stop_all_queues() call. 2964 * and the netif_tx_stop_all_queues() call.
2969 */ 2965 */
2970 if (unlikely(!test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) { 2966 if (unlikely(!tcb || !test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) {
2971 dev_kfree_skb(skb); 2967 dev_kfree_skb(skb);
2972 BNAD_UPDATE_CTR(bnad, tx_skb_stopping); 2968 BNAD_UPDATE_CTR(bnad, tx_skb_stopping);
2973 return NETDEV_TX_OK; 2969 return NETDEV_TX_OK;
2974 } 2970 }
2975 2971
2972 q_depth = tcb->q_depth;
2973 prod = tcb->producer_index;
2974 unmap_q = tcb->unmap_q;
2975
2976 vectors = 1 + skb_shinfo(skb)->nr_frags; 2976 vectors = 1 + skb_shinfo(skb)->nr_frags;
2977 wis = BNA_TXQ_WI_NEEDED(vectors); /* 4 vectors per work item */ 2977 wis = BNA_TXQ_WI_NEEDED(vectors); /* 4 vectors per work item */
2978 2978