[PATCH] sh: intc: Fix possible UAF in register_intc_controller

Chen Ridong <[email protected]>
Newsgroups gmane.linux.ports.sh.devel
Message-ID <[email protected]>
From: Chen Ridong <[email protected]>

When it goes to error, the 'd' is freed, but 'd->list' was not deleted
from 'intc_list', which may lead to a UAF.

Fixes: 01e9651a21bc ("sh: add INTC out of memory error handling")
Signed-off-by: Chen Ridong <[email protected]>
---
 drivers/sh/intc/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 74350b5871dc..a30d205e7a43 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -387,6 +387,7 @@ int __init register_intc_controller(struct intc_desc *desc)
 
 	kfree(d->window);
 err1:
+	list_del(&d->list);
 	kfree(d);
 err0:
 	pr_err("unable to allocate INTC memory\n");
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.