From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22B63881F for ; Fri, 10 Mar 2023 14:41:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DA98C4339C; Fri, 10 Mar 2023 14:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678459314; bh=MixvVkryo7N9jIJa3+uKxF0gQJFGw8RJ/CfUnMnkH20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfYL9Ud8IeH4PDpG8bM12xQHI0j6yvUwrvz7scDs/iLnoBxZtM98Zj0h1p5ZSlYIl LQwmkLBwjFgcet9KSarrfpf+7FbWyIK8YQRBJZLCNSP4FQYPO8M5uj6VRaK096xKLk BmOERBc9osabQ+p/1zP85+pf+YVBBp+/p1FxKUAQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiang Yang , Anton Ivanov , Richard Weinberger , Sasha Levin Subject: [PATCH 5.4 290/357] um: vector: Fix memory leak in vector_config Date: Fri, 10 Mar 2023 14:39:39 +0100 Message-Id: <20230310133747.557576287@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133733.973883071@linuxfoundation.org> References: <20230310133733.973883071@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Xiang Yang [ Upstream commit 8f88c73afe481f93d40801596927e8c0047b6d96 ] If the return value of the uml_parse_vector_ifspec function is NULL, we should call kfree(params) to prevent memory leak. Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver") Signed-off-by: Xiang Yang Acked-By: Anton Ivanov Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/um/drivers/vector_kern.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index 769ffbd9e9a61..eb9dba8dcf958 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -746,6 +746,7 @@ static int vector_config(char *str, char **error_out) if (parsed == NULL) { *error_out = "vector_config failed to parse parameters"; + kfree(params); return -EINVAL; } -- 2.39.2