From patchwork Fri Jun 19 14:31:15 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: 191214 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp603512ilo; Fri, 19 Jun 2020 07:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDy9cuvrX3UShvVu5YLWE66EtBVQk1XQrdc7YHUcWamYbL1+YI+6pOIEDHHxokzuWX4OhA X-Received: by 2002:a50:e387:: with SMTP id b7mr3626517edm.190.1592578698504; Fri, 19 Jun 2020 07:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592578698; cv=none; d=google.com; s=arc-20160816; b=QqmcvEzvUx8r2ZDPeOaadVyBpSBUuLjviQO4gXvztpC2jFsUbpt6fRdXVWrr7+d42l +VcNCRxH2e9L8bj8p2KPoUDh7n6TW9xseaXAwSlBTEA4ECsOxvmXg/UK0IqLwIXtEW3H w5Woz3iw43tTh9ryGtMfkGlL+4cZopmqI3igYRtyCma203xFEGWungQpY7mx/qUR5t2z /GqBviWaazGqXRlW+M9yrl7019jAVIF0wH3P6G7ZZVVbh0Rj9a+Sdm8f6YArZVbjjzQJ 7I/8sHtci8LENTUBcjVvaCxgncwlMawQggUYWvVrMCuQWY1dpgegK0fXFzTMoKBbczlB eVBA== 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=sShzhlyU8Z3GRVUfM5OBUssBBlwN9PBQky0zeq22M9Y=; b=t3iu8XeV9rNcxjbSRllAXkF8BDLeLYKFnoYrdVIqhfr6vRN+5Jt2Q+KGspk5V6RDPq yVy1HBbtncYYOWgt8+UNH27Gh9wd98gnkiEMdO0qXB0WiwMgILfsjA17LTko0LqkTysA JCosKngouh6fTTbgaU5PvPV5XEm1X14VTnSgT4uz+XJf+FCN7QrZe5Zh+GBj8rLt1czD Ktpwh+g9UwfEpDj2884nDb/ENMSqIPyv1RC9pGq1+Rc2PuJp6t3vu6AViw9XvpGCBZZ3 o0jpU37JxElDHK9CLnnw70QxlxVbDRGo7Tju3z6uR6r6zzf3ylvktACy/yiDrYlmCmn8 EsWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GGqvF10m; 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 m19si5184729edb.335.2020.06.19.07.58.18; Fri, 19 Jun 2020 07:58:18 -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=GGqvF10m; 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 S2390365AbgFSO6Q (ORCPT + 15 others); Fri, 19 Jun 2020 10:58:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:53898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390361AbgFSO6N (ORCPT ); Fri, 19 Jun 2020 10:58:13 -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 82BC621919; Fri, 19 Jun 2020 14:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578694; bh=5StiBJX239xbQ2TBSQhispyxs0136n1QRkV2NzneILo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGqvF10m1kJS0uI0o+p4+B9LDHt3/N0fFDbNyVO4YcKjKu0h/ktqwwYpkoEVUooW0 DM0nDYRoZCsTKfAKjgbzs96Beof0Fti3N7jNO72gqZgkaYUXwdL8K7QS9f8bh2Km8k lH4enfCoSfOPA2aQPn4oC0C0evqJnMxcFE4oir/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson Subject: [PATCH 4.19 090/267] mmc: sdio: Fix potential NULL pointer error in mmc_sdio_init_card() Date: Fri, 19 Jun 2020 16:31:15 +0200 Message-Id: <20200619141653.187262591@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@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 @@ -720,9 +720,8 @@ try_again: /* Retry init sequence, but without R4_18V_PRESENT. */ retries = 0; goto try_again; - } else { - goto remove; } + return err; } /*