[PATCH] affs: kstrdup() memory handling

From: Sanidhya Kashyap
Date: Sat Mar 21 2015 - 12:58:39 EST


There is a possibility of kstrdup() failure upon memory pressure.
Therefore, returning ENOMEM even for new_opts.

Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@xxxxxxxxx>
---
fs/affs/super.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/affs/super.c b/fs/affs/super.c
index 4cf0e91..f4d0d36 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -524,6 +524,10 @@ affs_remount(struct super_block *sb, int *flags, char *data)
char volume[32];
char *prefix = NULL;

+
+ if (!new_opts)
+ return -ENOMEM;
+
pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data);

sync_filesystem(sb);
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/