dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: fix possible null pointer dereference
@ 2015-07-20 12:29 Sudip Mukherjee
  2015-07-20 12:38 ` Chris Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-07-20 12:29 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, David Airlie
  Cc: linux-kernel, intel-gfx, dri-devel, Sudip Mukherjee

We were dereferencing dev first and then checking if it is NULL. Lets
check for NULL first and then dereference.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index bc817da..f316e49 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4100,12 +4100,13 @@ static int i915_displayport_test_active_show(struct seq_file *m, void *data)
 {
 	struct drm_device *dev = m->private;
 	struct drm_connector *connector;
-	struct list_head *connector_list = &dev->mode_config.connector_list;
+	struct list_head *connector_list;
 	struct intel_dp *intel_dp;
 
 	if (!dev)
 		return -ENODEV;
 
+	connector_list = &dev->mode_config.connector_list;
 	list_for_each_entry(connector, connector_list, head) {
 
 		if (connector->connector_type !=
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: fix possible null pointer dereference
  2015-07-20 12:29 [PATCH] drm/i915: fix possible null pointer dereference Sudip Mukherjee
@ 2015-07-20 12:38 ` Chris Wilson
  2015-07-20 13:28   ` Sudip Mukherjee
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2015-07-20 12:38 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, Daniel Vetter

On Mon, Jul 20, 2015 at 05:59:29PM +0530, Sudip Mukherjee wrote:
> We were dereferencing dev first and then checking if it is NULL. Lets
> check for NULL first and then dereference.

The code is bonkers. Testing for a lack of a correctly constructed
debugfs seq_file inside the debugfs seq_file callback is inane.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: fix possible null pointer dereference
  2015-07-20 12:38 ` Chris Wilson
@ 2015-07-20 13:28   ` Sudip Mukherjee
  2015-07-20 14:23     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-07-20 13:28 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Jani Nikula, David Airlie,
	intel-gfx, linux-kernel, dri-devel

On Mon, Jul 20, 2015 at 01:38:46PM +0100, Chris Wilson wrote:
> On Mon, Jul 20, 2015 at 05:59:29PM +0530, Sudip Mukherjee wrote:
> > We were dereferencing dev first and then checking if it is NULL. Lets
> > check for NULL first and then dereference.
> 
> The code is bonkers. Testing for a lack of a correctly constructed
> debugfs seq_file inside the debugfs seq_file callback is inane.
I missed seeing before sending this patch that there are some more
places where this has been done.
Then are you suggesting to remove the test?

regards
sudip
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: fix possible null pointer dereference
  2015-07-20 13:28   ` Sudip Mukherjee
@ 2015-07-20 14:23     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-07-20 14:23 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, Daniel Vetter

On Mon, Jul 20, 2015 at 06:58:32PM +0530, Sudip Mukherjee wrote:
> On Mon, Jul 20, 2015 at 01:38:46PM +0100, Chris Wilson wrote:
> > On Mon, Jul 20, 2015 at 05:59:29PM +0530, Sudip Mukherjee wrote:
> > > We were dereferencing dev first and then checking if it is NULL. Lets
> > > check for NULL first and then dereference.
> > 
> > The code is bonkers. Testing for a lack of a correctly constructed
> > debugfs seq_file inside the debugfs seq_file callback is inane.
> I missed seeing before sending this patch that there are some more
> places where this has been done.
> Then are you suggesting to remove the test?

It's all been added for the tp validation support. And yes it should be
removed everywhere.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-20 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 12:29 [PATCH] drm/i915: fix possible null pointer dereference Sudip Mukherjee
2015-07-20 12:38 ` Chris Wilson
2015-07-20 13:28   ` Sudip Mukherjee
2015-07-20 14:23     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).