Commit 40d3ac2
media: uvcvideo: Fix allocation for small frame sizes
If a frame has size of less or equal than one packet size
uvc_alloc_urb_buffers() is unable to allocate memory for it due to a
off-by-one error.
Fix the off-by-one-error and now that we are at it, make sure that
stream->urb_size has always a valid value when we return from the
function, even when an error happens.
Fixes: efdc8a9 ("V4L/DVB (10295): uvcvideo: Retry URB buffers allocation when the system is low on memory.")
Reported-by: Itay Chamiel <[email protected]>
Closes: https://lore.kernel.org/linux-media/CANiDSCsSoZf2LsCCoWAUbCg6tJT-ypXR1B85aa6rAdMVYr2iBQ@mail.gmail.com/T/#t
Co-developed-by: Itay Chamiel <[email protected]>
Signed-off-by: Itay Chamiel <[email protected]>
Signed-off-by: Ricardo Ribalda <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Tested-by: Itay Chamiel <[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 4cf3b6f commit 40d3ac2
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1812 | 1812 | | |
1813 | 1813 | | |
1814 | 1814 | | |
1815 | | - | |
| 1815 | + | |
1816 | 1816 | | |
1817 | 1817 | | |
1818 | 1818 | | |
| |||
1837 | 1837 | | |
1838 | 1838 | | |
1839 | 1839 | | |
| 1840 | + | |
1840 | 1841 | | |
1841 | 1842 | | |
1842 | 1843 | | |
| |||
0 commit comments