[PATCH v2] drm/amdgpu: Fix potential double free and null pointer dereference

2022-11-21 Thread Liang He
In amdgpu_get_xgmi_hive(), we should not call kfree() after kobject_put() as the PUT will call kfree(). In amdgpu_device_ip_init(), we need to check the returned *hive* which can be NULL before we dereference it. Signed-off-by: Liang He --- v1->v2: we need the extra GET to keep *hive* al

[PATCH] drm/amdgpu: Fix Double Free, Null Pointer Dereference and MemLeak

2022-11-21 Thread Liang He
*hive* which can be NULL before we dereference it. Signed-off-by: Liang He --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 + drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 4 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b

[PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()

2022-07-25 Thread Liang He
c5b5 ("drm: Add support for Amlogic Meson Graphic Controller") Signed-off-by: Liang He Acked-by: Martin Blumenstingl --- drivers/gpu/drm/meson/meson_drv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/mes

Re:Re: [PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()

2022-07-25 Thread Liang He
At 2022-07-26 03:39:17, "Martin Blumenstingl" wrote: >Hello, > >On Fri, Jul 15, 2022 at 3:22 PM Liang He wrote: >> >> In this function, there are two refcount leak bugs: >> (1) when breaking out of for_each_endpoint_of_node(), we need call >> the o

[PATCH] drm/omap: dss: Fix refcount leak bugs

2022-07-22 Thread Liang He
In dss_init_ports() and __dss_uninit_ports(), we should call of_node_put() for the reference returned by of_graph_get_port_by_id() in fail path or when it is not used anymore. Fixes: 09bffa6e5192 ("drm: omap: use common OF graph helpers") Signed-off-by: Liang He --- drivers/gpu/drm/o

[PATCH] drm/sun4i: tcon: Fix refcount leak bug in sun4i_tcon_of_get_id_from_port()

2022-07-21 Thread Liang He
We should call of_node_put() for the reference returned by of_graph_get_remote_endpoint() when it is not used anymore. Fixes: e8d5bbf7f4c4 ("drm/sun4i: tcon: get TCON ID and matching engine with remote endpoint ID") Signed-off-by: Liang He --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 1

[PATCH] gpu: ipu-v3: common: Add of_node_put() for reference returned by of_graph_get_port_by_id()

2022-07-20 Thread Liang He
In ipu_add_client_devices(), we need to call of_node_put() for reference returned by of_graph_get_port_by_id() in fail path. Fixes: 17e052175039 ("gpu: ipu-v3: Do not bail out on missing optional port nodes") Signed-off-by: Liang He --- In fact, there may be another problem in foll

[PATCH v2 1/2] drm/bridge: anx7625: Fix refcount bug in anx7625_parse_dt()

2022-07-18 Thread Liang He
Fixes: 8bdfc5dae4e3 ("drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP") Signed-off-by: Liang He --- changelog: v2: (1) rebase with drm-misc-next advised by Robert Foss (2) use proper title (3) remove the v1's second bug ('ep0'), fixed recently v1: https://lor

[PATCH v2 2/2] drm/bridge: tc358767: Add of_node_put() when breaking out of loop

2022-07-18 Thread Liang He
In tc_probe_bridge_endpoint(), we should call of_node_put() when breaking out of the for_each_endpoint_of_node() which will automatically increase and decrease the refcount. Fixes: 71f7d9c03118 ("drm/bridge: tc358767: Detect bridge mode from connected endpoints in DT") Signed-off-by

Re:Re:Re: [PATCH] drm:bridge:analogix: Fix refcount bugs in anx7625_parse_dt()

2022-07-18 Thread Liang He
At 2022-07-18 19:56:09, "Liang He" wrote: > >At 2022-07-18 19:54:18, "Robert Foss" wrote: >>Hey Liang, >> >> >>On Thu, 7 Jul 2022 at 03:25, Liang He wrote: >>> >>> There are two refcount bugs in this funcion: >>

Re:Re: [PATCH] drm:bridge:analogix: Fix refcount bugs in anx7625_parse_dt()

2022-07-18 Thread Liang He
At 2022-07-18 19:55:16, "Robert Foss" wrote: >On Mon, 18 Jul 2022 at 13:54, Robert Foss wrote: >> >> Hey Liang, >> >> >> On Thu, 7 Jul 2022 at 03:25, Liang He wrote: >> > >> > There are two refcount bugs in this funcion: >> >

Re:Re: [PATCH] drm:bridge:analogix: Fix refcount bugs in anx7625_parse_dt()

2022-07-18 Thread Liang He
At 2022-07-18 19:54:18, "Robert Foss" wrote: >Hey Liang, > > >On Thu, 7 Jul 2022 at 03:25, Liang He wrote: >> >> There are two refcount bugs in this funcion: >> >> BUG-1: 'pdata->mipi_host_node' will be assigned a new reference with >

[PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()

2022-07-16 Thread Liang He
c5b5 ("drm: Add support for Amlogic Meson Graphic Controller") Signed-off-by: Liang He --- drivers/gpu/drm/meson/meson_drv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 1b70938cfd2c.

[PATCH v2] drm/imx/dcss: Add missing of_node_put() in fail path

2022-07-14 Thread Liang He
In dcss_dev_create() and dcss_dev_destroy(), we should call of_node_put() in fail path or before the dcss's destroy as of_graph_get_port_by_id() has increased the refcount. Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ") Signed-off-by: Liang He --- chang

Re:Re: [PATCH] drm/imx/dcss: Add missing of_node_put() in fail path

2022-07-14 Thread Liang He
gt;laurentiu > >On Thu, Jul 07, 2022 at 10:32:14AM +0800, Liang He wrote: >> In dcss_dev_create(), we should call of_node_put() in fail path for >> of_graph_get_port_by_id() which will increase the refcount. >> >> Fixes: 9021c317b770 ("drm/imx: Add initial suppor

[PATCH] drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node()

2022-07-11 Thread Liang He
d decrease the refcount. Fixes: ca454bd42dc2 ("drm/pl111: Support the Versatile Express") Signed-off-by: Liang He --- As 'Check-after-Put' has been widely accepted in kernel source, we just use it. If the maintainer thinks it is harmful, I'd like also to use 'Check-a

[PATCH] drm/mipi-dsi: Fix device_node's refcount bugs

2022-07-11 Thread Liang He
i_dsi_device_register_full() for DSI device creation") Signed-off-by: Liang He --- I have noticed that the of_node_get() is moved into of_mipi_dsi_device_add() which then call above register func in commit-c63ae8a9686b. However, as there are different ways to directly call the register, I t

[PATCH] drm/sprd: Remove of_node_put() in sprd_crtc_init()

2022-07-06 Thread Liang He
As the new reference created in 'dpu->base.port' will be escaped out, we need not to call of_node_put() again. Fixes: b07bcf34b6c9 ("drm/sprd: add Unisoc's drm display controller driver") Signed-off-by: Liang He --- drivers/gpu/drm/sprd/sprd_dpu.c | 1 - 1 file

[PATCH] drm/bridge:tc358767: Add of_node_put() when breaking out of loop

2022-07-06 Thread Liang He
In tc_probe_bridge_endpoint(), we should call of_node_put() when breaking out of the for_each_endpoint_of_node() which will automatically increase and decrease the refcount. Fixes: 71f7d9c03118 ("drm/bridge: tc358767: Detect bridge mode from connected endpoints in DT") Signed-off-by

[PATCH] drm/imx/dcss: Add missing of_node_put() in fail path

2022-07-06 Thread Liang He
In dcss_dev_create(), we should call of_node_put() in fail path for of_graph_get_port_by_id() which will increase the refcount. Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ") Signed-off-by: Liang He --- drivers/gpu/drm/imx/dcss/dcss-dev.c | 1 + 1 file

[PATCH] drm:bridge:analogix: Fix refcount bugs in anx7625_parse_dt()

2022-07-06 Thread Liang He
ge: anx7625: Add anx7625 MIPI DSI/DPI to DP") Fixes: fd0310b6fe7d ("drm/bridge: anx7625: add MIPI DPI input feature") Signed-off-by: Liang He --- drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625

[PATCH] video: fbdev: Fix refcount leak bug in valkyriefb.c

2022-06-17 Thread Liang He
In valkyriefb_init(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() in fail path or when it is not used anymore. Signed-off-by: Liang He --- drivers/video/fbdev/valkyriefb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers

Re:Re: [Linaro-mm-sig] Re: [PATCH] drivers: tty: serial: Add missing of_node_put() in serial-tegra.c

2022-06-16 Thread Liang He
At 2022-06-16 17:20:24, conor.doo...@microchip.com wrote: >On 16/06/2022 09:52, Liang He wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the >> content is safe >> >> At 2022-06-16 16:43:43, "Greg KH" wrote: >>> On

Re:Re: [Linaro-mm-sig] Re: [PATCH] drivers: tty: serial: Add missing of_node_put() in serial-tegra.c

2022-06-16 Thread Liang He
At 2022-06-16 16:43:43, "Greg KH" wrote: >On Wed, Jun 15, 2022 at 10:30:47PM +0200, Daniel Vetter wrote: >> On Wed, 15 Jun 2022 at 22:23, Dave Airlie wrote: >> > >> > On Wed, 15 Jun 2022 at 20:53, Greg KH wrote: >> > > >> > > On Wed, Jun 15, 2022 at 06:48:33PM +0800, heliang wrote: >> > > > In

[PATCH] drivers: tty: serial: Add missing of_node_put() in serial-tegra.c

2022-06-15 Thread Liang He
In tegra_uart_init(), of_find_matching_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Signed-off-by: Liang He --- drivers/tty/serial/serial-tegra.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial