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 42F6F8481 for ; Fri, 10 Mar 2023 14:05:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A44F7C433D2; Fri, 10 Mar 2023 14:05:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678457110; bh=WbRGxJjexTrn32/f2mfDDeqTxPCV2Mqvg6pvIbLkbbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qmJyvt9Ol+R+z/OIGJBWcvEx2rmhituEJK0xcLflkL8XYRxF4Uoi/MEYQY64WPAqs pxGUuaKmRXo4UfurH2WVJFta2ZlTb7KxNNrBBSw1Dcwy0TwxMCW0tNeTuD2bR7Rft1 Opqs2PqtcKitk+0b+z0H4JbY9MqzBZJHH8LklnGE= 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 6.1 023/200] um: vector: Fix memory leak in vector_config Date: Fri, 10 Mar 2023 14:37:10 +0100 Message-Id: <20230310133717.756287422@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133717.050159289@linuxfoundation.org> References: <20230310133717.050159289@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 ded7c47d2fbe5..131b7cb295767 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -767,6 +767,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