route: set the deleted fnhe fnhe_daddr to 0 in ip_del_fnhe to fix a race

PPA description

route: set the deleted fnhe fnhe_daddr to 0 in ip_del_fnhe to fix a race

    [ Upstream commit ee60ad219f5c7c4fb2f047f88037770063ef785f ]

    The race occurs in __mkroute_output() when 2 threads lookup a dst:

      CPU A CPU B
      find_exception()
                            find_exception() [fnhe expires]
                            ip_del_fnhe() [fnhe is deleted]
      rt_bind_exception()

    In rt_bind_exception() it will bind a deleted fnhe with the new dst, and
    this dst will get no chance to be freed. It causes a dev defcnt leak and
    consecutive dmesg warnings:

      unregister_netdevice: waiting for ethX to become free. Usage count = 1

    Especially thanks Jon to identify the issue.

    This patch fixes it by setting fnhe_daddr to 0 in ip_del_fnhe() to stop
    binding the deleted fnhe with a new dst when checking fnhe's fnhe_daddr
    and daddr in rt_bind_exception().

    It works as both ip_del_fnhe() and rt_bind_exception() are protected by
    fnhe_lock and the fhne is freed by kfree_rcu().

    Fixes: deed49df7390 ("route: check and remove route cache when we get route")

Adding this PPA to your system

You can update your system with unsupported packages from this untrusted PPA by adding ppa:mimi0213kimo/fnhe-daddr-fix-race to your system's Software Sources. (Read about installing)

sudo add-apt-repository ppa:mimi0213kimo/fnhe-daddr-fix-race
sudo apt update
        
Technical details about this PPA

This PPA can be added to your system manually by copying the lines below and adding them to your system's software sources.

deb https://ppa.launchpadcontent.net/mimi0213kimo/fnhe-daddr-fix-race/ubuntu bionic main 
deb-src https://ppa.launchpadcontent.net/mimi0213kimo/fnhe-daddr-fix-race/ubuntu bionic main 
Signing key:
1024R/507FCC449C3DF235AF6799B2B68469EAC3EDBBD2 (What is this?)
Fingerprint:
507FCC449C3DF235AF6799B2B68469EAC3EDBBD2

For questions and bugs with software in this PPA please contact Gavin Guo.

PPA statistics

Activity
0 updates added during the past month.
View package details

Overview of published packages

11 of 1 result
Package Version Uploaded by
linux 4.15.0-58.64+hf0000000v20190906b1h67df89ba7cf2 (Newer version available) Gavin Guo ()
11 of 1 result

Latest updates

  • linux 245 weeks ago
    Successfully built