[PATCH v2] char: tpm: fix error return code in tpm_cr50_i2c_tis_recv()

2021-04-08 Thread Zhihao Cheng
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: 3a253caaad11 ("char: tpm: add i2c driver for cr50") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/char/tpm/tpm_tis_i2c_cr50.c | 1 + 1 file

[PATCH] char: tpm: fix error return code in tpm_cr50_i2c_tis_recv()

2021-04-08 Thread Zhihao Cheng
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: 3a253caaad11 ("char: tpm: add i2c driver for cr50") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/char/tpm/tpm_tis_i2c_cr50.c | 1 + 1 file

[PATCH] perf tools: Fix error return code in cmd_buildid_cache()

2021-04-08 Thread Zhihao Cheng
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: e3ed75bb537a8 ("perf buildid-cache: Move session...") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- tools/perf/builtin-buildid-cache.c | 3 ++- 1 file

Re: [PATCH 3/4] ubifs: Update directory size when creating whiteouts

2021-01-25 Thread Zhihao Cheng
在 2021/1/25 15:55, Richard Weinberger 写道: The idea was that in the !whiteout case, sz_change is always 0. Oh, sz_change was initialized to 0, I missed it. Thanks.

Re: [PATCH 3/4] ubifs: Update directory size when creating whiteouts

2021-01-24 Thread Zhihao Cheng
在 2021/1/23 10:45, Zhihao Cheng 写道: @@ -430,6 +433,7 @@ static int do_tmpfile(struct inode *dir, struct dentry *dentry,   return 0;   out_cancel: Still one question: Does this need a judgment? Like this, if (whiteout)     dir->i_size -= sz_change; +    dir->i_size -= sz_

Re: [PATCH 3/4] ubifs: Update directory size when creating whiteouts

2021-01-22 Thread Zhihao Cheng
在 2021/1/23 5:22, Richard Weinberger 写道: Although whiteouts are unlinked files they will get re-linked later, I just want to make sure, is this where the count is increased? do_rename -> inc_nlink(whiteout) therefore the size of the parent directory needs to be updated too. Cc:

Re: [PATCH 1/4] ubifs: Correctly set inode size in ubifs_link()

2021-01-22 Thread Zhihao Cheng
在 2021/1/23 5:22, Richard Weinberger 写道: Reviewed-by: Zhihao Cheng diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 9a6b8660425a..04912dedca48 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -693,7 +693,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir

Re: [PATCH] ubifs: Fix memleak in ubifs_init_authentication

2021-01-04 Thread Zhihao Cheng
在 2021/1/5 14:03, Dinghao Liu 写道: When crypto_shash_digestsize() fails, c->hmac_tfm has not been freed before returning, which leads to memleak. Fixes: 49525e5eecca5 ("ubifs: Add helper functions for authentication support") Signed-off-by: Dinghao Liu Reviewed-by: Zhihao Che

Re: [PATCH v2] ubifs: Fix read out-of-bounds in ubifs_jnl_write_inode()

2020-12-23 Thread Zhihao Cheng
在 2020/12/24 7:07, Richard Weinberger 写道: Reproducer: 0. config KASAN && apply print.patch 1. mount ubifs on /root/temp 2. run test.sh What does test.sh do? Go to Link: https://bugzilla.kernel.org/show_bug.cgi?id=210865. test.sh creates a very long path file test_file, and then create a

Re: [PATCH] ubifs: Fix read out-of-bounds in ubifs_jnl_write_inode()

2020-12-22 Thread Zhihao Cheng
在 2020/12/23 14:28, Chengsong Ke 写道: Reviewed-by: Zhihao Cheng From: kechengsong ubifs_jnl_write_inode() probably cause read out-of-bounds in some situation. There is kasan stack: [ 336.432159] BUG: KASAN: slab-out-of-bounds in ecc_sw_hamming_calculate+0x1dc/0x7d0 [ 336.433634] Read

[PATCH v2] btrfs: free-space-cache: Fix error return code in __load_free_space_cache

2020-12-07 Thread Zhihao Cheng
uld be there for clarity. Fixes: a67509c30079f4c50 ("Btrfs: add a io_ctl struct and helpers for dealing with the space cache") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- fs/btrfs/free-space-cache.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/

[PATCH] dmaengine: mv_xor_v2: Fix error return code in mv_xor_v2_probe()

2020-11-23 Thread Zhihao Cheng
Return the corresponding error code when first_msi_entry() returns NULL in mv_xor_v2_probe(). Fixes: 19a340b1a820430 ("dmaengine: mv_xor_v2: new driver") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/dma/mv_xor_v2.c | 4 +++- 1 file changed, 3 insertions(+),

[PATCH] mmc: pxamci: Fix error return code in pxamci_probe

2020-11-20 Thread Zhihao Cheng
Fix to return the error code from devm_gpiod_get_optional() instaed of 0 in pxamci_probe(). Fixes: f54005b508b9a9d9c ("mmc: pxa: Use GPIO descriptor for power") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/mmc/host/pxamci.c | 1 + 1 file changed, 1 insertion(+)

[PATCH] btrfs: free-space-cache: Fix error return code in __load_free_space_cache

2020-11-19 Thread Zhihao Cheng
Fix to return the error code(instead always 0) when memory allocating failed in __load_free_space_cache(). Fixes: a67509c30079f4c50 ("Btrfs: add a io_ctl struct and helpers ...") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- fs/btrfs/free-space-cache.c | 6 +- 1 file

[PATCH] drivers: soc: ti: knav_qmss_queue: Fix error return code in knav_queue_probe

2020-11-19 Thread Zhihao Cheng
Fix to return the error code from of_get_child_by_name() instaed of 0 in knav_queue_probe(). Fixes: 41f93af900a20d1a0a ("soc: ti: add Keystone Navigator QMSS driver") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/soc/ti/knav_qmss_queue.c | 3 ++- 1 file changed, 2

Re: [PATCH] ubifs: wbuf: Don't leak kernel memory to flash

2020-11-17 Thread Zhihao Cheng
在 2020/11/17 16:43, Richard Weinberger 写道: On Tue, Nov 17, 2020 at 2:28 AM Zhihao Cheng wrote: Reviewed-by: Zhihao Cheng Thanks for reviewing, highly appreciated! You're welcome. Actually I've been following the linux-mtd. It's just that this patch isn't complicated, so I checked it. :-)

Re: [PATCH] ubifs: wbuf: Don't leak kernel memory to flash

2020-11-16 Thread Zhihao Cheng
< 8); + ubifs_pad(c, wbuf->buf + len, aligned_len - len); + } + } if (c->leb_size - wbuf->offs >= c->max_write_size) wbuf->size = c->max_write_size; Reviewed-by: Zhihao Cheng

[PATCH v2] spi: cadence-quadspi: Fix error return code in cqspi_probe

2020-11-16 Thread Zhihao Cheng
Fix to return the error code from devm_reset_control_get_optional_exclusive() instaed of 0 in cqspi_probe(). Fixes: 31fb632b5d43ca ("spi: Move cadence-quadspi driver to drivers/spi/") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/spi/spi-cadence-quadspi.c | 2

[PATCH] i2c: qup: Fix error return code in qup_i2c_bam_schedule_desc()

2020-11-16 Thread Zhihao Cheng
Fix to return the error code from qup_i2c_change_state() instaed of 0 in qup_i2c_bam_schedule_desc(). Fixes: fbf9921f8b35d9b2 ("i2c: qup: Fix error handling") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/i2c/busses/i2c-qup.c | 3 ++- 1 file changed, 2 insert

[PATCH] spi: cadence-quadspi: Fix error return code in cqspi_probe

2020-11-16 Thread Zhihao Cheng
Fix to return the error code from devm_reset_control_get_optional_exclusive() instaed of 0 in cqspi_probe(). Fixes: 31fb632b5d43ca ("spi: Move cadence-quadspi driver to drivers/spi/") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/spi/spi-cadence-quadspi.c | 2

[PATCH v2] binfmt_elf_fdpic: return corresponding errcode if create_elf_fdpic_tables() fail

2020-11-16 Thread Zhihao Cheng
Function load_elf_fdpic_binary() may return 0 to caller if create_elf_fdpic_tables() fail, which will misslead caller to continue running without handling errors. Fixes: 1da177e4c3f41524e886 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- fs/binfmt_elf_f

Re: [PATCH RFC 0/5] ubifs: Prevent memory oob accessing while dumping node

2020-10-18 Thread Zhihao Cheng
在 2020/6/16 15:11, Zhihao Cheng 写道: We use function ubifs_dump_node() to dump bad node caused by some reasons (Such as bit flipping caused by hardware error, writing bypass ubifs or unknown bugs in ubifs). The node content can not be trusted anymore, so we should prevent memory out-of-bounds

[PATCH 1/3] ubifs: Fix a memleak after dumping authentication mount options

2020-09-29 Thread Zhihao Cheng
Fix a memory leak after dumping authentication mount options in error handling branch. Signed-off-by: Zhihao Cheng Cc: # 4.20+ Fixes: d8a22773a12c6d7 ("ubifs: Enable authentication support") --- fs/ubifs/super.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletion

[PATCH 2/3] ubifs: Don't parse authentication mount options in remount process

2020-09-29 Thread Zhihao Cheng
options. Signed-off-by: Zhihao Cheng Cc: # 4.20+ Fixes: d8a22773a12c6d7 ("ubifs: Enable authentication support") --- fs/ubifs/super.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 6f85cd618766..97

[PATCH 3/3] ubifs: mount_ubifs: Release authentication resource in error handling path

2020-09-29 Thread Zhihao Cheng
Release the authentication related resource in some error handling branches in mount_ubifs(). Signed-off-by: Zhihao Cheng Cc: # 4.20+ Fixes: d8a22773a12c6d7 ("ubifs: Enable authentication support") --- fs/ubifs/super.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletion

Re: [PATCH 1/2] ubifs: xattr: Fix some potential memory leaks while iterating entries

2020-09-13 Thread Zhihao Cheng
在 2020/9/14 3:08, Richard Weinberger 写道: On Mon, Jun 1, 2020 at 11:11 AM Zhihao Cheng wrote: I agree that this needs fixing. Did you also look into getting rid of pxent? UBIFS uses the pxent pattern over and over and the same error got copy pasted a lot. :-( I thought about it. I'm

[PATCH] ubifs: setflags: Don't show error message when vfs_ioc_setflags_prepare() fails

2020-08-27 Thread Zhihao Cheng
attributes chattr: Operation not permitted while setting flags on a This is not an UBIFS problem, it was caused by task priviliage checking on file operations. Remove error message printing from kernel just like other filesystems (eg. ext4), since we already have enough information from userspace t

[PATCH] ubifs: ubifs_jnl_change_xattr: Remove assertion 'nlink > 0' for host inode

2020-08-17 Thread Zhihao Cheng
value2, XATTR_CREATE) 3. fsetxattr(fd, key, value2, XATTR_REPLACE) Fix this by removing assertion 'nlink > 0' for host inode. Reported-by: Chengsong Ke Signed-off-by: Zhihao Cheng --- fs/ubifs/journal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/ubifs/journal.c b/fs/ubifs/journa

Re: [PATCH] ubi: check kthread_should_stop() after the setting of task state

2020-08-07 Thread Zhihao Cheng
在 2020/8/8 3:29, Richard Weinberger 写道: On Fri, Aug 7, 2020 at 4:18 AM Zhihao Cheng wrote: Maybe it's just me being dense and in need for a vacation. ;-) I have quite a few ubi/ubifs patches in pending list, may you comment/check them before 5.9 ending please? thanks. \( ̄▽ ̄) For example

Re: [PATCH] ubi: check kthread_should_stop() after the setting of task state

2020-08-06 Thread Zhihao Cheng
在 2020/8/7 4:15, Richard Weinberger 写道: On Wed, Aug 5, 2020 at 4:23 AM Zhihao Cheng wrote: Er, I can't get the point. I can list two possible situations, did I miss other situations? Yes. You keep ignoring the case I brought up. Let's start from scratch, maybe I miss something. So I'm sorry

Re: [PATCH] ubi: check kthread_should_stop() after the setting of task state

2020-08-04 Thread Zhihao Cheng
在 2020/8/5 5:56, Richard Weinberger 写道: On Tue, Aug 4, 2020 at 4:58 AM Zhihao Cheng wrote: Oh, you're thinking about influence by schedule(), I get it. But I think it still works. Because the ubi_thread is still on runqueue, it will be scheduled to execute later anyway. It will not get woken

Re: [PATCH] ubi: check kthread_should_stop() after the setting of task state

2020-08-03 Thread Zhihao Cheng
在 2020/8/4 6:11, Richard Weinberger 写道: On Mon, Aug 3, 2020 at 4:01 AM Zhihao Cheng wrote: Hmm, I see the problem but I fear this patch does not cure the race completely. It just lowers the chance to hit it. What if KTHREAD_SHOULD_STOP is set right after you checked for it? The patch can

Re: [PATCH] ubi: check kthread_should_stop() after the setting of task state

2020-08-02 Thread Zhihao Cheng
在 2020/8/3 5:25, Richard Weinberger 写道: On Mon, Jun 1, 2020 at 11:13 AM Zhihao Cheng wrote: A detach hung is possible when a race occurs between the detach process and the ubi background thread. The following sequences outline the race: ubi thread: if (list_empty(>works)... ubi det

[f2fs-dev][PATCH] f2fs: update_sit_entry: Make the judgment condition of f2fs_bug_on more intuitive

2020-07-31 Thread Zhihao Cheng
Current judgment condition of f2fs_bug_on in function update_sit_entry(): new_vblocks >> (sizeof(unsigned short) << 3) || new_vblocks > sbi->blocks_per_seg which equivalents to: new_vblocks < 0 || new_vblocks > sbi->blocks_per_seg The latter is more intuit

Re: [PATCH] ubifs: Fix a potential space leak problem while linking tmpfile

2020-07-12 Thread Zhihao Cheng
在 2020/7/11 14:37, Zhihao Cheng 写道: 在 2020/7/7 20:47, Richard Weinberger 写道: - Ursprüngliche Mail - Perhaps I misunderstood what commit 32fe905c17f001 ("ubifs: Fix O_TMPFILE corner case in ubifs_link()") wanted to fix. I think orphan area is used to remind filesystem do

Re: [PATCH] ubifs: Fix a potential space leak problem while linking tmpfile

2020-07-11 Thread Zhihao Cheng
在 2020/7/11 14:37, Zhihao Cheng 写道: 在 2020/7/7 20:47, Richard Weinberger 写道: - Ursprüngliche Mail - Perhaps I misunderstood what commit 32fe905c17f001 ("ubifs: Fix O_TMPFILE corner case in ubifs_link()") wanted to fix. I think orphan area is used to remind filesystem do

Re: [PATCH] ubifs: Fix a potential space leak problem while linking tmpfile

2020-07-11 Thread Zhihao Cheng
在 2020/7/7 20:47, Richard Weinberger 写道: - Ursprüngliche Mail - Perhaps I misunderstood what commit 32fe905c17f001 ("ubifs: Fix O_TMPFILE corner case in ubifs_link()") wanted to fix. I think orphan area is used to remind filesystem don't forget to delete inodes (whose nlink is 0) in

[PATCH v3 1/2] ubi: fastmap: Don't produce the initial next anchor PEB when fastmap is disabled

2020-07-07 Thread Zhihao Cheng
xt anchor PEB) Don't produce the initial next anchor PEB in __erase_worker() when fastmap is disabled. Signed-off-by: Zhihao Cheng Suggested-by: Sascha Hauer Fixes: f9c34bb529975fe ("ubi: Fix producing anchor PEBs") Reported-by: syzbot+d9aab50b1154e3d16...@syzkaller.appspotmail.com -

[PATCH v3 0/2] ubi: fastmap: Produce and release fm_anchor peb correctly

2020-07-07 Thread Zhihao Cheng
v1 -> v2: Adapt Sascha's suggestions for fm_diabled checking in __erase_worker(). v2 -> v3: Free fm_anchor peb during cloing fastmap. Zhihao Cheng (2): ubi: fastmap: Don't produce the initial next anchor PEB when fastmap is disabled ubi: fastmap: Free fastmap next anchor peb

[PATCH v3 2/2] ubi: fastmap: Free fastmap next anchor peb during detach

2020-07-07 Thread Zhihao Cheng
ubi_wl_entry related with the fm_next_anchor PEB is not freed during detach, which causes a memory leak. Don't forget to release fm_next_anchor PEB while detaching ubi from mtd when CONFIG_MTD_UBI_FASTMAP is enabled. Signed-off-by: Zhihao Cheng Fixes: 4b68bf9a69d22d ("ubi: Select fastmap a

[PATCH v2] ubifs: Fix wrong orphan node deletion in ubifs_jnl_update|rename

2020-07-07 Thread Zhihao Cheng
to orphan list before being deleted, Signed-off-by: Zhihao Cheng Fixes: 823838a486888cf484e ("ubifs: Add hashes to the tree node cache") --- fs/ubifs/journal.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index e5

Re: [PATCH] ubifs: Fix a potential space leak problem while linking tmpfile

2020-07-07 Thread Zhihao Cheng
在 2020/7/7 20:09, Richard Weinberger 写道: - Ursprüngliche Mail - Perhaps I misunderstood what commit 32fe905c17f001 ("ubifs: Fix O_TMPFILE corner case in ubifs_link()") wanted to fix. I think orphan area is used to remind filesystem don't forget to delete inodes (whose nlink is 0) in

Re: [PATCH] ubifs: Fix wrong orphan node deletion in ubifs_jnl_update()

2020-07-07 Thread Zhihao Cheng
在 2020/7/7 19:52, Richard Weinberger 写道: On Thu, Jul 2, 2020 at 5:21 PM Zhihao Cheng wrote: There a wrong orphan node deleting in error handling path in ubifs_jnl_update(), which may cause following error msg: UBIFS error (ubi0:0 pid 1522): ubifs_delete_orphan [ubifs]: missing orphan

Re: [PATCH] ubifs: Fix a potential space leak problem while linking tmpfile

2020-07-07 Thread Zhihao Cheng
在 2020/7/7 19:26, Richard Weinberger 写道: On Wed, Jul 1, 2020 at 1:28 PM Zhihao Cheng wrote: There is a potential space leak problem while linking tmpfile, in which case, inode node (with nlink=0) is valid in tnc (on flash), which leads to space leak. Meanwhile, the corresponding data nodes

[PATCH] ubifs: Fix wrong orphan node deletion in ubifs_jnl_update()

2020-07-02 Thread Zhihao Cheng
being deleted, Signed-off-by: Zhihao Cheng --- fs/ubifs/journal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index e5ec1afe1c66..db0a80dd9d52 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -539,7 +539,7 @@ int

[PATCH] ubifs: Fix a potential space leak problem while linking tmpfile

2020-07-01 Thread Zhihao Cheng
eleting relinked tmpfile while replaying orphan area. Since that, tmpfile inode should always live in orphan area even it is linked. Fix it by reverting commit 32fe905c17f001 ("ubifs: Fix O_TMPFILE corner case in ubifs_link()"). Signed-off-by: Zhihao Cheng Cc: # v5.3+ Fixes: 32fe905c17f

[PATCH] ubifs: Fix a potential space leak problem while linking tmpfile

2020-07-01 Thread Zhihao Cheng
eleting relinked tmpfile while replaying orphan area. Since that, tmpfile inode should always live in orphan area even it is linked. Fix it by reverting commit 32fe905c17f001 ("ubifs: Fix O_TMPFILE corner case in ubifs_link()"). Signed-off-by: Zhihao Cheng Cc: Fixes: 32fe905c17f001 (&q

[PATCH RFC 1/5] ubifs: Limit dumping length by size of memory which is allocated for the node

2020-06-16 Thread Zhihao Cheng
ata not beyond the node length. 3. node_type changes: Read data according to type A, but expected type B, before that, node is allocated according to type B's size. Length of type A node is greater than type B node. Signed-off-by: Zhihao Cheng --- fs/ubifs/debug.c |

[PATCH RFC 3/5] ubifs: Pass node length in all node dumping callers

2020-06-16 Thread Zhihao Cheng
Function ubifs_dump_node() has been modified to avoid memory oob accessing while dumping node, node length (corresponding to the size of allocated memory for node) should be passed into all node dumping callers. Signed-off-by: Zhihao Cheng --- fs/ubifs/commit.c | 4 ++-- fs/ubifs/debug.c

[PATCH RFC 0/5] ubifs: Prevent memory oob accessing while dumping node

2020-06-16 Thread Zhihao Cheng
ts after patchset applied: https://bugzilla.kernel.org/show_bug.cgi?id=208203 Zhihao Cheng (5): ubifs: Limit dumping length by size of memory which is allocated for the node Revert "ubifs: Fix out-of-bounds memory access caused by abnormal value of node_len" ubifs: Pass node

[PATCH RFC 4/5] ubifs: ubifs_dump_sleb: Remove unused function

2020-06-16 Thread Zhihao Cheng
Function ubifs_dump_sleb() is defined but unused, it can be removed. Signed-off-by: Zhihao Cheng --- fs/ubifs/debug.c | 16 fs/ubifs/debug.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 24a6e6fb5e9a..2d07615369f9 100644

[PATCH RFC 2/5] Revert "ubifs: Fix out-of-bounds memory access caused by abnormal value of node_len"

2020-06-16 Thread Zhihao Cheng
This reverts commit acc5af3efa303d5f36cc8c0f61716161f6ca1384. No need to avoid memory oob in dumping for data node alone. Later, node length will be passed into function 'ubifs_dump_node()' which replaces all node dumping places. Signed-off-by: Zhihao Cheng --- fs/ubifs/io.c | 16

[PATCH RFC 5/5] ubifs: ubifs_dump_node: Dump all branches of the index node

2020-06-16 Thread Zhihao Cheng
An index node can have up to c->fanout branches, all branches should be displayed while dumping index node. Signed-off-by: Zhihao Cheng --- fs/ubifs/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 2d07615369f9..a65f73e91

[PATCH v2] ubi: fastmap: Don't produce the initial anchor PEB when fastmap is disabled

2020-06-02 Thread Zhihao Cheng
B) Don't produce the initial anchor PEB in __erase_worker() when fastmap is disabled. Signed-off-by: Zhihao Cheng Suggested-by: Sascha Hauer Fixes: f9c34bb529975fe ("ubi: Fix producing anchor PEBs") Reported-by: syzbot+d9aab50b1154e3d16...@syzkaller.appspotmail.com --- drivers/mtd/ubi/w

Re: [PATCH] ubi: fastmap: Don't produce the initial anchor PEB when fastmap is disabled

2020-06-02 Thread Zhihao Cheng
在 2020/6/2 17:23, Sascha Hauer 写道: Hi, On Mon, Jun 01, 2020 at 05:11:34PM +0800, Zhihao Cheng wrote: Following process triggers a memleak caused by forgetting to release the initial anchor PEB (CONFIG_MTD_UBI_FASTMAP is disabled): 1. attach -> __erase_worker -> produce the initial anchor

[PATCH v3] afs: Fix memory leak in afs_put_sysnames()

2020-06-01 Thread Zhihao Cheng
Fix afs_put_sysnames() to actually free the specified afs_sysnames object after its reference count has been decreased to zero and its contents have been released. Signed-off-by: Zhihao Cheng Cc: # v4.17+ Fixes: 6f8880d8e681557 ("afs: Implement @sys substitution handling") --- fs/

Re: [PATCH 1/2] ubifs: Fix potential memory leaks while iterating entries

2020-06-01 Thread Zhihao Cheng
在 2020/6/1 20:00, Markus Elfring 写道: Fix some potential memory leaks in error handling branches while iterating xattr entries. Such information is useful. For example, function ubifs_tnc_remove_ino() forgets to free pxent if it exists. Similar problems also exist in ubifs_purge_xattrs(),

[PATCH v2] afs: Fix memory leak in afs_put_sysnames()

2020-06-01 Thread Zhihao Cheng
sysnames should be freed after refcnt being decreased to zero in afs_put_sysnames(). Signed-off-by: Zhihao Cheng Cc: # v4.17+ Fixes: 6f8880d8e681557 ("afs: Implement @sys substitution handling") --- fs/afs/proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/proc.c b/fs/

[PATCH] afs: Fix memory leak in afs_put_sysnames()

2020-06-01 Thread Zhihao Cheng
sysnames should be freed after refcnt being decreased to zero in afs_put_sysnames(). Besides, it would be better set net->sysnames to 'NULL' after net->sysnames being released if afs_put_sysnames() aims on an afs_sysnames object. Signed-off-by: Zhihao Cheng Cc: # v4.17+ Fixes: 6f8880d8e

[PATCH] ubi: check kthread_should_stop() after the setting of task state

2020-06-01 Thread Zhihao Cheng
fix that, we need to check kthread_should_stop() after we set the task state, so the ubi thread will either see the stop bit and exit or the task state is reset to runnable such that it isn't scheduled out indefinitely. Signed-off-by: Zhihao Cheng Cc: Fixes: 801c135ce73d5df1ca ("UBI: Unsorted

[PATCH] ubi: fastmap: Don't produce the initial anchor PEB when fastmap is disabled

2020-06-01 Thread Zhihao Cheng
B) Don't produce the initial anchor PEB in __erase_worker() when fastmap is disabled. Signed-off-by: Zhihao Cheng Fixes: f9c34bb529975fe ("ubi: Fix producing anchor PEBs") Reported-by: syzbot+d9aab50b1154e3d16...@syzkaller.appspotmail.com --- drivers/mtd/ubi/wl.c | 8 +++- 1 file ch

[PATCH 1/2] ubifs: xattr: Fix some potential memory leaks while iterating entries

2020-06-01 Thread Zhihao Cheng
Fix some potential memory leaks in error handling branches while iterating xattr entries. For example, function ubifs_tnc_remove_ino() forgets to free pxent if it exists. Similar problems also exist in ubifs_purge_xattrs(), ubifs_add_orphan() and ubifs_jnl_write_inode(). Signed-off-by: Zhihao

[PATCH 2/2] ubifs: dent: Fix some potential memory leaks while iterating entries

2020-06-01 Thread Zhihao Cheng
Fix some potential memory leaks in error handling branches while iterating dent entries. For example, function dbg_check_dir() forgets to free pdent if it exists. Signed-off-by: Zhihao Cheng Cc: Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system") --- fs/ubifs/debug.c | 1

Re: [PATCH] ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps

2019-10-18 Thread Zhihao Cheng
Can the current modification method be confirmed? 在 2019/9/16 6:00, Richard Weinberger 写道: > I need to give this another thought

[QUESTION] Hung task warning while running syzkaller test

2019-10-14 Thread Zhihao Cheng
Hi, everyone. We met a hung task problem while running syzkaller test. The stacks of hung tasks vary in net/fs/sched, and we provide a stable reproduce test case in fs. The higher the kernel version, the lower the probability of reproduce. Maybe the mainline has gradually optimized the

Re: [PATCH xfstests] generic/192: Move 'cd /' to the place where the program exits

2019-10-13 Thread Zhihao Cheng
, generic/003. I wonder the intention of operation 'cd /'. 在 2019/10/13 20:46, Eryu Guan 写道: > On Wed, Oct 09, 2019 at 04:27:57PM +0800, Zhihao Cheng wrote: >> Running generic/192 with overlayfs(Let ubifs as base fs) yields the >> following output: >> >> generic/192 -

[PATCH xfstests] generic/192: Move 'cd /' to the place where the program exits

2019-10-09 Thread Zhihao Cheng
'xfstests-dev' to '/', so src/t_dir_type was not found. Signed-off-by: Zhihao Cheng --- tests/generic/192 | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/generic/192 b/tests/generic/192 index 50b3d6fd..5550f39e 100755 --- a/tests/generic/192 +++ b/tests/generic/192

[PATCH xfstests v3] overlay: Enable character device to be the base fs partition

2019-09-25 Thread Zhihao Cheng
/character device, FSTYP is overwritten as 'overlay'. This patch allows the base fs partition to be a character device that can also execute overlay usecases (such as ubifs). Signed-off-by: Zhihao Cheng Signed-off-by: Amir Goldstein --- common/config | 6 +++--- common/rc | 2 +- 2 files changed

Re: [PATCH xfstests v2] overlay: Enable character device to be the base fs partition

2019-09-24 Thread Zhihao Cheng
8AM +0800, Zhihao Cheng wrote: >>> There is a message in _supported_fs(): >>> _notrun "not suitable for this filesystem type: $FSTYP" >>> for when overlay usecases are executed on a chararcter device based base >> >> You can do that? >> >>

Re: [PATCH xfstests] overlay: Enable character device to be the base fs partition

2019-09-24 Thread Zhihao Cheng
Oh, You are right, I understood it wrong. Thanks for reminding. 在 2019/9/25 11:15, Eryu Guan 写道: > On Tue, Sep 24, 2019 at 10:19:38PM +0800, Zhihao Cheng wrote: >> As far as I know, _require_scratch_shutdown() is called after >> _overay_config_override(), at this moment, FSTYP eq

[PATCH xfstests v2] overlay: Enable character device to be the base fs partition

2019-09-24 Thread Zhihao Cheng
ter device judgments for TEST_DEV and SCRATCH_DEV in _overay_config_override(). Signed-off-by: Zhihao Cheng --- common/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/config b/common/config index 4c86a49..a22acdb 100644 --- a/common/config +++ b/common/config @@ -55

Re: [PATCH xfstests] overlay: Enable character device to be the base fs partition

2019-09-24 Thread Zhihao Cheng
But I'll consider describing error more concisely in v2. 在 2019/9/24 20:33, Amir Goldstein 写道: > On Tue, Sep 24, 2019 at 12:34 PM Zhihao Cheng wrote: >> >> When running overlay tests using character devices as base fs partitions, >> all overlay usecase results become 'notrun'.

Re: [PATCH xfstests] overlay: Enable character device to be the base fs partition

2019-09-24 Thread Zhihao Cheng
1s overlay/012 0s overlay/013 0s overlay/014 1s ... Attachments: setup.sh: Create character device for base fs (UBIFS) local.config: Xfstests local configuration 在 2019/9/24 17:40, Zhihao Cheng 写道: > When running overlay tests using character devices as base fs partitions, &g

[PATCH xfstests] overlay: Enable character device to be the base fs partition

2019-09-24 Thread Zhihao Cheng
is a block/character device, FSTYP is overwritten as 'overlay'. This patch allows the base fs partition to be a character device that can also execute overlay usecases (such as ubifs). Signed-off-by: Zhihao Cheng --- common/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [PATCH] ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps

2019-09-15 Thread Zhihao Cheng
在 2019/9/16 6:00, Richard Weinberger 写道: > On Fri, Aug 16, 2019 at 10:01 AM chengzhihao wrote: >> >>> ubifs_assert(c, p < c->gap_lebs + c->lst.idx_lebs); >> >> I've done 50 problem reproduces on different flash devices and made sure >> that the assertion was not triggered. See record.txt for

[PATCH RFC v2] ubi: ubi_wl_get_peb: Increase the number of attempts while getting PEB

2019-08-10 Thread Zhihao Cheng
he biggest number of attempts are shown below: x86_64 arm64 2-core4 4 4-core8 4 8-core4 4 Signed-off-by: Zhihao Cheng --- drivers/mtd/ubi/fastmap-wl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/d

[PATCH RFC] ubi: ubi_wl_get_peb: Replace a limited number of attempts with polling while getting PEB

2019-08-01 Thread Zhihao Cheng
EBs on UBI that can be filled into the pool. So, ubi_wl_get_peb (in fastmap-wil.c) should be implemented to obtain a free PEB by polling method. The polling exit condition is that there is no free PEBs on UBI, no free PEBs in pool, and ubi->works_count is 0. Signed-off-by: Zhihao Cheng --- drivers/mt

[RFC] ubi: ubi_wl_get_peb: Replace a limited number of attempts with polling while getting PEB

2019-08-01 Thread Zhihao Cheng
EBs on UBI that can be filled into the pool. So, ubi_wl_get_peb (in fastmap-wil.c) should be implemented to obtain a free PEB by polling method. The polling exit condition is that there is no free PEBs on UBI, no free PEBs in pool, and ubi->works_count is 0. Signed-off-by: Zhihao Cheng --- drivers/mt

[PATCH] ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps

2019-07-20 Thread Zhihao Cheng
alue of @c->lst.idx_lebs. See detail in https://bugzilla.kernel.org/show_bug.cgi?id=204229. This patch fixes oob in layout_in_gaps. Signed-off-by: Zhihao Cheng --- fs/ubifs/tnc_commit.c | 34 +++--- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a

[PATCH RFC v2] mtd: ubi: Add fastmap sysfs attribute

2019-06-28 Thread Zhihao Cheng
is confirmed valid. Else, there may be some problems with old fastmap. Besides, userspace tool can also check whether the fastmap updating triggered by other operations (such as resize volume) is successful by reading this sysfs attribute. Signed-off-by: Zhihao Cheng --- Documentation/ABI/stable/sysfs

[PATCH RFC] mtd: ubi: Add fastmap sysfs attribute

2019-06-28 Thread Zhihao Cheng
valid. Else, there may be some problems with old fastmap. Besides, userspace tool can also check whether the fastmap updating triggered by other operations (such as resize volume) is successful by reading this sysfs attribute. Signed-off-by: Zhihao Cheng --- Documentation/ABI/stable/sysfs-class