mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
ppp_synctty: ensure a writeable skb header
ppp_sync_txmunge() checks headroom before prepending the address and
control bytes, but does not ensure that the skb header is writable.
A received skb can reach this function through PPP channel bridging
without passing through ppp_start_xmit(), which calls skb_cow_head().
For example, a PPPoE frame may share its buffer with a clone queued to
an AF_PACKET socket. If it is bridged to a synchronous tty channel, the
address/control bytes can overwrite data still visible to that socket.
Use skb_cow_head() to ensure both sufficient headroom and a writable
header.
Fixes: 4cf476ced4 ("ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls")
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260908072135.877364-1-qingfang.deng@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
be83178bfc
commit
8aaeb56aff
|
|
@ -455,17 +455,9 @@ ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb)
|
|||
|
||||
/* prepend address/control fields if necessary */
|
||||
if ((ap->flags & SC_COMP_AC) == 0 || islcp) {
|
||||
if (skb_headroom(skb) < 2) {
|
||||
struct sk_buff *npkt = dev_alloc_skb(skb->len + 2);
|
||||
if (npkt == NULL) {
|
||||
kfree_skb(skb);
|
||||
return NULL;
|
||||
}
|
||||
skb_reserve(npkt,2);
|
||||
skb_copy_from_linear_data(skb,
|
||||
skb_put(npkt, skb->len), skb->len);
|
||||
consume_skb(skb);
|
||||
skb = npkt;
|
||||
if (skb_cow_head(skb, 2)) {
|
||||
kfree_skb(skb);
|
||||
return NULL;
|
||||
}
|
||||
skb_push(skb,2);
|
||||
skb->data[0] = PPP_ALLSTATIONS;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user