From patchwork Tue Nov 15 07:32:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang Yang X-Patchwork-Id: 20226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2571791wru; Mon, 14 Nov 2022 23:38:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4p/eGlvrhOMATnFvPUuOGUSHH6bvt0ybQrtM2ys9XCLO/PqkFXS3ILdWwScouWPLSJDoQa X-Received: by 2002:a17:906:cd0f:b0:78d:99ee:4e68 with SMTP id oz15-20020a170906cd0f00b0078d99ee4e68mr12371127ejb.302.1668497936267; Mon, 14 Nov 2022 23:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668497936; cv=none; d=google.com; s=arc-20160816; b=cwV2aQHUIolTMaKup+Q+a3N5wBehG37b0CxpBmuhn1L2lPxyQE6S7hOaVLSAXfRHvL xHxcKGBcTHEUxfheDUuZJaZYsG9Bb4tzGno1vosP09nGDVlv9AZnogmENza5QDCn49pv Euziohsye1GvKBpLJUpVWy5jyYlCgRcOMtTY7jrPlh5DjM6nEjK4QEkfDLQ0bSiyh3q4 9EiloQxVE9Lmg01XYgk+CXP5wUNXMRgosjAUWBAo2S3NU/uKHPIwmr9EfdcJAH+0Ew9M fs726WKWI/F2A0/rHJeVQkG8MkOIQ+jY5+PBsOJG2jVjxJwY311FVDyOiIwa5VuCeac9 lGkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OnI2Mz8YzKaFdphujFGkwr9zWfWDTwNu0INigsUK7EQ=; b=WyphaUVw4S8Sd3F9remDQ7e36olzGp4B4NqW/PHCDj8i3vGabhHIqm8UzdL7kSN+yw Qu+yLDnaCWwkuC2qzjSsBAhjywPGT2S8r3BuleunDUasOf1BYl09zJ74N1uFP8pN7XR0 MBqCUqPKVRTN8MfDf2uUXlNKMIgu0jiUhWbSeDT82xAU4XyZ1Kg9PKvzgGKU5xTeLbmy 4HyecGfZeHkY1njWszz3zOfw1TiniBfqEEfLZoU2UxdkzZF073C6TSh4PFzVOe4iC2Mh 9J3B6G76/Y4PdDvkYNkZ/ChvMMVWxQxCiuooRFt8TjnPgrL8cY9PCfQaa614Ys11XuIz 6SBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr22-20020a170907721600b0078dcd448f97si11864595ejc.801.2022.11.14.23.38.32; Mon, 14 Nov 2022 23:38:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232321AbiKOHfk (ORCPT + 99 others); Tue, 15 Nov 2022 02:35:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232299AbiKOHfg (ORCPT ); Tue, 15 Nov 2022 02:35:36 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 821D365B2 for ; Mon, 14 Nov 2022 23:35:35 -0800 (PST) Received: from canpemm500004.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NBHyS6RVrzmW02; Tue, 15 Nov 2022 15:35:12 +0800 (CST) Received: from ubuntu1604.huawei.com (10.67.174.160) by canpemm500004.china.huawei.com (7.192.104.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 15:35:33 +0800 From: Xiang Yang To: , , , , , CC: , Subject: [PATCH -next] um: vector: Fix memory leak in vector_config Date: Tue, 15 Nov 2022 15:32:25 +0800 Message-ID: <20221115073225.161592-1-xiangyang3@huawei.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-Originating-IP: [10.67.174.160] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500004.china.huawei.com (7.192.104.92) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749546891918605358?= X-GMAIL-MSGID: =?utf-8?q?1749546891918605358?= 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 --- 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 ded7c47d2fbe..131b7cb29576 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; }