mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
Revert "net: Remove low_thresh in ip defrag"
This reverts commitb2cbac9b9b
. We have multiple reports of obvious breakage from this patch. Reported-by: Ido Schimmel <idosch@idosch.org> Link: https://lore.kernel.org/all/ZGIRWjNcfqI8yY8W@shredder/ Link: https://lore.kernel.org/all/CADJHv_sDK=0RrMA2FTZQV5fw7UQ+qY=HG21Wu5qb0V9vvx5w6A@mail.gmail.com/ Reported-by: syzbot+a5e719ac7c268e414c95@syzkaller.appspotmail.com Reported-by: syzbot+a03fd670838d927d9cd8@syzkaller.appspotmail.com Fixes:b2cbac9b9b
("net: Remove low_thresh in ip defrag") Link: https://lore.kernel.org/r/20230517034112.1261835-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a0e35a648f
commit
e7480a44d7
6 changed files with 24 additions and 18 deletions
|
@ -55,7 +55,6 @@ nf_conntrack_frag6_high_thresh - INTEGER
|
||||||
nf_conntrack_frag6_low_thresh is reached.
|
nf_conntrack_frag6_low_thresh is reached.
|
||||||
|
|
||||||
nf_conntrack_frag6_low_thresh - INTEGER
|
nf_conntrack_frag6_low_thresh - INTEGER
|
||||||
(Obsolete since linux-4.17)
|
|
||||||
default 196608
|
default 196608
|
||||||
|
|
||||||
See nf_conntrack_frag6_low_thresh
|
See nf_conntrack_frag6_low_thresh
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
struct fqdir {
|
struct fqdir {
|
||||||
/* sysctls */
|
/* sysctls */
|
||||||
long high_thresh;
|
long high_thresh;
|
||||||
|
long low_thresh;
|
||||||
int timeout;
|
int timeout;
|
||||||
int max_dist;
|
int max_dist;
|
||||||
struct inet_frags *f;
|
struct inet_frags *f;
|
||||||
|
|
|
@ -318,7 +318,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SYSCTL
|
#ifdef CONFIG_SYSCTL
|
||||||
static unsigned long lowpanfrag_low_thresh_unuesd = IPV6_FRAG_LOW_THRESH;
|
|
||||||
static struct ctl_table lowpan_frags_ns_ctl_table[] = {
|
static struct ctl_table lowpan_frags_ns_ctl_table[] = {
|
||||||
{
|
{
|
||||||
.procname = "6lowpanfrag_high_thresh",
|
.procname = "6lowpanfrag_high_thresh",
|
||||||
|
@ -374,9 +374,9 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
|
||||||
}
|
}
|
||||||
|
|
||||||
table[0].data = &ieee802154_lowpan->fqdir->high_thresh;
|
table[0].data = &ieee802154_lowpan->fqdir->high_thresh;
|
||||||
table[0].extra1 = &lowpanfrag_low_thresh_unuesd;
|
table[0].extra1 = &ieee802154_lowpan->fqdir->low_thresh;
|
||||||
table[1].data = &lowpanfrag_low_thresh_unuesd;
|
table[1].data = &ieee802154_lowpan->fqdir->low_thresh;
|
||||||
table[1].extra2 = &ieee802154_lowpan->fqdir->high_thresh;
|
table[1].extra2 = &ieee802154_lowpan->fqdir->high_thresh;
|
||||||
table[2].data = &ieee802154_lowpan->fqdir->timeout;
|
table[2].data = &ieee802154_lowpan->fqdir->timeout;
|
||||||
|
|
||||||
hdr = register_net_sysctl(net, "net/ieee802154/6lowpan", table);
|
hdr = register_net_sysctl(net, "net/ieee802154/6lowpan", table);
|
||||||
|
@ -451,6 +451,7 @@ static int __net_init lowpan_frags_init_net(struct net *net)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
ieee802154_lowpan->fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
|
ieee802154_lowpan->fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
|
||||||
|
ieee802154_lowpan->fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
|
||||||
ieee802154_lowpan->fqdir->timeout = IPV6_FRAG_TIMEOUT;
|
ieee802154_lowpan->fqdir->timeout = IPV6_FRAG_TIMEOUT;
|
||||||
|
|
||||||
res = lowpan_frags_ns_sysctl_register(net);
|
res = lowpan_frags_ns_sysctl_register(net);
|
||||||
|
|
|
@ -553,7 +553,7 @@ EXPORT_SYMBOL(ip_check_defrag);
|
||||||
|
|
||||||
#ifdef CONFIG_SYSCTL
|
#ifdef CONFIG_SYSCTL
|
||||||
static int dist_min;
|
static int dist_min;
|
||||||
static unsigned long ipfrag_low_thresh_unused;
|
|
||||||
static struct ctl_table ip4_frags_ns_ctl_table[] = {
|
static struct ctl_table ip4_frags_ns_ctl_table[] = {
|
||||||
{
|
{
|
||||||
.procname = "ipfrag_high_thresh",
|
.procname = "ipfrag_high_thresh",
|
||||||
|
@ -609,9 +609,9 @@ static int __net_init ip4_frags_ns_ctl_register(struct net *net)
|
||||||
|
|
||||||
}
|
}
|
||||||
table[0].data = &net->ipv4.fqdir->high_thresh;
|
table[0].data = &net->ipv4.fqdir->high_thresh;
|
||||||
table[0].extra1 = &ipfrag_low_thresh_unused;
|
table[0].extra1 = &net->ipv4.fqdir->low_thresh;
|
||||||
table[1].data = &ipfrag_low_thresh_unused;
|
table[1].data = &net->ipv4.fqdir->low_thresh;
|
||||||
table[1].extra2 = &net->ipv4.fqdir->high_thresh;
|
table[1].extra2 = &net->ipv4.fqdir->high_thresh;
|
||||||
table[2].data = &net->ipv4.fqdir->timeout;
|
table[2].data = &net->ipv4.fqdir->timeout;
|
||||||
table[3].data = &net->ipv4.fqdir->max_dist;
|
table[3].data = &net->ipv4.fqdir->max_dist;
|
||||||
|
|
||||||
|
@ -674,9 +674,12 @@ static int __net_init ipv4_frags_init_net(struct net *net)
|
||||||
* A 64K fragment consumes 129736 bytes (44*2944)+200
|
* A 64K fragment consumes 129736 bytes (44*2944)+200
|
||||||
* (1500 truesize == 2944, sizeof(struct ipq) == 200)
|
* (1500 truesize == 2944, sizeof(struct ipq) == 200)
|
||||||
*
|
*
|
||||||
* We will commit 4MB at one time. Should we cross that limit.
|
* We will commit 4MB at one time. Should we cross that limit
|
||||||
|
* we will prune down to 3MB, making room for approx 8 big 64K
|
||||||
|
* fragments 8x128k.
|
||||||
*/
|
*/
|
||||||
net->ipv4.fqdir->high_thresh = 4 * 1024 * 1024;
|
net->ipv4.fqdir->high_thresh = 4 * 1024 * 1024;
|
||||||
|
net->ipv4.fqdir->low_thresh = 3 * 1024 * 1024;
|
||||||
/*
|
/*
|
||||||
* Important NOTE! Fragment queue must be destroyed before MSL expires.
|
* Important NOTE! Fragment queue must be destroyed before MSL expires.
|
||||||
* RFC791 is wrong proposing to prolongate timer each fragment arrival
|
* RFC791 is wrong proposing to prolongate timer each fragment arrival
|
||||||
|
|
|
@ -42,7 +42,7 @@ static struct nft_ct_frag6_pernet *nf_frag_pernet(struct net *net)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SYSCTL
|
#ifdef CONFIG_SYSCTL
|
||||||
static unsigned long nf_conntrack_frag6_low_thresh_unused = IPV6_FRAG_LOW_THRESH;
|
|
||||||
static struct ctl_table nf_ct_frag6_sysctl_table[] = {
|
static struct ctl_table nf_ct_frag6_sysctl_table[] = {
|
||||||
{
|
{
|
||||||
.procname = "nf_conntrack_frag6_timeout",
|
.procname = "nf_conntrack_frag6_timeout",
|
||||||
|
@ -82,10 +82,10 @@ static int nf_ct_frag6_sysctl_register(struct net *net)
|
||||||
nf_frag = nf_frag_pernet(net);
|
nf_frag = nf_frag_pernet(net);
|
||||||
|
|
||||||
table[0].data = &nf_frag->fqdir->timeout;
|
table[0].data = &nf_frag->fqdir->timeout;
|
||||||
table[1].data = &nf_conntrack_frag6_low_thresh_unused;
|
table[1].data = &nf_frag->fqdir->low_thresh;
|
||||||
table[1].extra2 = &nf_frag->fqdir->high_thresh;
|
table[1].extra2 = &nf_frag->fqdir->high_thresh;
|
||||||
table[2].data = &nf_frag->fqdir->high_thresh;
|
table[2].data = &nf_frag->fqdir->high_thresh;
|
||||||
table[2].extra1 = &nf_conntrack_frag6_low_thresh_unused;
|
table[2].extra1 = &nf_frag->fqdir->low_thresh;
|
||||||
|
|
||||||
hdr = register_net_sysctl(net, "net/netfilter", table);
|
hdr = register_net_sysctl(net, "net/netfilter", table);
|
||||||
if (hdr == NULL)
|
if (hdr == NULL)
|
||||||
|
@ -500,6 +500,7 @@ static int nf_ct_net_init(struct net *net)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
nf_frag->fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
|
nf_frag->fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
|
||||||
|
nf_frag->fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
|
||||||
nf_frag->fqdir->timeout = IPV6_FRAG_TIMEOUT;
|
nf_frag->fqdir->timeout = IPV6_FRAG_TIMEOUT;
|
||||||
|
|
||||||
res = nf_ct_frag6_sysctl_register(net);
|
res = nf_ct_frag6_sysctl_register(net);
|
||||||
|
|
|
@ -416,7 +416,7 @@ static const struct inet6_protocol frag_protocol = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_SYSCTL
|
#ifdef CONFIG_SYSCTL
|
||||||
static unsigned long ip6_frags_low_thresh_unused = IPV6_FRAG_LOW_THRESH;
|
|
||||||
static struct ctl_table ip6_frags_ns_ctl_table[] = {
|
static struct ctl_table ip6_frags_ns_ctl_table[] = {
|
||||||
{
|
{
|
||||||
.procname = "ip6frag_high_thresh",
|
.procname = "ip6frag_high_thresh",
|
||||||
|
@ -465,9 +465,9 @@ static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
|
||||||
|
|
||||||
}
|
}
|
||||||
table[0].data = &net->ipv6.fqdir->high_thresh;
|
table[0].data = &net->ipv6.fqdir->high_thresh;
|
||||||
table[0].extra1 = &ip6_frags_low_thresh_unused;
|
table[0].extra1 = &net->ipv6.fqdir->low_thresh;
|
||||||
table[1].data = &ip6_frags_low_thresh_unused;
|
table[1].data = &net->ipv6.fqdir->low_thresh;
|
||||||
table[1].extra2 = &net->ipv6.fqdir->high_thresh;
|
table[1].extra2 = &net->ipv6.fqdir->high_thresh;
|
||||||
table[2].data = &net->ipv6.fqdir->timeout;
|
table[2].data = &net->ipv6.fqdir->timeout;
|
||||||
|
|
||||||
hdr = register_net_sysctl(net, "net/ipv6", table);
|
hdr = register_net_sysctl(net, "net/ipv6", table);
|
||||||
|
@ -536,6 +536,7 @@ static int __net_init ipv6_frags_init_net(struct net *net)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
net->ipv6.fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
|
net->ipv6.fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
|
||||||
|
net->ipv6.fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
|
||||||
net->ipv6.fqdir->timeout = IPV6_FRAG_TIMEOUT;
|
net->ipv6.fqdir->timeout = IPV6_FRAG_TIMEOUT;
|
||||||
|
|
||||||
res = ip6_frags_ns_sysctl_register(net);
|
res = ip6_frags_ns_sysctl_register(net);
|
||||||
|
|
Loading…
Reference in a new issue