[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 Feb 2023 11:58:21 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
Cc: Potnuri Bharat Teja <bharat@...lsio.com>,
Leon Romanovsky <leon@...nel.org>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH] RDMA/cxgb4: Fix potential null-ptr-deref in
pass_establish()
On Thu, Feb 02, 2023 at 06:52:22AM -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>
> ---
> drivers/infiniband/hw/cxgb4/cm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
> index c16017f6e8db..f4a02c2ec02f 100644
> --- a/drivers/infiniband/hw/cxgb4/cm.c
> +++ b/drivers/infiniband/hw/cxgb4/cm.c
> @@ -2683,6 +2683,10 @@ 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) {
> + pr_warn("%s tid %d lookup failure!\n", __func__, tid);
> + return 0;
> + }
don't print please
Jason
Powered by blists - more mailing lists