public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Jiang Liu <jiang.liu@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/vt-d: Fix an off-by-one bug in __domain_mapping()
Date: Mon, 1 Dec 2014 17:27:40 +0100	[thread overview]
Message-ID: <20141201162740.GK3762@8bytes.org> (raw)
In-Reply-To: <1416966130-866-1-git-send-email-jiang.liu@linux.intel.com>

On Wed, Nov 26, 2014 at 09:42:10AM +0800, Jiang Liu wrote:
> There's an off-by-one bug in function __domain_mapping(), which may
> trigger the BUG_ON(nr_pages < lvl_pages) when
> 	(nr_pages + 1) & superpage_mask == 0

What is the superpage_mask?

> The issue was introduced by commit 9051aa0268dc "intel-iommu: Combine
> domain_pfn_mapping() and domain_sg_mapping()", which sets sg_res to
> "nr_pages + 1" to avoid some of the 'sg_res==0' code paths.
> 
> It's safe to remove extra "+1" because sg_res is only used to calculate
> page size now.

>From your description and the (hard to read) code in __domain_mapping I
don't really understand the issue yet. Can you please elaborate on this
issue can be triggered?

Is the BUG_ON the only issue and, if yes, can that be fixed by just
changing the BUG_ON condition?

> 	This issue was introduced in v2.6.31, but intel-iommu.c has
> been moved into drivers/iommu in v3.1. So what's the preferred way
> to deal with stable kernels between v2.6.31 and v3.1?

Just remove the kernel version marker from the stable tag. The stable
kernel maintainers for kernels >3.1 will ask you to backport the patch
or just backport it by themselfes.


	Joerg


  reply	other threads:[~2014-12-01 16:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26  1:42 [PATCH] iommu/vt-d: Fix an off-by-one bug in __domain_mapping() Jiang Liu
2014-12-01 16:27 ` Joerg Roedel [this message]
2014-12-02  0:06   ` Jiang Liu
2014-12-02 10:34   ` David Woodhouse
2014-12-02 12:04     ` 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=20141201162740.GK3762@8bytes.org \
    --to=joro@8bytes.org \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jiang.liu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.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