diff options
| author | Julia Lawall <julia@diku.dk> | 2008-05-12 17:02:16 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-13 11:02:24 -0400 |
| commit | 7a6278e5e4bce72ace681ae3cf48209fb63a5420 (patch) | |
| tree | ba1aba392096d9cffdb53a13d69cef225c2ec044 /drivers/video | |
| parent | 5aecd559871d23a3cc297e544c9d63f0b8441cf4 (diff) | |
drivers/video/pnx4008: eliminate double free
The function framebuffer_release just calls kfree, so calling kfree
subsequently on the same argument represents a double free. The comments with
the definition of framebuffer_release in drivers/video/fbsysfs.c suggest that
a more elaborate definition of this function is planned, such that the
splitting up of framebuffer_release and kfree as done in the second instance
might someday make sense, but it does not make sense now.
This was found using the following semantic match.
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
expression E;
@@
* kfree(E);
...
* framebuffer_release(E);
@@
expression E;
@@
* framebuffer_release(E);
...
* kfree(E);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Vitaly Wool <vitalywool@gmail.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: Grigory Tolstolytkin <gtolstolytkin@ru.mvista.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
| -rw-r--r-- | drivers/video/pnx4008/pnxrgbfb.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/video/pnx4008/pnxrgbfb.c b/drivers/video/pnx4008/pnxrgbfb.c index 685761a0732c..4db6b48a8715 100644 --- a/drivers/video/pnx4008/pnxrgbfb.c +++ b/drivers/video/pnx4008/pnxrgbfb.c | |||
| @@ -100,7 +100,6 @@ static int rgbfb_remove(struct platform_device *pdev) | |||
| 100 | fb_dealloc_cmap(&info->cmap); | 100 | fb_dealloc_cmap(&info->cmap); |
| 101 | framebuffer_release(info); | 101 | framebuffer_release(info); |
| 102 | platform_set_drvdata(pdev, NULL); | 102 | platform_set_drvdata(pdev, NULL); |
| 103 | kfree(info); | ||
| 104 | } | 103 | } |
| 105 | 104 | ||
| 106 | pnx4008_free_dum_channel(channel_owned, pdev->id); | 105 | pnx4008_free_dum_channel(channel_owned, pdev->id); |
| @@ -168,23 +167,21 @@ static int __devinit rgbfb_probe(struct platform_device *pdev) | |||
| 168 | 167 | ||
| 169 | ret = fb_alloc_cmap(&info->cmap, 256, 0); | 168 | ret = fb_alloc_cmap(&info->cmap, 256, 0); |
| 170 | if (ret < 0) | 169 | if (ret < 0) |
| 171 | goto err2; | 170 | goto err1; |
| 172 | 171 | ||
| 173 | ret = register_framebuffer(info); | 172 | ret = register_framebuffer(info); |
| 174 | if (ret < 0) | 173 | if (ret < 0) |
| 175 | goto err3; | 174 | goto err2; |
| 176 | platform_set_drvdata(pdev, info); | 175 | platform_set_drvdata(pdev, info); |
| 177 | 176 | ||
| 178 | return 0; | 177 | return 0; |
| 179 | 178 | ||
| 180 | err3: | ||
| 181 | fb_dealloc_cmap(&info->cmap); | ||
| 182 | err2: | 179 | err2: |
| 183 | framebuffer_release(info); | 180 | fb_dealloc_cmap(&info->cmap); |
| 184 | err1: | 181 | err1: |
| 185 | pnx4008_free_dum_channel(channel_owned, pdev->id); | 182 | pnx4008_free_dum_channel(channel_owned, pdev->id); |
| 186 | err0: | 183 | err0: |
| 187 | kfree(info); | 184 | framebuffer_release(info); |
| 188 | err: | 185 | err: |
| 189 | return ret; | 186 | return ret; |
| 190 | } | 187 | } |
