From 97d44cdd13883d32eb992c7b0de3d8e1b60d0d43 Mon Sep 17 00:00:00 2001 From: Yang Yingliang Date: Mon, 28 Jan 2019 17:01:10 +0800 Subject: [PATCH] Revert "can: gw: ensure DLC boundaries after CAN frame modification" euler inclusion category: feature Bugzilla: N/A CVE: N/A Using lts patch instead of this patch. ---------------------------------------- This reverts commit 1378af97f8d132a0913c382a14ba4aa8dd37a06a. Signed-off-by: Yang Yingliang --- net/can/gw.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/net/can/gw.c b/net/can/gw.c index 53859346dc9a..faa3da88a127 100644 --- a/net/can/gw.c +++ b/net/can/gw.c @@ -416,29 +416,13 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data) while (modidx < MAX_MODFUNCTIONS && gwj->mod.modfunc[modidx]) (*gwj->mod.modfunc[modidx++])(cf, &gwj->mod); - /* Has the CAN frame been modified? */ + /* check for checksum updates when the CAN frame has been modified */ if (modidx) { - /* get available space for the processed CAN frame type */ - int max_len = nskb->len - offsetof(struct can_frame, data); - - /* dlc may have changed, make sure it fits to the CAN frame */ - if (cf->can_dlc > max_len) - goto out_delete; - - /* check for checksum updates in classic CAN length only */ - if (gwj->mod.csumfunc.crc8) { - if (cf->can_dlc > 8) - goto out_delete; - + if (gwj->mod.csumfunc.crc8) (*gwj->mod.csumfunc.crc8)(cf, &gwj->mod.csum.crc8); - } - - if (gwj->mod.csumfunc.xor) { - if (cf->can_dlc > 8) - goto out_delete; + if (gwj->mod.csumfunc.xor) (*gwj->mod.csumfunc.xor)(cf, &gwj->mod.csum.xor); - } } /* clear the skb timestamp if not configured the other way */ @@ -450,14 +434,6 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data) gwj->dropped_frames++; else gwj->handled_frames++; - - return; - - out_delete: - /* delete frame due to misconfiguration */ - gwj->deleted_frames++; - kfree_skb(nskb); - return; } static inline int cgw_register_filter(struct net *net, struct cgw_job *gwj) -- GitLab