Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp319675rwd; Mon, 12 Jun 2023 14:09:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uM3IfqlyTd8K9Q4hJym3Ru172xpuyx0l/yTV6FYCVEUks31rc3tURlONfiBSHDTR5IzW8 X-Received: by 2002:a17:906:7953:b0:973:92a8:f611 with SMTP id l19-20020a170906795300b0097392a8f611mr10606812ejo.31.1686604190341; Mon, 12 Jun 2023 14:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686604190; cv=none; d=google.com; s=arc-20160816; b=PQRq150Jd8lU+uEs/1ktU+LcihN31C2UafGwzobeE6uH6zHzSWXVezlJPrbq/ieomD SIJGc1moQVCfJaSdV2g8auv+XKqmgNwXLmgLV/MKa/QzszGOA4V3mesQ/yy6G7SC8fPY whkiBw0o0XvMnBJiVF8GT6ayZ0JdzrB3EFx7z2fBfg8pfzz+MH9JwS3EZ/d8D5iw+RiZ 5CrbVUPN8XlnltCBAWqUVZk4R7CUvp+QAwN9P7f6NP+lRgtJCR6x7VJUVblNNEyYhHru GUbv5UrdD2hiCr386R/WRl18Pz0dQzFl/IJWBUp4w2u+aW4h0xS5jzGoqCP6WXl12bXV 8gmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cd2BKjHPLWDCu9Q1XribmDmWEMcXr/7r3+EV/zIKxFQ=; b=iSdV8n90gm5ewRI6jOuVG/ZCBm+Er4SiL1SDwKFdBJObfSKoTMOZ4EMla1PZP4Ymvi O6hV0i8dqpdeUPZGonsQEvYhlgW2WFqflDw15W+eSMKdi3W4DHEGv/fn1RGP1vF5foFL iBHtcQob6Pa51ZUCctP3lBAJaUZEysvO+iPXGymTG5JwNMg/4KuJDmDPS7RXfOfT9wSO Eiuq5C1N8ak/dLPefh2NZxUcsqS2ZvPyUAd/lpZT3xxhSOrxTfIusBQ1LGtzMNzfMXKq fJ3SpzvHFngCOhL4ZsNSpbbglR14zrUI2E6UhZ5e9hJCsEzL+5dWfzQgfovl6Pfz/buF aczw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f5bSwK5j; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kg12-20020a17090776ec00b009788d85f570si6075999ejc.631.2023.06.12.14.09.24; Mon, 12 Jun 2023 14:09:50 -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=@intel.com header.s=Intel header.b=f5bSwK5j; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238414AbjFLU6S (ORCPT + 99 others); Mon, 12 Jun 2023 16:58:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238410AbjFLU57 (ORCPT ); Mon, 12 Jun 2023 16:57:59 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31B501FD8; Mon, 12 Jun 2023 13:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686603218; x=1718139218; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=yZDu6jpDfsPrib6sgBtYsE6AHXoQX3x+qF2vtZtYuu8=; b=f5bSwK5jYaxbiTFpAv2N6YmjgQxmtVXb61WZLIgT7zT/My0FLCfEsNMK sI39WT+sxOXeIk5mcfS5cqPq1Rq13jqwCarmUjH+TNcafPr/8I6sq++Fn qfIGgwyFC0NoOcSaR5DNDUmlSIghbYqvgzdG/rV+HsnWkMuZ8/JFoJamw GW/WZDXha4JBDsQm4sCoy/0Sslryz+z/itq3i5o+r8MMLMnnl+8JtYePo jwLyraAJ48lZvIIBgnq8UgDqBBoaxHIlDYnHZP5yYclqe9O0EYNNrMcxo xwzUVLcFU864JqCNZHO6f6vJjmDQEsx4N24hV/NTlaXKuyXbeCgv464JX A==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="386547617" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="386547617" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 13:52:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="711361022" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="711361022" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga002.jf.intel.com with ESMTP; 12 Jun 2023 13:52:31 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1q8oWc-003Ipk-17; Mon, 12 Jun 2023 23:52:30 +0300 Date: Mon, 12 Jun 2023 23:52:30 +0300 From: Andy Shevchenko To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Michal Wilczynski , linux-acpi@vger.kernel.org, rafael@kernel.org, ilpo.jarvinen@linux.intel.com, hdegoede@redhat.com, markgross@kernel.org, fengguang.wu@intel.com, dvhart@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] platform/x86/dell/dell-rbtn: Fix resources leaking on error path Message-ID: References: <20230612090250.1417940-1-michal.wilczynski@intel.com> <20230612175205.eom2guabgfmnzrce@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230612175205.eom2guabgfmnzrce@pali> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On Mon, Jun 12, 2023 at 07:52:05PM +0200, Pali Roh?r wrote: > On Monday 12 June 2023 12:02:50 Michal Wilczynski wrote: > > Currently rbtn_add() in case of failure is leaking resources. Fix this > > by adding a proper rollback. While at it, remove unnecessary assignment > > of NULL to device->driver_data and unnecessary whitespace, plus add a > > break for the default case in a switch. ... > Hello! I'm looking at rbtn_add() function and there is also code: > > rbtn_data = devm_kzalloc(&device->dev, sizeof(*rbtn_data), GFP_KERNEL); > if (!rbtn_data) > return -ENOMEM; > > which is called after rbtn_acquire(). So it looks like when kzalloc > fails then there is another leak... Side note: In that case we would need a devm wrapper on acquire call. -- With Best Regards, Andy Shevchenko