Commit bc16efd2 authored by Vinay Kumar Yadav's avatar Vinay Kumar Yadav Committed by David S. Miller

ch_ktls: fix device connection close

When sge queue is full and chcr_ktls_xmit_wr_complete()
returns failure, skb is not freed if it is not the last tls record in
this skb, causes refcount never gets freed and tls_dev_del()
never gets called on this connection.

Fixes: 5a4b9fe7 ("cxgb4/chcr: complete record tx handling")
Signed-off-by: default avatarVinay Kumar Yadav <vinay.yadav@chelsio.com>
Signed-off-by: default avatarRohit Maheshwari <rohitm@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1a73e427
...@@ -1735,7 +1735,9 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info, ...@@ -1735,7 +1735,9 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info,
struct sge_eth_txq *q, u32 skb_offset, struct sge_eth_txq *q, u32 skb_offset,
u32 tls_end_offset, bool last_wr) u32 tls_end_offset, bool last_wr)
{ {
bool free_skb_if_tx_fails = false;
struct sk_buff *nskb = NULL; struct sk_buff *nskb = NULL;
/* check if it is a complete record */ /* check if it is a complete record */
if (tls_end_offset == record->len) { if (tls_end_offset == record->len) {
nskb = skb; nskb = skb;
...@@ -1758,6 +1760,8 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info, ...@@ -1758,6 +1760,8 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info,
if (last_wr) if (last_wr)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
else
free_skb_if_tx_fails = true;
last_wr = true; last_wr = true;
...@@ -1769,6 +1773,8 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info, ...@@ -1769,6 +1773,8 @@ static int chcr_end_part_handler(struct chcr_ktls_info *tx_info,
record->num_frags, record->num_frags,
(last_wr && tcp_push_no_fin), (last_wr && tcp_push_no_fin),
mss)) { mss)) {
if (free_skb_if_tx_fails)
dev_kfree_skb_any(skb);
goto out; goto out;
} }
tx_info->prev_seq = record->end_seq; tx_info->prev_seq = record->end_seq;
......
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