Skip to contentSkip to conversation

virt: vbox: Use current_uid() in vbg_misc_device_requestor()

PATCH In review Denis Efremov 2 participants 2 messages Aug 24, 2020 Virtual box guest device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virt: vbox: Use current_uid() in vbg_misc_device_requestor()

Modify vbg_misc_device_requestor() to use current_uid() wrapper.

---
 drivers/virt/vboxguest/vboxguest_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/vboxguest/vboxguest_linux.c +1 -1
index 32c2c52f7e84..6215a688edaf 100644
@@ -35,7 +35,7 @@ static u32 vbg_misc_device_requestor(struct inode *inode)
 			VMMDEV_REQUESTOR_CON_DONT_KNOW |
 			VMMDEV_REQUESTOR_TRUST_NOT_GIVEN;
 
-	if (from_kuid(current_user_ns(), current->cred->uid) == 0)
+	if (from_kuid(current_user_ns(), current_uid()) == 0)
 		requestor |= VMMDEV_REQUESTOR_USR_ROOT;
 	else
 		requestor |= VMMDEV_REQUESTOR_USR_USER;
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 3 lines · Denis Efremov

Modify vbg_misc_device_requestor() to use current_uid() wrapper.

Thank you, patch looks good to me:

Regards,

Hans

Quoted 18 lines
---
  drivers/virt/vboxguest/vboxguest_linux.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/vboxguest/vboxguest_linux.c +1 -1
index 32c2c52f7e84..6215a688edaf 100644
@@ -35,7 +35,7 @@ static u32 vbg_misc_device_requestor(struct inode *inode)
  			VMMDEV_REQUESTOR_CON_DONT_KNOW |
  			VMMDEV_REQUESTOR_TRUST_NOT_GIVEN;
 
-	if (from_kuid(current_user_ns(), current->cred->uid) == 0)
+	if (from_kuid(current_user_ns(), current_uid()) == 0)
  		requestor |= VMMDEV_REQUESTOR_USR_ROOT;
  	else
  		requestor |= VMMDEV_REQUESTOR_USR_USER;