From: Michal Sojka Date: Thu, 20 Dec 2012 14:07:42 +0000 (+0100) Subject: Check the type of CAN socket passed to ioctl handler X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-eth-gw-linux.git/commitdiff_plain/44d845b5f1d3cc31d14657146319954eec69040d Check the type of CAN socket passed to ioctl handler --- diff --git a/net/can/canethgw.c b/net/can/canethgw.c index e1e9bd2874c5..17753640814d 100644 --- a/net/can/canethgw.c +++ b/net/can/canethgw.c @@ -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);