Skip to content

Commit f997ea3

Browse files
YongjiXiemartinetd
authored andcommitted
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. Link: http://lkml.kernel.org/r/[email protected] Fixes: 86c8437 ("net/9p: Add sysfs mount_tag file for virtio 9P device") Signed-off-by: Xie Yongji <[email protected]> Signed-off-by: Dominique Martinet <[email protected]>
1 parent ff11764 commit f997ea3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/9p/trans_virtio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
610610
chan->vc_wq = kmalloc(sizeof(wait_queue_head_t), GFP_KERNEL);
611611
if (!chan->vc_wq) {
612612
err = -ENOMEM;
613-
goto out_free_tag;
613+
goto out_remove_file;
614614
}
615615
init_waitqueue_head(chan->vc_wq);
616616
chan->ring_bufs_avail = 1;
@@ -628,6 +628,8 @@ static int p9_virtio_probe(struct virtio_device *vdev)
628628

629629
return 0;
630630

631+
out_remove_file:
632+
sysfs_remove_file(&vdev->dev.kobj, &dev_attr_mount_tag.attr);
631633
out_free_tag:
632634
kfree(tag);
633635
out_free_vq:

0 commit comments

Comments
 (0)