All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "John Groves" <john@jagalactic.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH V6 03/10] dax/fsdev: clear vmemmap_shift when binding static pgmap
Date: Mon, 15 Jun 2026 16:25:01 +0000	[thread overview]
Message-ID: <20260615162501.92D1C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <0100019ecc090eea-7c46f51e-5393-402c-850d-78059bb6d343-000000@email.amazonses.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Dangling pointer in `dev_dax->pgmap` on probe failure for dynamic DAX devices permanently breaks subsequent driver binds.
--

commit fd456f28017271824ad7d531a3c134c95b20881f
Author: John Groves <John@Groves.net>

dax/fsdev: clear vmemmap_shift when binding static pgmap

This commit clears the vmemmap_shift on the shared pgmap for static DAX
devices when rebinding from device_dax to fsdev_dax. This explicitly
zeroes the shift before devm_memremap_pages() so the vmemmap is built
for order-0 folios.

> diff --git a/drivers/dax/fsdev.c b/drivers/dax/fsdev.c
> --- a/drivers/dax/fsdev.c
> +++ b/drivers/dax/fsdev.c
> @@ -237,6 +237,7 @@ static int fsdev_dax_probe(struct dev_dax *dev_dax)
>  		}
>  
>  		pgmap = dev_dax->pgmap;
> +		pgmap->vmemmap_shift = 0;

[Severity: High]
This is a pre-existing issue, but while reviewing the probe logic here,
could a dangling pointer occur during probe failure for dynamic DAX
devices in drivers/dax/device.c?

Looking at dev_dax_probe() in drivers/dax/device.c, dev_dax->pgmap is
assigned to a devm-managed allocation:

drivers/dax/device.c:dev_dax_probe() {
    ...
    dev_dax->pgmap = pgmap;
    ...
}

If a subsequent devm operation fails, such as:

drivers/dax/device.c:dev_dax_probe() {
    ...
    if (!devm_request_mem_region(dev, range->start,
                                 range_len(range), dev_name(dev))) {
        dev_warn(dev, "mapping%d: %#llx-%#llx could not reserve range\n",
                 i, range->start, range->end);
        return -EBUSY;
    }
    ...
}

The probe aborts and devres frees the pgmap. However, since dev_dax_kill
has not yet been registered as a devm action, dev_dax->pgmap is not reset
to NULL.

If a subsequent probe attempt occurs, would it hit this earlier check and
permanently fail by evaluating the dangling pointer?

drivers/dax/device.c:dev_dax_probe() {
    ...
    if (dev_dax->pgmap) {
        dev_warn(dev,
                 "dynamic-dax with pre-populated page map\n");
        return -EINVAL;
    }
    ...
}

Since the underlying dev_dax structure persists on the DAX bus, does this
effectively block the dynamic DAX device from being bound until it is
explicitly deleted and recreated?

>  	} else {
>  		size_t pgmap_size;
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/0100019ecc080a68-8dc0c99f-ab17-4aa9-83d9-490e9c97ac2e-000000@email.amazonses.com?part=3

  reply	other threads:[~2026-06-15 16:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260615160531.17432-1-john@jagalactic.com>
2026-06-15 16:05 ` [PATCH V6 0/10] Fixes to the previously-merged drivers/dax/fsdev series John Groves
2026-06-15 16:06   ` [PATCH V6 01/10] dax: fix misleading comment about share/index union in dax_folio_reset_order() John Groves
2026-06-15 16:06   ` [PATCH V6 02/10] dax/fsdev: fix multi-range offset in memory_failure handler John Groves
2026-06-15 16:25     ` sashiko-bot
2026-06-15 16:06   ` [PATCH V6 03/10] dax/fsdev: clear vmemmap_shift when binding static pgmap John Groves
2026-06-15 16:25     ` sashiko-bot [this message]
2026-06-15 16:06   ` [PATCH V6 04/10] dax/fsdev: don't leave a dangling dev_dax->pgmap on probe failure John Groves
2026-06-15 16:18     ` sashiko-bot
2026-06-15 16:07   ` [PATCH V6 05/10] dax/fsdev: clear pgmap ops and owner on unbind John Groves
2026-06-15 16:22     ` sashiko-bot
2026-06-15 16:07   ` [PATCH V6 06/10] dax/fsdev: use __va(phys) for kaddr in direct_access John Groves
2026-06-15 16:19     ` sashiko-bot
2026-06-15 16:07   ` [PATCH V6 07/10] dax/fsdev: fail probe on invalid pgmap offset John Groves
2026-06-15 18:22     ` sashiko-bot
2026-06-15 16:07   ` [PATCH V6 08/10] dax: read holder_ops once in dax_holder_notify_failure() John Groves
2026-06-15 16:20     ` sashiko-bot
2026-06-15 16:07   ` [PATCH V6 09/10] dax: fix holder_ops race in fs_put_dax() John Groves
2026-06-15 16:23     ` sashiko-bot
2026-06-15 16:07   ` [PATCH V6 10/10] dax: fsdev.c minor formatting cleanup John Groves

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=20260615162501.92D1C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=john@jagalactic.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.