[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517083557.172-1-xieyongji@bytedance.com>
Date: Mon, 17 May 2021 16:35:57 +0800
From: Xie Yongji <xieyongji@...edance.com>
To: ericvh@...il.com, lucho@...kov.net, asmadeus@...ewreck.org
Cc: v9fs-developer@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: [PATCH] 9p/trans_virtio: Remove sysfs file on probe failure
This ensures we don't leak the sysfs file if we failed to
allocate chan->vc_wq during probe.
Signed-off-by: Xie Yongji <xieyongji@...edance.com>
---
net/9p/trans_virtio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 93f2f8654882..0960ed1ad7ac 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -610,7 +610,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
chan->vc_wq = kmalloc(sizeof(wait_queue_head_t), GFP_KERNEL);
if (!chan->vc_wq) {
err = -ENOMEM;
- goto out_free_tag;
+ goto out_remove_file;
}
init_waitqueue_head(chan->vc_wq);
chan->ring_bufs_avail = 1;
@@ -628,6 +628,8 @@ static int p9_virtio_probe(struct virtio_device *vdev)
return 0;
+out_remove_file:
+ sysfs_remove_file(&vdev->dev.kobj, &dev_attr_mount_tag.attr);
out_free_tag:
kfree(tag);
out_free_vq:
--
2.11.0
Powered by blists - more mailing lists