* [PATCH] drm/bochs: Drop manual put on probe error path @ 2026-04-24 12:34 Myeonghun Pak 2026-04-24 13:25 ` Thomas Zimmermann 0 siblings, 1 reply; 5+ messages in thread From: Myeonghun Pak @ 2026-04-24 12:34 UTC (permalink / raw) To: Gerd Hoffmann, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter Cc: Myeonghun Pak, virtualization, dri-devel, linux-kernel bochs_pci_probe() allocates the DRM device with devm_drm_dev_alloc(), which registers a devres action to drop the initial DRM device reference on driver detach or probe failure. The error path currently calls drm_dev_put() manually. If probe then returns an error, devres will run the registered release action and put the same device again, after the first put may already have released it. Return the probe error directly and let devres own the final put. Signed-off-by: Myeonghun Pak <mhun512@gmail.com> --- drivers/gpu/drm/tiny/bochs.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 222e4ae1ab..5d8dc5efec 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -761,25 +761,21 @@ static int bochs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent ret = pcim_enable_device(pdev); if (ret) - goto err_free_dev; + return ret; pci_set_drvdata(pdev, dev); ret = bochs_load(bochs); if (ret) - goto err_free_dev; + return ret; ret = drm_dev_register(dev, 0); if (ret) - goto err_free_dev; + return ret; drm_client_setup(dev, NULL); return ret; - -err_free_dev: - drm_dev_put(dev); - return ret; } static void bochs_pci_remove(struct pci_dev *pdev) -- 2.39.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/bochs: Drop manual put on probe error path 2026-04-24 12:34 [PATCH] drm/bochs: Drop manual put on probe error path Myeonghun Pak @ 2026-04-24 13:25 ` Thomas Zimmermann [not found] ` <CAGEsz8FrkbQEWZbxV3Q0NkSxhQka575uemKMQtTJQaCm44ByxQ@mail.gmail.com> 0 siblings, 1 reply; 5+ messages in thread From: Thomas Zimmermann @ 2026-04-24 13:25 UTC (permalink / raw) To: Myeonghun Pak, Gerd Hoffmann, Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter Cc: virtualization, dri-devel, linux-kernel Hi, please add fixes tags to all these patches you're sending. You also need to CC stable so that they can be backported easily. Also list the AI you're using to find and create these patches. Best regards Thomas Am 24.04.26 um 14:34 schrieb Myeonghun Pak: > bochs_pci_probe() allocates the DRM device with devm_drm_dev_alloc(), > which registers a devres action to drop the initial DRM device reference > on driver detach or probe failure. > > The error path currently calls drm_dev_put() manually. If probe then > returns an error, devres will run the registered release action and put > the same device again, after the first put may already have released it. > > Return the probe error directly and let devres own the final put. > > Signed-off-by: Myeonghun Pak <mhun512@gmail.com> > --- > drivers/gpu/drm/tiny/bochs.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c > index 222e4ae1ab..5d8dc5efec 100644 > --- a/drivers/gpu/drm/tiny/bochs.c > +++ b/drivers/gpu/drm/tiny/bochs.c > @@ -761,25 +761,21 @@ static int bochs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent > > ret = pcim_enable_device(pdev); > if (ret) > - goto err_free_dev; > + return ret; > > pci_set_drvdata(pdev, dev); > > ret = bochs_load(bochs); > if (ret) > - goto err_free_dev; > + return ret; > > ret = drm_dev_register(dev, 0); > if (ret) > - goto err_free_dev; > + return ret; > > drm_client_setup(dev, NULL); > > return ret; > - > -err_free_dev: > - drm_dev_put(dev); > - return ret; > } > > static void bochs_pci_remove(struct pci_dev *pdev) -- -- 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] 5+ messages in thread
[parent not found: <CAGEsz8FrkbQEWZbxV3Q0NkSxhQka575uemKMQtTJQaCm44ByxQ@mail.gmail.com>]
* Re: [PATCH] drm/bochs: Drop manual put on probe error path [not found] ` <CAGEsz8FrkbQEWZbxV3Q0NkSxhQka575uemKMQtTJQaCm44ByxQ@mail.gmail.com> @ 2026-04-24 14:59 ` Thomas Zimmermann [not found] ` <CAGEsz8F54LaiJYGD6i-nW7hDiLTu6FOi4Z8fzb8b4=+9-OEH+Q@mail.gmail.com> 0 siblings, 1 reply; 5+ messages in thread From: Thomas Zimmermann @ 2026-04-24 14:59 UTC (permalink / raw) To: Myeonghun Pak Cc: Gerd Hoffmann, Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter, virtualization, dri-devel, linux-kernel Hi Am 24.04.26 um 15:40 schrieb Myeonghun Pak: > Hi Thomas, > > Thank you for your reply. I will ensure that the requested |Fixes| tag > and |stable| CC are included in the next patch I send. > > Regarding your request for information about AI usage and how the > issue was identified: > > * This issue was identified during our ongoing static-analysis > research while reviewing kernel code. > 1 > <https://mail.google.com/mail/u/0/#all/%23thread-f:1863355320119932959> > * Specifically, it was found by an experimental static analysis tool > 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. > > I will incorporate your requests and this additional context, and then > resend the modified patch. Thanks a lot. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Best regards Thomas > > Thank you. > > Myeonghun Pak > > > 2026년 4월 24일 (금) 오후 10:25, Thomas Zimmermann > <tzimmermann@suse.de>님이 작성: > > Hi, > > please add fixes tags to all these patches you're sending. You > also need > to CC stable so that they can be backported easily. Also list the AI > you're using to find and create these patches. > > Best regards > Thomas > > Am 24.04.26 um 14:34 schrieb Myeonghun Pak: > > bochs_pci_probe() allocates the DRM device with > devm_drm_dev_alloc(), > > which registers a devres action to drop the initial DRM device > reference > > on driver detach or probe failure. > > > > The error path currently calls drm_dev_put() manually. If probe then > > returns an error, devres will run the registered release action > and put > > the same device again, after the first put may already have > released it. > > > > Return the probe error directly and let devres own the final put. > > > > Signed-off-by: Myeonghun Pak <mhun512@gmail.com> > > --- > > drivers/gpu/drm/tiny/bochs.c | 10 +++------- > > 1 file changed, 3 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpu/drm/tiny/bochs.c > b/drivers/gpu/drm/tiny/bochs.c > > index 222e4ae1ab..5d8dc5efec 100644 > > --- a/drivers/gpu/drm/tiny/bochs.c > > +++ b/drivers/gpu/drm/tiny/bochs.c > > @@ -761,25 +761,21 @@ static int bochs_pci_probe(struct pci_dev > *pdev, const struct pci_device_id *ent > > > > ret = pcim_enable_device(pdev); > > if (ret) > > - goto err_free_dev; > > + return ret; > > > > pci_set_drvdata(pdev, dev); > > > > ret = bochs_load(bochs); > > if (ret) > > - goto err_free_dev; > > + return ret; > > > > ret = drm_dev_register(dev, 0); > > if (ret) > > - goto err_free_dev; > > + return ret; > > > > drm_client_setup(dev, NULL); > > > > return ret; > > - > > -err_free_dev: > > - drm_dev_put(dev); > > - return ret; > > } > > > > static void bochs_pci_remove(struct pci_dev *pdev) > > -- > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com > <http://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] 5+ messages in thread
[parent not found: <CAGEsz8F54LaiJYGD6i-nW7hDiLTu6FOi4Z8fzb8b4=+9-OEH+Q@mail.gmail.com>]
* Re: [PATCH] drm/bochs: Drop manual put on probe error path [not found] ` <CAGEsz8F54LaiJYGD6i-nW7hDiLTu6FOi4Z8fzb8b4=+9-OEH+Q@mail.gmail.com> @ 2026-05-04 8:36 ` Thomas Zimmermann 0 siblings, 0 replies; 5+ messages in thread From: Thomas Zimmermann @ 2026-05-04 8:36 UTC (permalink / raw) To: Myeonghun Pak Cc: Gerd Hoffmann, Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter, virtualization, dri-devel, linux-kernel Hi Am 30.04.26 um 15:52 schrieb Myeonghun Pak: > Thanks for the explanation. > > I see your point now. My patch treated uart_add_one_port() failure as > a fatal > probe failure, but the current code is intentionally trying to keep > the driver > alive so that other MAX3100 ports can still be available even if one > port cannot > be instantiated. > > Please drop this patch. I will not pursue this direction. Why? The was patch was good AFAICT. It's just missing a Fixes tag. Best regards Thomas > > Thanks, > Myeonghun > > 2026년 4월 24일 (금) 오후 11:59, Thomas Zimmermann > <tzimmermann@suse.de>님이 작성: > > Hi > > Am 24.04.26 um 15:40 schrieb Myeonghun Pak: > > Hi Thomas, > > > > Thank you for your reply. I will ensure that the requested > |Fixes| tag > > and |stable| CC are included in the next patch I send. > > > > Regarding your request for information about AI usage and how the > > issue was identified: > > > > * This issue was identified during our ongoing static-analysis > > research while reviewing kernel code. > > 1 > > > <https://mail.google.com/mail/u/0/#all/%23thread-f:1863355320119932959> > > * Specifically, it was found by an experimental static > analysis tool > > 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. > > > > I will incorporate your requests and this additional context, > and then > > resend the modified patch. > > Thanks a lot. > > Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> > > Best regards > Thomas > > > > > Thank you. > > > > Myeonghun Pak > > > > > > 2026년 4월 24일 (금) 오후 10:25, Thomas Zimmermann > > <tzimmermann@suse.de>님이 작성: > > > > Hi, > > > > please add fixes tags to all these patches you're sending. You > > also need > > to CC stable so that they can be backported easily. Also > list the AI > > you're using to find and create these patches. > > > > Best regards > > Thomas > > > > Am 24.04.26 um 14:34 schrieb Myeonghun Pak: > > > bochs_pci_probe() allocates the DRM device with > > devm_drm_dev_alloc(), > > > which registers a devres action to drop the initial DRM device > > reference > > > on driver detach or probe failure. > > > > > > The error path currently calls drm_dev_put() manually. If > probe then > > > returns an error, devres will run the registered release > action > > and put > > > the same device again, after the first put may already have > > released it. > > > > > > Return the probe error directly and let devres own the > final put. > > > > > > Signed-off-by: Myeonghun Pak <mhun512@gmail.com> > > > --- > > > drivers/gpu/drm/tiny/bochs.c | 10 +++------- > > > 1 file changed, 3 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/tiny/bochs.c > > b/drivers/gpu/drm/tiny/bochs.c > > > index 222e4ae1ab..5d8dc5efec 100644 > > > --- a/drivers/gpu/drm/tiny/bochs.c > > > +++ b/drivers/gpu/drm/tiny/bochs.c > > > @@ -761,25 +761,21 @@ static int bochs_pci_probe(struct > pci_dev > > *pdev, const struct pci_device_id *ent > > > > > > ret = pcim_enable_device(pdev); > > > if (ret) > > > - goto err_free_dev; > > > + return ret; > > > > > > pci_set_drvdata(pdev, dev); > > > > > > ret = bochs_load(bochs); > > > if (ret) > > > - goto err_free_dev; > > > + return ret; > > > > > > ret = drm_dev_register(dev, 0); > > > if (ret) > > > - goto err_free_dev; > > > + return ret; > > > > > > drm_client_setup(dev, NULL); > > > > > > return ret; > > > - > > > -err_free_dev: > > > - drm_dev_put(dev); > > > - return ret; > > > } > > > > > > static void bochs_pci_remove(struct pci_dev *pdev) > > > > -- > > -- > > Thomas Zimmermann > > Graphics Driver Developer > > SUSE Software Solutions Germany GmbH > > Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com > <http://www.suse.com> > > <http://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 > <http://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] 5+ messages in thread
* [PATCH] drm/bochs: Drop manual put on probe error path
@ 2026-04-24 13:54 Myeonghun Pak
0 siblings, 0 replies; 5+ messages in thread
From: Myeonghun Pak @ 2026-04-24 13:54 UTC (permalink / raw)
To: Gerd Hoffmann, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Myeonghun Pak, virtualization, dri-devel, stable, linux-kernel
bochs_pci_probe() allocates the DRM device with devm_drm_dev_alloc(),
which registers a devres action to drop the initial DRM device reference
on driver detach or probe failure.
The error path currently calls drm_dev_put() manually. If probe then
returns an error, devres will run the registered release action and put
the same device again, after the first put may already have released it.
Return the probe error directly and let devres own the final put.
Fixes: 04826f588682 ("drm/bochs: Allocate DRM device in struct bochs_device")
Cc: stable@vger.kernel.org
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/gpu/drm/tiny/bochs.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index 222e4ae1ab..5d8dc5efec 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -761,25 +761,21 @@ static int bochs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent
ret = pcim_enable_device(pdev);
if (ret)
- goto err_free_dev;
+ return ret;
pci_set_drvdata(pdev, dev);
ret = bochs_load(bochs);
if (ret)
- goto err_free_dev;
+ return ret;
ret = drm_dev_register(dev, 0);
if (ret)
- goto err_free_dev;
+ return ret;
drm_client_setup(dev, NULL);
return ret;
-
-err_free_dev:
- drm_dev_put(dev);
- return ret;
}
static void bochs_pci_remove(struct pci_dev *pdev)
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in threadend of thread, other threads:[~2026-05-04 8:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 12:34 [PATCH] drm/bochs: Drop manual put on probe error path Myeonghun Pak
2026-04-24 13:25 ` Thomas Zimmermann
[not found] ` <CAGEsz8FrkbQEWZbxV3Q0NkSxhQka575uemKMQtTJQaCm44ByxQ@mail.gmail.com>
2026-04-24 14:59 ` Thomas Zimmermann
[not found] ` <CAGEsz8F54LaiJYGD6i-nW7hDiLTu6FOi4Z8fzb8b4=+9-OEH+Q@mail.gmail.com>
2026-05-04 8:36 ` Thomas Zimmermann
-- strict thread matches above, loose matches on Subject: below --
2026-04-24 13:54 Myeonghun Pak
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox