Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1633309 > unrolled thread

Re: [PATCH] w1: w1-gpio: Fix double-free of platform_data

Started byEvgeniy Polyakov <zbr@ioremap.net>
First post2017-04-29 18:50 +0200
Last post2017-04-29 18:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] w1: w1-gpio: Fix double-free of platform_data Evgeniy Polyakov <zbr@ioremap.net> - 2017-04-29 18:50 +0200

#1633309 — Re: [PATCH] w1: w1-gpio: Fix double-free of platform_data

FromEvgeniy Polyakov <zbr@ioremap.net>
Date2017-04-29 18:50 +0200
SubjectRe: [PATCH] w1: w1-gpio: Fix double-free of platform_data
Message-ID<tBDJf-c0-5@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web