mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: Mike Marshall <hubcap@omnibond.com>,
	Martin Brandenburg <martin@omnibond.com>,
	devel@lists.orangefs.org, linux-kernel@vger.kernel.org
Cc: emamd001@umn.edu, Navid Emamdoost <navid.emamdoost@gmail.com>
Subject: [PATCH] orangefs: Fix memory leak in orangefs_mount
Date: Sat, 14 Dec 2019 19:58:48 -0600	[thread overview]
Message-ID: <20191215015849.23223-1-navid.emamdoost@gmail.com> (raw)

In the implementation of orangefs_mount() the allocated memory for sb
info should be released if op_alloc() fails. Release it via
goto free_sb_and_op.

Fixes: 482664ddba81 ("orangefs: add features op")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 fs/orangefs/super.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index ee5efdc35cc1..ad98b893989b 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -566,8 +566,10 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
 
 	if (orangefs_userspace_version >= 20906) {
 		new_op = op_alloc(ORANGEFS_VFS_OP_FEATURES);
-		if (!new_op)
-			return ERR_PTR(-ENOMEM);
+		if (!new_op) {
+			d = ERR_PTR(-ENOMEM);
+			goto free_sb_and_op;
+		}
 		new_op->upcall.req.features.features = 0;
 		ret = service_operation(new_op, "orangefs_features", 0);
 		orangefs_features = new_op->downcall.resp.features.features;
-- 
2.17.1


                 reply	other threads:[~2019-12-15  1:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20191215015849.23223-1-navid.emamdoost@gmail.com \
    --to=navid.emamdoost@gmail.com \
    --cc=devel@lists.orangefs.org \
    --cc=emamd001@umn.edu \
    --cc=hubcap@omnibond.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@omnibond.com \
    /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®