mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bo YU <tsu.yubo@gmail.com>
To: danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com,
	ledford@redhat.com, jgg@ziepe.ca
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	tsu.yubo@gmail.com
Subject: [PATCH -next] RDMA/rtrs: fix potential resources leaks
Date: Fri, 19 Jun 2020 21:10:23 +0800	[thread overview]
Message-ID: <20200619131017.pr7eoca2bzdtlbk4@debian.debian-2> (raw)

Dev is returned from allocation function kzalloc but it does not
free it in out_err path.

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@gmail.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


             reply	other threads:[~2020-06-19 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 13:10 Bo YU [this message]
2020-06-19 13:16 ` Jinpu Wang
2020-06-19 14:46   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200619131017.pr7eoca2bzdtlbk4@debian.debian-2 \
    --to=tsu.yubo@gmail.com \
    --cc=danil.kipnis@cloud.ionos.com \
    --cc=jgg@ziepe.ca \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=ledford@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®