Patch "gma500: fix an incorrect NULL check on list iterator" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    gma500: fix an incorrect NULL check on list iterator

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gma500-fix-an-incorrect-null-check-on-list-iterator.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From bdef417d84536715145f6dc9cc3275c46f26295a Mon Sep 17 00:00:00 2001
From: Xiaomeng Tong <xiam0nd.tong@xxxxxxxxx>
Date: Sun, 27 Mar 2022 13:20:28 +0800
Subject: gma500: fix an incorrect NULL check on list iterator

From: Xiaomeng Tong <xiam0nd.tong@xxxxxxxxx>

commit bdef417d84536715145f6dc9cc3275c46f26295a upstream.

The bug is here:
	return crtc;

The list iterator value 'crtc' will *always* be set and non-NULL by
list_for_each_entry(), so it is incorrect to assume that the iterator
value will be NULL if the list is empty or no element is found.

To fix the bug, return 'crtc' when found, otherwise return NULL.

Cc: stable@xxxxxxxxxxxxxxx
fixes: 89c78134cc54d ("gma500: Add Poulsbo support")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@xxxxxxxxx>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx>
Link: https://patchwork.freedesktop.org/patch/msgid/20220327052028.2013-1-xiam0nd.tong@xxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/gma500/psb_intel_display.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -543,14 +543,15 @@ void psb_intel_crtc_init(struct drm_devi
 
 struct drm_crtc *psb_intel_get_crtc_from_pipe(struct drm_device *dev, int pipe)
 {
-	struct drm_crtc *crtc = NULL;
+	struct drm_crtc *crtc;
 
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 		struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
+
 		if (gma_crtc->pipe == pipe)
-			break;
+			return crtc;
 	}
-	return crtc;
+	return NULL;
 }
 
 int gma_connector_clones(struct drm_device *dev, int type_mask)


Patches currently in stable-queue which might be from xiam0nd.tong@xxxxxxxxx are

queue-4.19/md-fix-an-incorrect-null-check-in-does_sb_need_changing.patch
queue-4.19/scsi-dc395x-fix-a-missing-check-on-list-iterator.patch
queue-4.19/iommu-msm-fix-an-incorrect-null-check-on-list-iterator.patch
queue-4.19/carl9170-tx-fix-an-incorrect-use-of-list-iterator.patch
queue-4.19/gma500-fix-an-incorrect-null-check-on-list-iterator.patch
queue-4.19/drm-nouveau-clk-fix-an-incorrect-null-check-on-list-iterator.patch
queue-4.19/media-uvcvideo-fix-missing-check-to-determine-if-ele.patch
queue-4.19/md-fix-an-incorrect-null-check-in-md_reload_sb.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux