Skip to contentSkip to conversation

ipvs: initialize tbl->entries in ip_vs_lblc_init_svc()

PATCH In review Cong Wang 4 participants 4 messages Apr 23, 2018 – Apr 26, 2018

Subsystems (4)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 ipvs: initialize tbl->entries in ip_vs_lblc_init_svc()

Similarly, tbl->entries is not initialized after kmalloc(), therefore causes an uninit-value warning in ip_vs_lblc_check_expire(), as reported by syzbot.

Cc Simon Horman <[email protected]>
Cc Julian Anastasov <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
---
 net/netfilter/ipvs/ip_vs_lblc.c | 1 +
 1 file changed, 1 insertion(+)
net/netfilter/ipvs/ip_vs_lblc.c +1 -0
index 3057e453bf31..83918119ceb8 100644
@@ -371,6 +371,7 @@ static int ip_vs_lblc_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
Signature · 1 line
2.13.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 9 lines · Cong Wang

Similarly, tbl->entries is not initialized after kmalloc(), therefore causes an uninit-value warning in ip_vs_lblc_check_expire(), as reported by syzbot.

Cc Simon Horman <[email protected]>
Cc Julian Anastasov <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>

Thanks!

Quoted 18 lines
---
 net/netfilter/ipvs/ip_vs_lblc.c | 1 +
 1 file changed, 1 insertion(+)
net/netfilter/ipvs/ip_vs_lblc.c +1 -0
index 3057e453bf31..83918119ceb8 100644
@@ -371,6 +371,7 @@ static int ip_vs_lblc_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
Signature · 1 line
2.13.0

Regards

maintainer Acked-by
#2 lore raw
Quoted 15 lines · Julian Anastasov

Hello,

Quoted 9 lines · Cong Wang

Similarly, tbl->entries is not initialized after kmalloc(), therefore causes an uninit-value warning in ip_vs_lblc_check_expire(), as reported by syzbot.

Cc Simon Horman <[email protected]>
Cc Julian Anastasov <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
Quoted 3 lines

Thanks!

Thanks.

Pablo, could you take this into nf?

Quoted 25 lines
Quoted 19 lines
---
 net/netfilter/ipvs/ip_vs_lblc.c | 1 +
 1 file changed, 1 insertion(+)
net/netfilter/ipvs/ip_vs_lblc.c +1 -0
index 3057e453bf31..83918119ceb8 100644
@@ -371,6 +371,7 @@ static int ip_vs_lblc_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
Signature · 1 line
2.13.0

Regards

--
Julian Anastasov <[email protected]>

#3 lore raw
Quoted 18 lines · Simon Horman
Quoted 17 lines · Julian Anastasov

Hello,

Quoted 9 lines · Cong Wang

Similarly, tbl->entries is not initialized after kmalloc(), therefore causes an uninit-value warning in ip_vs_lblc_check_expire(), as reported by syzbot.

Cc Simon Horman <[email protected]>
Cc Julian Anastasov <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>

Thanks!

Quoted 7 lines
Quoted 1 line

Thanks.

Pablo, could you take this into nf?

Done, thanks.