Skip to content

Commit d1b333d

Browse files
l1viathanawilliam
authored andcommitted
vfio iommu type1: fix the testing of capability for remote task
Before the mdev enhancement type1 iommu used capable() to test the capability of current task; in the course of mdev development a new requirement, testing for another task other than current, was raised. ns_capable() was used for this purpose, however it still tests current, the only difference is, in a specified namespace. Fix it by using has_capability() instead, which tests the cap for specified task in init_user_ns, the same namespace as capable(). Cc: Gerd Hoffmann <[email protected]> Signed-off-by: Jike Song <[email protected]> Reviewed-by: James Morris <[email protected]> Reviewed-by: Kirti Wankhede <[email protected]> Signed-off-by: Alex Williamson <[email protected]>
1 parent 19c816e commit d1b333d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/vfio/vfio_iommu_type1.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,7 @@ static int vfio_pin_page_external(struct vfio_dma *dma, unsigned long vaddr,
495495
unsigned long *pfn_base, bool do_accounting)
496496
{
497497
unsigned long limit;
498-
bool lock_cap = ns_capable(task_active_pid_ns(dma->task)->user_ns,
499-
CAP_IPC_LOCK);
498+
bool lock_cap = has_capability(dma->task, CAP_IPC_LOCK);
500499
struct mm_struct *mm;
501500
int ret;
502501
bool rsvd;

0 commit comments

Comments
 (0)