All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <alexander.levin@microsoft.com>,
	Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drivers/staging/exfat - by default, prohibit mount of fat/vfat
Date: Fri, 30 Aug 2019 12:42:39 -0400	[thread overview]
Message-ID: <245727.1567183359@turing-police> (raw)

Concerns have been raised about the exfat driver accidentally mounting
fat/vfat file systems.  Add an extra configure option to help prevent that.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

diff --git a/drivers/staging/exfat/Kconfig b/drivers/staging/exfat/Kconfig
index 78b32aa2ca19..1df177b1dc72 100644
--- a/drivers/staging/exfat/Kconfig
+++ b/drivers/staging/exfat/Kconfig
@@ -4,6 +4,14 @@ config EXFAT_FS
 	help
 	  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
 	bool "enable discard support"
 	depends on EXFAT_FS
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 5b5c2ca8c9aa..7fdb5b8bc928 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -486,10 +486,16 @@ static int ffsMountVol(struct super_block *sb)
 			break;
 
 	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 */
 			ret = fat16_mount(sb, p_pbr);
 		else
 			ret = fat32_mount(sb, p_pbr);
+#endif
 	} else {
 		ret = exfat_mount(sb, p_pbr);
 	}


             reply	other threads:[~2019-08-30 16:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 16:42 Valdis Klētnieks [this message]
2019-08-30 16:45 ` [PATCH] drivers/staging/exfat - by default, prohibit mount of fat/vfat Christoph Hellwig
2019-08-31  0:48   ` Valdis Klētnieks
2019-08-31  6:46     ` Christoph Hellwig
2019-08-31 10:25       ` Valdis Klētnieks
2019-08-31 14:24         ` Andy Shevchenko
2019-08-31 14:51           ` Valdis Klētnieks
2019-09-01  1:07         ` Dave Chinner
2019-09-01  1:37           ` Gao Xiang
2019-09-01  3:05             ` Al Viro
2019-09-01  3:26               ` Gao Xiang
2019-09-01  3:37           ` Valdis Klētnieks
2019-09-01 22:43             ` Dave Chinner
2019-09-01 23:13               ` Valdis Klētnieks
2019-09-02  7:38                 ` Christoph Hellwig
2019-09-02  7:35         ` Christoph Hellwig
2019-09-02 15:25           ` Greg Kroah-Hartman
2019-09-02 19:00             ` Valdis Klētnieks
2019-09-02 19:06               ` Greg Kroah-Hartman
2019-09-08 10:50                 ` OGAWA Hirofumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=245727.1567183359@turing-police \
    --to=valdis.kletnieks@vt.edu \
    --cc=alexander.levin@microsoft.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.