Skip to content

Commit

Permalink
hwspinlock: add a check of devm_regmap_field_alloc in qcom_hwspinlock…
Browse files Browse the repository at this point in the history
…_probe

devm_regmap_field_alloc may fails, priv field might be error pointer and
cause illegal address access later.

Signed-off-by: Kang Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
void0red authored and andersson committed Jul 15, 2023
1 parent 06c2afb commit 3c81195
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/hwspinlock/qcom_hwspinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)

bank->lock[i].priv = devm_regmap_field_alloc(&pdev->dev,
regmap, field);
if (IS_ERR(bank->lock[i].priv))
return PTR_ERR(bank->lock[i].priv);
}

return devm_hwspin_lock_register(&pdev->dev, bank, &qcom_hwspinlock_ops,
Expand Down

0 comments on commit 3c81195

Please sign in to comment.