[Devel] [PATCH RHEL COMMIT] ve/net: Fix possible fall through when cheking capability for ETHTOOL_SEEPROM

Konstantin Khorenko khorenko at virtuozzo.com
Tue Sep 28 15:51:20 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 3a5dbfdc99afc27737c8b1652bc90b7badc289c0
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Tue Sep 28 15:37:56 2021 +0300

    ve/net: Fix possible fall through when cheking capability for ETHTOOL_SEEPROM
    
    This does not change the logic and capable() supersedes ns_capable(),
    but the additional "break" makes the compiler happy.
    
    Fixes: 53c8b1085e51 ("ve/net: restrict ethtool to CT root userns and
    prohibit EEPROM change")
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/ethtool/ioctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 48cf8dcb8971..4b4e95950ba5 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -2643,6 +2643,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 	case ETHTOOL_SEEPROM:
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
+		break;
 	default:
 		if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
 			return -EPERM;


More information about the Devel mailing list