From patchwork Tue Aug 6 12:51:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 817044 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1783616wrh; Tue, 6 Aug 2024 05:56:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUqAHhCy+YIXFh/29RsSdAgkMPWc2Leq+XpsV8vBdw3Y4AMwwNObiCM+87OtMZEsSfMI+d4LJVrdxiQApDd8s6F X-Google-Smtp-Source: AGHT+IEgSH8X4d0hJiTXO5qUk43cuF3Li2laV+FhBH32s/rLLZeSCwBUUOi/CR49mI2m+2h13uQv X-Received: by 2002:a05:6830:2807:b0:70a:9876:b781 with SMTP id 46e09a7af769-70a9876b996mr17360674a34.34.1722948977756; Tue, 06 Aug 2024 05:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722948977; cv=none; d=google.com; s=arc-20160816; b=X3BwMUsp62mzLSoXnQA4ITFAbTAqFVxcVeO9VU7qYPmJfsiTrY9B6/XBokUmxFNuig OzhHezXBzz3DVODMybg5DSuZJrU/Myi8VxNp+nchSLUAthCvoFFhTmNvAmUfmsdUnbSG Ah7JQ46hhAPpK2X87WU2BGauB3tJFzogCY7BCBMzKiRDz3K6IXYsSB5aJ7cK/CJU9s76 eZygn5khCYF+BKnp/yFSQmSI58EPcGDuVKndyayxz0xw8/hzN2ZT9mDzsUx02PW1L3Em tcO9oAKTNQ7FlUN1bW1JczaKLTqrz4VlCeFQZtiASivJIG+l8I0yTQ/7AIshO3KoTu5o LGiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qVol/losEhIcWq2r2tAtbopJaOl9RLGh9SWaxvA4wzc=; fh=SJVSVookgcyZ3xhuRNVfkJ3f/S7xP2f7Ub1ylu5GG5E=; b=0IfjxD+EpFeP4m9SZeaIcaqcCJWXpOY5+uufVXRzYCbeaIEssWJVo8pxTPV+KTFQjZ kweJva1EwslvxnmIzcGsjYxIWClldtdsGLqaleSnwj0wCIWhgfc60WI1AhCgE+veY8yX YQEbid+mI22995v7hcsZjzkFJdnOVcOtU2ntJ6LUmE7E5hmspuIUuaXaSxgVQCazePuG SSiluJmvtWrLYWOyXOUwCKK1PUqjckjoGlN3nAXsGAydQd2c9XtoAic4WvOxA0eqHTqc xSDhhDYGAG44W3eI/9jv1du2zxrugYWd2waKrAbrKkWPyk4rMswvuEjRQwtJcTxF/0iN RZaA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6JVPJ0X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a79e324si119395781cf.630.2024.08.06.05.56.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Aug 2024 05:56:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6JVPJ0X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbJhI-0006CN-V0; Tue, 06 Aug 2024 08:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbJhF-0005n8-WA for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:53:50 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbJhD-0000H5-SW for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:53:49 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5a156557026so601245a12.2 for ; Tue, 06 Aug 2024 05:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722948826; x=1723553626; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qVol/losEhIcWq2r2tAtbopJaOl9RLGh9SWaxvA4wzc=; b=J6JVPJ0XQ5uN+ZsELFsdsiDAMrbd0+7F3iDFAT9V+44ciHkgpMAJP7da0u/T36UzlR VHwt+Bd5OAaeXElOsqeYmSClSlihXrkuJlsM+FUY2TAcDUzy1/WcTuv8RRi/GZRl8av3 w3UtEha3VI+eUwXGDY7ndswrP7zUBkhIg2gwStPirONjIedMjWqKYGZ0MPFlSkJ9sMoW 93mpwB1W8uv8QT44exYTH2o8yGgWWnQxwuP2BNltmfyCseL1tWHs/+fHlgxYO2nYJOTo GkDEFK/VyJRfn8oXYSKDwQynxIkfEIkiI+wMWdj7GN9iSVbHR8ODU6a4mymu86j2zSZQ sm3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722948826; x=1723553626; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qVol/losEhIcWq2r2tAtbopJaOl9RLGh9SWaxvA4wzc=; b=vgFb6tvu+AYeFzIt1pCFCWByxfUN3F3+5qgvEgjvl2e3t/tk93el2y+5gd6nX7ciWj LYRC9AOG/cKRearmVEzRaZExHhFM5VtE+ctuigQikeIfi9k3kzn59xqx0tV2q4LOnkpx /y71Ijx+sQ/wt2MgebIu0X411otemLAw4YadIC9RUxNRZaynBGJ+qFdbGRfmQesHOfWc Tti1edglQ4rTAHt5ogR//HfUGL9qkdbbTBRYo+o9NBMAW7NkXuhcOSlxmW+TjfaT6BLO w/8u8VwxUJzffSBRL8dTH8LPd4yR+JuKg0ImZlYJnXLr6jmUh89FW407ccKQKcA1bHPW ALOg== X-Gm-Message-State: AOJu0YwrdvfdAL1n3JPq+W749GowUsHHoyEmhq8qujy509EVqg0QC5TP EYVg8UjVzwDTlIgdeysVd2b+pXuATxm/5r6h3nlQp+u74taAgqF5GZDy4FCjFZ+FdyfmqKVS8bH z X-Received: by 2002:a05:6402:31a3:b0:5ba:83d:3294 with SMTP id 4fb4d7f45d1cf-5ba083d343cmr6726452a12.2.1722948825908; Tue, 06 Aug 2024 05:53:45 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5baa6b916b8sm3653114a12.22.2024.08.06.05.53.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 06 Aug 2024 05:53:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org, Zheyu Ma , Richard Henderson Subject: [PULL 17/28] hw/sd/sdhci: Reset @data_count index on invalid ADMA transfers Date: Tue, 6 Aug 2024 14:51:45 +0200 Message-ID: <20240806125157.91185-18-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806125157.91185-1-philmd@linaro.org> References: <20240806125157.91185-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=philmd@linaro.org; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We neglected to clear the @data_count index on ADMA error, allowing to trigger assertion in sdhci_read_dataport() or sdhci_write_dataport(). Cc: qemu-stable@nongnu.org Fixes: d7dfca0807 ("hw/sdhci: introduce standard SD host controller") Reported-by: Zheyu Ma Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2455 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240730092138.32443-4-philmd@linaro.org> --- hw/sd/sdhci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index d02c3e3963..8293d83556 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -846,6 +846,7 @@ static void sdhci_do_adma(SDHCIState *s) } } if (res != MEMTX_OK) { + s->data_count = 0; if (s->errintstsen & SDHC_EISEN_ADMAERR) { trace_sdhci_error("Set ADMA error flag"); s->errintsts |= SDHC_EIS_ADMAERR;