* [PATCH] drm/radeon: Use drm_calloc_ab for CS relocs @ 2015-04-16 2:17 Michel Dänzer 2015-04-16 2:30 ` Michel Dänzer 0 siblings, 1 reply; 4+ messages in thread From: Michel Dänzer @ 2015-04-16 2:17 UTC (permalink / raw) To: dri-devel From: Michel Dänzer <michel.daenzer@amd.com> The number of relocs is passed in by userspace and can be large. It has been observed to cause kmalloc failures in the wild. Cc: stable@vger.kernel.org Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> --- drivers/gpu/drm/radeon/radeon_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 4d0f96c..ab39b85 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -88,7 +88,7 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) p->dma_reloc_idx = 0; /* FIXME: we assume that each relocs use 4 dwords */ p->nrelocs = chunk->length_dw / 4; - p->relocs = kcalloc(p->nrelocs, sizeof(struct radeon_bo_list), GFP_KERNEL); + p->relocs = drm_calloc_large(p->nrelocs, sizeof(struct radeon_bo_list)); if (p->relocs == NULL) { return -ENOMEM; } @@ -428,7 +428,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo } } kfree(parser->track); - kfree(parser->relocs); + drm_free_large(parser->relocs); drm_free_large(parser->vm_bos); for (i = 0; i < parser->nchunks; i++) drm_free_large(parser->chunks[i].kdata); -- 2.1.4 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/radeon: Use drm_calloc_ab for CS relocs 2015-04-16 2:17 [PATCH] drm/radeon: Use drm_calloc_ab for CS relocs Michel Dänzer @ 2015-04-16 2:30 ` Michel Dänzer 2015-04-16 7:58 ` Christian König 0 siblings, 1 reply; 4+ messages in thread From: Michel Dänzer @ 2015-04-16 2:30 UTC (permalink / raw) To: dri-devel On 16.04.2015 11:17, Michel Dänzer wrote: > From: Michel Dänzer <michel.daenzer@amd.com> > > The number of relocs is passed in by userspace and can be large. It has > been observed to cause kmalloc failures in the wild. That should of course say 'kcalloc failures'. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/radeon: Use drm_calloc_ab for CS relocs 2015-04-16 2:30 ` Michel Dänzer @ 2015-04-16 7:58 ` Christian König 2015-04-16 14:13 ` Alex Deucher 0 siblings, 1 reply; 4+ messages in thread From: Christian König @ 2015-04-16 7:58 UTC (permalink / raw) To: Michel Dänzer, dri-devel On 16.04.2015 04:30, Michel Dänzer wrote: > On 16.04.2015 11:17, Michel Dänzer wrote: >> From: Michel Dänzer <michel.daenzer@amd.com> >> >> The number of relocs is passed in by userspace and can be large. It has >> been observed to cause kmalloc failures in the wild. > That should of course say 'kcalloc failures'. Yeah, with that fixed in the commit message the patch is Reviewed-by: Christian König <christian.koenig@amd.com> Regards, Christian. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/radeon: Use drm_calloc_ab for CS relocs 2015-04-16 7:58 ` Christian König @ 2015-04-16 14:13 ` Alex Deucher 0 siblings, 0 replies; 4+ messages in thread From: Alex Deucher @ 2015-04-16 14:13 UTC (permalink / raw) To: Christian König; +Cc: Michel Dänzer, Maling list - DRI developers On Thu, Apr 16, 2015 at 3:58 AM, Christian König <deathsimple@vodafone.de> wrote: > On 16.04.2015 04:30, Michel Dänzer wrote: >> >> On 16.04.2015 11:17, Michel Dänzer wrote: >>> >>> From: Michel Dänzer <michel.daenzer@amd.com> >>> >>> The number of relocs is passed in by userspace and can be large. It has >>> been observed to cause kmalloc failures in the wild. >> >> That should of course say 'kcalloc failures'. > > > Yeah, with that fixed in the commit message the patch is Reviewed-by: > Christian König <christian.koenig@amd.com> Applied with the commit message fixed. Alex > > Regards, > Christian. > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-04-16 14:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-16 2:17 [PATCH] drm/radeon: Use drm_calloc_ab for CS relocs Michel Dänzer 2015-04-16 2:30 ` Michel Dänzer 2015-04-16 7:58 ` Christian König 2015-04-16 14:13 ` Alex Deucher
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.