From: sashiko-bot@kernel.org
To: "Hongling Zeng" <zenghongling@kylinos.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 3/5] nouveau/gsp/rm/alloc: Cleanup IS_ERR_OR_NULL usage
Date: Mon, 22 Jun 2026 04:28:45 +0000 [thread overview]
Message-ID: <20260622042846.308FA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622021207.14764-4-zenghongling@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Silently dropping oversized GSP RPC messages and reporting false success.
--
commit c03df51ffa049e6fe56eec7d75137d404fe0855b
Author: Hongling Zeng <zenghongling@kylinos.cn>
nouveau/gsp/rm/alloc: Cleanup IS_ERR_OR_NULL usage
This commit cleans up error checking by using IS_ERR() instead of
WARN_ON(IS_ERR_OR_NULL()) after nvkm_gsp_rpc_get() calls, matching
the actual return value contract.
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/alloc.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/alloc.c
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/alloc.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/alloc.c
> @@ -35,7 +35,7 @@ r535_gsp_rpc_rm_free(struct nvkm_gsp_object *object)
> client->object.handle, object->handle);
>
> rpc = nvkm_gsp_rpc_get(gsp, NV_VGPU_MSG_FUNCTION_FREE, sizeof(*rpc));
> - if (WARN_ON(IS_ERR_OR_NULL(rpc)))
> + if (WARN_ON(IS_ERR(rpc)))
> return -EIO;
>
> rpc->params.hRoot = client->object.handle;
> rpc->params.hObjectParent = 0;
> rpc->params.hObjectOld = object->handle;
> return nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_RECV);
[Severity: High]
This isn't a bug introduced by this patch, but since this commit is
cleaning up error handling around GSP RPC interactions, does
nvkm_gsp_rpc_wr() also have an error handling issue that hides critical
failures?
Looking at drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c, if the
GSP sends an RPC message where rpc->length > max_rpc_size,
r535_gsp_msgq_recv() returns NULL without advancing the message queue read
pointer:
r535_gsp_msgq_recv()
...
if (WARN_ON(rpc->length > max_rpc_size))
return NULL;
This NULL propagates to nvkm_gsp_rpc_wr() in
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h, which translates it into
a false success:
nvkm_gsp_rpc_wr()
...
if (IS_ERR(repv))
return PTR_ERR(repv);
return 0;
Since repv is NULL, IS_ERR(repv) evaluates to false, causing the function
to silently return 0.
Could this cause the caller to proceed assuming the RPC succeeded,
potentially leading to an invalid state or use-after-free, while the
unadvanced read pointer permanently wedges the message queue for all
subsequent reads?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260622021207.14764-1-zenghongling@kylinos.cn?part=3
next prev parent reply other threads:[~2026-06-22 4:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 2:12 [PATCH v3 0/5] nouveau/gsp: Clean up IS_ERR vs IS_ERR_OR_NULL usage Hongling Zeng
2026-06-22 2:12 ` [PATCH v3 1/5] nouveau/gsp/rpc: Document RPC function return value contracts Hongling Zeng
2026-06-22 2:26 ` sashiko-bot
2026-06-22 2:12 ` [PATCH v3 2/5] nouveau/gsp/rpc: Cleanup incorrect IS_ERR_OR_NULL in rpc.c Hongling Zeng
2026-06-22 2:27 ` sashiko-bot
2026-06-22 2:12 ` [PATCH v3 3/5] nouveau/gsp/rm/alloc: Cleanup IS_ERR_OR_NULL usage Hongling Zeng
2026-06-22 4:28 ` sashiko-bot [this message]
2026-06-22 2:12 ` [PATCH v3 4/5] nouveau/gsp/rm/bar: " Hongling Zeng
2026-06-22 2:27 ` sashiko-bot
2026-06-22 2:12 ` [PATCH v3 5/5] nouveau/gsp: Cleanup IS_ERR_OR_NULL in nvkm_gsp_rpc_rd() Hongling Zeng
2026-06-22 2:28 ` sashiko-bot
[not found] ` <1782119054239712.17995.seg@mailgw.kylinos.cn>
2026-06-22 9:20 ` [PATCH v3 1/5] nouveau/gsp/rpc: Document RPC function return value contracts sashiko-bot
[not found] ` <1782119054238429.17993.seg@mailgw.kylinos.cn>
2026-06-22 9:33 ` [PATCH v3 2/5] nouveau/gsp/rpc: Cleanup incorrect IS_ERR_OR_NULL in rpc.c sashiko-bot
[not found] ` <1782119054236227.17989.seg@mailgw.kylinos.cn>
2026-06-22 9:47 ` [PATCH v3 3/5] nouveau/gsp/rm/alloc: Cleanup IS_ERR_OR_NULL usage sashiko-bot
[not found] ` <1782119054234413.17986.seg@mailgw.kylinos.cn>
2026-06-22 12:09 ` [PATCH v3 5/5] nouveau/gsp: Cleanup IS_ERR_OR_NULL in nvkm_gsp_rpc_rd() sashiko-bot
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=20260622042846.308FA1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zenghongling@kylinos.cn \
/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