Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v2] can: gw: reject frame format changes in UID updates
@ 2026-12-04  7:07 Hungyu Lin
  2026-12-04  7:12 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-12-04  7:07 UTC (permalink / raw)
  To: socketcan, mkl; +Cc: linux-can, netdev

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")
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))) {
 				err = -EINVAL;
 				goto out_free_cf;
 			}
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox