Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290985
b: refs/heads/master
c: cedc546
h: refs/heads/master
i:
  290983: 4c9a9bf
v: v3
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Feb 20, 2012
1 parent e8a9a81 commit 5b293f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f39cdb7a270da24532734dfdfd10c490be981c4
refs/heads/master: cedc5469778846ee18c653aaa6d70681961eed93
23 changes: 17 additions & 6 deletions trunk/net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,20 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char
{
struct hci_ufilter uf;
struct sock *sk = sock->sk;
int len, opt;
int len, opt, err = 0;

BT_DBG("sk %p, opt %d", sk, optname);

if (get_user(len, optlen))
return -EFAULT;

lock_sock(sk);

if (hci_pi(sk)->channel != HCI_CHANNEL_RAW) {
err = -EINVAL;
goto done;
}

switch (optname) {
case HCI_DATA_DIR:
if (hci_pi(sk)->cmsg_mask & HCI_CMSG_DIR)
Expand All @@ -690,7 +699,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char
opt = 0;

if (put_user(opt, optval))
return -EFAULT;
err = -EFAULT;
break;

case HCI_TIME_STAMP:
Expand All @@ -700,7 +709,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char
opt = 0;

if (put_user(opt, optval))
return -EFAULT;
err = -EFAULT;
break;

case HCI_FILTER:
Expand All @@ -715,15 +724,17 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char

len = min_t(unsigned int, len, sizeof(uf));
if (copy_to_user(optval, &uf, len))
return -EFAULT;
err = -EFAULT;
break;

default:
return -ENOPROTOOPT;
err = -ENOPROTOOPT;
break;
}

return 0;
done:
release_sock(sk);
return err;
}

static const struct proto_ops hci_sock_ops = {
Expand Down

0 comments on commit 5b293f5

Please sign in to comment.