summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorSanidhya Kashyap <sanidhya.gatech@gmail.com>2015-03-21 12:57:50 -0400
committerZefan Li <lizefan@huawei.com>2016-03-21 09:17:40 +0800
commit0a4cdc47f96f44c55cfa5a80ff383db2304dd734 (patch)
tree4910099e1cdff38182b956a8a05349d6ce7a8fc3 /fs
parentbb09c8d93f6bcd5983d3e51df0acb1473ef799ab (diff)
hpfs: kstrdup() out of memory handling
commit ce657611baf902f14ae559ce4e0787ead6712067 upstream. There is a possibility of nothing being allocated to the new_opts in case of memory pressure, therefore return ENOMEM for such case. Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com> Signed-off-by: Mikulas Patocka <mikulas@twibright.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [lizf: Backported to 3.4: adjust context] Signed-off-by: Zefan Li <lizefan@huawei.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/hpfs/super.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 0bf578dbfce7..0b990b288aff 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -385,9 +385,13 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
int o;
struct hpfs_sb_info *sbi = hpfs_sb(s);
char *new_opts = kstrdup(data, GFP_KERNEL);
-
+
+
+ if (!new_opts)
+ return -ENOMEM;
+
*flags |= MS_NOATIME;
-
+
hpfs_lock(s);
lock_super(s);
uid = sbi->sb_uid; gid = sbi->sb_gid;