Commit b76449e
fbdev: smscufx: fix error handling code in ufx_usb_probe
The current error handling code in ufx_usb_probe have many unmatching
issues, e.g., missing ufx_free_usb_list, destroy_modedb label should
only include framebuffer_release, fb_dealloc_cmap only matches
fb_alloc_cmap.
My local syzkaller reports a memory leak bug:
memory leak in ufx_usb_probe
BUG: memory leak
unreferenced object 0xffff88802f879580 (size 128):
comm "kworker/0:7", pid 17416, jiffies 4295067474 (age 46.710s)
hex dump (first 32 bytes):
80 21 7c 2e 80 88 ff ff 18 d0 d0 0c 80 88 ff ff .!|.............
00 d0 d0 0c 80 88 ff ff e0 ff ff ff 0f 00 00 00 ................
backtrace:
[<ffffffff814c99a0>] kmalloc_trace+0x20/0x90 mm/slab_common.c:1045
[<ffffffff824d219c>] kmalloc include/linux/slab.h:553 [inline]
[<ffffffff824d219c>] kzalloc include/linux/slab.h:689 [inline]
[<ffffffff824d219c>] ufx_alloc_urb_list drivers/video/fbdev/smscufx.c:1873 [inline]
[<ffffffff824d219c>] ufx_usb_probe+0x11c/0x15a0 drivers/video/fbdev/smscufx.c:1655
[<ffffffff82d17927>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
[<ffffffff82712f0d>] call_driver_probe drivers/base/dd.c:560 [inline]
[<ffffffff82712f0d>] really_probe+0x12d/0x390 drivers/base/dd.c:639
[<ffffffff8271322f>] __driver_probe_device+0xbf/0x140 drivers/base/dd.c:778
[<ffffffff827132da>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:808
[<ffffffff82713c27>] __device_attach_driver+0xf7/0x150 drivers/base/dd.c:936
[<ffffffff82710137>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:427
[<ffffffff827136b5>] __device_attach+0x105/0x2d0 drivers/base/dd.c:1008
[<ffffffff82711d36>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:487
[<ffffffff8270e242>] device_add+0x642/0xdc0 drivers/base/core.c:3517
[<ffffffff82d14d5f>] usb_set_configuration+0x8ef/0xb80 drivers/usb/core/message.c:2170
[<ffffffff82d2576c>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
[<ffffffff82d16ffc>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
[<ffffffff82712f0d>] call_driver_probe drivers/base/dd.c:560 [inline]
[<ffffffff82712f0d>] really_probe+0x12d/0x390 drivers/base/dd.c:639
[<ffffffff8271322f>] __driver_probe_device+0xbf/0x140 drivers/base/dd.c:778
Fix this bug by rewriting the error handling code in ufx_usb_probe.
Reported-by: syzkaller <syzkaller@googlegroups.com>
Tested-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Helge Deller <deller@gmx.de>1 parent 5886b13 commit b76449e
1 file changed
Lines changed: 31 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1622 | 1622 | | |
1623 | 1623 | | |
1624 | 1624 | | |
1625 | | - | |
| 1625 | + | |
1626 | 1626 | | |
1627 | 1627 | | |
1628 | 1628 | | |
| |||
1654 | 1654 | | |
1655 | 1655 | | |
1656 | 1656 | | |
1657 | | - | |
| 1657 | + | |
1658 | 1658 | | |
1659 | 1659 | | |
1660 | 1660 | | |
1661 | 1661 | | |
1662 | 1662 | | |
1663 | 1663 | | |
1664 | | - | |
1665 | | - | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
1666 | 1668 | | |
1667 | 1669 | | |
1668 | 1670 | | |
| |||
1705 | 1707 | | |
1706 | 1708 | | |
1707 | 1709 | | |
1708 | | - | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
1709 | 1714 | | |
1710 | 1715 | | |
1711 | 1716 | | |
1712 | 1717 | | |
1713 | 1718 | | |
1714 | 1719 | | |
1715 | | - | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
1716 | 1724 | | |
1717 | 1725 | | |
1718 | 1726 | | |
1719 | | - | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
1720 | 1731 | | |
1721 | 1732 | | |
1722 | 1733 | | |
1723 | | - | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
1724 | 1738 | | |
1725 | 1739 | | |
1726 | 1740 | | |
1727 | 1741 | | |
1728 | 1742 | | |
1729 | 1743 | | |
1730 | 1744 | | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
1734 | 1748 | | |
1735 | 1749 | | |
1736 | 1750 | | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
1737 | 1754 | | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
1738 | 1758 | | |
1739 | 1759 | | |
1740 | 1760 | | |
1741 | 1761 | | |
1742 | | - | |
1743 | | - | |
1744 | | - | |
1745 | | - | |
1746 | 1762 | | |
1747 | 1763 | | |
1748 | 1764 | | |
| |||
0 commit comments