lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210518055132.9397-1-ayush.sawal@chelsio.com>
Date:   Tue, 18 May 2021 11:21:32 +0530
From:   Ayush Sawal <ayush.sawal@...lsio.com>
To:     netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
        dan.carpenter@...cle.com
Cc:     secdev@...lsio.com, Ayush Sawal <ayush.sawal@...lsio.com>
Subject: [PATCH net] ch_ktls: Remove the checks for u_ctx pointer

The u_ctx pointer in case of ch_ktls will always be valid. As u_ctx is
ch_ktls ctx pointer and remains valid until driver is running.

So removing the u_ctx checks.

Fixes: 65e302a9bd57 ("cxgb4/ch_ktls: Clear resources when pf4 device is removed")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Ayush Sawal <ayush.sawal@...lsio.com>
---
 .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 20 +++++++++----------
 1 file changed, 9 insertions(+), 11 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 59683f79959c..82f847cecf90 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
@@ -371,7 +371,7 @@ static void chcr_ktls_dev_del(struct net_device *netdev,
 		return;
 
 	u_ctx = tx_info->adap->uld[CXGB4_ULD_KTLS].handle;
-	if (u_ctx && u_ctx->detach)
+	if (u_ctx->detach)
 		return;
 	/* clear l2t entry */
 	if (tx_info->l2te)
@@ -443,7 +443,7 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
 	if (tx_ctx->chcr_info)
 		goto out;
 
-	if (u_ctx && u_ctx->detach)
+	if (u_ctx->detach)
 		goto out;
 
 	tx_info = kvzalloc(sizeof(*tx_info), GFP_KERNEL);
@@ -688,15 +688,13 @@ static int chcr_ktls_cpl_act_open_rpl(struct adapter *adap,
 		tls_ctx = tls_get_ctx(tx_info->sk);
 		tx_ctx = chcr_get_ktls_tx_context(tls_ctx);
 		u_ctx = adap->uld[CXGB4_ULD_KTLS].handle;
-		if (u_ctx) {
-			ret = xa_insert_bh(&u_ctx->tid_list, tid, tx_ctx,
-					   GFP_NOWAIT);
-			if (ret < 0) {
-				pr_err("%s: Failed to allocate tid XA entry = %d\n",
-				       __func__, tx_info->tid);
-				tx_info->open_state = CH_KTLS_OPEN_FAILURE;
-				goto out;
-			}
+		ret = xa_insert_bh(&u_ctx->tid_list, tid, tx_ctx,
+				   GFP_NOWAIT);
+		if (ret < 0) {
+			pr_err("%s: Failed to allocate tid XA entry = %d\n",
+			       __func__, tx_info->tid);
+			tx_info->open_state = CH_KTLS_OPEN_FAILURE;
+			goto out;
 		}
 		tx_info->open_state = CH_KTLS_OPEN_SUCCESS;
 	} else {
-- 
2.28.0.rc1.6.gae46588

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ