Unverified Commit 62884474 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10679 ibmvnic: Add tx check to prevent skb leak

parents 3168a7c0 226f3b25
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1625,6 +1625,18 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
	    (tx_pool->consumer_index + 1) % tx_pool->num_buffers;

	tx_buff = &tx_pool->tx_buff[index];

	/* Sanity checks on our free map to make sure it points to an index
	 * that is not being occupied by another skb. If skb memory is
	 * not freed then we see congestion control kick in and halt tx.
	 */
	if (unlikely(tx_buff->skb)) {
		dev_warn_ratelimited(dev, "TX free map points to untracked skb (%s %d idx=%d)\n",
				     skb_is_gso(skb) ? "tso_pool" : "tx_pool",
				     queue_num, index);
		dev_kfree_skb_any(tx_buff->skb);
	}

	tx_buff->skb = skb;
	tx_buff->data_dma[0] = data_dma_addr;
	tx_buff->data_len[0] = skb->len;