Merge tag 'staging-3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux-2.6.git] / net / can / raw.c
blob641e1c895123ac114330635c43d0b2ed778c2ae7
1 /*
2 * raw.c - Raw sockets for protocol family CAN
4 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of Volkswagen nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * Alternatively, provided that this notice is retained in full, this
20 * software may be distributed under the terms of the GNU General
21 * Public License ("GPL") version 2, in which case the provisions of the
22 * GPL apply INSTEAD OF those given above.
24 * The provided data structures and external interfaces from this code
25 * are not restricted to be used by modules with a GPL compatible license.
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
38 * DAMAGE.
42 #include <linux/module.h>
43 #include <linux/init.h>
44 #include <linux/uio.h>
45 #include <linux/net.h>
46 #include <linux/slab.h>
47 #include <linux/netdevice.h>
48 #include <linux/socket.h>
49 #include <linux/if_arp.h>
50 #include <linux/skbuff.h>
51 #include <linux/can.h>
52 #include <linux/can/core.h>
53 #include <linux/can/skb.h>
54 #include <linux/can/raw.h>
55 #include <net/sock.h>
56 #include <net/net_namespace.h>
58 #define CAN_RAW_VERSION CAN_VERSION
59 static __initconst const char banner[] =
60 KERN_INFO "can: raw protocol (rev " CAN_RAW_VERSION ")\n";
62 MODULE_DESCRIPTION("PF_CAN raw protocol");
63 MODULE_LICENSE("Dual BSD/GPL");
64 MODULE_AUTHOR("Urs Thuermann <urs.thuermann@volkswagen.de>");
65 MODULE_ALIAS("can-proto-1");
67 #define MASK_ALL 0
70 * A raw socket has a list of can_filters attached to it, each receiving
71 * the CAN frames matching that filter. If the filter list is empty,
72 * no CAN frames will be received by the socket. The default after
73 * opening the socket, is to have one filter which receives all frames.
74 * The filter list is allocated dynamically with the exception of the
75 * list containing only one item. This common case is optimized by
76 * storing the single filter in dfilter, to avoid using dynamic memory.
79 struct raw_sock {
80 struct sock sk;
81 int bound;
82 int ifindex;
83 struct notifier_block notifier;
84 int loopback;
85 int recv_own_msgs;
86 int fd_frames;
87 int count; /* number of active filters */
88 struct can_filter dfilter; /* default/single filter */
89 struct can_filter *filter; /* pointer to filter(s) */
90 can_err_mask_t err_mask;
94 * Return pointer to store the extra msg flags for raw_recvmsg().
95 * We use the space of one unsigned int beyond the 'struct sockaddr_can'
96 * in skb->cb.
98 static inline unsigned int *raw_flags(struct sk_buff *skb)
100 BUILD_BUG_ON(sizeof(skb->cb) <= (sizeof(struct sockaddr_can) +
101 sizeof(unsigned int)));
103 /* return pointer after struct sockaddr_can */
104 return (unsigned int *)(&((struct sockaddr_can *)skb->cb)[1]);
107 static inline struct raw_sock *raw_sk(const struct sock *sk)
109 return (struct raw_sock *)sk;
112 static void raw_rcv(struct sk_buff *oskb, void *data)
114 struct sock *sk = (struct sock *)data;
115 struct raw_sock *ro = raw_sk(sk);
116 struct sockaddr_can *addr;
117 struct sk_buff *skb;
118 unsigned int *pflags;
120 /* check the received tx sock reference */
121 if (!ro->recv_own_msgs && oskb->sk == sk)
122 return;
124 /* do not pass frames with DLC > 8 to a legacy socket */
125 if (!ro->fd_frames) {
126 struct canfd_frame *cfd = (struct canfd_frame *)oskb->data;
128 if (unlikely(cfd->len > CAN_MAX_DLEN))
129 return;
132 /* clone the given skb to be able to enqueue it into the rcv queue */
133 skb = skb_clone(oskb, GFP_ATOMIC);
134 if (!skb)
135 return;
138 * Put the datagram to the queue so that raw_recvmsg() can
139 * get it from there. We need to pass the interface index to
140 * raw_recvmsg(). We pass a whole struct sockaddr_can in skb->cb
141 * containing the interface index.
144 BUILD_BUG_ON(sizeof(skb->cb) < sizeof(struct sockaddr_can));
145 addr = (struct sockaddr_can *)skb->cb;
146 memset(addr, 0, sizeof(*addr));
147 addr->can_family = AF_CAN;
148 addr->can_ifindex = skb->dev->ifindex;
150 /* add CAN specific message flags for raw_recvmsg() */
151 pflags = raw_flags(skb);
152 *pflags = 0;
153 if (oskb->sk)
154 *pflags |= MSG_DONTROUTE;
155 if (oskb->sk == sk)
156 *pflags |= MSG_CONFIRM;
158 if (sock_queue_rcv_skb(sk, skb) < 0)
159 kfree_skb(skb);
162 static int raw_enable_filters(struct net_device *dev, struct sock *sk,
163 struct can_filter *filter, int count)
165 int err = 0;
166 int i;
168 for (i = 0; i < count; i++) {
169 err = can_rx_register(dev, filter[i].can_id,
170 filter[i].can_mask,
171 raw_rcv, sk, "raw");
172 if (err) {
173 /* clean up successfully registered filters */
174 while (--i >= 0)
175 can_rx_unregister(dev, filter[i].can_id,
176 filter[i].can_mask,
177 raw_rcv, sk);
178 break;
182 return err;
185 static int raw_enable_errfilter(struct net_device *dev, struct sock *sk,
186 can_err_mask_t err_mask)
188 int err = 0;
190 if (err_mask)
191 err = can_rx_register(dev, 0, err_mask | CAN_ERR_FLAG,
192 raw_rcv, sk, "raw");
194 return err;
197 static void raw_disable_filters(struct net_device *dev, struct sock *sk,
198 struct can_filter *filter, int count)
200 int i;
202 for (i = 0; i < count; i++)
203 can_rx_unregister(dev, filter[i].can_id, filter[i].can_mask,
204 raw_rcv, sk);
207 static inline void raw_disable_errfilter(struct net_device *dev,
208 struct sock *sk,
209 can_err_mask_t err_mask)
212 if (err_mask)
213 can_rx_unregister(dev, 0, err_mask | CAN_ERR_FLAG,
214 raw_rcv, sk);
217 static inline void raw_disable_allfilters(struct net_device *dev,
218 struct sock *sk)
220 struct raw_sock *ro = raw_sk(sk);
222 raw_disable_filters(dev, sk, ro->filter, ro->count);
223 raw_disable_errfilter(dev, sk, ro->err_mask);
226 static int raw_enable_allfilters(struct net_device *dev, struct sock *sk)
228 struct raw_sock *ro = raw_sk(sk);
229 int err;
231 err = raw_enable_filters(dev, sk, ro->filter, ro->count);
232 if (!err) {
233 err = raw_enable_errfilter(dev, sk, ro->err_mask);
234 if (err)
235 raw_disable_filters(dev, sk, ro->filter, ro->count);
238 return err;
241 static int raw_notifier(struct notifier_block *nb,
242 unsigned long msg, void *ptr)
244 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
245 struct raw_sock *ro = container_of(nb, struct raw_sock, notifier);
246 struct sock *sk = &ro->sk;
248 if (!net_eq(dev_net(dev), &init_net))
249 return NOTIFY_DONE;
251 if (dev->type != ARPHRD_CAN)
252 return NOTIFY_DONE;
254 if (ro->ifindex != dev->ifindex)
255 return NOTIFY_DONE;
257 switch (msg) {
259 case NETDEV_UNREGISTER:
260 lock_sock(sk);
261 /* remove current filters & unregister */
262 if (ro->bound)
263 raw_disable_allfilters(dev, sk);
265 if (ro->count > 1)
266 kfree(ro->filter);
268 ro->ifindex = 0;
269 ro->bound = 0;
270 ro->count = 0;
271 release_sock(sk);
273 sk->sk_err = ENODEV;
274 if (!sock_flag(sk, SOCK_DEAD))
275 sk->sk_error_report(sk);
276 break;
278 case NETDEV_DOWN:
279 sk->sk_err = ENETDOWN;
280 if (!sock_flag(sk, SOCK_DEAD))
281 sk->sk_error_report(sk);
282 break;
285 return NOTIFY_DONE;
288 static int raw_init(struct sock *sk)
290 struct raw_sock *ro = raw_sk(sk);
292 ro->bound = 0;
293 ro->ifindex = 0;
295 /* set default filter to single entry dfilter */
296 ro->dfilter.can_id = 0;
297 ro->dfilter.can_mask = MASK_ALL;
298 ro->filter = &ro->dfilter;
299 ro->count = 1;
301 /* set default loopback behaviour */
302 ro->loopback = 1;
303 ro->recv_own_msgs = 0;
304 ro->fd_frames = 0;
306 /* set notifier */
307 ro->notifier.notifier_call = raw_notifier;
309 register_netdevice_notifier(&ro->notifier);
311 return 0;
314 static int raw_release(struct socket *sock)
316 struct sock *sk = sock->sk;
317 struct raw_sock *ro;
319 if (!sk)
320 return 0;
322 ro = raw_sk(sk);
324 unregister_netdevice_notifier(&ro->notifier);
326 lock_sock(sk);
328 /* remove current filters & unregister */
329 if (ro->bound) {
330 if (ro->ifindex) {
331 struct net_device *dev;
333 dev = dev_get_by_index(&init_net, ro->ifindex);
334 if (dev) {
335 raw_disable_allfilters(dev, sk);
336 dev_put(dev);
338 } else
339 raw_disable_allfilters(NULL, sk);
342 if (ro->count > 1)
343 kfree(ro->filter);
345 ro->ifindex = 0;
346 ro->bound = 0;
347 ro->count = 0;
349 sock_orphan(sk);
350 sock->sk = NULL;
352 release_sock(sk);
353 sock_put(sk);
355 return 0;
358 static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
360 struct sockaddr_can *addr = (struct sockaddr_can *)uaddr;
361 struct sock *sk = sock->sk;
362 struct raw_sock *ro = raw_sk(sk);
363 int ifindex;
364 int err = 0;
365 int notify_enetdown = 0;
367 if (len < sizeof(*addr))
368 return -EINVAL;
370 lock_sock(sk);
372 if (ro->bound && addr->can_ifindex == ro->ifindex)
373 goto out;
375 if (addr->can_ifindex) {
376 struct net_device *dev;
378 dev = dev_get_by_index(&init_net, addr->can_ifindex);
379 if (!dev) {
380 err = -ENODEV;
381 goto out;
383 if (dev->type != ARPHRD_CAN) {
384 dev_put(dev);
385 err = -ENODEV;
386 goto out;
388 if (!(dev->flags & IFF_UP))
389 notify_enetdown = 1;
391 ifindex = dev->ifindex;
393 /* filters set by default/setsockopt */
394 err = raw_enable_allfilters(dev, sk);
395 dev_put(dev);
396 } else {
397 ifindex = 0;
399 /* filters set by default/setsockopt */
400 err = raw_enable_allfilters(NULL, sk);
403 if (!err) {
404 if (ro->bound) {
405 /* unregister old filters */
406 if (ro->ifindex) {
407 struct net_device *dev;
409 dev = dev_get_by_index(&init_net, ro->ifindex);
410 if (dev) {
411 raw_disable_allfilters(dev, sk);
412 dev_put(dev);
414 } else
415 raw_disable_allfilters(NULL, sk);
417 ro->ifindex = ifindex;
418 ro->bound = 1;
421 out:
422 release_sock(sk);
424 if (notify_enetdown) {
425 sk->sk_err = ENETDOWN;
426 if (!sock_flag(sk, SOCK_DEAD))
427 sk->sk_error_report(sk);
430 return err;
433 static int raw_getname(struct socket *sock, struct sockaddr *uaddr,
434 int *len, int peer)
436 struct sockaddr_can *addr = (struct sockaddr_can *)uaddr;
437 struct sock *sk = sock->sk;
438 struct raw_sock *ro = raw_sk(sk);
440 if (peer)
441 return -EOPNOTSUPP;
443 memset(addr, 0, sizeof(*addr));
444 addr->can_family = AF_CAN;
445 addr->can_ifindex = ro->ifindex;
447 *len = sizeof(*addr);
449 return 0;
452 static int raw_setsockopt(struct socket *sock, int level, int optname,
453 char __user *optval, unsigned int optlen)
455 struct sock *sk = sock->sk;
456 struct raw_sock *ro = raw_sk(sk);
457 struct can_filter *filter = NULL; /* dyn. alloc'ed filters */
458 struct can_filter sfilter; /* single filter */
459 struct net_device *dev = NULL;
460 can_err_mask_t err_mask = 0;
461 int count = 0;
462 int err = 0;
464 if (level != SOL_CAN_RAW)
465 return -EINVAL;
467 switch (optname) {
469 case CAN_RAW_FILTER:
470 if (optlen % sizeof(struct can_filter) != 0)
471 return -EINVAL;
473 count = optlen / sizeof(struct can_filter);
475 if (count > 1) {
476 /* filter does not fit into dfilter => alloc space */
477 filter = memdup_user(optval, optlen);
478 if (IS_ERR(filter))
479 return PTR_ERR(filter);
480 } else if (count == 1) {
481 if (copy_from_user(&sfilter, optval, sizeof(sfilter)))
482 return -EFAULT;
485 lock_sock(sk);
487 if (ro->bound && ro->ifindex)
488 dev = dev_get_by_index(&init_net, ro->ifindex);
490 if (ro->bound) {
491 /* (try to) register the new filters */
492 if (count == 1)
493 err = raw_enable_filters(dev, sk, &sfilter, 1);
494 else
495 err = raw_enable_filters(dev, sk, filter,
496 count);
497 if (err) {
498 if (count > 1)
499 kfree(filter);
500 goto out_fil;
503 /* remove old filter registrations */
504 raw_disable_filters(dev, sk, ro->filter, ro->count);
507 /* remove old filter space */
508 if (ro->count > 1)
509 kfree(ro->filter);
511 /* link new filters to the socket */
512 if (count == 1) {
513 /* copy filter data for single filter */
514 ro->dfilter = sfilter;
515 filter = &ro->dfilter;
517 ro->filter = filter;
518 ro->count = count;
520 out_fil:
521 if (dev)
522 dev_put(dev);
524 release_sock(sk);
526 break;
528 case CAN_RAW_ERR_FILTER:
529 if (optlen != sizeof(err_mask))
530 return -EINVAL;
532 if (copy_from_user(&err_mask, optval, optlen))
533 return -EFAULT;
535 err_mask &= CAN_ERR_MASK;
537 lock_sock(sk);
539 if (ro->bound && ro->ifindex)
540 dev = dev_get_by_index(&init_net, ro->ifindex);
542 /* remove current error mask */
543 if (ro->bound) {
544 /* (try to) register the new err_mask */
545 err = raw_enable_errfilter(dev, sk, err_mask);
547 if (err)
548 goto out_err;
550 /* remove old err_mask registration */
551 raw_disable_errfilter(dev, sk, ro->err_mask);
554 /* link new err_mask to the socket */
555 ro->err_mask = err_mask;
557 out_err:
558 if (dev)
559 dev_put(dev);
561 release_sock(sk);
563 break;
565 case CAN_RAW_LOOPBACK:
566 if (optlen != sizeof(ro->loopback))
567 return -EINVAL;
569 if (copy_from_user(&ro->loopback, optval, optlen))
570 return -EFAULT;
572 break;
574 case CAN_RAW_RECV_OWN_MSGS:
575 if (optlen != sizeof(ro->recv_own_msgs))
576 return -EINVAL;
578 if (copy_from_user(&ro->recv_own_msgs, optval, optlen))
579 return -EFAULT;
581 break;
583 case CAN_RAW_FD_FRAMES:
584 if (optlen != sizeof(ro->fd_frames))
585 return -EINVAL;
587 if (copy_from_user(&ro->fd_frames, optval, optlen))
588 return -EFAULT;
590 break;
592 default:
593 return -ENOPROTOOPT;
595 return err;
598 static int raw_getsockopt(struct socket *sock, int level, int optname,
599 char __user *optval, int __user *optlen)
601 struct sock *sk = sock->sk;
602 struct raw_sock *ro = raw_sk(sk);
603 int len;
604 void *val;
605 int err = 0;
607 if (level != SOL_CAN_RAW)
608 return -EINVAL;
609 if (get_user(len, optlen))
610 return -EFAULT;
611 if (len < 0)
612 return -EINVAL;
614 switch (optname) {
616 case CAN_RAW_FILTER:
617 lock_sock(sk);
618 if (ro->count > 0) {
619 int fsize = ro->count * sizeof(struct can_filter);
620 if (len > fsize)
621 len = fsize;
622 if (copy_to_user(optval, ro->filter, len))
623 err = -EFAULT;
624 } else
625 len = 0;
626 release_sock(sk);
628 if (!err)
629 err = put_user(len, optlen);
630 return err;
632 case CAN_RAW_ERR_FILTER:
633 if (len > sizeof(can_err_mask_t))
634 len = sizeof(can_err_mask_t);
635 val = &ro->err_mask;
636 break;
638 case CAN_RAW_LOOPBACK:
639 if (len > sizeof(int))
640 len = sizeof(int);
641 val = &ro->loopback;
642 break;
644 case CAN_RAW_RECV_OWN_MSGS:
645 if (len > sizeof(int))
646 len = sizeof(int);
647 val = &ro->recv_own_msgs;
648 break;
650 case CAN_RAW_FD_FRAMES:
651 if (len > sizeof(int))
652 len = sizeof(int);
653 val = &ro->fd_frames;
654 break;
656 default:
657 return -ENOPROTOOPT;
660 if (put_user(len, optlen))
661 return -EFAULT;
662 if (copy_to_user(optval, val, len))
663 return -EFAULT;
664 return 0;
667 static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
668 struct msghdr *msg, size_t size)
670 struct sock *sk = sock->sk;
671 struct raw_sock *ro = raw_sk(sk);
672 struct sk_buff *skb;
673 struct net_device *dev;
674 int ifindex;
675 int err;
677 if (msg->msg_name) {
678 struct sockaddr_can *addr =
679 (struct sockaddr_can *)msg->msg_name;
681 if (msg->msg_namelen < sizeof(*addr))
682 return -EINVAL;
684 if (addr->can_family != AF_CAN)
685 return -EINVAL;
687 ifindex = addr->can_ifindex;
688 } else
689 ifindex = ro->ifindex;
691 if (ro->fd_frames) {
692 if (unlikely(size != CANFD_MTU && size != CAN_MTU))
693 return -EINVAL;
694 } else {
695 if (unlikely(size != CAN_MTU))
696 return -EINVAL;
699 dev = dev_get_by_index(&init_net, ifindex);
700 if (!dev)
701 return -ENXIO;
703 skb = sock_alloc_send_skb(sk, size + sizeof(struct can_skb_priv),
704 msg->msg_flags & MSG_DONTWAIT, &err);
705 if (!skb)
706 goto put_dev;
708 can_skb_reserve(skb);
709 can_skb_prv(skb)->ifindex = dev->ifindex;
711 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
712 if (err < 0)
713 goto free_skb;
715 sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
717 skb->dev = dev;
718 skb->sk = sk;
720 err = can_send(skb, ro->loopback);
722 dev_put(dev);
724 if (err)
725 goto send_failed;
727 return size;
729 free_skb:
730 kfree_skb(skb);
731 put_dev:
732 dev_put(dev);
733 send_failed:
734 return err;
737 static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,
738 struct msghdr *msg, size_t size, int flags)
740 struct sock *sk = sock->sk;
741 struct raw_sock *ro = raw_sk(sk);
742 struct sk_buff *skb;
743 int rxmtu;
744 int err = 0;
745 int noblock;
747 noblock = flags & MSG_DONTWAIT;
748 flags &= ~MSG_DONTWAIT;
750 skb = skb_recv_datagram(sk, flags, noblock, &err);
751 if (!skb)
752 return err;
755 * when serving a legacy socket the DLC <= 8 is already checked inside
756 * raw_rcv(). Now check if we need to pass a canfd_frame to a legacy
757 * socket and cut the possible CANFD_MTU/CAN_MTU length to CAN_MTU
759 if (!ro->fd_frames)
760 rxmtu = CAN_MTU;
761 else
762 rxmtu = skb->len;
764 if (size < rxmtu)
765 msg->msg_flags |= MSG_TRUNC;
766 else
767 size = rxmtu;
769 err = memcpy_toiovec(msg->msg_iov, skb->data, size);
770 if (err < 0) {
771 skb_free_datagram(sk, skb);
772 return err;
775 sock_recv_ts_and_drops(msg, sk, skb);
777 if (msg->msg_name) {
778 msg->msg_namelen = sizeof(struct sockaddr_can);
779 memcpy(msg->msg_name, skb->cb, msg->msg_namelen);
782 /* assign the flags that have been recorded in raw_rcv() */
783 msg->msg_flags |= *(raw_flags(skb));
785 skb_free_datagram(sk, skb);
787 return size;
790 static const struct proto_ops raw_ops = {
791 .family = PF_CAN,
792 .release = raw_release,
793 .bind = raw_bind,
794 .connect = sock_no_connect,
795 .socketpair = sock_no_socketpair,
796 .accept = sock_no_accept,
797 .getname = raw_getname,
798 .poll = datagram_poll,
799 .ioctl = can_ioctl, /* use can_ioctl() from af_can.c */
800 .listen = sock_no_listen,
801 .shutdown = sock_no_shutdown,
802 .setsockopt = raw_setsockopt,
803 .getsockopt = raw_getsockopt,
804 .sendmsg = raw_sendmsg,
805 .recvmsg = raw_recvmsg,
806 .mmap = sock_no_mmap,
807 .sendpage = sock_no_sendpage,
810 static struct proto raw_proto __read_mostly = {
811 .name = "CAN_RAW",
812 .owner = THIS_MODULE,
813 .obj_size = sizeof(struct raw_sock),
814 .init = raw_init,
817 static const struct can_proto raw_can_proto = {
818 .type = SOCK_RAW,
819 .protocol = CAN_RAW,
820 .ops = &raw_ops,
821 .prot = &raw_proto,
824 static __init int raw_module_init(void)
826 int err;
828 printk(banner);
830 err = can_proto_register(&raw_can_proto);
831 if (err < 0)
832 printk(KERN_ERR "can: registration of raw protocol failed\n");
834 return err;
837 static __exit void raw_module_exit(void)
839 can_proto_unregister(&raw_can_proto);
842 module_init(raw_module_init);
843 module_exit(raw_module_exit);