Commit graph

894,770 commits

Author SHA1 Message Date
Shreyas K K
6a66341782 defconfig: Enable service locator and notifier for sdmsteppeauto
Enable service locator and service notifier support on sdmsteppeauto
target.

Change-Id: I8cd97abd03b9f91178bdc6efce08d18e743d5c08
Signed-off-by: Shreyas K K <shrekk@codeaurora.org>
2021-02-22 19:12:58 +05:30
Shreyas K K
ee033423a4 defconfig: Enable LLCC driver for sdmsteppeauto
Enable LLCC driver for sdmsteppeauto target.

Change-Id: I6956378e827fc2b445af6106c72eb7ec0ae722ca
Signed-off-by: Shreyas K K <shrekk@codeaurora.org>
2021-02-22 19:12:11 +05:30
Venkata Rao Kakani
cae095080f defconfig: quinvmauto: Enable Uncompressed kernel
Enable Uncompressed kernel for gvm to get kernel parsed
from host.

Change-Id: I659409112aab8ea78de81e94969053aa2e57fe23
Signed-off-by: Venkata Rao Kakani <vkakani@codeaurora.org>
2021-02-22 17:34:14 +05:30
Venkata Rao Kakani
d8c670d79e defconfig: quinvmauto: Enable DM_INIT
Enable DM_INIT to support dm-mod.create command line parameter
to mount dm-verity enabled system partition.

Change-Id: Ia9afb608d216f0b3295fa2ebb4d6aebc0a497ef0
Signed-off-by: Venkata Rao Kakani <vkakani@codeaurora.org>
2021-02-22 17:28:24 +05:30
Veera Vegivada
528cfb77a9 phy: qcom-ufs: Fix LF markings
Update with proper LF markings.

Change-Id: I2f655fd16b0d98cb96f3ab0893de2099105e5830
Signed-off-by: Veera Vegivada <vvegivad@codeaurora.org>
2021-02-22 16:12:50 +05:30
Wu Gao
c630041763 defconfig: Disable CONFIG_CNSS2_DEBUG for perf build
Disable CONFIG_CNSS2_DEBUG for perf build on SDX65.

Change-Id: I4f685385d28230c08afa8057b201d9e26f8cb202
Signed-off-by: Wu Gao <wugao@codeaurora.org>
2021-02-22 18:16:11 +08:00
Jishnu Prakash
0e83ac3b49 backlight: qcom-spmi-wled: update check for OVP fault in probe
When OVP fault is detected during WLED driver probe, SW first needs to
confirm that OVP event is sustained over a minimum time duration
before fixing it. After reading fault status and seeing OVP is set,
add time delay equal to OVP_INT_TIMER value, and ensure OVP fault
is still seen, before running auto calibration algorithm.

Change-Id: I4fbc75fa1f63af53fe2e1b5298e0e277cc8a74b8
Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
2021-02-22 00:52:30 -08:00
Pradeep P V K
0fdd07ada6 mtd: msm_qpic_nand: Enable Pagescope read feature on sdxlemur
Enable Pagescope read feature on sdxlemur also remove the
software workaround that made for pagescope read feature
on qpic 2.0 controllers because this got fixed on sdxlemur.

Change-Id: I61a2e16d308f80096628024030148a2d6e822ea8
Signed-off-by: Pradeep P V K <pragalla@codeaurora.org>
2021-02-22 13:53:45 +05:30
Yogesh Lal
0c7dfb5103 pinctrl: qcom: Correct sdc1 rclk offset for Shima
Correct the SDC1 rclk offset for configuration for
Shima.

Change-Id: I8c8661870edaa28c621ac1d4c95fa0b44fd518fc
Signed-off-by: Yogesh Lal <ylal@codeaurora.org>
2021-02-22 12:46:11 +05:30
Veera Vegivada
b3a8fb9500 interconnect: qcom: update prio for gpu_tc of scshrike
Update the priority based on the hw recommendation.

Change-Id: I6a53adf7f6c8b4584d146637fd7a4a094fa2dea8
Signed-off-by: Veera Vegivada <vvegivad@codeaurora.org>
2021-02-22 11:52:31 +05:30
Shreyas K K
e7c24883b3 defconfig: gen3auto: Enable boot stats and boot marker
Enable boot stats driver and boot time marker config
options for gen3auto targets.

Change-Id: If9b24937d2fe1df9f8a3eb5f0e8ee1d0b4c4d28f
Signed-off-by: Shreyas K K <shrekk@codeaurora.org>
2021-02-22 11:19:03 +05:30
Chandana Kishori Chiluveru
3f42369d8f slim-msm-ngd: Fix unbalanced core irq disable from ndg_slim_enable
The 'commit 5adc2a6e19 ("slim-msm-ngd: Disable core irq
in SSR/PDR Down notification")' added irq_enable and disable from
ngd_slim_enable function. irq will be enabled only if msm_slim_qmi_init
success where as disabled by default in else block. If QMI init is
failed we will disable the IRQ twice during SSR testing.

As the interrupt line is not enabled, capability exchange is timing out and
leading to freed memory access inside ngd_xfer_msg.

Move irq enable in ndg_slim_enable without depending on QMI init.

Change-Id: Id32b0d283b1653bb4085231694031b0df126cf4b
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
2021-02-22 10:54:55 +05:30
Udipto Goswami
dd34ce10d8 usb: dwc3: Enable parkmode for Gen1 controllers
Commit 8799bc1e517f ("usb: dwc3: Disable parkmode for Gen1 controllers")
was added to disable the park mode which is a debug feature. But, doing
this indirectly affect the host mode throughput for targets using Gen1
controllers in HS mode.

Therefore enabling park mode only for HS to improve the throughput
numbers in host mode.

Change-Id: Iea9e44d0ed0f9e2f9bba6731cae29229d9b46bb1
Signed-off-by: Udipto Goswami <ugoswami@codeaurora.org>
2021-02-21 20:33:25 -08:00
Artem Labazov
5030b0ac32 exfat: Avoid allocating upcase table using kcalloc()
commit 9eb78c25327548b905598975aa3ded4ef244b94a upstream.

The table for Unicode upcase conversion requires an order-5 allocation,
which may fail on a highly-fragmented system:

 pool-udisksd: page allocation failure: order:5,
 mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null),
 cpuset=/,mems_allowed=0
 CPU: 4 PID: 3756880 Comm: pool-udisksd Tainted: G U
 5.8.10-200.fc32.x86_64 #1
 Hardware name: Dell Inc. XPS 13 9360/0PVG6D, BIOS 2.13.0 11/14/2019
 Call Trace:
  dump_stack+0x6b/0x88
  warn_alloc.cold+0x75/0xd9
  ? _cond_resched+0x16/0x40
  ? __alloc_pages_direct_compact+0x144/0x150
  __alloc_pages_slowpath.constprop.0+0xcfa/0xd30
  ? __schedule+0x28a/0x840
  ? __wait_on_bit_lock+0x92/0xa0
  __alloc_pages_nodemask+0x2df/0x320
  kmalloc_order+0x1b/0x80
  kmalloc_order_trace+0x1d/0xa0
  exfat_create_upcase_table+0x115/0x390 [exfat]
  exfat_fill_super+0x3ef/0x7f0 [exfat]
  ? sget_fc+0x1d0/0x240
  ? exfat_init_fs_context+0x120/0x120 [exfat]
  get_tree_bdev+0x15c/0x250
  vfs_get_tree+0x25/0xb0
  do_mount+0x7c3/0xaf0
  ? copy_mount_options+0xab/0x180
  __x64_sys_mount+0x8e/0xd0
  do_syscall_64+0x4d/0x90
  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Make the driver use kvcalloc() to eliminate the issue.

Fixes: 370e812b3ec1 ("exfat: add nls operations")
Cc: stable@vger.kernel.org #v5.7+
Signed-off-by: Artem Labazov <123321artyom@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 5f5240c03aa39b18034ec2b6ecada486ab0d4077
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:23 +08:00
Tetsuhiro Kohada
00b2b0f9d8 exfat: remove useless check in exfat_move_file()
In exfat_move_file(), the identity of source and target directory has been
checked by the caller.
Also, it gets stream.start_clu from file dir-entry, which is an invalid
determination.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: eae503f7eb0509594076a951e422e29082385c96
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:21 +08:00
Tetsuhiro Kohada
705bc56a1e exfat: remove 'rwoffset' in exfat_inode_info
Remove 'rwoffset' in exfat_inode_info and replace it with the parameter of
exfat_readdir().
Since rwoffset is referenced only by exfat_readdir(), it is not necessary
a exfat_inode_info's member.
Also, change cpos to point to the next of entry-set, and return the index
of dir-entry via dir_entry->entry.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 04cee52fb8bdbdb0506460f191ed6fd9e6faf00b
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:20 +08:00
Tetsuhiro Kohada
401cbf6939 exfat: replace memcpy with structure assignment
Use structure assignment instead of memcpy.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: a7a241686c8f8142afafbd5fa5b9b9b6ea1aa173
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:19 +08:00
Tetsuhiro Kohada
73eb91c3d3 exfat: remove useless directory scan in exfat_add_entry()
There is nothing in directory just created, so there is no need to scan.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 6c958a09555515684947d94bfcfa8e8a414f0572
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:17 +08:00
Tetsuhiro Kohada
29a1aca794 exfat: eliminate dead code in exfat_find()
The exfat_find_dir_entry() called by exfat_find() doesn't return -EEXIST.
Therefore, the root-dir information setting is never executed.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 188df41f212c9282f6cb05b832383ffca3c66893
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:16 +08:00
Xianting Tian
2d8566900e exfat: use i_blocksize() to get blocksize
We alreday has the interface i_blocksize() to get blocksize,
so use it.

Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 45882a6a0dbd1189defae1a449152f8a8168c274
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:15 +08:00
Namjae Jeon
567608aa74 exfat: fix misspellings using codespell tool
Sedat reported typos using codespell tool.

 $ codespell fs/exfat/*.c | grep -v iput
 fs/exfat/namei.c:293: upto ==> up to
 fs/exfat/nls.c:14: tabel ==> table

 $ codespell fs/exfat/*.h
 fs/exfat/exfat_fs.h:133: usally ==> usually

Fix typos found by codespell.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 9e456aeaacb6b44c5d8f858800d53c1958daad3d
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:13 +08:00
Namjae Jeon
4e557899b9 exfat: fix use of uninitialized spinlock on error path
syzbot reported warning message:

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d6/0x29e lib/dump_stack.c:118
 register_lock_class+0xf06/0x1520 kernel/locking/lockdep.c:893
 __lock_acquire+0xfd/0x2ae0 kernel/locking/lockdep.c:4320
 lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151
 spin_lock include/linux/spinlock.h:354 [inline]
 exfat_cache_inval_inode+0x30/0x280 fs/exfat/cache.c:226
 exfat_evict_inode+0x124/0x270 fs/exfat/inode.c:660
 evict+0x2bb/0x6d0 fs/inode.c:576
 exfat_fill_super+0x1e07/0x27d0 fs/exfat/super.c:681
 get_tree_bdev+0x3e9/0x5f0 fs/super.c:1342
 vfs_get_tree+0x88/0x270 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 path_mount+0x179d/0x29e0 fs/namespace.c:3192
 do_mount fs/namespace.c:3205 [inline]
 __do_sys_mount fs/namespace.c:3413 [inline]
 __se_sys_mount+0x126/0x180 fs/namespace.c:3390
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

If exfat_read_root() returns an error, spinlock is used in
exfat_evict_inode() without initialization. This patch combines
exfat_cache_init_inode() with exfat_inode_init_once() to initialize
spinlock by slab constructor.

Fixes: c35b6810c495 ("exfat: add exfat cache")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: syzbot <syzbot+b91107320911a26c9a95@syzkaller.appspotmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 8ff006e57ad3a25f909c456d053aa498b6673a39
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:12 +08:00
Tetsuhiro Kohada
25a1fcc929 exfat: fix pointer error checking
Fix missing result check of exfat_build_inode().
And use PTR_ERR_OR_ZERO instead of PTR_ERR.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: d6c9efd92443b23307995f34246c2374056ebbd8
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:10 +08:00
Tetsuhiro Kohada
7c1cfed418 exfat: retain 'VolumeFlags' properly
MediaFailure and VolumeDirty should be retained if these are set before
mounting.

In '3.1.13.3 Media Failure Field' of exfat specification describe:

 If, upon mounting a volume, the value of this field is 1,
 implementations which scan the entire volume for media failures and
 record all failures as "bad" clusters in the FAT (or otherwise resolve
 media failures) may clear the value of  this field to 0.

Therefore, We should not clear MediaFailure without scanning volume.

In '8.1 Recommended Write Ordering' of exfat specification describe:

 Clear the value of the VolumeDirty field to 0, if its value prior to
 the first step was 0.

Therefore, We should not clear VolumeDirty after mounting.
Also rename ERR_MEDIUM to MEDIA_FAILURE.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 7018ec68f08249de17cb131b324d5a48e89ed898
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:09 +08:00
Tetsuhiro Kohada
d8af14f1f0 exfat: optimize exfat_zeroed_cluster()
Replace part of exfat_zeroed_cluster() with exfat_update_bhs().
And remove exfat_sync_bhs().

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 4dc7d35e09ba78aa0a3bcaa9fad1c19952e018a7
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:08 +08:00
Tetsuhiro Kohada
3a45765a8c exfat: add error check when updating dir-entries
Add error check when synchronously updating dir-entries.

Suggested-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 8b0c471773819c8201dc0b0123e1580639ee1570
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:06 +08:00
Tetsuhiro Kohada
637fde8a17 exfat: write multiple sectors at once
Write multiple sectors at once when updating dir-entries.
Add exfat_update_bhs() for that. It wait for write completion once
instead of sector by sector.
It's only effective if sync enabled.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 3db3c3fb840ed4a6c7666d1464959edd40fe54f1
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:05 +08:00
Tetsuhiro Kohada
97ac39868d exfat: remove EXFAT_SB_DIRTY flag
This flag is set/reset in exfat_put_super()/exfat_sync_fs()
to avoid sync_blockdev().
- exfat_put_super():
Before calling this, the VFS has already called sync_filesystem(),
so sync is never performed here.
- exfat_sync_fs():
After calling this, the VFS calls sync_blockdev(), so, it is meaningless
to check EXFAT_SB_DIRTY or to bypass sync_blockdev() here.

Remove the EXFAT_SB_DIRTY check to ensure synchronization.
And remove the code related to the flag.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 2c7f8937ef91520a8a4bd700d5817b5e9c99803c
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:04 +08:00
Ilya Ponetayev
0adf73c46b exfat: fix name_hash computation on big endian systems
On-disk format for name_hash field is LE, so it must be explicitly
transformed on BE system for proper result.

Fixes: 370e812b3ec1 ("exfat: add nls operations")
Cc: stable@vger.kernel.org # v5.7
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Ilya Ponetayev <i.ponetaev@ndmsystems.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: db415f7aae07cadcabd5d2a659f8ad825c905299
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:02 +08:00
Hyeongseok Kim
f39ef0b7c9 exfat: fix wrong size update of stream entry by typo
The stream.size field is updated to the value of create timestamp
of the file entry. Fix this to use correct stream entry pointer.

Fixes: 29bbb14bfc80 ("exfat: fix incorrect update of stream entry in __exfat_truncate()")
Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 41e3928f8c58184fcf0bb22e822af39a436370c7
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:23:01 +08:00
Namjae Jeon
6724d25d69 exfat: fix wrong hint_stat initialization in exfat_find_dir_entry()
We found the wrong hint_stat initialization in exfat_find_dir_entry().
It should be initialized when cluster is EXFAT_EOF_CLUSTER.

Fixes: ca06197382bd ("exfat: add directory operations")
Cc: stable@vger.kernel.org # v5.7
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: d2fa0c337d97a5490190b9f3b9c73c8f9f3602a1
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:59 +08:00
Namjae Jeon
0dbad0f014 exfat: fix overflow issue in exfat_cluster_to_sector()
An overflow issue can occur while calculating sector in
exfat_cluster_to_sector(). It needs to cast clus's type to sector_t
before left shifting.

Fixes: 1acf1a564b60 ("exfat: add in-memory and on-disk structures and headers")
Cc: stable@vger.kernel.org # v5.7
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 43946b70494beefe40ec1b2ba4744c0f294d7736
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:58 +08:00
Sungjong Seo
f6cfd65a55 exfat: flush dirty metadata in fsync
generic_file_fsync() exfat used could not guarantee the consistency of
a file because it has flushed not dirty metadata but only dirty data pages
for a file.

Instead of that, use exfat_file_fsync() for files and directories so that
it guarantees to commit both the metadata and data pages for a file.

Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 5267456e953fd8c5abd8e278b1cc6a9f9027ac0a
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:57 +08:00
Namjae Jeon
12434f933c exfat: move setting VOL_DIRTY over exfat_remove_entries()
Move setting VOL_DIRTY over exfat_remove_entries() to avoid unneeded
leaving VOL_DIRTY on -ENOTEMPTY.

Fixes: 5f2aa075070c ("exfat: add inode operations")
Cc: stable@vger.kernel.org # v5.7
Reported-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 3bcfb701099acf96b0e883bf5544f96af473aa1d
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:55 +08:00
Hyunchul Lee
93c4d7ff9b exfat: call sync_filesystem for read-only remount
We need to commit dirty metadata and pages to disk
before remounting exfat as read-only.

This fixes a failure in xfstests generic/452

generic/452 does the following:
cp something <exfat>/
mount -o remount,ro <exfat>

the <exfat>/something is corrupted. because while
exfat is remounted as read-only, exfat doesn't
have a chance to commit metadata and
vfs invalidates page caches in a block device.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: a0271a15cf2cf907ea5b0f2ba611123f1b7935ec
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:54 +08:00
Dan Carpenter
64362edf40 exfat: add missing brelse() calls on error paths
If the second exfat_get_dentry() call fails then we need to release
"old_bh" before returning.  There is a similar bug in exfat_move_file().

Fixes: 5f2aa075070c ("exfat: add inode operations")
Reported-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: e8dd3cda8667118b70d9fe527f61fe22623de04d
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:53 +08:00
Hyeongseok.Kim
e79cb8c29f exfat: Set the unused characters of FileName field to the value 0000h
Some fsck tool complain that padding part of the FileName field
is not set to the value 0000h. So let's maintain filesystem cleaner,
as exfat's spec. recommendation.

Signed-off-by: Hyeongseok.Kim <Hyeongseok@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 4ba6ccd695f5ed3ae851e59b443b757bbe4557fe
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:51 +08:00
Dan Carpenter
a9516936e5 exfat: Fix potential use after free in exfat_load_upcase_table()
This code calls brelse(bh) and then dereferences "bh" on the next line
resulting in a possible use after free.  The brelse() should just be
moved down a line.

Fixes: b676fdbcf4c8 ("exfat: standardize checksum calculation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: fc961522ddbdf00254dd03b677627139cc1f68bc
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:50 +08:00
hyeongseok.kim
160b739319 exfat: fix range validation error in alloc and free cluster
There is check error in range condition that can never be entered
even with invalid input.
Replace incorrent checking code with already existing valid checker.

Signed-off-by: hyeongseok.kim <hyeongseok@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: a949824f01f3b39f737d77aed6cba47aced09319
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:49 +08:00
Namjae Jeon
522be1fd6a exfat: fix incorrect update of stream entry in __exfat_truncate()
At truncate, there is a problem of incorrect updating in the file entry
pointer instead of stream entry. This will cause the problem of
overwriting the time field of the file entry to new_size. Fix it to
update stream entry.

Fixes: 98d917047e8b ("exfat: add file operations")
Cc: stable@vger.kernel.org # v5.7
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 29bbb14bfc80dd760b07d2be0a27e610562982e3
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:47 +08:00
Al Viro
39e181c7f0 exfat: fix memory leak in exfat_parse_param()
butt3rflyh4ck reported memory leak found by syzkaller.

A param->string held by exfat_mount_options.

BUG: memory leak

unreferenced object 0xffff88801972e090 (size 8):
  comm "syz-executor.2", pid 16298, jiffies 4295172466 (age 14.060s)
  hex dump (first 8 bytes):
    6b 6f 69 38 2d 75 00 00                          koi8-u..
  backtrace:
    [<000000005bfe35d6>] kstrdup+0x36/0x70 mm/util.c:60
    [<0000000018ed3277>] exfat_parse_param+0x160/0x5e0
fs/exfat/super.c:276
    [<000000007680462b>] vfs_parse_fs_param+0x2b4/0x610
fs/fs_context.c:147
    [<0000000097c027f2>] vfs_parse_fs_string+0xe6/0x150
fs/fs_context.c:191
    [<00000000371bf78f>] generic_parse_monolithic+0x16f/0x1f0
fs/fs_context.c:231
    [<000000005ce5eb1b>] do_new_mount fs/namespace.c:2812 [inline]
    [<000000005ce5eb1b>] do_mount+0x12bb/0x1b30 fs/namespace.c:3141
    [<00000000b642040c>] __do_sys_mount fs/namespace.c:3350 [inline]
    [<00000000b642040c>] __se_sys_mount fs/namespace.c:3327 [inline]
    [<00000000b642040c>] __x64_sys_mount+0x18f/0x230 fs/namespace.c:3327
    [<000000003b024e98>] do_syscall_64+0xf6/0x7d0
arch/x86/entry/common.c:295
    [<00000000ce2b698c>] entry_SYSCALL_64_after_hwframe+0x49/0xb3

exfat_free() should call exfat_free_iocharset(), to prevent a leak
in case we fail after parsing iocharset= but before calling
get_tree_bdev().

Additionally, there's no point copying param->string in
exfat_parse_param() - just steal it, leaving NULL in param->string.
That's independent from the leak or fix thereof - it's simply
avoiding an extra copy.

Fixes: 719c1e182916 ("exfat: add super block operations")
Cc: stable@vger.kernel.org # v5.7
Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: f341a7d8dcc4e3d01544d7bc145633f062ef6249
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:46 +08:00
Namjae Jeon
d9c8e203b5 exfat: remove unnecessary reassignment of p_uniname->name_len
kbuild test robot reported :

	fs/exfat/nls.c:531:22: warning: Variable 'p_uniname->name_len'
	is reassigned a value before the old one has been used.

The reassignment of p_uniname->name_len is not needed and remove it.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: f78059805fb9fc5c343e89f39cf11856d047dd60
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:45 +08:00
Tetsuhiro Kohada
0547dcff3f exfat: standardize checksum calculation
To clarify that it is a 16-bit checksum, the parts related to the 16-bit
checksum are renamed and change type to u16.
Furthermore, replace checksum calculation in exfat_load_upcase_table()
with exfat_calc_checksum32().

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 5875bf287d95314c58add01184f361cc5aa38429
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:43 +08:00
Tetsuhiro Kohada
cff207c559 exfat: add boot region verification
Add Boot-Regions verification specified in exFAT specification.
Note that the checksum type is strongly related to the raw structure,
so the'u32 'type is used to clarify the number of bits.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 476189c0ef3b658de3f6b89fd0fdeb6dc451b564
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:42 +08:00
Tetsuhiro Kohada
88d53600ae exfat: separate the boot sector analysis
Separate the boot sector analysis to read_boot_sector().
And add a check for the fs_name field.
Furthermore, add a strict consistency check, because overlapping areas
can cause serious corruption.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 33404a159828a97fefada0d8f4cf910873b8e9f1
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:41 +08:00
Tetsuhiro Kohada
99d787fc66 exfat: redefine PBR as boot_sector
Aggregate PBR related definitions and redefine as "boot_sector" to comply
with the exFAT specification.
And, rename variable names including 'pbr'.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 181a9e8009a8a8bdb19c2e24eeeae7d8e77c8c47
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:39 +08:00
Tetsuhiro Kohada
73da91e6fa exfat: optimize dir-cache
Optimize directory access based on exfat_entry_set_cache.
 - Hold bh instead of copied d-entry.
 - Modify bh->data directly instead of the copied d-entry.
 - Write back the retained bh instead of rescanning the d-entry-set.
And
 - Remove unused cache related definitions.

Signed-off-by: Tetsuhiro Kohada <kohada.tetsuhiro@dc.mitsubishielectric.co.jp>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 943af1fdacfebe4ff13430655abc460a5e1072f7
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:38 +08:00
Tetsuhiro Kohada
97257ea7d6 exfat: replace 'time_ms' with 'time_cs'
Replace time_ms  with time_cs in the file directory entry structure
and related functions.

The unit of create_time_ms/modify_time_ms in File Directory Entry are not
'milli-second', but 'centi-second'.
The exfat specification uses the term '10ms', but instead use 'cs' as in
msdos_fs.h.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: ed0f84d30ba65f44bed2739572c7ab0fdeed4004
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:36 +08:00
Jason Yan
1651428277 exfat: remove the assignment of 0 to bool variable
There is no need to init 'sync' in exfat_set_vol_flags().
This also fixes the following coccicheck warning:

fs/exfat/super.c:104:6-10: WARNING: Assignment of 0/1 to bool variable

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: cdc06129a6cea0e4863fa2b34a0c132c6eb7278b
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:34 +08:00
Pali Rohár
95e5256add exfat: Remove unused functions exfat_high_surrogate() and exfat_low_surrogate()
After applying previous two patches, these functions are not used anymore.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Git-commit: 6778337a7a4e51ec9fa4a76846d34e8a66ca6418
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: lixiang <lixiang@codeaurora.org>
2021-02-22 11:22:33 +08:00