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

Commit c801147c authored by Egbert Eich's avatar Egbert Eich Committed by Linus Torvalds
Browse files

[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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d2ef5ebb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);