Commit 4172385
media: dvb-core: Fix use-after-free due on race condition at dvb_net
A race condition may occur between the .disconnect function, which
is called when the device is disconnected, and the dvb_device_open()
function, which is called when the device node is open()ed.
This results in several types of UAFs.
The root cause of this is that you use the dvb_device_open() function,
which does not implement a conditional statement
that checks 'dvbnet->exit'.
So, add 'remove_mutex` to protect 'dvbnet->exit' and use
locked_dvb_net_open() function to check 'dvbnet->exit'.
[mchehab: fix a checkpatch warning]
Link: https://lore.kernel.org/linux-media/20221117045925.14297-3-imv4bel@gmail.com
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>1 parent 6769a0b commit 4172385
2 files changed
Lines changed: 39 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1564 | 1564 | | |
1565 | 1565 | | |
1566 | 1566 | | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1567 | 1588 | | |
1568 | 1589 | | |
1569 | 1590 | | |
1570 | 1591 | | |
1571 | 1592 | | |
| 1593 | + | |
| 1594 | + | |
1572 | 1595 | | |
1573 | 1596 | | |
1574 | | - | |
| 1597 | + | |
| 1598 | + | |
1575 | 1599 | | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
1576 | 1604 | | |
1577 | 1605 | | |
1578 | 1606 | | |
1579 | 1607 | | |
1580 | 1608 | | |
1581 | 1609 | | |
1582 | 1610 | | |
1583 | | - | |
| 1611 | + | |
1584 | 1612 | | |
1585 | 1613 | | |
1586 | 1614 | | |
| |||
1599 | 1627 | | |
1600 | 1628 | | |
1601 | 1629 | | |
| 1630 | + | |
1602 | 1631 | | |
| 1632 | + | |
| 1633 | + | |
1603 | 1634 | | |
1604 | 1635 | | |
1605 | | - | |
| 1636 | + | |
1606 | 1637 | | |
1607 | 1638 | | |
1608 | 1639 | | |
| |||
1621 | 1652 | | |
1622 | 1653 | | |
1623 | 1654 | | |
| 1655 | + | |
1624 | 1656 | | |
1625 | 1657 | | |
1626 | 1658 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| |||
0 commit comments