mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 15:11:50 +00:00
gpio: potential null dereference
Smatch found a potential null dereference in gpio_setup_irq(). The "pdesc" variable is allocated with idr_find() that can return NULL. If gpio_setup_irq() is called with 0 as gpio_flags and "pdesc" is null, it would OOPs here. Signed-off-by: Dan Carpenter <error27@gmail.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
01bf0b6457
commit
3913fd5ed4
@ -416,6 +416,7 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
|
||||
return 0;
|
||||
|
||||
free_sd:
|
||||
if (pdesc)
|
||||
sysfs_put(pdesc->value_sd);
|
||||
free_id:
|
||||
idr_remove(&pdesc_idr, id);
|
||||
|
Loading…
Reference in New Issue
Block a user