linux/drivers/net
Xie He 77b981c82c drivers/net/wan/hdlc_x25: Added needed_headroom and a skb->len check
1. Added a skb->len check

This driver expects upper layers to include a pseudo header of 1 byte
when passing down a skb for transmission. This driver will read this
1-byte header. This patch added a skb->len check before reading the
header to make sure the header exists.

2. Added needed_headroom and set hard_header_len to 0

When this driver transmits data,
  first this driver will remove a pseudo header of 1 byte,
  then the lapb module will prepend the LAPB header of 2 or 3 bytes.
So the value of needed_headroom in this driver should be 3 - 1.

Because this driver has no header_ops, according to the logic of
af_packet.c, the value of hard_header_len should be 0.

Reason of setting needed_headroom and hard_header_len at this place:

This driver is written using the API of the hdlc module, the hdlc
module enables this driver (the protocol driver) to run on any hardware
that has a driver (the hardware driver) written using the API of the
hdlc module.

Two other hdlc protocol drivers - hdlc_ppp and hdlc_raw_eth, also set
things like hard_header_len at this place. In hdlc_ppp, it sets
hard_header_len after attach_hdlc_protocol and before setting dev->type.
In hdlc_raw_eth, it sets hard_header_len by calling ether_setup after
attach_hdlc_protocol and after memcpy the settings.

3. Reset needed_headroom when detaching protocols (in hdlc.c)

When detaching a protocol from a hardware device, the hdlc module will
reset various parameters of the device (including hard_header_len) to
the default values. We add needed_headroom here so that needed_headroom
will also be reset.

Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Martin Schiller <ms@dev.tdt.de>
Cc: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-08-14 20:41:08 -07:00
..
appletalk
arcnet
bonding bonding: show saner speed for broadcast mode 2020-08-14 20:39:33 -07:00
caif
can treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
dsa net: dsa: sja1105: use detected device id instead of DT one on mismatch 2020-08-05 12:20:55 -07:00
ethernet net: fec: correct the error path for regulator disable in probe 2020-08-14 16:48:29 -07:00
fddi net: fddi: skfp: Remove addr_to_string(). 2020-07-13 11:49:51 -07:00
fjes
hamradio
hippi hippi: Fix a size used in a 'pci_free_consistent()' in an error handling path 2020-07-14 14:11:49 -07:00
hyperv hv_netvsc: do not use VF device if link is down 2020-08-04 16:15:16 -07:00
ieee802154 net: ieee802154: adf7242: Replace HTTP links with HTTPS ones 2020-07-20 08:51:38 +02:00
ipa remoteproc updates for v5.9 2020-08-11 11:17:45 -07:00
ipvlan
netdevsim Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
phy net: phy: marvell10g: fix null pointer dereference 2020-08-11 15:42:23 -07:00
plip
ppp mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
slip
team
usb r8152: Use MAC address from correct device tree node 2020-08-07 17:13:52 -07:00
vmxnet3 vmxnet3: use correct tcp hdr length when packet is encapsulated 2020-08-10 12:09:38 -07:00
wan drivers/net/wan/hdlc_x25: Added needed_headroom and a skb->len check 2020-08-14 20:41:08 -07:00
wimax
wireguard mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
wireless Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
xen-netback xen networking: add XDP offset adjustment to xen-netback 2020-07-01 15:25:14 -07:00
bareudp.c tunnels: PMTU discovery support for directly bridged IP packets 2020-08-04 13:01:45 -07:00
dummy.c
eql.c
geneve.c geneve: Support for PMTU discovery on directly bridged links 2020-08-04 13:01:45 -07:00
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
tun.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-08-03 18:27:40 -07:00
veth.c bpf, xdp: Remove XDP_QUERY_PROG and XDP_QUERY_PROG_HW XDP commands 2020-07-25 20:37:02 -07:00
virtio_net.c virtio: fixes, features 2020-08-11 14:34:17 -07:00
vrf.c vrf: Handle CONFIG_SYSCTL not set 2020-07-23 17:51:04 -07:00
vsockmon.c
vxlan.c Revert "vxlan: fix tos value before xmit" 2020-08-05 12:09:10 -07:00
xen-netfront.c bpf, xdp: Remove XDP_QUERY_PROG and XDP_QUERY_PROG_HW XDP commands 2020-07-25 20:37:02 -07:00