dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Tauro, Riana" <riana.tauro@intel.com>
To: Raag Jadav <raag.jadav@intel.com>,
	<intel-xe@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <netdev@vger.kernel.org>
Cc: <rodrigo.vivi@intel.com>, <dev@lankhorst.se>, <airlied@gmail.com>,
	<simona@ffwll.ch>, <kuba@kernel.org>
Subject: Re: [PATCH v2 1/4] drm/ras: Cancel and free message on get counter failure
Date: Mon, 25 May 2026 15:23:50 +0530	[thread overview]
Message-ID: <b1c3c79d-f114-4283-b8fc-1fbcfe85576c@intel.com> (raw)
In-Reply-To: <20260523050212.557292-2-raag.jadav@intel.com>


On 5/23/2026 10:30 AM, 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 <raag.jadav@intel.com>

Reviewed-by: Riana Tauro <riana.tauro@intel.com>

> ---
> 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
> 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;
>   }
>   
>   /**

  reply	other threads:[~2026-05-25  9:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23  5:00 [PATCH v2 0/4] DRM RAS Fixes Raag Jadav
2026-05-23  5:00 ` [PATCH v2 1/4] drm/ras: Cancel and free message on get counter failure Raag Jadav
2026-05-25  9:53   ` Tauro, Riana [this message]
2026-05-23  5:00 ` [PATCH v2 2/4] drm/xe/drm_ras: Make counter allocation drm managed Raag Jadav
2026-05-23  5:00 ` [PATCH v2 3/4] drm/xe/drm_ras: Add per node cleanup action Raag Jadav
2026-06-01  9:13   ` Tauro, Riana
2026-05-23  5:00 ` [PATCH v2 4/4] drm/xe/hw_error: Use HW_ERR prefix in log Raag Jadav
2026-06-01  9:19   ` Tauro, Riana
2026-06-01 11:13   ` Michal Wajdeczko
2026-06-01 12:25     ` Raag Jadav
2026-06-17 11:21       ` Raag Jadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b1c3c79d-f114-4283-b8fc-1fbcfe85576c@intel.com \
    --to=riana.tauro@intel.com \
    --cc=airlied@gmail.com \
    --cc=dev@lankhorst.se \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raag.jadav@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox