android_kernel_oneplus_msm8998/fs/sdcardfs
Ritesh Harjani 13172f49e6 ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.
sdcardfs_name_match gets a 'name' argument from the underlying FS.
This need not be null terminated string.
So in sdcardfs_name_match -> qstr_case_eq -> we should use
str_n_case_eq.

This happens because few of the entries in lower level FS may not be
NULL terminated and may have some garbage characters passed while
doing sdcardfs_name_match.

For e.g.
 # dmesg |grep Download
 [  103.646386] sdcardfs_name_match: q1->name=.nomedia, q1->len=8,
 q2->name=Download\x17\x80\x03, q2->len=8
 [  104.021340] sdcardfs_name_match: q1->name=.nomedia, q1->len=8,
 q2->name=Download\x17\x80\x03, q2->len=8
 [  105.196864] sdcardfs_name_match: q1->name=.nomedia, q1->len=8,
 q2->name=Download\x17\x80\x03, q2->len=8
 [  109.113521] sdcardfs_name_match: q1->name=logs, q1->len=4,
 q2->name=Download\x17\x80\x03, q2->len=8

Now when we try to create a directory with different case for a such
files. SDCARDFS creates a entry if it could not find the underlying
entry in it's dcache.

To reproduce:-
1. bootup the device wait for some time after sdcardfs mounting to
   complete.
2. cd /storage/emulated/0
3. echo 3 > /proc/sys/vm/drop_caches
4. mkdir download

We now start seeing two entries with name.
Download & download.

Change-Id: I976d92a220a607dd8cdb96c01c2041c5c2bc3326
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
bug: 75987238
2018-04-06 15:31:18 -07:00
..
dentry.c ANDROID: sdcardfs: Check for NULL in revalidate 2017-05-23 00:18:43 +00:00
derived_perm.c ANDROID: sdcardfs: Protect set_top 2018-02-02 19:32:16 -08:00
file.c ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures 2018-03-15 19:48:16 -07:00
inode.c ANDROID: sdcardfs: Use lower getattr times/size 2018-02-02 19:03:19 -08:00
Kconfig sdcardfs: remove effectless config option 2016-03-23 17:48:27 -07:00
lookup.c ANDROID: sdcardfs: d_splice_alias can return error values 2017-06-07 13:51:22 -07:00
main.c ANDROID: sdcardfs: Protect set_top 2018-02-02 19:32:16 -08:00
Makefile Included sdcardfs source code for kernel 3.0 2016-03-22 20:27:13 -07:00
mmap.c ANDROID: sdcardfs: Directly pass lower file for mmap 2017-04-11 14:25:31 -07:00
multiuser.h ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges 2017-04-26 16:56:27 -07:00
packagelist.c ANDROID: sdcardfs: Set num in extension_details during make_item 2018-02-26 16:15:34 -08:00
sdcardfs.h ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries. 2018-04-06 15:31:18 -07:00
super.c ANDROID: sdcardfs: Protect set_top 2018-02-02 19:32:16 -08:00