From: Peter Antoine <peter.antoine@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm: Fixes unsafe deference in locks.
Date: Tue, 31 Mar 2015 09:09:35 +0100 [thread overview]
Message-ID: <1427789375-2213-3-git-send-email-peter.antoine@intel.com> (raw)
In-Reply-To: <1427789375-2213-1-git-send-email-peter.antoine@intel.com>
This patch fixes an unsafe deference in the DRM_IOCTL_NEW_CTX. If the
ioctl is called before the lock is created or after it has been destroyed.
The code will deference a NULL pointer. This ioctl is a root ioctl so
exploitation is limited.
Issue: GMINL-7409
Change-Id: Icabf814abe8225d616fdf4f981cd36d2b27f7ad5
Signed-off-by: Peter Antoine <peter.antoine@intel.com>
---
drivers/gpu/drm/drm_context.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index a4b017b..4754e79 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -252,7 +252,13 @@ static int drm_context_switch_complete(struct drm_device *dev,
{
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
- if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) {
+ if (file_priv->master->lock.hw_lock == NULL) {
+ DRM_ERROR(
+ "Device has been unregistered. Hard exit. Process %d\n",
+ task_pid_nr(current));
+ send_sig(SIGTERM, current, 0);
+ return -EINTR;
+ } else if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) {
DRM_ERROR("Lock isn't held after context switch\n");
}
--
1.9.1
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-03-31 8:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 8:09 [PATCH] drm: Kernel Crash in drm_unlock Peter Antoine
2015-03-31 8:09 ` [PATCH] drm: Possible lock priority escalation Peter Antoine
2015-03-31 15:53 ` shuang.he
2015-03-31 8:09 ` Peter Antoine [this message]
2015-03-31 18:20 ` [PATCH] drm: Fixes unsafe deference in locks shuang.he
2015-03-31 13:24 ` [PATCH] drm: Kernel Crash in drm_unlock shuang.he
2015-03-31 13:25 ` Daniel Vetter
2015-03-31 13:28 ` Damien Lespiau
2015-03-31 13:34 ` Antoine, Peter
2015-03-31 14:00 ` Daniel Vetter
2015-03-31 14:21 ` Antoine, Peter
2015-04-15 14:22 ` Antoine, Peter
2015-04-16 7:30 ` Daniel Vetter
2015-03-31 13:35 ` Damien Lespiau
2015-03-31 13:38 ` Antoine, Peter
2015-03-31 13:44 ` Damien Lespiau
2015-03-31 13:47 ` Antoine, Peter
2015-03-31 13:53 ` He, Shuang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427789375-2213-3-git-send-email-peter.antoine@intel.com \
--to=peter.antoine@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox