Re: + nfs42-use-a-specific-kmem_cache-to-allocate-nfs4_xattr_entry.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 1, 2022 at 10:27 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> The patch titled
>      Subject: nfs42: use a specific kmem_cache to allocate nfs4_xattr_entry
> has been added to the -mm tree.  Its filename is
>      nfs42-use-a-specific-kmem_cache-to-allocate-nfs4_xattr_entry.patch
>
> This patch should soon appear at
>     https://ozlabs.org/~akpm/mmots/broken-out/nfs42-use-a-specific-kmem_cache-to-allocate-nfs4_xattr_entry.patch
> and later at
>     https://ozlabs.org/~akpm/mmotm/broken-out/nfs42-use-a-specific-kmem_cache-to-allocate-nfs4_xattr_entry.patch
>
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
>
> ------------------------------------------------------
> From: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> Subject: nfs42: use a specific kmem_cache to allocate nfs4_xattr_entry
>
> Fixes a null-pointer deref in nfs4.
>
> If we want to add the allocated objects to its list_lru, we should use
> kmem_cache_alloc_lru() to allocate objects.  So intruduce
> nfs4_xattr_entry_cachep which is used to allocate nfs4_xattr_entry.
>
> Link: https://lkml.kernel.org/r/164876616694.25542.14010655277238655246@xxxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> Tested-by: NeilBrown <neilb@xxxxxxx>
> Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

My bad. I think this patch could be dropped.  I have looked at
the latest code. I found the following commit has removed
GFP_ACCOUNT on allocation.

5c60e89e71f8 ("NFSv4.2: Fix up an invalid combination of memory
allocation flags")

But this commit forgot to remove SLAB_ACCOUNT when creating
nfs4_xattr_cache_cachep (I think it is a bug).  So I think the following
patch could work properly.  I'll send a new patch to fix this issue.

Thanks.

diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
index ad3405c64b9e..e7b34f7e0614 100644
--- a/fs/nfs/nfs42xattr.c
+++ b/fs/nfs/nfs42xattr.c
@@ -997,7 +997,7 @@ int __init nfs4_xattr_cache_init(void)

        nfs4_xattr_cache_cachep = kmem_cache_create("nfs4_xattr_cache_cache",
            sizeof(struct nfs4_xattr_cache), 0,
-           (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|SLAB_ACCOUNT),
+           (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD),
            nfs4_xattr_cache_init_once);
        if (nfs4_xattr_cache_cachep == NULL)
                return -ENOMEM;



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux