Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vc4: possible memleak in vc4_hdmi_connector_get_modes #101

Closed
lategoodbye opened this issue Jul 22, 2017 · 3 comments
Closed

vc4: possible memleak in vc4_hdmi_connector_get_modes #101

lategoodbye opened this issue Jul 22, 2017 · 3 comments

Comments

@lategoodbye
Copy link

Hi,
i started my Raspberry Pi Zero W (4.13-rc1) without HDMI connected and after booting i connected HDMI. After some delay the kmemleak reported the following:

unreferenced object 0xd81cea00 (size 256):
  comm "kworker/0:1", pid 11, jiffies 4294951235 (age 2991.460s)
  hex dump (first 32 bytes):
    00 ff ff ff ff ff ff 00 22 f0 56 29 01 01 01 01  ........".V)....
    22 16 01 03 80 34 20 78 2a fc 81 a4 55 4d 9d 25  "....4 x*...UM.%
  backtrace:
    [<c07f741c>] kmemleak_alloc+0x60/0xc8
    [<c024fa60>] __kmalloc_track_caller+0x184/0x2f4
    [<c0223bf8>] krealloc+0x64/0x9c
    [<c0480410>] drm_do_get_edid+0xec/0x234
    [<c04805a4>] drm_get_edid+0x4c/0x304
    [<c049f230>] vc4_hdmi_connector_get_modes+0x30/0x90
    [<c0460fe8>] drm_helper_probe_single_connector_modes+0x250/0x5b4
    [<c046e03c>] drm_setup_crtcs+0x9c/0xafc
    [<c046eedc>] drm_fb_helper_hotplug_event+0x90/0xb4
    [<c046fa10>] drm_fbdev_cma_hotplug_event+0x20/0x24
    [<c049bd24>] vc4_output_poll_changed+0x20/0x24
    [<c0460850>] drm_kms_helper_hotplug_event+0x34/0x38
    [<c0460cac>] output_poll_execute+0x124/0x15c
    [<c013af68>] process_one_work+0x328/0x674
    [<c013c034>] worker_thread+0x2d0/0x444
    [<c0142078>] kthread+0x14c/0x16c
@lategoodbye
Copy link
Author

It seems that a similiar leak is there in linux-next-20170807 (RPI3 32bit):

unreferenced object 0xed5d6200 (size 256):
  comm "systemd-udevd", pid 133, jiffies 4294938237 (age 1097.920s)
  hex dump (first 32 bytes):
    00 ff ff ff ff ff ff 00 22 f0 56 29 01 01 01 01  ........".V)....
    22 16 01 03 80 34 20 78 2a fc 81 a4 55 4d 9d 25  "....4 x*...UM.%
  backtrace:
    [<c08250a8>] drm_do_get_edid+0xf8/0x230
    [<c0826998>] drm_get_edid+0x34/0x2f4
    [<bf27bfa4>] vc4_hdmi_connector_get_modes+0x20/0x84 [vc4]
    [<c080850c>] drm_helper_probe_single_connector_modes+0x198/0x680
    [<c0815948>] drm_setup_crtcs+0x16c/0xacc
    [<c08162c8>] __drm_fb_helper_initial_config_and_unlock+0x20/0x3f0
    [<c0817370>] drm_fbdev_cma_init_with_funcs+0x78/0xfc
    [<bf2793d4>] vc4_kms_load+0x8c/0xb8 [vc4]
    [<bf274998>] vc4_drm_bind+0xe0/0x130 [vc4]
    [<c08840f8>] try_to_bring_up_master+0x13c/0x184
    [<c08842fc>] component_master_add_with_match+0x80/0xb8
    [<bf274a78>] vc4_platform_drm_probe+0x90/0xa8 [vc4]
    [<c088af54>] platform_drv_probe+0x4c/0xac
    [<c08892ac>] driver_probe_device+0x224/0x2fc
    [<c0889430>] __driver_attach+0xac/0xb0
    [<c0887738>] bus_for_each_dev+0x64/0x94
unreferenced object 0xed49b300 (size 256):
  comm "kworker/1:2", pid 59, jiffies 4294938369 (age 1096.610s)
  hex dump (first 32 bytes):
    00 ff ff ff ff ff ff 00 22 f0 56 29 01 01 01 01  ........".V)....
    22 16 01 03 80 34 20 78 2a fc 81 a4 55 4d 9d 25  "....4 x*...UM.%
  backtrace:
    [<c08250a8>] drm_do_get_edid+0xf8/0x230
    [<c0826998>] drm_get_edid+0x34/0x2f4
    [<bf27bfa4>] vc4_hdmi_connector_get_modes+0x20/0x84 [vc4]
    [<c080850c>] drm_helper_probe_single_connector_modes+0x198/0x680
    [<c0815948>] drm_setup_crtcs+0x16c/0xacc
    [<c0816d2c>] drm_fb_helper_hotplug_event.part.7+0x78/0xe8
    [<c0808b54>] output_poll_execute+0x68/0x16c
    [<c035d884>] process_one_work+0x154/0x47c
    [<c035dbe4>] worker_thread+0x38/0x554
    [<c03632b0>] kthread+0x12c/0x16c
    [<c0307cc0>] ret_from_fork+0x14/0x34
    [<ffffffff>] 0xffffffff

@anholt
Copy link
Owner

anholt commented Aug 7, 2017

Yeah, need to kfree(edid)

@anholt
Copy link
Owner

anholt commented Aug 15, 2017

Fixed in drm-misc-next

@anholt anholt closed this as completed Aug 15, 2017
Lyude pushed a commit to Lyude/linux that referenced this issue Oct 11, 2017
We don't keep a pointer to it around anywhere, so it's our job to free
it.

Cc: Stefan Wahren <stefan.wahren@i2se.com>
Link: anholt/linux#101
Fixes: c8b75bc ("drm/vc4: Add KMS support for Raspberry Pi.")
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170808205605.4432-1-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
anholt added a commit that referenced this issue Nov 13, 2017
We don't keep a pointer to it around anywhere, so it's our job to free
it.

Cc: Stefan Wahren <stefan.wahren@i2se.com>
Link: #101
Fixes: c8b75bc ("drm/vc4: Add KMS support for Raspberry Pi.")
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170808205605.4432-1-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
(cherry picked from commit 5afe0e6)
anholt added a commit that referenced this issue Nov 21, 2017
We don't keep a pointer to it around anywhere, so it's our job to free
it.

Cc: Stefan Wahren <stefan.wahren@i2se.com>
Link: #101
Fixes: c8b75bc ("drm/vc4: Add KMS support for Raspberry Pi.")
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170808205605.4432-1-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
(cherry picked from commit 5afe0e6)
popcornmix pushed a commit to raspberrypi/linux that referenced this issue Feb 6, 2018
We don't keep a pointer to it around anywhere, so it's our job to free
it.

Cc: Stefan Wahren <stefan.wahren@i2se.com>
Link: anholt#101
Fixes: c8b75bc ("drm/vc4: Add KMS support for Raspberry Pi.")
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170808205605.4432-1-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
(cherry picked from commit 5afe0e6)
johalun pushed a commit to FreeBSDDesktop/kms-drm that referenced this issue Mar 23, 2018
We don't keep a pointer to it around anywhere, so it's our job to free
it.

Cc: Stefan Wahren <stefan.wahren@i2se.com>
Link: anholt/linux#101
Fixes: c8b75bca92cb ("drm/vc4: Add KMS support for Raspberry Pi.")
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170808205605.4432-1-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this issue Apr 7, 2018
commit 81d8808
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Aug 8 13:56:05 2017 -0700

    drm/vc4: Fix leak of HDMI EDID
    
    We don't keep a pointer to it around anywhere, so it's our job to free
    it.
    
    Cc: Stefan Wahren <stefan.wahren@i2se.com>
    Link: anholt/linux#101
    Fixes: c8b75bc ("drm/vc4: Add KMS support for Raspberry Pi.")
    Signed-off-by: Eric Anholt <eric@anholt.net>
    Link: https://patchwork.freedesktop.org/patch/msgid/20170808205605.4432-1-eric@anholt.net
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
    (cherry picked from commit 5afe0e62a548a0aa7d2095a98530b68f3d2c64e6)


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1461_81d8808b1b58d0cf750e641c20f7b5d32e975777.patch
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this issue Nov 11, 2018
commit 81d8808
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Aug 8 13:56:05 2017 -0700

    drm/vc4: Fix leak of HDMI EDID
    
    We don't keep a pointer to it around anywhere, so it's our job to free
    it.
    
    Cc: Stefan Wahren <stefan.wahren@i2se.com>
    Link: anholt/linux#101
    Fixes: c8b75bc ("drm/vc4: Add KMS support for Raspberry Pi.")
    Signed-off-by: Eric Anholt <eric@anholt.net>
    Link: https://patchwork.freedesktop.org/patch/msgid/20170808205605.4432-1-eric@anholt.net
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
    (cherry picked from commit 5afe0e62a548a0aa7d2095a98530b68f3d2c64e6)


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1461_81d8808b1b58d0cf750e641c20f7b5d32e975777.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants