diff options
author | Christian Brauner <brauner@kernel.org> | 2023-08-29 17:23:57 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-08-31 12:47:15 +0200 |
commit | ec952aa253c0f49a70d9de7b44b5f5c93e2dfe54 (patch) | |
tree | 7b90079309020da73f388c8a8aac97e8316ef922 /lib/string_helpers.c | |
parent | 69881be3d9a00cca770886af40913cfc5274b2d0 (diff) |
mtd: key superblock by device number
The mtd driver has similar problems than the one that was fixed in
commit dc3216b14160 ("super: ensure valid info").
The kill_mtd_super() helper calls shuts the superblock down but leaves
the superblock on fs_supers as the devices are still in use but puts the
mtd device and cleans out the superblock's s_mtd field.
This means another mounter can find the superblock on the list accessing
its s_mtd field while it is curently in the process of being freed or
already freed.
Prevent that from happening by keying superblock by dev_t just as we do
in the generic code.
Link: https://lore.kernel.org/linux-fsdevel/20230829-weitab-lauwarm-49c40fc85863@brauner
Acked-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Message-Id: <20230829-vfs-super-mtd-v1-2-fecb572e5df3@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions