Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
* [PATCH] OMAPDSS: OMAPFB: Fix possible null pointer dereferencing
@ 2012-11-19  5:10 Tushar Behera
  2012-11-19  8:44 ` Tomi Valkeinen
  0 siblings, 1 reply; 3+ messages in thread
From: Tushar Behera @ 2012-11-19  5:10 UTC (permalink / raw)
  To: linux-omap; +Cc: archit, patches, tomi.valkeinen

If display is NULL, display->output would lead to kernel panic.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/video/omap2/omapfb/omapfb-ioctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
index 55a39be..532a31b 100644
--- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
@@ -787,7 +787,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
 
 	case OMAPFB_WAITFORVSYNC:
 		DBG("ioctl WAITFORVSYNC\n");
-		if (!display && !display->output && !display->output->manager) {
+		if (!display || !display->output || !display->output->manager) {
 			r = -EINVAL;
 			break;
 		}
-- 
1.7.4.1


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

* Re: [PATCH] OMAPDSS: OMAPFB: Fix possible null pointer dereferencing
  2012-11-19  5:10 [PATCH] OMAPDSS: OMAPFB: Fix possible null pointer dereferencing Tushar Behera
@ 2012-11-19  8:44 ` Tomi Valkeinen
  2012-11-19  9:41   ` Tushar Behera
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Valkeinen @ 2012-11-19  8:44 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-omap, archit, patches

[-- Attachment #1: Type: text/plain, Size: 1802 bytes --]

On 2012-11-19 07:10, Tushar Behera wrote:
> If display is NULL, display->output would lead to kernel panic.
> 
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/video/omap2/omapfb/omapfb-ioctl.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
> index 55a39be..532a31b 100644
> --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
> +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
> @@ -787,7 +787,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
>  
>  	case OMAPFB_WAITFORVSYNC:
>  		DBG("ioctl WAITFORVSYNC\n");
> -		if (!display && !display->output && !display->output->manager) {
> +		if (!display || !display->output || !display->output->manager) {
>  			r = -EINVAL;
>  			break;
>  		}
> 

Thanks, good catch. However, the patch description is not very good.
If you agree with the change, I'll apply the patch with the description:


OMAPFB: Fix possible null pointer dereferencing                          
                                                                         
Commit 952cbaaa9b8beacc425f9aedf370468cbb737a2c (OMAPFB: Change          
dssdev->manager references) added checks for OMAPFB_WAITFORVSYNC ioctl   
to verify that the display, output and overlay manager exist. However,   
the code erroneously uses && for each part, which means that             
OMAPFB_WAITFORVSYNC may crash the kernel if no display, output or        
manager is associated with the framebuffer.                              
                                                                         
This patch fixes the issue by using ||.                                  


 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

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

* Re: [PATCH] OMAPDSS: OMAPFB: Fix possible null pointer dereferencing
  2012-11-19  8:44 ` Tomi Valkeinen
@ 2012-11-19  9:41   ` Tushar Behera
  0 siblings, 0 replies; 3+ messages in thread
From: Tushar Behera @ 2012-11-19  9:41 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, archit, patches

On 11/19/2012 02:14 PM, Tomi Valkeinen wrote:
> On 2012-11-19 07:10, Tushar Behera wrote:
>> If display is NULL, display->output would lead to kernel panic.
>>
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> ---
>>  drivers/video/omap2/omapfb/omapfb-ioctl.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
>> index 55a39be..532a31b 100644
>> --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
>> +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
>> @@ -787,7 +787,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
>>  
>>  	case OMAPFB_WAITFORVSYNC:
>>  		DBG("ioctl WAITFORVSYNC\n");
>> -		if (!display && !display->output && !display->output->manager) {
>> +		if (!display || !display->output || !display->output->manager) {
>>  			r = -EINVAL;
>>  			break;
>>  		}
>>
> 
> Thanks, good catch. However, the patch description is not very good.

I agree.

> If you agree with the change, I'll apply the patch with the description:
> 

Please go ahead with the description that you have written here.

> 
> OMAPFB: Fix possible null pointer dereferencing                          
>                                                                          
> Commit 952cbaaa9b8beacc425f9aedf370468cbb737a2c (OMAPFB: Change          
> dssdev->manager references) added checks for OMAPFB_WAITFORVSYNC ioctl   
> to verify that the display, output and overlay manager exist. However,   
> the code erroneously uses && for each part, which means that             
> OMAPFB_WAITFORVSYNC may crash the kernel if no display, output or        
> manager is associated with the framebuffer.                              
>                                                                          
> This patch fixes the issue by using ||.                                  
> 
> 
>  Tomi
> 
> 

Thanks.

-- 
Tushar Behera

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

end of thread, other threads:[~2012-11-19  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-19  5:10 [PATCH] OMAPDSS: OMAPFB: Fix possible null pointer dereferencing Tushar Behera
2012-11-19  8:44 ` Tomi Valkeinen
2012-11-19  9:41   ` Tushar Behera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox