From: Murillo Bernardes <mfb@br.ibm.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] Talk_to_backend on xenbus_probe only if drv->probe was sucessful
Date: Mon, 12 Dec 2005 16:35:45 -0200 [thread overview]
Message-ID: <200512121635.45358.mfb@br.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 348 bytes --]
Hi,
This patch makes xenbus_probe only call talk_to_backend if drv->probe() was
sucessful.
There is no sense in add a watch before drv->probe, because if it fails the
otherend_changed callback will be called and receive a struct with invalid
pointers and we get a segfault (ooops).
--
Murillo Fernandes Bernardes
IBM Linux Technology Center
[-- Attachment #2: talk_to_backend-after-drv_probe.patch --]
[-- Type: text/x-diff, Size: 1215 bytes --]
# HG changeset patch
# User root@localhost.localdomain
# Node ID 9ecd0d7fc6693e2aaceeb5e8c28af84109e9d3d8
# Parent bdcb115c667a12a5514517456639142c1273b0f1
Put watch on device node only if probe was sucessful.
This fix segfault on netfront when creating more than three network devices on domU.
Signed-off-by: Murillo F. Bernardes <mfb@br.ibm.com>
diff -r bdcb115c667a -r 9ecd0d7fc669 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Sat Dec 10 23:20:08 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Dec 12 17:50:37 2005
@@ -338,6 +338,21 @@
DPRINTK("");
+ if (!drv->probe) {
+ err = -ENODEV;
+ goto fail;
+ }
+
+ id = match_device(drv->ids, dev);
+ if (!id) {
+ err = -ENODEV;
+ goto fail;
+ }
+
+ err = drv->probe(dev, id);
+ if (err)
+ goto fail;
+
err = talk_to_otherend(dev);
if (err) {
printk(KERN_WARNING
@@ -345,21 +360,6 @@
dev->nodename);
return err;
}
-
- if (!drv->probe) {
- err = -ENODEV;
- goto fail;
- }
-
- id = match_device(drv->ids, dev);
- if (!id) {
- err = -ENODEV;
- goto fail;
- }
-
- err = drv->probe(dev, id);
- if (err)
- goto fail;
return 0;
fail:
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2005-12-12 18:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-12 18:35 Murillo Bernardes [this message]
2005-12-15 13:38 ` [PATCH] Talk_to_backend on xenbus_probe only if drv->probe was sucessful Ewan Mellor
2005-12-15 16:59 ` Murillo Bernardes
2005-12-15 17:18 ` Ewan Mellor
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=200512121635.45358.mfb@br.ibm.com \
--to=mfb@br.ibm.com \
--cc=xen-devel@lists.xensource.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 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.