linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] 9p/xen: Add cleanup path in p9_trans_xen_init
@ 2019-04-30 14:39 YueHaibing
  2019-05-15 15:41 ` Dominique Martinet
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-04-30 14:39 UTC (permalink / raw)
  To: davem, ericvh, lucho, asmadeus
  Cc: linux-kernel, netdev, v9fs-developer, YueHaibing

If xenbus_register_frontend() fails in p9_trans_xen_init,
we should call v9fs_unregister_trans() to do cleanup.

Fixes: 868eb122739a ("xen/9pfs: introduce Xen 9pfs transport driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/9p/trans_xen.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 29420eb..3963eb1 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_front_driver = {
 
 static int p9_trans_xen_init(void)
 {
+	int rc;
+
 	if (!xen_domain())
 		return -ENODEV;
 
 	pr_info("Initialising Xen transport for 9pfs\n");
 
 	v9fs_register_trans(&p9_xen_trans);
-	return xenbus_register_frontend(&xen_9pfs_front_driver);
+	rc = xenbus_register_frontend(&xen_9pfs_front_driver);
+	if (rc)
+		v9fs_unregister_trans(&p9_xen_trans);
+
+	return rc;
 }
 module_init(p9_trans_xen_init);
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] 9p/xen: Add cleanup path in p9_trans_xen_init
  2019-04-30 14:39 [PATCH -next] 9p/xen: Add cleanup path in p9_trans_xen_init YueHaibing
@ 2019-05-15 15:41 ` Dominique Martinet
  0 siblings, 0 replies; 2+ messages in thread
From: Dominique Martinet @ 2019-05-15 15:41 UTC (permalink / raw)
  To: YueHaibing; +Cc: davem, ericvh, lucho, linux-kernel, netdev, v9fs-developer

YueHaibing wrote on Tue, Apr 30, 2019:
> If xenbus_register_frontend() fails in p9_trans_xen_init,
> we should call v9fs_unregister_trans() to do cleanup.
> 
> Fixes: 868eb122739a ("xen/9pfs: introduce Xen 9pfs transport driver")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Thanks, queued both in my repo - sorry for the delay.

-- 
Dominique

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-15 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 14:39 [PATCH -next] 9p/xen: Add cleanup path in p9_trans_xen_init YueHaibing
2019-05-15 15:41 ` Dominique Martinet

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).