mirror of
https://github.com/NVIDIA/open-gpu-kernel-modules.git
synced 2026-02-01 14:09:47 +00:00
530.41.03
This commit is contained in:
@@ -458,7 +458,7 @@ static int nvidia_mmap_numa(
|
||||
}
|
||||
|
||||
// Needed for the linux kernel for mapping compound pages
|
||||
vma->vm_flags |= VM_MIXEDMAP;
|
||||
nv_vm_flags_set(vma, VM_MIXEDMAP);
|
||||
|
||||
for (i = 0, addr = mmap_context->page_array[0]; i < pages;
|
||||
addr = mmap_context->page_array[++i], start += PAGE_SIZE)
|
||||
@@ -603,7 +603,7 @@ int nvidia_mmap_helper(
|
||||
}
|
||||
up(&nvl->mmap_lock);
|
||||
|
||||
vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND;
|
||||
nv_vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -670,15 +670,15 @@ int nvidia_mmap_helper(
|
||||
|
||||
NV_PRINT_AT(NV_DBG_MEMINFO, at);
|
||||
|
||||
vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
|
||||
vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP);
|
||||
nv_vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
|
||||
nv_vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
|
||||
}
|
||||
|
||||
if ((prot & NV_PROTECT_WRITEABLE) == 0)
|
||||
{
|
||||
vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot);
|
||||
vma->vm_flags &= ~VM_WRITE;
|
||||
vma->vm_flags &= ~VM_MAYWRITE;
|
||||
nv_vm_flags_clear(vma, VM_WRITE);
|
||||
nv_vm_flags_clear(vma, VM_MAYWRITE);
|
||||
}
|
||||
|
||||
vma->vm_ops = &nv_vm_ops;
|
||||
|
||||
@@ -165,7 +165,7 @@ NvBool nv_ats_supported = NVCPU_IS_PPC64LE
|
||||
/* nvos_ functions.. do not take a state device parameter */
|
||||
static int nvos_count_devices(void);
|
||||
|
||||
static nv_alloc_t *nvos_create_alloc(struct device *, int);
|
||||
static nv_alloc_t *nvos_create_alloc(struct device *, NvU64);
|
||||
static int nvos_free_alloc(nv_alloc_t *);
|
||||
|
||||
/***
|
||||
@@ -280,11 +280,11 @@ void nv_sev_init(
|
||||
static
|
||||
nv_alloc_t *nvos_create_alloc(
|
||||
struct device *dev,
|
||||
int num_pages
|
||||
NvU64 num_pages
|
||||
)
|
||||
{
|
||||
nv_alloc_t *at;
|
||||
unsigned int pt_size;
|
||||
NvU64 pt_size;
|
||||
unsigned int i;
|
||||
|
||||
NV_KZALLOC(at, sizeof(nv_alloc_t));
|
||||
@@ -296,6 +296,23 @@ nv_alloc_t *nvos_create_alloc(
|
||||
|
||||
at->dev = dev;
|
||||
pt_size = num_pages * sizeof(nvidia_pte_t *);
|
||||
//
|
||||
// Check for multiplication overflow and check whether num_pages value can fit in at->num_pages.
|
||||
//
|
||||
if ((num_pages != 0) && ((pt_size / num_pages) != sizeof(nvidia_pte_t*)))
|
||||
{
|
||||
nv_printf(NV_DBG_ERRORS, "NVRM: Invalid page table allocation - Number of pages exceeds max value.\n");
|
||||
NV_KFREE(at, sizeof(nv_alloc_t));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
at->num_pages = num_pages;
|
||||
if (at->num_pages != num_pages)
|
||||
{
|
||||
nv_printf(NV_DBG_ERRORS, "NVRM: Invalid page table allocation - requested size overflows.\n");
|
||||
NV_KFREE(at, sizeof(nv_alloc_t));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (os_alloc_mem((void **)&at->page_table, pt_size) != NV_OK)
|
||||
{
|
||||
@@ -305,7 +322,6 @@ nv_alloc_t *nvos_create_alloc(
|
||||
}
|
||||
|
||||
memset(at->page_table, 0, pt_size);
|
||||
at->num_pages = num_pages;
|
||||
NV_ATOMIC_SET(at->usage_count, 0);
|
||||
|
||||
for (i = 0; i < at->num_pages; i++)
|
||||
|
||||
@@ -236,6 +236,7 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += remove_memory_has_nid_arg
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += add_memory_driver_managed_has_mhp_flags_arg
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += num_registered_fb
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += pci_driver_has_driver_managed_dma
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
|
||||
|
||||
NV_CONFTEST_GENERIC_COMPILE_TESTS += dom0_kernel_present
|
||||
NV_CONFTEST_GENERIC_COMPILE_TESTS += nvidia_vgpu_kvm_build
|
||||
|
||||
Reference in New Issue
Block a user