* [PATCH][next] drm: simpledrm: Fix use after free issues
@ 2021-05-12 20:30 Colin King
2021-05-13 14:01 ` Thomas Zimmermann
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-05-12 20:30 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann, Maxime Ripard, dri-devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
There are two occurrances where objects are being free'd via
a put call and yet they are being referenced after this. Fix these
by adding in the missing continue statement so that the put on the
end of the loop is skipped over.
Addresses-Coverity: ("Use after free")
Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/gpu/drm/tiny/simpledrm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index 2bdb477d9326..eae748394b00 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -298,6 +298,7 @@ static int simpledrm_device_init_clocks(struct simpledrm_device *sdev)
drm_err(dev, "failed to enable clock %u: %d\n",
i, ret);
clk_put(clock);
+ continue;
}
sdev->clks[i] = clock;
}
@@ -415,6 +416,7 @@ static int simpledrm_device_init_regulators(struct simpledrm_device *sdev)
drm_err(dev, "failed to enable regulator %u: %d\n",
i, ret);
regulator_put(regulator);
+ continue;
}
sdev->regulators[i++] = regulator;
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][next] drm: simpledrm: Fix use after free issues
2021-05-12 20:30 [PATCH][next] drm: simpledrm: Fix use after free issues Colin King
@ 2021-05-13 14:01 ` Thomas Zimmermann
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2021-05-13 14:01 UTC (permalink / raw)
To: Colin King, David Airlie, Daniel Vetter, Maxime Ripard, dri-devel
Cc: kernel-janitors, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1616 bytes --]
Hi
Am 12.05.21 um 22:30 schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> There are two occurrances where objects are being free'd via
> a put call and yet they are being referenced after this. Fix these
> by adding in the missing continue statement so that the put on the
> end of the loop is skipped over.
>
> Addresses-Coverity: ("Use after free")
> Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Queued up for drm-misc-next. Thanks!
Best regards
Thomas
> ---
> drivers/gpu/drm/tiny/simpledrm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 2bdb477d9326..eae748394b00 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -298,6 +298,7 @@ static int simpledrm_device_init_clocks(struct simpledrm_device *sdev)
> drm_err(dev, "failed to enable clock %u: %d\n",
> i, ret);
> clk_put(clock);
> + continue;
> }
> sdev->clks[i] = clock;
> }
> @@ -415,6 +416,7 @@ static int simpledrm_device_init_regulators(struct simpledrm_device *sdev)
> drm_err(dev, "failed to enable regulator %u: %d\n",
> i, ret);
> regulator_put(regulator);
> + continue;
> }
>
> sdev->regulators[i++] = regulator;
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-13 14:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 20:30 [PATCH][next] drm: simpledrm: Fix use after free issues Colin King
2021-05-13 14:01 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®