netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: nf_conntrack_sip: fix wrong memory initialisation
@ 2017-03-01 14:33 Christophe Leroy
  2017-03-01 22:46 ` Gao Feng
  2017-03-03 12:27 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2017-03-01 14:33 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller, Gao Feng
  Cc: linux-kernel, netfilter-devel, coreteam, netdev, stable

In commit 82de0be6862cd ("netfilter: Add helper array
register/unregister functions"),
struct nf_conntrack_helper sip[MAX_PORTS][4] was changed to
sip[MAX_PORTS * 4], so the memory init should have been changed to
memset(&sip[4 * i], 0, 4 * sizeof(sip[i]));

But as the sip[] table is allocated in the BSS, it is already set to 0

Fixes: 82de0be6862cd ("netfilter: Add helper array
register/unregister functions")
Cc: stable@vger.kernel.org

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 net/netfilter/nf_conntrack_sip.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 24174c520239..0d17894798b5 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -1628,8 +1628,6 @@ static int __init nf_conntrack_sip_init(void)
 		ports[ports_c++] = SIP_PORT;
 
 	for (i = 0; i < ports_c; i++) {
-		memset(&sip[i], 0, sizeof(sip[i]));
-
 		nf_ct_helper_init(&sip[4 * i], AF_INET, IPPROTO_UDP, "sip",
 				  SIP_PORT, ports[i], i, sip_exp_policy,
 				  SIP_EXPECT_MAX,
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] netfilter: nf_conntrack_sip: fix wrong memory initialisation
  2017-03-01 14:33 [PATCH] netfilter: nf_conntrack_sip: fix wrong memory initialisation Christophe Leroy
@ 2017-03-01 22:46 ` Gao Feng
  2017-03-03 12:27 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Feng @ 2017-03-01 22:46 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
	linux-kernel, Netfilter Developer Mailing List, coreteam,
	Linux Kernel Network Developers, stable

On Wed, Mar 1, 2017 at 10:33 PM, Christophe Leroy
<christophe.leroy@c-s.fr> wrote:
> In commit 82de0be6862cd ("netfilter: Add helper array
> register/unregister functions"),
> struct nf_conntrack_helper sip[MAX_PORTS][4] was changed to
> sip[MAX_PORTS * 4], so the memory init should have been changed to
> memset(&sip[4 * i], 0, 4 * sizeof(sip[i]));

Yes, the memset initialization should be changed too.

Thanks
Feng

>
> But as the sip[] table is allocated in the BSS, it is already set to 0
>
> Fixes: 82de0be6862cd ("netfilter: Add helper array
> register/unregister functions")
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  net/netfilter/nf_conntrack_sip.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
> index 24174c520239..0d17894798b5 100644
> --- a/net/netfilter/nf_conntrack_sip.c
> +++ b/net/netfilter/nf_conntrack_sip.c
> @@ -1628,8 +1628,6 @@ static int __init nf_conntrack_sip_init(void)
>                 ports[ports_c++] = SIP_PORT;
>
>         for (i = 0; i < ports_c; i++) {
> -               memset(&sip[i], 0, sizeof(sip[i]));
> -
>                 nf_ct_helper_init(&sip[4 * i], AF_INET, IPPROTO_UDP, "sip",
>                                   SIP_PORT, ports[i], i, sip_exp_policy,
>                                   SIP_EXPECT_MAX,
> --
> 2.12.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] netfilter: nf_conntrack_sip: fix wrong memory initialisation
  2017-03-01 14:33 [PATCH] netfilter: nf_conntrack_sip: fix wrong memory initialisation Christophe Leroy
  2017-03-01 22:46 ` Gao Feng
@ 2017-03-03 12:27 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-03-03 12:27 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Jozsef Kadlecsik, David S. Miller, Gao Feng, linux-kernel,
	netfilter-devel, coreteam, netdev, stable

On Wed, Mar 01, 2017 at 03:33:26PM +0100, Christophe Leroy wrote:
> In commit 82de0be6862cd ("netfilter: Add helper array
> register/unregister functions"),
> struct nf_conntrack_helper sip[MAX_PORTS][4] was changed to
> sip[MAX_PORTS * 4], so the memory init should have been changed to
> memset(&sip[4 * i], 0, 4 * sizeof(sip[i]));
> 
> But as the sip[] table is allocated in the BSS, it is already set to 0

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-03 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 14:33 [PATCH] netfilter: nf_conntrack_sip: fix wrong memory initialisation Christophe Leroy
2017-03-01 22:46 ` Gao Feng
2017-03-03 12:27 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).