lkml.org 
[lkml]   [2019]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] net: tipc: fix a missing check of nla_nest_start
Date
nla_nest_start could fail and requires a check. The fix returns
-EMSGSIZE if it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
net/tipc/group.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/tipc/group.c b/net/tipc/group.c
index 06fee142f09f..117867e480ba 100644
--- a/net/tipc/group.c
+++ b/net/tipc/group.c
@@ -918,6 +918,8 @@ void tipc_group_member_evt(struct tipc_group *grp,
int tipc_group_fill_sock_diag(struct tipc_group *grp, struct sk_buff *skb)
{
struct nlattr *group = nla_nest_start(skb, TIPC_NLA_SOCK_GROUP);
+ if (!group)
+ return -EMSGSIZE;

if (nla_put_u32(skb, TIPC_NLA_SOCK_GROUP_ID,
grp->type) ||
--
2.17.1
\
 
 \ /
  Last update: 2019-03-15 07:08    [W:0.040 / U:2.272 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site