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]
Message-ID: <Y+EG4uZnMr0lYPwU@unreal>
Date:   Mon, 6 Feb 2023 15:55:46 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Nikita Zhandarovich <n.zhandarovich@...tech.ru>
Cc:     Potnuri Bharat Teja <bharat@...lsio.com>,
        Jason Gunthorpe <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH v2] RDMA/cxgb4: Fix potential null-ptr-deref in
 pass_establish()

On Thu, Feb 02, 2023 at 10:48:50AM -0800, Nikita Zhandarovich wrote:
> If get_ep_from_tid() fails to lookup non-NULL value for ep, ep is
> dereferenced later regardless of whether it is empty.
> This patch adds a simple sanity check to fix the issue.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 944661dd97f4 ("RDMA/iw_cxgb4: atomically lookup ep and get a reference")
> Signed-off-by: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
> ---
> v2: do not use pr_warn() when get_ep_from_tid() returns NULL as
> Jason Gunthorpe <jgg@...pe.ca> suggested.
> 
>  drivers/infiniband/hw/cxgb4/cm.c | 2 ++
>  1 file changed, 2 insertions(+)

I applied, but please next time.
1. Don't send patches as reply-to. It messes whole patch flow.
2. Use target in subject line, e.g. [PATCH rdma-next] or [PATCH rdma-rc]

Thanks


> 
> diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
> index 499a425a3379..f5f4579f037c 100644
> --- a/drivers/infiniband/hw/cxgb4/cm.c
> +++ b/drivers/infiniband/hw/cxgb4/cm.c
> @@ -2676,6 +2676,8 @@ static int pass_establish(struct c4iw_dev *dev, struct sk_buff *skb)
>  	u16 tcp_opt = ntohs(req->tcp_opt);
>  
>  	ep = get_ep_from_tid(dev, tid);
> +	if (!ep)
> +		return 0;
>  	pr_debug("ep %p tid %u\n", ep, ep->hwtid);
>  	ep->snd_seq = be32_to_cpu(req->snd_isn);
>  	ep->rcv_seq = be32_to_cpu(req->rcv_isn);
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ