From: Asias He <asias@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Andy King <acking@vmware.com>, Dmitry Torokhov <dtor@vmware.com>,
Reilly Grant <grantr@vmware.com>, Asias He <asias@redhat.com>
Subject: [PATCH 2/4] VSOCK: Return VMCI_ERROR_NO_MEM when fails to allocate skb
Date: Thu, 20 Jun 2013 17:20:31 +0800 [thread overview]
Message-ID: <1371720033-19714-3-git-send-email-asias@redhat.com> (raw)
In-Reply-To: <1371720033-19714-1-git-send-email-asias@redhat.com>
vmci_transport_recv_dgram_cb always return VMCI_SUCESS even if we fail
to allocate skb, return VMCI_ERROR_NO_MEM instead.
Signed-off-by: Asias He <asias@redhat.com>
---
net/vmw_vsock/vmci_transport.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index daff752..99b511d 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -625,13 +625,14 @@ static int vmci_transport_recv_dgram_cb(void *data, struct vmci_datagram *dg)
/* Attach the packet to the socket's receive queue as an sk_buff. */
skb = alloc_skb(size, GFP_ATOMIC);
- if (skb) {
- /* sk_receive_skb() will do a sock_put(), so hold here. */
- sock_hold(sk);
- skb_put(skb, size);
- memcpy(skb->data, dg, size);
- sk_receive_skb(sk, skb, 0);
- }
+ if (!skb)
+ return VMCI_ERROR_NO_MEM;
+
+ /* sk_receive_skb() will do a sock_put(), so hold here. */
+ sock_hold(sk);
+ skb_put(skb, size);
+ memcpy(skb->data, dg, size);
+ sk_receive_skb(sk, skb, 0);
return VMCI_SUCCESS;
}
--
1.8.1.4
next prev parent reply other threads:[~2013-06-20 9:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 9:20 [PATCH 0/4] VSOCK fix and cleanup Asias He
2013-06-20 9:20 ` [PATCH 1/4] VSOCK: Introduce vsock_auto_bind helper Asias He
2013-06-20 15:16 ` Andy King
2013-06-20 9:20 ` Asias He [this message]
2013-06-20 15:15 ` [PATCH 2/4] VSOCK: Return VMCI_ERROR_NO_MEM when fails to allocate skb Andy King
2013-06-20 9:20 ` [PATCH 3/4] VSOCK: Remove unnecessary label Asias He
2013-06-20 15:13 ` Andy King
2013-06-20 9:20 ` [PATCH 4/4] VSOCK: Fix VSOCK_HASH and VSOCK_CONN_HASH Asias He
2013-06-20 15:12 ` Andy King
2013-06-21 0:22 ` Asias He
2013-06-21 12:48 ` Andy King
2013-06-24 6:52 ` [PATCH 0/4] VSOCK fix and cleanup David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1371720033-19714-3-git-send-email-asias@redhat.com \
--to=asias@redhat.com \
--cc=acking@vmware.com \
--cc=davem@davemloft.net \
--cc=dtor@vmware.com \
--cc=grantr@vmware.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).