Mailing List Archive

[PATCH 08/18] mini-os: avoid crash if no xenstore is provided
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
extras/mini-os/xenbus/xenbus.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/extras/mini-os/xenbus/xenbus.c b/extras/mini-os/xenbus/xenbus.c
index a8081fd..e475e2c 100644
--- a/extras/mini-os/xenbus/xenbus.c
+++ b/extras/mini-os/xenbus/xenbus.c
@@ -328,6 +328,10 @@ static int allocate_xenbus_id(void)
void init_xenbus(void)
{
int err;
+ if (!start_info.store_evtchn) {
+ printk("Skipping initialization of xenbus\n");
+ return;
+ }
printk("Initialising xenbus\n");
DEBUG("init_xenbus called.\n");
xenstore_buf = mfn_to_virt(start_info.store_mfn);
@@ -435,6 +439,11 @@ xenbus_msg_reply(int type,
DEFINE_WAIT(w);
struct xsd_sockmsg *rep;

+ if (!xenstore_buf) {
+ printk("xenbus_msg_reply called but no xenstore!\n");
+ return NULL;
+ }
+
id = allocate_xenbus_id();
add_waiter(w, req_info[id].waitq);

--
1.7.7.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
[PATCH 08/18] mini-os: avoid crash if no xenstore is provided [ In reply to ]
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
extras/mini-os/xenbus/xenbus.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/extras/mini-os/xenbus/xenbus.c b/extras/mini-os/xenbus/xenbus.c
index a8081fd..e475e2c 100644
--- a/extras/mini-os/xenbus/xenbus.c
+++ b/extras/mini-os/xenbus/xenbus.c
@@ -328,6 +328,10 @@ static int allocate_xenbus_id(void)
void init_xenbus(void)
{
int err;
+ if (!start_info.store_evtchn) {
+ printk("Skipping initialization of xenbus\n");
+ return;
+ }
printk("Initialising xenbus\n");
DEBUG("init_xenbus called.\n");
xenstore_buf = mfn_to_virt(start_info.store_mfn);
@@ -435,6 +439,11 @@ xenbus_msg_reply(int type,
DEFINE_WAIT(w);
struct xsd_sockmsg *rep;

+ if (!xenstore_buf) {
+ printk("xenbus_msg_reply called but no xenstore!\n");
+ return NULL;
+ }
+
id = allocate_xenbus_id();
add_waiter(w, req_info[id].waitq);

--
1.7.7.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 08/18] mini-os: avoid crash if no xenstore is provided [ In reply to ]
On Thu, 2012-01-12 at 23:35 +0000, Daniel De Graaf wrote:
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

I suppose we could arrange for xenbus to be omitted entirely but this is
easier.

Ian.

> ---
> extras/mini-os/xenbus/xenbus.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/extras/mini-os/xenbus/xenbus.c b/extras/mini-os/xenbus/xenbus.c
> index a8081fd..e475e2c 100644
> --- a/extras/mini-os/xenbus/xenbus.c
> +++ b/extras/mini-os/xenbus/xenbus.c
> @@ -328,6 +328,10 @@ static int allocate_xenbus_id(void)
> void init_xenbus(void)
> {
> int err;
> + if (!start_info.store_evtchn) {
> + printk("Skipping initialization of xenbus\n");
> + return;
> + }
> printk("Initialising xenbus\n");
> DEBUG("init_xenbus called.\n");
> xenstore_buf = mfn_to_virt(start_info.store_mfn);
> @@ -435,6 +439,11 @@ xenbus_msg_reply(int type,
> DEFINE_WAIT(w);
> struct xsd_sockmsg *rep;
>
> + if (!xenstore_buf) {
> + printk("xenbus_msg_reply called but no xenstore!\n");
> + return NULL;
> + }
> +
> id = allocate_xenbus_id();
> add_waiter(w, req_info[id].waitq);
>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel