Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp871000rwb; Mon, 26 Sep 2022 06:58:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4lEj1V/mMZ9GAxyJpc5YK/eMlK7PTXEGYT2cN8KNnXKreXyPLBBzMoVU/NPJd+3mZ6DTp7 X-Received: by 2002:a17:906:6a04:b0:782:d25a:14a4 with SMTP id qw4-20020a1709066a0400b00782d25a14a4mr11385170ejc.572.1664200732660; Mon, 26 Sep 2022 06:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664200732; cv=none; d=google.com; s=arc-20160816; b=UJl9Y6WlMxQZ8pBNtOyH8PoAGBH9Q80uce4hZK1ZmfONw/pionwOp04Z6Q7FJBs42/ Z42T37+p/pvijsbv7ZDcom4NX0LsXaLitnF+91AzFMJ6Z25y1QGXw8LSJN7RpI+kUBuI PZt5PiKe4fx+2y19y5bru6tV2llvLW0fQ4gXhen5TfDmHuf+p91puLhxmoXPF1haRujQ Q4wLRBtwK9L+XOYXIyKPAugffV72yAYgeyH/D6Vy5YcOiQ6FfnQP8NfQxFx0dDj765gC SMhYaH32+SmK7no0rGp0ncqmdptQomiSoLnchEGnHeL4g9KxlSvt+84CYRUxtlnzX1Ru RT9g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/7ui8ZYWQg6wYEo08iMQDhNodqpGdCuoTzEf6EQ9ZAI=; b=W/mnJx59pvEQ9KFqST04yvMTsBXpWxASySJOk1baWWgtS5/4AJ/xxbLCg4WQvMowal VD63kIKjjzqfS4jjpjfxBg8TBxTxdx9x6YYMey4VpxCM80zFbu2Nh8TkZXvBKKDlNHmL oybKW02qKVYYdsjG+JbNNpniWEnuYLYgwjsYOGTJGbTnXOe+dRMPdUulM2OrUhBK59W5 sFr+Buzhzgornex8vRTm6tR7N9yd+5/kx6vyz1SKDmXBiEM1PrbD1MdtW4PeuhsLpueA 6DE6JYxUhmxIsYRUeppDEG2M+KEia0LVp7zkjAaBi/mKRuxNIkL3EtDZSY8BA4/WsR7U EvcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="i/l1YqAh"; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a170906d19100b00780024e0d1asi13681376ejz.150.2022.09.26.06.58.27; Mon, 26 Sep 2022 06:58:52 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b="i/l1YqAh"; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238109AbiIZLhV (ORCPT + 99 others); Mon, 26 Sep 2022 07:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238101AbiIZLgP (ORCPT ); Mon, 26 Sep 2022 07:36:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B1EB494; Mon, 26 Sep 2022 03:44:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2A69B8095D; Mon, 26 Sep 2022 10:43:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE6B2C433C1; Mon, 26 Sep 2022 10:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189035; bh=FNlNUpO7zOVpbzBzSiXTkd1MoY2CKoYDpVut8xj5Jag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/l1YqAhjNVDGRWH1sS9UtWHTfpxVbcZjhZa/mB+e8miEJ0NCppL+jlbBV/YemA7+ 2+sPo6//AmLY8foA9oT8N+Zj1Pz5X5ZVDbXwAAN5iDTzTqkZ5f5CVDnzg98+DQ+mjr M+UBaZT3lHEQJjxof6Ig99cb/kqkPVIusgB8wM6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Bartosz Golaszewski Subject: [PATCH 5.19 052/207] gpio: mockup: Fix potential resource leakage when register a chip Date: Mon, 26 Sep 2022 12:10:41 +0200 Message-Id: <20220926100808.957917375@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Andy Shevchenko commit 02743c4091ccfb246f5cdbbe3f44b152d5d12933 upstream. If creation of software node fails, the locally allocated string array is left unfreed. Free it on error path. Fixes: 6fda593f3082 ("gpio: mockup: Convert to use software nodes") Cc: stable@vger.kernel.org Signed-off-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-mockup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -533,8 +533,10 @@ static int __init gpio_mockup_register_c } fwnode = fwnode_create_software_node(properties, NULL); - if (IS_ERR(fwnode)) + if (IS_ERR(fwnode)) { + kfree_strarray(line_names, ngpio); return PTR_ERR(fwnode); + } pdevinfo.name = "gpio-mockup"; pdevinfo.id = idx;