From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Hungyu Lin <dennylin0707@gmail.com>, mkl@pengutronix.de
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] can: gw: reject frame format changes in UID updates
Date: Fri, 4 Dec 2026 09:25:08 +0100 [thread overview]
Message-ID: <a6792ccb-6edd-4dd1-88c2-c98dc878f1c3@hartkopp.net> (raw)
In-Reply-To: <20261204070726.53955-1-dennylin0707@gmail.com>
Hello Hungyu,
On 04.12.26 08:07, Hungyu Lin wrote:
> UID updates replace only the modification rules of an existing gateway
> job. The job keeps its original flags, while cgw_parse_attr() selects
> modification functions using the flags supplied with the update. A
> request that changes CGW_FLAGS_CAN_FD can therefore install CAN FD data
> operations on a Classical CAN job.
>
> Require all flags to match when updating a job by UID. Changes to the
> other flags are equally ineffective because the job keeps its original
> settings.
>
> Fixes: 456a8a646b25 ("can: gw: add support for CAN FD frames")
Please add
Cc: stable@vger.kernel.org
here.
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
> Changes in v2:
> - Reject changes to all flags, as suggested by Oliver Hartkopp.
>
> net/can/gw.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/can/gw.c b/net/can/gw.c
> index 8a5327d8a00e8..14fa2e5ef505c 100644
> --- a/net/can/gw.c
> +++ b/net/can/gw.c
> @@ -1123,7 +1123,8 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh,
> continue;
>
> /* interfaces & filters must be identical */
> - if (memcmp(&gwj->ccgw, &ccgw, sizeof(ccgw))) {
> + if (gwj->flags != r->flags ||
> + memcmp(&gwj->ccgw, &ccgw, sizeof(ccgw))) {
I've looked into cgw_remove_job() where limit_hops is also checked to
identify the gw job:
if (gwj->flags != r->flags)
continue;
if (gwj->limit_hops != limhops)
continue;
Therefore I would suggest to be consistent in the UID update:
if (gwj->flags != r->flags ||
gwj->limit_hops != limhops ||
memcmp(&gwj->ccgw, &ccgw, sizeof(ccgw))) {
> err = -EINVAL;
> goto out_free_cf;
> }
Many thanks,
Oliver
prev parent reply other threads:[~2026-12-04 8:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 7:07 [PATCH net-next v2] can: gw: reject frame format changes in UID updates Hungyu Lin
2026-12-04 7:12 ` netdev-bot+sinfo
2026-12-04 8:25 ` Oliver Hartkopp [this message]
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=a6792ccb-6edd-4dd1-88c2-c98dc878f1c3@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=dennylin0707@gmail.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.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