lkml.org 
[lkml]   [2012]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[ 34/62] ipvs: fix oops in ip_vs_dst_event on rmmod
    Date
    3.4-stable review patch.  If anyone has any objections, please let me know.

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

    From: Julian Anastasov <ja@ssi.bg>

    commit 283283c4da91adc44b03519f434ee1e7e91d6fdb upstream.

    After commit 39f618b4fd95ae243d940ec64c961009c74e3333 (3.4)
    "ipvs: reset ipvs pointer in netns" we can oops in
    ip_vs_dst_event on rmmod ip_vs because ip_vs_control_cleanup
    is called after the ipvs_core_ops subsys is unregistered and
    net->ipvs is NULL. Fix it by exiting early from ip_vs_dst_event
    if ipvs is NULL. It is safe because all services and dests
    for the net are already freed.

    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Simon Horman <horms@verge.net.au>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Acked-by: David Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    net/netfilter/ipvs/ip_vs_ctl.c | 5 +++--
    1 file changed, 3 insertions(+), 2 deletions(-)

    --- a/net/netfilter/ipvs/ip_vs_ctl.c
    +++ b/net/netfilter/ipvs/ip_vs_ctl.c
    @@ -1521,11 +1521,12 @@ static int ip_vs_dst_event(struct notifi
    {
    struct net_device *dev = ptr;
    struct net *net = dev_net(dev);
    + struct netns_ipvs *ipvs = net_ipvs(net);
    struct ip_vs_service *svc;
    struct ip_vs_dest *dest;
    unsigned int idx;

    - if (event != NETDEV_UNREGISTER)
    + if (event != NETDEV_UNREGISTER || !ipvs)
    return NOTIFY_DONE;
    IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name);
    EnterFunction(2);
    @@ -1551,7 +1552,7 @@ static int ip_vs_dst_event(struct notifi
    }
    }

    - list_for_each_entry(dest, &net_ipvs(net)->dest_trash, n_list) {
    + list_for_each_entry(dest, &ipvs->dest_trash, n_list) {
    __ip_vs_dev_reset(dest, dev);
    }
    mutex_unlock(&__ip_vs_mutex);



    \
     
     \ /
      Last update: 2012-10-19 06:01    [W:5.676 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site