linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: SeongJae Park <sj@kernel.org>, Andrew Morton <akpm@linux-foundation.org>
Cc: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	<damon@lists.linux.dev>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH 2/2] mm/damon/paddr: fix folio_nr_pages() after folio_put() in damon_pa_mark_accessed_or_deactivate()
Date: Mon, 6 Mar 2023 10:05:57 +0800	[thread overview]
Message-ID: <51e294bd-c241-ec7e-97d0-b1a7f3534578@huawei.com> (raw)
In-Reply-To: <20230304193949.296391-3-sj@kernel.org>



On 2023/3/5 3:39, SeongJae Park wrote:
> damon_pa_mark_accessed_or_deactivate() is accessing a folio via
> folio_nr_pages() after folio_put() for the folio has invoked.  Fix it.
> 

Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>

> Fixes: f70da5ee8fe1 ("mm/damon: convert damon_pa_mark_accessed_or_deactivate() to use folios")
> Cc: <stable@vger.kernel.org> # 6.3.x
> Signed-off-by: SeongJae Park <sj@kernel.org>
> ---
>   mm/damon/paddr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index 10f159b315ea..0db724aec5cb 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -277,8 +277,8 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate(
>   			folio_mark_accessed(folio);
>   		else
>   			folio_deactivate(folio);
> -		folio_put(folio);
>   		applied += folio_nr_pages(folio);
> +		folio_put(folio);
>   	}
>   	return applied * PAGE_SIZE;
>   }


  parent reply	other threads:[~2023-03-06  2:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04 19:39 [PATCH 0/2] mm/damon/paddr: Fix folio-use-after-put bugs SeongJae Park
2023-03-04 19:39 ` [PATCH 1/2] mm/damon/paddr: fix folio_size() call after folio_put() in damon_pa_young() SeongJae Park
2023-03-05  0:00   ` Matthew Wilcox
2023-03-06  2:09   ` Kefeng Wang
2023-03-04 19:39 ` [PATCH 2/2] mm/damon/paddr: fix folio_nr_pages() after folio_put() in damon_pa_mark_accessed_or_deactivate() SeongJae Park
2023-03-05  0:00   ` Matthew Wilcox
2023-03-06  2:05   ` Kefeng Wang [this message]
2023-03-06  2:04 ` [PATCH 0/2] mm/damon/paddr: Fix folio-use-after-put bugs Kefeng Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51e294bd-c241-ec7e-97d0-b1a7f3534578@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sj@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vishal.moola@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox