Fix NULL-reference in DRM
PATCH 1/1 Fix NULL-reference in DRM
This patch fixes the NULL pointer reference in DRM.
SiS driver tries to allocate a big chunk of memory, but the return value is never checked.
Reported in Novell bugzilla #132271:
https://bugzilla.novell.com/show_bug.cgi?id=132271
From: Egbert Eich <[email protected]>
Signed-off-by Takashi Iwai <[email protected]>
drivers/char/drm/drm_context.c +4 -1
@@ -432,7 +432,10 @@ int drm_addctx(struct inode *inode, struif (ctx.handle !=DRM_KERNEL_CONTEXT ) {if (dev->driver->context_ctor) - dev->driver->context_ctor (dev, ctx.handle); +if (!dev->driver->context_ctor (dev, ctx.handle)) { +DRM_DEBUG ("Running out of ctxs or memory.\n" ); +return -ENOMEM ; + } } ctx_entry =drm_alloc (sizeof (*ctx_entry),DRM_MEM_CTXLIST );