can: fix ioctl function removal
Commit60649d4e0a
("can: remove obsolete empty ioctl() handler") replaced the almost empty can_ioctl() function with sock_no_ioctl() which always returns -EOPNOTSUPP. Even though we don't have any ioctl() functions on socket/network layer we need to return -ENOIOCTLCMD to be able to forward ioctl commands like SIOCGIFINDEX to the network driver layer. This patch fixes the wrong return codes in the CAN network layer protocols. Reported-by: kernel test robot <rong.a.chen@intel.com> Fixes:60649d4e0a
("can: remove obsolete empty ioctl() handler") Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
1cb9dfca39
Коммит
473d924d7d
|
@ -1680,6 +1680,13 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bcm_sock_no_ioctlcmd(struct socket *sock, unsigned int cmd,
|
||||||
|
unsigned long arg)
|
||||||
|
{
|
||||||
|
/* no ioctls for socket layer -> hand it down to NIC layer */
|
||||||
|
return -ENOIOCTLCMD;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct proto_ops bcm_ops = {
|
static const struct proto_ops bcm_ops = {
|
||||||
.family = PF_CAN,
|
.family = PF_CAN,
|
||||||
.release = bcm_release,
|
.release = bcm_release,
|
||||||
|
@ -1689,7 +1696,7 @@ static const struct proto_ops bcm_ops = {
|
||||||
.accept = sock_no_accept,
|
.accept = sock_no_accept,
|
||||||
.getname = sock_no_getname,
|
.getname = sock_no_getname,
|
||||||
.poll = datagram_poll,
|
.poll = datagram_poll,
|
||||||
.ioctl = sock_no_ioctl,
|
.ioctl = bcm_sock_no_ioctlcmd,
|
||||||
.gettstamp = sock_gettstamp,
|
.gettstamp = sock_gettstamp,
|
||||||
.listen = sock_no_listen,
|
.listen = sock_no_listen,
|
||||||
.shutdown = sock_no_shutdown,
|
.shutdown = sock_no_shutdown,
|
||||||
|
|
|
@ -837,6 +837,13 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int raw_sock_no_ioctlcmd(struct socket *sock, unsigned int cmd,
|
||||||
|
unsigned long arg)
|
||||||
|
{
|
||||||
|
/* no ioctls for socket layer -> hand it down to NIC layer */
|
||||||
|
return -ENOIOCTLCMD;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct proto_ops raw_ops = {
|
static const struct proto_ops raw_ops = {
|
||||||
.family = PF_CAN,
|
.family = PF_CAN,
|
||||||
.release = raw_release,
|
.release = raw_release,
|
||||||
|
@ -846,7 +853,7 @@ static const struct proto_ops raw_ops = {
|
||||||
.accept = sock_no_accept,
|
.accept = sock_no_accept,
|
||||||
.getname = raw_getname,
|
.getname = raw_getname,
|
||||||
.poll = datagram_poll,
|
.poll = datagram_poll,
|
||||||
.ioctl = sock_no_ioctl,
|
.ioctl = raw_sock_no_ioctlcmd,
|
||||||
.gettstamp = sock_gettstamp,
|
.gettstamp = sock_gettstamp,
|
||||||
.listen = sock_no_listen,
|
.listen = sock_no_listen,
|
||||||
.shutdown = sock_no_shutdown,
|
.shutdown = sock_no_shutdown,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче