* [PATCH] net: tipc: fix a missing check of nla_nest_start
@ 2019-03-15 6:07 Kangjie Lu
2019-03-15 8:58 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2019-03-15 6:07 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Jon Maloy, Ying Xue, David S. Miller, netdev,
tipc-discussion, linux-kernel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: tipc: fix a missing check of nla_nest_start
2019-03-15 6:07 [PATCH] net: tipc: fix a missing check of nla_nest_start Kangjie Lu
@ 2019-03-15 8:58 ` Sergei Shtylyov
2019-03-15 17:11 ` Kangjie Lu
0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2019-03-15 8:58 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Jon Maloy, Ying Xue, David S. Miller, netdev,
tipc-discussion, linux-kernel
Hello!
On 15.03.2019 9:07, Kangjie Lu wrote:
> 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);
Please keep the empty line after the declarations.
> + if (!group)
> + return -EMSGSIZE;
>
> if (nla_put_u32(skb, TIPC_NLA_SOCK_GROUP_ID,
> grp->type) ||
MBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] net: tipc: fix a missing check of nla_nest_start
2019-03-15 8:58 ` Sergei Shtylyov
@ 2019-03-15 17:11 ` Kangjie Lu
2019-03-16 19:09 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2019-03-15 17:11 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Jon Maloy, Ying Xue, David S. Miller, netdev,
tipc-discussion, linux-kernel
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 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/tipc/group.c b/net/tipc/group.c
index 06fee142f09f..63f39201e41e 100644
--- a/net/tipc/group.c
+++ b/net/tipc/group.c
@@ -919,6 +919,9 @@ 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) ||
nla_put_u32(skb, TIPC_NLA_SOCK_GROUP_INSTANCE,
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: tipc: fix a missing check of nla_nest_start
2019-03-15 17:11 ` Kangjie Lu
@ 2019-03-16 19:09 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-16 19:09 UTC (permalink / raw)
To: kjlu; +Cc: pakki001, jon.maloy, ying.xue, netdev, tipc-discussion, linux-kernel
From: Kangjie Lu <kjlu@umn.edu>
Date: Fri, 15 Mar 2019 12:11:59 -0500
> nla_nest_start could fail and requires a check. The fix returns
> -EMSGSIZE if it fails.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-16 19:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 6:07 [PATCH] net: tipc: fix a missing check of nla_nest_start Kangjie Lu
2019-03-15 8:58 ` Sergei Shtylyov
2019-03-15 17:11 ` Kangjie Lu
2019-03-16 19:09 ` 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).