Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4092861pxb; Mon, 8 Feb 2021 07:47:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzn/MiaumJwBnACnZe2giv5vAzTrksHjbUSfpRXABhZUi0rojtD1HnPjsyFUFMjF6qVym5i X-Received: by 2002:a17:906:7698:: with SMTP id o24mr17066757ejm.504.1612799248131; Mon, 08 Feb 2021 07:47:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612799248; cv=none; d=google.com; s=arc-20160816; b=oBYfyunwX6mevdus2umbi5Wrn6dKEi6hMOODn/Ndcz9tRtg7ISn872C3s1QKl5M94E 17Pfit2h6cTTwlSQ9ccS6Fh/RBjOsqynuUDowc6cUg4bFYrF9hoqRKfBb0jd345O6X77 hOjTeG8FANNaSnvyPkNd+foD7zeuBGPdwRthJhi+lUey6W/dIeSxfW7EJm+t11/nEfYp RT5TpCx18ftsRnVuHkMke+zCWJJ+327OR6zNjMePtWNP9cC53No886lL5XR8opDfSHEc +Hjy7gmosAJGFRSIGpuSmFOix6XnZXWMC4Zmlxey7plY/UHhNJGk1VAKy9zjF1Q1lpux iyOA== 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=3grA9u5PuDLZOl6KuAyUb2n6Z2W3zf5CSMNeN6aXAqs=; b=K/iNqCd8RDvGG/LpMRCep9hnp/zQbPF+CvKtCsDPeJ5senXv5+89C1uTPsmhETuOe6 HWuuUmInGdJ0Fp2NlST8lOTzsReTcmBIMzwJh+7xwjCUYeMKBTUVCK6+Lq+OYDjb+Qz/ 7sATEW+v64Na7PKYPJ6rQS6ADnwSBqh5Oj0L//wxIE3cHrmPqhp6KBEeCoaj5MIBZCMh WmFGYDj9j4ypA6PPCUlgejDMIOBU5e/XpA0lDA5tF13tY2w1N4CsKp3TaWBSbNKf5EWe 3xulLVhdj/qakWlryhZkwURyDNoINe+yMTqn2DthQm5RjKTFtvR5qkmBssywx6SH3v+P 7n8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q1ICX63X; 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 r26si12150760edt.85.2021.02.08.07.47.03; Mon, 08 Feb 2021 07:47:28 -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=Q1ICX63X; 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 S233974AbhBHPoU (ORCPT + 99 others); Mon, 8 Feb 2021 10:44:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:52068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232690AbhBHPG3 (ORCPT ); Mon, 8 Feb 2021 10:06:29 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7154A64EE3; Mon, 8 Feb 2021 15:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612796695; bh=bJJtpk2EAQTf2zp91XPIaJD+lqMxr/92d9ylY371Ddg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q1ICX63XxzF8Sf9EBpzoi5oaMgI6TJAtZ7BIcgEBMw4WZaq2V3Iy+bRdt5W9OqywD Wpt0F6ExEhpo3SePYYY+KMDDmcPo/f4Uv1rlQfsIq9S2As6kS0QvGaZ1KZ4V1BhiKm qKWFf/+cXyIjt7xDWJsj9Y6XBx6BLCRhNXoMI8fw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fengnan Chang , Ulf Hansson Subject: [PATCH 4.9 32/43] mmc: core: Limit retries when analyse of SDIO tuples fails Date: Mon, 8 Feb 2021 16:00:58 +0100 Message-Id: <20210208145807.614886928@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145806.281758651@linuxfoundation.org> References: <20210208145806.281758651@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: Fengnan Chang commit f92e04f764b86e55e522988e6f4b6082d19a2721 upstream. When analysing tuples fails we may loop indefinitely to retry. Let's avoid this by using a 10s timeout and bail if not completed earlier. Signed-off-by: Fengnan Chang Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210123033230.36442-1-fengnanchang@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/sdio_cis.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/mmc/core/sdio_cis.c +++ b/drivers/mmc/core/sdio_cis.c @@ -24,6 +24,8 @@ #include "sdio_cis.h" #include "sdio_ops.h" +#define SDIO_READ_CIS_TIMEOUT_MS (10 * 1000) /* 10s */ + static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func, const unsigned char *buf, unsigned size) { @@ -269,6 +271,8 @@ static int sdio_read_cis(struct mmc_card do { unsigned char tpl_code, tpl_link; + unsigned long timeout = jiffies + + msecs_to_jiffies(SDIO_READ_CIS_TIMEOUT_MS); ret = mmc_io_rw_direct(card, 0, 0, ptr++, 0, &tpl_code); if (ret) @@ -321,6 +325,8 @@ static int sdio_read_cis(struct mmc_card prev = &this->next; if (ret == -ENOENT) { + if (time_after(jiffies, timeout)) + break; /* warn about unknown tuples */ pr_warn_ratelimited("%s: queuing unknown" " CIS tuple 0x%02x (%u bytes)\n",