Commit 659bf038 authored by Rohit Maheshwari's avatar Rohit Maheshwari Committed by Jakub Kicinski

ch_ktls: don't free skb before sending FIN

If its a last packet and fin is set. Make sure FIN is informed
to HW before skb gets freed.

Fixes: 429765a1 ("chcr: handle partial end part of a record")
Signed-off-by: default avatarRohit Maheshwari <rohitm@chelsio.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9478e083
...@@ -1932,6 +1932,9 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1932,6 +1932,9 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
flags); flags);
goto out; goto out;
} }
if (th->fin)
skb_get(skb);
} }
if (unlikely(tls_record_is_start_marker(record))) { if (unlikely(tls_record_is_start_marker(record))) {
...@@ -2006,8 +2009,11 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2006,8 +2009,11 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
__skb_frag_unref(&record->frags[i]); __skb_frag_unref(&record->frags[i]);
} }
/* if any failure, come out from the loop. */ /* if any failure, come out from the loop. */
if (ret) if (ret) {
if (th->fin)
dev_kfree_skb_any(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
}
/* length should never be less than 0 */ /* length should never be less than 0 */
WARN_ON(data_len < 0); WARN_ON(data_len < 0);
...@@ -2020,8 +2026,10 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2020,8 +2026,10 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
/* tcp finish is set, send a separate tcp msg including all the options /* tcp finish is set, send a separate tcp msg including all the options
* as well. * as well.
*/ */
if (th->fin) if (th->fin) {
chcr_ktls_write_tcp_options(tx_info, skb, q, tx_info->tx_chan); chcr_ktls_write_tcp_options(tx_info, skb, q, tx_info->tx_chan);
dev_kfree_skb_any(skb);
}
return NETDEV_TX_OK; return NETDEV_TX_OK;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment