Commit cf20397
committed
firmware: qcom: scm: Cleanup global '__scm' on probe failures
JIRA: https://issues.redhat.com/browse/RHEL-117514
commit 1e76b54
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date: Mon Dec 9 15:27:57 2024 +0100
firmware: qcom: scm: Cleanup global '__scm' on probe failures
If SCM driver fails the probe, it should not leave global '__scm'
variable assigned, because external users of this driver will assume the
probe finished successfully. For example TZMEM parts ('__scm->mempool')
are initialized later in the probe, but users of it (__scm_smc_call())
rely on the '__scm' variable.
This fixes theoretical NULL pointer exception, triggered via introducing
probe deferral in SCM driver with call trace:
qcom_tzmem_alloc+0x70/0x1ac (P)
qcom_tzmem_alloc+0x64/0x1ac (L)
qcom_scm_assign_mem+0x78/0x194
qcom_rmtfs_mem_probe+0x2d4/0x38c
platform_probe+0x68/0xc8
Fixes: 40289e3 ("firmware: qcom: scm: enable the TZ mem allocator")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20241209-qcom-scm-missing-barriers-and-all-sort-of-srap-v2-4-9061013c8d92@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Eric Chanudet <echanude@redhat.com>1 parent fd03ebb commit cf20397
1 file changed
+29
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2038 | 2038 | | |
2039 | 2039 | | |
2040 | 2040 | | |
2041 | | - | |
2042 | | - | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
2043 | 2045 | | |
2044 | 2046 | | |
2045 | 2047 | | |
2046 | | - | |
2047 | | - | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
2048 | 2052 | | |
2049 | 2053 | | |
2050 | 2054 | | |
| |||
2063 | 2067 | | |
2064 | 2068 | | |
2065 | 2069 | | |
2066 | | - | |
2067 | | - | |
2068 | | - | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
2069 | 2075 | | |
2070 | 2076 | | |
2071 | | - | |
2072 | | - | |
2073 | | - | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
2074 | 2082 | | |
2075 | 2083 | | |
2076 | 2084 | | |
2077 | 2085 | | |
2078 | 2086 | | |
2079 | 2087 | | |
2080 | 2088 | | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
2084 | 2094 | | |
2085 | 2095 | | |
2086 | 2096 | | |
| |||
2096 | 2106 | | |
2097 | 2107 | | |
2098 | 2108 | | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
2099 | 2115 | | |
2100 | 2116 | | |
2101 | 2117 | | |
| |||
0 commit comments