Netfilter/IPVS fixes for net
Subsystems (5)
Pablo Neira Ayuso
maintainercover Netfilter/IPVS fixes for net
Hi,
The following patchset contains Netfilter/IPVS fixes for net:
1) Fix crash on flowtable due to race between garbage collection and insertion.
2) Restore callback unbinding in netfilter offloads.
3) Fix races on IPVS module removal, from Davide Caratti.
4) Make old_secure_tcp per-netns to fix sysbot report, from Eric Dumazet.
5) Validate matching length in netfilter offloads, from wenxu.
You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
Thank you.
----------------------------------------------------------------
The following changes since commit 6c5d9c2a6bedbb3c3c14253776320c0ee564f064:
ipv6: include <net/addrconf.h> for missing declarations (2019-10-22 15:17:03 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git HEAD
for you to fetch changes up to 52b33b4f8186669ab88b56cf5b2812e3996ef289:
Merge tag 'ipvs-fixes-for-v5.4' of https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs (2019-10-26 12:42:45 +0200)
----------------------------------------------------------------
Davide Caratti (1):
ipvs: don't ignore errors in case refcounting ip_vs module fails
Eric Dumazet (1):
ipvs: move old_secure_tcp into struct netns_ipvs
Pablo Neira Ayuso (3):
netfilter: nf_flow_table: set timeout before insertion into hashes
netfilter: nf_tables_offload: restore basechain deletion Merge tag 'ipvs-fixes-for-v5.4' of https://git.kernel.org/.../horms/ipvs
wenxu (1):
netfilter: nft_payload: fix missing check for matching length in offloads
include/net/ip_vs.h | 1 + net/netfilter/ipvs/ip_vs_app.c | 12 ++++++++++-- net/netfilter/ipvs/ip_vs_ctl.c | 29 +++++++++++------------------ net/netfilter/ipvs/ip_vs_pe.c | 3 ++- net/netfilter/ipvs/ip_vs_sched.c | 3 ++- net/netfilter/ipvs/ip_vs_sync.c | 13 ++++++++++--- net/netfilter/nf_flow_table_core.c | 3 ++- net/netfilter/nf_tables_offload.c | 2 +- net/netfilter/nft_payload.c | 38 ++++++++++++++++++++++++++++++++++++++ 9 files changed, 77 insertions(+), 27 deletions(-)
Pablo Neira Ayuso
maintainerPATCH 1/5 netfilter: nf_flow_table: set timeout before insertion into hashes
Other garbage collector might remove an entry not fully set up yet.
[570953.958293] RIP: 0010:memcmp+0x9/0x50 [...] [570953.958567] flow_offload_hash_cmp+0x1e/0x30 [nf_flow_table] [570953.958585] flow_offload_lookup+0x8c/0x110 [nf_flow_table] [570953.958606] nf_flow_offload_ip_hook+0x135/0xb30 [nf_flow_table] [570953.958624] nf_flow_offload_inet_hook+0x35/0x37 [nf_flow_table_inet] [570953.958646] nf_hook_slow+0x3c/0xb0 [570953.958664] __netif_receive_skb_core+0x90f/0xb10 [570953.958678] ? ip_rcv_finish+0x82/0xa0 [570953.958692] __netif_receive_skb_one_core+0x3b/0x80 [570953.958711] __netif_receive_skb+0x18/0x60 [570953.958727] netif_receive_skb_internal+0x45/0xf0 [570953.958741] napi_gro_receive+0xcd/0xf0 [570953.958764] ixgbe_clean_rx_irq+0x432/0xe00 [ixgbe] [570953.958782] ixgbe_poll+0x27b/0x700 [ixgbe] [570953.958796] net_rx_action+0x284/0x3c0 [570953.958817] __do_softirq+0xcc/0x27c [570953.959464] irq_exit+0xe8/0x100 [570953.960097] do_IRQ+0x59/0xe0 [570953.960734] common_interrupt+0xf/0xf
--- net/netfilter/nf_flow_table_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_flow_table_core.c +2 -1
@@ -202,6 +202,8 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) {int err; + flow->timeout = (u32 )jiffies +NF_FLOW_TIMEOUT ; + err =rhashtable_insert_fast (&flow_table->rhashtable, &flow->tuplehash[0 ].node, nf_flow_offload_rhash_params);
@@ -218,7 +220,6 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow)return err; } - flow->timeout = (u32 )jiffies +NF_FLOW_TIMEOUT ;return 0 ; }EXPORT_SYMBOL_GPL (flow_offload_add);
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 2/5 netfilter: nf_tables_offload: restore basechain deletion
In reply to Pablo Neira AyusoUnbind callbacks on chain deletion.
--- net/netfilter/nf_tables_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_offload.c +1 -1
@@ -347,7 +347,7 @@ int nft_flow_rule_offload_commit(struct net *net) policy =nft_trans_chain_policy (trans); err =nft_flow_offload_chain (trans->ctx.chain, &policy, -FLOW_BLOCK_BIND ); +FLOW_BLOCK_UNBIND );break ;case NFT_MSG_NEWRULE :if (!(trans->ctx.chain->flags &NFT_CHAIN_HW_OFFLOAD ))
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 3/5 ipvs: don't ignore errors in case refcounting ip_vs module fails
In reply to Pablo Neira AyusoFrom: Davide Caratti <[email protected]>
if the IPVS module is removed while the sync daemon is starting, there is a small gap where try_module_get() might fail getting the refcount inside ip_vs_use_count_inc(). Then, the refcounts of IPVS module are unbalanced, and the subsequent call to stop_sync_thread() causes the following splat:
WARNING: CPU: 0 PID: 4013 at kernel/module.c:1146 module_put.part.44+0x15b/0x290 Modules linked in: ip_vs(-) nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 veth ip6table_filter ip6_tables iptable_filter binfmt_misc intel_rapl_msr intel_rapl_common crct10dif_pclmul crc32_pclmul ext4 mbcache jbd2 ghash_clmulni_intel snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_nhlt snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm aesni_intel crypto_simd cryptd glue_helper joydev pcspkr snd_timer virtio_balloon snd soundcore i2c_piix4 nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c ata_generic pata_acpi virtio_net net_failover virtio_blk failover virtio_console qxl drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ata_piix ttm crc32c_intel serio_raw drm virtio_pci libata virtio_ring virtio floppy dm_mirror dm_region_hash dm_log dm_mod [last unloaded: nf_defrag_ipv6] CPU: 0 PID: 4013 Comm: modprobe Tainted: G W 5.4.0-rc1.upstream+ #741 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 RIP: 0010:module_put.part.44+0x15b/0x290 Code: 04 25 28 00 00 00 0f 85 18 01 00 00 48 83 c4 68 5b 5d 41 5c 41 5d 41 5e 41 5f c3 89 44 24 28 83 e8 01 89 c5 0f 89 57 ff ff ff <0f> 0b e9 78 ff ff ff 65 8b 1d 67 83 26 4a 89 db be 08 00 00 00 48 RSP: 0018:ffff888050607c78 EFLAGS: 00010297 RAX: 0000000000000003 RBX: ffffffffc1420590 RCX: ffffffffb5db0ef9 RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffffc1420590 RBP: 00000000ffffffff R08: fffffbfff82840b3 R09: fffffbfff82840b3 R10: 0000000000000001 R11: fffffbfff82840b2 R12: 1ffff1100a0c0f90 R13: ffffffffc1420200 R14: ffff88804f533300 R15: ffff88804f533ca0 FS: 00007f8ea9720740(0000) GS:ffff888053800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f3245abe000 CR3: 000000004c28a006 CR4: 00000000001606f0 Call Trace: stop_sync_thread+0x3a3/0x7c0 [ip_vs] ip_vs_sync_net_cleanup+0x13/0x50 [ip_vs] ops_exit_list.isra.5+0x94/0x140 unregister_pernet_operations+0x29d/0x460 unregister_pernet_device+0x26/0x60 ip_vs_cleanup+0x11/0x38 [ip_vs] __x64_sys_delete_module+0x2d5/0x400 do_syscall_64+0xa5/0x4e0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f8ea8bf0db7 Code: 73 01 c3 48 8b 0d b9 80 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 89 80 2c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffcd38d2fe8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 RAX: ffffffffffffffda RBX: 0000000002436240 RCX: 00007f8ea8bf0db7 RDX: 0000000000000000 RSI: 0000000000000800 RDI: 00000000024362a8 RBP: 0000000000000000 R08: 00007f8ea8eba060 R09: 00007f8ea8c658a0 R10: 00007ffcd38d2a60 R11: 0000000000000206 R12: 0000000000000000 R13: 0000000000000001 R14: 00000000024362a8 R15: 0000000000000000 irq event stamp: 4538 hardirqs last enabled at (4537): [<ffffffffb6193dde>] quarantine_put+0x9e/0x170 hardirqs last disabled at (4538): [<ffffffffb5a0556a>] trace_hardirqs_off_thunk+0x1a/0x20 softirqs last enabled at (4522): [<ffffffffb6f8ebe9>] sk_common_release+0x169/0x2d0 softirqs last disabled at (4520): [<ffffffffb6f8eb3e>] sk_common_release+0xbe/0x2d0
Check the return value of ip_vs_use_count_inc() and let its caller return proper error. Inside do_ip_vs_set_ctl() the module is already refcounted, we don't need refcount/derefcount there. Finally, in register_ip_vs_app() and start_sync_thread(), take the module refcount earlier and ensure it's released in the error path.
Change since v1:
- better return values in case of failure of ip_vs_use_count_inc(), thanks to Julian Anastasov
- no need to increase/decrease the module refcount in ip_vs_set_ctl(), thanks to Julian Anastasov
--- net/netfilter/ipvs/ip_vs_app.c | 12 ++++++++++-- net/netfilter/ipvs/ip_vs_ctl.c | 14 ++++---------- net/netfilter/ipvs/ip_vs_pe.c | 3 ++- net/netfilter/ipvs/ip_vs_sched.c | 3 ++- net/netfilter/ipvs/ip_vs_sync.c | 13 ++++++++++--- 5 files changed, 28 insertions(+), 17 deletions(-)
net/netfilter/ipvs/ip_vs_app.c +10 -2
@@ -193,21 +193,29 @@ struct ip_vs_app *register_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *mutex_lock (&__ip_vs_app_mutex); +/* increase the module use count */ +if (!ip_vs_use_count_inc ()) { + err = -ENOENT ; + goto out_unlock; + } +list_for_each_entry (a, &ipvs->app_list, a_list) {if (!strcmp (app->name, a->name)) { err = -EEXIST ; +/* decrease the module use count */ +ip_vs_use_count_dec (); goto out_unlock; } } a =kmemdup (app,sizeof (*app),GFP_KERNEL );if (!a) { err = -ENOMEM ; +/* decrease the module use count */ +ip_vs_use_count_dec (); goto out_unlock; }INIT_LIST_HEAD (&a->incs_list);list_add (&a->a_list, &ipvs->app_list); -/* increase the module use count */ -ip_vs_use_count_inc (); out_unlock:mutex_unlock (&__ip_vs_app_mutex);
net/netfilter/ipvs/ip_vs_ctl.c +4 -10
@@ -1275,7 +1275,8 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u,struct ip_vs_service *svc =NULL ;/* increase the module use count */ -ip_vs_use_count_inc (); +if (!ip_vs_use_count_inc ()) +return -ENOPROTOOPT ;/* Lookup the scheduler by 'u->sched_name' */ if (strcmp (u->sched_name,"none" )) {
@@ -2435,9 +2436,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)if (copy_from_user (arg, user, len) !=0 )return -EFAULT ; -/* increase the module use count */ -ip_vs_use_count_inc (); -/* Handle daemons since they have another lock */ if (cmd ==IP_VS_SO_SET_STARTDAEMON || cmd ==IP_VS_SO_SET_STOPDAEMON ) {
@@ -2450,13 +2448,13 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) ret = -EINVAL ;if (strscpy (cfg.mcast_ifn, dm->mcast_ifn,sizeof (cfg.mcast_ifn)) <=0 ) - goto out_dec; +return ret; cfg.syncid = dm->syncid; ret =start_sync_thread (ipvs, &cfg, dm->state); }else { ret =stop_sync_thread (ipvs, dm->state); } - goto out_dec; +return ret; }mutex_lock (&__ip_vs_mutex);
@@ -2551,10 +2549,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) out_unlock:mutex_unlock (&__ip_vs_mutex); - out_dec: -/* decrease the module use count */ -ip_vs_use_count_dec (); -return ret; }
net/netfilter/ipvs/ip_vs_pe.c +2 -1
@@ -68,7 +68,8 @@ int register_ip_vs_pe(struct ip_vs_pe *pe)struct ip_vs_pe *tmp;/* increase the module use count */ -ip_vs_use_count_inc (); +if (!ip_vs_use_count_inc ()) +return -ENOENT ;mutex_lock (&ip_vs_pe_mutex);/* Make sure that the pe with this name doesn't exist
net/netfilter/ipvs/ip_vs_sched.c +2 -1
@@ -179,7 +179,8 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler) }/* increase the module use count */ -ip_vs_use_count_inc (); +if (!ip_vs_use_count_inc ()) +return -ENOENT ;mutex_lock (&ip_vs_sched_mutex);
net/netfilter/ipvs/ip_vs_sync.c +10 -3
@@ -1762,6 +1762,10 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c,IP_VS_DBG (7 ,"Each ip_vs_sync_conn entry needs %zd bytes\n" ,sizeof (struct ip_vs_sync_conn_v0 )); +/* increase the module use count */ +if (!ip_vs_use_count_inc ()) +return -ENOPROTOOPT ; +/* Do not hold one mutex and then to block on another */ for (;;) {rtnl_lock ();
@@ -1892,9 +1896,6 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c,mutex_unlock (&ipvs->sync_mutex);rtnl_unlock (); -/* increase the module use count */ -ip_vs_use_count_inc (); -return 0 ; out:
@@ -1924,11 +1925,17 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, }kfree (ti); } + +/* decrease the module use count */ +ip_vs_use_count_dec ();return result; out_early:mutex_unlock (&ipvs->sync_mutex);rtnl_unlock (); + +/* decrease the module use count */ +ip_vs_use_count_dec ();return result; }
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 4/5 ipvs: move old_secure_tcp into struct netns_ipvs
In reply to Pablo Neira AyusoFrom: Eric Dumazet <[email protected]>
syzbot reported the following issue :
BUG: KCSAN: data-race in update_defense_level / update_defense_level
read to 0xffffffff861a6260 of 4 bytes by task 3006 on cpu 1:
update_defense_level+0x621/0xb30 net/netfilter/ipvs/ip_vs_ctl.c:177 defense_work_handler+0x3d/0xd0 net/netfilter/ipvs/ip_vs_ctl.c:225 process_one_work+0x3d4/0x890 kernel/workqueue.c:2269 worker_thread+0xa0/0x800 kernel/workqueue.c:2415 kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
write to 0xffffffff861a6260 of 4 bytes by task 7333 on cpu 0:
update_defense_level+0xa62/0xb30 net/netfilter/ipvs/ip_vs_ctl.c:205 defense_work_handler+0x3d/0xd0 net/netfilter/ipvs/ip_vs_ctl.c:225 process_one_work+0x3d4/0x890 kernel/workqueue.c:2269 worker_thread+0xa0/0x800 kernel/workqueue.c:2415 kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 7333 Comm: kworker/0:5 Not tainted 5.4.0-rc3+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events defense_work_handler
Indeed, old_secure_tcp is currently a static variable, while it needs to be a per netns variable.
--- include/net/ip_vs.h | 1 + net/netfilter/ipvs/ip_vs_ctl.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-)
include/net/ip_vs.h +1 -0
@@ -889,6 +889,7 @@ struct netns_ipvs {struct delayed_work defense_work;/* Work handler */ int drop_rate;int drop_counter; +int old_secure_tcp;atomic_t dropentry;/* locks in ctl.c */ spinlock_t dropentry_lock;/* drop entry handling */
net/netfilter/ipvs/ip_vs_ctl.c +7 -8
@@ -93,7 +93,6 @@ static bool __ip_vs_addr_is_local_v6(struct net *net,static void update_defense_level (struct netns_ipvs *ipvs) {struct sysinfo i; -static int old_secure_tcp =0 ;int availmem;int nomem;int to_change =-1 ;
@@ -174,35 +173,35 @@ static void update_defense_level(struct netns_ipvs *ipvs)spin_lock (&ipvs->securetcp_lock);switch (ipvs->sysctl_secure_tcp) {case 0 : -if (old_secure_tcp >=2 ) +if (ipvs->old_secure_tcp >=2 ) to_change =0 ;break ;case 1 :if (nomem) { -if (old_secure_tcp <2 ) +if (ipvs->old_secure_tcp <2 ) to_change =1 ; ipvs->sysctl_secure_tcp =2 ; }else { -if (old_secure_tcp >=2 ) +if (ipvs->old_secure_tcp >=2 ) to_change =0 ; }break ;case 2 :if (nomem) { -if (old_secure_tcp <2 ) +if (ipvs->old_secure_tcp <2 ) to_change =1 ; }else { -if (old_secure_tcp >=2 ) +if (ipvs->old_secure_tcp >=2 ) to_change =0 ; ipvs->sysctl_secure_tcp =1 ; }break ;case 3 : -if (old_secure_tcp <2 ) +if (ipvs->old_secure_tcp <2 ) to_change =1 ;break ; } - old_secure_tcp = ipvs->sysctl_secure_tcp; + ipvs->old_secure_tcp = ipvs->sysctl_secure_tcp;if (to_change >=0 )ip_vs_protocol_timeout_change (ipvs, ipvs->sysctl_secure_tcp >1 );
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 5/5 netfilter: nft_payload: fix missing check for matching length in offloads
In reply to Pablo Neira AyusoFrom: wenxu <[email protected]>
Payload offload rule should also check the length of the match. Moreover, check for unsupported link-layer fields:
nft --debug=netlink add rule firewall zones vlan id 100
...
[ payload load 2b @ link header + 0 => reg 1 ]
this loads 2byte base on ll header and offset 0.
This also fixes unsupported raw payload match.
--- net/netfilter/nft_payload.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
net/netfilter/nft_payload.c +38 -0
@@ -161,13 +161,21 @@ static int nft_payload_offload_ll(struct nft_offload_ctx *ctx,switch (priv->offset) {case offsetof(struct ethhdr , h_source): +if (priv->len !=ETH_ALEN ) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_ETH_ADDRS , eth_addrs, src,ETH_ALEN , reg);break ;case offsetof(struct ethhdr , h_dest): +if (priv->len !=ETH_ALEN ) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_ETH_ADDRS , eth_addrs, dst,ETH_ALEN , reg);break ; +default : +return -EOPNOTSUPP ; }return 0 ;
@@ -181,14 +189,23 @@ static int nft_payload_offload_ip(struct nft_offload_ctx *ctx,switch (priv->offset) {case offsetof(struct iphdr , saddr): +if (priv->len !=sizeof (struct in_addr )) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_IPV4_ADDRS , ipv4, src,sizeof (struct in_addr ), reg);break ;case offsetof(struct iphdr , daddr): +if (priv->len !=sizeof (struct in_addr )) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_IPV4_ADDRS , ipv4, dst,sizeof (struct in_addr ), reg);break ;case offsetof(struct iphdr , protocol): +if (priv->len !=sizeof (__u8)) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_BASIC , basic, ip_proto,sizeof (__u8), reg);nft_offload_set_dependency (ctx,NFT_OFFLOAD_DEP_TRANSPORT );
@@ -208,14 +225,23 @@ static int nft_payload_offload_ip6(struct nft_offload_ctx *ctx,switch (priv->offset) {case offsetof(struct ipv6hdr , saddr): +if (priv->len !=sizeof (struct in6_addr )) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_IPV6_ADDRS , ipv6, src,sizeof (struct in6_addr ), reg);break ;case offsetof(struct ipv6hdr , daddr): +if (priv->len !=sizeof (struct in6_addr )) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_IPV6_ADDRS , ipv6, dst,sizeof (struct in6_addr ), reg);break ;case offsetof(struct ipv6hdr , nexthdr): +if (priv->len !=sizeof (__u8)) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_BASIC , basic, ip_proto,sizeof (__u8), reg);nft_offload_set_dependency (ctx,NFT_OFFLOAD_DEP_TRANSPORT );
@@ -255,10 +281,16 @@ static int nft_payload_offload_tcp(struct nft_offload_ctx *ctx,switch (priv->offset) {case offsetof(struct tcphdr , source): +if (priv->len !=sizeof (__be16)) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_PORTS , tp, src,sizeof (__be16), reg);break ;case offsetof(struct tcphdr , dest): +if (priv->len !=sizeof (__be16)) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_PORTS , tp, dst,sizeof (__be16), reg);break ;
@@ -277,10 +309,16 @@ static int nft_payload_offload_udp(struct nft_offload_ctx *ctx,switch (priv->offset) {case offsetof(struct udphdr , source): +if (priv->len !=sizeof (__be16)) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_PORTS , tp, src,sizeof (__be16), reg);break ;case offsetof(struct udphdr , dest): +if (priv->len !=sizeof (__be16)) +return -EOPNOTSUPP ; +NFT_OFFLOAD_MATCH (FLOW_DISSECTOR_KEY_PORTS , tp, dst,sizeof (__be16), reg);break ;
Signature · 1 line
2.11.0
David Miller
maintainerFrom: Pablo Neira Ayuso <[email protected]>
Date: Sun, 27 Oct 2019 13:02:16 +0100
Quoted 5 lines
The following patchset contains Netfilter/IPVS fixes for net:
1) Fix crash on flowtable due to race between garbage collection and insertion.
Quoted 8 lines
2) Restore callback unbinding in netfilter offloads.
3) Fix races on IPVS module removal, from Davide Caratti.
4) Make
old_secure_tcpper-netns to fix sysbot report, from Eric Dumazet.5) Validate matching length in netfilter offloads, from wenxu.
Pulled, thanks.