Skip to content

Commit 2409fa6

Browse files
author
Paolo Abeni
committed
Merge tag 'nf-25-03-13' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf
Pablo Neira Ayuso says: ==================== Netfilter/IPVS fixes for net The following patchset contains Netfilter/IPVS fixes for net: 1) Missing initialization of cpu and jiffies32 fields in conncount, from Kohei Enju. 2) Skip several tests in case kernel is tainted, otherwise tests bogusly report failure too as they also check for tainted kernel, from Florian Westphal. 3) Fix a hyphothetical integer overflow in do_ip_vs_get_ctl() leading to bogus error logs, from Dan Carpenter. 4) Fix incorrect offset in ipv4 option match in nft_exthdr, from Alexey Kashavkin. netfilter pull request 25-03-13 * tag 'nf-25-03-13' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf: netfilter: nft_exthdr: fix offset with ipv4_find_option() ipvs: prevent integer overflow in do_ip_vs_get_ctl() selftests: netfilter: skip br_netfilter queue tests if kernel is tainted netfilter: nf_conncount: Fully initialize struct nf_conncount_tuple in insert_tree() ==================== Link: https://patch.msgid.link/20250313095636.2186-1-pablo@netfilter.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2 parents 3e64bb2 + 6edd78a commit 2409fa6

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

net/netfilter/ipvs/ip_vs_ctl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,12 +3091,12 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
30913091
case IP_VS_SO_GET_SERVICES:
30923092
{
30933093
struct ip_vs_get_services *get;
3094-
int size;
3094+
size_t size;
30953095

30963096
get = (struct ip_vs_get_services *)arg;
30973097
size = struct_size(get, entrytable, get->num_services);
30983098
if (*len != size) {
3099-
pr_err("length: %u != %u\n", *len, size);
3099+
pr_err("length: %u != %zu\n", *len, size);
31003100
ret = -EINVAL;
31013101
goto out;
31023102
}
@@ -3132,12 +3132,12 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
31323132
case IP_VS_SO_GET_DESTS:
31333133
{
31343134
struct ip_vs_get_dests *get;
3135-
int size;
3135+
size_t size;
31363136

31373137
get = (struct ip_vs_get_dests *)arg;
31383138
size = struct_size(get, entrytable, get->num_dests);
31393139
if (*len != size) {
3140-
pr_err("length: %u != %u\n", *len, size);
3140+
pr_err("length: %u != %zu\n", *len, size);
31413141
ret = -EINVAL;
31423142
goto out;
31433143
}

net/netfilter/nf_conncount.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ insert_tree(struct net *net,
377377

378378
conn->tuple = *tuple;
379379
conn->zone = *zone;
380+
conn->cpu = raw_smp_processor_id();
381+
conn->jiffies32 = (u32)jiffies;
380382
memcpy(rbconn->key, key, sizeof(u32) * data->keylen);
381383

382384
nf_conncount_list_init(&rbconn->list);

net/netfilter/nft_exthdr.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,13 @@ static int ipv4_find_option(struct net *net, struct sk_buff *skb,
8585
unsigned char optbuf[sizeof(struct ip_options) + 40];
8686
struct ip_options *opt = (struct ip_options *)optbuf;
8787
struct iphdr *iph, _iph;
88-
unsigned int start;
8988
bool found = false;
9089
__be32 info;
9190
int optlen;
9291

9392
iph = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
9493
if (!iph)
9594
return -EBADMSG;
96-
start = sizeof(struct iphdr);
9795

9896
optlen = iph->ihl * 4 - (int)sizeof(struct iphdr);
9997
if (optlen <= 0)
@@ -103,7 +101,7 @@ static int ipv4_find_option(struct net *net, struct sk_buff *skb,
103101
/* Copy the options since __ip_options_compile() modifies
104102
* the options.
105103
*/
106-
if (skb_copy_bits(skb, start, opt->__data, optlen))
104+
if (skb_copy_bits(skb, sizeof(struct iphdr), opt->__data, optlen))
107105
return -EBADMSG;
108106
opt->optlen = optlen;
109107

@@ -118,18 +116,18 @@ static int ipv4_find_option(struct net *net, struct sk_buff *skb,
118116
found = target == IPOPT_SSRR ? opt->is_strictroute :
119117
!opt->is_strictroute;
120118
if (found)
121-
*offset = opt->srr + start;
119+
*offset = opt->srr;
122120
break;
123121
case IPOPT_RR:
124122
if (!opt->rr)
125123
break;
126-
*offset = opt->rr + start;
124+
*offset = opt->rr;
127125
found = true;
128126
break;
129127
case IPOPT_RA:
130128
if (!opt->router_alert)
131129
break;
132-
*offset = opt->router_alert + start;
130+
*offset = opt->router_alert;
133131
found = true;
134132
break;
135133
default:

tools/testing/selftests/net/netfilter/br_netfilter.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ source lib.sh
1313

1414
checktool "nft --version" "run test without nft tool"
1515

16+
read t < /proc/sys/kernel/tainted
17+
if [ "$t" -ne 0 ];then
18+
echo SKIP: kernel is tainted
19+
exit $ksft_skip
20+
fi
21+
1622
cleanup() {
1723
cleanup_all_ns
1824
}
@@ -165,6 +171,7 @@ if [ "$t" -eq 0 ];then
165171
echo PASS: kernel not tainted
166172
else
167173
echo ERROR: kernel is tainted
174+
dmesg
168175
ret=1
169176
fi
170177

tools/testing/selftests/net/netfilter/br_netfilter_queue.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ source lib.sh
44

55
checktool "nft --version" "run test without nft tool"
66

7+
read t < /proc/sys/kernel/tainted
8+
if [ "$t" -ne 0 ];then
9+
echo SKIP: kernel is tainted
10+
exit $ksft_skip
11+
fi
12+
713
cleanup() {
814
cleanup_all_ns
915
}
@@ -72,6 +78,7 @@ if [ "$t" -eq 0 ];then
7278
echo PASS: kernel not tainted
7379
else
7480
echo ERROR: kernel is tainted
81+
dmesg
7582
exit 1
7683
fi
7784

tools/testing/selftests/net/netfilter/nft_queue.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ EOF
593593
echo "PASS: queue program exiting while packets queued"
594594
else
595595
echo "TAINT: queue program exiting while packets queued"
596+
dmesg
596597
ret=1
597598
fi
598599
}

0 commit comments

Comments
 (0)