linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: socket: fix a missing check for nla_nest_start
@ 2019-03-15  6:03 Kangjie Lu
  2019-03-16 18:37 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2019-03-15  6:03 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Jon Maloy, Ying Xue, David S. Miller, netdev,
	tipc-discussion, linux-kernel

nla_nest_start may fail. The fix check its status and returns
-EMSGSIZE in case it fails.

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

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index e482b342bfa8..49ab8b27bde4 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -3255,6 +3255,8 @@ static int __tipc_nl_add_sk_con(struct sk_buff *skb, struct tipc_sock *tsk)
 	peer_port = tsk_peer_port(tsk);
 
 	nest = nla_nest_start(skb, TIPC_NLA_SOCK_CON);
+	if (!nest)
+		return -EMSGSIZE;
 
 	if (nla_put_u32(skb, TIPC_NLA_CON_NODE, peer_node))
 		goto msg_full;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: socket: fix a missing check for nla_nest_start
  2019-03-15  6:03 [PATCH] net: socket: fix a missing check for nla_nest_start Kangjie Lu
@ 2019-03-16 18:37 ` David Miller
  2019-03-16 21:46   ` [PATCH] net: tipc: " Kangjie Lu
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2019-03-16 18:37 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 01:03:05 -0500

> nla_nest_start may fail. The fix check its status and returns
> -EMSGSIZE in case it fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

The proper subsystem prefix is "tipc: " not "socket: "

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] net: tipc: fix a missing check for nla_nest_start
  2019-03-16 18:37 ` David Miller
@ 2019-03-16 21:46   ` Kangjie Lu
  2019-03-17  1:20     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2019-03-16 21:46 UTC (permalink / raw)
  To: kjlu
  Cc: Jon Maloy, Ying Xue, David S. Miller, netdev, tipc-discussion,
	linux-kernel

nla_nest_start may fail. The fix check its status and returns
-EMSGSIZE in case it fails.

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

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index e482b342bfa8..49ab8b27bde4 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -3255,6 +3255,8 @@ static int __tipc_nl_add_sk_con(struct sk_buff *skb, struct tipc_sock *tsk)
 	peer_port = tsk_peer_port(tsk);
 
 	nest = nla_nest_start(skb, TIPC_NLA_SOCK_CON);
+	if (!nest)
+		return -EMSGSIZE;
 
 	if (nla_put_u32(skb, TIPC_NLA_CON_NODE, peer_node))
 		goto msg_full;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: tipc: fix a missing check for nla_nest_start
  2019-03-16 21:46   ` [PATCH] net: tipc: " Kangjie Lu
@ 2019-03-17  1:20     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-17  1:20 UTC (permalink / raw)
  To: kjlu; +Cc: jon.maloy, ying.xue, netdev, tipc-discussion, linux-kernel

From: Kangjie Lu <kjlu@umn.edu>
Date: Sat, 16 Mar 2019 16:46:05 -0500

> nla_nest_start may fail. The fix check its status and returns
> -EMSGSIZE in case it fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-17  1:20 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:03 [PATCH] net: socket: fix a missing check for nla_nest_start Kangjie Lu
2019-03-16 18:37 ` David Miller
2019-03-16 21:46   ` [PATCH] net: tipc: " Kangjie Lu
2019-03-17  1:20     ` 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).