diff options
author | Egbert Eich <eich@suse.de> | 2005-11-30 09:32:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-30 11:45:40 -0500 |
commit | c801147c5a103eec864afee348c4ee3fdb0f380c (patch) | |
tree | 498a39dfb965c58b22b5b4ae0d920f72a0f6f2d5 | |
parent | d2ef5ebb4c4fe141a82252d4db8d8521e6765c5a (diff) |
[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>
-rw-r--r-- | drivers/char/drm/drm_context.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index bdd168d88f49..bd958d69a2ac 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c | |||
@@ -432,7 +432,10 @@ int drm_addctx(struct inode *inode, struct file *filp, | |||
432 | 432 | ||
433 | if (ctx.handle != DRM_KERNEL_CONTEXT) { | 433 | if (ctx.handle != DRM_KERNEL_CONTEXT) { |
434 | if (dev->driver->context_ctor) | 434 | if (dev->driver->context_ctor) |
435 | dev->driver->context_ctor(dev, ctx.handle); | 435 | if (!dev->driver->context_ctor(dev, ctx.handle)) { |
436 | DRM_DEBUG( "Running out of ctxs or memory.\n"); | ||
437 | return -ENOMEM; | ||
438 | } | ||
436 | } | 439 | } |
437 | 440 | ||
438 | ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST); | 441 | ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST); |