Commit 8a12f88
net: hso: fix null-ptr-deref during tty device unregistration
Multiple ttys try to claim the same the minor number causing a double
unregistration of the same device. The first unregistration succeeds
but the next one results in a null-ptr-deref.
The get_free_serial_index() function returns an available minor number
but doesn't assign it immediately. The assignment is done by the caller
later. But before this assignment, calls to get_free_serial_index()
would return the same minor number.
Fix this by modifying get_free_serial_index to assign the minor number
immediately after one is found to be and rename it to obtain_minor()
to better reflect what it does. Similary, rename set_serial_by_index()
to release_minor() and modify it to free up the minor number of the
given hso_serial. Every obtain_minor() should have corresponding
release_minor() call.
Fixes: 72dc1c0 ("HSO: add option hso driver")
Reported-by: [email protected]
Tested-by: [email protected]
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Anirudh Rayabharam <[email protected]>
Signed-off-by: David S. Miller <[email protected]>1 parent 5d1dbac commit 8a12f88
1 file changed
Lines changed: 12 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
| 614 | + | |
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| 622 | + | |
| 623 | + | |
622 | 624 | | |
623 | | - | |
| 625 | + | |
624 | 626 | | |
625 | 627 | | |
626 | 628 | | |
| |||
629 | 631 | | |
630 | 632 | | |
631 | 633 | | |
632 | | - | |
| 634 | + | |
633 | 635 | | |
634 | 636 | | |
635 | 637 | | |
636 | 638 | | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
| 639 | + | |
641 | 640 | | |
642 | 641 | | |
643 | 642 | | |
| |||
2230 | 2229 | | |
2231 | 2230 | | |
2232 | 2231 | | |
| 2232 | + | |
2233 | 2233 | | |
2234 | 2234 | | |
2235 | 2235 | | |
| |||
2253 | 2253 | | |
2254 | 2254 | | |
2255 | 2255 | | |
2256 | | - | |
2257 | 2256 | | |
2258 | 2257 | | |
2259 | 2258 | | |
2260 | 2259 | | |
2261 | | - | |
2262 | | - | |
| 2260 | + | |
2263 | 2261 | | |
2264 | 2262 | | |
2265 | 2263 | | |
2266 | 2264 | | |
2267 | | - | |
| 2265 | + | |
2268 | 2266 | | |
2269 | | - | |
| 2267 | + | |
| 2268 | + | |
2270 | 2269 | | |
| 2270 | + | |
2271 | 2271 | | |
2272 | | - | |
2273 | | - | |
2274 | 2272 | | |
2275 | 2273 | | |
2276 | 2274 | | |
| |||
2667 | 2665 | | |
2668 | 2666 | | |
2669 | 2667 | | |
2670 | | - | |
2671 | | - | |
2672 | | - | |
2673 | 2668 | | |
2674 | 2669 | | |
2675 | 2670 | | |
| |||
2726 | 2721 | | |
2727 | 2722 | | |
2728 | 2723 | | |
2729 | | - | |
2730 | | - | |
2731 | | - | |
2732 | 2724 | | |
2733 | 2725 | | |
2734 | 2726 | | |
| |||
3113 | 3105 | | |
3114 | 3106 | | |
3115 | 3107 | | |
3116 | | - | |
3117 | 3108 | | |
3118 | 3109 | | |
3119 | 3110 | | |
| |||
0 commit comments