Commit 7c39f48
media: uvcvideo: Fix bug in error path of uvc_alloc_urb_buffers
Recent cleanup introduced a bug in the error path of
uvc_alloc_urb_buffers(). If there is not enough memory for the
allocation the following error will be triggered:
[ 739.196672] UBSAN: shift-out-of-bounds in mm/page_alloc.c:1403:22
[ 739.196710] shift exponent 52 is too large for 32-bit type 'int'
Resulting in:
[ 740.464422] BUG: unable to handle page fault for address: fffffac1c0800000
The reason for the bug is that usb_free_noncoherent is called with an
invalid size (0) instead of the actual size of the urb.
This patch takes care of that.
Reported-by: Marek Marczykowski-Górecki <[email protected]>
Closes: https://lore.kernel.org/linux-media/abycbXzYupZpGkvR@hyeyoo/T/#t
Tested-by: Marek Marczykowski-Górecki <[email protected]>
Fixes: c824345 ("media: uvcvideo: Pass allocation size directly to uvc_alloc_urb_buffer")
Signed-off-by: Ricardo Ribalda <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Laurent Pinchart <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>1 parent e8d97c2 commit 7c39f48
1 file changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1751 | 1751 | | |
1752 | 1752 | | |
1753 | 1753 | | |
1754 | | - | |
| 1754 | + | |
| 1755 | + | |
1755 | 1756 | | |
1756 | 1757 | | |
1757 | 1758 | | |
| |||
1760 | 1761 | | |
1761 | 1762 | | |
1762 | 1763 | | |
1763 | | - | |
| 1764 | + | |
1764 | 1765 | | |
1765 | 1766 | | |
1766 | 1767 | | |
| |||
1820 | 1821 | | |
1821 | 1822 | | |
1822 | 1823 | | |
1823 | | - | |
| 1824 | + | |
1824 | 1825 | | |
1825 | 1826 | | |
1826 | 1827 | | |
| |||
1868 | 1869 | | |
1869 | 1870 | | |
1870 | 1871 | | |
1871 | | - | |
| 1872 | + | |
1872 | 1873 | | |
1873 | 1874 | | |
1874 | 1875 | | |
| |||
0 commit comments