From patchwork Tue Jun 16 15:35:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 188066 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp3774514ilo; Tue, 16 Jun 2020 08:57:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeRgXLw4yHHwxSqlw9bTouPBR2Ueh7KZe3h+qEUemguUGf5yRpdqQY3RMRaxKgKfew3DTm X-Received: by 2002:a17:906:1386:: with SMTP id f6mr3453965ejc.66.1592323047098; Tue, 16 Jun 2020 08:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592323047; cv=none; d=google.com; s=arc-20160816; b=t15S7QBREZ2HHwIW3YdTX/bZmMcCj2bFgFDIK+7VWAUSCWe3of9aa7K159dwRSB8iO iS7TTBTWGDey+xbQaY5/WGnlP5R9c6X9xaET5nMhwhZWd+te0LsWF2+FljDWSmxjjIdF Lbkn/Pr2M4hyPeYYI0fIRWtLH2ew+vDX+0U+NZY2tnl+hOzljfHzXSnNPIzokEzOy6fs 9EajB1af5Tbp00oVMk2Sol3ks8ozHM/OuqB84N6mCeFy5lwuNjx+eqMditm9DFWePh+I 0bq3o1EurnL7sl5lUdZPFzRNahGg3PcYBBMv5MsjvaS6HYAodfuEHh9LJLlyXQg0D1Xv T3hw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AmRCjRMKV9CpHN/C0t/k/XJH1ifINOw6N3zAZ6GLULY=; b=WxVjDgJzfttT+3KiLkSnUAy/nc3iLyEBb6y1lA+oRt8I3zaZkPGx0yrYPhU23mxdYz 1Po4blDk2rNlIwKgD0WU5ggx+mp21T2fjDYmOHynI6OvkFn3DXux7JJBH/8ftqHV19kC uvcX2cKei5OVteKPLesa5r4TcIxzHI8ZItFEgV/DVoAN5wkStKNTwI7QX8VsPkIwwDmH 7xf/x0ukYGufIVHAs1yW3MsBxJ6PztYnhf9PDzL1XDxsm1ipIbBpWmOD/tf6bkK6YPAq PeEqB48vq+PM1doVOLk4x5a6uKlPE7X8uE9L6SRQn6pTPJUMaimaXLFPQriTKZiU71Sb c9tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CaLMMgbl; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si11191989edq.44.2020.06.16.08.57.26; Tue, 16 Jun 2020 08:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=CaLMMgbl; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732084AbgFPP5Y (ORCPT + 15 others); Tue, 16 Jun 2020 11:57:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:55318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732447AbgFPPzS (ORCPT ); Tue, 16 Jun 2020 11:55:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 2BA51207C4; Tue, 16 Jun 2020 15:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322918; bh=REfJ7+ONixLxyVEXno+zYpwYGwcixL3r/XPDzbPOx0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CaLMMgblH3Veshfe4s4Ldun9nV/VkyTK65J/bJsGRM1rgj8x2QdVdPZMiWFjXsrng EPvLDaJIdcj5qGy61Ql/uPSGZ1I+h2X5aJ1nIStGbfAvxZX/fR0WPOT1M9ul0t0MzK 6MPiJdRdj/ORCh5Bl5pWz2ggXXD29Hccwlj/9TjA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson Subject: [PATCH 5.6 154/161] mmc: sdio: Fix potential NULL pointer error in mmc_sdio_init_card() Date: Tue, 16 Jun 2020 17:35:44 +0200 Message-Id: <20200616153113.682730368@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153106.402291280@linuxfoundation.org> References: <20200616153106.402291280@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson commit f04086c225da11ad16d7f9a2fbca6483ab16dded upstream. During some scenarios mmc_sdio_init_card() runs a retry path for the UHS-I specific initialization, which leads to removal of the previously allocated card. A new card is then re-allocated while retrying. However, in one of the corresponding error paths we may end up to remove an already removed card, which likely leads to a NULL pointer exception. So, let's fix this. Fixes: 5fc3d80ef496 ("mmc: sdio: don't use rocr to check if the card could support UHS mode") Cc: Signed-off-by: Ulf Hansson Link: https://lore.kernel.org/r/20200430091640.455-2-ulf.hansson@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/sdio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -718,9 +718,8 @@ try_again: /* Retry init sequence, but without R4_18V_PRESENT. */ retries = 0; goto try_again; - } else { - goto remove; } + return err; } /*