]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rds: free ib_device related resource
authorWengang Wang <wen.gang.wang@oracle.com>
Mon, 7 Sep 2015 07:35:29 +0000 (15:35 +0800)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Thu, 17 Sep 2015 00:07:09 +0000 (17:07 -0700)
commitceb99ba579a769f4e02375a3d52e36f44ae5f27f
tree121eddc17d7e7a017a4b969ce9a1d5f25477bedc
parent23f63dbf2dbc153937b34d60e2e37740ca2ec8dc
rds: free ib_device related resource

There is a (rare) case that a ib_device gets removed(driver unload) while
upper layer(RDS) is still having references to the resources allocated
from this ib_device.

The result is either causing memory leak or crashing when accessing
the freed memory.

The resources are mainly rds_ib_mr objects, in-use rds_ib_mr (rds_mr)
objects are stored in rds_sock.rs_rdma_keys.

The fix is to
1) links up all in-use rds_ib_mr objects to the pool
2) links the rds_sock to rds_ib_mr
3) the destroy of the rds_ib_mr_pool takes care of freeing rds_ib_mrs
   by calling rds_rdma_drop_keys()

Orabug: 21795824

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Acked-by: Chien Yen <chien.yen@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
net/rds/ib.c
net/rds/ib.h
net/rds/ib_rdma.c
net/rds/rdma.c