Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4036397ybx; Sat, 9 Nov 2019 07:59:31 -0800 (PST) X-Google-Smtp-Source: APXvYqweHMoI8Ei3nCuuYIgSlNjRfSK9euerCTWOM4hrXcLqG3MTzdeV8YiioxquqqD57M3tnUbh X-Received: by 2002:a05:6402:2d6:: with SMTP id b22mr16842350edx.133.1573315171876; Sat, 09 Nov 2019 07:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573315171; cv=none; d=google.com; s=arc-20160816; b=W6m2AfrSTAJzE9hmtGTFb0aFI3TVpa1h36LD6F1eskFmBnAtUw040TtTWIr/GbGebC 71FDcRyR9NolRaFq8qSFnrzOmBVLpJHPWPLN5bBZ6UZwJiJnVA2wuFZ0lTzPfifL7Mn8 qPJt6nNqHMXr95JXQHHIqLJziyDpFFXAyeoAKsZE05fAkKz+3r7fZmoHdSOXM3dlfTI7 Fj9A2ah8X3adZILmNZRAf1jiVB8MWTGYFgq48xBeWMuhqNslIUgXgrRr+OvwglbAJLpa 5aJQmNNKJJLLaPm4JsNjDsMh4YpvUl7Pn3w07HC+omKJ9zDxSrq1JXyzLWXohcN0J0Hf yU1A== 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:mime-version :message-id:date:subject:cc:to:from; bh=HyKlstPb0e1dkJzB2i1z26VUTCW9LHA/GdxUscvOcvk=; b=EYhchB5JzXrKdvW7JzZOZxP9PFMr9Au2n7twZ+6yFlaOxlLpR6W59P1sg5LdEzsoLF OldVCP+s3gKvYoXuYMBJ3gs5fXhqLPIaMXtG17ccohkvCEErmiJCSkzmWJcDaYNsryNh gbNUXtwSlbFXrxKOx9k/KwrI9Xe3969PuhwFs1uUgoLqun6jL8ihfNlSEGdBspKDBVzf XDhnEbLplUiRwsRB1a1NHrLIqgG8lBcPM+jYieiTsH7dKVJ8IZYfGMjOLjNa2tlzx9JY 8qkZb7hS3JMDMDh9ejGqYO00+65Kjvx/1CDWEHpQ0wr0a4JhY+egwnGmPutbqddSWNx0 oOGA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2si5986022ejx.364.2019.11.09.07.59.07; Sat, 09 Nov 2019 07:59:31 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726240AbfKIP6j (ORCPT + 99 others); Sat, 9 Nov 2019 10:58:39 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:37742 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbfKIP6j (ORCPT ); Sat, 9 Nov 2019 10:58:39 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iTT8G-0002aK-GI; Sat, 09 Nov 2019 15:58:36 +0000 From: Colin King To: Daniel Lezcano , Thomas Gleixner , Bartosz Golaszewski , linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org Subject: [PATCH] clocksource/drivers/davinci: fix memory leak on clockevent on error return Date: Sat, 9 Nov 2019 15:58:36 +0000 Message-Id: <20191109155836.223635-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 clockevents") 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/timer-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