1
0
Fork 0
remarkable-linux/fs/affs
Mikulas Patocka 9df75cfc33 affs: fix remount failure when there are no options changed
[ Upstream commit 01d6e08711 ]

Commit c8f33d0bec ("affs: kstrdup() memory handling") checks if the
kstrdup function returns NULL due to out-of-memory condition.

However, if we are remounting a filesystem with no change to
filesystem-specific options, the parameter data is NULL.  In this case,
kstrdup returns NULL (because it was passed NULL parameter), although no
out of memory condition exists.  The mount syscall then fails with
ENOMEM.

This patch fixes the bug.  We fail with ENOMEM only if data is non-NULL.

The patch also changes the call to replace_mount_options - if we didn't
pass any filesystem-specific options, we don't call
replace_mount_options (thus we don't erase existing reported options).

Fixes: c8f33d0bec ("affs: kstrdup() memory handling")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org	# v4.1+
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-06-06 19:12:35 -04:00
..
Changes remove obsolete references to powertweak 2013-11-27 20:34:32 -08:00
Kconfig fs/affs: remove depends on CONFIG_EXPERIMENTAL 2013-01-21 14:39:04 -08:00
Makefile fs: change to new flag variable 2011-03-17 14:02:57 +01:00
affs.h fs/affs/affs.h: add mount option manipulation macros 2015-04-17 09:04:08 -04:00
amigaffs.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
bitmap.c fs/affs/bitmap.c: remove unnecessary return 2015-02-17 14:34:52 -08:00
dir.c fs/affs: define AFFSNAMEMAX to replace constant use 2015-02-17 14:34:52 -08:00
file.c Merge branch 'akpm' (patches from Andrew) 2015-04-17 09:04:38 -04:00
inode.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
namei.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
super.c affs: fix remount failure when there are no options changed 2016-06-06 19:12:35 -04:00
symlink.c fs/affs: pr_debug cleanup 2014-06-06 16:08:13 -07:00