Skip to content

Commit 295de65

Browse files
Lukasz Majewskidavem330
authored andcommitted
net: hsr: Properly parse HSRv1 supervisor frames.
While adding support for parsing the redbox supervision frames, the author added `pull_size' and `total_pull_size' to track the amount of bytes that were pulled from the skb during while parsing the skb so it can be reverted/ pushed back at the end. In the process probably copy&paste error occurred and for the HSRv1 case the ethhdr was used instead of the hsr_tag. Later the hsr_tag was used instead of hsr_sup_tag. The later error didn't matter because both structs have the size so HSRv0 was still working. It broke however HSRv1 parsing because struct ethhdr is larger than struct hsr_tag. Reinstate the old pulling flow and pull first ethhdr, hsr_tag in v1 case followed by hsr_sup_tag. [bigeasy: commit message] Fixes: eafaa88 ("net: hsr: Add support for redbox supervision frames")' Suggested-by: [email protected] Signed-off-by: Lukasz Majewski <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Reviewed-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6af2897 commit 295de65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/hsr/hsr_framereg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ void hsr_handle_sup_frame(struct hsr_frame_info *frame)
288288

289289
/* And leave the HSR tag. */
290290
if (ethhdr->h_proto == htons(ETH_P_HSR)) {
291-
pull_size = sizeof(struct ethhdr);
291+
pull_size = sizeof(struct hsr_tag);
292292
skb_pull(skb, pull_size);
293293
total_pull_size += pull_size;
294294
}
295295

296296
/* And leave the HSR sup tag. */
297-
pull_size = sizeof(struct hsr_tag);
297+
pull_size = sizeof(struct hsr_sup_tag);
298298
skb_pull(skb, pull_size);
299299
total_pull_size += pull_size;
300300

0 commit comments

Comments
 (0)