From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: david.laight.linux@gmail.com, Kees Cook <kees@kernel.org>,
linux-hardening@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org
Cc: Arnd Bergmann <arnd@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>
Subject: Re: [PATCH next] drivers/rpmsg: Fix copy of channel->name into open request
Date: Thu, 18 Jun 2026 15:24:17 +0200 [thread overview]
Message-ID: <79c1dda2-153e-4b7a-ad18-c72db1cf4a00@oss.qualcomm.com> (raw)
In-Reply-To: <20260608095523.2606-33-david.laight.linux@gmail.com>
On 6/8/26 11:55 AM, david.laight.linux@gmail.com wrote:
> From: David Laight <david.laight.linux@gmail.com>
>
> Nothing obvious ensures that the name is less than GLINK_CMD_OPEN (32)
^ GLINK_NAME_SIZE
[...]
> @@ -481,8 +481,7 @@ static int qcom_glink_send_open_req(struct qcom_glink *glink,
> struct glink_channel *channel)
> {
> DEFINE_RAW_FLEX(struct glink_msg, req, data, GLINK_NAME_SIZE);
> - int name_len = strlen(channel->name) + 1;
> - int req_len = ALIGN(sizeof(*req) + name_len, 8);
> + int name_len, req_len;
> int ret;
> unsigned long flags;
>
> @@ -498,14 +497,20 @@ static int qcom_glink_send_open_req(struct qcom_glink *glink,
>
> channel->lcid = ret;
>
> + name_len = strscpy_pad(req->data, channel->name, GLINK_NAME_SIZE);
> + if (name_len < 0)
> + name_len = GLINK_NAME_SIZE;
> + else
> + name_len++;
Should we perhaps do something along the lines of:
WARN_ON(strlen(name) > GLINK_NAME_SIZE)
to prevent silent clipping?
Konrad
next prev parent reply other threads:[~2026-06-18 13:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 9:55 david.laight.linux
2026-06-18 13:24 ` Konrad Dybcio [this message]
2026-06-18 14:59 ` David Laight
2026-06-22 13:37 ` Konrad Dybcio
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=79c1dda2-153e-4b7a-ad18-c72db1cf4a00@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=arnd@kernel.org \
--cc=david.laight.linux@gmail.com \
--cc=kees@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
/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
all inboxes | Powered by JetHome®