* [net] ch_ktls: lock is not freed
@ 2020-11-18 8:21 Rohit Maheshwari
2020-11-20 18:36 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Rohit Maheshwari @ 2020-11-18 8:21 UTC (permalink / raw)
To: kuba, netdev, davem; +Cc: secdev, Rohit Maheshwari
Currently lock gets freed only if timeout expires, but missed a
case when HW returns failure and goes for cleanup.
Fixes: efca3878a5fb ("ch_ktls: Issue if connection offload fails")
Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
---
.../net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
index c24485c0d512..1f521751666d 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
@@ -594,9 +594,10 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
free_l2t:
cxgb4_l2t_release(tx_info->l2te);
free_tx_info:
- if (tx_info->pending_close)
+ if (tx_info->open_state)
spin_unlock_bh(&tx_info->lock);
- else
+
+ if (!tx_info->pending_close)
kvfree(tx_info);
out:
atomic64_inc(&port_stats->ktls_tx_connection_fail);
--
2.18.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net] ch_ktls: lock is not freed
2020-11-18 8:21 [net] ch_ktls: lock is not freed Rohit Maheshwari
@ 2020-11-20 18:36 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-11-20 18:36 UTC (permalink / raw)
To: Rohit Maheshwari; +Cc: netdev, davem, secdev
On Wed, 18 Nov 2020 13:51:07 +0530 Rohit Maheshwari wrote:
> Currently lock gets freed only if timeout expires, but missed a
> case when HW returns failure and goes for cleanup.
>
> Fixes: efca3878a5fb ("ch_ktls: Issue if connection offload fails")
> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
> ---
> .../net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
> index c24485c0d512..1f521751666d 100644
> --- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
> +++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
> @@ -594,9 +594,10 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
> free_l2t:
> cxgb4_l2t_release(tx_info->l2te);
> free_tx_info:
> - if (tx_info->pending_close)
> + if (tx_info->open_state)
> spin_unlock_bh(&tx_info->lock);
> - else
> +
> + if (!tx_info->pending_close)
> kvfree(tx_info);
> out:
> atomic64_inc(&port_stats->ktls_tx_connection_fail);
Are you 100% sure about this fix? The code seems to be jumping to the
error handler with or without this lock held. E.g. on line 558.
Please release the lock before jumping, in the two places that hold it.
It's far less complicated and actually fewer LoC.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-20 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 8:21 [net] ch_ktls: lock is not freed Rohit Maheshwari
2020-11-20 18:36 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).