qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amol Surati <suratiamol@gmail.com>
To: qemu-devel@nongnu.org
Cc: jsnow@redhat.com, Amol Surati <suratiamol@gmail.com>,
	"open list:IDE" <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PATCH 2/2] tests/ide-test: test case for crash when processing short PRDs
Date: Wed, 20 Jun 2018 09:59:30 +0530	[thread overview]
Message-ID: <20180620042930.24208-3-suratiamol@gmail.com> (raw)
In-Reply-To: <20180620042930.24208-1-suratiamol@gmail.com>

From: John Snow <jsnow@redhat.com>

Related Bug: https://bugs.launchpad.net/qemu/+bug/1777315

Signed-off-by: Amol Surati <suratiamol@gmail.com>
---
 tests/ide-test.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tests/ide-test.c b/tests/ide-test.c
index f39431b1a9..382c29a174 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -473,6 +473,32 @@ static void test_bmdma_one_sector_short_prdt(void)
     free_pci_device(dev);
 }
 
+static void test_bmdma_partial_sector_short_prdt(void)
+{
+    QPCIDevice *dev;
+    QPCIBar bmdma_bar, ide_bar;
+    uint8_t status;
+
+    /* Read 2 sectors but only give 1 sector in PRDT */
+    PrdtEntry prdt[] = {
+        {
+            .addr = 0,
+            .size = cpu_to_le32(0x200),
+        },
+        {
+            .addr = 512,
+            .size = cpu_to_le32(0x44 | PRDT_EOT),
+        }
+    };
+
+    dev = get_pci_device(&bmdma_bar, &ide_bar);
+    status = send_dma_request(CMD_READ_DMA, 0, 2,
+                              prdt, ARRAY_SIZE(prdt), NULL);
+    g_assert_cmphex(status, ==, 0);
+    assert_bit_clear(qpci_io_readb(dev, ide_bar, reg_status), DF | ERR);
+    free_pci_device(dev);
+}
+
 static void test_bmdma_long_prdt(void)
 {
     QPCIDevice *dev;
@@ -1037,6 +1063,8 @@ int main(int argc, char **argv)
     qtest_add_func("/ide/bmdma/short_prdt", test_bmdma_short_prdt);
     qtest_add_func("/ide/bmdma/one_sector_short_prdt",
                    test_bmdma_one_sector_short_prdt);
+    qtest_add_func("/ide/bmdma/partial_sector_short_prdt",
+                   test_bmdma_partial_sector_short_prdt);
     qtest_add_func("/ide/bmdma/long_prdt", test_bmdma_long_prdt);
     qtest_add_func("/ide/bmdma/no_busmaster", test_bmdma_no_busmaster);
     qtest_add_func("/ide/bmdma/teardown", test_bmdma_teardown);
-- 
2.17.1

      parent reply	other threads:[~2018-06-20  4:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20  4:29 [Qemu-devel] [PATCH 0/2] ide/hw/core: fix bug# 1777315, crash on short PRDs Amol Surati
2018-06-20  4:29 ` [Qemu-devel] [PATCH 1/2] ide/hw/core: fix crash on processing a partial-sector-size DMA xfer Amol Surati
2018-06-25 21:10   ` John Snow
2018-06-26  1:30     ` Amol Surati
2018-06-20  4:29 ` Amol Surati [this message]

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=20180620042930.24208-3-suratiamol@gmail.com \
    --to=suratiamol@gmail.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@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).