aboutsummaryrefslogtreecommitdiffstats
path: root/net/can/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/can/raw.c')
-rw-r--r--net/can/raw.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index aeefd1419d0..94cd7f27c44 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -98,7 +98,6 @@ static void raw_rcv(struct sk_buff *skb, void *data)
98 struct sock *sk = (struct sock *)data; 98 struct sock *sk = (struct sock *)data;
99 struct raw_sock *ro = raw_sk(sk); 99 struct raw_sock *ro = raw_sk(sk);
100 struct sockaddr_can *addr; 100 struct sockaddr_can *addr;
101 int error;
102 101
103 if (!ro->recv_own_msgs) { 102 if (!ro->recv_own_msgs) {
104 /* check the received tx sock reference */ 103 /* check the received tx sock reference */
@@ -121,14 +120,12 @@ static void raw_rcv(struct sk_buff *skb, void *data)
121 addr->can_family = AF_CAN; 120 addr->can_family = AF_CAN;
122 addr->can_ifindex = skb->dev->ifindex; 121 addr->can_ifindex = skb->dev->ifindex;
123 122
124 error = sock_queue_rcv_skb(sk, skb); 123 if (sock_queue_rcv_skb(sk, skb) < 0)
125 if (error < 0)
126 kfree_skb(skb); 124 kfree_skb(skb);
127} 125}
128 126
129static int raw_enable_filters(struct net_device *dev, struct sock *sk, 127static int raw_enable_filters(struct net_device *dev, struct sock *sk,
130 struct can_filter *filter, 128 struct can_filter *filter, int count)
131 int count)
132{ 129{
133 int err = 0; 130 int err = 0;
134 int i; 131 int i;
@@ -163,8 +160,7 @@ static int raw_enable_errfilter(struct net_device *dev, struct sock *sk,
163} 160}
164 161
165static void raw_disable_filters(struct net_device *dev, struct sock *sk, 162static void raw_disable_filters(struct net_device *dev, struct sock *sk,
166 struct can_filter *filter, 163 struct can_filter *filter, int count)
167 int count)
168{ 164{
169 int i; 165 int i;
170 166
@@ -353,7 +349,6 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
353 /* filters set by default/setsockopt */ 349 /* filters set by default/setsockopt */
354 err = raw_enable_allfilters(dev, sk); 350 err = raw_enable_allfilters(dev, sk);
355 dev_put(dev); 351 dev_put(dev);
356
357 } else { 352 } else {
358 ifindex = 0; 353 ifindex = 0;
359 354
@@ -466,7 +461,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
466 if (err) { 461 if (err) {
467 if (count > 1) 462 if (count > 1)
468 kfree(filter); 463 kfree(filter);
469
470 goto out_fil; 464 goto out_fil;
471 } 465 }
472 466
@@ -673,25 +667,25 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,
673{ 667{
674 struct sock *sk = sock->sk; 668 struct sock *sk = sock->sk;
675 struct sk_buff *skb; 669 struct sk_buff *skb;
676 int error = 0; 670 int err = 0;
677 int noblock; 671 int noblock;
678 672
679 noblock = flags & MSG_DONTWAIT; 673 noblock = flags & MSG_DONTWAIT;
680 flags &= ~MSG_DONTWAIT; 674 flags &= ~MSG_DONTWAIT;
681 675
682 skb = skb_recv_datagram(sk, flags, noblock, &error); 676 skb = skb_recv_datagram(sk, flags, noblock, &err);
683 if (!skb) 677 if (!skb)
684 return error; 678 return err;
685 679
686 if (size < skb->len) 680 if (size < skb->len)
687 msg->msg_flags |= MSG_TRUNC; 681 msg->msg_flags |= MSG_TRUNC;
688 else 682 else
689 size = skb->len; 683 size = skb->len;
690 684
691 error = memcpy_toiovec(msg->msg_iov, skb->data, size); 685 err = memcpy_toiovec(msg->msg_iov, skb->data, size);
692 if (error < 0) { 686 if (err < 0) {
693 skb_free_datagram(sk, skb); 687 skb_free_datagram(sk, skb);
694 return error; 688 return err;
695 } 689 }
696 690
697 sock_recv_timestamp(msg, sk, skb); 691 sock_recv_timestamp(msg, sk, skb);