Skip to content

Commit 957ea93

Browse files
ISCAS-VulabUlrich Hecht
authored andcommitted
media: cec: Fix debugfs leak on bus_register() failure
commit c43bcd2b2aa3c2ca9d2433c3990ecbc2c47d10eb upstream. In cec_devnode_init(), the debugfs directory created with debugfs_create_dir() is not removed if bus_register() fails. This leaves a stale "cec" entry in debugfs and prevents proper module reloading. Fix this by removing the debugfs directory in the error path. Fixes: a56960e ("[media] cec: add HDMI CEC framework (core)") Cc: stable@vger.kernel.org Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 0c03b8b commit 957ea93

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/media/cec/cec-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ static int __init cec_devnode_init(void)
455455

456456
ret = bus_register(&cec_bus_type);
457457
if (ret < 0) {
458+
debugfs_remove_recursive(top_cec_dir);
458459
unregister_chrdev_region(cec_dev_t, CEC_NUM_DEVICES);
459460
pr_warn("cec: bus_register failed\n");
460461
return -EIO;

0 commit comments

Comments
 (0)