From: Michel Dänzer <[email protected]>

3.4.109-rc1 review patch.  If anyone has any objections, please let me know.

------------------


commit b421ed15d2c3039eb724680e4de1e4b2bd196a9a upstream.

The number of relocs is passed in by userspace and can be large. It has
been observed to cause kcalloc failures in the wild.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Michel Dänzer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <[email protected]>
---
 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 f3ee360..d66d2cd 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -49,7 +49,7 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
        if (p->relocs_ptr == NULL) {
                return -ENOMEM;
        }
-       p->relocs = kcalloc(p->nrelocs, sizeof(struct radeon_cs_reloc), 
GFP_KERNEL);
+       p->relocs = drm_calloc_large(p->nrelocs, sizeof(struct radeon_bo_list));
        if (p->relocs == NULL) {
                return -ENOMEM;
        }
@@ -324,7 +324,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser 
*parser, int error)
                }
        }
        kfree(parser->track);
-       kfree(parser->relocs);
+       drm_free_large(parser->relocs);
        kfree(parser->relocs_ptr);
        for (i = 0; i < parser->nchunks; i++) {
                kfree(parser->chunks[i].kdata);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to