diff options
author | Jakub Kicinski <kuba@kernel.org> | 2022-01-10 03:59:30 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-01-10 04:00:17 +0300 |
commit | 8aaaf2f3af2ae212428f4db1af34214225f5cec3 (patch) | |
tree | 43c7f4f8af2fad7919f169b0924dba5e43147d97 /drivers/net/ppp/ppp_generic.c | |
parent | 208dd45d8d050360b46ded439a057bcc7cbf3b09 (diff) | |
parent | dd3ca4c5184ea98e40acb8eb293d85b88ea04ee2 (diff) | |
download | linux-8aaaf2f3af2ae212428f4db1af34214225f5cec3.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Merge in fixes directly in prep for the 5.17 merge window.
No conflicts.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ppp/ppp_generic.c')
-rw-r--r-- | drivers/net/ppp/ppp_generic.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 9e52c5d2d77f..4a365f15533e 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -69,6 +69,8 @@ #define MPHDRLEN 6 /* multilink protocol header length */ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ +#define PPP_PROTO_LEN 2 + /* * An instance of /dev/ppp can be associated with either a ppp * interface unit or a ppp channel. In both cases, file->private_data @@ -498,6 +500,9 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, if (!pf) return -ENXIO; + /* All PPP packets should start with the 2-byte protocol */ + if (count < PPP_PROTO_LEN) + return -EINVAL; ret = -ENOMEM; skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); if (!skb) @@ -1765,7 +1770,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) } ++ppp->stats64.tx_packets; - ppp->stats64.tx_bytes += skb->len - 2; + ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN; switch (proto) { case PPP_IP: |