[PATCH] SiS DRM: Fix possible NULL dereference

This fixes a NULL pointer reference in DRM. The 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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Egbert Eich and committed by Linus Torvalds c801147c d2ef5ebb

+4 -1
+4 -1
drivers/char/drm/drm_context.c
··· 432 433 if (ctx.handle != DRM_KERNEL_CONTEXT) { 434 if (dev->driver->context_ctor) 435 - dev->driver->context_ctor(dev, ctx.handle); 436 } 437 438 ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST);
··· 432 433 if (ctx.handle != DRM_KERNEL_CONTEXT) { 434 if (dev->driver->context_ctor) 435 + if (!dev->driver->context_ctor(dev, ctx.handle)) { 436 + DRM_DEBUG( "Running out of ctxs or memory.\n"); 437 + return -ENOMEM; 438 + } 439 } 440 441 ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST);