Patchwork [3.5.y.z,extended,stable] Patch "drm/radeon: fix a bogus kfree" has been added to staging queue

mail settings
Submitter Herton Ronaldo Krzesinski
Date Jan. 23, 2013, 9:39 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/215041/
State New
Headers show


Herton Ronaldo Krzesinski - Jan. 23, 2013, 9:39 p.m.
This is a note to let you know that I have just added a patch titled

    drm/radeon: fix a bogus kfree

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From 1fb954e1365ee4b0dd66f8d81e9e6ea83de02dd0 Mon Sep 17 00:00:00 2001
From: Ilija Hadzic <>
Date: Mon, 7 Jan 2013 18:21:58 -0500
Subject: [PATCH] drm/radeon: fix a bogus kfree

commit a6b7e1a02b77ab8fe8775d20a88c53d8ba55482e upstream.

parser->chunks[.].kpage[.] is not always kmalloc-ed
by the parser initialization, so parser_fini should
not try to kfree it if it didn't allocate it.

This patch fixes a kernel oops that can be provoked
in UMS mode.

Signed-off-by: Ilija Hadzic <>
Signed-off-by: Alex Deucher <>
Signed-off-by: Herton Ronaldo Krzesinski <>
 drivers/gpu/drm/radeon/r600_cs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)



diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 1119e31..c05e88a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2330,8 +2330,10 @@  static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
 	for (i = 0; i < parser->nchunks; i++) {
-		kfree(parser->chunks[i].kpage[0]);
-		kfree(parser->chunks[i].kpage[1]);
+		if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) {
+			kfree(parser->chunks[i].kpage[0]);
+			kfree(parser->chunks[i].kpage[1]);
+		}