lkml.org 
[lkml]   [2017]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.18 066/124] net sched actions: decrement module reference count after table flush.
    Date
    3.18-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Roman Mashak <mrv@mojatatu.com>

    commit edb9d1bff4bbe19b8ae0e71b1f38732591a9eeb2 upstream.

    When tc actions are loaded as a module and no actions have been installed,
    flushing them would result in actions removed from the memory, but modules
    reference count not being decremented, so that the modules would not be
    unloaded.

    Following is example with GACT action:

    % sudo modprobe act_gact
    % lsmod
    Module Size Used by
    act_gact 16384 0
    %
    % sudo tc actions ls action gact
    %
    % sudo tc actions flush action gact
    % lsmod
    Module Size Used by
    act_gact 16384 1
    % sudo tc actions flush action gact
    % lsmod
    Module Size Used by
    act_gact 16384 2
    % sudo rmmod act_gact
    rmmod: ERROR: Module act_gact is in use
    ....

    After the fix:
    % lsmod
    Module Size Used by
    act_gact 16384 0
    %
    % sudo tc actions add action pass index 1
    % sudo tc actions add action pass index 2
    % sudo tc actions add action pass index 3
    % lsmod
    Module Size Used by
    act_gact 16384 3
    %
    % sudo tc actions flush action gact
    % lsmod
    Module Size Used by
    act_gact 16384 0
    %
    % sudo tc actions flush action gact
    % lsmod
    Module Size Used by
    act_gact 16384 0
    % sudo rmmod act_gact
    % lsmod
    Module Size Used by
    %

    Fixes: f97017cdefef ("net-sched: Fix actions flushing")
    Signed-off-by: Roman Mashak <mrv@mojatatu.com>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    net/sched/act_api.c | 5 +----
    1 file changed, 1 insertion(+), 4 deletions(-)

    --- a/net/sched/act_api.c
    +++ b/net/sched/act_api.c
    @@ -801,10 +801,8 @@ static int tca_action_flush(struct net *
    goto out_module_put;

    err = a.ops->walk(skb, &dcb, RTM_DELACTION, &a);
    - if (err < 0)
    + if (err <= 0)
    goto out_module_put;
    - if (err == 0)
    - goto noflush_out;

    nla_nest_end(skb, nest);

    @@ -821,7 +819,6 @@ static int tca_action_flush(struct net *
    out_module_put:
    module_put(a.ops->owner);
    err_out:
    -noflush_out:
    kfree_skb(skb);
    return err;
    }

    \
     
     \ /
      Last update: 2017-04-20 08:59    [W:3.348 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site