RDS: fix the dangling reference to rds_ib_incoming_slab
authorsantosh.shilimkar@oracle.com <santosh.shilimkar@oracle.com>
Tue, 25 Aug 2015 19:01:58 +0000 (12:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2015 23:28:10 +0000 (16:28 -0700)
On rds_ib_frag_slab allocation failure, ensure rds_ib_incoming_slab
is not pointing to the detsroyed memory.

Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/ib_recv.c

index ed9b41e..6bbe620 100644 (file)
@@ -1102,9 +1102,10 @@ int rds_ib_recv_init(void)
        rds_ib_frag_slab = kmem_cache_create("rds_ib_frag",
                                        sizeof(struct rds_page_frag),
                                        0, SLAB_HWCACHE_ALIGN, NULL);
-       if (!rds_ib_frag_slab)
+       if (!rds_ib_frag_slab) {
                kmem_cache_destroy(rds_ib_incoming_slab);
-       else
+               rds_ib_incoming_slab = NULL;
+       } else
                ret = 0;
 out:
        return ret;