Skip to content

Commit ce65761

Browse files
Sanidhya Kashyaptorvalds
Sanidhya Kashyap
authored andcommitted
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 <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent d7b0409 commit ce65761

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/hpfs/super.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,14 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
451451
int o;
452452
struct hpfs_sb_info *sbi = hpfs_sb(s);
453453
char *new_opts = kstrdup(data, GFP_KERNEL);
454-
454+
455+
if (!new_opts)
456+
return -ENOMEM;
457+
455458
sync_filesystem(s);
456459

457460
*flags |= MS_NOATIME;
458-
461+
459462
hpfs_lock(s);
460463
uid = sbi->sb_uid; gid = sbi->sb_gid;
461464
umask = 0777 & ~sbi->sb_mode;

0 commit comments

Comments
 (0)