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: David S. Miller <davem@davemloft.net>
This commit is contained in:
Tetsuo Handa 2010-03-22 10:22:55 -07:00 committed by David S. Miller
parent 243aad830e
commit 7c3456fdb5
1 changed files with 6 additions and 0 deletions

View File

@ -88,6 +88,11 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
/* get a notification message to send to the server app */ /* get a notification message to send to the server app */
notification = alloc_skb(0, GFP_NOFS); notification = alloc_skb(0, GFP_NOFS);
if (!notification) {
_debug("no memory");
ret = -ENOMEM;
goto error_nofree;
}
rxrpc_new_skb(notification); rxrpc_new_skb(notification);
notification->mark = RXRPC_SKB_MARK_NEW_CALL; notification->mark = RXRPC_SKB_MARK_NEW_CALL;
@ -189,6 +194,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
ret = -ECONNREFUSED; ret = -ECONNREFUSED;
error: error:
rxrpc_free_skb(notification); rxrpc_free_skb(notification);
error_nofree:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} }