mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] fix NULL pointer deference in ALPS
@ 2005-03-07 12:24 Benoit Boissinot
  2005-03-07 13:10 ` Vojtech Pavlik
  2005-03-07 14:06 ` Alexey Dobriyan
  0 siblings, 2 replies; 5+ messages in thread
From: Benoit Boissinot @ 2005-03-07 12:24 UTC (permalink / raw)
  To: Vojtech Pavlik, Andrew Morton, Greg KH, torvalds; +Cc: linux-kernel

I get a NULL pointer deference in with alps while suspending.

The following patch fixes it: alps_get_model returns a pointer or
NULL in case of errors, so we need to check for the results being NULL,
not negative.

Since it is trivial, it is maybe a candidate for 2.6.11.2.

It does not apply to -mm since the last occurence of alps_get_model
was corrected (but not the others), if needed i can send a patch for
-mm as well.

regards,

Benoit

Signed-off-by: Benoit Boissinot <benoit.boissinot@ens-lyon.org>


--- linux-clean/drivers/input/mouse/alps.c	2005-03-07 12:45:46.000000000 +0100
+++ linux-vanilla/drivers/input/mouse/alps.c	2005-03-07 12:50:12.000000000 +0100
@@ -325,7 +325,7 @@ static int alps_reconnect(struct psmouse
 	int model;
 	unsigned char param[4];
 
-	if ((model = alps_get_model(psmouse)) < 0)
+	if (!(model = alps_get_model(psmouse)))
 		return -1;
 
 	if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 1))
@@ -358,7 +358,7 @@ int alps_init(struct psmouse *psmouse)
 	unsigned char param[4];
 	int model;
 
-	if ((model = alps_get_model(psmouse)) < 0)
+	if (!(model = alps_get_model(psmouse)))
 		return -1;
 
 	printk(KERN_INFO "ALPS Touchpad (%s) detected\n",
@@ -412,7 +412,7 @@ int alps_init(struct psmouse *psmouse)
 
 int alps_detect(struct psmouse *psmouse, int set_properties)
 {
-	if (alps_get_model(psmouse) < 0)
+	if (!alps_get_model(psmouse))
 		return -1;
 
 	if (set_properties) {


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

* Re: [patch] fix NULL pointer deference in ALPS
  2005-03-07 12:24 [patch] fix NULL pointer deference in ALPS Benoit Boissinot
@ 2005-03-07 13:10 ` Vojtech Pavlik
  2005-03-07 13:11   ` Vojtech Pavlik
  2005-03-07 14:06 ` Alexey Dobriyan
  1 sibling, 1 reply; 5+ messages in thread
From: Vojtech Pavlik @ 2005-03-07 13:10 UTC (permalink / raw)
  To: Benoit Boissinot; +Cc: Andrew Morton, Greg KH, torvalds, linux-kernel

On Mon, Mar 07, 2005 at 01:24:32PM +0100, Benoit Boissinot wrote:
> I get a NULL pointer deference in with alps while suspending.
> 
> The following patch fixes it: alps_get_model returns a pointer or
> NULL in case of errors, so we need to check for the results being NULL,
> not negative.
> 
> Since it is trivial, it is maybe a candidate for 2.6.11.2.
> 
> It does not apply to -mm since the last occurence of alps_get_model
> was corrected (but not the others), if needed i can send a patch for
> -mm as well.

I already fixed it in my tree, but feel free to push it for the sucker
tree.

> regards,
> 
> Benoit
> 
> Signed-off-by: Benoit Boissinot <benoit.boissinot@ens-lyon.org>
> 
> 
> --- linux-clean/drivers/input/mouse/alps.c	2005-03-07 12:45:46.000000000 +0100
> +++ linux-vanilla/drivers/input/mouse/alps.c	2005-03-07 12:50:12.000000000 +0100
> @@ -325,7 +325,7 @@ static int alps_reconnect(struct psmouse
>  	int model;
>  	unsigned char param[4];
>  
> -	if ((model = alps_get_model(psmouse)) < 0)
> +	if (!(model = alps_get_model(psmouse)))
>  		return -1;
>  
>  	if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 1))
> @@ -358,7 +358,7 @@ int alps_init(struct psmouse *psmouse)
>  	unsigned char param[4];
>  	int model;
>  
> -	if ((model = alps_get_model(psmouse)) < 0)
> +	if (!(model = alps_get_model(psmouse)))
>  		return -1;
>  
>  	printk(KERN_INFO "ALPS Touchpad (%s) detected\n",
> @@ -412,7 +412,7 @@ int alps_init(struct psmouse *psmouse)
>  
>  int alps_detect(struct psmouse *psmouse, int set_properties)
>  {
> -	if (alps_get_model(psmouse) < 0)
> +	if (!alps_get_model(psmouse))
>  		return -1;
>  
>  	if (set_properties) {
> 
> 

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

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

* Re: [patch] fix NULL pointer deference in ALPS
  2005-03-07 13:10 ` Vojtech Pavlik
@ 2005-03-07 13:11   ` Vojtech Pavlik
  0 siblings, 0 replies; 5+ messages in thread
From: Vojtech Pavlik @ 2005-03-07 13:11 UTC (permalink / raw)
  To: Benoit Boissinot; +Cc: Andrew Morton, Greg KH, torvalds, linux-kernel

On Mon, Mar 07, 2005 at 02:10:02PM +0100, Vojtech Pavlik wrote:

> On Mon, Mar 07, 2005 at 01:24:32PM +0100, Benoit Boissinot wrote:
> > I get a NULL pointer deference in with alps while suspending.
> > 
> > The following patch fixes it: alps_get_model returns a pointer or
> > NULL in case of errors, so we need to check for the results being NULL,
> > not negative.
> > 
> > Since it is trivial, it is maybe a candidate for 2.6.11.2.
> > 
> > It does not apply to -mm since the last occurence of alps_get_model
> > was corrected (but not the others), if needed i can send a patch for
> > -mm as well.
> 
> I already fixed it in my tree, but feel free to push it for the sucker
> tree.

Oops. No, 2.6.11 doesn't need that fix. Only -mm does, and it's already
queued.

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

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

* Re: [patch] fix NULL pointer deference in ALPS
  2005-03-07 14:06 ` Alexey Dobriyan
@ 2005-03-07 13:12   ` Benoit Boissinot
  0 siblings, 0 replies; 5+ messages in thread
From: Benoit Boissinot @ 2005-03-07 13:12 UTC (permalink / raw)
  To: Alexey Dobriyan
  Cc: Vojtech Pavlik, Andrew Morton, Greg KH, torvalds, linux-kernel

On Mon, Mar 07, 2005 at 04:06:33PM +0200, Alexey Dobriyan wrote:
> On Monday 07 March 2005 14:24, Benoit Boissinot wrote:
> 
> > alps_get_model returns a pointer or NULL in case of errors, so we need to
> > check for the results being NULL, not negative.
> 
> 2.6.11-bk2:	int alps_get_model(struct psmouse *psmouse)
> 	takes 1 argument, returns -1 on error
> 
> 2.6.11-mm1:	static struct alps_model_info *alps_get_model(struct psmouse *psmouse, int *version)
> 	takes 2 arguments, returns NULL on error
>

Sorry, i misreaded the vanilla code, it only applies to -mm.

Since it seems to be fixed in bk-input, please forget the patch.

Sorry.

Benoit
-- 
powered by bash/screen/(urxvt/fvwm|linux-console)/gentoo/gnu/linux OS

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

* Re: [patch] fix NULL pointer deference in ALPS
  2005-03-07 12:24 [patch] fix NULL pointer deference in ALPS Benoit Boissinot
  2005-03-07 13:10 ` Vojtech Pavlik
@ 2005-03-07 14:06 ` Alexey Dobriyan
  2005-03-07 13:12   ` Benoit Boissinot
  1 sibling, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2005-03-07 14:06 UTC (permalink / raw)
  To: Benoit Boissinot
  Cc: Vojtech Pavlik, Andrew Morton, Greg KH, torvalds, linux-kernel

On Monday 07 March 2005 14:24, Benoit Boissinot wrote:

> alps_get_model returns a pointer or NULL in case of errors, so we need to
> check for the results being NULL, not negative.

2.6.11-bk2:	int alps_get_model(struct psmouse *psmouse)
	takes 1 argument, returns -1 on error

2.6.11-mm1:	static struct alps_model_info *alps_get_model(struct psmouse *psmouse, int *version)
	takes 2 arguments, returns NULL on error

> --- linux-clean/drivers/input/mouse/alps.c
> +++ linux-vanilla/drivers/input/mouse/alps.c

> -	if ((model = alps_get_model(psmouse)) < 0)
> +	if (!(model = alps_get_model(psmouse)))

> -	if ((model = alps_get_model(psmouse)) < 0)
> +	if (!(model = alps_get_model(psmouse)))

> -	if (alps_get_model(psmouse) < 0)
> +	if (!alps_get_model(psmouse))

To what version of kernel this patch should be applied?

	Alexey

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

end of thread, other threads:[~2005-03-07 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-07 12:24 [patch] fix NULL pointer deference in ALPS Benoit Boissinot
2005-03-07 13:10 ` Vojtech Pavlik
2005-03-07 13:11   ` Vojtech Pavlik
2005-03-07 14:06 ` Alexey Dobriyan
2005-03-07 13:12   ` Benoit Boissinot

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

all inboxes | Powered by JetHome®