On Thu, Jan 25, 2018 at 03:31:42PM +0800, Jason Wang wrote:
We try to allocate one more entry for lockless peeking. The addingUgh that's just way too ugly.
operation may overflow which causes zero to be passed to kmalloc().
In this case, it returns ZERO_SIZE_PTR without any notice by ptr
ring. Try to do producing or consuming on such ring will lead NULL
dereference. Fix this detect and fail early.
Fixes: bcecb4bbf88a ("net: ptr_ring: otherwise safe empty checks can overrun array bounds")
Reported-by:syzbot+87678bcf753b44c39b67@xxxxxxxxxxxxxxxxxxxxxxxxx
Cc: John Fastabend<john.fastabend@xxxxxxxxx>
Signed-off-by: Jason Wang<jasowang@xxxxxxxxxx>
I'll work on dropping the extra + 1 - but calling this
function with -1 size is the real source of the bug.
Do you know how come we do that?