On Thu, May 07, 2026 at 01:03:45PM +0200, Paolo Abeni wrote:
> On 5/5/26 10:42 AM, Adrian Moreno wrote:
> > @@ -752,12 +759,16 @@ static struct genl_family dp_packet_genl_family
> > __ro_after_init = {
> > static void get_dp_stats(const struct datapath *dp, struct ovs_dp_stats
> > *stats,
> > struct ovs_dp_megaflow_stats *mega_stats)
> > {
> > + struct flow_table *table = ovsl_dereference(dp->table);
> > int i;
> >
> > memset(mega_stats, 0, sizeof(*mega_stats));
> > + memset(stats, 0, sizeof(*stats));
>
> Is this an unrelated bugfix, preventing random values from stack
> clobbering the stats? Should it land to a separate fix for net?
I don't think is a but, although it's definitely code that can be
improved.
Before this patch, all members of "stats" were being set in this
function so there is no stack-pollution. This patch introduces a
possibility of not setting mega_stats->n_stats if we fail to dereference
the flow table, so clearing all fields becomes mandatory.
Would this qualify for a backportable bug-fix?
Actually, now that I look at this hunk, I realize this line should be
removed:
stats->n_hit = stats->n_missed = stats->n_lost = 0;
>
> > @@ -1501,8 +1537,13 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb,
> > struct netlink_callback *cb)
> > rcu_read_unlock();
> > return -ENODEV;
> > }
> > + table = rcu_dereference_ovsl(dp->table);
>
> Possibly:
> table = rcu_dereference(dp->table);
> would be more accurate
You're right! Thanks.
>
> > @@ -518,6 +524,7 @@ void ovs_flow_tbl_destroy(struct flow_table *table)
> > call_rcu(&mc->rcu, mask_cache_rcu_cb);
> > call_rcu(&ma->rcu, mask_array_rcu_cb);
>
> This is always invoked after a rcu grace period, it would be probably
> nice to follow-up, not necessarly in this series, moving the above
> call_rcu together with the call_rcu(table). Such statements could be
> bundled in a new helper.
>
Sorry, bundled together with what exactly?
Are you refering to the fact that full table deletion now spans over two
rcu periods?
Thanks.
Adrián
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev