Commit f0b8535
media: imx-jpeg: Fix potential error pointer dereference in detach_pm()
commit 1378ffe upstream.
The proble is on the first line:
if (jpeg->pd_dev[i] && !pm_runtime_suspended(jpeg->pd_dev[i]))
If jpeg->pd_dev[i] is an error pointer, then passing it to
pm_runtime_suspended() will lead to an Oops. The other conditions
check for both error pointers and NULL, but it would be more clear to
use the IS_ERR_OR_NULL() check for that.
Fixes: fd0af4c ("media: imx-jpeg: Ensure power suppliers be suspended before detach them")
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 1556b91 commit f0b8535
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2677 | 2677 | | |
2678 | 2678 | | |
2679 | 2679 | | |
2680 | | - | |
| 2680 | + | |
| 2681 | + | |
2681 | 2682 | | |
2682 | | - | |
| 2683 | + | |
2683 | 2684 | | |
2684 | | - | |
| 2685 | + | |
2685 | 2686 | | |
2686 | 2687 | | |
2687 | 2688 | | |
| |||
0 commit comments