drm/atomic: fix null dereference
Subsystems (2)
PATCH 1/1 drm/atomic: fix null dereference
We are checking the size of e->event but we were doing it when e is known to be NULL.
--- drivers/gpu/drm/drm_atomic.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +0 -1
@@ -1311,7 +1311,6 @@ static struct drm_pending_vblank_event *create_vblank_event( e =kzalloc (sizeof *e,GFP_KERNEL );if (e ==NULL ) {spin_lock_irqsave (&dev->event_lock, flags); - file_priv->event_space +=sizeof e->event;spin_unlock_irqrestore (&dev->event_lock, flags); goto out; }
Signature · 6 lines
1.8.1.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Clark
NAKQuoted 2 lines · Sudip Mukherjee
We are checking the size of
e->eventbut we were doing it when e is known to be NULL.
nak, this will leak event_space.. since it is a sizeof, it isn't actually deref'ing e, but rather just using the static type info, so it's ok (although perhaps funny looking)
BR,
-R
Quoted 20 lines
Signed-off-by Sudip Mukherjee <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_atomic.c +0
-2@@ -1311,7 +1311,6 @@ static struct drm_pending_vblank_event *create_vblank_event( e =kzalloc (sizeof *e,GFP_KERNEL );if (e ==NULL ) {spin_lock_irqsave (&dev->event_lock, flags); - file_priv->event_space +=sizeof e->event;spin_unlock_irqrestore (&dev->event_lock, flags); goto out; } --1.8.1.2
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Rob Clark
Quoted 2 lines · Sudip Mukherjee
We are checking the size of
e->eventbut we were doing it when e is known to be NULL.nak, this will leak
event_space.. since it is a sizeof, it isn't actually deref'ing e, but rather just using the static type info, so it's ok (although perhaps funny looking)
Agreed, and I just verified the same with an userspace code also. But i think this will confuse people like me who have started to look at the drm code to start working with some new drm driver. what about:file_priv->event_space += sizeof(struct drm_event_vblank);
It will server the same purpose yet it will not be confusing.
regards
sudip
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel