Re: [PATCH] vhost: Add a defensive check in vhost_commit against wrong deallocation

2023-10-03 Thread Eric Auger
Hi Michael, On 10/3/23 14:43, Michael S. Tsirkin wrote: > On Wed, Sep 13, 2023 at 09:46:57AM +0200, Eric Auger wrote: >> In vhost_commit(), it may happen that dev->mem_sections and >> dev->tmp_sections are equal, > Could you please explain a bit more how this can happen? > I don't see how. > >> in

Re: [PATCH] vhost: Add a defensive check in vhost_commit against wrong deallocation

2023-10-03 Thread Michael S. Tsirkin
On Wed, Sep 13, 2023 at 09:46:57AM +0200, Eric Auger wrote: > In vhost_commit(), it may happen that dev->mem_sections and > dev->tmp_sections are equal, Could you please explain a bit more how this can happen? I don't see how. > in which case, unconditionally > freeing old_sections at the end of

Re: [PATCH] vhost: Add a defensive check in vhost_commit against wrong deallocation

2023-09-14 Thread Eric Auger
Hi Jason, On 9/14/23 05:46, Jason Wang wrote: > On Wed, Sep 13, 2023 at 3:47 PM Eric Auger wrote: >> In vhost_commit(), it may happen that dev->mem_sections and >> dev->tmp_sections are equal, in which case, unconditionally >> freeing old_sections at the end of the function will also free >> dev-

Re: [PATCH] vhost: Add a defensive check in vhost_commit against wrong deallocation

2023-09-13 Thread Jason Wang
On Wed, Sep 13, 2023 at 3:47 PM Eric Auger wrote: > > In vhost_commit(), it may happen that dev->mem_sections and > dev->tmp_sections are equal, in which case, unconditionally > freeing old_sections at the end of the function will also free > dev->mem_sections used on subsequent call leading to a

[PATCH] vhost: Add a defensive check in vhost_commit against wrong deallocation

2023-09-13 Thread Eric Auger
In vhost_commit(), it may happen that dev->mem_sections and dev->tmp_sections are equal, in which case, unconditionally freeing old_sections at the end of the function will also free dev->mem_sections used on subsequent call leading to a segmentation fault. Check this situation before deallocating