Commit 5607f5ed authored by Dan Carpenter's avatar Dan Carpenter Committed by Bartosz Golaszewski
Browse files

gpio: sysfs: Fix an end of loop test in gpiod_unexport()



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.

Fixes: 1cd53df7 ("gpio: sysfs: don't look up exported lines as class devices")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/747545bf-05f0-4f89-ba77-cb96bf9041f1@sabinyo.mountain


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent ae455b24
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment