All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] drm/vc4: drv: Add error handding for bind
       [not found] <CGME20201027041534epcas1p22f6b232a4d6be92dcc807f28baedab44@epcas1p2.samsung.com>
  2020-10-27  4:14   ` Hoegeun Kwon
@ 2020-10-27  4:14   ` Hoegeun Kwon
  0 siblings, 0 replies; 12+ messages in thread
From: Hoegeun Kwon @ 2020-10-27  4:14 UTC (permalink / raw)
  To: maxime, eric, airlied, daniel, robh+dt
  Cc: linux-kernel, devicetree, dri-devel, linux-arm-kernel,
	linux-rpi-kernel, bcm-kernel-feedback-list, dave.stevenson,
	sungguk.na, hoegeun.kwon

Hello all,

There is a problem that if vc4_drm bind fails, a memory leak occurs on
the drm_property_create side as shown below. Add error handding for
drm_mode_config.

unreferenced object 0xffffff80f5a7a6c8 (size 576):
  comm "swapper/0", pid 1, jiffies 4294892559 (age 181.448s)
  hex dump (first 32 bytes):
    00 00 1e 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    f8 f1 0e f5 80 ff ff ff e0 a6 a7 f5 80 ff ff ff  ................
  backtrace:
    [<00000000fd3656dc>] kmem_cache_alloc+0x1a4/0x328
    [<000000009dfa1aab>] radix_tree_node_alloc.constprop.19+0x50/0x108
    [<00000000a9f1657b>] idr_get_free+0x21c/0x2b8
    [<0000000099f2eea6>] idr_alloc_u32+0x68/0xf0
    [<00000000525beb52>] idr_alloc+0x44/0x80
    [<00000000dbfbaa4b>] __drm_mode_object_add+0x64/0xc0
    [<000000002c24dfc8>] drm_mode_object_add+0x3c/0x50
    [<00000000f45b491f>] drm_property_create+0xf0/0x1a0
    [<000000002e1a296b>] drm_connector_create_standard_properties+0x30/0x130
    [<000000007c53e4bd>] drm_mode_config_init+0x138/0x498
    [<00000000cc1b0767>] vc4_drm_bind+0x168/0x1f8
    [<0000000041d69f98>] try_to_bring_up_master+0x180/0x1e8
    [<00000000d1e1caae>] component_master_add_with_match+0xbc/0x108
    [<0000000085cea46d>] vc4_platform_drm_probe+0xd8/0x108
    [<00000000eacabf20>] platform_drv_probe+0x58/0xa8
    [<000000003822d094>] really_probe+0x10c/0x350

Best regards,
Hoegeun

Hoegeun Kwon (1):
  drm/vc4: drv: Add error handding for bind

 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 0/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-27  4:14   ` Hoegeun Kwon
  0 siblings, 0 replies; 12+ messages in thread
From: Hoegeun Kwon @ 2020-10-27  4:14 UTC (permalink / raw)
  To: maxime, eric, airlied, daniel, robh+dt
  Cc: devicetree, sungguk.na, dave.stevenson, linux-kernel, dri-devel,
	bcm-kernel-feedback-list, linux-rpi-kernel, hoegeun.kwon,
	linux-arm-kernel

Hello all,

There is a problem that if vc4_drm bind fails, a memory leak occurs on
the drm_property_create side as shown below. Add error handding for
drm_mode_config.

unreferenced object 0xffffff80f5a7a6c8 (size 576):
  comm "swapper/0", pid 1, jiffies 4294892559 (age 181.448s)
  hex dump (first 32 bytes):
    00 00 1e 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    f8 f1 0e f5 80 ff ff ff e0 a6 a7 f5 80 ff ff ff  ................
  backtrace:
    [<00000000fd3656dc>] kmem_cache_alloc+0x1a4/0x328
    [<000000009dfa1aab>] radix_tree_node_alloc.constprop.19+0x50/0x108
    [<00000000a9f1657b>] idr_get_free+0x21c/0x2b8
    [<0000000099f2eea6>] idr_alloc_u32+0x68/0xf0
    [<00000000525beb52>] idr_alloc+0x44/0x80
    [<00000000dbfbaa4b>] __drm_mode_object_add+0x64/0xc0
    [<000000002c24dfc8>] drm_mode_object_add+0x3c/0x50
    [<00000000f45b491f>] drm_property_create+0xf0/0x1a0
    [<000000002e1a296b>] drm_connector_create_standard_properties+0x30/0x130
    [<000000007c53e4bd>] drm_mode_config_init+0x138/0x498
    [<00000000cc1b0767>] vc4_drm_bind+0x168/0x1f8
    [<0000000041d69f98>] try_to_bring_up_master+0x180/0x1e8
    [<00000000d1e1caae>] component_master_add_with_match+0xbc/0x108
    [<0000000085cea46d>] vc4_platform_drm_probe+0xd8/0x108
    [<00000000eacabf20>] platform_drv_probe+0x58/0xa8
    [<000000003822d094>] really_probe+0x10c/0x350

Best regards,
Hoegeun

Hoegeun Kwon (1):
  drm/vc4: drv: Add error handding for bind

 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 0/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-27  4:14   ` Hoegeun Kwon
  0 siblings, 0 replies; 12+ messages in thread
From: Hoegeun Kwon @ 2020-10-27  4:14 UTC (permalink / raw)
  To: maxime, eric, airlied, daniel, robh+dt
  Cc: devicetree, sungguk.na, dave.stevenson, linux-kernel, dri-devel,
	bcm-kernel-feedback-list, linux-rpi-kernel, hoegeun.kwon,
	linux-arm-kernel

Hello all,

There is a problem that if vc4_drm bind fails, a memory leak occurs on
the drm_property_create side as shown below. Add error handding for
drm_mode_config.

unreferenced object 0xffffff80f5a7a6c8 (size 576):
  comm "swapper/0", pid 1, jiffies 4294892559 (age 181.448s)
  hex dump (first 32 bytes):
    00 00 1e 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    f8 f1 0e f5 80 ff ff ff e0 a6 a7 f5 80 ff ff ff  ................
  backtrace:
    [<00000000fd3656dc>] kmem_cache_alloc+0x1a4/0x328
    [<000000009dfa1aab>] radix_tree_node_alloc.constprop.19+0x50/0x108
    [<00000000a9f1657b>] idr_get_free+0x21c/0x2b8
    [<0000000099f2eea6>] idr_alloc_u32+0x68/0xf0
    [<00000000525beb52>] idr_alloc+0x44/0x80
    [<00000000dbfbaa4b>] __drm_mode_object_add+0x64/0xc0
    [<000000002c24dfc8>] drm_mode_object_add+0x3c/0x50
    [<00000000f45b491f>] drm_property_create+0xf0/0x1a0
    [<000000002e1a296b>] drm_connector_create_standard_properties+0x30/0x130
    [<000000007c53e4bd>] drm_mode_config_init+0x138/0x498
    [<00000000cc1b0767>] vc4_drm_bind+0x168/0x1f8
    [<0000000041d69f98>] try_to_bring_up_master+0x180/0x1e8
    [<00000000d1e1caae>] component_master_add_with_match+0xbc/0x108
    [<0000000085cea46d>] vc4_platform_drm_probe+0xd8/0x108
    [<00000000eacabf20>] platform_drv_probe+0x58/0xa8
    [<000000003822d094>] really_probe+0x10c/0x350

Best regards,
Hoegeun

Hoegeun Kwon (1):
  drm/vc4: drv: Add error handding for bind

 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/1] drm/vc4: drv: Add error handding for bind
       [not found]   ` <CGME20201027041535epcas1p489bbfe80b461f1e5c5deca1a571f1f35@epcas1p4.samsung.com>
  2020-10-27  4:14       ` Hoegeun Kwon
@ 2020-10-27  4:14       ` Hoegeun Kwon
  0 siblings, 0 replies; 12+ messages in thread
From: Hoegeun Kwon @ 2020-10-27  4:14 UTC (permalink / raw)
  To: maxime, eric, airlied, daniel, robh+dt
  Cc: linux-kernel, devicetree, dri-devel, linux-arm-kernel,
	linux-rpi-kernel, bcm-kernel-feedback-list, dave.stevenson,
	sungguk.na, hoegeun.kwon

There is a problem that if vc4_drm bind fails, a memory leak occurs on
the drm_property_create side. Add error handding for drm_mode_config.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index f1a5fd5dab6f..a17aa1db11b6 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -314,6 +314,7 @@ static int vc4_drm_bind(struct device *dev)
 	component_unbind_all(dev, drm);
 gem_destroy:
 	vc4_gem_destroy(drm);
+	drm_mode_config_cleanup(drm);
 	vc4_bo_cache_destroy(drm);
 dev_put:
 	drm_dev_put(drm);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 1/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-27  4:14       ` Hoegeun Kwon
  0 siblings, 0 replies; 12+ messages in thread
From: Hoegeun Kwon @ 2020-10-27  4:14 UTC (permalink / raw)
  To: maxime, eric, airlied, daniel, robh+dt
  Cc: devicetree, sungguk.na, dave.stevenson, linux-kernel, dri-devel,
	bcm-kernel-feedback-list, linux-rpi-kernel, hoegeun.kwon,
	linux-arm-kernel

There is a problem that if vc4_drm bind fails, a memory leak occurs on
the drm_property_create side. Add error handding for drm_mode_config.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index f1a5fd5dab6f..a17aa1db11b6 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -314,6 +314,7 @@ static int vc4_drm_bind(struct device *dev)
 	component_unbind_all(dev, drm);
 gem_destroy:
 	vc4_gem_destroy(drm);
+	drm_mode_config_cleanup(drm);
 	vc4_bo_cache_destroy(drm);
 dev_put:
 	drm_dev_put(drm);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 1/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-27  4:14       ` Hoegeun Kwon
  0 siblings, 0 replies; 12+ messages in thread
From: Hoegeun Kwon @ 2020-10-27  4:14 UTC (permalink / raw)
  To: maxime, eric, airlied, daniel, robh+dt
  Cc: devicetree, sungguk.na, dave.stevenson, linux-kernel, dri-devel,
	bcm-kernel-feedback-list, linux-rpi-kernel, hoegeun.kwon,
	linux-arm-kernel

There is a problem that if vc4_drm bind fails, a memory leak occurs on
the drm_property_create side. Add error handding for drm_mode_config.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index f1a5fd5dab6f..a17aa1db11b6 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -314,6 +314,7 @@ static int vc4_drm_bind(struct device *dev)
 	component_unbind_all(dev, drm);
 gem_destroy:
 	vc4_gem_destroy(drm);
+	drm_mode_config_cleanup(drm);
 	vc4_bo_cache_destroy(drm);
 dev_put:
 	drm_dev_put(drm);
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] drm/vc4: drv: Add error handding for bind
  2020-10-27  4:14       ` Hoegeun Kwon
  (?)
@ 2020-10-27 14:54         ` Maxime Ripard
  -1 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2020-10-27 14:54 UTC (permalink / raw)
  To: Hoegeun Kwon
  Cc: eric, airlied, daniel, robh+dt, linux-kernel, devicetree,
	dri-devel, linux-arm-kernel, linux-rpi-kernel,
	bcm-kernel-feedback-list, dave.stevenson, sungguk.na

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

Hi,

On Tue, Oct 27, 2020 at 01:14:42PM +0900, Hoegeun Kwon wrote:
> There is a problem that if vc4_drm bind fails, a memory leak occurs on
> the drm_property_create side. Add error handding for drm_mode_config.
> 
> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>

Applied, thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-27 14:54         ` Maxime Ripard
  0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2020-10-27 14:54 UTC (permalink / raw)
  To: Hoegeun Kwon
  Cc: devicetree, sungguk.na, dave.stevenson, airlied, linux-kernel,
	dri-devel, eric, robh+dt, bcm-kernel-feedback-list,
	linux-rpi-kernel, daniel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 307 bytes --]

Hi,

On Tue, Oct 27, 2020 at 01:14:42PM +0900, Hoegeun Kwon wrote:
> There is a problem that if vc4_drm bind fails, a memory leak occurs on
> the drm_property_create side. Add error handding for drm_mode_config.
> 
> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>

Applied, thanks!
Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-27 14:54         ` Maxime Ripard
  0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2020-10-27 14:54 UTC (permalink / raw)
  To: Hoegeun Kwon
  Cc: devicetree, sungguk.na, dave.stevenson, airlied, linux-kernel,
	dri-devel, robh+dt, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 307 bytes --]

Hi,

On Tue, Oct 27, 2020 at 01:14:42PM +0900, Hoegeun Kwon wrote:
> There is a problem that if vc4_drm bind fails, a memory leak occurs on
> the drm_property_create side. Add error handding for drm_mode_config.
> 
> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>

Applied, thanks!
Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] drm/vc4: drv: Add error handding for bind
  2020-10-27 14:54         ` Maxime Ripard
  (?)
@ 2020-10-28 11:29           ` Daniel Vetter
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2020-10-28 11:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Hoegeun Kwon, eric, airlied, daniel, robh+dt, linux-kernel,
	devicetree, dri-devel, linux-arm-kernel, linux-rpi-kernel,
	bcm-kernel-feedback-list, dave.stevenson, sungguk.na

On Tue, Oct 27, 2020 at 03:54:31PM +0100, Maxime Ripard wrote:
> Hi,
> 
> On Tue, Oct 27, 2020 at 01:14:42PM +0900, Hoegeun Kwon wrote:
> > There is a problem that if vc4_drm bind fails, a memory leak occurs on
> > the drm_property_create side. Add error handding for drm_mode_config.
> > 
> > Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
> 
> Applied, thanks!

Switching over to drmm_ version of this would also be good I think.
Together with the devm_ version for allocating the drm_device you could
delete a pile of that fragile cleanup code.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-28 11:29           ` Daniel Vetter
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2020-10-28 11:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: devicetree, sungguk.na, dave.stevenson, airlied, linux-kernel,
	dri-devel, eric, robh+dt, bcm-kernel-feedback-list,
	linux-rpi-kernel, daniel, Hoegeun Kwon, linux-arm-kernel

On Tue, Oct 27, 2020 at 03:54:31PM +0100, Maxime Ripard wrote:
> Hi,
> 
> On Tue, Oct 27, 2020 at 01:14:42PM +0900, Hoegeun Kwon wrote:
> > There is a problem that if vc4_drm bind fails, a memory leak occurs on
> > the drm_property_create side. Add error handding for drm_mode_config.
> > 
> > Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
> 
> Applied, thanks!

Switching over to drmm_ version of this would also be good I think.
Together with the devm_ version for allocating the drm_device you could
delete a pile of that fragile cleanup code.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] drm/vc4: drv: Add error handding for bind
@ 2020-10-28 11:29           ` Daniel Vetter
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2020-10-28 11:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: devicetree, sungguk.na, dave.stevenson, airlied, linux-kernel,
	dri-devel, robh+dt, bcm-kernel-feedback-list, linux-rpi-kernel,
	Hoegeun Kwon, linux-arm-kernel

On Tue, Oct 27, 2020 at 03:54:31PM +0100, Maxime Ripard wrote:
> Hi,
> 
> On Tue, Oct 27, 2020 at 01:14:42PM +0900, Hoegeun Kwon wrote:
> > There is a problem that if vc4_drm bind fails, a memory leak occurs on
> > the drm_property_create side. Add error handding for drm_mode_config.
> > 
> > Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
> 
> Applied, thanks!

Switching over to drmm_ version of this would also be good I think.
Together with the devm_ version for allocating the drm_device you could
delete a pile of that fragile cleanup code.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-10-28 22:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201027041534epcas1p22f6b232a4d6be92dcc807f28baedab44@epcas1p2.samsung.com>
2020-10-27  4:14 ` [PATCH 0/1] drm/vc4: drv: Add error handding for bind Hoegeun Kwon
2020-10-27  4:14   ` Hoegeun Kwon
2020-10-27  4:14   ` Hoegeun Kwon
     [not found]   ` <CGME20201027041535epcas1p489bbfe80b461f1e5c5deca1a571f1f35@epcas1p4.samsung.com>
2020-10-27  4:14     ` [PATCH 1/1] " Hoegeun Kwon
2020-10-27  4:14       ` Hoegeun Kwon
2020-10-27  4:14       ` Hoegeun Kwon
2020-10-27 14:54       ` Maxime Ripard
2020-10-27 14:54         ` Maxime Ripard
2020-10-27 14:54         ` Maxime Ripard
2020-10-28 11:29         ` Daniel Vetter
2020-10-28 11:29           ` Daniel Vetter
2020-10-28 11:29           ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.