RDMA/ocrdma: Avoid a possible crash in ocrdma_rem_port_stats
authorSelvin Xavier <selvin.xavier@avagotech.com>
Tue, 20 Oct 2015 08:47:57 +0000 (14:17 +0530)
committerDoug Ledford <dledford@redhat.com>
Wed, 21 Oct 2015 21:28:19 +0000 (17:28 -0400)
debugfs_remove should be called before freeing the driver
stats resources to avoid any crash during ocrdma_remove.

Signed-off-by: Devesh Sharma <devesh.sharma@avagotech.com>
Signed-off-by: Selvin Xavier <selvin.xavier@avagotech.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/ocrdma/ocrdma_stats.c

index 69334e214571b94ae0305bc8c9821aa0e261b7fe..86c303a620c1660625ebb94f1b54e578856b26ff 100644 (file)
@@ -855,9 +855,9 @@ void ocrdma_rem_port_stats(struct ocrdma_dev *dev)
 {
        if (!dev->dir)
                return;
+       debugfs_remove(dev->dir);
        mutex_destroy(&dev->stats_lock);
        ocrdma_release_stats_mem(dev);
-       debugfs_remove(dev->dir);
 }
 
 void ocrdma_init_debugfs(void)