* [PATCH v2] dax: fix dax_core_init error return code
@ 2026-10-12 15:18 jianyungao89
2026-10-12 16:18 ` Gregory Price
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: jianyungao89 @ 2026-10-12 15:18 UTC (permalink / raw)
To: linux-kernel
Cc: Jianyun Gao, stable, Dan Williams, Vishal Verma, Dave Jiang,
Alison Schofield, open list:DEVICE DIRECT ACCESS (DAX),
open list:DEVICE DIRECT ACCESS (DAX)
From: Jianyun Gao <jianyungao89@gmail.com>
dax_core_init() mistakenly returns 0 on error paths. Change the
error return to use rc so the actual error code is propagated
to the caller.
Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
Cc: stable@vger.kernel.org
Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
---
Changes in v2:
- Drop unnecessary goto label, keep direct return for dax_fs_init() error
- Add Fixes tag and Cc stable
Link: https://lore.kernel.org/lkml/20261011132017.31131-1-jianyungao89@gmail.com/ # v1
drivers/dax/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 45f84b0eb909..210f4af479f0 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -738,7 +738,7 @@ static int __init dax_core_init(void)
unregister_chrdev_region(dax_devt, MINORMASK+1);
err_chrdev:
dax_fs_exit();
- return 0;
+ return rc;
}
static void __exit dax_core_exit(void)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] dax: fix dax_core_init error return code
2026-10-12 15:18 [PATCH v2] dax: fix dax_core_init error return code jianyungao89
@ 2026-10-12 16:18 ` Gregory Price
2026-10-12 23:04 ` Alison Schofield
2026-10-13 17:10 ` Dave Jiang
2 siblings, 0 replies; 5+ messages in thread
From: Gregory Price @ 2026-10-12 16:18 UTC (permalink / raw)
To: jianyungao89
Cc: linux-kernel, stable, Dan Williams, Vishal Verma, Dave Jiang,
Alison Schofield, open list:DEVICE DIRECT ACCESS (DAX),
open list:DEVICE DIRECT ACCESS (DAX)
On Mon, Oct 12, 2026 at 11:18:57PM +0800, jianyungao89@gmail.com wrote:
> From: Jianyun Gao <jianyungao89@gmail.com>
>
> dax_core_init() mistakenly returns 0 on error paths. Change the
> error return to use rc so the actual error code is propagated
> to the caller.
>
> Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] dax: fix dax_core_init error return code
2026-10-12 15:18 [PATCH v2] dax: fix dax_core_init error return code jianyungao89
2026-10-12 16:18 ` Gregory Price
@ 2026-10-12 23:04 ` Alison Schofield
2026-10-13 1:02 ` Jianyun Gao
2026-10-13 17:10 ` Dave Jiang
2 siblings, 1 reply; 5+ messages in thread
From: Alison Schofield @ 2026-10-12 23:04 UTC (permalink / raw)
To: jianyungao89
Cc: linux-kernel, stable, Dan Williams, Vishal Verma, Dave Jiang,
open list:DEVICE DIRECT ACCESS (DAX),
open list:DEVICE DIRECT ACCESS (DAX)
On Mon, Oct 12, 2026 at 11:18:57PM +0800, jianyungao89@gmail.com wrote:
> From: Jianyun Gao <jianyungao89@gmail.com>
>
> dax_core_init() mistakenly returns 0 on error paths. Change the
> error return to use rc so the actual error code is propagated
> to the caller.
Hi Jianyun,
Thanks for the patch. The change looks good to me.
I'd like to expand the commit message to explain the impact of the bug,
not just describe the correction. I've proposed a revised message below.
dax: Return errors from dax_core_init()
dax_core_init() returns success when either the character device
number allocation or DAX bus registration fails, even though the
error paths have already released the initialized resources.
For modular DAX, this allows the module to remain loaded despite
failed initialization, leaving subsequent users and module removal
to access resources that have already been released.
Return the error code from the failed operation so that module
loading fails rather than reporting successful initialization
after the resources have been released.
Please let me know if you're OK with the above, and I'll amend the commit
message and merge the patch.
-- Alison
>
> Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
> ---
>
> Changes in v2:
> - Drop unnecessary goto label, keep direct return for dax_fs_init() error
> - Add Fixes tag and Cc stable
>
> Link: https://lore.kernel.org/lkml/20261011132017.31131-1-jianyungao89@gmail.com/ # v1
>
> drivers/dax/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 45f84b0eb909..210f4af479f0 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -738,7 +738,7 @@ static int __init dax_core_init(void)
> unregister_chrdev_region(dax_devt, MINORMASK+1);
> err_chrdev:
> dax_fs_exit();
> - return 0;
> + return rc;
> }
>
> static void __exit dax_core_exit(void)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] dax: fix dax_core_init error return code
2026-10-12 23:04 ` Alison Schofield
@ 2026-10-13 1:02 ` Jianyun Gao
0 siblings, 0 replies; 5+ messages in thread
From: Jianyun Gao @ 2026-10-13 1:02 UTC (permalink / raw)
To: Alison Schofield
Cc: linux-kernel, stable, Dan Williams, Vishal Verma, Dave Jiang,
open list:DEVICE DIRECT ACCESS (DAX),
open list:DEVICE DIRECT ACCESS (DAX)
Hi Dan,
Thank you for reviewing the patch! The revised commit message looks
great to me. I'm OK with it.
Best regards,
Jianyun
On Tue, Oct 13, 2026 at 7:05 AM Alison Schofield
<alison.schofield@intel.com> wrote:
>
> On Mon, Oct 12, 2026 at 11:18:57PM +0800, jianyungao89@gmail.com wrote:
> > From: Jianyun Gao <jianyungao89@gmail.com>
> >
> > dax_core_init() mistakenly returns 0 on error paths. Change the
> > error return to use rc so the actual error code is propagated
> > to the caller.
>
>
> Hi Jianyun,
>
> Thanks for the patch. The change looks good to me.
>
> I'd like to expand the commit message to explain the impact of the bug,
> not just describe the correction. I've proposed a revised message below.
>
> dax: Return errors from dax_core_init()
>
> dax_core_init() returns success when either the character device
> number allocation or DAX bus registration fails, even though the
> error paths have already released the initialized resources.
>
> For modular DAX, this allows the module to remain loaded despite
> failed initialization, leaving subsequent users and module removal
> to access resources that have already been released.
>
> Return the error code from the failed operation so that module
> loading fails rather than reporting successful initialization
> after the resources have been released.
>
> Please let me know if you're OK with the above, and I'll amend the commit
> message and merge the patch.
>
> -- Alison
>
>
> >
> > Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
> > ---
> >
> > Changes in v2:
> > - Drop unnecessary goto label, keep direct return for dax_fs_init() error
> > - Add Fixes tag and Cc stable
> >
> > Link: https://lore.kernel.org/lkml/20261011132017.31131-1-jianyungao89@gmail.com/ # v1
> >
> > drivers/dax/super.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> > index 45f84b0eb909..210f4af479f0 100644
> > --- a/drivers/dax/super.c
> > +++ b/drivers/dax/super.c
> > @@ -738,7 +738,7 @@ static int __init dax_core_init(void)
> > unregister_chrdev_region(dax_devt, MINORMASK+1);
> > err_chrdev:
> > dax_fs_exit();
> > - return 0;
> > + return rc;
> > }
> >
> > static void __exit dax_core_exit(void)
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] dax: fix dax_core_init error return code
2026-10-12 15:18 [PATCH v2] dax: fix dax_core_init error return code jianyungao89
2026-10-12 16:18 ` Gregory Price
2026-10-12 23:04 ` Alison Schofield
@ 2026-10-13 17:10 ` Dave Jiang
2 siblings, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2026-10-13 17:10 UTC (permalink / raw)
To: jianyungao89, linux-kernel
Cc: stable, Dan Williams, Vishal Verma, Alison Schofield,
open list:DEVICE DIRECT ACCESS (DAX),
open list:DEVICE DIRECT ACCESS (DAX)
On 10/12/26 8:18 AM, jianyungao89@gmail.com wrote:
> From: Jianyun Gao <jianyungao89@gmail.com>
>
> dax_core_init() mistakenly returns 0 on error paths. Change the
> error return to use rc so the actual error code is propagated
> to the caller.
>
> Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>
> Changes in v2:
> - Drop unnecessary goto label, keep direct return for dax_fs_init() error
> - Add Fixes tag and Cc stable
>
> Link: https://lore.kernel.org/lkml/20261011132017.31131-1-jianyungao89@gmail.com/ # v1
>
> drivers/dax/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 45f84b0eb909..210f4af479f0 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -738,7 +738,7 @@ static int __init dax_core_init(void)
> unregister_chrdev_region(dax_devt, MINORMASK+1);
> err_chrdev:
> dax_fs_exit();
> - return 0;
> + return rc;
> }
>
> static void __exit dax_core_exit(void)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-13 17:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 15:18 [PATCH v2] dax: fix dax_core_init error return code jianyungao89
2026-10-12 16:18 ` Gregory Price
2026-10-12 23:04 ` Alison Schofield
2026-10-13 1:02 ` Jianyun Gao
2026-10-13 17:10 ` Dave Jiang
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.