Skip to content

Commit 59d1d2e

Browse files
jwrdegoedegregkh
authored andcommitted
virt: vbox: Fix guest capabilities mask check
Check the passed in capabilities against VMMDEV_GUEST_CAPABILITIES_MASK instead of against VMMDEV_EVENT_VALID_EVENT_MASK. This tightens the allowed mask from 0x7ff to 0x7. Fixes: 0ba002b ("virt: Add vboxguest driver for Virtual Box Guest integration") Cc: [email protected] Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f794db6 commit 59d1d2e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/virt/vboxguest/vboxguest_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev,
14441444
or_mask = caps->u.in.or_mask;
14451445
not_mask = caps->u.in.not_mask;
14461446

1447-
if ((or_mask | not_mask) & ~VMMDEV_EVENT_VALID_EVENT_MASK)
1447+
if ((or_mask | not_mask) & ~VMMDEV_GUEST_CAPABILITIES_MASK)
14481448
return -EINVAL;
14491449

14501450
ret = vbg_set_session_capabilities(gdev, session, or_mask, not_mask,

drivers/virt/vboxguest/vmmdev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ VMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8);
206206
* not.
207207
*/
208208
#define VMMDEV_GUEST_SUPPORTS_GRAPHICS BIT(2)
209+
/* The mask of valid capabilities, for sanity checking. */
210+
#define VMMDEV_GUEST_CAPABILITIES_MASK 0x00000007U
209211

210212
/** struct vmmdev_hypervisorinfo - Hypervisor info structure. */
211213
struct vmmdev_hypervisorinfo {

0 commit comments

Comments
 (0)