Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3622121pxb; Mon, 24 Jan 2022 13:43:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJz21GVl3GtaQp8qwebNFLQhuk0fwVDdxVgoypvdJO62to9+G17MIqCzbCC5SFCmkV5ipdJy X-Received: by 2002:aa7:91c2:0:b0:4bc:6c97:401 with SMTP id z2-20020aa791c2000000b004bc6c970401mr15645727pfa.17.1643060623707; Mon, 24 Jan 2022 13:43:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060623; cv=none; d=google.com; s=arc-20160816; b=lwvHs03lH3wLcs2kBwxyjbLkQmMVoPJ3N0qNzceLn1z1OphOPCJE+MjYkU3MhULjVy PtMS8rvNldre9B+v0aJtsMxg7U1mWYLIqGkkFB4BdQ05jgybpKTvTwZm2bJRkPvt8hyB dNei87R7Dzwn21Yu9AOCg7fzxflhj8QzDjotoj3CBDwN+1TebbQGEZSF6zD0EuIVHRT+ a0U4otuwaH+++eU2c0lO5fLVybGvqe3NO5376z4SkyVat0xzj5kFWXTJv+bvQu4gKUUD zNGnWdOQqXtaJloAV+BEARaOUFxTvFpUCyB3idQMBv1/P/olaFcels5vwd+/l4DK07Q6 zO4A== 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=U7tqOKJzyvVhZ1rjHRQAS98nwq2mVBy2IRnbyZvURaM=; b=kxfbr6LuOemRAVlRAvpaO1lPnltqEmJ5u3hrESLn6Nhwd3MbbrmSbYwuP4ywBswsQI fFEFXeLr2vmYLY/za901baqiLZv0A845XV83z2apivrY36FizMRWpmvKUNjgF5wKwncq dMF9HYRCWGrV4cgXFmxAvmvlEqBOCHHZqnyDTLyB/OX4PV21elSvglUNsQ2J9VuLkCHI 8XNeTebzMX9DljwHANzmQf+1Z3XmP09mcefzsSp0W+KopB7GwF4xiUYdBhOzEZI5tSbB dhKqB0dAh/FKfABIKCJ2LVqZX8uJkl55WZInEVrHVeehbUJ14rI1ET1KRr5PhKDqKDhV zIFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VGovbQQ8; 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=pass (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 e32si14679586pgb.614.2022.01.24.13.43.25; Mon, 24 Jan 2022 13:43:43 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VGovbQQ8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452017AbiAXVX4 (ORCPT + 99 others); Mon, 24 Jan 2022 16:23:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52278 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443427AbiAXU4z (ORCPT ); Mon, 24 Jan 2022 15:56:55 -0500 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 7A14FB81233; Mon, 24 Jan 2022 20:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34D32C340E5; Mon, 24 Jan 2022 20:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057813; bh=iQYvZKOwn04GejAiJzx17eTC96LSLpLWKisII9IwQuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGovbQQ8iZrMN1opNtHCEg3aU7IhOWNDQj/6KRPWdFMdI4jdiMLhUXebtr8fnw/U7 Z16HhZZ6qbJYVPbRTVeIf/vSYd+YjtjEkQNbBEIPyTeVnh0RX/e2B9VXxC/M+t2oqx 0qzbZGkvEtds2dsHOtPuknwJuqdI3BXBh6hgGLOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Marc Kleine-Budde Subject: [PATCH 5.16 0055/1039] can: softing_cs: softingcs_probe(): fix memleak on registration failure Date: Mon, 24 Jan 2022 19:30:44 +0100 Message-Id: <20220124184126.998671788@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Johan Hovold commit ced4913efb0acc844ed65cc01d091a85d83a2082 upstream. In case device registration fails during probe, the driver state and the embedded platform device structure needs to be freed using platform_device_put() to properly free all resources (e.g. the device name). Fixes: 0a0b7a5f7a04 ("can: add driver for Softing card") Link: https://lore.kernel.org/all/20211222104843.6105-1-johan@kernel.org Cc: stable@vger.kernel.org # 2.6.38 Signed-off-by: Johan Hovold Reviewed-by: Greg Kroah-Hartman Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/softing/softing_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/softing/softing_cs.c +++ b/drivers/net/can/softing/softing_cs.c @@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia return 0; platform_failed: - kfree(dev); + platform_device_put(pdev); mem_failed: pcmcia_bad: pcmcia_failed: