aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c10
-rw-r--r--net/can/bcm.c3
-rw-r--r--net/can/raw.c5
3 files changed, 5 insertions, 13 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 606832115674..833bd838edc6 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -114,7 +114,8 @@ static void can_sock_destruct(struct sock *sk)
114 skb_queue_purge(&sk->sk_receive_queue); 114 skb_queue_purge(&sk->sk_receive_queue);
115} 115}
116 116
117static int can_create(struct net *net, struct socket *sock, int protocol) 117static int can_create(struct net *net, struct socket *sock, int protocol,
118 int kern)
118{ 119{
119 struct sock *sk; 120 struct sock *sk;
120 struct can_proto *cp; 121 struct can_proto *cp;
@@ -160,11 +161,6 @@ static int can_create(struct net *net, struct socket *sock, int protocol)
160 goto errout; 161 goto errout;
161 } 162 }
162 163
163 if (cp->capability >= 0 && !capable(cp->capability)) {
164 err = -EPERM;
165 goto errout;
166 }
167
168 sock->ops = cp->ops; 164 sock->ops = cp->ops;
169 165
170 sk = sk_alloc(net, PF_CAN, GFP_KERNEL, cp->prot); 166 sk = sk_alloc(net, PF_CAN, GFP_KERNEL, cp->prot);
@@ -842,7 +838,7 @@ static struct packet_type can_packet __read_mostly = {
842 .func = can_rcv, 838 .func = can_rcv,
843}; 839};
844 840
845static struct net_proto_family can_family_ops __read_mostly = { 841static const struct net_proto_family can_family_ops = {
846 .family = PF_CAN, 842 .family = PF_CAN,
847 .create = can_create, 843 .create = can_create,
848 .owner = THIS_MODULE, 844 .owner = THIS_MODULE,
diff --git a/net/can/bcm.c b/net/can/bcm.c
index e8d58f33fe09..c302c2ec959c 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1539,7 +1539,7 @@ static int bcm_recvmsg(struct kiocb *iocb, struct socket *sock,
1539 return err; 1539 return err;
1540 } 1540 }
1541 1541
1542 sock_recv_timestamp(msg, sk, skb); 1542 sock_recv_ts_and_drops(msg, sk, skb);
1543 1543
1544 if (msg->msg_name) { 1544 if (msg->msg_name) {
1545 msg->msg_namelen = sizeof(struct sockaddr_can); 1545 msg->msg_namelen = sizeof(struct sockaddr_can);
@@ -1581,7 +1581,6 @@ static struct proto bcm_proto __read_mostly = {
1581static struct can_proto bcm_can_proto __read_mostly = { 1581static struct can_proto bcm_can_proto __read_mostly = {
1582 .type = SOCK_DGRAM, 1582 .type = SOCK_DGRAM,
1583 .protocol = CAN_BCM, 1583 .protocol = CAN_BCM,
1584 .capability = -1,
1585 .ops = &bcm_ops, 1584 .ops = &bcm_ops,
1586 .prot = &bcm_proto, 1585 .prot = &bcm_proto,
1587}; 1586};
diff --git a/net/can/raw.c b/net/can/raw.c
index b5e897922d32..abca920440b5 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -424,8 +424,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
424 424
425 if (level != SOL_CAN_RAW) 425 if (level != SOL_CAN_RAW)
426 return -EINVAL; 426 return -EINVAL;
427 if (optlen < 0)
428 return -EINVAL;
429 427
430 switch (optname) { 428 switch (optname) {
431 429
@@ -702,7 +700,7 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,
702 return err; 700 return err;
703 } 701 }
704 702
705 sock_recv_timestamp(msg, sk, skb); 703 sock_recv_ts_and_drops(msg, sk, skb);
706 704
707 if (msg->msg_name) { 705 if (msg->msg_name) {
708 msg->msg_namelen = sizeof(struct sockaddr_can); 706 msg->msg_namelen = sizeof(struct sockaddr_can);
@@ -744,7 +742,6 @@ static struct proto raw_proto __read_mostly = {
744static struct can_proto raw_can_proto __read_mostly = { 742static struct can_proto raw_can_proto __read_mostly = {
745 .type = SOCK_RAW, 743 .type = SOCK_RAW,
746 .protocol = CAN_RAW, 744 .protocol = CAN_RAW,
747 .capability = -1,
748 .ops = &raw_ops, 745 .ops = &raw_ops,
749 .prot = &raw_proto, 746 .prot = &raw_proto,
750}; 747};