* [PATCH] 9p/trans_virtio: Remove sysfs file on probe failure
@ 2021-05-17 8:35 Xie Yongji
2021-05-17 9:55 ` asmadeus
0 siblings, 1 reply; 3+ messages in thread
From: Xie Yongji @ 2021-05-17 8:35 UTC (permalink / raw)
To: ericvh, lucho, asmadeus; +Cc: v9fs-developer, linux-kernel
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@bytedance.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] 9p/trans_virtio: Remove sysfs file on probe failure
2021-05-17 8:35 [PATCH] 9p/trans_virtio: Remove sysfs file on probe failure Xie Yongji
@ 2021-05-17 9:55 ` asmadeus
2021-05-17 10:32 ` Yongji Xie
0 siblings, 1 reply; 3+ messages in thread
From: asmadeus @ 2021-05-17 9:55 UTC (permalink / raw)
To: Xie Yongji; +Cc: ericvh, lucho, v9fs-developer, linux-kernel
Xie Yongji wrote on Mon, May 17, 2021 at 04:35:57PM +0800:
> This ensures we don't leak the sysfs file if we failed to
> allocate chan->vc_wq during probe.
Right.
I'll add a Fixed tag and take to -next shortly
--
Dominique
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] 9p/trans_virtio: Remove sysfs file on probe failure
2021-05-17 9:55 ` asmadeus
@ 2021-05-17 10:32 ` Yongji Xie
0 siblings, 0 replies; 3+ messages in thread
From: Yongji Xie @ 2021-05-17 10:32 UTC (permalink / raw)
To: asmadeus; +Cc: ericvh, lucho, v9fs-developer, linux-kernel
On Mon, May 17, 2021 at 5:55 PM <asmadeus@codewreck.org> wrote:
>
> Xie Yongji wrote on Mon, May 17, 2021 at 04:35:57PM +0800:
> > This ensures we don't leak the sysfs file if we failed to
> > allocate chan->vc_wq during probe.
>
> Right.
> I'll add a Fixed tag and take to -next shortly
>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-17 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 8:35 [PATCH] 9p/trans_virtio: Remove sysfs file on probe failure Xie Yongji
2021-05-17 9:55 ` asmadeus
2021-05-17 10:32 ` Yongji Xie
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).