Skip to content

Commit 26783d7

Browse files
Dan CarpenterLee Jones
authored andcommitted
mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq()
The "req" struct is always added to the "wm831x->auxadc_pending" list, but it's only removed from the list on the success path. If a failure occurs then the "req" struct is freed but it's still on the list, leading to a use after free. Fixes: 78bb368 ("mfd: Support multiple active WM831x AUXADC conversions") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 6a8fac0 commit 26783d7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/mfd/wm831x-auxadc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ static int wm831x_auxadc_read_irq(struct wm831x *wm831x,
9393
wait_for_completion_timeout(&req->done, msecs_to_jiffies(500));
9494

9595
mutex_lock(&wm831x->auxadc_lock);
96-
97-
list_del(&req->list);
9896
ret = req->val;
9997

10098
out:
99+
list_del(&req->list);
101100
mutex_unlock(&wm831x->auxadc_lock);
102101

103102
kfree(req);

0 commit comments

Comments
 (0)