iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jan Niehusmann <jan-7BUxKyILgIXQT0dZR+AlfA@public.gmane.org>
To: Aaron Campbell <aaron-J6AcJDG0ZEwdnm+yROfE0A@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
Subject: Re: [PATCH] iommu/vt-d: Fix infinite loop in free_all_cpu_cached_iovas
Date: Sun, 3 Jul 2016 09:53:14 +0200	[thread overview]
Message-ID: <20160703075314.GA3128@x61s.reliablesolutions.de> (raw)
In-Reply-To: <1467505404-3561-1-git-send-email-aaron-J6AcJDG0ZEwdnm+yROfE0A@public.gmane.org>

On Sat, Jul 02, 2016 at 09:23:24PM -0300, Aaron Campbell wrote:
> Per VT-d spec Section 10.4.2 ("Capability Register"), the maximum
> number of possible domains is 64K; indeed this is the maximum value
> that the cap_ndoms() macro will expand to.

Good catch. Before 3bd4f9112f87, the loop ended at the fixed value
0xffff. I didn't notice that cap_ndoms() could not only be lower than
that, like on my notebook, but could also be greater. Therefore I didn't
even look at the type of 'did'.

So, strictly speaking, the original code would not only overflow for
small values of cap_ndoms, but would miss the entry at 0xffff in case
cap_ndoms was 0x10000. My patch unfortunately changed that to an endless
loop, instead.

Jan

  parent reply	other threads:[~2016-07-03  7:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-03  0:23 [PATCH] iommu/vt-d: Fix infinite loop in free_all_cpu_cached_iovas Aaron Campbell
     [not found] ` <1467505404-3561-1-git-send-email-aaron-J6AcJDG0ZEwdnm+yROfE0A@public.gmane.org>
2016-07-03  7:53   ` Jan Niehusmann [this message]
2016-07-04 11:37   ` Joerg Roedel

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=20160703075314.GA3128@x61s.reliablesolutions.de \
    --to=jan-7buxkyilgixqt0dzr+alfa@public.gmane.org \
    --cc=aaron-J6AcJDG0ZEwdnm+yROfE0A@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jroedel-l3A5Bk7waGM@public.gmane.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).