lkml.org 
[lkml]   [2020]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm/shmem.c: Fix the missing unaccount on the failed path
Date
In function __shmem_file_setup(), shmem_unacct_size() is forgotten
on the failed path, so add it.

Fixes: 93dec2da7b234 ("... and switch shmem_file_setup() to alloc_file_pseudo()")
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
mm/shmem.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 8e2b35ba93ad..591410dc3541 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4200,8 +4200,10 @@ static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name, l
if (!IS_ERR(res))
res = alloc_file_pseudo(inode, mnt, name, O_RDWR,
&shmem_file_operations);
- if (IS_ERR(res))
+ if (IS_ERR(res)) {
iput(inode);
+ shmem_unacct_size(flags, size);
+ }
return res;
}

--
2.19.1.3.ge56e4f7
\
 
 \ /
  Last update: 2020-09-20 18:31    [W:6.705 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site