From: Greg Kroah-Hartman Date: Fri, 27 Jan 2023 07:09:14 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v5.10.166~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=770c4fadfef8839b235e798a82305bcd49081f60;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: fs-reiserfs-remove-useless-new_opts-in-reiserfs_remount.patch --- diff --git a/queue-5.10/fs-reiserfs-remove-useless-new_opts-in-reiserfs_remount.patch b/queue-5.10/fs-reiserfs-remove-useless-new_opts-in-reiserfs_remount.patch new file mode 100644 index 00000000000..06726d8403a --- /dev/null +++ b/queue-5.10/fs-reiserfs-remove-useless-new_opts-in-reiserfs_remount.patch @@ -0,0 +1,56 @@ +From 81dedaf10c20959bdf5624f9783f408df26ba7a4 Mon Sep 17 00:00:00 2001 +From: Dongliang Mu +Date: Wed, 27 Oct 2021 22:34:41 +0800 +Subject: fs: reiserfs: remove useless new_opts in reiserfs_remount + +From: Dongliang Mu + +commit 81dedaf10c20959bdf5624f9783f408df26ba7a4 upstream. + +Since the commit c3d98ea08291 ("VFS: Don't use save/replace_mount_options +if not using generic_show_options") eliminates replace_mount_options +in reiserfs_remount, but does not handle the allocated new_opts, +it will cause memory leak in the reiserfs_remount. + +Because new_opts is useless in reiserfs_mount, so we fix this bug by +removing the useless new_opts in reiserfs_remount. + +Fixes: c3d98ea08291 ("VFS: Don't use save/replace_mount_options if not using generic_show_options") +Link: https://lore.kernel.org/r/20211027143445.4156459-1-mudongliangabcd@gmail.com +Signed-off-by: Dongliang Mu +Signed-off-by: Jan Kara +Signed-off-by: Fedor Pchelkin +Signed-off-by: Greg Kroah-Hartman +--- + fs/reiserfs/super.c | 6 ------ + 1 file changed, 6 deletions(-) + +--- a/fs/reiserfs/super.c ++++ b/fs/reiserfs/super.c +@@ -1437,7 +1437,6 @@ static int reiserfs_remount(struct super + unsigned long safe_mask = 0; + unsigned int commit_max_age = (unsigned int)-1; + struct reiserfs_journal *journal = SB_JOURNAL(s); +- char *new_opts; + int err; + char *qf_names[REISERFS_MAXQUOTAS]; + unsigned int qfmt = 0; +@@ -1445,10 +1444,6 @@ static int reiserfs_remount(struct super + int i; + #endif + +- new_opts = kstrdup(arg, GFP_KERNEL); +- if (arg && !new_opts) +- return -ENOMEM; +- + sync_filesystem(s); + reiserfs_write_lock(s); + +@@ -1599,7 +1594,6 @@ out_ok_unlocked: + out_err_unlock: + reiserfs_write_unlock(s); + out_err: +- kfree(new_opts); + return err; + } + diff --git a/queue-5.10/series b/queue-5.10/series index 0f1996e9581..705af7fb8c1 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -75,3 +75,4 @@ lockref-stop-doing-cpu_relax-in-the-cmpxchg-loop.patch revert-selftests-bpf-check-null-propagation-only-nei.patch netfilter-conntrack-do-not-renew-entry-stuck-in-tcp-.patch x86-acpi-cstate-optimize-c3-entry-on-amd-cpus.patch +fs-reiserfs-remove-useless-new_opts-in-reiserfs_remount.patch