Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4136067pxb; Mon, 8 Feb 2021 08:45:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNlrmptYeI3rs9SqNwQcJfXsmLxlBHWX4hT+6CMMvjxgLpUsQYKUbGtgCAtjYG4BbfRCZ1 X-Received: by 2002:aa7:d60f:: with SMTP id c15mr18116612edr.291.1612802745902; Mon, 08 Feb 2021 08:45:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612802745; cv=none; d=google.com; s=arc-20160816; b=AITzRKLEv0NIihC2uUygZIOyLYHi3gN4pZa0ko8aJ4HJeTlhl0y/kvevL3QVe5R7l9 1IRh6ebwZ29p2EWaBmtN91w/fesObNRMjhbraCUjiJYn38MNObJswU2doh6JxBqNgOkT aEbFw2jFXe8Ho4gUcJ1+Hrkp1atm6bTJBTMSfM/JuincKZxdBl/gxy4Td8yrb8jtDGN+ NE3diZGCzdfBsCQLC3CtrKi9ddPx83ZTbgp2swuOkc/o0I9NZ5i4+Jom3S31kXlLaAvt RzDLvCzucylo9ucYyemt6WHWIIVOTeISXFCMRBOAqpuO7C4AYkrDqBNpfa2zOh7MFvy0 I5gg== 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=2IQnOttxG7NG7K7TWUHCHOGp9FeEJP/A/QzCfCwzfdc=; b=G4pppG1vAQBbs0xfiEOvaUeIBojm176pvPulB1Mn+5PQ8vhLmgx5YFp960mBwLwHlj QNdtc7IbR3Yjkxnua34IwxvJGf7I+b8dSqJWL7DIDLRz9DuMfKg0WsT3TMqJUIgW9Cjv 3OH0/uEP/AhBORxSvfO8i7smKZn8MhmaXGsyBPB8aQ+v1r+u3lop3pKn7Z4ydFK53N4F 95Zqe6nnSr6BPnzbxETXj9m4nekuitFX7rOycWGKQjoY3PJQwlzzNVcDzR4FBdSKr1k4 R9+9HZZGJASFIXFI28bQ14noUN7CRB8ZJvsndPSBdlunex/51Cs4hwTfV68WrSkvH6Jm r6rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nreZYoVy; 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 z11si9281615ejm.578.2021.02.08.08.45.21; Mon, 08 Feb 2021 08:45:45 -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=nreZYoVy; 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 S234611AbhBHQn3 (ORCPT + 99 others); Mon, 8 Feb 2021 11:43:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:56628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbhBHPOt (ORCPT ); Mon, 8 Feb 2021 10:14:49 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5DF3064E50; Mon, 8 Feb 2021 15:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612797055; bh=AFF/PXZT9j9GHOqC0+qWXIv9B1RA08FedsN6s7hczMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nreZYoVyTx4S05UhBkD6Km3mSpn4LwV6io25d0ZAatuFfIWVplTgWItkwpnPjMCKy DWh87OA1A3hah1A/yUA7S2yxfGyavZib22wnmXl7wERjzhV9UwzTjhRn82TxoyeIkA 7CBLHVOSvExI2b9Kx2o0DAKqpiUln2jM4rL/6jh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fengnan Chang , Ulf Hansson Subject: [PATCH 5.4 42/65] mmc: core: Limit retries when analyse of SDIO tuples fails Date: Mon, 8 Feb 2021 16:01:14 +0100 Message-Id: <20210208145811.843817731@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145810.230485165@linuxfoundation.org> References: <20210208145810.230485165@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 @@ -20,6 +20,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) { @@ -266,6 +268,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) @@ -318,6 +322,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",