qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Kovalenko <igor.v.kovalenko@gmail.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] workaround for cmd646 bmdma register access while no dma is active
Date: Sun, 13 Dec 2009 21:00:54 +0300	[thread overview]
Message-ID: <b2fa41d60912131000k28547ebayfc33378629d8b1f6@mail.gmail.com> (raw)
In-Reply-To: <f43fc5580912130750r769da6c1r8bccc1948d28d00b@mail.gmail.com>

On Sun, Dec 13, 2009 at 6:50 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Sun, Dec 13, 2009 at 12:23 PM, Igor V. Kovalenko
> <igor.v.kovalenko@gmail.com> wrote:
>> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>>
>> This is a workaround only, and is a partial revert
>> of a few changes to BMDMAState which removed pci_dev
>> field on the way.
>>
>> - cmd646 pci_from_bm() expects bm->unit value to
>> correspond with bm data being passed to callback
>> as opaque pointer. This breaks when write to dma
>> control register of second channel happens when no
>> dma operation is in progress, so bm->unit is zero
>> for second channel, and pci_from_bm() returns garbage
>> pointer. Crash happens shortly after that while
>> dereferencing that pointer.
>
>>  static PCIIDEState *pci_from_bm(BMDMAState *bm)
>>  {
>> +    return bm->pci_dev;
>>     if (bm->unit == 0) {
>>         return container_of(bm, PCIIDEState, bmdma[0]);
>>     } else {
>
> I think you should delete the rest of the function, unused code is
> useless and if someone decides to fix and restore the old code, they
> can fetch it from git.

Thanks, resent with this change.

-- 
Kind regards,
Igor V. Kovalenko

  reply	other threads:[~2009-12-13 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-13 12:23 [Qemu-devel] [PATCH] workaround for cmd646 bmdma register access while no dma is active Igor V. Kovalenko
2009-12-13 15:50 ` Blue Swirl
2009-12-13 18:00   ` Igor Kovalenko [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-12-13 17:52 Igor V. Kovalenko

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=b2fa41d60912131000k28547ebayfc33378629d8b1f6@mail.gmail.com \
    --to=igor.v.kovalenko@gmail.com \
    --cc=blauwirbel@gmail.com \
    --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).