qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH 51/77] hw/sd/sdcard: Restrict Class 6 commands to SCSD cards
Date: Thu,  3 Sep 2020 15:59:09 -0500	[thread overview]
Message-ID: <20200903205935.27832-52-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <20200903205935.27832-1-mdroth@linux.vnet.ibm.com>

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

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.

Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200630133912.9428-7-f4bug@amsat.org>
(cherry picked from commit 9157dd597d293ab7f599f4d96c3fe8a6e07c633d)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/sd/sd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 3c06a0ac6d..da39590f58 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -905,6 +905,11 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         sd->multi_blk_cnt = 0;
     }
 
+    if (sd_cmd_class[req.cmd] == 6 && FIELD_EX32(sd->ocr, OCR, CARD_CAPACITY)) {
+        /* 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 */
-- 
2.17.1



  parent reply	other threads:[~2020-09-03 21:26 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 20:58 [PATCH 00/77] Patch Round-up for stable 5.0.1, freeze on 2020-09-10 Michael Roth
2020-09-03 20:58 ` [PATCH 01/77] hostmem: don't use mbind() if host-nodes is empty Michael Roth
2020-09-03 20:58 ` [PATCH 02/77] target/arm: Clear tail in gvec_fmul_idx_*, gvec_fmla_idx_* Michael Roth
2020-09-03 20:58 ` [PATCH 03/77] qemu-nbd: Close inherited stderr Michael Roth
2020-09-03 20:58 ` [PATCH 04/77] 9p: Lock directory streams with a CoMutex Michael Roth
2020-09-03 20:58 ` [PATCH 05/77] net: Do not include a newline in the id of -nic devices Michael Roth
2020-09-03 20:58 ` [PATCH 06/77] nbd/server: Avoid long error message assertions CVE-2020-10761 Michael Roth
2020-09-03 20:58 ` [PATCH 07/77] virtio-balloon: fix free page hinting without an iothread Michael Roth
2020-09-03 20:58 ` [PATCH 08/77] virtio-balloon: fix free page hinting check on unrealize Michael Roth
2020-09-03 20:58 ` [PATCH 09/77] virtio-balloon: unref the iothread when unrealizing Michael Roth
2020-09-03 20:58 ` [PATCH 10/77] block: Call attention to truncation of long NBD exports Michael Roth
2020-09-03 20:58 ` [PATCH 11/77] 9pfs: local: ignore O_NOATIME if we don't have permissions Michael Roth
2020-09-03 20:58 ` [PATCH 12/77] 9pfs: include linux/limits.h for XATTR_SIZE_MAX Michael Roth
2020-09-03 20:58 ` [PATCH 13/77] xen-9pfs: Fix log messages of reply errors Michael Roth
2020-09-03 20:58 ` [PATCH 14/77] Revert "9p: init_in_iov_from_pdu can truncate the size" Michael Roth
2020-09-03 20:58 ` [PATCH 15/77] xen/9pfs: yield when there isn't enough room on the ring Michael Roth
2020-09-04 10:59   ` Christian Schoenebeck
2020-09-03 20:58 ` [PATCH 16/77] ati-vga: check mm_index before recursive call (CVE-2020-13800) Michael Roth
2020-09-03 20:58 ` [PATCH 17/77] es1370: check total frame count against current frame Michael Roth
2020-09-03 20:58 ` [PATCH 18/77] Fix tulip breakage Michael Roth
2020-09-03 20:58 ` [PATCH 19/77] iotests/283: Use consistent size for source and target Michael Roth
2020-09-03 20:58 ` [PATCH 20/77] virtiofsd: add --rlimit-nofile=NUM option Michael Roth
2020-09-03 20:58 ` [PATCH 21/77] virtiofsd: stay below fs.file-max sysctl value (CVE-2020-10717) Michael Roth
2020-09-03 20:58 ` [PATCH 22/77] net: use peer when purging queue in qemu_flush_or_purge_queue_packets() Michael Roth
2020-09-03 20:58 ` [PATCH 23/77] KVM: x86: believe what KVM says about WAITPKG Michael Roth
2020-09-03 20:58 ` [PATCH 24/77] aio-posix: don't duplicate fd handler deletion in fdmon_io_uring_destroy() Michael Roth
2020-09-03 20:58 ` [PATCH 25/77] aio-posix: disable fdmon-io_uring when GSource is used Michael Roth
2020-09-03 20:58 ` [PATCH 26/77] linux-user/strace.list: fix epoll_create{, 1} -strace output Michael Roth
2020-09-03 20:58 ` [PATCH 27/77] libqos: usb-hcd-ehci: use 32-bit write for config register Michael Roth
2020-09-03 20:58 ` [PATCH 28/77] libqos: pci-pc: use 32-bit write for EJ register Michael Roth
2020-09-03 20:58 ` [PATCH 29/77] memory: Revert "memory: accept mismatching sizes in memory_region_access_valid" Michael Roth
2020-09-03 20:58 ` [PATCH 30/77] hw/riscv: Allow 64 bit access to SiFive CLINT Michael Roth
2020-09-03 20:58 ` [PATCH 31/77] xhci: fix valid.max_access_size to access address registers Michael Roth
2020-09-03 20:58 ` [PATCH 32/77] acpi: accept byte and word access to core ACPI registers Michael Roth
2020-09-03 20:58 ` [PATCH 33/77] hw/display/artist: Unbreak size mismatch memory accesses Michael Roth
2020-09-03 20:58 ` [PATCH 34/77] hw/net/e1000e: Do not abort() on invalid PSRCTL register value Michael Roth
2020-09-03 20:58 ` [PATCH 35/77] virtiofsd: Whitelist fchmod Michael Roth
2020-09-03 20:58 ` [PATCH 36/77] hw/audio/gus: Fix registers 32-bit access Michael Roth
2020-09-03 20:58 ` [PATCH 37/77] net/virtio: Fix failover_replug_primary() return value regression Michael Roth
2020-09-03 20:58 ` [PATCH 38/77] error: Use error_reportf_err() where appropriate Michael Roth
2020-09-03 20:58 ` [PATCH 39/77] usb/dev-mtp: Fix Error double free after inotify failure Michael Roth
2020-09-03 20:58 ` [PATCH 40/77] nbd: Avoid off-by-one in long export name truncation Michael Roth
2020-09-03 20:58 ` [PATCH 41/77] chardev/tcp: Fix error message double free error Michael Roth
2020-09-03 20:59 ` [PATCH 42/77] qga: fix assert regression on guest-shutdown Michael Roth
2020-09-03 20:59 ` [PATCH 43/77] util: Introduce qemu_get_host_name() Michael Roth
2020-09-03 20:59 ` [PATCH 44/77] qga: Use qemu_get_host_name() instead of g_get_host_name() Michael Roth
2020-09-03 20:59 ` [PATCH 45/77] docs/orangepi: Add instructions for resizing SD image to power of two Michael Roth
2020-09-03 20:59 ` [PATCH 46/77] tests/acceptance/boot_linux: Tag tests using a SD card with 'device:sd' Michael Roth
2020-09-03 20:59 ` [PATCH 47/77] tests/acceptance: allow console interaction with specific VMs Michael Roth
2020-09-03 20:59 ` [PATCH 48/77] tests/acceptance: refactor boot_linux to allow code reuse Michael Roth
2020-09-03 20:59 ` [PATCH 49/77] tests/acceptance: refactor boot_linux_console test " Michael Roth
2020-09-03 20:59 ` [PATCH 50/77] tests/acceptance/boot_linux: Expand SD card image to power of 2 Michael Roth
2020-09-03 20:59 ` Michael Roth [this message]
2020-09-03 20:59 ` [PATCH 52/77] hw/sd/sdcard: Simplify realize() a bit Michael Roth
2020-09-03 20:59 ` [PATCH 53/77] hw/sd/sdcard: Do not allow invalid SD card sizes Michael Roth
2020-09-03 20:59 ` [PATCH 54/77] hw/sd/sdcard: Update coding style to make checkpatch.pl happy Michael Roth
2020-09-03 20:59 ` [PATCH 55/77] hw/sd/sdcard: Do not switch to ReceivingData if address is invalid Michael Roth
2020-09-03 20:59 ` [PATCH 56/77] target/hppa: Free some temps in do_sub Michael Roth
2020-09-03 20:59 ` [PATCH 57/77] tpm: tpm_spapr: Exit on TPM backend failures Michael Roth
2020-09-03 20:59 ` [PATCH 58/77] tests: tpm: Skip over pcrUpdateCounter byte in result comparison Michael Roth
2020-09-03 20:59 ` [PATCH 59/77] qdev: Fix device_add DRIVER,help to print to monitor Michael Roth
2020-09-03 20:59 ` [PATCH 60/77] virtio-balloon: Prevent guest from starting a report when we didn't request one Michael Roth
2020-09-03 20:59 ` [PATCH 61/77] virtio-balloon: Add locking to prevent possible race when starting hinting Michael Roth
2020-09-03 20:59 ` [PATCH 62/77] virtio-balloon: always indicate S_DONE when migration fails Michael Roth
2020-09-03 20:59 ` [PATCH 63/77] linux-headers: update against Linux 5.7-rc3 Michael Roth
2020-09-03 20:59 ` [PATCH 64/77] virtio-balloon: Replace free page hinting references to 'report' with 'hint' Michael Roth
2020-09-03 20:59 ` [PATCH 65/77] virtio: list legacy-capable devices Michael Roth
2020-09-03 20:59 ` [PATCH 66/77] virtio: verify that legacy support is not accidentally on Michael Roth
2020-09-07 12:18   ` Cornelia Huck
2020-09-03 20:59 ` [PATCH 67/77] intel_iommu: Use correct shift for 256 bits qi descriptor Michael Roth
2020-09-03 20:59 ` [PATCH 68/77] virtio-pci: Changed vdev to proxy for VirtIO PCI BAR callbacks Michael Roth
2020-09-03 20:59 ` [PATCH 69/77] libvhost-user: Report descriptor index on panic Michael Roth
2020-09-03 20:59 ` [PATCH 70/77] Update OpenBIOS images to 7f28286f built from submodule Michael Roth
2020-09-03 20:59 ` [PATCH 71/77] migration/block-dirty-bitmap: fix dirty_bitmap_mig_before_vm_start Michael Roth
2020-09-03 20:59 ` [PATCH 72/77] block: Fix bdrv_aligned_p*v() for qiov_offset != 0 Michael Roth
2020-09-03 20:59 ` [PATCH 73/77] iotests/028: Add test for cross-base-EOF reads Michael Roth
2020-09-03 20:59 ` [PATCH 74/77] nbd: Fix large trim/zero requests Michael Roth
2020-09-03 20:59 ` [PATCH 75/77] virtio-net: align RSC fields with updated virtio-net header Michael Roth
2020-09-03 20:59 ` [PATCH 76/77] hw/arm/sbsa-ref: fix typo breaking PCIe IRQs Michael Roth
2020-09-03 20:59 ` [PATCH 77/77] usb: fix setup_len init (CVE-2020-14364) Michael Roth
2020-09-04  9:20 ` [PATCH 00/77] Patch Round-up for stable 5.0.1, freeze on 2020-09-10 Philippe Mathieu-Daudé
2020-09-10 18:16   ` Michael Roth
2020-09-10 19:29     ` Philippe Mathieu-Daudé
2020-09-10 20:11     ` Philippe Mathieu-Daudé
2020-09-04 13:17 ` Thomas Huth
2020-09-10 18:14 ` Michael Roth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200903205935.27832-52-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).