Subject: Re: [PATCH] chcr_ktls: add a defensive NULL check to prevent a possible null-pointer dereference in chcr_ktls_dev_del()

From: Jakub Kicinski <[email-masked]>
Date: Thu, 8 Jan 2026 17:53:57 -0800

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