From nobody Tue Feb 10 04:15:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1593189820; cv=none; d=zohomail.com; s=zohoarc; b=YH2hKHboLXK5FNeoTdF4m9oAz01ltUhMdeoNKnH9dc1e1doA4Yu/bbNTlw+xTN+tMdHzmJR1b576cYLwnGRsUqZLsmO+/g2W17suFtjtFj3wdHIPvwELKQ4vcx3Orv2+nW08INniSadM1h3DIlb3PMzKqry2aTy0a73MZVr31hw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593189820; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2FehWZv489g7gLp1IpuJgAw0ELgG4HGTfqwfreEPxtg=; b=A0xhetzZ+NrlbRAjY7ASMbcjA4xqXrLGOSmzukegBIAPOHaQuKoQrm70vOk6u6cNYcdx+LEL2+FWh5R/B6KgpDxXyriClJHuuxFQPdELp+zS2p44NGdRs9Am3vE4rHJbxIwiIL0e2t7WxIfc8L3Y25FxOsK+LbVnsPEce/tjWP4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593189820809523.9856699624512; Fri, 26 Jun 2020 09:43:40 -0700 (PDT) Received: from localhost ([::1]:54884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jorRz-0005ND-Ca for importer@patchew.org; Fri, 26 Jun 2020 12:43:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jorP6-0000Ez-BH; Fri, 26 Jun 2020 12:40:41 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jorP4-00064t-1M; Fri, 26 Jun 2020 12:40:39 -0400 Received: by mail-wr1-x443.google.com with SMTP id h15so10103321wrq.8; Fri, 26 Jun 2020 09:40:37 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id f12sm24623646wrw.53.2020.06.26.09.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 09:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2FehWZv489g7gLp1IpuJgAw0ELgG4HGTfqwfreEPxtg=; b=txwXMu4XvTfD1f8pUQtQk9yXebkKYepKvggw1Vy3cu4GclrXThTd6ud0foK3bRYntS 6wtabgp+67wFTD0dMNy6CD6qkcRi8rCb+FC/ZBl4t207YvdHOCC5oiFpTQPVGh6+qnCm LlHOOw7WMqZaTBUpO9MBu5ykhC3jcIVt6SGzocvRnmbvRx4t7o/mGb/fsHyKG6XGMTnk YfG6SWbnMyRY6TO/I7uiXH9gK/mQbHFw51WeF2gxAzNrXz9cwFtSjiRpUjIhdAgnFzzs CNI8bTqvkvZ4WIcY2dx5HUALUdNBiBLq3V6OcYfMJwjt1wRNDc7dXi2fSl/pv89FIszO AxFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2FehWZv489g7gLp1IpuJgAw0ELgG4HGTfqwfreEPxtg=; b=OBZE9fTWxbdYDNO0wQf6VLvLzDz5T3VbiT4qSLCiJ6x9W9hdy+MVqJUAkURu9t06Re lJpiUvaCoh2T0V6ifMrk4npOYqfhFdPIfl6RIXjpelYJHtbsiAn9TLHj6JMrlVN1+A93 DhJE0bPMDffaiCikUmGrknEVUWNWtOGzfnmwtKUTF1CHxoIeFWz5pTSq3aBj6EyszQW2 vrXYz13ai7g8WFBP3Lnp6Uz9qLbXS2uKlFfc6vdIz1vfN0sci+15K5x2twnRRUCysW0t bp4JCa9DGn7NwtYfNfAmgrJoid6814diF7xxnhaeDvLK+xvjqdNd09cKFmA6/1zbDoJ4 BF4g== X-Gm-Message-State: AOAM532wc0MCT2ORI/3tWjgIIZQwCzCUAwYwMxc2oHLFJvXj2Jzmbvke 9GifoiVlROinnpU7+R645ydE4cjH X-Google-Smtp-Source: ABdhPJxhoIM0XKrZpYY5JRU12pZfUtcDMDVd8w90AzShwY73VCFzDA9QhdQW9mNLc343257Rvb8IOw== X-Received: by 2002:adf:de01:: with SMTP id b1mr4507277wrm.305.1593189636111; Fri, 26 Jun 2020 09:40:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v5 06/15] hw/sd/sdcard: Restrict Class 6 commands to SCSD cards Date: Fri, 26 Jun 2020 18:40:17 +0200 Message-Id: <20200626164026.766-7-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200626164026.766-1-f4bug@amsat.org> References: <20200626164026.766-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Only SCSD cards support Class 6 (Block Oriented Write Protection) commands. "SD Specifications Part 1 Physical Layer Simplified Spec. v3.01" 4.3.14 Command Functional Difference in Card Capacity Types * Write Protected Group SDHC and SDXC do not support write-protected groups. Issuing CMD28, CMD29 and CMD30 generates the ILLEGAL_COMMAND error. Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7e0d684aca..871c30a67f 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -922,6 +922,11 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SD= Request req) sd->multi_blk_cnt =3D 0; } =20 + if (sd_cmd_class[req.cmd] =3D=3D 6 && FIELD_EX32(sd->ocr, OCR, CARD_CA= PACITY)) { + /* Only Standard Capacity cards support class 6 commands */ + return sd_illegal; + } + switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ case 0: /* CMD0: GO_IDLE_STATE */ --=20 2.21.3