linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: qrtr: fix error return code of qrtr_sendmsg()
@ 2021-03-08  9:13 Jia-Ju Bai
  2021-03-08 23:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2021-03-08  9:13 UTC (permalink / raw)
  To: davem, kuba, loic.poulain, bjorn.andersson, mani, cjhuang, necip,
	edumazet, miaoqinglang, dan.carpenter, wenhu.wang
  Cc: netdev, linux-kernel, Jia-Ju Bai

When sock_alloc_send_skb() returns NULL to skb, no error return code of
qrtr_sendmsg() is assigned.
To fix this bug, rc is assigned with -ENOMEM in this case.

Fixes: 194ccc88297a ("net: qrtr: Support decoding incoming v2 packets")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 net/qrtr/qrtr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index b34358282f37..ac2a4a7711da 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -958,8 +958,10 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 	plen = (len + 3) & ~3;
 	skb = sock_alloc_send_skb(sk, plen + QRTR_HDR_MAX_SIZE,
 				  msg->msg_flags & MSG_DONTWAIT, &rc);
-	if (!skb)
+	if (!skb) {
+		rc = -ENOMEM;
 		goto out_node;
+	}
 
 	skb_reserve(skb, QRTR_HDR_MAX_SIZE);
 
-- 
2.17.1


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

* Re: [PATCH] net: qrtr: fix error return code of qrtr_sendmsg()
  2021-03-08  9:13 [PATCH] net: qrtr: fix error return code of qrtr_sendmsg() Jia-Ju Bai
@ 2021-03-08 23:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-08 23:10 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: davem, kuba, loic.poulain, bjorn.andersson, mani, cjhuang, necip,
	edumazet, miaoqinglang, dan.carpenter, wenhu.wang, netdev,
	linux-kernel

Hello:

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

On Mon,  8 Mar 2021 01:13:55 -0800 you wrote:
> When sock_alloc_send_skb() returns NULL to skb, no error return code of
> qrtr_sendmsg() is assigned.
> To fix this bug, rc is assigned with -ENOMEM in this case.
> 
> Fixes: 194ccc88297a ("net: qrtr: Support decoding incoming v2 packets")
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> 
> [...]

Here is the summary with links:
  - net: qrtr: fix error return code of qrtr_sendmsg()
    https://git.kernel.org/netdev/net/c/179d0ba0c454

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:[~2021-03-08 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  9:13 [PATCH] net: qrtr: fix error return code of qrtr_sendmsg() Jia-Ju Bai
2021-03-08 23:10 ` 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).