Commit 2d859af
committed
Merge branch 'do-not-leave-dangling-sk-pointers-in-pf-create-functions'
Ignat Korchagin says:
====================
do not leave dangling sk pointers in pf->create functions
Some protocol family create() implementations have an error path after
allocating the sk object and calling sock_init_data(). sock_init_data()
attaches the allocated sk object to the sock object, provided by the
caller.
If the create() implementation errors out after calling sock_init_data(),
it releases the allocated sk object, but the caller ends up having a
dangling sk pointer in its sock object on return. Subsequent manipulations
on this sock object may try to access the sk pointer, because it is not
NULL thus creating a use-after-free scenario.
We have implemented a stable hotfix in commit 6310831
("net: explicitly clear the sk pointer, when pf->create fails"), but this
series aims to fix it properly by going through each of the pf->create()
implementations and making sure they all don't return a sock object with
a dangling pointer on error.
====================
Link: https://patch.msgid.link/20241014153808.51894-1-ignat@cloudflare.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>File tree
9 files changed
+42
-45
lines changed- net
- bluetooth
- rfcomm
- can
- core
- ieee802154
- ipv4
- ipv6
- packet
9 files changed
+42
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1886 | 1886 | | |
1887 | 1887 | | |
1888 | 1888 | | |
| 1889 | + | |
1889 | 1890 | | |
1890 | 1891 | | |
1891 | 1892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
| 277 | + | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
282 | | - | |
283 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3827 | 3827 | | |
3828 | 3828 | | |
3829 | 3829 | | |
3830 | | - | |
3831 | | - | |
3832 | | - | |
3833 | 3830 | | |
3834 | 3831 | | |
3835 | 3832 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1043 | 1043 | | |
1044 | 1044 | | |
1045 | 1045 | | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
| 1046 | + | |
| 1047 | + | |
1050 | 1048 | | |
1051 | 1049 | | |
1052 | 1050 | | |
1053 | 1051 | | |
1054 | 1052 | | |
1055 | | - | |
| 1053 | + | |
1056 | 1054 | | |
1057 | 1055 | | |
1058 | 1056 | | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
1059 | 1061 | | |
1060 | 1062 | | |
1061 | 1063 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
| 379 | + | |
| 380 | + | |
383 | 381 | | |
384 | 382 | | |
385 | 383 | | |
386 | 384 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
| 385 | + | |
| 386 | + | |
391 | 387 | | |
392 | 388 | | |
393 | 389 | | |
394 | 390 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
| 391 | + | |
| 392 | + | |
399 | 393 | | |
400 | 394 | | |
401 | 395 | | |
402 | 396 | | |
403 | 397 | | |
404 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
405 | 403 | | |
406 | 404 | | |
407 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 255 | + | |
| 256 | + | |
259 | 257 | | |
260 | 258 | | |
261 | 259 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
| 260 | + | |
| 261 | + | |
266 | 262 | | |
267 | 263 | | |
268 | 264 | | |
269 | 265 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 266 | + | |
| 267 | + | |
274 | 268 | | |
275 | 269 | | |
276 | 270 | | |
277 | 271 | | |
278 | 272 | | |
279 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
280 | 278 | | |
281 | 279 | | |
282 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3422 | 3422 | | |
3423 | 3423 | | |
3424 | 3424 | | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
3425 | 3430 | | |
3426 | 3431 | | |
3427 | | - | |
3428 | 3432 | | |
3429 | 3433 | | |
3430 | 3434 | | |
3431 | 3435 | | |
3432 | | - | |
3433 | | - | |
3434 | | - | |
3435 | | - | |
3436 | 3436 | | |
3437 | 3437 | | |
3438 | 3438 | | |
| |||
3464 | 3464 | | |
3465 | 3465 | | |
3466 | 3466 | | |
3467 | | - | |
| 3467 | + | |
3468 | 3468 | | |
3469 | 3469 | | |
3470 | 3470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1576 | 1576 | | |
1577 | 1577 | | |
1578 | 1578 | | |
1579 | | - | |
| 1579 | + | |
1580 | 1580 | | |
1581 | | - | |
| 1581 | + | |
1582 | 1582 | | |
1583 | 1583 | | |
1584 | 1584 | | |
| |||
0 commit comments