mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] orangefs: Fix memory leak in orangefs_mount
@ 2019-12-15  1:58 Navid Emamdoost
  0 siblings, 0 replies; only message in thread
From: Navid Emamdoost @ 2019-12-15  1:58 UTC (permalink / raw)
  To: Mike Marshall, Martin Brandenburg, devel, linux-kernel
  Cc: emamd001, Navid Emamdoost

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-15  1:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15  1:58 [PATCH] orangefs: Fix memory leak in orangefs_mount Navid Emamdoost

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®