aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAsias He <asias@redhat.com>2013-06-20 05:20:31 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-24 02:51:48 -0400
commitdce1a2877778fee172ab74411fcabd77bceb8e12 (patch)
treeb42a4643fc4380a665dcba93c71f9786df23584e /net
parentb3a6dfe8178c5159e54117078134fef806a913ca (diff)
VSOCK: Return VMCI_ERROR_NO_MEM when fails to allocate skb
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> Acked-by: Andy King <acking@vmware.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/vmw_vsock/vmci_transport.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index daff75200e25..99b511ddb4cb 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)
625 625
626 /* Attach the packet to the socket's receive queue as an sk_buff. */ 626 /* Attach the packet to the socket's receive queue as an sk_buff. */
627 skb = alloc_skb(size, GFP_ATOMIC); 627 skb = alloc_skb(size, GFP_ATOMIC);
628 if (skb) { 628 if (!skb)
629 /* sk_receive_skb() will do a sock_put(), so hold here. */ 629 return VMCI_ERROR_NO_MEM;
630 sock_hold(sk); 630
631 skb_put(skb, size); 631 /* sk_receive_skb() will do a sock_put(), so hold here. */
632 memcpy(skb->data, dg, size); 632 sock_hold(sk);
633 sk_receive_skb(sk, skb, 0); 633 skb_put(skb, size);
634 } 634 memcpy(skb->data, dg, size);
635 sk_receive_skb(sk, skb, 0);
635 636
636 return VMCI_SUCCESS; 637 return VMCI_SUCCESS;
637} 638}