[Devel] [PATCH RHEL7 COMMIT] ve/fs: Use comparison of signed integers in ve_mount_allowed()
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jan 18 06:27:01 PST 2016
The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.23
------>
commit 9726a9f12237d6f0f4bcca07f70b8dd523643939
Author: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
Date: Mon Jan 18 18:27:01 2016 +0400
ve/fs: Use comparison of signed integers in ve_mount_allowed()
ve->mnr_nr is a signed integer which may become negative in some cases:
* if the increments and decrements of ve->mnr_nr race against each other
and the decrements win;
* if something is mounted by one VE but unmounted by another VE.
sysctl_ve_mount_nr is unsigned.
So the comparison (ve->mnr_nr < sysctl_ve_mount_nr) can actually be
compiled as ((unsigned int)ve->mnr_nr < sysctl_ve_mount_nr).
ve_mount_allowed() would return 0 in that case and the mount operation
would fail as a result.
This patch fixes the problem.
https://jira.sw.ru/browse/PSBM-42825
Signed-off-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
---
include/linux/ve.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/ve.h b/include/linux/ve.h
index b206526..be3cfd9 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -239,7 +239,7 @@ static inline int ve_mount_allowed(void)
{
struct ve_struct *ve = get_exec_env();
- return ve_is_super(ve) || ve->mnt_nr < sysctl_ve_mount_nr;
+ return ve_is_super(ve) || ve->mnt_nr < (int)sysctl_ve_mount_nr;
}
static inline void ve_mount_nr_inc(void)
More information about the Devel
mailing list