Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2808142pxu; Mon, 14 Dec 2020 11:20:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2GHtPw8L9l3glDi7YbInJsDQoi/o5asaEt0uz6snoUFfP28YeNMb6015UvUafsusXCyUe X-Received: by 2002:a17:906:c04d:: with SMTP id bm13mr2535196ejb.519.1607973646239; Mon, 14 Dec 2020 11:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607973646; cv=none; d=google.com; s=arc-20160816; b=VdVYWT9JsiPx/FBlfFj8P3C/hzp5eq2D5yNYQTBacK+hNendJhNyBnPUbKW+YRI738 ZtMX1El4eh/jc6GW6xsGQ7zrZIrb2fflv194Tv0nJxZzWzWcfPxESV+bNDn3b4h3pDc6 DWep4qQHKSBXV562gNzn4svOQ+egZuRJ37VfSUA9cZRsfM5B6A+ukB/VCrOqScgPT456 sG5XC9GtNNHywKRoBYtB5L3751SPncfNRh3ChHAlMvr4Af+/TukTJZE6IYpn8l2FE8Ws kD/T3fddyrx7CtLvnZF9EgaCdEsZEpMmPsUeQSCzkP9IzYKhza78ePqiCE04bfdQnvV2 dYbw== 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; bh=RD6zn9QD6FutJEAJ55UoJFxWv+dY8zvewIOLS4c3m5Y=; b=puGmHQer0tnwoqsNu2Dj3x31NcJhQ3VecR+M/lpw2pz5PXD+YLB+xfOUqflYSiKV86 B82Ku4kVdOTZ4CDEwbHWdIDfLLc5j3vcelqOd/dqyAWWMNRuqJmbj50ABU4oxB5yx6xU o9j7vDiZioD157LJ9OeuM+hzD7mvvuPH5MmlkzOqd0lUGxy9jW3wbESkaTrgna8xKoDt /siy7tZXruLoy0kAeIgccc6j1/su4qopcULZ7z09QtjAg/r8EA+lVOyvDS4u8RrnY4o/ xBTdGDhr3P8brh6uM6eEdBjsO3EDSpSpAEtA4e1WidPv4Jdijlrc+FXDQ/pDGzMWGxOM JAtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r24si10870746edc.286.2020.12.14.11.20.23; Mon, 14 Dec 2020 11:20:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502342AbgLNTJI (ORCPT + 99 others); Mon, 14 Dec 2020 14:09:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:46104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408585AbgLNRhK (ORCPT ); Mon, 14 Dec 2020 12:37:10 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.9 028/105] can: kvaser_pciefd: kvaser_pciefd_open(): fix error handling Date: Mon, 14 Dec 2020 18:28:02 +0100 Message-Id: <20201214172556.633733426@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201214172555.280929671@linuxfoundation.org> References: <20201214172555.280929671@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ Upstream commit 13a84cf37a4cf1155a41684236c2314eb40cd65c ] If kvaser_pciefd_bus_on() failed, we should call close_candev() to avoid reference leak. Fixes: 26ad340e582d3 ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201128133922.3276973-3-zhangqilong3@huawei.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/kvaser_pciefd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c index 72acd1ba162d2..43151dd6cb1c3 100644 --- a/drivers/net/can/kvaser_pciefd.c +++ b/drivers/net/can/kvaser_pciefd.c @@ -692,8 +692,10 @@ static int kvaser_pciefd_open(struct net_device *netdev) return err; err = kvaser_pciefd_bus_on(can); - if (err) + if (err) { + close_candev(netdev); return err; + } return 0; } -- 2.27.0