linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gianfranco Trad <gianf.trad@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	skhan@linuxfoundation.org,
	syzbot+4089e577072948ac5531@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] Fix NULL pointer dereference in read_cache_folio
Date: Fri, 4 Oct 2024 14:07:25 +0200	[thread overview]
Message-ID: <991c8404-1c1c-47c7-ab27-2117d134b59b@gmail.com> (raw)
In-Reply-To: <ZvrqotTfw06vAK9Y@casper.infradead.org>

On 30/09/24 20:14, Matthew Wilcox wrote:
> On Mon, Sep 30, 2024 at 11:02:26AM +0200, Gianfranco Trad wrote:
>> @@ -2360,6 +2360,8 @@ static int filemap_read_folio(struct file *file, filler_t filler,
>>   	/* Start the actual read. The read will unlock the page. */
>>   	if (unlikely(workingset))
>>   		psi_memstall_enter(&pflags);
>> +	if (!filler)
>> +		return -EIO;
> 
> This is definitely wrong because you enter memstall, but do not exit it.

Got it, thanks.

> 
> As Andrew says, the underlying problem is that the filesystem does not
> implement ->read_folio.  Which filesystem is this?

Reproducer via procfs accesses a bpf map backed by an anonymous
inode (anon_inode_fs_type), with mapping->a_ops pointing to anon_aops,
hence, read_folio() undefined.

> 
>>   	error = filler(file, folio);
>>   	if (unlikely(workingset))
>>   		psi_memstall_leave(&pflags);
>> -- 
>> 2.43.0
>>

I suppose the next step would be to contact the proper maintainers(?)
If you have any additional suggestions, I'd be more than glad to listen.

Thanks to both of you for your time,

--Gian


  reply	other threads:[~2024-10-04 12:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29 23:05 [PATCH v1] Fix NULL pointer dereference in read_cache_folio Gianfranco Trad
2024-09-30  9:02 ` [PATCH v2] " Gianfranco Trad
2024-09-30 17:02   ` Andrew Morton
2024-09-30 18:14   ` Matthew Wilcox
2024-10-04 12:07     ` Gianfranco Trad [this message]
2024-10-15 11:57       ` [PATCH v2] mm: fix null " Gianfranco Trad

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=991c8404-1c1c-47c7-ab27-2117d134b59b@gmail.com \
    --to=gianf.trad@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=skhan@linuxfoundation.org \
    --cc=syzbot+4089e577072948ac5531@syzkaller.appspotmail.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;
as well as URLs for NNTP newsgroup(s).