Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Peter Maydell
On Tue, 24 Mar 2020 at 12:57, Yuval Shaia wrote: > So what i can do is to check list->list at every API since destroy > functions sets it to NULL. No, that won't help. You can't check list->list for NULL without taking the lock (because in the append etc functions you really could be multithreade

Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Yuval Shaia
On Tue, 24 Mar 2020 at 13:55, Peter Maydell wrote: > On Tue, 24 Mar 2020 at 11:25, Yuval Shaia > wrote: > > As i already said, current code makes sure it will not happen > > however it better that API will ensure this and will not trust callers. > > I agree with the principle, but I think that h

Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Yuval Shaia
On Tue, 24 Mar 2020 at 13:25, Peter Maydell wrote: > On Tue, 24 Mar 2020 at 11:18, Marcel Apfelbaum > wrote: > > > > Hi Peter,Yuval > > > > On 3/24/20 1:05 PM, Peter Maydell wrote: > > > So I think we require that the user of a protected-qlist > > > ensures that there are no more users of it bef

Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Peter Maydell
On Tue, 24 Mar 2020 at 11:25, Yuval Shaia wrote: > As i already said, current code makes sure it will not happen > however it better that API will ensure this and will not trust callers. I agree with the principle, but I think that here there is no way to do it -- if you are literally destroying

Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Yuval Shaia
On Tue, 24 Mar 2020 at 13:18, Marcel Apfelbaum wrote: > Hi Peter,Yuval > > On 3/24/20 1:05 PM, Peter Maydell wrote: > > On Tue, 24 Mar 2020 at 10:54, Yuval Shaia > wrote: > >> To protect from the case that users of the protected_qlist are still > >> using the qlist let's lock before detsroying i

Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Peter Maydell
On Tue, 24 Mar 2020 at 11:18, Marcel Apfelbaum wrote: > > Hi Peter,Yuval > > On 3/24/20 1:05 PM, Peter Maydell wrote: > > So I think we require that the user of a protected-qlist > > ensures that there are no more users of it before it is > > destroyed (which is fairly normal semantics), and the c

Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Marcel Apfelbaum
Hi Peter,Yuval On 3/24/20 1:05 PM, Peter Maydell wrote: On Tue, 24 Mar 2020 at 10:54, Yuval Shaia wrote: To protect from the case that users of the protected_qlist are still using the qlist let's lock before detsroying it. Reported-by: Coverity (CID 1421951) Signed-off-by: Yuval Shaia ---

Re: [PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Peter Maydell
On Tue, 24 Mar 2020 at 10:54, Yuval Shaia wrote: > > To protect from the case that users of the protected_qlist are still > using the qlist let's lock before detsroying it. > > Reported-by: Coverity (CID 1421951) > Signed-off-by: Yuval Shaia > --- > hw/rdma/rdma_utils.c | 1 + > 1 file changed,

[PATCH] hw/rdma: Lock before destroy

2020-03-24 Thread Yuval Shaia
To protect from the case that users of the protected_qlist are still using the qlist let's lock before detsroying it. Reported-by: Coverity (CID 1421951) Signed-off-by: Yuval Shaia --- hw/rdma/rdma_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/rdma/rdma_utils.c b/hw/rdma/rdma_ut