On Wed, Jul 22, 2026 at 09:11:11AM +0530, Raag Jadav wrote:
> doit_reply_value() directly returns on get counter failure, which results
> in stale sk_buff and genetlink header that aren't cleaned up. Fix it and
> while at it, consolidate error handling using goto.
> 
> Fixes: c36218dc49f5 ("drm/ras: Introduce the DRM RAS infrastructure over 
> generic netlink")
> Signed-off-by: Raag Jadav <[email protected]>
> Reviewed-by: Riana Tauro <[email protected]>
> ---
> v2: Use goto (Riana)
> ---
>  drivers/gpu/drm/drm_ras.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_ras.c b/drivers/gpu/drm/drm_ras.c

drm/drm-misc maintainers, ack to get this and the next patch through 
drm-xe-next?
We have a pretty active development of ras in xe right now so we would like
to keep them all together there.

Thanks in advance,
Rodrigo.

> index d6eab29a1394..467a169026fc 100644
> --- a/drivers/gpu/drm/drm_ras.c
> +++ b/drivers/gpu/drm/drm_ras.c
> @@ -201,25 +201,28 @@ static int doit_reply_value(struct genl_info *info, u32 
> node_id,
>  
>       hdr = genlmsg_iput(msg, info);
>       if (!hdr) {
> -             nlmsg_free(msg);
> -             return -EMSGSIZE;
> +             ret = -EMSGSIZE;
> +             goto free_msg;
>       }
>  
>       ret = get_node_error_counter(node_id, error_id,
>                                    &error_name, &value);
>       if (ret)
> -             return ret;
> +             goto cancel_msg;
>  
>       ret = msg_reply_value(msg, error_id, error_name, value);
> -     if (ret) {
> -             genlmsg_cancel(msg, hdr);
> -             nlmsg_free(msg);
> -             return ret;
> -     }
> +     if (ret)
> +             goto cancel_msg;
>  
>       genlmsg_end(msg, hdr);
>  
>       return genlmsg_reply(msg, info);
> +
> +cancel_msg:
> +     genlmsg_cancel(msg, hdr);
> +free_msg:
> +     nlmsg_free(msg);
> +     return ret;
>  }
>  
>  /**
> -- 
> 2.43.0
> 

Reply via email to