Commit 58985a9d authored by Valdis Klētnieks's avatar Valdis Klētnieks Committed by Greg Kroah-Hartman

drivers/staging/exfat - by default, prohibit mount of fat/vfat

Concerns have been raised about the exfat driver accidentally mounting
fat/vfat file systems.  Add an extra configure option to help prevent that.
Signed-off-by: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
Link: https://lore.kernel.org/r/245727.1567183359@turing-policeSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 097a802a
...@@ -4,6 +4,14 @@ config EXFAT_FS ...@@ -4,6 +4,14 @@ config EXFAT_FS
help help
This adds support for the exFAT file system. This adds support for the exFAT file system.
config EXFAT_DONT_MOUNT_VFAT
bool "Prohibit mounting of fat/vfat filesysems by exFAT"
default y
help
By default, the exFAT driver will only mount exFAT filesystems, and refuse
to mount fat/vfat filesystems. Set this to 'n' to allow the exFAT driver
to mount these filesystems.
config EXFAT_DISCARD config EXFAT_DISCARD
bool "enable discard support" bool "enable discard support"
depends on EXFAT_FS depends on EXFAT_FS
......
...@@ -486,10 +486,16 @@ static int ffsMountVol(struct super_block *sb) ...@@ -486,10 +486,16 @@ static int ffsMountVol(struct super_block *sb)
break; break;
if (i < 53) { if (i < 53) {
#ifdef CONFIG_EXFAT_DONT_MOUNT_VFAT
ret = -EINVAL;
printk(KERN_INFO "EXFAT: Attempted to mount VFAT filesystem\n");
goto out;
#else
if (GET16(p_pbr->bpb + 11)) /* num_fat_sectors */ if (GET16(p_pbr->bpb + 11)) /* num_fat_sectors */
ret = fat16_mount(sb, p_pbr); ret = fat16_mount(sb, p_pbr);
else else
ret = fat32_mount(sb, p_pbr); ret = fat32_mount(sb, p_pbr);
#endif
} else { } else {
ret = exfat_mount(sb, p_pbr); ret = exfat_mount(sb, p_pbr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment