On Tue, Nov 25, 2014 at 4:02 PM, Ben Pfaff <b...@nicira.com> wrote:

> On Tue, Nov 25, 2014 at 04:01:40PM -0800, Alex Wang wrote:
> > On current master, the 'struct dp_netdev_port' is destroyed
> > immediately when the ref count reaches 0.  However, non-pmd
> > threads calling the dpif_netdev_execute() for sending packets
> > could hold pointer to 'port' that is not ref-counted.  Thusly
> > those threads could possibly access freed memory when the port
> > is deleted.
> >
> > To fix this bug, this commit makes non-pmd threads acquiring
> > the 'port_mutex' before doing the actual execution in
> > dpif_netdev_execute().
> >
> > Signed-off-by: Alex Wang <al...@nicira.com>
>
> I don't know this code well enough to review it, but I hope that
> there's a proper lock ordering discipline so that this fix doesn't
> introduce a deadlock?
>
>

Hey Ben,

Yeah, I discussed this issue with Pravin and found that using lock could be
more efficient than calling ovsrcu_synchronize.

I checked the code, and at this time, the "port_mutex" is only acquired for
port add/del/name query (only main thread deals with the mutex).  So, there
should be no double locking.

I'll ask Pravin for review,

Thanks,
Alex Wang,
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to