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.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index 6e0663faaf9f..27aab63df467 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -641,17 +641,12 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
641 641
642 skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, 642 skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT,
643 &err); 643 &err);
644 if (!skb) { 644 if (!skb)
645 dev_put(dev); 645 goto put_dev;
646 return err;
647 }
648 646
649 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); 647 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
650 if (err < 0) { 648 if (err < 0)
651 kfree_skb(skb); 649 goto free_skb;
652 dev_put(dev);
653 return err;
654 }
655 skb->dev = dev; 650 skb->dev = dev;
656 skb->sk = sk; 651 skb->sk = sk;
657 652
@@ -660,9 +655,16 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
660 dev_put(dev); 655 dev_put(dev);
661 656
662 if (err) 657 if (err)
663 return err; 658 goto send_failed;
664 659
665 return size; 660 return size;
661
662free_skb:
663 kfree_skb(skb);
664put_dev:
665 dev_put(dev);
666send_failed:
667 return err;
666} 668}
667 669
668static int raw_recvmsg(struct kiocb *iocb, struct socket *sock, 670static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,