public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Ayush Sawal <ayush.sawal@chelsio.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: ayush.sawal@asicdesigners.com, kernel-janitors@vger.kernel.org,
	Rohit Maheshwari <rohitm@chelsio.com>
Subject: Re: [bug report] cxgb4/ch_ktls: Clear resources when pf4 device is removed
Date: Mon, 17 May 2021 15:48:49 +0530	[thread overview]
Message-ID: <83fca50a-448b-a0a7-e406-ea458270637f@chelsio.com> (raw)
In-Reply-To: <YJ+lregUoryep/Ix@mwanda>

Hi Dan,

Thanks for pointing this out.
The u_ctx pointer in case of ch_ktls will always be valid.

So this condition if(u_ctx && u_ctx->detach) must be if(u_ctx->detach).
and xa_erase(&u_ctx->tid_list, tx_info->tid) doesnot requires a u_ctx check.

So I will send a fix which replaces if(u_ctx && u_ctx->detach) to 
if(u_ctx->detach)
and removes the checks for u_ctx pointer in ch_ktls driver.

Thanks,
Ayush

On 5/15/2021 4:12 PM, Dan Carpenter wrote:
> Hello Ayush Sawal,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 65e302a9bd57: "cxgb4/ch_ktls: Clear resources when pf4
> device is removed" from May 13, 2021, leads to the following Smatch
> complaint:
>
>      drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:393 chcr_ktls_dev_del()
>      error: we previously assumed 'u_ctx' could be null (see line 374)
>
> drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
>     373		u_ctx = tx_info->adap->uld[CXGB4_ULD_KTLS].handle;
>     374		if (u_ctx && u_ctx->detach)
>                      ^^^^^
> Can u_ctx be NULL?
>
>     375			return;
>     376		/* clear l2t entry */
>     377		if (tx_info->l2te)
>     378			cxgb4_l2t_release(tx_info->l2te);
>     379	
>     380	#if IS_ENABLED(CONFIG_IPV6)
>     381		/* clear clip entry */
>     382		if (tx_info->ip_family == AF_INET6)
>     383			cxgb4_clip_release(netdev, (const u32 *)
>     384					   &tx_info->sk->sk_v6_rcv_saddr,
>     385					   1);
>     386	#endif
>     387	
>     388		/* clear tid */
>     389		if (tx_info->tid != -1) {
>     390			cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan,
>     391					 tx_info->tid, tx_info->ip_family);
>     392	
>     393			xa_erase(&u_ctx->tid_list, tx_info->tid);
>                                   ^^^^^^^^^^^^^^^^
> Unchecked dereference.
>
>     394		}
>     395	
>
> regards,
> dan carpenter

      reply	other threads:[~2021-05-17  9:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 10:42 [bug report] cxgb4/ch_ktls: Clear resources when pf4 device is removed Dan Carpenter
2021-05-17 10:18 ` Ayush Sawal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fca50a-448b-a0a7-e406-ea458270637f@chelsio.com \
    --to=ayush.sawal@chelsio.com \
    --cc=ayush.sawal@asicdesigners.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=rohitm@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox