[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwXn2ak_zjKyVGznYwoCDewHicFYX-ngLtrofDPyQ0N=w@mail.gmail.com>
Date: Tue, 10 Nov 2015 09:43:03 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Joerg Roedel <joro@...tes.org>
Cc: "open list:AMD IOMMU (AMD-VI)" <iommu@...ts.linux-foundation.org>,
Oded Gabbay <oded.gabbay@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 4/4] iommu/vt-d: Do access checks before calling handle_mm_fault()
On Tue, Nov 10, 2015 at 5:26 AM, Joerg Roedel <joro@...tes.org> wrote:
> +
> +static bool access_error(struct vm_area_struct *vma, struct page_req_dsc *req)
> +{
> + return !((req->rd_req && (vma->vm_flags & VM_READ)) ||
> + (req->wr_req && (vma->vm_flags & VM_WRITE)) ||
> + (req->exe_req && (vma->vm_flags & VM_EXEC)));
> +}
This seems odd.
Shouldn't it be
return ((req->rd_req && !(vma->vm_flags & VM_READ)) ||
(req->wr_req && !(vma->vm_flags & VM_WRITE)) ||
(req->exe_req && !(vma->vm_flags & VM_EXEC)));
instead?
Of course, if you just used the VM_xyz flags internally itself, this
would all be easier, and you'd end up with something like
/* Do we have requested bits that aren't in the allowed set? */
return (requested & ~vma->vm_flags) != 0;
instead..
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists