aboutsummaryrefslogtreecommitdiffstats
path: root/net/can/bcm.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /net/can/bcm.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'net/can/bcm.c')
-rw-r--r--net/can/bcm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c
index e8d58f33fe09..907dc871fac8 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -56,6 +56,7 @@
56#include <linux/can.h> 56#include <linux/can.h>
57#include <linux/can/core.h> 57#include <linux/can/core.h>
58#include <linux/can/bcm.h> 58#include <linux/can/bcm.h>
59#include <linux/slab.h>
59#include <net/sock.h> 60#include <net/sock.h>
60#include <net/net_namespace.h> 61#include <net/net_namespace.h>
61 62
@@ -139,13 +140,13 @@ static char *bcm_proc_getifname(char *result, int ifindex)
139 if (!ifindex) 140 if (!ifindex)
140 return "any"; 141 return "any";
141 142
142 read_lock(&dev_base_lock); 143 rcu_read_lock();
143 dev = __dev_get_by_index(&init_net, ifindex); 144 dev = dev_get_by_index_rcu(&init_net, ifindex);
144 if (dev) 145 if (dev)
145 strcpy(result, dev->name); 146 strcpy(result, dev->name);
146 else 147 else
147 strcpy(result, "???"); 148 strcpy(result, "???");
148 read_unlock(&dev_base_lock); 149 rcu_read_unlock();
149 150
150 return result; 151 return result;
151} 152}
@@ -1478,6 +1479,9 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
1478 struct sock *sk = sock->sk; 1479 struct sock *sk = sock->sk;
1479 struct bcm_sock *bo = bcm_sk(sk); 1480 struct bcm_sock *bo = bcm_sk(sk);
1480 1481
1482 if (len < sizeof(*addr))
1483 return -EINVAL;
1484
1481 if (bo->bound) 1485 if (bo->bound)
1482 return -EISCONN; 1486 return -EISCONN;
1483 1487
@@ -1539,7 +1543,7 @@ static int bcm_recvmsg(struct kiocb *iocb, struct socket *sock,
1539 return err; 1543 return err;
1540 } 1544 }
1541 1545
1542 sock_recv_timestamp(msg, sk, skb); 1546 sock_recv_ts_and_drops(msg, sk, skb);
1543 1547
1544 if (msg->msg_name) { 1548 if (msg->msg_name) {
1545 msg->msg_namelen = sizeof(struct sockaddr_can); 1549 msg->msg_namelen = sizeof(struct sockaddr_can);
@@ -1581,7 +1585,6 @@ static struct proto bcm_proto __read_mostly = {
1581static struct can_proto bcm_can_proto __read_mostly = { 1585static struct can_proto bcm_can_proto __read_mostly = {
1582 .type = SOCK_DGRAM, 1586 .type = SOCK_DGRAM,
1583 .protocol = CAN_BCM, 1587 .protocol = CAN_BCM,
1584 .capability = -1,
1585 .ops = &bcm_ops, 1588 .ops = &bcm_ops,
1586 .prot = &bcm_proto, 1589 .prot = &bcm_proto,
1587}; 1590};