* [PATCH] drm/stm: ltdc: fix unchecked dereferenced pointer
@ 2022-05-10 14:24 ` Raphael Gallais-Pou
0 siblings, 0 replies; 3+ messages in thread
From: Raphael Gallais-Pou @ 2022-05-10 14:24 UTC (permalink / raw)
To: Yannick Fertre, Philippe Cornu
Cc: Raphael Gallais-Pou, David Airlie, Alexandre Torgue, dri-devel,
linux-kernel, Dan Carpenter, Maxime Coquelin, linux-stm32,
linux-arm-kernel, kernel test robot
Pointer of struct *drm_crtc was dereferenced before checking it was non
NULL. This could potentially create a kernel panic.
Fixes: 79b44684a14e ("drm/stm: ltdc: add support for CRC hashing feature")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
---
drivers/gpu/drm/stm/ltdc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 6bd45df8f5a7..9c0fadd58d2a 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -1120,7 +1120,7 @@ static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source)
{
- struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+ struct ltdc_device *ldev;
int ret;
DRM_DEBUG_DRIVER("\n");
@@ -1128,6 +1128,8 @@ static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source)
if (!crtc)
return -ENODEV;
+ ldev = crtc_to_ltdc(crtc);
+
if (source && strcmp(source, "auto") == 0) {
ldev->crc_active = true;
ret = regmap_set_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] drm/stm: ltdc: fix unchecked dereferenced pointer
@ 2022-05-10 14:24 ` Raphael Gallais-Pou
0 siblings, 0 replies; 3+ messages in thread
From: Raphael Gallais-Pou @ 2022-05-10 14:24 UTC (permalink / raw)
To: Yannick Fertre, Philippe Cornu
Cc: David Airlie, Daniel Vetter, Maxime Coquelin, Alexandre Torgue,
dri-devel, linux-stm32, linux-arm-kernel, linux-kernel,
Raphael Gallais-Pou, kernel test robot, Dan Carpenter
Pointer of struct *drm_crtc was dereferenced before checking it was non
NULL. This could potentially create a kernel panic.
Fixes: 79b44684a14e ("drm/stm: ltdc: add support for CRC hashing feature")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
---
drivers/gpu/drm/stm/ltdc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 6bd45df8f5a7..9c0fadd58d2a 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -1120,7 +1120,7 @@ static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source)
{
- struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+ struct ltdc_device *ldev;
int ret;
DRM_DEBUG_DRIVER("\n");
@@ -1128,6 +1128,8 @@ static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source)
if (!crtc)
return -ENODEV;
+ ldev = crtc_to_ltdc(crtc);
+
if (source && strcmp(source, "auto") == 0) {
ldev->crc_active = true;
ret = regmap_set_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] drm/stm: ltdc: fix unchecked dereferenced pointer
@ 2022-05-10 14:24 ` Raphael Gallais-Pou
0 siblings, 0 replies; 3+ messages in thread
From: Raphael Gallais-Pou @ 2022-05-10 14:24 UTC (permalink / raw)
To: Yannick Fertre, Philippe Cornu
Cc: David Airlie, Daniel Vetter, Maxime Coquelin, Alexandre Torgue,
dri-devel, linux-stm32, linux-arm-kernel, linux-kernel,
Raphael Gallais-Pou, kernel test robot, Dan Carpenter
Pointer of struct *drm_crtc was dereferenced before checking it was non
NULL. This could potentially create a kernel panic.
Fixes: 79b44684a14e ("drm/stm: ltdc: add support for CRC hashing feature")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
---
drivers/gpu/drm/stm/ltdc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 6bd45df8f5a7..9c0fadd58d2a 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -1120,7 +1120,7 @@ static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source)
{
- struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+ struct ltdc_device *ldev;
int ret;
DRM_DEBUG_DRIVER("\n");
@@ -1128,6 +1128,8 @@ static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source)
if (!crtc)
return -ENODEV;
+ ldev = crtc_to_ltdc(crtc);
+
if (source && strcmp(source, "auto") == 0) {
ldev->crc_active = true;
ret = regmap_set_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-10 14:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 14:24 [PATCH] drm/stm: ltdc: fix unchecked dereferenced pointer Raphael Gallais-Pou
2022-05-10 14:24 ` Raphael Gallais-Pou
2022-05-10 14:24 ` Raphael Gallais-Pou
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.