netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill()
@ 2020-11-16  8:20 Wang Hai
  2020-11-18  0:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Hai @ 2020-11-16  8:20 UTC (permalink / raw)
  To: davem, kuznet, yoshfuji, kuba, lorenzo; +Cc: netdev, linux-kernel

nlmsg_cancel() needs to be called in the error path of
inet_req_diag_fill to cancel the message.

Fixes: d545caca827b ("net: inet: diag: expose the socket mark to privileged processes.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 net/ipv4/inet_diag.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 366a4507b5a3..93474b1bea4e 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -479,8 +479,10 @@ static int inet_req_diag_fill(struct sock *sk, struct sk_buff *skb,
 	r->idiag_inode	= 0;
 
 	if (net_admin && nla_put_u32(skb, INET_DIAG_MARK,
-				     inet_rsk(reqsk)->ir_mark))
+				     inet_rsk(reqsk)->ir_mark)) {
+		nlmsg_cancel(skb, nlh);
 		return -EMSGSIZE;
+	}
 
 	nlmsg_end(skb, nlh);
 	return 0;
-- 
2.17.1


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

* Re: [PATCH net] inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill()
  2020-11-16  8:20 [PATCH net] inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill() Wang Hai
@ 2020-11-18  0:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-18  0:20 UTC (permalink / raw)
  To: Wang Hai; +Cc: davem, kuznet, yoshfuji, kuba, lorenzo, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon, 16 Nov 2020 16:20:18 +0800 you wrote:
> nlmsg_cancel() needs to be called in the error path of
> inet_req_diag_fill to cancel the message.
> 
> Fixes: d545caca827b ("net: inet: diag: expose the socket mark to privileged processes.")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> 
> [...]

Here is the summary with links:
  - [net] inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill()
    https://git.kernel.org/netdev/net/c/e33de7c5317e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2020-11-18  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16  8:20 [PATCH net] inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill() Wang Hai
2020-11-18  0:20 ` patchwork-bot+netdevbpf

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).