From: Andrew Morton <akpm@linux-foundation.org>
To: "Kun(llfl)" <llfl@linux.alibaba.com>
Cc: linux-kernel@vger.kernel.org,
Dan Williams <dan.j.williams@intel.com>,
Joao Martins <joao.m.martins@oracle.com>
Subject: Re: [PATCH 1/1] device-dax: Correct pgoff align in dax_set_mapping()
Date: Fri, 27 Sep 2024 10:46:46 -0700 [thread overview]
Message-ID: <20240927104646.3a0b777b5114ec62becd7f47@linux-foundation.org> (raw)
In-Reply-To: <23c02a03e8d666fef11bbe13e85c69c8b4ca0624.1727421694.git.llfl@linux.alibaba.com>
(cc's added)
On Fri, 27 Sep 2024 15:45:09 +0800 "Kun(llfl)" <llfl@linux.alibaba.com> wrote:
> pgoff should be aligned using ALIGN_DOWN() instead of ALIGN(). Otherwise,
> vmf->address not aligned to fault_size will be aligned to the next
> alignment, that can result in memory failure getting the wrong address.
>
> Fixes: b9b5777f09be ("device-dax: use ALIGN() for determining pgoff")
That's quite an old change. Can you suggest why it took this long to
be discovered? What is your userspace doing to trigger this?
> Signed-off-by: Kun(llfl) <llfl@linux.alibaba.com>
> Tested-by: JianXiong Zhao <zhaojianxiong.zjx@alibaba-inc.com>
> ---
> drivers/dax/device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dax/device.c b/drivers/dax/device.c
> index 9c1a729cd77e..6d74e62bbee0 100644
> --- a/drivers/dax/device.c
> +++ b/drivers/dax/device.c
> @@ -86,7 +86,7 @@ static void dax_set_mapping(struct vm_fault *vmf, pfn_t pfn,
> nr_pages = 1;
>
> pgoff = linear_page_index(vmf->vma,
> - ALIGN(vmf->address, fault_size));
> + ALIGN_DOWN(vmf->address, fault_size));
>
> for (i = 0; i < nr_pages; i++) {
> struct page *page = pfn_to_page(pfn_t_to_pfn(pfn) + i);
> --
> 2.43.0
next prev parent reply other threads:[~2024-09-27 17:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 7:45 Kun(llfl)
2024-09-27 17:46 ` Andrew Morton [this message]
2024-09-29 3:00 ` Kun(llfl)
2024-09-30 11:06 ` Joao Martins
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=20240927104646.3a0b777b5114ec62becd7f47@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=joao.m.martins@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llfl@linux.alibaba.com \
/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
all inboxes | Powered by JetHome®