From: Jakub Kicinski <kuba@kernel.org>
To: Tuo Li <islituo@gmail.com>
Cc: ayush.sawal@chelsio.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
kernelxing@tencent.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] chcr_ktls: add a defensive NULL check to prevent a possible null-pointer dereference in chcr_ktls_dev_del()
Date: Thu, 8 Jan 2026 17:53:57 -0800 [thread overview]
Message-ID: <20260108175357.52ad56c1@kernel.org> (raw)
In-Reply-To: <20260106123302.166220-1-islituo@gmail.com>
On Tue, 6 Jan 2026 20:33:02 +0800 Tuo Li wrote:
> In this function, u_ctx is guarded by an if statement, which indicates that
> it may be NULL:
>
> u_ctx = tx_info->adap->uld[CXGB4_ULD_KTLS].handle;
> if (u_ctx && u_ctx->detach)
> return;
>
> Consequently, a potential null-pointer dereference may occur when
> tx_info->tid != -1, as shown below:
>
> if (tx_info->tid != -1) {
> ...
> xa_erase(&u_ctx->tid_list, tx_info->tid);
> }
>
> Therefore, add a defensive NULL check to prevent this issue.
There seems to be no locking here.
It'd take much more to make this code safe, sprinking random ifs
here and there seem like a waste of time.
--
pw-bot: reject
next prev parent reply other threads:[~2026-01-09 1:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 12:33 [PATCH] chcr_ktls: add a defensive NULL check to prevent a possible null-pointer dereference in chcr_ktls_dev_del() Tuo Li
2026-01-09 1:53 ` Jakub Kicinski [this message]
2026-01-11 17:25 ` Tuo Li
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=20260108175357.52ad56c1@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ayush.sawal@chelsio.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=islituo@gmail.com \
--cc=kernelxing@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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