Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5153049ybx; Sun, 10 Nov 2019 08:03:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzA5Oz0zVgwXHYVgr6QsHTJHFt8fcuDcsdhgBY3Rkqyh+j+bdh0aXnkZSK5yUnskK/MH2C0 X-Received: by 2002:a17:906:6083:: with SMTP id t3mr18720171ejj.145.1573401817862; Sun, 10 Nov 2019 08:03:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573401817; cv=none; d=google.com; s=arc-20160816; b=R/Kp4fACe02WhywUjPhlpdz2Zscl9O6UyEfIRI8qDvGp6KkNxMQuy3GqVi7/2l+vuF 0iE/m4lsxIEabvaeojedYf6ESXCtiTiALmxu8pG4lvGq4gqT1abh9Hk9pxyCENA51c2N 43XKw2G06kyD/t3bw2UeFlw1AW8teJJBEHIF6W1qqHHm0AXys9/1Gzf5IRF2YYMvXn0s +wUFPNORbVVGMZay7XsZHWuw/0Ndu3MH/nUgQV4XB/mnDej6lmYkXTzhn+/V242dq4w9 TokcUPOusxcLpLoAVfDTJqRpLlKBbvQ/8kle0h5uOblfEt4yxP3g4EimeqDovq2mohYF Df6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=h+YUD2WvRKAp40jyOGFeoD1xEis0jky10NsQDZqufMM=; b=Y3FquWf34TN6r2XYSJdaBJaKpfsUM9XuFBm3M59gvGs19F6mn0hcy4GtOASzN4r/NB CKutJf0oOAXVC3IhxTXw3uHwYDrOaedpHlrAtbsEP3hHHAA9a+Bj9e1TVhLaxflVWDtg l5XphwuGpA55lzQ+R2aEU2NuSfJCYDsDa7gsf9SfryZehszzvh71tqZ+3CqXFyIEG+ul CPLwEXs6gmN/3yGSxhDuIMtHdCCcinijkUjAp+tjhm7Sr3exU4Wfi2D79OUaU8x4Zmcy 7r1IlCWoj1F/hooq8U51GqMArtOhiRDxjGW3c8u+8VAjika6aB3Znjb0Y+y8/4Uh3vuE 4K9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=DCyns65O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si4si7632191ejb.156.2019.11.10.08.03.14; Sun, 10 Nov 2019 08:03:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=DCyns65O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbfKJQAB (ORCPT + 99 others); Sun, 10 Nov 2019 11:00:01 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:41673 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726800AbfKJQAB (ORCPT ); Sun, 10 Nov 2019 11:00:01 -0500 Received: by mail-oi1-f193.google.com with SMTP id e9so9427988oif.8 for ; Sun, 10 Nov 2019 08:00:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=h+YUD2WvRKAp40jyOGFeoD1xEis0jky10NsQDZqufMM=; b=DCyns65OmKpHr/7szeQZBS3eagcFeBLXjv4ZVnFzoV+n4a20e8HrXBrRvxI0KmBrpS LOOYGOnHCEWM6Vl2YgorGNhBH+aryiMHeokXLl+ewlzIBye6/4ttf+eWp/AYvUHVwV1j N7Bw5rqBWP4SykY7R9nDjtlQcbXt8Vj17FuVc/no0uBQvaGjPS8R0XbfLEw/xQC0dj+V z6LcJQMA8QeivurTYYjDU8o9RT2iJtb6GRqmbnXTrB0Tlctqdwh3WXvh+Vt28E/BYpu/ KYs6JLyor+jiciIEIZ04R9WT4+iCH7WdFKDYcWJZUi4HX8R6A4igsFdteCcjPoNZMIw5 /9uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=h+YUD2WvRKAp40jyOGFeoD1xEis0jky10NsQDZqufMM=; b=X26oDbhJgjkpnv4N9lhRPEH0x7gygFFP7pEwyUvZZ3QGhTZUHSoBzml0mSAuOodvrx LWZtEgl9f/4CLAmtvNyndzVv9cHAYgD2iS2Gy+PQdlM+n0KskIurBINOdOnxb/nRNvwY XaM+6x2lMIZ5Gld3vEF5D2JWa/h7lQri7oV9LqV62NpCQARP6U0DsAnsTise55Dp9gO6 KZc+JbJBuRBHQ8LtBYPSLt42yorrvkJHeYKzs0Pz6XVHAannrLNGwvyyjYYweK1F+9Ed wfzpG50F8d9AZBKp76tOsioBPkUJ02j046SVr/GUYc/B08R+LF2TxhUV+Dc8h22jwEgk hE2Q== X-Gm-Message-State: APjAAAWfiW5WUTfNmgA4IGAmn53Kw9drqdL2ZXigWDn85cT7Gk4xa1x+ 0KQilhGAo6P5tMJYp1e9y65+IStCQnGY0eoImrP6CA4V X-Received: by 2002:aca:451:: with SMTP id 78mr20238408oie.170.1573401600442; Sun, 10 Nov 2019 08:00:00 -0800 (PST) MIME-Version: 1.0 References: <20191109155836.223635-1-colin.king@canonical.com> In-Reply-To: <20191109155836.223635-1-colin.king@canonical.com> From: Bartosz Golaszewski Date: Sun, 10 Nov 2019 16:59:49 +0100 Message-ID: Subject: Re: [PATCH] clocksource/drivers/davinci: fix memory leak on clockevent on error return To: Daniel Lezcano Cc: Colin King , Thomas Gleixner , LKML , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sob., 9 lis 2019 o 16:58 Colin King napisa=C5=82= (a): > > From: Colin Ian King > > In the case where request_irq fails, the return path does not kfree > clockevent and hence we have a memory leak. Fix this by kfree'ing > clockevent before returning. > > Addresses-Coverity: ("Resource leak") > Fixes: 721154f972aa ("clocksource/drivers/davinci: Add support for clocke= vents") > Signed-off-by: Colin Ian King > --- > drivers/clocksource/timer-davinci.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/clocksource/timer-davinci.c b/drivers/clocksource/ti= mer-davinci.c > index 62745c962049..910d4d2f0d64 100644 > --- a/drivers/clocksource/timer-davinci.c > +++ b/drivers/clocksource/timer-davinci.c > @@ -299,6 +299,7 @@ int __init davinci_timer_register(struct clk *clk, > "clockevent/tim12", clockevent); > if (rv) { > pr_err("Unable to request the clockevent interrupt"); > + kfree(clockevent); > return rv; > } > > -- > 2.20.1 > Hi Daniel, this is what I think the third time someone tries to "fix" this driver's "memory leaks". I'm not sure what the general approach in clocksource is but it doesn't make sense to free resources on non-recoverable errors, does it? Should I add a comment about it or you'll just take those "fixes" to stop further such submissions? Best regards, Bartosz Golaszewski