summaryrefslogtreecommitdiffstats
path: root/fs/affs/super.c
diff options
context:
space:
mode:
authorSanidhya Kashyap <sanidhya.gatech@gmail.com>2015-04-16 12:48:26 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-17 09:04:09 -0400
commitc8f33d0bec999a4f2b5c3f9380361b88ce6f6ab0 (patch)
tree7f5ff253261b35a918b9223e21ac9cf5cdc3814c /fs/affs/super.c
parent79bda4d510f80e403ef66fee852f8ccb17308581 (diff)
downloadop-kernel-dev-c8f33d0bec999a4f2b5c3f9380361b88ce6f6ab0.zip
op-kernel-dev-c8f33d0bec999a4f2b5c3f9380361b88ce6f6ab0.tar.gz
affs: kstrdup() memory handling
There is a possibility of kstrdup() failure upon memory pressure. Therefore, returning ENOMEM even for new_opts. [akpm@linux-foundation.org: cleanup] Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com> Cc: Taesoo kim <taesoo@gatech.edu> Cc: Fabian Frederick <fabf@skynet.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/affs/super.c')
-rw-r--r--fs/affs/super.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 6819d04..3f89c9e 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -521,10 +521,14 @@ affs_remount(struct super_block *sb, int *flags, char *data)
int root_block;
unsigned long mount_flags;
int res = 0;
- char *new_opts = kstrdup(data, GFP_KERNEL);
+ char *new_opts;
char volume[32];
char *prefix = NULL;
+ new_opts = kstrdup(data, GFP_KERNEL);
+ if (!new_opts)
+ return -ENOMEM;
+
pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data);
sync_filesystem(sb);
OpenPOWER on IntegriCloud