Skip to content

Commit

Permalink
net: qrtr: fix error return code of qrtr_sendmsg()
Browse files Browse the repository at this point in the history
commit 179d0ba upstream.

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: 194ccc8 ("net: qrtr: Support decoding incoming v2 packets")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
XidianGeneral authored and gregkh committed Mar 17, 2021
1 parent d28e783 commit e8b6c1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/qrtr/qrtr.c
Expand Up @@ -791,8 +791,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);

Expand Down

0 comments on commit e8b6c1d

Please sign in to comment.