From patchwork Tue Jul 30 09:21:35 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: 815273 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp210385wrs; Tue, 30 Jul 2024 02:22:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUOhMtzzYXLBR/WnE6onDCStRQbIgBvXaNT6ks7rY49ZsBZmcLBkbR4v7TvKZtHgkZSsdkw9lKAcxAOE+kt271Q X-Google-Smtp-Source: AGHT+IFHfNJlK/8HN354z0RGg1ZthOXKEWVgYySuvZo0fGg280mpa8aq/ZZxgZtOBPZUvvTVwT/D X-Received: by 2002:a05:6902:120d:b0:e0b:2afc:a803 with SMTP id 3f1490d57ef6-e0b544ebb73mr10195057276.30.1722331366632; Tue, 30 Jul 2024 02:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722331366; cv=none; d=google.com; s=arc-20160816; b=WlwLHh++DrgeZgmYGkEhNncClycjpluD60IBhOuXGJU97c1TlTpRwtkBuZe2ceG1U2 gQEzoA+cb7bndZEAZ73209tTi4wV7fV2PJtNIJvKgU5JZdBlmlQp1xP9aGA9lah6hNJH AS3tkAUx+qRPY+aJmn1coAJsi3HOr0OfXXSKEOD1vLLmzscrlcYNN3cYdjXQrAPgTwrn 9CV4YtGs0i1J1lKUIo4ls9Rgissnp1Jq5TK1MRdMPNRcdk6m4jPa2V3ET+1nIqBGaptp azmJ7GalRt8lizgRylqrm3H8XV4VMGRAwp7EYcR0OK1HCsVkmruTGAZMgEsfRbTYnDyt arEA== 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=fRMGyzp03tYfu+a5mNwyhx3DbvljVjB1l6w81zoWVuY=; fh=Mv2M8tuhVwb2pCrpLwfwJceuDvk4ZWzOTf/kU4VxOgk=; b=nzP+iQlxmW2CTzBQf+Ekus3pioJGFzC362LtOppM8dCgsMm/MzwNJyx0hf/oC328dI yoPg+VSXbsGciu9PRUIQ+/jqPHfBtHnBaLujuWIr2BrGhDsEFuhnV4gWHeyFDuwewRWF nnFWxt3VabjwScvI+oTkXy0Tlo9LNXTSYf0zF8KrC1Nt3y8LWBwypgakZXxwuW+S7YA2 i0xsphBJhWCpO3vgbg3PZgY62Hg025h+CuoBQLQwUeBMKLUiE8Cs1mp+SUgZpQdecuSY Y8UdsVX2IqWVVVOGz6EDYt15PdmsBWB3GLO18p57VFwKy7EWa3x9kgufAzaITeUljtJN Tyzg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rkLnIo6C; 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-44fe8421b92si118623001cf.569.2024.07.30.02.22.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jul 2024 02:22:46 -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=rkLnIo6C; 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 1sYj3T-0000Nc-Nd; Tue, 30 Jul 2024 05:22:03 -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 1sYj3R-0000JC-Vl for qemu-devel@nongnu.org; Tue, 30 Jul 2024 05:22:01 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sYj3Q-0005kM-EE for qemu-devel@nongnu.org; Tue, 30 Jul 2024 05:22:01 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-426526d30aaso25457445e9.0 for ; Tue, 30 Jul 2024 02:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722331319; x=1722936119; 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=fRMGyzp03tYfu+a5mNwyhx3DbvljVjB1l6w81zoWVuY=; b=rkLnIo6CLqCFwYqG4JoU6NzcdRAnwSFtqmaTKenoNtyXDWXESUm9902YiuvfbXMU81 4SO36jzn6O1bjy6pq72/Vb/4ENLAaQtGyeZLay/5ygNyNhB0WYgtrE3jYtGirN0ECmiN 9wuCW3l7JNRTwc7aAkKnfWgswGyXyrwMtgAaJcc5U/aojI9x/ZMdczsec74xyNBej42w h1dHZDYqBWq8wg+zhaEgY7wN1zBXItEEuFDuANUMcdKH0PsKBB3E8FNBWctRPIf533EG WoZjUqK0MHwsHm8DWMrh8h3Zs1NziZkGehl34qbA3pfHe5VM9GXffPZu0s01cdSS4wZt stEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722331319; x=1722936119; 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=fRMGyzp03tYfu+a5mNwyhx3DbvljVjB1l6w81zoWVuY=; b=YKRVRC7mhGC4d8ZL9xcBU1nMGk1XIcxIGZ+Pk9XyOCEthftCEDLS6B96CIdgHqbhuV pids+Qzw5ZV01FuABRwk2uQ1RFRwMb46Ol0bf6WtXKdCfYG2MdcumrOupIqZdpU4HqyP 67N4lIdqxej0y+SM2Mdid1SwWPDg8OjkzvZX/VQOzumUPb6bavDgJbtx6a49AfRV3x8O ydUySDrABrJA/KKNX3UyekdpD7AUzxdVAsxb3zPvMqy2EFZPPo22iSo2kwwIu5cn2574 VwYduthCFh5FcFbJN7cpy6mO3v2DoOAqCZk/YhdF9DfRVuIjVKnZhXprhSaxSGAvFSY8 Gv0Q== X-Gm-Message-State: AOJu0Yyekd+jGj5QF5bZ0OCiwImm5TuWELploABCw1vGmY2pT1Ycy4qj pnJ1KztIORK3q17s3Gr6NiKLkM7uip0pUNA708BFNhH2r1Ew8n7VtlPZf/BKSndaJktRcnVbG4B uv68= X-Received: by 2002:a05:600c:6b06:b0:426:6f1e:ce93 with SMTP id 5b1f17b1804b1-42811dfe3d0mr69752425e9.33.1722331318878; Tue, 30 Jul 2024 02:21:58 -0700 (PDT) Received: from localhost.localdomain (82.red-88-28-10.dynamicip.rima-tde.net. [88.28.10.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-428089c28f0sm192352015e9.28.2024.07.30.02.21.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 30 Jul 2024 02:21:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bin Meng , Zheyu Ma , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH-for-9.1 2/5] hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state Date: Tue, 30 Jul 2024 11:21:35 +0200 Message-ID: <20240730092138.32443-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730092138.32443-1-philmd@linaro.org> References: <20240730092138.32443-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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 Guest should not try to read the DAT lines from invalid command state. If it still insists to do so, return a dummy value. Cc: qemu-stable@nongnu.org Fixes: e2dec2eab0 ("hw/sd/sdcard: Remove default case in read/write on DAT lines") Reported-by: Zheyu Ma Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2454 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/sd/sd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index c02f04f1ea..b1e6e36b44 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2540,7 +2540,9 @@ uint8_t sd_read_byte(SDState *sd) break; default: - g_assert_not_reached(); + qemu_log_mask(LOG_GUEST_ERROR, "%s: DAT read illegal for command %s\n", + __func__, sd->last_cmd_name); + return dummy_byte; } return ret;