summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2009-09-27 14:57:02 +0400
committerDavid S. Miller <davem@davemloft.net>2009-10-01 03:44:12 +0400
commit8c185ab6185bf5e67766edb000ce428269364c86 (patch)
treef866c6daea8affedbe04bba6948bd688e9500498
parent81bbb3d4048cf577b5babcb0834230de391a35c5 (diff)
downloadlinux-8c185ab6185bf5e67766edb000ce428269364c86.tar.xz
ax25: Fix possible oops in ax25_make_new
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@free.fr> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ax25/af_ax25.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index cd1c3dc0fe01..f45460730371 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -901,7 +901,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;
@@ -939,6 +938,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;