diff options
Diffstat (limited to 'net/ax25/af_ax25.c')
-rw-r--r-- | net/ax25/af_ax25.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 707097deac3d..a5c94f11547c 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -875,12 +875,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
875 | sk->sk_sndbuf = osk->sk_sndbuf; | 875 | sk->sk_sndbuf = osk->sk_sndbuf; |
876 | sk->sk_state = TCP_ESTABLISHED; | 876 | sk->sk_state = TCP_ESTABLISHED; |
877 | sk->sk_sleep = osk->sk_sleep; | 877 | sk->sk_sleep = osk->sk_sleep; |
878 | 878 | sock_copy_flags(sk, osk); | |
879 | if (sock_flag(osk, SOCK_DBG)) | ||
880 | sock_set_flag(sk, SOCK_DBG); | ||
881 | |||
882 | if (sock_flag(osk, SOCK_ZAPPED)) | ||
883 | sock_set_flag(sk, SOCK_ZAPPED); | ||
884 | 879 | ||
885 | oax25 = ax25_sk(osk); | 880 | oax25 = ax25_sk(osk); |
886 | 881 | ||
@@ -1007,7 +1002,8 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1007 | struct sock *sk = sock->sk; | 1002 | struct sock *sk = sock->sk; |
1008 | struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr; | 1003 | struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr; |
1009 | ax25_dev *ax25_dev = NULL; | 1004 | ax25_dev *ax25_dev = NULL; |
1010 | ax25_address *call; | 1005 | ax25_uid_assoc *user; |
1006 | ax25_address call; | ||
1011 | ax25_cb *ax25; | 1007 | ax25_cb *ax25; |
1012 | int err = 0; | 1008 | int err = 0; |
1013 | 1009 | ||
@@ -1026,9 +1022,15 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1026 | if (addr->fsa_ax25.sax25_family != AF_AX25) | 1022 | if (addr->fsa_ax25.sax25_family != AF_AX25) |
1027 | return -EINVAL; | 1023 | return -EINVAL; |
1028 | 1024 | ||
1029 | call = ax25_findbyuid(current->euid); | 1025 | user = ax25_findbyuid(current->euid); |
1030 | if (call == NULL && ax25_uid_policy && !capable(CAP_NET_ADMIN)) { | 1026 | if (user) { |
1031 | return -EACCES; | 1027 | call = user->call; |
1028 | ax25_uid_put(user); | ||
1029 | } else { | ||
1030 | if (ax25_uid_policy && !capable(CAP_NET_ADMIN)) | ||
1031 | return -EACCES; | ||
1032 | |||
1033 | call = addr->fsa_ax25.sax25_call; | ||
1032 | } | 1034 | } |
1033 | 1035 | ||
1034 | lock_sock(sk); | 1036 | lock_sock(sk); |
@@ -1039,10 +1041,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1039 | goto out; | 1041 | goto out; |
1040 | } | 1042 | } |
1041 | 1043 | ||
1042 | if (call == NULL) | 1044 | ax25->source_addr = call; |
1043 | ax25->source_addr = addr->fsa_ax25.sax25_call; | ||
1044 | else | ||
1045 | ax25->source_addr = *call; | ||
1046 | 1045 | ||
1047 | /* | 1046 | /* |
1048 | * User already set interface with SO_BINDTODEVICE | 1047 | * User already set interface with SO_BINDTODEVICE |