[PATCH] misc: ocxl: fix possible refcount leak in afu_ioctl()

2022-08-24 Thread Hangyu Hua
eventfd_ctx_put need to be called to put the refcount that gotten by eventfd_ctx_fdget when ocxl_irq_set_handler fails. Fixes: 060146614643 ("ocxl: move event_fd handling to frontend") Signed-off-by: Hangyu Hua --- drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+)

Re: [PATCH] misc: ocxl: fix possible double free in ocxl_file_register_afu

2022-04-20 Thread Hangyu Hua
On 2022/4/21 06:54, Michael Ellerman wrote: Hangyu Hua writes: info_release() will be called in device_unregister() when info->dev's reference count is 0. So there is no need to call ocxl_afu_put() and kfree() again. Double frees are often exploitable. But it looks to me like this error p

Re: [PATCH] misc: ocxl: fix possible double free in ocxl_file_register_afu

2022-04-19 Thread Hangyu Hua
On 2022/4/19 17:09, Frederic Barrat wrote: On 18/04/2022 10:57, Hangyu Hua wrote: info_release() will be called in device_unregister() when info->dev's reference count is 0. So there is no need to call ocxl_afu_put() and kfree() again. Fix this by adding free_minor() and ret

[PATCH] misc: ocxl: fix possible double free in ocxl_file_register_afu

2022-04-18 Thread Hangyu Hua
een ocxl backend & frontend") Signed-off-by: Hangyu Hua --- drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index d881f5e40ad9..6777c419a8da 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl

Re: [PATCH v2] powerpc: kernel: fix refcount leak in format_show()

2022-03-06 Thread Hangyu Hua
Any further suggestions for this patch? guys. Thanks. On 2022/3/2 10:19, Hangyu Hua wrote: Refcount leak will happen when format_show returns failure in multiple cases. Unified management of of_node_put can fix this problem. Signed-off-by: Hangyu Hua --- v2: 1. change the title

Re: [PATCH] powerpc: 8xx: fix a return value error in mpc8xx_pic_init

2022-03-06 Thread Hangyu Hua
Ping? On 2022/2/23 15:02, Hangyu Hua wrote: mpc8xx_pic_init() should return -ENOMEM instead of 0 when irq_domain_add_linear() return NULL. This cause mpc8xx_pics_init to continue executing even if mpc8xx_pic_host is NULL. Fixes: cc76404feaed ("powerpc/8xx: Fix possible device node refe

[PATCH v2] powerpc: kernel: fix refcount leak in format_show()

2022-03-01 Thread Hangyu Hua
Refcount leak will happen when format_show returns failure in multiple cases. Unified management of of_node_put can fix this problem. Signed-off-by: Hangyu Hua --- v2: 1. change the title and description information. 2. fix all possible refcount leak. arch/powerpc/kernel/secvar-sysfs.c | 9

Re: [PATCH] powerpc: kernel: fix a refcount leak in format_show()

2022-03-01 Thread Hangyu Hua
Thanks. I will resubmit my patch latter. On 2022/3/2 03:50, Tyrel Datwyler wrote: On 3/1/22 04:55, Michael Ellerman wrote: Hangyu Hua writes: node needs to be dropped when of_property_read_string fails. So an earlier call to of_node_put is required here. That's true but ... diff --git

[PATCH] powerpc: kernel: fix a refcount leak in format_show()

2022-02-28 Thread Hangyu Hua
node needs to be dropped when of_property_read_string fails. So an earlier call to of_node_put is required here. Signed-off-by: Hangyu Hua --- arch/powerpc/kernel/secvar-sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch

[PATCH] powerpc: 8xx: fix a return value error in mpc8xx_pic_init

2022-02-23 Thread Hangyu Hua
mpc8xx_pic_init() should return -ENOMEM instead of 0 when irq_domain_add_linear() return NULL. This cause mpc8xx_pics_init to continue executing even if mpc8xx_pic_host is NULL. Fixes: cc76404feaed ("powerpc/8xx: Fix possible device node reference leak") Signed-off-by: Hangyu Hua