[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090506173105.18108634@pedra.chehab.org>
Date: Wed, 6 May 2009 17:31:05 -0300
From: Mauro Carvalho Chehab <mchehab@...hat.com>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] dereferencing freed in saa5249.c
Em Wed, 06 May 2009 17:13:45 +0100
Alan Cox <alan@...rguk.ukuu.org.uk> escreveu:
> From: Dan Carpenter <error27@...il.com>
>
> I moved the kfree() down a couple lines. t->vdev is going to be in freed
> memory so there is no point setting it to NULL. I added a kfree(t) on a
> different error path.
>
> regards,
> dan carpenter
>
> Signed-off-by: Dan Carpenter <error27@...il.com>
> Signed-off-by: Alan Cox <alan@...ux.intel.com>
Acked-by: Mauro Carvalho Chehab <mchehab@...hat.com>
> ---
>
> drivers/media/video/saa5249.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
>
> diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
> index 48b27fe..271d6e9 100644
> --- a/drivers/media/video/saa5249.c
> +++ b/drivers/media/video/saa5249.c
> @@ -598,6 +598,7 @@ static int saa5249_probe(struct i2c_client *client,
> /* Now create a video4linux device */
> t->vdev = video_device_alloc();
> if (t->vdev == NULL) {
> + kfree(t);
> kfree(client);
> return -ENOMEM;
> }
> @@ -617,9 +618,8 @@ static int saa5249_probe(struct i2c_client *client,
> /* Register it */
> err = video_register_device(t->vdev, VFL_TYPE_VTX, -1);
> if (err < 0) {
> - kfree(t);
> video_device_release(t->vdev);
> - t->vdev = NULL;
> + kfree(t);
> return err;
> }
> return 0;
>
--
Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists