UID updates replace only the modification rules of an existing gateway job. The job keeps its original flags and hop limit, 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. As in cgw_remove_job(), require both the flags and the hop limit to match when updating a job by UID. Changes to either setting are ineffective because the job keeps its original settings. Fixes: 456a8a646b25 ("can: gw: add support for CAN FD frames") Cc: stab…@vger.kernel.org Signed-off-by: Hungyu Lin <denn…@gmail.com> --- Changes in v3: - Also require the hop limit to match on UID updates, as suggested by Oliver Hartkopp. - Add the stable Cc trailer and use the CAN tree subject prefix. net/can/gw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/can/gw.c b/net/can/gw.c index 8a5327d8a00e8..a46f781aa67fe 100644 --- a/net/can/gw.c +++ b/net/can/gw.c @@ -1123,7 +1123,9 @@ 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 || + gwj->limit_hops != limhops || + memcmp(&gwj->ccgw, &ccgw, sizeof(ccgw))) { err = -EINVAL; goto out_free_cf; }
-- 2.50.1 (Apple Git-155)