Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1525450

[PATCH] ovl: fix return value of ovl_fill_super

From Geliang Tang <geliangtang@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] ovl: fix return value of ovl_fill_super
Date 2016-11-18 16:10 +0100
Message-ID <sESXE-l4-39@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


If kcalloc() failed, the return value of ovl_fill_super() is -EINVAL,
not -ENOMEM. So this patch sets this value to -ENOMEM before calling
kcalloc(), and sets it back to -EINVAL after calling kcalloc().

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 fs/overlayfs/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 19d31ce..1afdf77 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -754,10 +754,12 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 		goto out_free_lowertmp;
 	}
 
+	err = -ENOMEM;
 	stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL);
 	if (!stack)
 		goto out_free_lowertmp;
 
+	err = -EINVAL;
 	lower = lowertmp;
 	for (numlower = 0; numlower < stacklen; numlower++) {
 		err = ovl_lower_dir(lower, &stack[numlower], ufs,
-- 
2.9.3

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] ovl: fix return value of ovl_fill_super Geliang Tang <geliangtang@gmail.com> - 2016-11-18 16:10 +0100

csiph-web