diff --git a/net/rds/connection.c b/net/rds/connection.c index 9b2de5e67d7951..49adeef8090cae 100644 --- a/net/rds/connection.c +++ b/net/rds/connection.c @@ -190,6 +190,12 @@ static struct rds_connection *__rds_conn_create(struct net *net, } } + if (trans == NULL) { + kmem_cache_free(rds_conn_slab, conn); + conn = ERR_PTR(-ENODEV); + goto out; + } + conn->c_trans = trans; ret = trans->conn_alloc(conn, gfp);