Skip to content

Commit 5fff99e

Browse files
edumazetgregkh
authored andcommitted
inet: frags: fix ip6frag_low_thresh boundary
Giving an integer to proc_doulongvec_minmax() is dangerous on 64bit arches, since linker might place next to it a non zero value preventing a change to ip6frag_low_thresh. ip6frag_low_thresh is not used anymore in the kernel, but we do not want to prematuraly break user scripts wanting to change it. Since specifying a minimal value of 0 for proc_doulongvec_minmax() is moot, let's remove these zero values in all defrag units. Fixes: 6e00f7d ("ipv6: frags: fix /proc/sys/net/ipv6/ip6frag_low_thresh") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Maciej Żenczykowski <maze@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit 3d23401) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 48c2afc commit 5fff99e

4 files changed

Lines changed: 3 additions & 10 deletions

File tree

net/ieee802154/6lowpan/reassembly.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type)
411411
}
412412

413413
#ifdef CONFIG_SYSCTL
414-
static long zero;
415414

416415
static struct ctl_table lowpan_frags_ns_ctl_table[] = {
417416
{
@@ -428,7 +427,6 @@ static struct ctl_table lowpan_frags_ns_ctl_table[] = {
428427
.maxlen = sizeof(unsigned long),
429428
.mode = 0644,
430429
.proc_handler = proc_doulongvec_minmax,
431-
.extra1 = &zero,
432430
.extra2 = &init_net.ieee802154_lowpan.frags.high_thresh
433431
},
434432
{

net/ipv4/ip_fragment.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user)
672672
EXPORT_SYMBOL(ip_check_defrag);
673673

674674
#ifdef CONFIG_SYSCTL
675-
static long zero;
675+
static int dist_min;
676676

677677
static struct ctl_table ip4_frags_ns_ctl_table[] = {
678678
{
@@ -689,7 +689,6 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
689689
.maxlen = sizeof(unsigned long),
690690
.mode = 0644,
691691
.proc_handler = proc_doulongvec_minmax,
692-
.extra1 = &zero,
693692
.extra2 = &init_net.ipv4.frags.high_thresh
694693
},
695694
{
@@ -705,7 +704,7 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
705704
.maxlen = sizeof(int),
706705
.mode = 0644,
707706
.proc_handler = proc_dointvec_minmax,
708-
.extra1 = &zero
707+
.extra1 = &dist_min,
709708
},
710709
{ }
711710
};

net/ipv6/netfilter/nf_conntrack_reasm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ struct nf_ct_frag6_skb_cb
6363
static struct inet_frags nf_frags;
6464

6565
#ifdef CONFIG_SYSCTL
66-
static long zero;
6766

6867
static struct ctl_table nf_ct_frag6_sysctl_table[] = {
6968
{
@@ -79,7 +78,6 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = {
7978
.maxlen = sizeof(unsigned long),
8079
.mode = 0644,
8180
.proc_handler = proc_doulongvec_minmax,
82-
.extra1 = &zero,
8381
.extra2 = &init_net.nf_frag.frags.high_thresh
8482
},
8583
{

net/ipv6/reassembly.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,6 @@ static const struct inet6_protocol frag_protocol = {
554554
};
555555

556556
#ifdef CONFIG_SYSCTL
557-
static int zero;
558557

559558
static struct ctl_table ip6_frags_ns_ctl_table[] = {
560559
{
@@ -570,8 +569,7 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = {
570569
.data = &init_net.ipv6.frags.low_thresh,
571570
.maxlen = sizeof(unsigned long),
572571
.mode = 0644,
573-
.proc_handler = proc_dointvec_minmax,
574-
.extra1 = &zero,
572+
.proc_handler = proc_doulongvec_minmax,
575573
.extra2 = &init_net.ipv6.frags.high_thresh
576574
},
577575
{

0 commit comments

Comments
 (0)