Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2510163rwb; Mon, 3 Oct 2022 01:37:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76/7vM5qjM6l+aCy1OK417onXFP6zODkhOw7g9xEm9IoU6F6flKzdKQhuoQJ8PHRhYi/i5 X-Received: by 2002:a17:90a:9381:b0:20a:79b7:766a with SMTP id q1-20020a17090a938100b0020a79b7766amr9280778pjo.33.1664786230795; Mon, 03 Oct 2022 01:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664786230; cv=none; d=google.com; s=arc-20160816; b=L24PwFnLIUjloEDVVWNoW1wCp2ck/v8oh2bILRum9fbb6FnXf1GKG4INHgb4WEA3Rj AKE31qCc1HFE64L8jZK8nN6r8gOzajodbsL1DypcgMKmUnBDk6u8xVF9Av7Jaocq2QQh xWoUyELwDP709cyBRjY1saHcy7uyHV3N/LYDISVVt57iyL9mqzvCzMs9l1QoqhENstX+ 9Xt8wFCLLcoPIMXLnFeKZZirkyB95gtP+CH9sOMOXGNdVG8ROMBpDKTKkTlgQzI+hDCb Hw711FxLJEh32+o238VcaXmmmyHubQYGI5h/6TdsL/zMCed9VfbYqWwpbpC8hZHt7PMp 8OLA== 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=eqlVrN5jCiyhHmfburAbuaFvRRemd797+rUJCtqxDho=; b=ZOtCApusGTX4yQua6nUxzJRKOLsv6mMQkHde+ol4K9MUsaHYx7g83iDbZFtGQCMPTg a6iHnt6vyieij+JBzerrdVmgJLn9bDXjgnVbqoiJyvhEOSSCTu1AAyADuq0iL9ELxDHR weYM2SDZF89qX17feKpVh3e9AaSuBF/Da2iHpCB7VqEwcGhlFbkD6ut99Qb+7SR4DPZ0 v+v2JsqqQlBWQFMnuoHroa2A2Husncy+H6Qsx90W3vUYh9lLSokpg9ylzzzqgAZ3Y72I lEdSybWbR4s+D8/8Ej/hB0XMaothnKDLsX/lbgxKTxna6jQZe9D1aEYrrAhCuMu3NAcR sASg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MrhClt9K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ij13-20020a170902ab4d00b00178431e09bdsi9256458plb.230.2022.10.03.01.36.59; Mon, 03 Oct 2022 01:37:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MrhClt9K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231305AbiJCH36 (ORCPT + 99 others); Mon, 3 Oct 2022 03:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231345AbiJCH2t (ORCPT ); Mon, 3 Oct 2022 03:28:49 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6697AF587; Mon, 3 Oct 2022 00:19:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1566BCE0B1C; Mon, 3 Oct 2022 07:18:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 262D9C433C1; Mon, 3 Oct 2022 07:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781480; bh=2UHdbvEr9lqpstgtuyNn+47IaQkePd+H6y1WP7Yv+1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrhClt9KX4TV62GmRhnRv/loQ8y7hehAZXwMgo1YMSwkvjoCa1SedFgzFhlX+8R0R ZGG/UbTcFuRvO/gKRC8/nD5tSuGKmASLtLe5+BTx4MwKlxzjY+36SQeNNyh6xdSbat QtgeOT9Gx1nSp0X5lQWNIh+e7fgDohzOLRjMjPSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenchao Chen , Ulf Hansson Subject: [PATCH 5.15 28/83] mmc: hsq: Fix data stomping during mmc recovery Date: Mon, 3 Oct 2022 09:10:53 +0200 Message-Id: <20221003070722.704036470@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wenchao Chen commit e7afa79a3b35a27a046a2139f8b20bd6b98155c2 upstream. The block device uses multiple queues to access emmc. There will be up to 3 requests in the hsq of the host. The current code will check whether there is a request doing recovery before entering the queue, but it will not check whether there is a request when the lock is issued. The request is in recovery mode. If there is a request in recovery, then a read and write request is initiated at this time, and the conflict between the request and the recovery request will cause the data to be trampled. Signed-off-by: Wenchao Chen Fixes: 511ce378e16f ("mmc: Add MMC host software queue support") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220916090506.10662-1-wenchao.chen666@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/mmc_hsq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/mmc_hsq.c +++ b/drivers/mmc/host/mmc_hsq.c @@ -34,7 +34,7 @@ static void mmc_hsq_pump_requests(struct spin_lock_irqsave(&hsq->lock, flags); /* Make sure we are not already running a request now */ - if (hsq->mrq) { + if (hsq->mrq || hsq->recovery_halt) { spin_unlock_irqrestore(&hsq->lock, flags); return; }