Skip to content

Commit

Permalink
virt: vbox: Fix guest capabilities mask check
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200709120858.63928-3-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Hans de Goede authored and Greg Kroah-Hartman committed Jul 10, 2020
1 parent f794db6 commit 59d1d2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/virt/vboxguest/vboxguest_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev,
or_mask = caps->u.in.or_mask;
not_mask = caps->u.in.not_mask;

if ((or_mask | not_mask) & ~VMMDEV_EVENT_VALID_EVENT_MASK)
if ((or_mask | not_mask) & ~VMMDEV_GUEST_CAPABILITIES_MASK)
return -EINVAL;

ret = vbg_set_session_capabilities(gdev, session, or_mask, not_mask,
Expand Down
2 changes: 2 additions & 0 deletions drivers/virt/vboxguest/vmmdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ VMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8);
* not.
*/
#define VMMDEV_GUEST_SUPPORTS_GRAPHICS BIT(2)
/* The mask of valid capabilities, for sanity checking. */
#define VMMDEV_GUEST_CAPABILITIES_MASK 0x00000007U

/** struct vmmdev_hypervisorinfo - Hypervisor info structure. */
struct vmmdev_hypervisorinfo {
Expand Down

0 comments on commit 59d1d2e

Please sign in to comment.