Commit c7e2c18
net: rose: include node references in rose_neigh refcount
[ Upstream commit da9c9c8 ]
Current implementation maintains two separate reference counting
mechanisms: the 'count' field in struct rose_neigh tracks references from
rose_node structures, while the 'use' field (now refcount_t) tracks
references from rose_sock.
This patch merges these two reference counting systems using 'use' field
for proper reference management. Specifically, this patch adds incrementing
and decrementing of rose_neigh->use when rose_neigh->count is incremented
or decremented.
This patch also modifies rose_rt_free(), rose_rt_device_down() and
rose_clear_route() to properly release references to rose_neigh objects
before freeing a rose_node through rose_remove_node().
These changes ensure rose_neigh structures are properly freed only when
all references, including those from rose_node structures, are released.
As a result, this resolves a slab-use-after-free issue reported by Syzbot.
Fixes: 1da177e ("Linux-2.6.12-rc2")
Reported-by: syzbot+942297eecf7d2d61d1f1@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=942297eecf7d2d61d1f1
Signed-off-by: Takamitsu Iwai <takamitz@amazon.co.jp>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250823085857.47674-4-takamitz@amazon.co.jp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9c547c8eee9d1cf6e744611d688b9f725cf9a115)1 parent 3bf1ebd commit c7e2c18
1 file changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| |||
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| |||
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
| 327 | + | |
325 | 328 | | |
326 | 329 | | |
327 | 330 | | |
| |||
430 | 433 | | |
431 | 434 | | |
432 | 435 | | |
| 436 | + | |
433 | 437 | | |
434 | 438 | | |
435 | 439 | | |
| |||
461 | 465 | | |
462 | 466 | | |
463 | 467 | | |
| 468 | + | |
464 | 469 | | |
465 | 470 | | |
466 | 471 | | |
| |||
500 | 505 | | |
501 | 506 | | |
502 | 507 | | |
| 508 | + | |
503 | 509 | | |
504 | 510 | | |
505 | 511 | | |
| |||
543 | 549 | | |
544 | 550 | | |
545 | 551 | | |
| 552 | + | |
546 | 553 | | |
547 | 554 | | |
548 | 555 | | |
| |||
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
556 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
557 | 567 | | |
| 568 | + | |
558 | 569 | | |
559 | 570 | | |
560 | 571 | | |
| |||
1189 | 1200 | | |
1190 | 1201 | | |
1191 | 1202 | | |
1192 | | - | |
| 1203 | + | |
1193 | 1204 | | |
1194 | 1205 | | |
1195 | 1206 | | |
| |||
1294 | 1305 | | |
1295 | 1306 | | |
1296 | 1307 | | |
| 1308 | + | |
1297 | 1309 | | |
1298 | 1310 | | |
1299 | 1311 | | |
| |||
1307 | 1319 | | |
1308 | 1320 | | |
1309 | 1321 | | |
| 1322 | + | |
| 1323 | + | |
1310 | 1324 | | |
1311 | 1325 | | |
1312 | 1326 | | |
| |||
0 commit comments