Skip to content

Commit 659bf03

Browse files
rmchelsiokuba-moo
authored andcommitted
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: 429765a ("chcr: handle partial end part of a record") Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9478e08 commit 659bf03

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • drivers/net/ethernet/chelsio/inline_crypto/ch_ktls

drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,9 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
19321932
flags);
19331933
goto out;
19341934
}
1935+
1936+
if (th->fin)
1937+
skb_get(skb);
19351938
}
19361939

19371940
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)
20062009
__skb_frag_unref(&record->frags[i]);
20072010
}
20082011
/* if any failure, come out from the loop. */
2009-
if (ret)
2012+
if (ret) {
2013+
if (th->fin)
2014+
dev_kfree_skb_any(skb);
20102015
return NETDEV_TX_OK;
2016+
}
20112017

20122018
/* length should never be less than 0 */
20132019
WARN_ON(data_len < 0);
@@ -2020,8 +2026,10 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
20202026
/* tcp finish is set, send a separate tcp msg including all the options
20212027
* as well.
20222028
*/
2023-
if (th->fin)
2029+
if (th->fin) {
20242030
chcr_ktls_write_tcp_options(tx_info, skb, q, tx_info->tx_chan);
2031+
dev_kfree_skb_any(skb);
2032+
}
20252033

20262034
return NETDEV_TX_OK;
20272035
out:

0 commit comments

Comments
 (0)