On Wed, Oct 13, 2021 at 05:21:17PM +0800, ChenXiaoSong wrote: > If two processes mount same superblock, memory leak occurs: > > CPU0 | CPU1 > do_new_mount | do_new_mount > fs_set_subtype | fs_set_subtype > kstrdup | > | kstrdup > memrory leak | > > Fix this by adding a write lock while calling fs_set_subtype. > > Linus's tree already have refactoring patchset [1], one of them can fix this bug: > c30da2e981a7 (fuse: convert to use the new mount API) > > Since we did not merge the refactoring patchset in this branch, I create this patch. > > [1] https://patchwork.kernel.org/project/linux-fsdevel/patch/20190903113640.7984-3-mszeredi@xxxxxxxxxx/ > > Fixes: 79c0b2df79eb (add filesystem subtype support) > Cc: David Howells <dhowells@xxxxxxxxxx> > Signed-off-by: ChenXiaoSong <chenxiaosong2@xxxxxxxxxx> > --- > fs/namespace.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) Is this a v2 patch? If so, you need to list below the --- line what changed. thanks, greg k-h