提交 af3b6382 编写于 作者: D Darrick J. Wong 提交者: Dave Chinner

xfs: don't leak uuid table on rmmod

Don't leak the UUID table when the module is unloaded.
(Found with kmemleak.)
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 47e1bf64
...@@ -47,6 +47,16 @@ static DEFINE_MUTEX(xfs_uuid_table_mutex); ...@@ -47,6 +47,16 @@ static DEFINE_MUTEX(xfs_uuid_table_mutex);
static int xfs_uuid_table_size; static int xfs_uuid_table_size;
static uuid_t *xfs_uuid_table; static uuid_t *xfs_uuid_table;
void
xfs_uuid_table_free(void)
{
if (xfs_uuid_table_size == 0)
return;
kmem_free(xfs_uuid_table);
xfs_uuid_table = NULL;
xfs_uuid_table_size = 0;
}
/* /*
* See if the UUID is unique among mounted XFS filesystems. * See if the UUID is unique among mounted XFS filesystems.
* Mount fails if UUID is nil or a FS with the same UUID is already mounted. * Mount fails if UUID is nil or a FS with the same UUID is already mounted.
......
...@@ -312,6 +312,7 @@ typedef struct xfs_perag { ...@@ -312,6 +312,7 @@ typedef struct xfs_perag {
int pagb_count; /* pagb slots in use */ int pagb_count; /* pagb slots in use */
} xfs_perag_t; } xfs_perag_t;
extern void xfs_uuid_table_free(void);
extern int xfs_log_sbcount(xfs_mount_t *); extern int xfs_log_sbcount(xfs_mount_t *);
extern __uint64_t xfs_default_resblks(xfs_mount_t *mp); extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);
extern int xfs_mountfs(xfs_mount_t *mp); extern int xfs_mountfs(xfs_mount_t *mp);
......
...@@ -1896,6 +1896,7 @@ exit_xfs_fs(void) ...@@ -1896,6 +1896,7 @@ exit_xfs_fs(void)
xfs_mru_cache_uninit(); xfs_mru_cache_uninit();
xfs_destroy_workqueues(); xfs_destroy_workqueues();
xfs_destroy_zones(); xfs_destroy_zones();
xfs_uuid_table_free();
} }
module_init(init_xfs_fs); module_init(init_xfs_fs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册