<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/net/netfilter/ipvs, branch v5.13.2</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service</title>
<updated>2021-05-27T11:06:48+00:00</updated>
<author>
<name>Julian Anastasov</name>
<email>ja@ssi.bg</email>
</author>
<published>2021-05-24T19:54:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=56e4ee82e850026d71223262c07df7d6af3bd872'/>
<id>56e4ee82e850026d71223262c07df7d6af3bd872</id>
<content type='text'>
syzbot reported memory leak [1] when adding service with
HASHED flag. We should ignore this flag both from sockopt
and netlink provided data, otherwise the service is not
hashed and not visible while releasing resources.

[1]
BUG: memory leak
unreferenced object 0xffff888115227800 (size 512):
  comm "syz-executor263", pid 8658, jiffies 4294951882 (age 12.560s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff83977188&gt;] kmalloc include/linux/slab.h:556 [inline]
    [&lt;ffffffff83977188&gt;] kzalloc include/linux/slab.h:686 [inline]
    [&lt;ffffffff83977188&gt;] ip_vs_add_service+0x598/0x7c0 net/netfilter/ipvs/ip_vs_ctl.c:1343
    [&lt;ffffffff8397d770&gt;] do_ip_vs_set_ctl+0x810/0xa40 net/netfilter/ipvs/ip_vs_ctl.c:2570
    [&lt;ffffffff838449a8&gt;] nf_setsockopt+0x68/0xa0 net/netfilter/nf_sockopt.c:101
    [&lt;ffffffff839ae4e9&gt;] ip_setsockopt+0x259/0x1ff0 net/ipv4/ip_sockglue.c:1435
    [&lt;ffffffff839fa03c&gt;] raw_setsockopt+0x18c/0x1b0 net/ipv4/raw.c:857
    [&lt;ffffffff83691f20&gt;] __sys_setsockopt+0x1b0/0x360 net/socket.c:2117
    [&lt;ffffffff836920f2&gt;] __do_sys_setsockopt net/socket.c:2128 [inline]
    [&lt;ffffffff836920f2&gt;] __se_sys_setsockopt net/socket.c:2125 [inline]
    [&lt;ffffffff836920f2&gt;] __x64_sys_setsockopt+0x22/0x30 net/socket.c:2125
    [&lt;ffffffff84350efa&gt;] do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
    [&lt;ffffffff84400068&gt;] entry_SYSCALL_64_after_hwframe+0x44/0xae

Reported-and-tested-by: syzbot+e562383183e4b1766930@syzkaller.appspotmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Reviewed-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
syzbot reported memory leak [1] when adding service with
HASHED flag. We should ignore this flag both from sockopt
and netlink provided data, otherwise the service is not
hashed and not visible while releasing resources.

[1]
BUG: memory leak
unreferenced object 0xffff888115227800 (size 512):
  comm "syz-executor263", pid 8658, jiffies 4294951882 (age 12.560s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff83977188&gt;] kmalloc include/linux/slab.h:556 [inline]
    [&lt;ffffffff83977188&gt;] kzalloc include/linux/slab.h:686 [inline]
    [&lt;ffffffff83977188&gt;] ip_vs_add_service+0x598/0x7c0 net/netfilter/ipvs/ip_vs_ctl.c:1343
    [&lt;ffffffff8397d770&gt;] do_ip_vs_set_ctl+0x810/0xa40 net/netfilter/ipvs/ip_vs_ctl.c:2570
    [&lt;ffffffff838449a8&gt;] nf_setsockopt+0x68/0xa0 net/netfilter/nf_sockopt.c:101
    [&lt;ffffffff839ae4e9&gt;] ip_setsockopt+0x259/0x1ff0 net/ipv4/ip_sockglue.c:1435
    [&lt;ffffffff839fa03c&gt;] raw_setsockopt+0x18c/0x1b0 net/ipv4/raw.c:857
    [&lt;ffffffff83691f20&gt;] __sys_setsockopt+0x1b0/0x360 net/socket.c:2117
    [&lt;ffffffff836920f2&gt;] __do_sys_setsockopt net/socket.c:2128 [inline]
    [&lt;ffffffff836920f2&gt;] __se_sys_setsockopt net/socket.c:2125 [inline]
    [&lt;ffffffff836920f2&gt;] __x64_sys_setsockopt+0x22/0x30 net/socket.c:2125
    [&lt;ffffffff84350efa&gt;] do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
    [&lt;ffffffff84400068&gt;] entry_SYSCALL_64_after_hwframe+0x44/0xae

Reported-and-tested-by: syzbot+e562383183e4b1766930@syzkaller.appspotmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Reviewed-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netfilter: ipvs: do not printk on netns creation</title>
<updated>2021-04-03T18:17:11+00:00</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2021-03-30T06:42:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=daf47a7c109a166c812b2d701d66aa8905c54ec1'/>
<id>daf47a7c109a166c812b2d701d66aa8905c54ec1</id>
<content type='text'>
This causes dmesg spew during normal operation, so remove this.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Reviewed-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This causes dmesg spew during normal operation, so remove this.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Reviewed-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netfilter: ipvs: A spello fix</title>
<updated>2021-03-29T00:31:13+00:00</updated>
<author>
<name>Bhaskar Chowdhury</name>
<email>unixbhaskar@gmail.com</email>
</author>
<published>2021-03-26T23:12:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f60d94f0d7b42dd1caed258ff23b93e038bde745'/>
<id>f60d94f0d7b42dd1caed258ff23b93e038bde745</id>
<content type='text'>
s/registerd/registered/

Signed-off-by: Bhaskar Chowdhury &lt;unixbhaskar@gmail.com&gt;
Reviewed-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
s/registerd/registered/

Signed-off-by: Bhaskar Chowdhury &lt;unixbhaskar@gmail.com&gt;
Reviewed-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next</title>
<updated>2021-02-06T23:34:23+00:00</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-02-06T23:34:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c273a20c304f299d4cf24ba0c9c9f54b7d580b77'/>
<id>c273a20c304f299d4cf24ba0c9c9f54b7d580b77</id>
<content type='text'>
Pablo Neira Ayuso says:

====================
Netfilter/IPVS updates for net-next

1) Remove indirection and use nf_ct_get() instead from nfnetlink_log
   and nfnetlink_queue, from Florian Westphal.

2) Add weighted random twos choice least-connection scheduling for IPVS,
   from Darby Payne.

3) Add a __hash placeholder in the flow tuple structure to identify
   the field to be included in the rhashtable key hash calculation.

4) Add a new nft_parse_register_load() and nft_parse_register_store()
   to consolidate register load and store in the core.

5) Statify nft_parse_register() since it has no more module clients.

6) Remove redundant assignment in nft_cmp, from Colin Ian King.

* git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next:
  netfilter: nftables: remove redundant assignment of variable err
  netfilter: nftables: statify nft_parse_register()
  netfilter: nftables: add nft_parse_register_store() and use it
  netfilter: nftables: add nft_parse_register_load() and use it
  netfilter: flowtable: add hash offset field to tuple
  ipvs: add weighted random twos choice algorithm
  netfilter: ctnetlink: remove get_ct indirection
====================

Link: https://lore.kernel.org/r/20210206015005.23037-1-pablo@netfilter.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pablo Neira Ayuso says:

====================
Netfilter/IPVS updates for net-next

1) Remove indirection and use nf_ct_get() instead from nfnetlink_log
   and nfnetlink_queue, from Florian Westphal.

2) Add weighted random twos choice least-connection scheduling for IPVS,
   from Darby Payne.

3) Add a __hash placeholder in the flow tuple structure to identify
   the field to be included in the rhashtable key hash calculation.

4) Add a new nft_parse_register_load() and nft_parse_register_store()
   to consolidate register load and store in the core.

5) Statify nft_parse_register() since it has no more module clients.

6) Remove redundant assignment in nft_cmp, from Colin Ian King.

* git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next:
  netfilter: nftables: remove redundant assignment of variable err
  netfilter: nftables: statify nft_parse_register()
  netfilter: nftables: add nft_parse_register_store() and use it
  netfilter: nftables: add nft_parse_register_load() and use it
  netfilter: flowtable: add hash offset field to tuple
  ipvs: add weighted random twos choice algorithm
  netfilter: ctnetlink: remove get_ct indirection
====================

Link: https://lore.kernel.org/r/20210206015005.23037-1-pablo@netfilter.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netfilter: move handlers to net/ip_vs.h</title>
<updated>2021-02-05T02:37:57+00:00</updated>
<author>
<name>Leon Romanovsky</name>
<email>leonro@nvidia.com</email>
</author>
<published>2021-02-03T13:51:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=edf597da02a01edb26bddf06890fb81eee3d82cf'/>
<id>edf597da02a01edb26bddf06890fb81eee3d82cf</id>
<content type='text'>
Fix the following compilation warnings:
net/netfilter/ipvs/ip_vs_proto_tcp.c:147:1: warning: no previous prototype for 'tcp_snat_handler' [-Wmissing-prototypes]
  147 | tcp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
      | ^~~~~~~~~~~~~~~~
net/netfilter/ipvs/ip_vs_proto_udp.c:136:1: warning: no previous prototype for 'udp_snat_handler' [-Wmissing-prototypes]
  136 | udp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
      | ^~~~~~~~~~~~~~~~

Signed-off-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix the following compilation warnings:
net/netfilter/ipvs/ip_vs_proto_tcp.c:147:1: warning: no previous prototype for 'tcp_snat_handler' [-Wmissing-prototypes]
  147 | tcp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
      | ^~~~~~~~~~~~~~~~
net/netfilter/ipvs/ip_vs_proto_udp.c:136:1: warning: no previous prototype for 'udp_snat_handler' [-Wmissing-prototypes]
  136 | udp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
      | ^~~~~~~~~~~~~~~~

Signed-off-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: remove redundant 'depends on NET'</title>
<updated>2021-01-28T01:04:12+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2021-01-25T23:20:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=864e898ba3f6a7974d35efb604a1345d50e45f91'/>
<id>864e898ba3f6a7974d35efb604a1345d50e45f91</id>
<content type='text'>
These Kconfig files are included from net/Kconfig, inside the
if NET ... endif.

Remove 'depends on NET', which we know it is already met.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Link: https://lore.kernel.org/r/20210125232026.106855-1-masahiroy@kernel.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These Kconfig files are included from net/Kconfig, inside the
if NET ... endif.

Remove 'depends on NET', which we know it is already met.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Link: https://lore.kernel.org/r/20210125232026.106855-1-masahiroy@kernel.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipvs: add weighted random twos choice algorithm</title>
<updated>2021-01-26T00:09:46+00:00</updated>
<author>
<name>Darby Payne</name>
<email>darby.payne@gmail.com</email>
</author>
<published>2021-01-06T19:02:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=012da53d1afb619556f1a63c9da76b15888b190f'/>
<id>012da53d1afb619556f1a63c9da76b15888b190f</id>
<content type='text'>
Adds the random twos choice load-balancing algorithm. The algorithm will
pick two random servers based on weights. Then select the server with
the least amount of connections normalized by weight. The algorithm
avoids the "herd behavior" problem. The algorithm comes from a paper
by Michael Mitzenmacher available here
http://www.eecs.harvard.edu/~michaelm/NEWWORK/postscripts/twosurvey.pdf

Signed-off-by: Darby Payne &lt;darby.payne@gmail.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Acked-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds the random twos choice load-balancing algorithm. The algorithm will
pick two random servers based on weights. Then select the server with
the least amount of connections normalized by weight. The algorithm
avoids the "herd behavior" problem. The algorithm comes from a paper
by Michael Mitzenmacher available here
http://www.eecs.harvard.edu/~michaelm/NEWWORK/postscripts/twosurvey.pdf

Signed-off-by: Darby Payne &lt;darby.payne@gmail.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Acked-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next</title>
<updated>2020-12-14T23:43:21+00:00</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2020-12-14T23:43:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7bca5021a4e653a323492cb500cfc387331481b9'/>
<id>7bca5021a4e653a323492cb500cfc387331481b9</id>
<content type='text'>
Pablo Neira Ayuso says:

====================
Netfilter/IPVS updates for net-next

1) Missing dependencies in NFT_BRIDGE_REJECT, from Randy Dunlap.

2) Use atomic_inc_return() instead of atomic_add_return() in IPVS,
   from Yejune Deng.

3) Simplify check for overquota in xt_nfacct, from Kaixu Xia.

4) Move nfnl_acct_list away from struct net, from Miao Wang.

5) Pass actual sk in reject actions, from Jan Engelhardt.

6) Add timeout and protoinfo to ctnetlink destroy events,
   from Florian Westphal.

7) Four patches to generalize set infrastructure to support
   for multiple expressions per set element.

* git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next:
  netfilter: nftables: netlink support for several set element expressions
  netfilter: nftables: generalize set extension to support for several expressions
  netfilter: nftables: move nft_expr before nft_set
  netfilter: nftables: generalize set expressions support
  netfilter: ctnetlink: add timeout and protoinfo to destroy events
  netfilter: use actual socket sk for REJECT action
  netfilter: nfnl_acct: remove data from struct net
  netfilter: Remove unnecessary conversion to bool
  ipvs: replace atomic_add_return()
  netfilter: nft_reject_bridge: fix build errors due to code movement
====================

Link: https://lore.kernel.org/r/20201212230513.3465-1-pablo@netfilter.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pablo Neira Ayuso says:

====================
Netfilter/IPVS updates for net-next

1) Missing dependencies in NFT_BRIDGE_REJECT, from Randy Dunlap.

2) Use atomic_inc_return() instead of atomic_add_return() in IPVS,
   from Yejune Deng.

3) Simplify check for overquota in xt_nfacct, from Kaixu Xia.

4) Move nfnl_acct_list away from struct net, from Miao Wang.

5) Pass actual sk in reject actions, from Jan Engelhardt.

6) Add timeout and protoinfo to ctnetlink destroy events,
   from Florian Westphal.

7) Four patches to generalize set infrastructure to support
   for multiple expressions per set element.

* git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next:
  netfilter: nftables: netlink support for several set element expressions
  netfilter: nftables: generalize set extension to support for several expressions
  netfilter: nftables: move nft_expr before nft_set
  netfilter: nftables: generalize set expressions support
  netfilter: ctnetlink: add timeout and protoinfo to destroy events
  netfilter: use actual socket sk for REJECT action
  netfilter: nfnl_acct: remove data from struct net
  netfilter: Remove unnecessary conversion to bool
  ipvs: replace atomic_add_return()
  netfilter: nft_reject_bridge: fix build errors due to code movement
====================

Link: https://lore.kernel.org/r/20201212230513.3465-1-pablo@netfilter.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipvs: fix possible memory leak in ip_vs_control_net_init</title>
<updated>2020-11-27T11:10:46+00:00</updated>
<author>
<name>Wang Hai</name>
<email>wanghai38@huawei.com</email>
</author>
<published>2020-11-24T08:07:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4bc3c8dc9f5f1eff0d3bfa59491383ac11308b6b'/>
<id>4bc3c8dc9f5f1eff0d3bfa59491383ac11308b6b</id>
<content type='text'>
kmemleak report a memory leak as follows:

BUG: memory leak
unreferenced object 0xffff8880759ea000 (size 256):
backtrace:
[&lt;00000000c0bf2deb&gt;] kmem_cache_zalloc include/linux/slab.h:656 [inline]
[&lt;00000000c0bf2deb&gt;] __proc_create+0x23d/0x7d0 fs/proc/generic.c:421
[&lt;000000009d718d02&gt;] proc_create_reg+0x8e/0x140 fs/proc/generic.c:535
[&lt;0000000097bbfc4f&gt;] proc_create_net_data+0x8c/0x1b0 fs/proc/proc_net.c:126
[&lt;00000000652480fc&gt;] ip_vs_control_net_init+0x308/0x13a0 net/netfilter/ipvs/ip_vs_ctl.c:4169
[&lt;000000004c927ebe&gt;] __ip_vs_init+0x211/0x400 net/netfilter/ipvs/ip_vs_core.c:2429
[&lt;00000000aa6b72d9&gt;] ops_init+0xa8/0x3c0 net/core/net_namespace.c:151
[&lt;00000000153fd114&gt;] setup_net+0x2de/0x7e0 net/core/net_namespace.c:341
[&lt;00000000be4e4f07&gt;] copy_net_ns+0x27d/0x530 net/core/net_namespace.c:482
[&lt;00000000f1c23ec9&gt;] create_new_namespaces+0x382/0xa30 kernel/nsproxy.c:110
[&lt;00000000098a5757&gt;] copy_namespaces+0x2e6/0x3b0 kernel/nsproxy.c:179
[&lt;0000000026ce39e9&gt;] copy_process+0x220a/0x5f00 kernel/fork.c:2072
[&lt;00000000b71f4efe&gt;] _do_fork+0xc7/0xda0 kernel/fork.c:2428
[&lt;000000002974ee96&gt;] __do_sys_clone3+0x18a/0x280 kernel/fork.c:2703
[&lt;0000000062ac0a4d&gt;] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
[&lt;0000000093f1ce2c&gt;] entry_SYSCALL_64_after_hwframe+0x44/0xa9

In the error path of ip_vs_control_net_init(), remove_proc_entry() needs
to be called to remove the added proc entry, otherwise a memory leak
will occur.

Also, add some '#ifdef CONFIG_PROC_FS' because proc_create_net* return NULL
when PROC is not used.

Fixes: b17fc9963f83 ("IPVS: netns, ip_vs_stats and its procfs")
Fixes: 61b1ab4583e2 ("IPVS: netns, add basic init per netns.")
Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Wang Hai &lt;wanghai38@huawei.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
kmemleak report a memory leak as follows:

BUG: memory leak
unreferenced object 0xffff8880759ea000 (size 256):
backtrace:
[&lt;00000000c0bf2deb&gt;] kmem_cache_zalloc include/linux/slab.h:656 [inline]
[&lt;00000000c0bf2deb&gt;] __proc_create+0x23d/0x7d0 fs/proc/generic.c:421
[&lt;000000009d718d02&gt;] proc_create_reg+0x8e/0x140 fs/proc/generic.c:535
[&lt;0000000097bbfc4f&gt;] proc_create_net_data+0x8c/0x1b0 fs/proc/proc_net.c:126
[&lt;00000000652480fc&gt;] ip_vs_control_net_init+0x308/0x13a0 net/netfilter/ipvs/ip_vs_ctl.c:4169
[&lt;000000004c927ebe&gt;] __ip_vs_init+0x211/0x400 net/netfilter/ipvs/ip_vs_core.c:2429
[&lt;00000000aa6b72d9&gt;] ops_init+0xa8/0x3c0 net/core/net_namespace.c:151
[&lt;00000000153fd114&gt;] setup_net+0x2de/0x7e0 net/core/net_namespace.c:341
[&lt;00000000be4e4f07&gt;] copy_net_ns+0x27d/0x530 net/core/net_namespace.c:482
[&lt;00000000f1c23ec9&gt;] create_new_namespaces+0x382/0xa30 kernel/nsproxy.c:110
[&lt;00000000098a5757&gt;] copy_namespaces+0x2e6/0x3b0 kernel/nsproxy.c:179
[&lt;0000000026ce39e9&gt;] copy_process+0x220a/0x5f00 kernel/fork.c:2072
[&lt;00000000b71f4efe&gt;] _do_fork+0xc7/0xda0 kernel/fork.c:2428
[&lt;000000002974ee96&gt;] __do_sys_clone3+0x18a/0x280 kernel/fork.c:2703
[&lt;0000000062ac0a4d&gt;] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
[&lt;0000000093f1ce2c&gt;] entry_SYSCALL_64_after_hwframe+0x44/0xa9

In the error path of ip_vs_control_net_init(), remove_proc_entry() needs
to be called to remove the added proc entry, otherwise a memory leak
will occur.

Also, add some '#ifdef CONFIG_PROC_FS' because proc_create_net* return NULL
when PROC is not used.

Fixes: b17fc9963f83 ("IPVS: netns, ip_vs_stats and its procfs")
Fixes: 61b1ab4583e2 ("IPVS: netns, add basic init per netns.")
Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Wang Hai &lt;wanghai38@huawei.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipvs: replace atomic_add_return()</title>
<updated>2020-11-22T12:45:52+00:00</updated>
<author>
<name>Yejune Deng</name>
<email>yejune.deng@gmail.com</email>
</author>
<published>2020-11-16T08:01:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=988187e8810364dc02f3ceb7cab497f4a2e9003f'/>
<id>988187e8810364dc02f3ceb7cab497f4a2e9003f</id>
<content type='text'>
atomic_inc_return() looks better

Signed-off-by: Yejune Deng &lt;yejune.deng@gmail.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
atomic_inc_return() looks better

Signed-off-by: Yejune Deng &lt;yejune.deng@gmail.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
