Skip to content

Commit

Permalink
rxrpc: Check allocation failure.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tetsuo Handa authored and Linus Torvalds committed Mar 22, 2010
1 parent 99b437a commit c3824d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/rxrpc/ar-accept.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -189,6 +194,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
ret = -ECONNREFUSED;
error:
rxrpc_free_skb(notification);
error_nofree:
_leave(" = %d", ret);
return ret;
}
Expand Down

0 comments on commit c3824d2

Please sign in to comment.