GIT: unionfs2-2.6.27.y: ax25: Fix possible oops in ax25_make_new

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:15:07 EDT 2010


commit d59e55cb2c8bc73f885de7242223849b3d051cd5
Author: Jarek Poplawski <jarkao2 at gmail.com>
Date:   Sun Sep 27 10:57:02 2009 +0000

    ax25: Fix possible oops in ax25_make_new
    
    commit 8c185ab6185bf5e67766edb000ce428269364c86 upstream.
    
    In ax25_make_new, if kmemdup of digipeat returns an error, there would
    be an oops in sk_free while calling sk_destruct, because sk_protinfo
    is NULL at the moment; move sk->sk_destruct initialization after this.
    
    BTW of reported-by: Bernard Pidoux F6BVP <f6bvp at free.fr>
    
    Signed-off-by: Jarek Poplawski <jarkao2 at gmail.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index cd9d526..2268a7e 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -894,7 +894,6 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
 
 	sock_init_data(NULL, sk);
 
-	sk->sk_destruct = ax25_free_sock;
 	sk->sk_type     = osk->sk_type;
 	sk->sk_priority = osk->sk_priority;
 	sk->sk_protocol = osk->sk_protocol;
@@ -932,6 +931,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
 	}
 
 	sk->sk_protinfo = ax25;
+	sk->sk_destruct = ax25_free_sock;
 	ax25->sk    = sk;
 
 	return sk;


More information about the unionfs-cvs mailing list