Skip to contentSkip to conversation

orangefs: Fix sb refcount leak when allocate sb info failed.

PATCH New Chenyuan Mi 1 participant 1 message Sep 7, 2021 Orangefs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 orangefs: Fix sb refcount leak when allocate sb info failed.

The reference counting issue happens in one exception handling path of orangefs_mount(). When failing to allocate sb info, the function forgets to decrease the refcount of sb increased by sget(), causing a refcount leak.

Fix this issue by jumping to the label "free_sb_and_op" instead of "free_op"

---
 fs/orangefs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/super.c +1 -1
index 2f2e430461b2..c46a9005fc44 100644
@@ -526,7 +526,7 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
 	sb->s_fs_info = kzalloc(sizeof(struct orangefs_sb_info_s), GFP_KERNEL);
 	if (!ORANGEFS_SB(sb)) {
 		d = ERR_PTR(-ENOMEM);
-		goto free_op;
+		goto free_sb_and_op;
 	}
 
 	ret = orangefs_fill_sb(sb,
Signature · 1 line
2.17.1