* [PATCH] xen: don't continue xenstore initialization in case of errors
@ 2021-11-12 21:47 Stefano Stabellini
2021-11-15 10:08 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2021-11-12 21:47 UTC (permalink / raw)
To: jgross
Cc: boris.ostrovsky, xen-devel, linux-kernel, sstabellini,
Stefano Stabellini, Stable
From: Stefano Stabellini <stefano.stabellini@xilinx.com>
In case of errors in xenbus_init (e.g. missing xen_store_gfn parameter),
we goto out_error but we forget to reset xen_store_domain_type to
XS_UNKNOWN. As a consequence xenbus_probe_initcall and other initcalls
will still try to initialize xenstore resulting into a crash at boot.
[ 2.479830] Call trace:
[ 2.482314] xb_init_comms+0x18/0x150
[ 2.486354] xs_init+0x34/0x138
[ 2.489786] xenbus_probe+0x4c/0x70
[ 2.498432] xenbus_probe_initcall+0x2c/0x7c
[ 2.503944] do_one_initcall+0x54/0x1b8
[ 2.507358] kernel_init_freeable+0x1ac/0x210
[ 2.511617] kernel_init+0x28/0x130
[ 2.516112] ret_from_fork+0x10/0x20
Cc: <Stable@vger.kernel.org>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
drivers/xen/xenbus/xenbus_probe.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index bd003ca8acbe..34abf2b5967b 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -983,8 +983,10 @@ static int __init xenbus_init(void)
*/
proc_create_mount_point("xen");
#endif
+ return err;
out_error:
+ xen_store_domain_type = XS_UNKNOWN;
return err;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xen: don't continue xenstore initialization in case of errors
2021-11-12 21:47 [PATCH] xen: don't continue xenstore initialization in case of errors Stefano Stabellini
@ 2021-11-15 10:08 ` Jan Beulich
2021-11-15 22:25 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2021-11-15 10:08 UTC (permalink / raw)
To: Stefano Stabellini
Cc: boris.ostrovsky, xen-devel, linux-kernel, Stefano Stabellini,
Stable, jgross
On 12.11.2021 22:47, Stefano Stabellini wrote:
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -983,8 +983,10 @@ static int __init xenbus_init(void)
> */
> proc_create_mount_point("xen");
> #endif
> + return err;
Personally I think such cases would better be "return 0". With
that done here, err's initializer could (imo should) then also
be dropped.
Jan
> out_error:
> + xen_store_domain_type = XS_UNKNOWN;
> return err;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xen: don't continue xenstore initialization in case of errors
2021-11-15 10:08 ` Jan Beulich
@ 2021-11-15 22:25 ` Stefano Stabellini
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2021-11-15 22:25 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, boris.ostrovsky, xen-devel, linux-kernel,
Stefano Stabellini, Stable, jgross
On Mon, 15 Nov 2021, Jan Beulich wrote:
> On 12.11.2021 22:47, Stefano Stabellini wrote:
> > --- a/drivers/xen/xenbus/xenbus_probe.c
> > +++ b/drivers/xen/xenbus/xenbus_probe.c
> > @@ -983,8 +983,10 @@ static int __init xenbus_init(void)
> > */
> > proc_create_mount_point("xen");
> > #endif
> > + return err;
>
> Personally I think such cases would better be "return 0". With
> that done here, err's initializer could (imo should) then also
> be dropped.
I'll make both changes in the next version
> > out_error:
> > + xen_store_domain_type = XS_UNKNOWN;
> > return err;
> > }
> >
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-15 22:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 21:47 [PATCH] xen: don't continue xenstore initialization in case of errors Stefano Stabellini
2021-11-15 10:08 ` Jan Beulich
2021-11-15 22:25 ` Stefano Stabellini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).