[PATCH] fs/namespace.c: fix missing return value check of ida_pre_get()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Function mnt_alloc_id() defined in fs/namespace.c calls ida_pre_get() to allocate memory. It may return 0 on failure. The return code should be checked against 0.
---
 fs/namespace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index bd2f4c6..ae89b69 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -104,7 +104,8 @@ static int mnt_alloc_id(struct mount *mnt)
 	int res;
 
 retry:
-	ida_pre_get(&mnt_id_ida, GFP_KERNEL);
+	if (!ida_pre_get(&mnt_id_ida, GFP_KERNEL))
+		return -ENOMEM;
 	spin_lock(&mnt_id_lock);
 	res = ida_get_new_above(&mnt_id_ida, mnt_id_start, &mnt->mnt_id);
 	if (!res)
-- 
2.6.4




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux