Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547588pxb; Mon, 24 Jan 2022 11:57:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDL2o4Xzx3pV6hByRNnHYRnwdXpAOd5PrJQUmKmRUjIDiq+2TjQLAgPkMnXJ7wrc6F8p3O X-Received: by 2002:a17:902:6901:b0:149:4e89:2d45 with SMTP id j1-20020a170902690100b001494e892d45mr15272171plk.22.1643054246223; Mon, 24 Jan 2022 11:57:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054246; cv=none; d=google.com; s=arc-20160816; b=TKjcEuZBsQIKFNWmc0J30lszFW9oX7W3sYWbvTfws/m8x1cnPuRtOsJw8rYGa3zT+R HFwLvj5+dqZO3y+8VQwQBfpvzai/x4vTdKPqQBVg4DD2br1JRaJ7F4TzlQnEH2cLuVzI mfIINe9jpm39Zg0iByWY+W0XVzG6sz9ttlBnogHz8lQkm7omVZvxdmF1GudOyIphG1R5 6mysYEDjp8Mv4UfaBEKhnwwj1uYDslDJIYRMO1mHjNSUk2J8f/bOsD0kftezUgDkriEK BqSY01KlQxd8O6czZLRR3yaUNRF/h+locZrrKK5jHuHBi3hCsz4Y/3GVa6aSjb2yUgFo /YMA== 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=ZYx7mt0d1J6fgXTZKAWOp5kObR6QXaT77wnOuj2eZxU=; b=jvugA/nZnm+g/eijFztcEKxra9WDf2IrmU7gOuPOs1gsPr4PDr8JmT3fIUx7Dbei8n b///73n7uMLSs70u3zOuGBDGUiz+sG4EUFNb8E5epuMUEDmfe4Am5Yr8/ezkvWf2hq0o dnRb9Ymo0G3tXTSO9JoAvmGG1iFS6J6cu1/m3LtlHd5uOHsoOxvOpEome6CFPr4vXmCI wow8DXY55x+Mc4o0Z3BlMEH4RejoHyiAw02uQC7Kh1ZhnjTP9TlBLiXkcBOwF40QWKuS aVIHOyTo90Lt9AZMRqSv/jCrdTy4E/79ifxMItKwdKiUp3MzZrwwjivNLAWsnRhUF4CC 0PYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LzrFVwgV; 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 w25si13462099pgk.153.2022.01.24.11.57.13; Mon, 24 Jan 2022 11:57:26 -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=LzrFVwgV; 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 S245620AbiAXSvh (ORCPT + 99 others); Mon, 24 Jan 2022 13:51:37 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49258 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245386AbiAXSub (ORCPT ); Mon, 24 Jan 2022 13:50:31 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 94A4B614E1; Mon, 24 Jan 2022 18:50:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C742C340E5; Mon, 24 Jan 2022 18:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050230; bh=gTiAsola0UWMwwPm3YlisJWsAT/oMqMZKVdHyRXMZh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LzrFVwgVwkgdQytjt1k6vbyywv+o4h4vHjtHIn17Z+nqGrFiwjMMcGqt9uXSyoGXi Bwd7B18PV9FS8Y4h6tUIMU2ZiwImDBn6ilBD0/koL1hAs7I9jdXM3p4T4/TBU+JMc2 UiJirk5SU2EuyOxwNNGcUffO0TM0NRDujj2mfgzs= 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 4.4 018/114] can: softing_cs: softingcs_probe(): fix memleak on registration failure Date: Mon, 24 Jan 2022 19:41:53 +0100 Message-Id: <20220124183927.678729716@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@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 @@ -304,7 +304,7 @@ static int softingcs_probe(struct pcmcia return 0; platform_failed: - kfree(dev); + platform_device_put(pdev); mem_failed: pcmcia_bad: pcmcia_failed: