[ovs-dev] [PATCH] netdev-dummy: Lock mutex when retrieving custom stats.
Ben Pfaff
blp at ovn.org
Thu Jan 11 00:14:09 UTC 2018
Thanks a lot! I applied this to master.
On Wed, Jan 10, 2018 at 04:02:24PM -0800, Yifeng Sun wrote:
> Looks good to me, thanks.
>
>
> Reviewed-by: Yifeng Sun <pkusunyifeng at gmail.com>
>
> On Wed, Jan 10, 2018 at 3:47 PM, Ben Pfaff <blp at ovn.org> wrote:
>
> > Found by Clang.
> >
> > CC: Michal Weglicki <michalx.weglicki at intel.com>
> > Fixes: 971f4b394c6e ("netdev: Custom statistics.")
> > Signed-off-by: Ben Pfaff <blp at ovn.org>
> > ---
> > Somehow I didn't notice this before I applied the previous patch. Oops,
> > sorry.
> >
> > lib/netdev-dummy.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
> > index 57da19c48fcb..4246af3b9c86 100644
> > --- a/lib/netdev-dummy.c
> > +++ b/lib/netdev-dummy.c
> > @@ -1239,12 +1239,14 @@ netdev_dummy_get_custom_stats(const struct netdev
> > *netdev,
> > (struct netdev_custom_counter *) xcalloc(C_STATS_SIZE,
> > sizeof(struct netdev_custom_counter));
> >
> > + ovs_mutex_lock(&dev->mutex);
> > for (i = 0 ; i < C_STATS_SIZE ; i++) {
> > custom_stats->counters[i].value = dev->custom_stats[i].value;
> > ovs_strlcpy(custom_stats->counters[i].name,
> > dev->custom_stats[i].name,
> > NETDEV_CUSTOM_STATS_NAME_SIZE);
> > }
> > + ovs_mutex_unlock(&dev->mutex);
> >
> > return 0;
> > }
> > --
> > 2.10.2
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
More information about the dev
mailing list