All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipvs: fix possible use of uninitialized ipvs pointer
@ 2015-09-29 17:04 Marcelo Ricardo Leitner
  2015-09-29 19:04 ` Julian Anastasov
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-09-29 17:04 UTC (permalink / raw)
  To: lvs-devel; +Cc: agartrell

5e26b1b3abce[1] moved a derreference on ipvs on sysctl_sloppy_sctp(ipvs)
to before its initialization.

Fix now is to just move ipvs initialization a bit upper.

Fixes: 5e26b1b3abce ("ipvs: support scheduling inverse and icmp SCTP packets")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/netfilter/ipvs/ip_vs_proto_sctp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c
index 2026fca7e1c36f12db1351e7c14e9eba8ad8b8e1..ac628a9afdb521c243d79b2f415ee98a3f41d0c3 100644
--- a/net/netfilter/ipvs/ip_vs_proto_sctp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c
@@ -20,6 +20,9 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
 	sctp_sctphdr_t *sh, _sctph;
 	__be16 _ports[2], *ports = NULL;
 
+	net = skb_net(skb);
+	ipvs = net_ipvs(net);
+
 	if (likely(!ip_vs_iph_icmp(iph))) {
 		sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph);
 		if (sh) {
@@ -40,8 +43,6 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
 		return 0;
 	}
 
-	net = skb_net(skb);
-	ipvs = net_ipvs(net);
 	rcu_read_lock();
 	if (likely(!ip_vs_iph_inverse(iph)))
 		svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,
-- 
2.4.3


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

* Re: [PATCH] ipvs: fix possible use of uninitialized ipvs pointer
  2015-09-29 17:04 [PATCH] ipvs: fix possible use of uninitialized ipvs pointer Marcelo Ricardo Leitner
@ 2015-09-29 19:04 ` Julian Anastasov
  2015-09-29 19:11   ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Anastasov @ 2015-09-29 19:04 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner; +Cc: lvs-devel, agartrell


	Hello,

On Tue, 29 Sep 2015, Marcelo Ricardo Leitner wrote:

> 5e26b1b3abce[1] moved a derreference on ipvs on sysctl_sloppy_sctp(ipvs)
> to before its initialization.
> 
> Fix now is to just move ipvs initialization a bit upper.
> 
> Fixes: 5e26b1b3abce ("ipvs: support scheduling inverse and icmp SCTP packets")
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

	This is already fixed in ipvs-next tree as part of the
Eric W. Biederman's work:

"ipvs: Hoist computation of ipvs earlier in sctp_conn_schedule"

> ---
>  net/netfilter/ipvs/ip_vs_proto_sctp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c
> index 2026fca7e1c36f12db1351e7c14e9eba8ad8b8e1..ac628a9afdb521c243d79b2f415ee98a3f41d0c3 100644
> --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c
> +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c
> @@ -20,6 +20,9 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
>  	sctp_sctphdr_t *sh, _sctph;
>  	__be16 _ports[2], *ports = NULL;
>  
> +	net = skb_net(skb);
> +	ipvs = net_ipvs(net);
> +
>  	if (likely(!ip_vs_iph_icmp(iph))) {
>  		sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph);
>  		if (sh) {
> @@ -40,8 +43,6 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
>  		return 0;
>  	}
>  
> -	net = skb_net(skb);
> -	ipvs = net_ipvs(net);
>  	rcu_read_lock();
>  	if (likely(!ip_vs_iph_inverse(iph)))
>  		svc = ip_vs_service_find(net, af, skb->mark, iph->protocol,

Regards

--
Julian Anastasov <ja@ssi.bg>

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

* Re: [PATCH] ipvs: fix possible use of uninitialized ipvs pointer
  2015-09-29 19:04 ` Julian Anastasov
@ 2015-09-29 19:11   ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-09-29 19:11 UTC (permalink / raw)
  To: Julian Anastasov; +Cc: lvs-devel, agartrell

Em 29-09-2015 16:04, Julian Anastasov escreveu:
>
> 	Hello,
>
> On Tue, 29 Sep 2015, Marcelo Ricardo Leitner wrote:
>
>> 5e26b1b3abce[1] moved a derreference on ipvs on sysctl_sloppy_sctp(ipvs)
>> to before its initialization.
>>
>> Fix now is to just move ipvs initialization a bit upper.
>>
>> Fixes: 5e26b1b3abce ("ipvs: support scheduling inverse and icmp SCTP packets")
>> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>
> 	This is already fixed in ipvs-next tree as part of the
> Eric W. Biederman's work:
>
> "ipvs: Hoist computation of ipvs earlier in sctp_conn_schedule"

Oh, right. Sorry the noise then. Thanks.

   Marcelo


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

end of thread, other threads:[~2015-09-29 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-29 17:04 [PATCH] ipvs: fix possible use of uninitialized ipvs pointer Marcelo Ricardo Leitner
2015-09-29 19:04 ` Julian Anastasov
2015-09-29 19:11   ` Marcelo Ricardo Leitner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.