import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / char / misc.c
index 190d4423653f6b99690967ba3602915eda5463fb..e3c29ea378fa6c481bf0677eaad49789f83063c5 100644 (file)
@@ -144,7 +144,18 @@ static int misc_open(struct inode * inode, struct file * file)
        old_fops = file->f_op;
        file->f_op = new_fops;
        if (file->f_op->open) {
-               file->private_data = c;
+
+
+               /*
+                * FIXME: this is a workaround for pmem
+                * PMEM need private_data to be NULL for an unmapped file.
+                * The private_data is used to store PMEM internal data strucutre.
+                * Leakage may happen if we just override this field in pmem_open function
+                */
+               if (strcmp(c->name, "pmem_multimedia") != 0 && strcmp(c->name, "vmem_multimedia") != 0)
+                       file->private_data = c;
+
+
                err=file->f_op->open(inode,file);
                if (err) {
                        fops_put(file->f_op);