Re: [REF PATCH] mm/swap: fix swapon failure

2020-11-09 Thread linmiaohe
Hi: Alex Shi wrote: > One of my VM guest has a swapon issue: > root #swapon -v -f /swap1 > swapon /swap1 > swapon: /swap1: found swap signature: version 1, page-size 4, same byte order > swapon: /swap1: pagesize=4096, swapsize=1607467008, devsize=1607467008 > swapon: /swap1: swapon failed:

Re: [PATCH] mm: swap: Use memset to fill the swap_map with SWAP_HAS_CACHE

2020-10-25 Thread linmiaohe
Andrew Morton wrote: > On Mon, 21 Sep 2020 08:22:24 -0400 Miaohe Lin wrote: > >> We could use helper memset to fill the swap_map with SWAP_HAS_CACHE >> instead of a direct loop here to simplify the code. Also we can remove >> the local variable i and map this way. >> *slot =

Re: [PATCH] mm/swap_state: Skip meaningless swap cache readahead when ra_info.win == 0

2020-10-25 Thread linmiaohe
Andrew Morton wrote: > On Fri, 9 Oct 2020 09:30:59 -0400 Miaohe Lin wrote: > >> swap_ra_info() may leave ra_info untouched in non_swap_entry() case as >> page table lock is not held. In this case, we have ra_info.nr_pte == 0 >> and it is meaningless to continue with swap cache readahead. Skip

Re: [Question Resend] About z3fold page migration

2020-10-12 Thread linmiaohe
Matthew Wilcox wrote: > On Mon, Oct 12, 2020 at 02:00:17PM +0000, linmiaohe wrote: >> Hi all: >> >> Many thanks for brilliant z3fold code. I am reading it and have some >> questions about it. It's very nice of you if you can explain it for me. >>

[Question Resend] About z3fold page migration

2020-10-12 Thread linmiaohe
Hi all: Many thanks for brilliant z3fold code. I am reading it and have some questions about it. It's very nice of you if you can explain it for me. 1.page->private is used in z3fold but PagePrivate flag is never set, should we SetPagePrivate for it? 2.Since PagePrivate

[Question] About z3fold page migration

2020-10-12 Thread linmiaohe
Hi Vitaly: Many thanks for your brilliant z3fold code. I am reading it and have some questions about it. It's very nice of you if you can explain it for me. 1.page->private is used in z3fold but PagePrivate flag is never set, should we SetPagePrivate for it? 2.Since

Re: [PATCH] page-flags: Remove unused __[Set|Clear]PagePrivate

2020-10-11 Thread linmiaohe
David Hildenbrand wrote: >> Am 10.10.2020 um 03:53 schrieb linmiaohe : >> >> David Hildenbrand wrote: >>>> On 09.10.20 15:59, Miaohe Lin wrote: >>>> They are unused anymore. >>> >>> -EINVAL, sentence does not make sense :

Re: [PATCH] mm: memcontrol: eliminate redundant check in __mem_cgroup_insert_exceeded()

2020-10-09 Thread linmiaohe
Michal Hocko wrote: > On Fri 09-10-20 09:51:04, Miaohe Lin wrote: >> The mz->usage_in_excess >= mz_node->usage_in_excess check is exactly >> the else case of mz->usage_in_excess < mz_node->usage_in_excess. So we >> could replace else if (mz->usage_in_excess >= >> mz_node->usage_in_excess) with

Re: [PATCH] page-flags: Remove unused __[Set|Clear]PagePrivate

2020-10-09 Thread linmiaohe
David Hildenbrand wrote: > On 09.10.20 15:59, Miaohe Lin wrote: >> They are unused anymore. > >-EINVAL, sentence does not make sense :) > >"They are not used anymore." >"They are unused ." My poor English. ;) Will change it in v2 soon. Many Thanks. > >Reviewed-by: David Hildenbrand >

Re: [PATCH 1/6] mm: mmap: fix fput in error path

2020-10-09 Thread linmiaohe
Jason Gunthorpe wrote: > On Fri, Oct 09, 2020 at 03:04:20PM -0700, Andrew Morton wrote: >> On Fri, 9 Oct 2020 17:03:37 +0200 "Christian König" >> wrote: >> >> > Patch "495c10cc1c0c CHROMIUM: dma-buf: restore args..." >> > adds a workaround for a bug in mmap_region. >> > >> > As the comment

Re: [PATCH] mm: mmap: Fix general protection fault in unlink_file_vma()

2020-10-09 Thread linmiaohe
Andrew Morton wrote: > On Thu, 8 Oct 2020 07:17:18 +0000 linmiaohe wrote: > >> Andrew Morton wrote: >> > On Wed, 16 Sep 2020 05:07:33 -0400 Miaohe Lin wrote: >> > >> >> The syzbot reported the below general protection fault: >> &

Re: [PATCH] mm: mmap: Fix general protection fault in unlink_file_vma()

2020-10-08 Thread linmiaohe
Andrew Morton wrote: > On Wed, 16 Sep 2020 05:07:33 -0400 Miaohe Lin wrote: > >> The syzbot reported the below general protection fault: >> >> general protection fault, probably for non-canonical address >> 0xe00eeaee003b: [#1] PREEMPT SMP KASAN >> KASAN: maybe wild-memory-access in

Re: [PATCH] mm: mmap: Fix general protection fault in unlink_file_vma()

2020-10-06 Thread linmiaohe
Friendly ping. > The syzbot reported the below general protection fault: > > general protection fault, probably for non-canonical address > 0xe00eeaee003b: [#1] PREEMPT SMP KASAN > KASAN: maybe wild-memory-access in range > [0x007001d8-0x007001df] > CPU: 1 PID: 10488

Re: [PATCH] mm: swap: Use memset to fill the swap_map with SWAP_HAS_CACHE

2020-10-06 Thread linmiaohe
Friendly ping. > We could use helper memset to fill the swap_map with SWAP_HAS_CACHE instead > of a direct loop here to simplify the code. Also we can remove the local > variable i and map this way. > > Signed-off-by: Miaohe Lin > --- > mm/swapfile.c | 7 ++- > 1 file changed, 2

Re: [PATCH] locking/atomic/bitops: Fix some wrong param names in comments

2020-09-30 Thread linmiaohe
Friendly ping :) > Correct the wrong param name @addr to @p. > > Signed-off-by: Miaohe Lin > --- > include/asm-generic/bitops/lock.h | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/asm-generic/bitops/lock.h > b/include/asm-generic/bitops/lock.h

Re: [PATCH v2] block: Fix potential page reference leak in __bio_iov_append_get_pages()

2020-09-30 Thread linmiaohe
Friendly ping :) > When bio_add_hw_page() failed, we left page reference still held in pages > from iov_iter_get_pages(). Release these references and also advance the > iov_iter according to what we have done successfully yet. > > Fixes: 0512a75b98f8 ("block: Introduce REQ_OP_ZONE_APPEND") >

Re: [PATCH v2] mm: memcontrol: remove obsolete comment of mem_cgroup_unmark_under_oom()

2020-09-29 Thread linmiaohe
Michal Hocko wrote: > On Thu 17-09-20 06:59:00, Miaohe Lin wrote: >> Since commit 79dfdaccd1d5 ("memcg: make oom_lock 0 and 1 based rather >> than counter"), the mem_cgroup_unmark_under_oom() is added and the >> comment of the mem_cgroup_oom_unlock() is moved here. But this comment >> make no

Re: [PATCH v2] mm/mempool: Add 'else' to split mutually exclusive case

2020-09-24 Thread linmiaohe
Andrew Morton wrote: > On Thu, 24 Sep 2020 07:16:41 -0400 Miaohe Lin wrote: > >> Add else to split mutually exclusive case and avoid some unnecessary check. >> It doesn't seem to change code generation (compiler is smart), but I >> think it helps readability. > > OK, I guess. But the comments

Re: [PATCH] block: Use helper function blk_mq_hctx_stopped() in blk_mq_run_work_fn()

2020-09-24 Thread linmiaohe
Friend ping :) > Use helper function blk_mq_hctx_stopped() to check if hardware queue stopped > in blk_mq_run_work_fn(). > > Signed-off-by: Miaohe Lin > --- > block/blk-mq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH] block: Use helper function blk_mq_sched_needs_restart()

2020-09-24 Thread linmiaohe
Friendly ping :) > > Use helper function blk_mq_sched_needs_restart() to check if hardware queue > needs restart. > > Signed-off-by: Miaohe Lin > --- > block/blk-mq-sched.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-)

Re: [PATCH] block: Fix various comments

2020-09-24 Thread linmiaohe
Friendly ping :) > Fix various comments including wrong function names, global variable name and > so on. > > Signed-off-by: Miaohe Lin > --- > block/bio.c | 2 +- > block/blk-cgroup.c | 2 +- > block/blk-mq.c | 4 ++-- > block/blk-throttle.c | 2 +- > 4 files changed, 5

Re: [PATCH] sched: Fix some comments

2020-09-24 Thread linmiaohe
Friendly ping. :) > Since commit dfa50b605c2a ("sched: Make finish_task_switch() return 'struct > rq *'"), prev == current is incorrect in finish_task_switch(). Also fix a > typo in the comment of struct dl_bandwidth. > > Signed-off-by: Miaohe Lin > --- > kernel/sched/core.c | 4 ++-- >

Re: [PATCH v2] lib: fix incomplete comment in refcount_dec_and_lock_irqsave()

2020-09-21 Thread linmiaohe
Will Deacon wrote: > On Mon, Sep 21, 2020 at 07:23:58AM -0400, Miaohe Lin wrote: >> The description of arg flags is incomplete. The flags is saved >> IRQ-flags when the @lock is acquired. >> >> + * @flags: saved IRQ-flags if the is @lock acquired > >This still isn't quite right. If we go with:

Re: [PATCH] mm: avoid possible multiple call to swap_node()

2020-09-17 Thread linmiaohe
Matthew Wilcox wrote: > On Thu, Sep 17, 2020 at 07:44:49AM -0400, Miaohe Lin wrote: >> Cache the swap_node() in a local variable to avoid possible multiple >> call to swap_node(), though compiler may do this for us. > >Why don't you find out? Compare the assembly before and after, see what the

Re: [PATCH v2] nfs: remove incorrect fallthrough label

2020-09-17 Thread linmiaohe
Nick Desaulniers wrote: > There is no case after the default from which to fallthrough to. Clang will > error in this case (unhelpfully without context, see link below) and GCC will > with -Wswitch-unreachable. > >The previous commit should have just replaced the comment with a break

Re: [PATCH] mm: memcontrol: correct the comment of mem_cgroup_unmark_under_oom()

2020-09-16 Thread linmiaohe
Michal Hocko wrote: > On Wed 16-09-20 09:19:27, Miaohe Lin wrote: >> Since commit fb2a6fc56be6 ("mm: memcg: rework and document OOM waiting >> and wakeup"), we have renamed mem_cgroup_oom_lock to >> mem_cgroup_oom_trylock. So replace mem_cgroup_oom_lock with >> mem_cgroup_oom_trylock in

Re: general protection fault in unlink_file_vma

2020-09-16 Thread linmiaohe
1506f0 >DR0: 0000 DR1: DR2: >DR3: DR6: fffe0ff0 DR7: 0400 > > >Tested on: > >commit: 152d246f mmap: revert mm-mmap-merge-vma-after-call_mmap-if.. >git tree: https://github.com/Linmiaoh

Re: general protection fault in unlink_file_vma

2020-09-16 Thread linmiaohe
R1: DR2: >DR3: DR6: fffe0ff0 DR7: 0400 Kernel panic >- not syncing: Fatal exception Kernel Offset: disabled > > >Tested on: > >commit: 8f79400b fix vma_merge gpf >git tree: https

Re: general protection fault in unlink_file_vma

2020-09-15 Thread linmiaohe
293 R12: 0118cf40 > R13: 0118d940 R14: R15: 0118cfec Kernel > Offset: disabled Rebooting in 86400 seconds.. > > > Tested on: > > commit: 796cd8f4 fix gpf > git tree: https://github.com/Linmiaohe/linux/ >

Re: [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap()

2020-09-15 Thread linmiaohe
Christian Brauner wrote: > On Sun, Sep 13, 2020 at 05:24:15AM -0400, Miaohe Lin wrote: >> Use helper function mapping_allow_writable() to atomic_inc i_mmap_writable. >> >> Signed-off-by: Miaohe Lin >> --- > >Hey Miaohe, > >Thanks for the patch! >Per se there's nothing against using a proper

Re: general protection fault in unlink_file_vma

2020-09-15 Thread linmiaohe
00293 R12: 0118cf40 >R13: 0118d940 R14: R15: 0118cfec Kernel >Offset: disabled Rebooting in 86400 seconds.. > > >Tested on: > >commit: 796cd8f4 fix gpf >git tree: https://github.com/Linmiaohe/linux/ >console output:

Re: [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap()

2020-09-15 Thread linmiaohe
Eric W. Biederman wrote: > linmiaohe writes: >> Eric W. Biederman wrote: >>> Miaohe Lin writes: >>> >>>> Use helper function mapping_allow_writable() to atomic_inc >>>> i_mmap_writable. >>> >>>Why? >>> >> >

Re: [PATCH] mm: memcontrol: Correct the comment of mem_cgroup_iter()

2020-09-14 Thread linmiaohe
Michal Hocko wrote: > On Sun 13-09-20 05:41:29, Miaohe Lin wrote: >> Since commit bbec2e15170a ("mm: rename page_counter's count/limit into >> usage/max"), the arg @reclaim has no priority field anymore. > >The priority field has been removed by 9da83f3fc74b ("mm, memcg: clean up >reclaim iter

Re: general protection fault in unlink_file_vma

2020-09-14 Thread linmiaohe
gnal+0x82/0x2520 arch/x86/kernel/signal.c:811 > exit_to_user_mode_loop kernel/entry/common.c:136 [inline] > exit_to_user_mode_prepare+0x1ae/0x200 kernel/entry/common.c:167 > syscall_exit_to_user_mode+0x7e/0x2e0 kernel/entry/common.c:242 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 #syz test: https://github.com/Linmiaohe/linux/ 796cd8f497d5b62b00667229375326381c32bdb3

Re: general protection fault in unlink_file_vma

2020-09-13 Thread linmiaohe
Hillf Danton wrote: > On Sun, 13 Sep 2020 09:17:26 +0000 linmiaohe wrote: >> >> I reviewed the code carefully these days and I found vma_merge() do only >> fput() the vm_file of the linked vma in remove_next cases. >> This gpf is much likely because the ->mmap

Re: [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap()

2020-09-13 Thread linmiaohe
Eric W. Biederman wrote: > Miaohe Lin writes: > >> Use helper function mapping_allow_writable() to atomic_inc >> i_mmap_writable. > >Why? > Because I think it's better to use the wrapper function instead of the open hard code. Thanks.

Re: general protection fault in unlink_file_vma

2020-09-13 Thread linmiaohe
Hi: Hillf Danton wrote: > Tue, 08 Sep 2020 17:19:17 -0700 >> syzbot found the following issue on: >> general protection fault, probably for non-canonical address >> 0xe00eeaee003b: [#1] PREEMPT SMP KASAN >> KASAN: maybe wild-memory-access in range >>

Re: general protection fault in unlink_file_vma

2020-09-10 Thread linmiaohe
Hillf Danton wrote: >> On Thu, 10 Sep 2020 07:43:41 +0530 Souptick Joarder wrote: >> On Wed, Sep 9, 2020 at 9:45 AM Hillf Danton wrote: >> > Tue, 08 Sep 2020 17:19:17 -0700 >> > > syzbot found the following issue on: >> > > >> > > HEAD commit:59126901 Merge tag >> > >

Re: [PATCH] block: Fix potential page reference leak in __bio_iov_append_get_pages()

2020-09-09 Thread linmiaohe
Johannes Thumshirn wrote: >On 05/09/2020 11:41, Miaohe Lin wrote: >> When bio_add_hw_page() failed, we left page reference still held in pages. > >I'd add "from iov_iter_get_pages()" to the above sentence. > Sounds good. Will add it in v2. >Otherwise >Reviewed-by: Johannes Thumshirn Many

Re: [PATCH] net: Fix some comments

2020-09-06 Thread linmiaohe
Jakub Kicinski wrote: >On Sat, 5 Sep 2020 05:14:48 -0400 Miaohe Lin wrote: >> Since commit 8d7017fd621d ("blackhole_netdev: use blackhole_netdev to >> invalidate dst entries"), we use blackhole_netdev to invalidate dst >> entries instead of loopback device anymore. Also fix broken

Re: [PATCH] signal: clean up codestyle

2020-09-02 Thread linmiaohe
Christian Brauner wrote: >On Wed, Sep 02, 2020 at 01:34:59AM +0000, linmiaohe wrote: >> Christian Brauner wrote: >> >On Tue, Sep 01, 2020 at 06:39:05PM +0200, Oleg Nesterov wrote: >> >> On 09/01, Christian Brauner wrote: >> >Christian >> >

Re: [PATCH] block: Fix potential NULL pointer dereference in __bio_crypt_clone()

2020-09-01 Thread linmiaohe
Eric Biggers wrote: >On Tue, Sep 01, 2020 at 07:59:21AM -0400, Miaohe Lin wrote: >> mempool_alloc() may return NULL if __GFP_DIRECT_RECLAIM is not set in >> gfp_mask under memory pressure. So we should check the return value of >> mempool_alloc() against NULL before dereference. >> >> Fixes:

Re: [PATCH] block: Fix potential page reference leak in __bio_iov_iter_get_pages()

2020-09-01 Thread linmiaohe
Christoph Hellwig wrote: >On Tue, Sep 01, 2020 at 08:00:06AM -0400, Miaohe Lin wrote: >> When bio is full, __bio_iov_iter_get_pages() would return error >> directly while left page reference still held in pages. Release these >> references. >> Also advance the iov_iter according to what we have

Re: [PATCH] signal: clean up codestyle

2020-09-01 Thread linmiaohe
Christian Brauner wrote: >On Tue, Sep 01, 2020 at 06:39:05PM +0200, Oleg Nesterov wrote: >> On 09/01, Christian Brauner wrote: >> > >> > On Tue, Sep 01, 2020 at 07:58:00AM -0400, Miaohe Lin wrote: >> > > No functional change intended. >> > >> > Hey Miaohe, >> > >> > Thank you for the patch. >> >

Re: [PATCH] signal: clean up codestyle

2020-09-01 Thread linmiaohe
Christian Brauner wrote: > On Tue, Sep 01, 2020 at 07:58:00AM -0400, Miaohe Lin wrote: > No functional change intended. >Hey Miaohe, > >Thank you for the patch. >I'm sure this is well-intended but afaict the whole file has more or less a >consistent style already where e.g. sig-1 without spaces

Re: [PATCH] block: bio: Trim bio to sensible size in bio_trim()

2020-08-31 Thread linmiaohe
Jens Axboe wrote: >On 8/29/20 3:37 AM, Miaohe Lin wrote: >> Trim bio to sensible size in bio_trim() or something bad may happen. > >This really needs a LOT more detail. What is "something bad"? How does this >condition trigger to begin with? > Many thanks for your reply. I do this mainly by

Re: [PATCH] net: ipv4: remove unused arg exact_dif in compute_score

2020-08-30 Thread linmiaohe
David Ahern wrote: >On 8/29/20 3:01 AM, Miaohe Lin wrote: >> @@ -277,15 +277,13 @@ static struct sock *inet_lhash2_lookup(struct net *net, >> const __be32 daddr, const unsigned short hnum, >> const int dif, const int sdif) >> { >> -

Re: [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker

2020-08-24 Thread linmiaohe
friendly ping :) >Miaohe Lin wrote: >From: Miaohe Lin > >Use wrapper function wake_up_worker() to wake up first idle worker. > >Signed-off-by: Miaohe Lin >--- > kernel/workqueue.c | 10 -- > 1 file changed, 4 insertions(+), 6 deletions(-) > >diff --git a/kernel/workqueue.c

Re: [PATCH] netlink: remove duplicated nla_need_padding_for_64bit() check

2020-08-24 Thread linmiaohe
friendly ping :) >Miaohe Lin wrote: >From: Miaohe Lin > >The need for padding 64bit is implicitly checked by nla_align_64bit(), so >remove this explicit one. > >Signed-off-by: Miaohe Lin >--- > lib/nlattr.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > >diff --git a/lib/nlattr.c

Re: [PATCH] io_uring: Convert to use the fallthrough macro

2020-08-22 Thread linmiaohe
Friendly ping :) >From: Miaohe Lin > >Convert the uses of fallthrough comments to fallthrough macro. > >Signed-off-by: Hongxiang Lou >Signed-off-by: Miaohe Lin >--- > fs/io_uring.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/fs/io_uring.c b/fs/io_uring.c index

Re: [PATCH] nfsd: Convert to use the preferred fallthrough macro

2020-08-19 Thread linmiaohe
Chuck Lever wrote: >> On Aug 19, 2020, at 5:26 AM, Miaohe Lin wrote: >> >> Convert the uses of fallthrough comments to fallthrough macro. > >The patch description would be more helpful if it referenced the commit that >added the fallthrough macro to the kernel, or a permanent mailing list link

Re: [PATCH] mm/migrate: Avoid possible unnecessary ptrace_may_access() call in kernel_move_pages()

2020-08-19 Thread linmiaohe
Kees Cook wrote: >On Mon, Aug 17, 2020 at 07:59:33AM -0400, Miaohe Lin wrote: >> There is no need to check if this process has the right to modify the >> specified process when they are same. >> >> Signed-off-by: Hongxiang Lou >> Signed-off-by: Miaohe Lin > >NAK, please don't do this -- the

Re: [PATCH] ceph: Convert to use the preferred fallthrough macro

2020-08-19 Thread linmiaohe
Ilya Dryomov wrote: >On Wed, Aug 19, 2020 at 10:53 AM Miaohe Lin wrote: >> >> Convert the uses of fallthrough comments to fallthrough macro. >> > >Hi Miaohe, > >I've already done that, folding into your previous patch: > > >

Re: [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5

2020-08-18 Thread linmiaohe
David Miller wrote: >From: Miaohe Lin >Date: Tue, 18 Aug 2020 07:41:32 -0400 > >> @@ -417,7 +417,7 @@ static void sock_warn_obsolete_bsdism(const char >> *name) { >> static int warned; >> static char warncomm[TASK_COMM_LEN]; >> -if (strcmp(warncomm, current->comm) && warned < 5)

Re: [PATCH] net: Relax the npages test against MAX_SKB_FRAGS

2020-08-18 Thread linmiaohe
Eric Dumazet wrote: >On Tue, Aug 18, 2020 at 4:58 AM Miaohe Lin wrote: >> >> The npages test against MAX_SKB_FRAGS can be relaxed if we succeed to >> allocate high order pages as the note in comment said. >> > > >We do not want this change. > >This interface is used by datagram providers, we do

Re: [PATCH] mm/migrate: Avoid possible unnecessary ptrace_may_access() call in kernel_move_pages()

2020-08-17 Thread linmiaohe
Matthew Wilcox wrote: >On Mon, Aug 17, 2020 at 07:59:33AM -0400, Miaohe Lin wrote: >> There is no need to check if this process has the right to modify the >> specified process when they are same. > >We should probably also skip the security hook call if a process is modifying >its own pages. >

Re: [PATCH] net: handle the return value of pskb_carve_frag_list() correctly

2020-08-17 Thread linmiaohe
David Miller wrote: >> David Miller wrote: + /* split line is in frag list */ + if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) { + /* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. */ + if (skb_has_frag_list(skb))

Re: [PATCH] net: handle the return value of pskb_carve_frag_list() correctly

2020-08-16 Thread linmiaohe
David Miller wrote: >> +/* split line is in frag list */ >> +if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) { >> +/* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. >> */ >> +if (skb_has_frag_list(skb)) >> +

Re: [PATCH 1/5] net: Fix potential deadloop in skb_copy_ubufs()

2020-08-15 Thread linmiaohe
Eric Dumazet wrote: >On Fri, Aug 14, 2020 at 12:14 AM linmiaohe wrote: >> >> Willem de Bruijn wrote: >> >> Since we always call skb_orphan_frags in skb_clone, is it unnecessary to >> call skb_orphan_frags in pskb_expand_head when skb is cloned ? > &g

Re: [PATCH] net: add missing skb_uarg refcount increment in pskb_carve_inside_header()

2020-08-15 Thread linmiaohe
Willem de Bruijn wrote: >On Fri, Aug 14, 2020 at 9:20 AM linmiaohe wrote: >> >> Willem de Bruijn wrote: >> >On Thu, Aug 13, 2020 at 2:16 PM Miaohe Lin wrote: >> >> >> >> If the skb is zcopied, we should increase the skb_uarg refcount

Re: [PATCH] net: correct zerocopy refcnt with newly allocated UDP or RAW uarg

2020-08-15 Thread linmiaohe
Willem de Bruijn wrote: >On Fri, Aug 14, 2020 at 10:17 AM linmiaohe wrote: >> > >I don't think that can happen. > >The question is when this branch is false > >next = (u32)atomic_read(>sk_zckey); >if ((u32)(uarg->id + uarg-

Re: [PATCH] bpf: Convert to use the preferred fallthrough macro

2020-08-15 Thread linmiaohe
Yonghong Song wrote: >On 8/14/20 2:16 AM, Miaohe Lin wrote: >> Convert the uses of fallthrough comments to fallthrough macro. >> >> Signed-off-by: Miaohe Lin > >This is not a bug fix but rather an enhancement so not sure whether this >should push to bpf tree or wait until bpf-next. > >It may

Re: [PATCH] bpf: Convert to use the preferred fallthrough macro

2020-08-15 Thread linmiaohe
Andrii Nakryiko wrote: On Fri, Aug 14, 2020 at 2:58 AM Miaohe Lin wrote: >> >> Convert the uses of fallthrough comments to fallthrough macro. >> @@ -1794,7 +1794,7 @@ static bool cg_sockopt_is_valid_access(int off, int >> size, >> return prog->expected_attach_type == >>

Re: [PATCH] net: correct zerocopy refcnt with newly allocated UDP or RAW uarg

2020-08-14 Thread linmiaohe
Willem de Bruijn wrote: >On Thu, Aug 13, 2020 at 1:59 PM Miaohe Lin wrote: >> >> The var extra_uref is introduced to pass the initial reference taken >> in sock_zerocopy_alloc to the first generated skb. But now we may fail >> to pass the initial reference with newly allocated UDP or RAW uarg

Re: [PATCH] net: add missing skb_uarg refcount increment in pskb_carve_inside_header()

2020-08-14 Thread linmiaohe
Willem de Bruijn wrote: >On Thu, Aug 13, 2020 at 2:16 PM Miaohe Lin wrote: >> >> If the skb is zcopied, we should increase the skb_uarg refcount before >> we involve skb_release_data(). See pskb_expand_head() as a reference. > >Did you manage to observe a bug through this datapath in practice?

Re: [PATCH 1/5] net: Fix potential deadloop in skb_copy_ubufs()

2020-08-14 Thread linmiaohe
Willem de Bruijn wrote: >On Thu, Aug 6, 2020 at 1:48 PM linmiaohe wrote: >> >> From: Miaohe Lin >> >> We could be trapped in deadloop when we try to copy userspace skb >> frags buffers to kernel with a cloned skb: >> Reproduce code snippet: >>

Re: [PATCH] net: Fix potential memory leak in proto_register()

2020-08-12 Thread linmiaohe
Hi all: David Miller wrote: >From: Cong Wang >Date: Tue, 11 Aug 2020 16:02:51 -0700 > >>> @@ -3406,6 +3406,16 @@ static void sock_inuse_add(struct net *net, >>> int val) } #endif >>> >>> +static void tw_prot_cleanup(struct timewait_sock_ops *twsk_prot) { >>> + if (!twsk_prot) >>> +

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-11 Thread linmiaohe
Eric Dumazet wrote: > On 8/10/20 5:28 AM, Miaohe Lin wrote: >> The skb_shared_info part of the data is assigned in the following >> loop. It is meaningless to do a memcpy here. >> > >Reminder : net-next is CLOSED. > Thanks for your remind. I would wait for it open. >This is not correct. We

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-11 Thread linmiaohe
Florian Westphal wrote: >Miaohe Lin wrote: >> The skb_shared_info part of the data is assigned in the following loop. > >Where? > It's at the below for (i = 0; i < nfrags; i++) loop. But I missed something as Eric Dumazet pointed out. Sorry about it.

Re: [PATCH] cifs: Convert to use the fallthrough macro

2020-08-10 Thread linmiaohe
Steve French wrote: > >merged into cifs-2.6.git for-next > Many thanks. > (but note that most places in fs directory other than cifs and btrfs have not > been updated), and I noticed another 8 places in fs/cifs that you didn't > change in your patch (ie change from the older way of

[PATCH] erofs: Convert to use the fallthrough macro

2020-08-08 Thread linmiaohe
From: Miaohe Lin Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/erofs/zmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index

[PATCH] badblocks: Convert to use the fallthrough macro

2020-08-08 Thread linmiaohe
From: Miaohe Lin Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- block/badblocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/badblocks.c b/block/badblocks.c index

[PATCH] io_uring: Convert to use the fallthrough macro

2020-08-08 Thread linmiaohe
From: Miaohe Lin Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 2a3af95be4ca..77e932c25312 100644

[PATCH] cifs: Convert to use the fallthrough macro

2020-08-08 Thread linmiaohe
From: Miaohe Lin Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index

[PATCH] net: Convert to use the fallthrough macro

2020-08-08 Thread linmiaohe
From: Miaohe Lin Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Miaohe Lin --- net/socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/socket.c b/net/socket.c index c61f036d24f5..f4d5998bdcba 100644 --- a/net/socket.c +++

Re: [PATCH 3/5] net: Set fput_needed iff FDPUT_FPUT is set

2020-08-07 Thread linmiaohe
Al Viro wrote: >On Thu, Aug 06, 2020 at 12:59:16PM +0100, Al Viro wrote: >> On Thu, Aug 06, 2020 at 07:53:16PM +0800, linmiaohe wrote: >> > From: Miaohe Lin >> > >> > We should fput() file iff FDPUT_FPUT is set. So we should set >> > fput_neede

Re: [PATCH 1/5] net: Fix potential deadloop in skb_copy_ubufs()

2020-08-07 Thread linmiaohe
Willem de Bruijn wrote: >On Thu, Aug 6, 2020 at 1:48 PM linmiaohe wrote: >> >> From: Miaohe Lin >> >> We could be trapped in deadloop when we try to copy userspace skb >> frags buffers to kernel with a cloned skb: > >> Catch this unexpected c

Re: [PATCH] net: Fix potential out of bound write in skb_try_coalesce()

2020-08-06 Thread linmiaohe
Eric Dumazet wrote: >On Tue, Aug 4, 2020 at 4:46 AM linmiaohe wrote: >> >> From: Miaohe Lin >> >> The head_frag of skb would occupy one extra skb_frag_t. Take it into >> account or out of bound write to skb frags may happen. >> > >Please share

[PATCH 5/5] net: Use helper function ip_is_fragment()

2020-08-06 Thread linmiaohe
From: Miaohe Lin Use helper function ip_is_fragment() to check ip fragment. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8a0c39e4ab0a..fa823405829c 100644 --- a/net/core/skbuff.c

[PATCH 3/5] net: Set fput_needed iff FDPUT_FPUT is set

2020-08-06 Thread linmiaohe
From: Miaohe Lin We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed accordingly. Fixes: 00e188ef6a7e ("sockfd_lookup_light(): switch to fdget^W^Waway from fget_light") Signed-off-by: Miaohe Lin --- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH 1/5] net: Fix potential deadloop in skb_copy_ubufs()

2020-08-06 Thread linmiaohe
From: Miaohe Lin We could be trapped in deadloop when we try to copy userspace skb frags buffers to kernel with a cloned skb: [kbox] catch panic event, panic reason:kernel stack overflow [kbox] catch panic event, start logging. CPU: 3 PID: 4083 Comm: insmod Kdump: loaded Tainted: G OE

[PATCH 4/5] net: Remove meaningless jump label out_fs

2020-08-06 Thread linmiaohe
From: Miaohe Lin The out_fs jump label has nothing to do but goto out. Signed-off-by: Miaohe Lin --- net/socket.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index ee9c9dac4728..e1a1195ce69e 100644 --- a/net/socket.c +++ b/net/socket.c @@

[PATCH 2/5] net: Use helper function fdput()

2020-08-06 Thread linmiaohe
From: Miaohe Lin Use helper function fdput() to fput() the file iff FDPUT_FPUT is set. Signed-off-by: Miaohe Lin --- net/socket.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/socket.c b/net/socket.c index 976426d03f09..6aff5aeb6728 100644 --- a/net/socket.c

[PATCH] net: Fix potential out of bound write in skb_try_coalesce()

2020-08-04 Thread linmiaohe
From: Miaohe Lin The head_frag of skb would occupy one extra skb_frag_t. Take it into account or out of bound write to skb frags may happen. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/skbuff.c

Re: [PATCH] mac80211: use eth_zero_addr() to clear mac address

2020-08-04 Thread linmiaohe
> David Miller wrote: >>From: linmiaohe >>Date: Sat, 1 Aug 2020 17:12:38 +0800 >> >> From: Miaohe Lin >> >> Use eth_zero_addr() to clear mac address instead of memset(). >> >> Signed-off-by: Miaohe Lin > >If you're going to make thi

[PATCH] netlink: remove duplicated nla_need_padding_for_64bit() check

2020-08-01 Thread linmiaohe
From: Miaohe Lin The need for padding 64bit is implicitly checked by nla_align_64bit(), so remove this explicit one. Signed-off-by: Miaohe Lin --- lib/nlattr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/nlattr.c b/lib/nlattr.c index bc5b5cf608c4..98f596bfbfd8

[PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth

2020-08-01 Thread linmiaohe
From: Miaohe Lin When we don't care about vlan depth, we could pass NULL instead of the address of a unused local variable to skb_network_protocol() as a param. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[PATCH] net: Use __skb_pagelen() directly in skb_cow_data()

2020-08-01 Thread linmiaohe
From: Miaohe Lin In fact, skb_pagelen() - skb_headlen() is equal to __skb_pagelen(), use it directly to avoid unnecessary skb_headlen() call. Also fix the CHECK note of checkpatch.pl: Comparison to NULL could be written "!__pskb_pull_tail" Signed-off-by: Miaohe Lin --- net/core/skbuff.c

[PATCH] nl80211: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- net/wireless/nl80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7fbca0854265..c88f9d09cb25 100644 ---

[PATCH] net: qed: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c

[PATCH] net: qede: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/qlogic/qede/qede_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c

[PATCH] mac80211: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- net/mac80211/trace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 1b4709694d2a..50ab5b9d8eab 100644 ---

[PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth

2020-07-30 Thread linmiaohe
From: Miaohe Lin When we don't care about vlan depth, we could pass NULL instead of the address of a unused local variable to skb_network_protocol() as a param. Signed-off-by: Miaohe Lin --- net/core/dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/dev.c

[PATCH] sched: remove duplicated tick_nohz_full_enabled() check

2020-07-28 Thread linmiaohe
From: Miaohe Lin The func tick_nohz_full_enabled() is also called by tick_nohz_full_cpu(). So this one is duplicated and should be removed. Signed-off-by: Miaohe Lin --- kernel/sched/sched.h | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/kernel/sched/sched.h

[PATCH] workqueue: Use wake_up_worker() to wake up first idle worker

2020-07-27 Thread linmiaohe
From: Miaohe Lin Use wrapper function wake_up_worker() to wake up first idle worker. Signed-off-by: Miaohe Lin --- kernel/workqueue.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c41c3c17b86a..5302f227f38f 100644

[PATCH] net/ncsi: use eth_zero_addr() to clear mac address

2020-07-23 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- net/ncsi/ncsi-rsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index a94bb59793f0..5b1f4ec66dd9 100644 ---

[PATCH] cxgb4: use eth_zero_addr() to clear mac address

2020-07-23 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/chelsio/cxgb4/smt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/smt.c

[PATCH] net: udp: Fix wrong clean up for IS_UDPLITE macro

2020-07-21 Thread linmiaohe
From: Miaohe Lin We can't use IS_UDPLITE to replace udp_sk->pcflag when UDPLITE_RECV_CC is checked. Fixes: b2bf1e2659b1 ("[UDP]: Clean up for IS_UDPLITE macro") Signed-off-by: Miaohe Lin --- net/ipv4/udp.c | 2 +- net/ipv6/udp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff

[PATCH] scsi: fcoe: use eth_zero_addr() to clear mac address

2020-07-20 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index

[PATCH] igb: use eth_zero_addr() to clear mac address

2020-07-20 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c

  1   2   >