Skip to contentSkip to conversation

FAILED: patch "[PATCH] bootconfig: init: Fix memblock leak in xbc_make_cmdline()" failed to apply to 5.14-stable tree

PATCH [email protected] 2 participants 3 messages Oct 18, 2021 – Nov 19, 2021 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 1ae43851b18afe861120ebd7c426dc44f06bb2bd Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <[email protected]>
Date: Thu, 16 Sep 2021 15:23:12 +0900
Subject: [PATCH] bootconfig: init: Fix memblock leak in xbc_make_cmdline()

Free unused memblock in a error case to fix memblock leak in xbc_make_cmdline().

Fixes 51887d03aca1 ("bootconfig: init: Allow admin to use bootconfig for kernel command line")
init/main.c +1 -0
index 81a79a77db46..3c4054a95545 100644
@@ -382,6 +382,7 @@ static char * __init xbc_make_cmdline(const char *key)
 	ret = xbc_snprint_cmdline(new_cmdline, len + 1, root);
 	if (ret < 0 || ret > len) {
 		pr_err("Failed to print extra kernel cmdline.\n");
+		memblock_free_ptr(new_cmdline, len + 1);
 		return NULL;
 	}
 
#1 lore raw
Quoted 9 lines · On Mon, 18 Oct 2021 12:30:54 +0200 <[email protected]> wrote:

The patch below does not apply to the 5.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

This should apply to both 5.14 and 5.10.

-- Steve

Quoted 3 lines

------------------ original commit in Linus's tree ------------------

From 1ae43851b18afe861120ebd7c426dc44f06bb2bd Mon Sep 17 00:00:00 2001

From: Masami Hiramatsu <[email protected]>
Date: Thu, 16 Sep 2021 15:23:12 +0900
Subject: [PATCH] bootconfig: init: Fix memblock leak in xbc_make_cmdline()

Free unused memblock in a error case to fix memblock leak in xbc_make_cmdline().

Fixes 51887d03aca1 ("bootconfig: init: Allow admin to use bootconfig for kernel command line")
init/main.c +1 -0
Index: linux-test.git/init/main.c
===================================================================
@@ -382,6 +382,7 @@ static char * __init xbc_make_cmdline(co
 	ret = xbc_snprint_cmdline(new_cmdline, len + 1, root);
 	if (ret < 0 || ret > len) {
 		pr_err("Failed to print extra kernel cmdline.\n");
+		memblock_free(__pa(new_cmdline), len + 1);
 		return NULL;
 	}
 
author maintainer
#2 lore raw
Quoted 8 lines · Steven Rostedt
Quoted 5 lines · On Mon, 18 Oct 2021 12:30:54 +0200 <[email protected]> wrote:

The patch below does not apply to the 5.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 6 lines
Quoted 4 lines

thanks,

greg k-h

This should apply to both 5.14 and 5.10.

Now queued up, thanks.

greg k-h