Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6b7e1a0 authored by Ilija Hadzic's avatar Ilija Hadzic Committed by Alex Deucher
Browse files

drm/radeon: fix a bogus kfree



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: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ff4bd082
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2476,9 +2476,11 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
	kfree(parser->relocs);
	for (i = 0; i < parser->nchunks; i++) {
		kfree(parser->chunks[i].kdata);
		if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) {
			kfree(parser->chunks[i].kpage[0]);
			kfree(parser->chunks[i].kpage[1]);
		}
	}
	kfree(parser->chunks);
	kfree(parser->chunks_array);
}