linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ieee802154: fix error return code of dgram_sendmsg()
@ 2021-03-08  9:31 Jia-Ju Bai
  2021-03-08 10:19 ` Heiner Kallweit
  0 siblings, 1 reply; 5+ messages in thread
From: Jia-Ju Bai @ 2021-03-08  9:31 UTC (permalink / raw)
  To: alex.aring, stefan, davem, kuba
  Cc: linux-wpan, netdev, linux-kernel, Jia-Ju Bai

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

Fixes: 78f821b64826 ("ieee802154: socket: put handling into one file")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 net/ieee802154/socket.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index a45a0401adc5..a750b37c7e73 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -642,8 +642,10 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 	skb = sock_alloc_send_skb(sk, hlen + tlen + size,
 				  msg->msg_flags & MSG_DONTWAIT,
 				  &err);
-	if (!skb)
+	if (!skb) {
+		err = -ENOMEM;
 		goto out_dev;
+	}
 
 	skb_reserve(skb, hlen);
 
-- 
2.17.1


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

end of thread, other threads:[~2021-03-08 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  9:31 [PATCH] net: ieee802154: fix error return code of dgram_sendmsg() Jia-Ju Bai
2021-03-08 10:19 ` Heiner Kallweit
2021-03-08 12:18   ` Jia-Ju Bai
2021-03-08 13:33     ` Heiner Kallweit
2021-03-08 13:49       ` Jia-Ju Bai

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