Commit 6ed8bfd
slab: Avoid race on slab->obj_exts in alloc_slab_obj_exts
If two competing threads enter alloc_slab_obj_exts() and one of them
fails to allocate the object extension vector, it might override the
valid slab->obj_exts allocated by the other thread with
OBJEXTS_ALLOC_FAIL. This will cause the thread that lost this race and
expects a valid pointer to dereference a NULL pointer later on.
Update slab->obj_exts atomically using cmpxchg() to avoid
slab->obj_exts overrides by racing threads.
Thanks for Vlastimil and Suren's help with debugging.
Fixes: f7381b9 ("slab: mark slab->obj_exts allocation failures unconditionally")
Cc: <[email protected]>
Suggested-by: Suren Baghdasaryan <[email protected]>
Signed-off-by: Hao Ge <[email protected]>
Reviewed-by: Harry Yoo <[email protected]>
Reviewed-by: Suren Baghdasaryan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Vlastimil Babka <[email protected]>1 parent 86f54f9 commit 6ed8bfd
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2054 | 2054 | | |
2055 | 2055 | | |
2056 | 2056 | | |
2057 | | - | |
| 2057 | + | |
2058 | 2058 | | |
2059 | 2059 | | |
2060 | 2060 | | |
| |||
2136 | 2136 | | |
2137 | 2137 | | |
2138 | 2138 | | |
| 2139 | + | |
2139 | 2140 | | |
2140 | 2141 | | |
2141 | 2142 | | |
| |||
2145 | 2146 | | |
2146 | 2147 | | |
2147 | 2148 | | |
2148 | | - | |
2149 | | - | |
| 2149 | + | |
2150 | 2150 | | |
2151 | 2151 | | |
2152 | 2152 | | |
| |||
2158 | 2158 | | |
2159 | 2159 | | |
2160 | 2160 | | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
2161 | 2164 | | |
2162 | 2165 | | |
2163 | 2166 | | |
| |||
0 commit comments