Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp498535pxx; Wed, 28 Oct 2020 09:41:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz29neQuJka+7h0DpSxrm6QWYwD6sj3np9Mf+oqUVgzmS43m39EnuEIHpdj/40rFrqioBE1 X-Received: by 2002:aa7:c90a:: with SMTP id b10mr8706211edt.163.1603903279648; Wed, 28 Oct 2020 09:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903279; cv=none; d=google.com; s=arc-20160816; b=XOwmT1LUzid3Z6yhq/nzLu1jEVtw35vv11W6dSAfJs5VROazXvLDqgJeNJYrwakbQS bWeHcA1mrbFwjHQwT+VbWJ5tJ+aRRDuq792qqA5RNGyqWj6d4A0ABETVzgAhKpfLG8d/ Ujs8yCdHZj1SgoJ7wgco8rzhjU+VI+Wlmw6eEZ5/KlGxdxRD/qFuJFA3C6EuBIlBv0rc OdRFf6cs8cjsn2rOtgJ/W6EQppkjO1eDYxk+1N66unA7MDgBkE9U2QAs2SMlY236Hrmj cq7Cv5lxje8vuGDRKqRHbUvLS9/Q8TaEE3AR0QDY9vTVeRfpV8/JWW1Y4nzNtM6sf/2K xZNw== 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=Jbht4an+9TrPAVCSvmi7aSgkZaNF2mFrhZiOJnI5RDI=; b=ZkYygrjfIGK2tP//IPA3yqKoFvGoboZ3HLW4gGY6Gd321Ld/qMli3jgtYhqL5G3HNg fDNl0Y8suME395n8ftD2oFpTXv1+f3dE0hVGdX7Et9EqVgaROhpmOTyRmQ2rVN/6pmLf IiKiLRzAUjUGZLOasygfgRhxquDIaOjH2lGUt//eUMl8c9o1Tv1FD2og9fhKkrJ4GZox VqQ/gfuuKjj5YlTyuq47Nv0o5kw7uZDO/GyC1YCHBUuUOuZ4R4RTK1LOJ33hC0mQ2eSl Vb7XumAutPwRnGFqzTwHt42AYaqyIqTVGyTZ/cmCygyJaMBoGDzOFX4TBUO5dzKBERdF tCWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dimc2iUU; 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 i9si3854304eje.410.2020.10.28.09.40.56; Wed, 28 Oct 2020 09:41:19 -0700 (PDT) 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=@kernel.org header.s=default header.b=dimc2iUU; 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 S1818170AbgJ0RRy (ORCPT + 99 others); Tue, 27 Oct 2020 13:17:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:58244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752688AbgJ0O5V (ORCPT ); Tue, 27 Oct 2020 10:57:21 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FCB722264; Tue, 27 Oct 2020 14:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810640; bh=7WraC83vZtyV3v1YKsMF4+NWyB+Vdlg0yhD/SehfC5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dimc2iUURC7Ztw3qPNKosnCvQUXmAshlNztIjyb2l882Q/3OPAe3JoS8UzT+tzxcp t++7jWCnhFhpHTCIVLHFHPTw4TsMEJTwJzKLx5g3at7oj0JcavTyCEXzA9opR0Vq2N AC89mlm9l8wiUN/GJxMEpaqxRmXCdSvrYqqNUqgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Ajay Singh , Kalle Valo , Sasha Levin Subject: [PATCH 5.8 180/633] wilc1000: Fix memleak in wilc_sdio_probe Date: Tue, 27 Oct 2020 14:48:43 +0100 Message-Id: <20201027135531.132473554@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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: Dinghao Liu [ Upstream commit 8d95ab34b21ee0f870a9185b6457e8f6eb54914c ] When devm_clk_get() returns -EPROBE_DEFER, sdio_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 8692b047e86cf ("staging: wilc1000: look for rtc_clk clock") Signed-off-by: Dinghao Liu Acked-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200820054819.23365-1-dinghao.liu@zju.edu.cn Signed-off-by: Sasha Levin --- drivers/staging/wilc1000/sdio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/sdio.c b/drivers/staging/wilc1000/sdio.c index 36eb589263bfd..b14e4ed6134fc 100644 --- a/drivers/staging/wilc1000/sdio.c +++ b/drivers/staging/wilc1000/sdio.c @@ -151,9 +151,10 @@ static int wilc_sdio_probe(struct sdio_func *func, wilc->dev = &func->dev; wilc->rtc_clk = devm_clk_get(&func->card->dev, "rtc"); - if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER) + if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER) { + kfree(sdio_priv); return -EPROBE_DEFER; - else if (!IS_ERR(wilc->rtc_clk)) + } else if (!IS_ERR(wilc->rtc_clk)) clk_prepare_enable(wilc->rtc_clk); dev_info(&func->dev, "Driver Initializing success\n"); -- 2.25.1