[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio_pcs: fix out of bounds roles_str[] array access

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 15 15:01:58 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.50.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.50.9
------>
commit a62c232469cbd17da8ff1cf72b8c15d6074c0c06
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Fri Jun 15 15:01:58 2018 +0300

    fs/fuse kio_pcs: fix out of bounds roles_str[] array access
    
    The array roles_str[] can be accessed at index PCS_NODE_ROLES_, which is out of
    bounds. (Actually it's not very dangerous because index PCS_NODE_ROLES_ always
    points to the end of the array - NULL, but anyway it should be fixed).
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_rpc_prot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/kio/pcs/pcs_rpc_prot.h b/fs/fuse/kio/pcs/pcs_rpc_prot.h
index 594670e9ead6..e32e7912943e 100644
--- a/fs/fuse/kio/pcs/pcs_rpc_prot.h
+++ b/fs/fuse/kio/pcs/pcs_rpc_prot.h
@@ -80,7 +80,7 @@ static inline const char *pcs_role_to_str(u8 role)
 		"TEST", "CN", "CS", "MDS", "TOOL", "SVC"
 	};
 
-	if (role > PCS_NODE_ROLES_)
+	if (role >= PCS_NODE_ROLES_)
 		return "Unknown";
 	return roles_str[role];
 }


More information about the Devel mailing list