diff options
Diffstat (limited to 'net/bluetooth/hidp/sock.c')
-rw-r--r-- | net/bluetooth/hidp/sock.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index 5d0f1ca0a314..2f4cbb0865ca 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -77,21 +77,12 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
77 | return err; | 77 | return err; |
78 | } | 78 | } |
79 | 79 | ||
80 | if (csock->sk->sk_state != BT_CONNECTED || | 80 | err = hidp_connection_add(&ca, csock, isock); |
81 | isock->sk->sk_state != BT_CONNECTED) { | 81 | if (!err && copy_to_user(argp, &ca, sizeof(ca))) |
82 | sockfd_put(csock); | 82 | err = -EFAULT; |
83 | sockfd_put(isock); | ||
84 | return -EBADFD; | ||
85 | } | ||
86 | 83 | ||
87 | err = hidp_add_connection(&ca, csock, isock); | 84 | sockfd_put(csock); |
88 | if (!err) { | 85 | sockfd_put(isock); |
89 | if (copy_to_user(argp, &ca, sizeof(ca))) | ||
90 | err = -EFAULT; | ||
91 | } else { | ||
92 | sockfd_put(csock); | ||
93 | sockfd_put(isock); | ||
94 | } | ||
95 | 86 | ||
96 | return err; | 87 | return err; |
97 | 88 | ||
@@ -102,7 +93,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
102 | if (copy_from_user(&cd, argp, sizeof(cd))) | 93 | if (copy_from_user(&cd, argp, sizeof(cd))) |
103 | return -EFAULT; | 94 | return -EFAULT; |
104 | 95 | ||
105 | return hidp_del_connection(&cd); | 96 | return hidp_connection_del(&cd); |
106 | 97 | ||
107 | case HIDPGETCONNLIST: | 98 | case HIDPGETCONNLIST: |
108 | if (copy_from_user(&cl, argp, sizeof(cl))) | 99 | if (copy_from_user(&cl, argp, sizeof(cl))) |
@@ -296,7 +287,6 @@ int __init hidp_init_sockets(void) | |||
296 | return 0; | 287 | return 0; |
297 | 288 | ||
298 | error: | 289 | error: |
299 | BT_ERR("Can't register HIDP socket"); | ||
300 | proto_unregister(&hidp_proto); | 290 | proto_unregister(&hidp_proto); |
301 | return err; | 291 | return err; |
302 | } | 292 | } |