[Devel] [PATCH RHEL7 COMMIT] ms/ipv6: only call ip6_route_dev_notify() once for NETDEV_UNREGISTER

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jul 17 19:03:01 MSK 2017


Please consider to prepare a ReadyKernel patch for this.

https://readykernel.com/

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 07/17/2017 07:00 PM, Konstantin Khorenko wrote:
> The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
> after rh7-3.10.0-514.26.1.vz7.33.9
> ------>
> commit 7b1c8329b82cff08f8a0c2e686b9b66de668a18c
> Author: WANG Cong <xiyou.wangcong at gmail.com>
> Date:   Tue Jun 20 11:42:27 2017 -0700
>
>     ms/ipv6: only call ip6_route_dev_notify() once for NETDEV_UNREGISTER
>
>     In commit 242d3a49a2a1 ("ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf")
>     I assumed NETDEV_REGISTER and NETDEV_UNREGISTER are paired,
>     unfortunately, as reported by jeffy, netdev_wait_allrefs()
>     could rebroadcast NETDEV_UNREGISTER event until all refs are
>     gone.
>
>     We have to add an additional check to avoid this corner case.
>     For netdev_wait_allrefs() dev->reg_state is NETREG_UNREGISTERED,
>     for dev_change_net_namespace(), dev->reg_state is
>     NETREG_REGISTERED. So check for dev->reg_state != NETREG_UNREGISTERED.
>
>     Fixes: 242d3a49a2a1 ("ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf")
>     Reported-by: jeffy <jeffy.chen at rock-chips.com>
>     Cc: David Ahern <dsahern at gmail.com>
>     Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
>     Acked-by: David Ahern <dsahern at gmail.com>
>     Signed-off-by: David S. Miller <davem at davemloft.net>
>
>     https://jira.sw.ru/browse/PSBM-66197
>
>     (cherry picked from commit 76da0704507bbc51875013f6557877ab308cfd0a)
>     Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
> ---
>  net/ipv6/route.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 3d4d519..fa0e036 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -3228,7 +3228,11 @@ static int ip6_route_dev_notify(struct notifier_block *this,
>  		net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
>  		net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
>  #endif
> -	 } else if (event == NETDEV_UNREGISTER) {
> +	 } else if (event == NETDEV_UNREGISTER &&
> +		    dev->reg_state != NETREG_UNREGISTERED) {
> +		/* NETDEV_UNREGISTER could be fired for multiple times by
> +		 * netdev_wait_allrefs(). Make sure we only call this once.
> +		 */
>  		in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev);
>  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
>  		in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev);
> .
>


More information about the Devel mailing list