[ovs-dev] [PATCH 1/2] datapath: Handle hh_cache access for Linux kernel 3.1

Jesse Gross jesse at nicira.com
Wed Oct 19 23:32:47 UTC 2011


On Wed, Oct 19, 2011 at 1:57 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
> From 3.1 kernel, struct dst_entry no longer has direct ref to hh_cache.
> Following patch handles this case.
>
> Signed-off-by: Pravin Shelar <pshelar at nicira.com>

I don't think there is an actual problem here but the fact that we
repeatedly fetch the neighbor (which is protected by RCU) and assume
that it is the same scares me.  This is especially true because we use
the hard header length for allocations and copies, so theoretically if
the neighbor were to change out from under us bad things could happen.

For complete safety, I would change things to be more similar to the
upstream code:
 * Get a pointer to the neighbor/hh_cache once at the beginning of the
cache build function.
 * Allocate space for the cache using LL_RESERVED_SPACE(dev).
 * Get the hh_len only inside of the seqlock.
 * Store hh_len inside the cache so we can use later for packet processing.



More information about the dev mailing list