]> git.baikalelectronics.ru Git - kernel.git/commit
net: hdlc_fr: Improve the initial checks when we receive an skb
authorXie He <xie.he.0141@gmail.com>
Sat, 31 Oct 2020 18:10:42 +0000 (11:10 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Nov 2020 23:19:14 +0000 (15:19 -0800)
commitc4156f9e0fa7667c183e53d83b25fa89f9c19945
treedd5a3fe0330d867c74251a8518ae0db4c3ccd1cf
parentf48d09d82d5bbfb04434c3d20ea14317dd1b3140
net: hdlc_fr: Improve the initial checks when we receive an skb

1.
Change the skb->len check from "<= 4" to "< 4".
At first we only need to ensure a 4-byte header is present. We indeed
normally need the 5th byte, too, but it'd be more logical and cleaner
to check its existence when we actually need it.

2.
Add an fh->ea2 check to the initial checks in fr_rx. fh->ea2 == 1 means
the second address byte is the final address byte. We only support the
case where the address length is 2 bytes.

Cc: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/wan/hdlc_fr.c