Skip to content

Commit

Permalink
[PATCH] SiS DRM: Fix possible NULL dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Egbert Eich authored and Linus Torvalds committed Nov 30, 2005
1 parent d2ef5eb commit c801147
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/char/drm/drm_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,10 @@ int drm_addctx(struct inode *inode, struct file *filp,

if (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);
Expand Down

0 comments on commit c801147

Please sign in to comment.