[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <175294121708.8606.9732156006120686279.b4-ty@linaro.org>
Date: Sat, 19 Jul 2025 18:08:12 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH next] gpio: sysfs: Fix an end of loop test in gpiod_unexport()
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
On Fri, 18 Jul 2025 16:22:15 -0500, Dan Carpenter wrote:
> The test for "if (!desc_data)" does not work correctly because the list
> iterator in a list_for_each_entry() loop is always non-NULL. If we don't
> exit via a break, then it points to invalid memory. Instead, use a tmp
> variable for the list iterator and only set the "desc_data" when we have
> found a match.
>
>
> [...]
Thanks for catching it. This is not obvious because in normal circumstances
we'll always find a matching descriptor and exit the loop via break so it's
hard to trigger a bug this way. Anyway, the patch is correct so applied.
[1/1] gpio: sysfs: Fix an end of loop test in gpiod_unexport()
https://git.kernel.org/brgl/linux/c/5607f5ed3c5f30f41e72ce09c8e616af0fc0d474
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Powered by blists - more mailing lists