Skip to contentSkip to conversation

rxrpc: Check allocation failure.

PATCH Applied David Howells 2 participants 2 messages Mar 22, 2010

Subsystems (3)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 rxrpc: Check allocation failure.

From: Tetsuo Handa <[email protected]>

alloc_skb() can return NULL.

---

 net/rxrpc/ar-accept.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
net/rxrpc/ar-accept.c +6 -0
index 77228f2..2d744f2 100644
@@ -88,6 +88,11 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
 
 	/* get a notification message to send to the server app */
 	notification = alloc_skb(0, GFP_NOFS);
+	if (!notification) {
+		_debug("no memory");
+		ret = -ENOMEM;
+		goto error_nofree;
+	}
 	rxrpc_new_skb(notification);
 	notification->mark = RXRPC_SKB_MARK_NEW_CALL;
 
@@ -189,6 +194,7 @@ invalid_service:
 	ret = -ECONNREFUSED;
 error:
 	rxrpc_free_skb(notification);
+error_nofree:
 	_leave(" = %d", ret);
 	return ret;
 }