From 9487af325bab1dd38d889bb0d4c6bbc3fe116569 Mon Sep 17 00:00:00 2001 From: Jiamin Ma Date: Wed, 16 Aug 2017 19:58:00 +0800 Subject: [PATCH] memleek: using single_open/seq_read and single_release in pair PD#149178: memleek when single_open/seq_readwithout single_release single_open/seq_read will apply for one page and two small slab memory. If we do not release them in single_release, the system will crash for memory leeking Change-Id: I2b74a0c6faec415e96164d0c20ba0676836e55eb Signed-off-by: Jiamin Ma --- drivers/amlogic/bluetooth/bluesleep.c | 2 ++ drivers/amlogic/clk/clk_measure.c | 1 + drivers/amlogic/mmc/emmc_partitions.c | 3 ++- drivers/amlogic/reg_access/reg_access.c | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/bluetooth/bluesleep.c b/drivers/amlogic/bluetooth/bluesleep.c index 9814640..9631491 100644 --- a/drivers/amlogic/bluetooth/bluesleep.c +++ b/drivers/amlogic/bluetooth/bluesleep.c @@ -779,11 +779,13 @@ static const struct file_operations bluesleep_proc_readwrite_fops = { .open = bluesleep_proc_open, .read = seq_read, .write = bluesleep_proc_write, + .release = single_release, }; static const struct file_operations bluesleep_proc_read_fops = { .owner = THIS_MODULE, .open = bluesleep_proc_open, .read = seq_read, + .release = single_release, }; /** diff --git a/drivers/amlogic/clk/clk_measure.c b/drivers/amlogic/clk/clk_measure.c index b213397..ed1581d 100644 --- a/drivers/amlogic/clk/clk_measure.c +++ b/drivers/amlogic/clk/clk_measure.c @@ -636,6 +636,7 @@ static const struct file_operations clkmsr_file_ops = { .read = seq_read, .write = clkmsr_write, .llseek = seq_lseek, + .release = single_release, }; static int aml_clkmsr_probe(struct platform_device *pdev) diff --git a/drivers/amlogic/mmc/emmc_partitions.c b/drivers/amlogic/mmc/emmc_partitions.c index 702030f..99b1851 100644 --- a/drivers/amlogic/mmc/emmc_partitions.c +++ b/drivers/amlogic/mmc/emmc_partitions.c @@ -252,6 +252,7 @@ static const struct file_operations dtb_ops = { .read = mmc_dtb_read, .write = mmc_dtb_write, .unlocked_ioctl = mmc_dtb_ioctl, + .release = single_release, }; int amlmmc_dtb_init(struct mmc_card *card) @@ -737,7 +738,7 @@ static const struct file_operations card_proc_fops = { .open = card_proc_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release, + .release = single_release, }; static int add_emmc_partition(struct gendisk *disk, diff --git a/drivers/amlogic/reg_access/reg_access.c b/drivers/amlogic/reg_access/reg_access.c index 030222c..3ae2bc1 100644 --- a/drivers/amlogic/reg_access/reg_access.c +++ b/drivers/amlogic/reg_access/reg_access.c @@ -178,6 +178,7 @@ static const struct file_operations dump_file_ops = { .read = seq_read, .write = dump_write_file, .llseek = seq_lseek, + .release = single_release, }; static int __init aml_debug_init(void) { -- 2.7.4