]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/rxrpc/ar-accept.c
rxrpc: Check allocation failure.
[net-next-2.6.git] / net / rxrpc / ar-accept.c
index bdfb7741779441c3752176c5ad3ce585cc30cfc2..2d744f22a9a1e0433363137c2aef908bf19f3508 100644 (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 */
        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;
 
@@ -100,7 +105,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
 
        trans = rxrpc_get_transport(local, peer, GFP_NOIO);
        rxrpc_put_peer(peer);
-       if (!trans) {
+       if (IS_ERR(trans)) {
                _debug("no trans");
                ret = -EBUSY;
                goto error;
@@ -189,6 +194,7 @@ invalid_service:
        ret = -ECONNREFUSED;
 error:
        rxrpc_free_skb(notification);
+error_nofree:
        _leave(" = %d", ret);
        return ret;
 }