From patchwork Thu Dec 29 07:53:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 37321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2285875wrt; Thu, 29 Dec 2022 00:03:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXtitjiOvtSQhJcZVsYaQ4cMuDJqQiWpl4uy2D4ZpUL2ed7betm9eqncHA2WmX5Txfg1eQ7w X-Received: by 2002:a17:90b:1110:b0:225:c6fa:97cb with SMTP id gi16-20020a17090b111000b00225c6fa97cbmr20553570pjb.21.1672301023399; Thu, 29 Dec 2022 00:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672301023; cv=none; d=google.com; s=arc-20160816; b=UJeaIoAcXkRbq8leVOjNKn482hV/OgQSWLJoR6+AoPkpEMaQb8hYITVSasJz8GRkP0 C73epNTQr7n5msSIgnwfqzr7JDbslBH3M5daGXJ96rv6PXfmeErBwepBBcC5R8qslFwb A45v5Uobl3TxHc4lP9OlMigZpaVVQJ7HdmkckdXWxFZFAmu8VUTyE64BvCa18Zr0J9UO QN5zS7GTZlYogNN0fWlWZzraT4sPj3rwZSDCFTBJHR3nrl5Wp6sxGWWmQW4qHY5imROA Du7352CM/7yCThOHXb1b+uzicNWXFuw5MmAcNtu6c2N3wQW8bFA0At6RghVYYRcaFCNA WYJQ== 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:to:from:dkim-signature; bh=wDeSYbJRD5UIxf0kkPf6Les3H3nIVnzcLc/ji7ALnCE=; b=fp9mXxZR5WRXCWcGs7py75udC7GcWzQnv4dKXZ/sjME6AMedh7bskUvXWvtUGXt5Hl Yduen2MTNVJs5nLh7sy7oZiNy02WQ5hJIWal/EATzvFfgcsfHPIzfz4qF5H6wqp8pZ9h UsXNspG3xzBJZzu0kUVkl7CdSclcjFxDFIZmRAkMVtFK0XfmuH7+nMS6ficv59CG83jw ywm2e+Pkf3UZvV8m6Y8a2C5uGeaeGnC7EOHrnMf8LXfgoSmPac5No859vPMAp6T/XPlS OChjOkEQcxTP2RfcneZ20FLKmHoQMdEaNOjO/Kmd4fLAz+/IlU7HmkDyqJzlyKF6gieP bLxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qtpzgTHl; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a634417000000b004782ca58117si18827545pga.611.2022.12.29.00.03.25; Thu, 29 Dec 2022 00:03:43 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qtpzgTHl; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbiL2Hxi (ORCPT + 99 others); Thu, 29 Dec 2022 02:53:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbiL2Hxe (ORCPT ); Thu, 29 Dec 2022 02:53:34 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B95EF585 for ; Wed, 28 Dec 2022 23:53:33 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id k19so4464896pfg.11 for ; Wed, 28 Dec 2022 23:53:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=wDeSYbJRD5UIxf0kkPf6Les3H3nIVnzcLc/ji7ALnCE=; b=qtpzgTHlnAUEX2ly37pMS8tGaRlIXK0hm2KhLHj9n1OgGC9mPJ4R3s1wEEjDXcr7v8 LH/xO2CKUW7TThMnCXMQEU9Fk5xFelRz6bQcuIWar7ylBvHdnqsKlrLT9D6avGwhi1k3 LmoOfoEoWvjBIA2cf40UqTdy6hKv1svsnmqN10EGTR7WwHtxWgAwe08tA8Sp5BiuBktj 2ju9o7VcUAj4/KeelGsnMQNp3IcuNtJuvIASxr7+eJX/yilF8MgvPSYnudnfAm3/5xvt i0tWic8Sgt7ZkiBubZUj1ckNt5qyowqTIWpqOgNKZPebk0yxzwrGsJBHf+fMUC3tgzj5 Y/2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wDeSYbJRD5UIxf0kkPf6Les3H3nIVnzcLc/ji7ALnCE=; b=zhURCT4uDETmXKC9umyxVE8I65Elkdzwr4Eu0Lznt0fVPIiHwQ89a/uAoai5CxP2l3 yZYT/PM0t1bOnGThzrwPR3Blgzw3BIebU6AmXwP2BRDXTn6bU0yFJa/9hdYnexKz3nHp nS1jZmqkzF6U0OFfn9PsTrAB8dc7eVMcoAXivCWzwDLbyl4NCmwWd2RgVR9tU4foCb/9 Klj6WxsbdNT/6S9XmNoofDL7Al56D5gz8TLA0H1NoLz14DE/xw5wUVZMKNHQcmSCfVUO d3uDDc3g6j2/WHEufyL6MSNqkajaf5mqTipkj23FaavLanVr3K7SDHHv1f55CyOpWGtx ZVpQ== X-Gm-Message-State: AFqh2kpZmVKzDkTl5yhcUy2ZYB4Q7hgy3J5Tq05eu6Aqu9J86wi5xx07 U7DQ/iAu8K+lB3iWLXj2qA0= X-Received: by 2002:a05:6a00:410b:b0:57a:9482:843b with SMTP id bu11-20020a056a00410b00b0057a9482843bmr31812196pfb.5.1672300412939; Wed, 28 Dec 2022 23:53:32 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id x24-20020aa78f18000000b0058134d2df41sm6126235pfr.146.2022.12.28.23.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 23:53:32 -0800 (PST) From: Miaoqian Lin To: Richard Weinberger , Anton Ivanov , Johannes Berg , Jakub Kicinski , Miaoqian Lin , "David S. Miller" , Wolfram Sang , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] um: vector: Fix memory leak in vector_config Date: Thu, 29 Dec 2022 11:53:21 +0400 Message-Id: <20221229075323.1394010-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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?1753534717980598910?= X-GMAIL-MSGID: =?utf-8?q?1753534717980598910?= kstrdup() return newly allocated copy of the string. Call kfree() to release the memory when after use. Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver") Signed-off-by: Miaoqian Lin --- 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..78f32005dd90 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -765,6 +765,7 @@ static int vector_config(char *str, char **error_out) parsed = uml_parse_vector_ifspec(params); + kfree(params); if (parsed == NULL) { *error_out = "vector_config failed to parse parameters"; return -EINVAL;