Commit 31c07df
net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn()
Sili Luo reported a race in nfc_llcp_sock_get(), leading to UAF.
Getting a reference on the socket found in a lookup while
holding a lock should happen before releasing the lock.
nfc_llcp_sock_get_sn() has a similar problem.
Finally nfc_llcp_recv_snl() needs to make sure the socket
found by nfc_llcp_sock_from_sn() does not disappear.
Fixes: 8f50020 ("NFC: LLCP late binding")
Reported-by: Sili Luo <rootlab@huawei.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231009123110.3735515-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 5093bbf commit 31c07df
1 file changed
Lines changed: 12 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | 213 | | |
218 | 214 | | |
219 | 215 | | |
| |||
346 | 342 | | |
347 | 343 | | |
348 | 344 | | |
349 | | - | |
| 345 | + | |
| 346 | + | |
350 | 347 | | |
351 | 348 | | |
352 | 349 | | |
| |||
382 | 379 | | |
383 | 380 | | |
384 | 381 | | |
| 382 | + | |
| 383 | + | |
385 | 384 | | |
386 | 385 | | |
387 | 386 | | |
| |||
423 | 422 | | |
424 | 423 | | |
425 | 424 | | |
426 | | - | |
| 425 | + | |
| 426 | + | |
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
| 827 | + | |
837 | 828 | | |
838 | 829 | | |
839 | 830 | | |
| |||
1298 | 1289 | | |
1299 | 1290 | | |
1300 | 1291 | | |
1301 | | - | |
| 1292 | + | |
| 1293 | + | |
1302 | 1294 | | |
1303 | 1295 | | |
1304 | 1296 | | |
| |||
1318 | 1310 | | |
1319 | 1311 | | |
1320 | 1312 | | |
| 1313 | + | |
1321 | 1314 | | |
1322 | 1315 | | |
1323 | 1316 | | |
| |||
1335 | 1328 | | |
1336 | 1329 | | |
1337 | 1330 | | |
| 1331 | + | |
1338 | 1332 | | |
1339 | 1333 | | |
1340 | 1334 | | |
| |||
0 commit comments