All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Jingbo Xu <jefflexu@linux.alibaba.com>
Cc: dhowells@redhat.com, Christian Brauner <christian@brauner.io>,
	Jeff Layton <jlayton@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	netfs@lists.linux.dev, linux-afs@lists.infradead.org,
	linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
	ceph-devel@vger.kernel.org, v9fs@lists.linux.dev,
	linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Marc Dionne <marc.dionne@auristor.com>,
	Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>,
	Yue Hu <huyue2@coolpad.com>
Subject: Re: [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode
Date: Mon, 22 Jan 2024 22:01:19 +0000	[thread overview]
Message-ID: <3980816.1705960879@warthog.procyon.org.uk> (raw)
In-Reply-To: <7790423f-665e-44cc-b4ae-d3f3d2996af5@linux.alibaba.com>

Jingbo Xu <jefflexu@linux.alibaba.com> wrote:

> > -	ret = cachefiles_ondemand_init_object(object);
> > -	if (ret < 0)
> > -		goto err_unuse;
> > +	if (object->ondemand) {
> > +		ret = cachefiles_ondemand_init_object(object);
> > +		if (ret < 0)
> > +			goto err_unuse;
> > +	}
> 
> I'm not sure if object->ondemand shall be checked by the caller or
> inside cachefiles_ondemand_init_object(), as
> cachefiles_ondemand_clean_object() is also called without checking
> object->ondemand. cachefiles_ondemand_clean_object() won't trigger the
> NULL oops as the called cachefiles_ondemand_send_req() will actually
> checks that.

Meh.  The above doesn't actually build if CONFIG_CACHEFILES_ONDEMAND=N.  I
think I have to push the check down into cachefiles_ondemand_init_object()
instead.

David


WARNING: multiple messages have this Message-ID (diff)
From: David Howells <dhowells@redhat.com>
To: Jingbo Xu <jefflexu@linux.alibaba.com>
Cc: linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
	v9fs@lists.linux.dev, Jeff Layton <jlayton@kernel.org>,
	linux-kernel@vger.kernel.org,
	Matthew Wilcox <willy@infradead.org>,
	Marc Dionne <marc.dionne@auristor.com>,
	dhowells@redhat.com, linux-mm@kvack.org,
	Yue Hu <huyue2@coolpad.com>,
	linux-fsdevel@vger.kernel.org, netfs@lists.linux.dev,
	ceph-devel@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	linux-afs@lists.infradead.org,
	Christian Brauner <christian@brauner.io>
Subject: Re: [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode
Date: Mon, 22 Jan 2024 22:01:19 +0000	[thread overview]
Message-ID: <3980816.1705960879@warthog.procyon.org.uk> (raw)
In-Reply-To: <7790423f-665e-44cc-b4ae-d3f3d2996af5@linux.alibaba.com>

Jingbo Xu <jefflexu@linux.alibaba.com> wrote:

> > -	ret = cachefiles_ondemand_init_object(object);
> > -	if (ret < 0)
> > -		goto err_unuse;
> > +	if (object->ondemand) {
> > +		ret = cachefiles_ondemand_init_object(object);
> > +		if (ret < 0)
> > +			goto err_unuse;
> > +	}
> 
> I'm not sure if object->ondemand shall be checked by the caller or
> inside cachefiles_ondemand_init_object(), as
> cachefiles_ondemand_clean_object() is also called without checking
> object->ondemand. cachefiles_ondemand_clean_object() won't trigger the
> NULL oops as the called cachefiles_ondemand_send_req() will actually
> checks that.

Meh.  The above doesn't actually build if CONFIG_CACHEFILES_ONDEMAND=N.  I
think I have to push the check down into cachefiles_ondemand_init_object()
instead.

David


  reply	other threads:[~2024-01-22 22:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 12:38 [PATCH 00/10] netfs, afs, cifs, cachefiles, erofs: Miscellaneous fixes David Howells
2024-01-22 12:38 ` David Howells
2024-01-22 12:38 ` [PATCH 01/10] netfs: Don't use certain internal folio_*() functions David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 15:38   ` Jeff Layton
2024-01-22 15:38     ` Jeff Layton
2024-01-22 16:10     ` Matthew Wilcox
2024-01-22 16:10       ` Matthew Wilcox
2024-01-22 17:22     ` David Howells
2024-01-22 17:22       ` David Howells
2024-01-22 12:38 ` [PATCH 02/10] afs: " David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 12:38 ` [PATCH 03/10] cifs: " David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 12:38 ` [PATCH 04/10] netfs, fscache: Prevent Oops in fscache_put_cache() David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 12:38 ` [PATCH 05/10] netfs: Fix a NULL vs IS_ERR() check in netfs_perform_write() David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 12:38 ` [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 13:48   ` Jingbo Xu
2024-01-22 13:48     ` Jingbo Xu
2024-01-22 22:01     ` David Howells [this message]
2024-01-22 22:01       ` David Howells
2024-01-22 15:27   ` Gao Xiang
2024-01-22 15:27     ` Gao Xiang
2024-01-22 12:38 ` [PATCH 07/10] afs: Hide silly-rename files from userspace David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 12:38 ` [PATCH 08/10] afs: Fix error handling with lookup via FS.InlineBulkStatus David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 12:38 ` [PATCH 09/10] afs: Remove afs_dynroot_d_revalidate() as it is redundant David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 12:38 ` [PATCH 10/10] afs: Fix missing/incorrect unlocking of RCU read lock David Howells
2024-01-22 12:38   ` David Howells
2024-01-22 15:18 ` [PATCH 00/10] netfs, afs, cifs, cachefiles, erofs: Miscellaneous fixes Christian Brauner
2024-01-22 15:18   ` Christian Brauner
2024-01-23 15:03   ` Christian Brauner
2024-01-23 15:03     ` Christian Brauner
2024-01-22 15:57 ` Jeff Layton
2024-01-22 15:57   ` Jeff Layton

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=3980816.1705960879@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chao@kernel.org \
    --cc=christian@brauner.io \
    --cc=huyue2@coolpad.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=jlayton@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=netfs@lists.linux.dev \
    --cc=v9fs@lists.linux.dev \
    --cc=willy@infradead.org \
    --cc=xiang@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.