Commit f40139f
ublk: fix race between io_uring_cmd_complete_in_task and ublk_cancel_cmd
ublk_cancel_cmd() calls io_uring_cmd_done() to complete uring_cmd, but
we may have scheduled task work via io_uring_cmd_complete_in_task() for
dispatching request, then kernel crash can be triggered.
Fix it by not trying to canceling the command if ublk block request is
started.
Fixes: 216c8f5 ("ublk: replace monitor with cancelable uring_cmd")
Reported-by: Jared Holzman <[email protected]>
Tested-by: Jared Holzman <[email protected]>
Closes: https://lore.kernel.org/linux-block/[email protected]/
Signed-off-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>1 parent d6aa0c1 commit f40139f
1 file changed
+21
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1683 | 1683 | | |
1684 | 1684 | | |
1685 | 1685 | | |
1686 | | - | |
| 1686 | + | |
1687 | 1687 | | |
1688 | 1688 | | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
1689 | 1692 | | |
1690 | 1693 | | |
1691 | 1694 | | |
1692 | 1695 | | |
1693 | 1696 | | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
1694 | 1711 | | |
1695 | 1712 | | |
1696 | 1713 | | |
| |||
1722 | 1739 | | |
1723 | 1740 | | |
1724 | 1741 | | |
1725 | | - | |
1726 | 1742 | | |
1727 | 1743 | | |
1728 | 1744 | | |
| |||
1737 | 1753 | | |
1738 | 1754 | | |
1739 | 1755 | | |
1740 | | - | |
1741 | | - | |
1742 | | - | |
| 1756 | + | |
| 1757 | + | |
1743 | 1758 | | |
1744 | 1759 | | |
1745 | 1760 | | |
| |||
1752 | 1767 | | |
1753 | 1768 | | |
1754 | 1769 | | |
1755 | | - | |
| 1770 | + | |
1756 | 1771 | | |
1757 | 1772 | | |
1758 | 1773 | | |
| |||
0 commit comments