diff mbox

[v2] ipvs: uninitialized data with IP_VS_IPV6

Message ID 20141206134924.GA17278@mwanda
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter Dec. 6, 2014, 1:49 p.m. UTC
The app_tcp_pkt_out() function expects "*diff" to be set and ends up
using uninitialized data if CONFIG_IP_VS_IPV6 is turned on.

The same issue is there in app_tcp_pkt_in().  Thanks to Julian Anastasov
for noticing that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: fix app_tcp_pkt_in() as well.  This is an old bug.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Julian Anastasov Dec. 7, 2014, 6:39 p.m. UTC | #1
Hello,

On Sat, 6 Dec 2014, Dan Carpenter wrote:

> The app_tcp_pkt_out() function expects "*diff" to be set and ends up
> using uninitialized data if CONFIG_IP_VS_IPV6 is turned on.
> 
> The same issue is there in app_tcp_pkt_in().  Thanks to Julian Anastasov
> for noticing that.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: fix app_tcp_pkt_in() as well.  This is an old bug.

	Thanks! It will not break seqs for IPv6 control
connection, only that we do not support FTP yet :( I have
the doubt whether this should be classified as bugfix :)
I guess, it is a net-next material, right?

	Simon, please apply.

Acked-by: Julian Anastasov <ja@ssi.bg>

> diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
> index 1d5341f..5d3daae 100644
> --- a/net/netfilter/ipvs/ip_vs_ftp.c
> +++ b/net/netfilter/ipvs/ip_vs_ftp.c
> @@ -183,6 +183,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
>  	struct nf_conn *ct;
>  	struct net *net;
>  
> +	*diff = 0;
> +
>  #ifdef CONFIG_IP_VS_IPV6
>  	/* This application helper doesn't work with IPv6 yet,
>  	 * so turn this into a no-op for IPv6 packets
> @@ -191,8 +193,6 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
>  		return 1;
>  #endif
>  
> -	*diff = 0;
> -
>  	/* Only useful for established sessions */
>  	if (cp->state != IP_VS_TCP_S_ESTABLISHED)
>  		return 1;
> @@ -322,6 +322,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
>  	struct ip_vs_conn *n_cp;
>  	struct net *net;
>  
> +	/* no diff required for incoming packets */
> +	*diff = 0;
> +
>  #ifdef CONFIG_IP_VS_IPV6
>  	/* This application helper doesn't work with IPv6 yet,
>  	 * so turn this into a no-op for IPv6 packets
> @@ -330,9 +333,6 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
>  		return 1;
>  #endif
>  
> -	/* no diff required for incoming packets */
> -	*diff = 0;
> -
>  	/* Only useful for established sessions */
>  	if (cp->state != IP_VS_TCP_S_ESTABLISHED)
>  		return 1;

Regards

--
Julian Anastasov <ja@ssi.bg>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Dec. 9, 2014, 12:52 a.m. UTC | #2
On Sun, Dec 07, 2014 at 08:39:35PM +0200, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Sat, 6 Dec 2014, Dan Carpenter wrote:
> 
> > The app_tcp_pkt_out() function expects "*diff" to be set and ends up
> > using uninitialized data if CONFIG_IP_VS_IPV6 is turned on.
> > 
> > The same issue is there in app_tcp_pkt_in().  Thanks to Julian Anastasov
> > for noticing that.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: fix app_tcp_pkt_in() as well.  This is an old bug.
> 
> 	Thanks! It will not break seqs for IPv6 control
> connection, only that we do not support FTP yet :( I have
> the doubt whether this should be classified as bugfix :)
> I guess, it is a net-next material, right?

Agreed, I have queued it up in ipvs-next.
I'll send a pull request to Pablo if Dan doesn't object
to it going there.

> 	Simon, please apply.
> 
> Acked-by: Julian Anastasov <ja@ssi.bg>
> 
> > diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
> > index 1d5341f..5d3daae 100644
> > --- a/net/netfilter/ipvs/ip_vs_ftp.c
> > +++ b/net/netfilter/ipvs/ip_vs_ftp.c
> > @@ -183,6 +183,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
> >  	struct nf_conn *ct;
> >  	struct net *net;
> >  
> > +	*diff = 0;
> > +
> >  #ifdef CONFIG_IP_VS_IPV6
> >  	/* This application helper doesn't work with IPv6 yet,
> >  	 * so turn this into a no-op for IPv6 packets
> > @@ -191,8 +193,6 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
> >  		return 1;
> >  #endif
> >  
> > -	*diff = 0;
> > -
> >  	/* Only useful for established sessions */
> >  	if (cp->state != IP_VS_TCP_S_ESTABLISHED)
> >  		return 1;
> > @@ -322,6 +322,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
> >  	struct ip_vs_conn *n_cp;
> >  	struct net *net;
> >  
> > +	/* no diff required for incoming packets */
> > +	*diff = 0;
> > +
> >  #ifdef CONFIG_IP_VS_IPV6
> >  	/* This application helper doesn't work with IPv6 yet,
> >  	 * so turn this into a no-op for IPv6 packets
> > @@ -330,9 +333,6 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
> >  		return 1;
> >  #endif
> >  
> > -	/* no diff required for incoming packets */
> > -	*diff = 0;
> > -
> >  	/* Only useful for established sessions */
> >  	if (cp->state != IP_VS_TCP_S_ESTABLISHED)
> >  		return 1;
> 
> Regards
> 
> --
> Julian Anastasov <ja@ssi.bg>
> 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dan Carpenter Dec. 9, 2014, 6:49 a.m. UTC | #3
On Tue, Dec 09, 2014 at 09:52:15AM +0900, Simon Horman wrote:
> On Sun, Dec 07, 2014 at 08:39:35PM +0200, Julian Anastasov wrote:
> > 
> > 	Hello,
> > 
> > On Sat, 6 Dec 2014, Dan Carpenter wrote:
> > 
> > > The app_tcp_pkt_out() function expects "*diff" to be set and ends up
> > > using uninitialized data if CONFIG_IP_VS_IPV6 is turned on.
> > > 
> > > The same issue is there in app_tcp_pkt_in().  Thanks to Julian Anastasov
> > > for noticing that.
> > > 
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > ---
> > > v2: fix app_tcp_pkt_in() as well.  This is an old bug.
> > 
> > 	Thanks! It will not break seqs for IPv6 control
> > connection, only that we do not support FTP yet :( I have
> > the doubt whether this should be classified as bugfix :)
> > I guess, it is a net-next material, right?
> 
> Agreed, I have queued it up in ipvs-next.
> I'll send a pull request to Pablo if Dan doesn't object
> to it going there.

No objections from me.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Dec. 10, 2014, 8:47 a.m. UTC | #4
On Tue, Dec 09, 2014 at 09:49:47AM +0300, Dan Carpenter wrote:
> On Tue, Dec 09, 2014 at 09:52:15AM +0900, Simon Horman wrote:
> > On Sun, Dec 07, 2014 at 08:39:35PM +0200, Julian Anastasov wrote:
> > > 
> > > 	Hello,
> > > 
> > > On Sat, 6 Dec 2014, Dan Carpenter wrote:
> > > 
> > > > The app_tcp_pkt_out() function expects "*diff" to be set and ends up
> > > > using uninitialized data if CONFIG_IP_VS_IPV6 is turned on.
> > > > 
> > > > The same issue is there in app_tcp_pkt_in().  Thanks to Julian Anastasov
> > > > for noticing that.
> > > > 
> > > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > > ---
> > > > v2: fix app_tcp_pkt_in() as well.  This is an old bug.
> > > 
> > > 	Thanks! It will not break seqs for IPv6 control
> > > connection, only that we do not support FTP yet :( I have
> > > the doubt whether this should be classified as bugfix :)
> > > I guess, it is a net-next material, right?
> > 
> > Agreed, I have queued it up in ipvs-next.
> > I'll send a pull request to Pablo if Dan doesn't object
> > to it going there.
> 
> No objections from me.

Thanks, I have sent a pull-request.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 1d5341f..5d3daae 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -183,6 +183,8 @@  static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
 	struct nf_conn *ct;
 	struct net *net;
 
+	*diff = 0;
+
 #ifdef CONFIG_IP_VS_IPV6
 	/* This application helper doesn't work with IPv6 yet,
 	 * so turn this into a no-op for IPv6 packets
@@ -191,8 +193,6 @@  static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 #endif
 
-	*diff = 0;
-
 	/* Only useful for established sessions */
 	if (cp->state != IP_VS_TCP_S_ESTABLISHED)
 		return 1;
@@ -322,6 +322,9 @@  static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
 	struct ip_vs_conn *n_cp;
 	struct net *net;
 
+	/* no diff required for incoming packets */
+	*diff = 0;
+
 #ifdef CONFIG_IP_VS_IPV6
 	/* This application helper doesn't work with IPv6 yet,
 	 * so turn this into a no-op for IPv6 packets
@@ -330,9 +333,6 @@  static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 #endif
 
-	/* no diff required for incoming packets */
-	*diff = 0;
-
 	/* Only useful for established sessions */
 	if (cp->state != IP_VS_TCP_S_ESTABLISHED)
 		return 1;