From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD298C2B9F8 for ; Tue, 25 May 2021 07:44:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1D0C61421 for ; Tue, 25 May 2021 07:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231860AbhEYHqZ (ORCPT ); Tue, 25 May 2021 03:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbhEYHqY (ORCPT ); Tue, 25 May 2021 03:46:24 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EFF6C061574 for ; Tue, 25 May 2021 00:44:53 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id y184-20020a1ce1c10000b02901769b409001so12251862wmg.3 for ; Tue, 25 May 2021 00:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=0KlRjzQm22CeZiyIa7aNXzjG3v3++JjJtrb3QKuBlFg=; b=uB+kt1kCTABrxvP71MO/n7oJKKWZxxOY0SZ56SjDWmi4r8ZYrJ2oMZSR1p6MAn7/Ke BTDTIL7ZyTyexNXr9aM4P4K230w16Q4mGyL3pZjSCINPdGdhqVkKZRgAYA0FvamFI2T7 1zEUPzpE3AiPVefkgxi1iK+1xHTSdTaJ+ZPhY9rjq7ajvyTtLy/wAcV3++C2MSYnJx4L Q7tQoZR8p9bLHu84VYOMhphc6UO1yoMIWz3Y4k+YcoW15QuHGG1ef+KVGcgtEHTJW2YZ C1gq7pMuGhQyWsRNNSyU2f7b3L90xtLt9GE549P65ntog9z52gyPuG4yOoK+muL9PMLd 1yMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=0KlRjzQm22CeZiyIa7aNXzjG3v3++JjJtrb3QKuBlFg=; b=ijOgd5wQAS/BSd3QhEMs8Ggyy8BeYjOCsu9v2+Pfxu3KEVFTxs+1indBWwrbTXh6nU +ps7oFG3d1OUMtdQcxZTvEbtyOAfPz5cZiPUzpAS+VBkJknd5iQLxcbM4YyLjyHww10a +uYJQwSplglCe969zrMjeQg+X9K2iqET8FpY9EyMy4Y+Ir9aMKWAQfIAdYB5iqK2BlFh ptoJxWOZ2EhOSBwDZAxftc1G3o83IDkBkAB6S0Yq+/sFs4BNQXGXsOYhVRyv4DPsaNHs dvkN4NgSomxOPTfE79gnig/8vu9j0tqXXJAE+OaY+vJ4JV16tZe3aWfBTdcvFg8FoA9m sIPQ== X-Gm-Message-State: AOAM530PHzWszs6YTlhEvrtvS/3673hBPuyjswRRC87QvRiEafgYfHUC UVOyt640KbeU0mJuHoD/+Bn8jQ== X-Google-Smtp-Source: ABdhPJzPX9go0KIvC9xcUVS2o7b7XUzjSCHwzXD1enbWBXmTmvkDd73ZsDxOb7JjDszh15bMkfX7Gg== X-Received: by 2002:a05:600c:2298:: with SMTP id 24mr22948839wmf.10.1621928692250; Tue, 25 May 2021 00:44:52 -0700 (PDT) Received: from dell ([91.110.221.223]) by smtp.gmail.com with ESMTPSA id t17sm14740546wrp.89.2021.05.25.00.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 00:44:51 -0700 (PDT) Date: Tue, 25 May 2021 08:44:50 +0100 From: Lee Jones To: Ansuel Smith Cc: Arnd Bergmann , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mfd: syscon: Fix leak of syscon name Message-ID: <20210525074450.GB4005783@dell> References: <20210525001351.10300-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210525001351.10300-1-ansuelsmth@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 May 2021, Ansuel Smith wrote: > regmap_init_mmio duplicate the name and never free the provided name in > the sysconf_config. Always free the name instead of freeing only on > error to fix error from kmemleak generated by any syscon user. > > Signed-off-by: Ansuel Smith > --- > drivers/mfd/syscon.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Which repo have you authored this against? I believe this is already fixed in -next. > diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c > index c6f139b2e0c0..765c0210cb52 100644 > --- a/drivers/mfd/syscon.c > +++ b/drivers/mfd/syscon.c > @@ -108,6 +108,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk) > syscon_config.max_register = resource_size(&res) - reg_io_width; > > regmap = regmap_init_mmio(NULL, base, &syscon_config); > + kfree(syscon_config.name); > if (IS_ERR(regmap)) { > pr_err("regmap init failed\n"); > ret = PTR_ERR(regmap); > @@ -144,7 +145,6 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk) > regmap_exit(regmap); > err_regmap: > iounmap(base); > - kfree(syscon_config.name); > err_map: > kfree(syscon); > return ERR_PTR(ret); -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog