2022-12-20 18:50:10

by Maximilian Luz

[permalink] [raw]
Subject: [PATCH 1/2] platform/surface: aggregator: Add missing call to ssam_request_sync_free()

Although rare, ssam_request_sync_init() can fail. In that case, the
request should be freed via ssam_request_sync_free(). Currently it is
leaked instead. Fix this.

Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
Signed-off-by: Maximilian Luz <[email protected]>
---
drivers/platform/surface/aggregator/controller.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c
index 43e765199137..c6537a1b3a2e 100644
--- a/drivers/platform/surface/aggregator/controller.c
+++ b/drivers/platform/surface/aggregator/controller.c
@@ -1700,8 +1700,10 @@ int ssam_request_sync(struct ssam_controller *ctrl,
return status;

status = ssam_request_sync_init(rqst, spec->flags);
- if (status)
+ if (status) {
+ ssam_request_sync_free(rqst);
return status;
+ }

ssam_request_sync_set_resp(rqst, rsp);

--
2.39.0


2023-01-12 19:03:49

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH 1/2] platform/surface: aggregator: Add missing call to ssam_request_sync_free()

Hi,

On 12/20/22 18:56, Maximilian Luz wrote:
> Although rare, ssam_request_sync_init() can fail. In that case, the
> request should be freed via ssam_request_sync_free(). Currently it is
> leaked instead. Fix this.
>
> Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
> Signed-off-by: Maximilian Luz <[email protected]>

Thank you for your patch, I've applied this patch to my fixes
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes

Note it will show up in my fixes branch once I've pushed my
local branch there, which might take a while.

I will include this patch in my next fixes pull-req to Linus
for the current kernel development cycle.

Regards,

Hans

> ---
> drivers/platform/surface/aggregator/controller.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c
> index 43e765199137..c6537a1b3a2e 100644
> --- a/drivers/platform/surface/aggregator/controller.c
> +++ b/drivers/platform/surface/aggregator/controller.c
> @@ -1700,8 +1700,10 @@ int ssam_request_sync(struct ssam_controller *ctrl,
> return status;
>
> status = ssam_request_sync_init(rqst, spec->flags);
> - if (status)
> + if (status) {
> + ssam_request_sync_free(rqst);
> return status;
> + }
>
> ssam_request_sync_set_resp(rqst, rsp);
>