[ovs-dev] [PATCH] lib: fix cmap_find_protected

Zang MingJie zealot0630 at gmail.com
Mon Dec 24 08:32:41 UTC 2018


We have found a bug where recirc node with duplicate id has been inserted
to the cmap, details of the bug in the following email:

https://mail.openvswitch.org/pipermail/ovs-discuss/2018-December/047945.html

Finally we found that cmap_find_protected calculated wrong h2:

    struct cmap_impl *impl = cmap_get_impl(cmap);
    uint32_t h1 = rehash(impl, hash);
    uint32_t h2 = other_hash(hash);

Here is how h2 is calculated in other functions:

    const struct cmap_impl *impl = cmap_get_impl(cmap);
    uint32_t h1 = rehash(impl, hash);
    uint32_t h2 = other_hash(h1);


On Mon, Dec 24, 2018 at 4:25 PM Zang MingJie <zealot0630 at gmail.com> wrote:

> ---
>  lib/cmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/cmap.c b/lib/cmap.c
> index cb9cd32ab..c9eef3f4a 100644
> --- a/lib/cmap.c
> +++ b/lib/cmap.c
> @@ -568,7 +568,7 @@ cmap_find_protected(const struct cmap *cmap, uint32_t
> hash)
>  {
>      struct cmap_impl *impl = cmap_get_impl(cmap);
>      uint32_t h1 = rehash(impl, hash);
> -    uint32_t h2 = other_hash(hash);
> +    uint32_t h2 = other_hash(h1);
>      struct cmap_node *node;
>
>      node = cmap_find_bucket_protected(impl, hash, h1);
> --
> 2.20.1
>
>


More information about the dev mailing list