Commit 35a3bb3
crypto: talitos - Prevent panic in probe error path
The probe error path for this driver, for all intents and purposes,
is the talitos_remove() function due to the common "goto err_out".
Without this patch applied, talitos_remove() will panic under these
two conditions:
1. If the RNG device hasn't been registered via
talitos_register_rng() prior to entry into talitos_remove(),
then the attempt to unregister the RNG "device" will cause a panic.
2. If the priv->chan array has not been allocated prior to entry
into talitos_remove(), then the per-channel FIFO cleanup will panic
because of the dereference of that NULL "array".
Both of the above scenarios occur if talitos_probe_irq() fails.
This patch resolves issue #1 by introducing a boolean to mask the
hwrng_unregister() call in talitos_unregister_rng() if RNG device
registration was unsuccessful.
It resolves issue #2 by checking that priv->chan is not NULL in the
per-channel FIFO cleanup for loop.
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>1 parent ab86ca0 commit 35a3bb3
2 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
| 769 | + | |
769 | 770 | | |
770 | 771 | | |
771 | 772 | | |
772 | 773 | | |
773 | 774 | | |
774 | 775 | | |
775 | 776 | | |
776 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
777 | 782 | | |
778 | 783 | | |
779 | 784 | | |
780 | 785 | | |
781 | 786 | | |
782 | 787 | | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
783 | 791 | | |
| 792 | + | |
784 | 793 | | |
785 | 794 | | |
786 | 795 | | |
| |||
2673 | 2682 | | |
2674 | 2683 | | |
2675 | 2684 | | |
2676 | | - | |
| 2685 | + | |
2677 | 2686 | | |
2678 | 2687 | | |
2679 | 2688 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
0 commit comments