rxrpc: Check allocation failure.

Previous thread: KS8851: Avoid NULL pointer in set rx mode by Linux Kernel Mailing List on Monday, March 22, 2010 - 10:59 am. (1 message)

Next thread: tcp: Fix OOB POLLIN avoidance. by Linux Kernel Mailing List on Monday, March 22, 2010 - 10:59 am. (1 message)
From: Linux Kernel Mailing List
Date: Monday, March 22, 2010 - 10:59 am

Gitweb:     http://git.kernel.org/linus/c3824d21eb653fe7017476724257ccaa8bf3d9e1
Commit:     c3824d21eb653fe7017476724257ccaa8bf3d9e1
Parent:     99b437a9257cb6b267bf32adfb7675948dc6d485
Author:     Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
AuthorDate: Mon Mar 22 13:50:19 2010 +0000
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Mon Mar 22 09:57:19 2010 -0700

    rxrpc: Check allocation failure.
    
    alloc_skb() can return NULL.
    
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 net/rxrpc/ar-accept.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/rxrpc/ar-accept.c b/net/rxrpc/ar-accept.c
index 77228f2..2d744f2 100644
--- a/net/rxrpc/ar-accept.c
+++ b/net/rxrpc/ar-accept.c
@@ -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;
 }
--

Previous thread: KS8851: Avoid NULL pointer in set rx mode by Linux Kernel Mailing List on Monday, March 22, 2010 - 10:59 am. (1 message)

Next thread: tcp: Fix OOB POLLIN avoidance. by Linux Kernel Mailing List on Monday, March 22, 2010 - 10:59 am. (1 message)