ipvs: initialize tbl->entries after allocation
authorCong Wang <xiyou.wangcong@gmail.com>
Mon, 23 Apr 2018 20:53:41 +0000 (13:53 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 26 Apr 2018 22:20:33 +0000 (00:20 +0200)
tbl->entries is not initialized after kmalloc(), therefore
causes an uninit-value warning in ip_vs_lblc_check_expire()
as reported by syzbot.

Reported-by: <syzbot+3dfdea57819073a04f21@syzkaller.appspotmail.com>
Cc: Simon Horman <horms@verge.net.au>
Cc: Julian Anastasov <ja@ssi.bg>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/ipvs/ip_vs_lblcr.c

index 9b6a6c9e9cfa143cf8dc3967472dcb65cb722a60..542c4949937ab284ad656a558a8f9c24ccfff37c 100644 (file)
@@ -535,6 +535,7 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
        tbl->counter = 1;
        tbl->dead = false;
        tbl->svc = svc;
+       atomic_set(&tbl->entries, 0);
 
        /*
         *    Hook periodic timer for garbage collection