Commit 343d7fe
smb: client: fix use-after-free of signing key
Customers have reported use-after-free in @ses->auth_key.response with
SMB2.1 + sign mounts which occurs due to following race:
task A task B
cifs_mount()
dfs_mount_share()
get_session()
cifs_mount_get_session() cifs_send_recv()
cifs_get_smb_ses() compound_send_recv()
cifs_setup_session() smb2_setup_request()
kfree_sensitive() smb2_calc_signature()
crypto_shash_setkey() *UAF*
Fix this by ensuring that we have a valid @ses->auth_key.response by
checking whether @ses->ses_status is SES_GOOD or SES_EXITING with
@ses->ses_lock held. After commit 24a9799 ("smb: client: fix UAF
in smb2_reconnect_server()"), we made sure to call ->logoff() only
when @SES was known to be good (e.g. valid ->auth_key.response), so
it's safe to access signing key when @ses->ses_status == SES_EXITING.
Cc: [email protected]
Reported-by: Jay Shin <[email protected]>
Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]>
Signed-off-by: Steve French <[email protected]>1 parent 7460bf4 commit 343d7fe
2 files changed
+40
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
172 | | - | |
| 171 | + | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | 180 | | |
177 | | - | |
178 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
181 | 206 | | |
182 | 207 | | |
183 | 208 | | |
| |||
236 | 261 | | |
237 | 262 | | |
238 | 263 | | |
239 | | - | |
240 | 264 | | |
241 | 265 | | |
| 266 | + | |
| 267 | + | |
242 | 268 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
247 | 274 | | |
248 | 275 | | |
249 | 276 | | |
| |||
260 | 287 | | |
261 | 288 | | |
262 | 289 | | |
263 | | - | |
264 | | - | |
| 290 | + | |
265 | 291 | | |
266 | 292 | | |
267 | 293 | | |
| |||
303 | 329 | | |
304 | 330 | | |
305 | 331 | | |
306 | | - | |
307 | | - | |
308 | 332 | | |
309 | 333 | | |
310 | 334 | | |
| |||
570 | 594 | | |
571 | 595 | | |
572 | 596 | | |
573 | | - | |
| 597 | + | |
574 | 598 | | |
575 | 599 | | |
576 | 600 | | |
| |||
0 commit comments