Re: [PATCH net-next] ptr_ring: fix integer overflow

2018-01-29 Thread Jason Wang
On 2018年01月30日 01:01, David Miller wrote: From: Jason Wang Date: Thu, 25 Jan 2018 15:31:42 +0800 We try to allocate one more entry for lockless peeking. The adding operation may overflow which causes zero to be passed to kmalloc(). In this case, it returns ZERO_SIZE_PTR

Re: [PATCH net-next] ptr_ring: fix integer overflow

2018-01-29 Thread David Miller
From: Jason Wang Date: Thu, 25 Jan 2018 15:31:42 +0800 > We try to allocate one more entry for lockless peeking. The adding > 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

Re: [PATCH net-next] ptr_ring: fix integer overflow

2018-01-26 Thread Michael S. Tsirkin
On Fri, Jan 26, 2018 at 11:44:22AM +0800, Jason Wang wrote: > > > On 2018年01月26日 01:31, Michael S. Tsirkin wrote: > > On Thu, Jan 25, 2018 at 10:17:38PM +0800, Jason Wang wrote: > > > > > > On 2018年01月25日 21:45, Michael S. Tsirkin wrote: > > > > On Thu, Jan 25, 2018 at 03:31:42PM +0800, Jason

Re: [PATCH net-next] ptr_ring: fix integer overflow

2018-01-25 Thread Jason Wang
On 2018年01月26日 01:31, Michael S. Tsirkin wrote: On Thu, Jan 25, 2018 at 10:17:38PM +0800, Jason Wang wrote: On 2018年01月25日 21:45, Michael S. Tsirkin wrote: On Thu, Jan 25, 2018 at 03:31:42PM +0800, Jason Wang wrote: We try to allocate one more entry for lockless peeking. The adding

Re: [PATCH net-next] ptr_ring: fix integer overflow

2018-01-25 Thread Michael S. Tsirkin
On Thu, Jan 25, 2018 at 10:17:38PM +0800, Jason Wang wrote: > > > On 2018年01月25日 21:45, Michael S. Tsirkin wrote: > > On Thu, Jan 25, 2018 at 03:31:42PM +0800, Jason Wang wrote: > > > We try to allocate one more entry for lockless peeking. The adding > > > operation may overflow which causes

Re: [PATCH net-next] ptr_ring: fix integer overflow

2018-01-25 Thread Jason Wang
On 2018年01月25日 21:45, Michael S. Tsirkin wrote: On Thu, Jan 25, 2018 at 03:31:42PM +0800, Jason Wang wrote: We try to allocate one more entry for lockless peeking. The adding operation may overflow which causes zero to be passed to kmalloc(). In this case, it returns ZERO_SIZE_PTR without any

Re: [PATCH net-next] ptr_ring: fix integer overflow

2018-01-25 Thread Michael S. Tsirkin
On Thu, Jan 25, 2018 at 03:31:42PM +0800, Jason Wang wrote: > We try to allocate one more entry for lockless peeking. The adding > 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

[PATCH net-next] ptr_ring: fix integer overflow

2018-01-24 Thread Jason Wang
We try to allocate one more entry for lockless peeking. The adding 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