From: Jarek Poplawski Date: Sun, 27 Sep 2009 10:57:02 +0000 (+0000) Subject: ax25: Fix possible oops in ax25_make_new X-Git-Tag: v2.6.31.4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84b176798b6526e88cf34a47f554359f0be42f98;p=thirdparty%2Fkernel%2Fstable.git ax25: Fix possible oops in ax25_make_new [ Upstream commit 8c185ab6185bf5e67766edb000ce428269364c86 ] 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 Signed-off-by: Jarek Poplawski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index f03529cabcb02..b28d1a056aa3a 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -893,7 +893,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; @@ -931,6 +930,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;