diff options
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r-- | net/bluetooth/l2cap.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 338295007c4b..bd0a4c1bced0 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -812,7 +812,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
812 | goto done; | 812 | goto done; |
813 | } | 813 | } |
814 | 814 | ||
815 | if (la.l2_psm && btohs(la.l2_psm) < 0x1001 && | 815 | if (la.l2_psm && __le16_to_cpu(la.l2_psm) < 0x1001 && |
816 | !capable(CAP_NET_BIND_SERVICE)) { | 816 | !capable(CAP_NET_BIND_SERVICE)) { |
817 | err = -EACCES; | 817 | err = -EACCES; |
818 | goto done; | 818 | goto done; |
@@ -829,7 +829,8 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
829 | l2cap_pi(sk)->sport = la.l2_psm; | 829 | l2cap_pi(sk)->sport = la.l2_psm; |
830 | sk->sk_state = BT_BOUND; | 830 | sk->sk_state = BT_BOUND; |
831 | 831 | ||
832 | if (btohs(la.l2_psm) == 0x0001 || btohs(la.l2_psm) == 0x0003) | 832 | if (__le16_to_cpu(la.l2_psm) == 0x0001 || |
833 | __le16_to_cpu(la.l2_psm) == 0x0003) | ||
833 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; | 834 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; |
834 | } | 835 | } |
835 | 836 | ||
@@ -1015,9 +1016,9 @@ static int l2cap_sock_listen(struct socket *sock, int backlog) | |||
1015 | write_lock_bh(&l2cap_sk_list.lock); | 1016 | write_lock_bh(&l2cap_sk_list.lock); |
1016 | 1017 | ||
1017 | for (psm = 0x1001; psm < 0x1100; psm += 2) | 1018 | for (psm = 0x1001; psm < 0x1100; psm += 2) |
1018 | if (!__l2cap_get_sock_by_addr(htobs(psm), src)) { | 1019 | if (!__l2cap_get_sock_by_addr(cpu_to_le16(psm), src)) { |
1019 | l2cap_pi(sk)->psm = htobs(psm); | 1020 | l2cap_pi(sk)->psm = cpu_to_le16(psm); |
1020 | l2cap_pi(sk)->sport = htobs(psm); | 1021 | l2cap_pi(sk)->sport = cpu_to_le16(psm); |
1021 | err = 0; | 1022 | err = 0; |
1022 | break; | 1023 | break; |
1023 | } | 1024 | } |
@@ -1106,11 +1107,11 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *l | |||
1106 | if (peer) { | 1107 | if (peer) { |
1107 | la->l2_psm = l2cap_pi(sk)->psm; | 1108 | la->l2_psm = l2cap_pi(sk)->psm; |
1108 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->dst); | 1109 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->dst); |
1109 | la->l2_cid = htobs(l2cap_pi(sk)->dcid); | 1110 | la->l2_cid = cpu_to_le16(l2cap_pi(sk)->dcid); |
1110 | } else { | 1111 | } else { |
1111 | la->l2_psm = l2cap_pi(sk)->sport; | 1112 | la->l2_psm = l2cap_pi(sk)->sport; |
1112 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->src); | 1113 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->src); |
1113 | la->l2_cid = htobs(l2cap_pi(sk)->scid); | 1114 | la->l2_cid = cpu_to_le16(l2cap_pi(sk)->scid); |
1114 | } | 1115 | } |
1115 | 1116 | ||
1116 | return 0; | 1117 | return 0; |
@@ -2720,8 +2721,8 @@ static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) | |||
2720 | 2721 | ||
2721 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", | 2722 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", |
2722 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), | 2723 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
2723 | sk->sk_state, btohs(pi->psm), pi->scid, pi->dcid, | 2724 | sk->sk_state, __le16_to_cpu(pi->psm), pi->scid, |
2724 | pi->imtu, pi->omtu, pi->sec_level); | 2725 | pi->dcid, pi->imtu, pi->omtu, pi->sec_level); |
2725 | } | 2726 | } |
2726 | 2727 | ||
2727 | read_unlock_bh(&l2cap_sk_list.lock); | 2728 | read_unlock_bh(&l2cap_sk_list.lock); |