[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMGffEntL4XkF6bCuhUDP+AOBO4mpKK1pTe3NgPUW86ySyy7Wg@mail.gmail.com>
Date: Fri, 19 Jun 2020 15:16:57 +0200
From: Jinpu Wang <jinpu.wang@...ud.ionos.com>
To: Bo YU <tsu.yubo@...il.com>
Cc: Danil Kipnis <danil.kipnis@...ud.ionos.com>, ledford@...hat.com,
Jason Gunthorpe <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] RDMA/rtrs: fix potential resources leaks
Hi, Bo,
On Fri, Jun 19, 2020 at 3:10 PM Bo YU <tsu.yubo@...il.com> wrote:
>
> Dev is returned from allocation function kzalloc but it does not
> free it in out_err path.
If allocation failed, kzalloc return NULL, nothing to free.
>
> Detected by CoverityScan, CID# 1464569: (Resource leak)
>
> Fixes: c0894b3ea69d3("RDMA/rtrs: core: lib functions shared between client and server modules")
> Signed-off-by: Bo YU <tsu.yubo@...il.com>
> ---
> drivers/infiniband/ulp/rtrs/rtrs.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c
> index ff1093d6e4bc..03bdab92fa49 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs.c
> @@ -607,6 +607,7 @@ rtrs_ib_dev_find_or_add(struct ib_device *ib_dev,
> else
> kfree(dev);
> out_err:
> + kfree(dev);
> return NULL;
> }
> EXPORT_SYMBOL(rtrs_ib_dev_find_or_add);
> --
> 2.11.0
>
Powered by blists - more mailing lists