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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 Aug 2021 16:55:42 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Tuo Li <islituo@...il.com>
Cc:     ericvh@...il.com, lucho@...kov.net, asmadeus@...ewreck.org,
        davem@...emloft.net, kuba@...nel.org,
        v9fs-developer@...ts.sourceforge.net, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, baijiaju1990@...il.com,
        TOTE Robot <oslab@...nghua.edu.cn>
Subject: Re: [PATCH] net: 9p: Fix possible null-pointer dereference in
 p9_cm_event_handler()

On Tue, Aug 10, 2021 at 06:20:07AM -0700, Tuo Li wrote:
> The variable rdma is checked when event->event is equal to 
> RDMA_CM_EVENT_DISCONNECTED:
>   if (rdma)
> 
> This indicates that it can be NULL. If so, a null-pointer dereference will 
> occur when calling complete():
>   complete(&rdma->cm_done);
> 
> To fix this possible null-pointer dereference, calling complete() only 
> when rdma is not NULL.

You need to explain how is it possible and blindly set if () checks.
I would say first "if (rdma)" is not needed, but don't know for sure.

> 
> Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
> Signed-off-by: Tuo Li <islituo@...il.com>
> ---
>  net/9p/trans_rdma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
> index af0a8a6cd3fd..fb3435dfd071 100644
> --- a/net/9p/trans_rdma.c
> +++ b/net/9p/trans_rdma.c
> @@ -285,7 +285,8 @@ p9_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
>  	default:
>  		BUG();
>  	}
> -	complete(&rdma->cm_done);
> +	if (rdma)
> +		complete(&rdma->cm_done);
>  	return 0;
>  }
>  
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists