[ovs-dev] [PATCH 04/10] datapath: Don't directly access port array in query_port().
blp at nicira.com
Wed Dec 29 09:59:40 PST 2010
On Tue, Dec 28, 2010 at 08:50:42PM -0800, Jesse Gross wrote:
> query_port() directly accesses the datapath port array, without
> using any kind of RCU dereference. It's OK, since it is holding
> DP mutex but this adds an explicit check to make sparse happy.
> It also simplifies the code path somewhat.
> Found with sparse.
> Signed-off-by: Jesse Gross <jesse at nicira.com>
Doesn't the "if" below still reference the datapath port array without
RCU dereference? I would use the get_vport_protected() call to retrieve
the vport and then check it for NULL.
> if (port.port >= DP_MAX_PORTS)
> return -EINVAL;
> if (!dp->ports[port.port])
> return -ENOENT;
> + vport = get_vport_protected(dp, port.port);
Acked-by: Ben Pfaff <blp at nicira.com>
More information about the dev