diff options
author | Sanidhya Kashyap <sanidhya.gatech@gmail.com> | 2015-03-21 12:57:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-09 16:35:31 -0400 |
commit | ce657611baf902f14ae559ce4e0787ead6712067 (patch) | |
tree | 43f2a918a0c4d8f7b9c3cc2418953ed0f34a0c70 /fs/hpfs | |
parent | d7b04097c250e6322ba73d3b03337074afeeb314 (diff) |
hpfs: kstrdup() out of memory handling
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>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hpfs')
-rw-r--r-- | fs/hpfs/super.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 0642516d36c8..cde044d41f69 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -451,11 +451,14 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
451 | int o; | 451 | int o; |
452 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 452 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
453 | char *new_opts = kstrdup(data, GFP_KERNEL); | 453 | char *new_opts = kstrdup(data, GFP_KERNEL); |
454 | 454 | ||
455 | if (!new_opts) | ||
456 | return -ENOMEM; | ||
457 | |||
455 | sync_filesystem(s); | 458 | sync_filesystem(s); |
456 | 459 | ||
457 | *flags |= MS_NOATIME; | 460 | *flags |= MS_NOATIME; |
458 | 461 | ||
459 | hpfs_lock(s); | 462 | hpfs_lock(s); |
460 | uid = sbi->sb_uid; gid = sbi->sb_gid; | 463 | uid = sbi->sb_uid; gid = sbi->sb_gid; |
461 | umask = 0777 & ~sbi->sb_mode; | 464 | umask = 0777 & ~sbi->sb_mode; |