sync
This commit is contained in:
parent
eb24b58aac
commit
e19db867f5
@ -853,7 +853,7 @@ define KernelPackage/crypto-rng
|
||||
DEPENDS:=+kmod-crypto-hash +kmod-crypto-hmac \
|
||||
+(LINUX_5_4||LINUX_5_10):kmod-crypto-sha256 \
|
||||
+(LINUX_5_15||LINUX_6_1||LINUX_6_6):kmod-crypto-sha512 \
|
||||
+LINUX_6_6:kmod-crypto-sha3
|
||||
+(LINUX_6_1||LINUX_6_6):kmod-crypto-sha3
|
||||
KCONFIG:= \
|
||||
CONFIG_CRYPTO_DRBG \
|
||||
CONFIG_CRYPTO_DRBG_HMAC=y \
|
||||
|
@ -0,0 +1,85 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 11 Apr 2024 13:28:59 +0200
|
||||
Subject: [PATCH] netfilter: flowtable: validate pppoe header
|
||||
|
||||
Ensure there is sufficient room to access the protocol field of the
|
||||
PPPoe header. Validate it once before the flowtable lookup, then use a
|
||||
helper function to access protocol field.
|
||||
|
||||
Reported-by: syzbot+b6f07e1c07ef40199081@syzkaller.appspotmail.com
|
||||
Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -318,7 +318,7 @@ int nf_flow_rule_route_ipv6(struct net *
|
||||
int nf_flow_table_offload_init(void);
|
||||
void nf_flow_table_offload_exit(void);
|
||||
|
||||
-static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
+static inline __be16 __nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
{
|
||||
__be16 proto;
|
||||
|
||||
@@ -334,4 +334,14 @@ static inline __be16 nf_flow_pppoe_proto
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static inline bool nf_flow_pppoe_proto(struct sk_buff *skb, __be16 *inner_proto)
|
||||
+{
|
||||
+ if (!pskb_may_pull(skb, PPPOE_SES_HLEN))
|
||||
+ return false;
|
||||
+
|
||||
+ *inner_proto = __nf_flow_pppoe_proto(skb);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
#endif /* _NF_FLOW_TABLE_H */
|
||||
--- a/net/netfilter/nf_flow_table_inet.c
|
||||
+++ b/net/netfilter/nf_flow_table_inet.c
|
||||
@@ -21,7 +21,8 @@ nf_flow_offload_inet_hook(void *priv, st
|
||||
proto = veth->h_vlan_encapsulated_proto;
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- proto = nf_flow_pppoe_proto(skb);
|
||||
+ if (!nf_flow_pppoe_proto(skb, &proto))
|
||||
+ return NF_ACCEPT;
|
||||
break;
|
||||
default:
|
||||
proto = skb->protocol;
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -246,10 +246,11 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
return NF_STOLEN;
|
||||
}
|
||||
|
||||
-static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto,
|
||||
+static bool nf_flow_skb_encap_protocol(struct sk_buff *skb, __be16 proto,
|
||||
u32 *offset)
|
||||
{
|
||||
struct vlan_ethhdr *veth;
|
||||
+ __be16 inner_proto;
|
||||
|
||||
switch (skb->protocol) {
|
||||
case htons(ETH_P_8021Q):
|
||||
@@ -260,7 +261,8 @@ static bool nf_flow_skb_encap_protocol(c
|
||||
}
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- if (nf_flow_pppoe_proto(skb) == proto) {
|
||||
+ if (nf_flow_pppoe_proto(skb, &inner_proto) &&
|
||||
+ inner_proto == proto) {
|
||||
*offset += PPPOE_SES_HLEN;
|
||||
return true;
|
||||
}
|
||||
@@ -289,7 +291,7 @@ static void nf_flow_encap_pop(struct sk_
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- skb->protocol = nf_flow_pppoe_proto(skb);
|
||||
+ skb->protocol = __nf_flow_pppoe_proto(skb);
|
||||
skb_pull(skb, PPPOE_SES_HLEN);
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
@ -0,0 +1,24 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 11 Apr 2024 13:29:00 +0200
|
||||
Subject: [PATCH] netfilter: flowtable: incorrect pppoe tuple
|
||||
|
||||
pppoe traffic reaching ingress path does not match the flowtable entry
|
||||
because the pppoe header is expected to be at the network header offset.
|
||||
This bug causes a mismatch in the flow table lookup, so pppoe packets
|
||||
enter the classical forwarding path.
|
||||
|
||||
Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -156,7 +156,7 @@ static void nf_flow_tuple_encap(struct s
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- phdr = (struct pppoe_hdr *)skb_mac_header(skb);
|
||||
+ phdr = (struct pppoe_hdr *)skb_network_header(skb);
|
||||
tuple->encap[i].id = ntohs(phdr->sid);
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
break;
|
@ -0,0 +1,87 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 11 Apr 2024 13:28:59 +0200
|
||||
Subject: [PATCH] netfilter: flowtable: validate pppoe header
|
||||
|
||||
Ensure there is sufficient room to access the protocol field of the
|
||||
PPPoe header. Validate it once before the flowtable lookup, then use a
|
||||
helper function to access protocol field.
|
||||
|
||||
Reported-by: syzbot+b6f07e1c07ef40199081@syzkaller.appspotmail.com
|
||||
Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -335,7 +335,7 @@ int nf_flow_rule_route_ipv6(struct net *
|
||||
int nf_flow_table_offload_init(void);
|
||||
void nf_flow_table_offload_exit(void);
|
||||
|
||||
-static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
+static inline __be16 __nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
{
|
||||
__be16 proto;
|
||||
|
||||
@@ -351,6 +351,16 @@ static inline __be16 nf_flow_pppoe_proto
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static inline bool nf_flow_pppoe_proto(struct sk_buff *skb, __be16 *inner_proto)
|
||||
+{
|
||||
+ if (!pskb_may_pull(skb, PPPOE_SES_HLEN))
|
||||
+ return false;
|
||||
+
|
||||
+ *inner_proto = __nf_flow_pppoe_proto(skb);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
#define NF_FLOW_TABLE_STAT_INC(net, count) __this_cpu_inc((net)->ft.stat->count)
|
||||
#define NF_FLOW_TABLE_STAT_DEC(net, count) __this_cpu_dec((net)->ft.stat->count)
|
||||
#define NF_FLOW_TABLE_STAT_INC_ATOMIC(net, count) \
|
||||
--- a/net/netfilter/nf_flow_table_inet.c
|
||||
+++ b/net/netfilter/nf_flow_table_inet.c
|
||||
@@ -21,7 +21,8 @@ nf_flow_offload_inet_hook(void *priv, st
|
||||
proto = veth->h_vlan_encapsulated_proto;
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- proto = nf_flow_pppoe_proto(skb);
|
||||
+ if (!nf_flow_pppoe_proto(skb, &proto))
|
||||
+ return NF_ACCEPT;
|
||||
break;
|
||||
default:
|
||||
proto = skb->protocol;
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -267,10 +267,11 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
return NF_STOLEN;
|
||||
}
|
||||
|
||||
-static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto,
|
||||
+static bool nf_flow_skb_encap_protocol(struct sk_buff *skb, __be16 proto,
|
||||
u32 *offset)
|
||||
{
|
||||
struct vlan_ethhdr *veth;
|
||||
+ __be16 inner_proto;
|
||||
|
||||
switch (skb->protocol) {
|
||||
case htons(ETH_P_8021Q):
|
||||
@@ -281,7 +282,8 @@ static bool nf_flow_skb_encap_protocol(c
|
||||
}
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- if (nf_flow_pppoe_proto(skb) == proto) {
|
||||
+ if (nf_flow_pppoe_proto(skb, &inner_proto) &&
|
||||
+ inner_proto == proto) {
|
||||
*offset += PPPOE_SES_HLEN;
|
||||
return true;
|
||||
}
|
||||
@@ -310,7 +312,7 @@ static void nf_flow_encap_pop(struct sk_
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- skb->protocol = nf_flow_pppoe_proto(skb);
|
||||
+ skb->protocol = __nf_flow_pppoe_proto(skb);
|
||||
skb_pull(skb, PPPOE_SES_HLEN);
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
@ -0,0 +1,24 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 11 Apr 2024 13:29:00 +0200
|
||||
Subject: [PATCH] netfilter: flowtable: incorrect pppoe tuple
|
||||
|
||||
pppoe traffic reaching ingress path does not match the flowtable entry
|
||||
because the pppoe header is expected to be at the network header offset.
|
||||
This bug causes a mismatch in the flow table lookup, so pppoe packets
|
||||
enter the classical forwarding path.
|
||||
|
||||
Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -156,7 +156,7 @@ static void nf_flow_tuple_encap(struct s
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- phdr = (struct pppoe_hdr *)skb_mac_header(skb);
|
||||
+ phdr = (struct pppoe_hdr *)skb_network_header(skb);
|
||||
tuple->encap[i].id = ntohs(phdr->sid);
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
break;
|
@ -0,0 +1,87 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 11 Apr 2024 13:28:59 +0200
|
||||
Subject: [PATCH] netfilter: flowtable: validate pppoe header
|
||||
|
||||
Ensure there is sufficient room to access the protocol field of the
|
||||
PPPoe header. Validate it once before the flowtable lookup, then use a
|
||||
helper function to access protocol field.
|
||||
|
||||
Reported-by: syzbot+b6f07e1c07ef40199081@syzkaller.appspotmail.com
|
||||
Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -335,7 +335,7 @@ int nf_flow_rule_route_ipv6(struct net *
|
||||
int nf_flow_table_offload_init(void);
|
||||
void nf_flow_table_offload_exit(void);
|
||||
|
||||
-static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
+static inline __be16 __nf_flow_pppoe_proto(const struct sk_buff *skb)
|
||||
{
|
||||
__be16 proto;
|
||||
|
||||
@@ -351,6 +351,16 @@ static inline __be16 nf_flow_pppoe_proto
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static inline bool nf_flow_pppoe_proto(struct sk_buff *skb, __be16 *inner_proto)
|
||||
+{
|
||||
+ if (!pskb_may_pull(skb, PPPOE_SES_HLEN))
|
||||
+ return false;
|
||||
+
|
||||
+ *inner_proto = __nf_flow_pppoe_proto(skb);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
#define NF_FLOW_TABLE_STAT_INC(net, count) __this_cpu_inc((net)->ft.stat->count)
|
||||
#define NF_FLOW_TABLE_STAT_DEC(net, count) __this_cpu_dec((net)->ft.stat->count)
|
||||
#define NF_FLOW_TABLE_STAT_INC_ATOMIC(net, count) \
|
||||
--- a/net/netfilter/nf_flow_table_inet.c
|
||||
+++ b/net/netfilter/nf_flow_table_inet.c
|
||||
@@ -21,7 +21,8 @@ nf_flow_offload_inet_hook(void *priv, st
|
||||
proto = veth->h_vlan_encapsulated_proto;
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- proto = nf_flow_pppoe_proto(skb);
|
||||
+ if (!nf_flow_pppoe_proto(skb, &proto))
|
||||
+ return NF_ACCEPT;
|
||||
break;
|
||||
default:
|
||||
proto = skb->protocol;
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -273,10 +273,11 @@ static unsigned int nf_flow_xmit_xfrm(st
|
||||
return NF_STOLEN;
|
||||
}
|
||||
|
||||
-static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto,
|
||||
+static bool nf_flow_skb_encap_protocol(struct sk_buff *skb, __be16 proto,
|
||||
u32 *offset)
|
||||
{
|
||||
struct vlan_ethhdr *veth;
|
||||
+ __be16 inner_proto;
|
||||
|
||||
switch (skb->protocol) {
|
||||
case htons(ETH_P_8021Q):
|
||||
@@ -287,7 +288,8 @@ static bool nf_flow_skb_encap_protocol(c
|
||||
}
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- if (nf_flow_pppoe_proto(skb) == proto) {
|
||||
+ if (nf_flow_pppoe_proto(skb, &inner_proto) &&
|
||||
+ inner_proto == proto) {
|
||||
*offset += PPPOE_SES_HLEN;
|
||||
return true;
|
||||
}
|
||||
@@ -316,7 +318,7 @@ static void nf_flow_encap_pop(struct sk_
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- skb->protocol = nf_flow_pppoe_proto(skb);
|
||||
+ skb->protocol = __nf_flow_pppoe_proto(skb);
|
||||
skb_pull(skb, PPPOE_SES_HLEN);
|
||||
skb_reset_network_header(skb);
|
||||
break;
|
@ -0,0 +1,24 @@
|
||||
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
Date: Thu, 11 Apr 2024 13:29:00 +0200
|
||||
Subject: [PATCH] netfilter: flowtable: incorrect pppoe tuple
|
||||
|
||||
pppoe traffic reaching ingress path does not match the flowtable entry
|
||||
because the pppoe header is expected to be at the network header offset.
|
||||
This bug causes a mismatch in the flow table lookup, so pppoe packets
|
||||
enter the classical forwarding path.
|
||||
|
||||
Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
|
||||
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
---
|
||||
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -157,7 +157,7 @@ static void nf_flow_tuple_encap(struct s
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
break;
|
||||
case htons(ETH_P_PPP_SES):
|
||||
- phdr = (struct pppoe_hdr *)skb_mac_header(skb);
|
||||
+ phdr = (struct pppoe_hdr *)skb_network_header(skb);
|
||||
tuple->encap[i].id = ntohs(phdr->sid);
|
||||
tuple->encap[i].proto = skb->protocol;
|
||||
break;
|
@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
|
||||
--- /dev/null
|
||||
+++ b/net/netfilter/xt_FLOWOFFLOAD.c
|
||||
@@ -0,0 +1,701 @@
|
||||
@@ -0,0 +1,702 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2018-2021 Felix Fietkau <nbd@nbd.name>
|
||||
+ *
|
||||
@ -163,7 +163,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+ proto = veth->h_vlan_encapsulated_proto;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ proto = nf_flow_pppoe_proto(skb);
|
||||
+ if (!nf_flow_pppoe_proto(skb, &proto))
|
||||
+ return NF_ACCEPT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ proto = skb->protocol;
|
||||
|
@ -179,6 +179,32 @@ Subject: [PATCH] kernel: add block fit partition parser
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
--- a/drivers/mtd/mtd_blkdevs.c
|
||||
+++ b/drivers/mtd/mtd_blkdevs.c
|
||||
@@ -359,7 +359,9 @@ int add_mtd_blktrans_dev(struct mtd_blkt
|
||||
} else {
|
||||
snprintf(gd->disk_name, sizeof(gd->disk_name),
|
||||
"%s%d", tr->name, new->devnum);
|
||||
- gd->flags |= GENHD_FL_NO_PART;
|
||||
+
|
||||
+ if (!IS_ENABLED(CONFIG_FIT_PARTITION) || mtd_type_is_nand(new->mtd))
|
||||
+ gd->flags |= GENHD_FL_NO_PART;
|
||||
}
|
||||
|
||||
set_capacity(gd, ((u64)new->size * tr->blksize) >> 9);
|
||||
--- a/drivers/mtd/ubi/block.c
|
||||
+++ b/drivers/mtd/ubi/block.c
|
||||
@@ -431,7 +431,9 @@ int ubiblock_create(struct ubi_volume_in
|
||||
ret = -ENODEV;
|
||||
goto out_cleanup_disk;
|
||||
}
|
||||
- gd->flags |= GENHD_FL_NO_PART;
|
||||
+ if (!IS_ENABLED(CONFIG_FIT_PARTITION))
|
||||
+ gd->flags |= GENHD_FL_NO_PART;
|
||||
+
|
||||
gd->private_data = dev;
|
||||
sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
|
||||
set_capacity(gd, disk_capacity);
|
||||
--- a/include/linux/msdos_partition.h
|
||||
+++ b/include/linux/msdos_partition.h
|
||||
@@ -31,6 +31,7 @@ enum msdos_sys_ind {
|
||||
|
@ -59,7 +59,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
|
||||
--- /dev/null
|
||||
+++ b/net/netfilter/xt_FLOWOFFLOAD.c
|
||||
@@ -0,0 +1,702 @@
|
||||
@@ -0,0 +1,703 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2018-2021 Felix Fietkau <nbd@nbd.name>
|
||||
+ *
|
||||
@ -124,7 +124,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+ proto = veth->h_vlan_encapsulated_proto;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ proto = nf_flow_pppoe_proto(skb);
|
||||
+ if (!nf_flow_pppoe_proto(skb, &proto))
|
||||
+ return NF_ACCEPT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ proto = skb->protocol;
|
||||
|
@ -59,7 +59,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
|
||||
--- /dev/null
|
||||
+++ b/net/netfilter/xt_FLOWOFFLOAD.c
|
||||
@@ -0,0 +1,702 @@
|
||||
@@ -0,0 +1,703 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2018-2021 Felix Fietkau <nbd@nbd.name>
|
||||
+ *
|
||||
@ -124,7 +124,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+ proto = veth->h_vlan_encapsulated_proto;
|
||||
+ break;
|
||||
+ case htons(ETH_P_PPP_SES):
|
||||
+ proto = nf_flow_pppoe_proto(skb);
|
||||
+ if (!nf_flow_pppoe_proto(skb, &proto))
|
||||
+ return NF_ACCEPT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ proto = skb->protocol;
|
||||
|
Loading…
x
Reference in New Issue
Block a user