drivers: can: socket: Use proper filter when setsockopt is called

Check that the received filter is can_filter type when setsockopt()
is called.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2019-03-08 17:44:07 +02:00 committed by Kumar Gala
commit fc36d56aca
2 changed files with 22 additions and 6 deletions

View file

@ -85,10 +85,7 @@ static inline int socket_can_setsockopt(struct device *dev, void *obj,
return -1;
}
if (optlen != sizeof(struct can_filter)) {
errno = EINVAL;
return -1;
}
__ASSERT_NO_MSG(optlen == sizeof(struct zcan_filter));
ret = can_attach_msgq(socket_context->can_dev, socket_context->msgq,
optval);