From: Alistair Francis <alistair23@gmail.com>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: "Mauro Matteo Cascella" <mcascell@redhat.com>,
Qemu-block <qemu-block@nongnu.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
qemu-stable@nongnu.org, "Li Qiang" <liq3ea@163.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Prasad J Pandit" <ppandit@redhat.com>,
"Alexander Bulekov" <alxndr@bu.edu>,
"Bandan Das" <bsd@redhat.com>,
"Alistair Francis" <alistair.francis@wdc.com>
Subject: Re: [PATCH] hw/sd: sdhci: Do not transfer any data when command fails
Date: Wed, 10 Feb 2021 14:27:03 -0800 [thread overview]
Message-ID: <CAKmqyKPLD68GXeMyU_LTVYjv8YUXex4wvyAnHkOgu=PK48pP7w@mail.gmail.com> (raw)
In-Reply-To: <1612868085-72809-1-git-send-email-bmeng.cn@gmail.com>
On Tue, Feb 9, 2021 at 2:55 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> At the end of sdhci_send_command(), it starts a data transfer if
> the command register indicates a data is associated. However the
> data transfer should only be initiated when the command execution
> has succeeded.
>
> Cc: qemu-stable@nongnu.org
> Fixes: CVE-2020-17380
> Fixes: CVE-2020-25085
> Reported-by: Alexander Bulekov <alxndr@bu.edu>
> Reported-by: Sergej Schumilo (Ruhr-University Bochum)
> Reported-by: Cornelius Aschermann (Ruhr-University Bochum)
> Reported-by: Simon Wrner (Ruhr-University Bochum)
> Buglink: https://bugs.launchpad.net/qemu/+bug/1892960
Isn't this already fixed?
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>
> hw/sd/sdhci.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
> index 8ffa539..0450110 100644
> --- a/hw/sd/sdhci.c
> +++ b/hw/sd/sdhci.c
> @@ -326,6 +326,7 @@ static void sdhci_send_command(SDHCIState *s)
> SDRequest request;
> uint8_t response[16];
> int rlen;
> + bool cmd_failure = false;
>
> s->errintsts = 0;
> s->acmd12errsts = 0;
> @@ -349,6 +350,7 @@ static void sdhci_send_command(SDHCIState *s)
> trace_sdhci_response16(s->rspreg[3], s->rspreg[2],
> s->rspreg[1], s->rspreg[0]);
> } else {
> + cmd_failure = true;
> trace_sdhci_error("timeout waiting for command response");
> if (s->errintstsen & SDHC_EISEN_CMDTIMEOUT) {
> s->errintsts |= SDHC_EIS_CMDTIMEOUT;
> @@ -369,7 +371,7 @@ static void sdhci_send_command(SDHCIState *s)
>
> sdhci_update_irq(s);
>
> - if (s->blksize && (s->cmdreg & SDHC_CMD_DATA_PRESENT)) {
> + if (!cmd_failure && s->blksize && (s->cmdreg & SDHC_CMD_DATA_PRESENT)) {
> s->data_count = 0;
> sdhci_data_transfer(s);
> }
> --
> 2.7.4
>
>
next prev parent reply other threads:[~2021-02-10 22:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-09 10:54 [PATCH] hw/sd: sdhci: Do not transfer any data when command fails Bin Meng
2021-02-09 11:03 ` Philippe Mathieu-Daudé
2021-02-10 22:27 ` Alistair Francis [this message]
2021-02-11 8:52 ` Mauro Matteo Cascella
2021-02-11 19:48 ` Philippe Mathieu-Daudé
2021-02-12 13:55 ` Mauro Matteo Cascella
2021-02-11 15:49 ` Alexander Bulekov
2021-02-11 16:53 ` Alexander Bulekov
2021-02-11 21:24 ` Alexander Bulekov
2021-02-14 5:56 ` Bin Meng
2021-02-14 15:53 ` Bin Meng
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='CAKmqyKPLD68GXeMyU_LTVYjv8YUXex4wvyAnHkOgu=PK48pP7w@mail.gmail.com' \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=alxndr@bu.edu \
--cc=bmeng.cn@gmail.com \
--cc=bsd@redhat.com \
--cc=f4bug@amsat.org \
--cc=liq3ea@163.com \
--cc=mcascell@redhat.com \
--cc=ppandit@redhat.com \
--cc=qemu-block@nongnu.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).