Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1633309
| From | Evgeniy Polyakov <zbr@ioremap.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] w1: w1-gpio: Fix double-free of platform_data |
| Date | 2017-04-29 18:50 +0200 |
| Message-ID | <tBDJf-c0-5@gated-at.bofh.it> (permalink) |
| References | <toXw5-3WR-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Alexey
25.03.2017, 20:08, "Alexey Ignatov" <lexszero@gmail.com>:
> struct w1_gpio_platform_data was allocated using devres when using
> device tree. Then it was assigned to dev.platform_data, which leaded
> to double free on device removal by devres and by direct
> kfree(platform_data) in platform_device_release)
If this patch is still relevant, please add someone from device-tree into copy, I would think this bug
affect anyone and we see alot of bug reports since probe failure ends up with double free.
Also a nit:
> @@ -143,12 +141,12 @@ static int w1_gpio_probe(struct platform_device *pdev)
> int err;
>
> if (of_have_populated_dt()) {
> - err = w1_gpio_probe_dt(pdev);
> - if (err < 0)
> - return err;
> + pdata = w1_gpio_probe_dt(pdev);
> + if (IS_ERR(pdata) < 0)
> + return PTR_ERR(pdata);
IS_ERR() should not be used this way
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH] w1: w1-gpio: Fix double-free of platform_data Evgeniy Polyakov <zbr@ioremap.net> - 2017-04-29 18:50 +0200
csiph-web