* [net-next 1/1] tipc: Fix missing list initializations in struct tipc_subscription
@ 2018-04-03 17:11 Jon Maloy
2018-04-04 15:34 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jon Maloy @ 2018-04-03 17:11 UTC (permalink / raw)
To: davem, netdev
Cc: mohan.krishna.ghanta.krishnamurthy, tung.q.nguyen, hoang.h.le,
jon.maloy, canh.d.luu, ying.xue, tipc-discussion
When an item of struct tipc_subscription is created, we fail to
initialize the two lists aggregated into the struct. This has so far
never been a problem, since the items are just added to a root
object by list_add(), which does not require the addee list to be
pre-initialized. However, syzbot is provoking situations where this
addition fails, whereupon the attempted removal if the item from
the list causes a crash.
This problem seems to always have been around, despite that the code
for creating this object was rewritten in commit 242e82cc95f6 ("tipc:
collapse subscription creation functions"), which is still in net-next.
We fix this for that commit by initializing the two lists properly.
Fixes: 242e82cc95f6 ("tipc: collapse subscription creation functions")
Reported-by: syzbot+0bb443b74ce09197e970@syzkaller.appspotmail.com
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/subscr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 6925a98..b7d80bc 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -145,6 +145,8 @@ struct tipc_subscription *tipc_sub_subscribe(struct net *net,
pr_warn("Subscription rejected, no memory\n");
return NULL;
}
+ INIT_LIST_HEAD(&sub->service_list);
+ INIT_LIST_HEAD(&sub->sub_list);
sub->net = net;
sub->conid = conid;
sub->inactive = false;
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [net-next 1/1] tipc: Fix missing list initializations in struct tipc_subscription
2018-04-03 17:11 [net-next 1/1] tipc: Fix missing list initializations in struct tipc_subscription Jon Maloy
@ 2018-04-04 15:34 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-04-04 15:34 UTC (permalink / raw)
To: jon.maloy
Cc: netdev, mohan.krishna.ghanta.krishnamurthy, tung.q.nguyen,
hoang.h.le, canh.d.luu, ying.xue, tipc-discussion
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Tue, 3 Apr 2018 19:11:19 +0200
> When an item of struct tipc_subscription is created, we fail to
> initialize the two lists aggregated into the struct. This has so far
> never been a problem, since the items are just added to a root
> object by list_add(), which does not require the addee list to be
> pre-initialized. However, syzbot is provoking situations where this
> addition fails, whereupon the attempted removal if the item from
> the list causes a crash.
>
> This problem seems to always have been around, despite that the code
> for creating this object was rewritten in commit 242e82cc95f6 ("tipc:
> collapse subscription creation functions"), which is still in net-next.
>
> We fix this for that commit by initializing the two lists properly.
>
> Fixes: 242e82cc95f6 ("tipc: collapse subscription creation functions")
> Reported-by: syzbot+0bb443b74ce09197e970@syzkaller.appspotmail.com
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Applied, thanks Jon.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-04 15:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-03 17:11 [net-next 1/1] tipc: Fix missing list initializations in struct tipc_subscription Jon Maloy
2018-04-04 15:34 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).