summaryrefslogtreecommitdiff
path: root/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_l2cap_sock.patch
blob: 572c4d9a7cc2eca4e89a75504a639003641a083f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -574,8 +574,13 @@ static int l2cap_sock_setsockopt_old(str
 	return err;
 }
 
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
 static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
 				 char __user *optval, unsigned int optlen)
+#else
+static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
+				 char __user *optval, int optlen)
+#endif
 {
 	struct sock *sk = sock->sk;
 	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
@@ -1227,8 +1232,12 @@ static struct sock *l2cap_sock_alloc(str
 	return sk;
 }
 
+#if defined(CPTCFG_BACKPORT_OPTION_BT_SOCK_CREATE_NEEDS_KERN)
 static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol,
 			     int kern)
+#else
+static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol)
+#endif
 {
 	struct sock *sk;
 
@@ -1240,7 +1249,11 @@ static int l2cap_sock_create(struct net
 	    sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
 		return -ESOCKTNOSUPPORT;
 
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32))
 	if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
+#else
+	if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW))
+#endif
 		return -EPERM;
 
 	sock->ops = &l2cap_sock_ops;