* [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks
@ 2026-04-20 0:25 Yuho Choi
2026-04-20 6:21 ` Thomas Zimmermann
2026-04-21 5:58 ` [PATCH v1] " Thomas Zimmermann
0 siblings, 2 replies; 6+ messages in thread
From: Yuho Choi @ 2026-04-20 0:25 UTC (permalink / raw)
To: Thomas Zimmermann, Javier Martinez Canillas, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
linux-kernel, Myeonghun Pak, Ijae Kim, Taegyu Kim, Yuho Choi
display_get_pci_dev_of() gets a referenced PCI device via
pci_get_device(). Drop that reference when pci_enable_device() fails and
release it during the managed teardown path after pci_disable_device().
Without that, ofdrm leaks the pci_dev reference on both the error path
and the normal cleanup path.
Fixes: c8a17756c425 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers")
Co-developed-by: Myeonghun Pak <mhun512@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Co-developed-by: Taegyu Kim <tmk5904@psu.edu>
Signed-off-by: Taegyu Kim <tmk5904@psu.edu>
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/gpu/drm/sysfb/ofdrm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/sysfb/ofdrm.c b/drivers/gpu/drm/sysfb/ofdrm.c
index d38ba70f4e0d3..247cf13c80a05 100644
--- a/drivers/gpu/drm/sysfb/ofdrm.c
+++ b/drivers/gpu/drm/sysfb/ofdrm.c
@@ -350,6 +350,7 @@ static void ofdrm_pci_release(void *data)
struct pci_dev *pcidev = data;
pci_disable_device(pcidev);
+ pci_dev_put(pcidev);
}
static int ofdrm_device_init_pci(struct ofdrm_device *odev)
@@ -375,6 +376,7 @@ static int ofdrm_device_init_pci(struct ofdrm_device *odev)
if (ret) {
drm_err(dev, "pci_enable_device(%s) failed: %d\n",
dev_name(&pcidev->dev), ret);
+ pci_dev_put(pcidev);
return ret;
}
ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev);
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks
2026-04-20 0:25 [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks Yuho Choi
@ 2026-04-20 6:21 ` Thomas Zimmermann
2026-04-20 20:55 ` 최유호
2026-04-21 5:58 ` [PATCH v1] " Thomas Zimmermann
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Zimmermann @ 2026-04-20 6:21 UTC (permalink / raw)
To: Yuho Choi, Javier Martinez Canillas, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
linux-kernel, Myeonghun Pak, Ijae Kim, Taegyu Kim
Hi,
thanks for the patch.
Am 20.04.26 um 02:25 schrieb Yuho Choi:
> display_get_pci_dev_of() gets a referenced PCI device via
> pci_get_device(). Drop that reference when pci_enable_device() fails and
> release it during the managed teardown path after pci_disable_device().
>
> Without that, ofdrm leaks the pci_dev reference on both the error path
> and the normal cleanup path.
Did you use an AI to find or fix this bug?
https://docs.kernel.org/process/coding-assistants.html
Best regards
Thomas
>
> Fixes: c8a17756c425 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers")
> Co-developed-by: Myeonghun Pak <mhun512@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Co-developed-by: Taegyu Kim <tmk5904@psu.edu>
> Signed-off-by: Taegyu Kim <tmk5904@psu.edu>
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> ---
> drivers/gpu/drm/sysfb/ofdrm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/sysfb/ofdrm.c b/drivers/gpu/drm/sysfb/ofdrm.c
> index d38ba70f4e0d3..247cf13c80a05 100644
> --- a/drivers/gpu/drm/sysfb/ofdrm.c
> +++ b/drivers/gpu/drm/sysfb/ofdrm.c
> @@ -350,6 +350,7 @@ static void ofdrm_pci_release(void *data)
> struct pci_dev *pcidev = data;
>
> pci_disable_device(pcidev);
> + pci_dev_put(pcidev);
> }
>
> static int ofdrm_device_init_pci(struct ofdrm_device *odev)
> @@ -375,6 +376,7 @@ static int ofdrm_device_init_pci(struct ofdrm_device *odev)
> if (ret) {
> drm_err(dev, "pci_enable_device(%s) failed: %d\n",
> dev_name(&pcidev->dev), ret);
> + pci_dev_put(pcidev);
> return ret;
> }
> ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev);
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks
2026-04-20 6:21 ` Thomas Zimmermann
@ 2026-04-20 20:55 ` 최유호
2026-04-21 5:54 ` Thomas Zimmermann
2026-04-21 11:33 ` Markus Elfring
0 siblings, 2 replies; 6+ messages in thread
From: 최유호 @ 2026-04-20 20:55 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: Javier Martinez Canillas, dri-devel, Maarten Lankhorst,
Maxime Ripard, David Airlie, Simona Vetter, linux-kernel,
Myeonghun Pak, Ijae Kim, Taegyu Kim
Dear Thomas,
This issue was identified during our ongoing static-analysis research
while reviewing
kernel code. Specifically, an experimental static analysis tool found
that we are currently
developing. The tool is not public yet, so I prefer not to disclose
further project details
at this stage. AI was used only for cross-review, not as the primary
means of finding or
fixing the bug. I manually reviewed the code and verified the issue
before sending
the patch.
Best regards,
Yuho Choi
On Mon, 20 Apr 2026 at 02:21, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi,
>
> thanks for the patch.
>
> Am 20.04.26 um 02:25 schrieb Yuho Choi:
> > display_get_pci_dev_of() gets a referenced PCI device via
> > pci_get_device(). Drop that reference when pci_enable_device() fails and
> > release it during the managed teardown path after pci_disable_device().
> >
> > Without that, ofdrm leaks the pci_dev reference on both the error path
> > and the normal cleanup path.
>
> Did you use an AI to find or fix this bug?
>
> https://docs.kernel.org/process/coding-assistants.html
>
> Best regards
> Thomas
>
> >
> > Fixes: c8a17756c425 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers")
> > Co-developed-by: Myeonghun Pak <mhun512@gmail.com>
> > Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> > Co-developed-by: Ijae Kim <ae878000@gmail.com>
> > Signed-off-by: Ijae Kim <ae878000@gmail.com>
> > Co-developed-by: Taegyu Kim <tmk5904@psu.edu>
> > Signed-off-by: Taegyu Kim <tmk5904@psu.edu>
> > Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> > ---
> > drivers/gpu/drm/sysfb/ofdrm.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/sysfb/ofdrm.c b/drivers/gpu/drm/sysfb/ofdrm.c
> > index d38ba70f4e0d3..247cf13c80a05 100644
> > --- a/drivers/gpu/drm/sysfb/ofdrm.c
> > +++ b/drivers/gpu/drm/sysfb/ofdrm.c
> > @@ -350,6 +350,7 @@ static void ofdrm_pci_release(void *data)
> > struct pci_dev *pcidev = data;
> >
> > pci_disable_device(pcidev);
> > + pci_dev_put(pcidev);
> > }
> >
> > static int ofdrm_device_init_pci(struct ofdrm_device *odev)
> > @@ -375,6 +376,7 @@ static int ofdrm_device_init_pci(struct ofdrm_device *odev)
> > if (ret) {
> > drm_err(dev, "pci_enable_device(%s) failed: %d\n",
> > dev_name(&pcidev->dev), ret);
> > + pci_dev_put(pcidev);
> > return ret;
> > }
> > ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev);
>
> --
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
> GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks
2026-04-20 20:55 ` 최유호
@ 2026-04-21 5:54 ` Thomas Zimmermann
2026-04-21 11:33 ` Markus Elfring
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 5:54 UTC (permalink / raw)
To: 최유호
Cc: Javier Martinez Canillas, dri-devel, Maarten Lankhorst,
Maxime Ripard, David Airlie, Simona Vetter, linux-kernel,
Myeonghun Pak, Ijae Kim, Taegyu Kim
Hi
Am 20.04.26 um 22:55 schrieb 최유호:
> Dear Thomas,
>
> This issue was identified during our ongoing static-analysis research
> while reviewing
> kernel code. Specifically, an experimental static analysis tool found
> that we are currently
> developing. The tool is not public yet, so I prefer not to disclose
> further project details
> at this stage. AI was used only for cross-review, not as the primary
> means of finding or
> fixing the bug. I manually reviewed the code and verified the issue
> before sending
> the patch.
Thanks.
Best regards
Thomas
>
> Best regards,
> Yuho Choi
>
>
> On Mon, 20 Apr 2026 at 02:21, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Hi,
>>
>> thanks for the patch.
>>
>> Am 20.04.26 um 02:25 schrieb Yuho Choi:
>>> display_get_pci_dev_of() gets a referenced PCI device via
>>> pci_get_device(). Drop that reference when pci_enable_device() fails and
>>> release it during the managed teardown path after pci_disable_device().
>>>
>>> Without that, ofdrm leaks the pci_dev reference on both the error path
>>> and the normal cleanup path.
>> Did you use an AI to find or fix this bug?
>>
>> https://docs.kernel.org/process/coding-assistants.html
>>
>> Best regards
>> Thomas
>>
>>> Fixes: c8a17756c425 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers")
>>> Co-developed-by: Myeonghun Pak <mhun512@gmail.com>
>>> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
>>> Co-developed-by: Ijae Kim <ae878000@gmail.com>
>>> Signed-off-by: Ijae Kim <ae878000@gmail.com>
>>> Co-developed-by: Taegyu Kim <tmk5904@psu.edu>
>>> Signed-off-by: Taegyu Kim <tmk5904@psu.edu>
>>> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
>>> ---
>>> drivers/gpu/drm/sysfb/ofdrm.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/sysfb/ofdrm.c b/drivers/gpu/drm/sysfb/ofdrm.c
>>> index d38ba70f4e0d3..247cf13c80a05 100644
>>> --- a/drivers/gpu/drm/sysfb/ofdrm.c
>>> +++ b/drivers/gpu/drm/sysfb/ofdrm.c
>>> @@ -350,6 +350,7 @@ static void ofdrm_pci_release(void *data)
>>> struct pci_dev *pcidev = data;
>>>
>>> pci_disable_device(pcidev);
>>> + pci_dev_put(pcidev);
>>> }
>>>
>>> static int ofdrm_device_init_pci(struct ofdrm_device *odev)
>>> @@ -375,6 +376,7 @@ static int ofdrm_device_init_pci(struct ofdrm_device *odev)
>>> if (ret) {
>>> drm_err(dev, "pci_enable_device(%s) failed: %d\n",
>>> dev_name(&pcidev->dev), ret);
>>> + pci_dev_put(pcidev);
>>> return ret;
>>> }
>>> ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev);
>> --
>> --
>> Thomas Zimmermann
>> Graphics Driver Developer
>> SUSE Software Solutions Germany GmbH
>> Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
>> GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
>>
>>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks
2026-04-20 0:25 [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks Yuho Choi
2026-04-20 6:21 ` Thomas Zimmermann
@ 2026-04-21 5:58 ` Thomas Zimmermann
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 5:58 UTC (permalink / raw)
To: Yuho Choi, Javier Martinez Canillas, dri-devel
Cc: Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
linux-kernel, Myeonghun Pak, Ijae Kim, Taegyu Kim
Am 20.04.26 um 02:25 schrieb Yuho Choi:
> display_get_pci_dev_of() gets a referenced PCI device via
> pci_get_device(). Drop that reference when pci_enable_device() fails and
> release it during the managed teardown path after pci_disable_device().
>
> Without that, ofdrm leaks the pci_dev reference on both the error path
> and the normal cleanup path.
>
> Fixes: c8a17756c425 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers")
> Co-developed-by: Myeonghun Pak <mhun512@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Co-developed-by: Taegyu Kim <tmk5904@psu.edu>
> Signed-off-by: Taegyu Kim <tmk5904@psu.edu>
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/sysfb/ofdrm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/sysfb/ofdrm.c b/drivers/gpu/drm/sysfb/ofdrm.c
> index d38ba70f4e0d3..247cf13c80a05 100644
> --- a/drivers/gpu/drm/sysfb/ofdrm.c
> +++ b/drivers/gpu/drm/sysfb/ofdrm.c
> @@ -350,6 +350,7 @@ static void ofdrm_pci_release(void *data)
> struct pci_dev *pcidev = data;
>
> pci_disable_device(pcidev);
> + pci_dev_put(pcidev);
> }
>
> static int ofdrm_device_init_pci(struct ofdrm_device *odev)
> @@ -375,6 +376,7 @@ static int ofdrm_device_init_pci(struct ofdrm_device *odev)
> if (ret) {
> drm_err(dev, "pci_enable_device(%s) failed: %d\n",
> dev_name(&pcidev->dev), ret);
> + pci_dev_put(pcidev);
> return ret;
> }
> ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev);
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: drm/sysfb: ofdrm: fix PCI device reference leaks
2026-04-20 20:55 ` 최유호
2026-04-21 5:54 ` Thomas Zimmermann
@ 2026-04-21 11:33 ` Markus Elfring
1 sibling, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2026-04-21 11:33 UTC (permalink / raw)
To: Yuho Choi, Taegyu Kim, Myeonghun Pak, Ijae Kim, dri-devel
Cc: LKML, David Airlie, Javier Martinez Canillas, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
> This issue was identified during our ongoing static-analysis research
> while reviewing kernel code. Specifically, an experimental static analysis tool found
> that we are currently developing. The tool is not public yet, so I prefer not to disclose
> further project details at this stage. …
Will any additional background information become available?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/researcher-guidelines.rst?h=v7.0#n5
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-21 11:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 0:25 [PATCH v1] drm/sysfb: ofdrm: fix PCI device reference leaks Yuho Choi
2026-04-20 6:21 ` Thomas Zimmermann
2026-04-20 20:55 ` 최유호
2026-04-21 5:54 ` Thomas Zimmermann
2026-04-21 11:33 ` Markus Elfring
2026-04-21 5:58 ` [PATCH v1] " Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox