search for: u_memcpya

Displaying 16 results from an estimated 16 matches for "u_memcpya".

2019 Aug 21
2
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...el *chan, return ret; } - ret = validate_list(chan, cli, &op->list, pbbo, user_buffers); + ret = validate_list(chan, cli, &op->list, pbbo); if (unlikely(ret < 0)) { if (ret != -ERESTARTSYS) NV_PRINTK(err, cli, "validating bo list\n"); @@ -603,16 +596,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) static int nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf *req, + struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - struct drm_nouveau_gem_pushbuf_reloc *relo...
2019 Oct 21
1
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...el *chan, return ret; } - ret = validate_list(chan, cli, &op->list, pbbo, user_buffers); + ret = validate_list(chan, cli, &op->list, pbbo); if (unlikely(ret < 0)) { if (ret != -ERESTARTSYS) NV_PRINTK(err, cli, "validating bo list\n"); @@ -605,16 +598,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) static int nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf *req, + struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - struct drm_nouveau_gem_pushbuf_reloc *relo...
2019 Nov 04
2
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...el *chan, return ret; } - ret = validate_list(chan, cli, &op->list, pbbo, user_buffers); + ret = validate_list(chan, cli, &op->list, pbbo); if (unlikely(ret < 0)) { if (ret != -ERESTARTSYS) NV_PRINTK(err, cli, "validating bo list\n"); @@ -605,16 +598,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) static int nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf *req, + struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - struct drm_nouveau_gem_pushbuf_reloc *relo...
2013 Sep 02
2
[PATCH] drm/nouveau: fix command submission to use vmalloc for big allocations
...eau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -584,18 +584,34 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan, return 0; } +static inline void +u_free(void *addr) +{ + if (!is_vmalloc_addr(addr)) + kfree(addr); + else + vfree(addr); +} + static inline void * u_memcpya(uint64_t user, unsigned nmemb, unsigned size) { void *mem; void __user *userptr = (void __force __user *)(uintptr_t)user; - mem = kmalloc(nmemb * size, GFP_KERNEL); + if (nmemb > 256 * 1024 / size) + return ERR_PTR(-ENOMEM); + + size *= nmemb; + + mem = kmalloc(size, GFP_KERNEL | __GFP_N...
2013 Nov 12
6
[PATCH 1/7] drm/nouveau: fix m2mf copy to tiled gart
From: Maarten Lankhorst <maarten.lankhorst at canonical.com> Commit de7b7d59d54852c introduced tiled GART, but a linear copy is still performed. This may result in errors on eviction, fix it by checking tiling from memtype. Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com> Cc: stable at vger.kernel.org #3.10+ --- drivers/gpu/drm/nouveau/nouveau_bo.c | 33
2019 Aug 20
0
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...el *chan, return ret; } - ret = validate_list(chan, cli, &op->list, pbbo, user_buffers); + ret = validate_list(chan, cli, &op->list, pbbo); if (unlikely(ret < 0)) { if (ret != -ERESTARTSYS) NV_PRINTK(err, cli, "validating bo list\n"); @@ -603,16 +596,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) static int nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf *req, + struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - struct drm_nouveau_gem_pushbuf_reloc *relo...
2019 Sep 03
0
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...> - ret = validate_list(chan, cli, &op->list, pbbo, user_buffers); > + ret = validate_list(chan, cli, &op->list, pbbo); > if (unlikely(ret < 0)) { > if (ret != -ERESTARTSYS) > NV_PRINTK(err, cli, "validating bo list\n"); > @@ -603,16 +596,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) > static int > nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, > struct drm_nouveau_gem_pushbuf *req, > + struct drm_nouveau_gem_pushbuf_reloc *reloc, > struct drm_nouveau_gem_pushbuf_bo *bo) > { > - struct...
2019 Nov 05
0
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...> - ret = validate_list(chan, cli, &op->list, pbbo, user_buffers); > + ret = validate_list(chan, cli, &op->list, pbbo); > if (unlikely(ret < 0)) { > if (ret != -ERESTARTSYS) > NV_PRINTK(err, cli, "validating bo list\n"); > @@ -605,16 +598,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) > static int > nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, > struct drm_nouveau_gem_pushbuf *req, > + struct drm_nouveau_gem_pushbuf_reloc *reloc, > struct drm_nouveau_gem_pushbuf_bo *bo) > { > - struct...
2020 Aug 11
3
[PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
...--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 81f111ad3f4f..7ef6221408af 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -587,15 +587,9 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) void __user *userptr = (void __force __user *)(uintptr_t)user; size *= nmemb; - - mem = kvmalloc(size, GFP_KERNEL); - if (!mem) - return ERR_PTR(-ENOMEM); - - if (copy_from_user(mem, userptr, size)) { - u_free(mem); - return ERR_PTR(-EFAULT); -...
2023 Apr 05
0
[PATCH] drm/nouveau: Add a jump label in nouveau_gem_ioctl_pushbuf()
...The label ?out_prevalid? was used to jump to another pointer check despite of the detail in the implementation of the function ?nouveau_gem_ioctl_pushbuf? that it was determined already in one case that the corresponding variable contained an error pointer because of a failed call of the function ?u_memcpya?. Thus use an additional label. This issue was detected by using the Coccinelle software. Fixes: 2be65641642ef423f82162c3a5f28c754d1637d2 ("drm/nouveau: fix relocations applying logic and a double-free") Signed-off-by: Markus Elfring <elfring at users.sourceforge.net> --- driver...
2013 Sep 04
0
[PATCH] drm/nouveau: fix command submission to use vmalloc for big allocations
...(struct nouveau_channel *chan, > return 0; > } > > +static inline void > +u_free(void *addr) > +{ > + if (!is_vmalloc_addr(addr)) > + kfree(addr); > + else > + vfree(addr); > +} > + > static inline void * > u_memcpya(uint64_t user, unsigned nmemb, unsigned size) > { > void *mem; > void __user *userptr = (void __force __user *)(uintptr_t)user; > > - mem = kmalloc(nmemb * size, GFP_KERNEL); > + if (nmemb > 256 * 1024 / size) > + return ERR_PTR(-EN...
2020 Aug 28
8
[PATCH 0/6] drm/nouveau: Support sync FDs and sync objects
From: Thierry Reding <treding at nvidia.com> Hi, This series implements a new IOCTL to submit push buffers that can optionally return a sync FD or sync object to userspace. This is useful in cases where userspace wants to synchronize operations between the GPU and another driver (such as KMS for display). Among other things this allows extensions such as eglDupNativeFenceFDANDROID to be
2020 Nov 12
0
[PATCH] drm/nouveau: Use vmemdup_user()
....c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 787d05e..df986d9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -591,14 +591,9 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) size *= nmemb; - mem = kvmalloc(size, GFP_KERNEL); - if (!mem) - return ERR_PTR(-ENOMEM); - - if (copy_from_user(mem, userptr, size)) { - u_free(mem); - return ERR_PTR(-EFAULT); - } + mem = vmemdup_user(userptr, size); + if (IS_ERR(mem)) + ret...
2009 Aug 18
1
[PATCH 1/2] drm/nouveau: minor gem cleanups
...--git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 64e59fb..75cae79 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -595,7 +595,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, bo = u_memcpya(req->buffers, req->nr_buffers, sizeof(*bo)); if (IS_ERR(bo)) - return (unsigned long)bo; + return PTR_ERR(bo); mutex_lock(&dev->struct_mutex); @@ -622,7 +622,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, ret = -EINVAL; goto out; } - pbbo = ge...
2016 Mar 18
4
[PATCH] gpu/drm: Use u64_to_user_pointer
...drm_nouveau_gem_pushbuf_bo __user *upbbo; struct nouveau_bo *nvbo; int ret, relocs = 0; + upbbo = u64_to_user_ptr(user_pbbo_ptr); + list_for_each_entry(nvbo, list, entry) { struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; @@ -565,7 +566,7 @@ static inline void * u_memcpya(uint64_t user, unsigned nmemb, unsigned size) { void *mem; - void __user *userptr = (void __force __user *)(uintptr_t)user; + void __user *userptr = u64_to_user_ptr(user); size *= nmemb; diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 8e6b18c..b20c87d 100644 --...
2016 Mar 18
4
[PATCH] gpu/drm: Use u64_to_user_pointer
...drm_nouveau_gem_pushbuf_bo __user *upbbo; struct nouveau_bo *nvbo; int ret, relocs = 0; + upbbo = u64_to_user_ptr(user_pbbo_ptr); + list_for_each_entry(nvbo, list, entry) { struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; @@ -565,7 +566,7 @@ static inline void * u_memcpya(uint64_t user, unsigned nmemb, unsigned size) { void *mem; - void __user *userptr = (void __force __user *)(uintptr_t)user; + void __user *userptr = u64_to_user_ptr(user); size *= nmemb; diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 8e6b18c..b20c87d 100644 --...