From mboxrd@z Thu Jan 1 00:00:00 1970 From: Murillo Bernardes Subject: [PATCH] Talk_to_backend on xenbus_probe only if drv->probe was sucessful Date: Mon, 12 Dec 2005 16:35:45 -0200 Message-ID: <200512121635.45358.mfb@br.ibm.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_BMcnDAzT5viq4n6" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_BMcnDAzT5viq4n6 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --Boundary-00=_BMcnDAzT5viq4n6 Content-Type: text/x-diff; charset="iso-8859-1"; name="talk_to_backend-after-drv_probe.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="talk_to_backend-after-drv_probe.patch" # 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 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: --Boundary-00=_BMcnDAzT5viq4n6 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_BMcnDAzT5viq4n6--