Skip to contentSkip to conversation

affs: kstrdup() memory handling

PATCH New Sanidhya Kashyap 1 participant 1 message Mar 21, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 affs: kstrdup() memory handling

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

---
 fs/affs/super.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/affs/super.c +4 -0
index 4cf0e91..f4d0d36 100644
@@ -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);
Signature · 1 line
2.1.0