Module: xenomai-3
Branch: wip/rtnet-fixes
Commit: 721cee3385731d7500a682242ed291880434c06a
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=721cee3385731d7500a682242ed291880434c06a

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Jan 18 10:37:01 2018 +0100

net/socket: enforce secondary mode for SIOCETHTOOL

Assume this feature was originally provided by the regular driver
converted to RTNet, which we may want to support thoroughly, including
when tapping into the common PHY layer is required.

To this end, we need to enter the ioctl handler from secondary mode
only, which is not supposed to be an issue since there is no point is
expecting ethertool requests to be part of the time-critical code
anyway.

---

 kernel/drivers/net/stack/socket.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/kernel/drivers/net/stack/socket.c 
b/kernel/drivers/net/stack/socket.c
index d7d36d5..46ea5c6 100644
--- a/kernel/drivers/net/stack/socket.c
+++ b/kernel/drivers/net/stack/socket.c
@@ -340,11 +340,13 @@ int rt_socket_if_ioctl(struct rtdm_fd *fd, int request, 
void __user *arg)
                break;
 
        case SIOCETHTOOL:
-           if (rtdev->do_ioctl != NULL)
-               ret = rtdev->do_ioctl(rtdev, request, arg);
-           else
-               ret = -EOPNOTSUPP;
-           break;
+               if (rtdev->do_ioctl != NULL) {
+                       if (rtdm_in_rt_context())
+                               return -ENOSYS;
+                       ret = rtdev->do_ioctl(rtdev, request, arg);
+               } else
+                       ret = -EOPNOTSUPP;
+               break;
 
        default:
            ret = -EOPNOTSUPP;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to