]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
Check the type of CAN socket passed to ioctl handler
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 20 Dec 2012 14:07:42 +0000 (15:07 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 20 Dec 2012 14:20:16 +0000 (15:20 +0100)
net/can/canethgw.c

index e1e9bd2874c506c5c7e5d9a76d73c6da0c3f0cff..17753640814d0277c8baf4fd45eff675aed38270 100644 (file)
@@ -297,6 +297,12 @@ static long cegw_ioctl_start(struct file *file, unsigned long arg)
                return err;
        }
 
+       if (job->can_sock->ops->family != AF_CAN ||
+           job->can_sock->type != CAN_RAW) {
+               kfree(job);
+               return -EBADF;
+       }
+
        job->udp_dstcnt = dstcnt;
 
        err = cegw_thread_start(job);