public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access
@ 2020-08-05 19:10 J. Bruce Fields
  2020-08-05 19:17 ` Chuck Lever
  0 siblings, 1 reply; 6+ messages in thread
From: J. Bruce Fields @ 2020-08-05 19:10 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-nfs

From: "J. Bruce Fields" <bfields@redhat.com>

If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a
NULL dereference in nfsd_breaker_owns_lease().

Easily reproduceable with for example

	mount -overs=4.2 server:/export /mnt/
	sleep 1h </mnt/file &
	mount -overs=3 server:/export /mnt2/
	touch /mnt2/file

Reported-by: Robert Dinse <nanook@eskimo.com>
Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations")
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4state.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9fc0a1b9e4dd..45f3832d70d4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
 	if (!i_am_nfsd())
 		return NULL;
 	rqst = kthread_data(current);
+	if (!rqst->rq_lease_breaker)
+		return NULL;
 	clp = *(rqst->rq_lease_breaker);
 	return dl->dl_stid.sc_client == clp;
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access
  2020-08-05 19:10 [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access J. Bruce Fields
@ 2020-08-05 19:17 ` Chuck Lever
  2020-08-05 20:04   ` Bruce Fields
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Lever @ 2020-08-05 19:17 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing List

Hi Bruce-

> On Aug 5, 2020, at 3:10 PM, bfields@fieldses.org wrote:
> 
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a
> NULL dereference in nfsd_breaker_owns_lease().
> 
> Easily reproduceable with for example
> 
> 	mount -overs=4.2 server:/export /mnt/
> 	sleep 1h </mnt/file &
> 	mount -overs=3 server:/export /mnt2/
> 	touch /mnt2/file
> 
> Reported-by: Robert Dinse <nanook@eskimo.com>
> Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations")

May I add

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208807

And send this in the first NFSD v5.9 -rc pull request?


> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
> fs/nfsd/nfs4state.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 9fc0a1b9e4dd..45f3832d70d4 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
> 	if (!i_am_nfsd())
> 		return NULL;
> 	rqst = kthread_data(current);
> +	if (!rqst->rq_lease_breaker)
> +		return NULL;
> 	clp = *(rqst->rq_lease_breaker);
> 	return dl->dl_stid.sc_client == clp;
> }
> -- 
> 2.26.2
> 

--
Chuck Lever




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access
  2020-08-05 19:17 ` Chuck Lever
@ 2020-08-05 20:04   ` Bruce Fields
  0 siblings, 0 replies; 6+ messages in thread
From: Bruce Fields @ 2020-08-05 20:04 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Linux NFS Mailing List

On Wed, Aug 05, 2020 at 03:17:54PM -0400, Chuck Lever wrote:
> Hi Bruce-
> 
> > On Aug 5, 2020, at 3:10 PM, bfields@fieldses.org wrote:
> > 
> > From: "J. Bruce Fields" <bfields@redhat.com>
> > 
> > If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a
> > NULL dereference in nfsd_breaker_owns_lease().
> > 
> > Easily reproduceable with for example
> > 
> > 	mount -overs=4.2 server:/export /mnt/
> > 	sleep 1h </mnt/file &
> > 	mount -overs=3 server:/export /mnt2/
> > 	touch /mnt2/file
> > 
> > Reported-by: Robert Dinse <nanook@eskimo.com>
> > Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations")
> 
> May I add
> 
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208807
> 
> And send this in the first NFSD v5.9 -rc pull request?

Sounds good, thanks!

--b.

> 
> 
> > Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> > ---
> > fs/nfsd/nfs4state.c | 2 ++
> > 1 file changed, 2 insertions(+)
> > 
> > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > index 9fc0a1b9e4dd..45f3832d70d4 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
> > 	if (!i_am_nfsd())
> > 		return NULL;
> > 	rqst = kthread_data(current);
> > +	if (!rqst->rq_lease_breaker)
> > +		return NULL;
> > 	clp = *(rqst->rq_lease_breaker);
> > 	return dl->dl_stid.sc_client == clp;
> > }
> > -- 
> > 2.26.2
> > 
> 
> --
> Chuck Lever
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access
@ 2020-08-20 19:39 Bruce Fields
  2020-08-20 19:42 ` Chuck Lever
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Fields @ 2020-08-20 19:39 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Linux NFS Mailing List

From: "J. Bruce Fields" <bfields@redhat.com>

If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a
NULL dereference in nfsd_breaker_owns_lease().

Easily reproduceable with for example

	mount -overs=4.2 server:/export /mnt/
	sleep 1h </mnt/file &
	mount -overs=3 server:/export /mnt2/
	touch /mnt2/file

Reported-by: Robert Dinse <nanook@eskimo.com>
Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations")
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4state.c | 2 ++
 1 file changed, 2 insertions(+)

Oops, I've had this sitting around a couple weeks but I must have
forgotten to send it in.  This is needed for 5.9.

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 4b70657385f2..0e5302f6df52 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4598,6 +4598,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
 	if (!i_am_nfsd())
 		return NULL;
 	rqst = kthread_data(current);
+	if (!rqst->rq_lease_breaker)
+		return NULL;
 	clp = *(rqst->rq_lease_breaker);
 	return dl->dl_stid.sc_client == clp;
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access
  2020-08-20 19:39 Bruce Fields
@ 2020-08-20 19:42 ` Chuck Lever
  2020-08-20 19:44   ` Bruce Fields
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Lever @ 2020-08-20 19:42 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing List



> On Aug 20, 2020, at 3:39 PM, Bruce Fields <bfields@fieldses.org> wrote:
> 
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a
> NULL dereference in nfsd_breaker_owns_lease().
> 
> Easily reproduceable with for example
> 
> 	mount -overs=4.2 server:/export /mnt/
> 	sleep 1h </mnt/file &
> 	mount -overs=3 server:/export /mnt2/
> 	touch /mnt2/file
> 
> Reported-by: Robert Dinse <nanook@eskimo.com>
> Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations")
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>

I think I've got this queued already. Is this different than:

http://git.linux-nfs.org/?p=cel/cel-2.6.git;a=commit;h=34b09af4f54e6485e28f138ccad159611a240cc1


> ---
> fs/nfsd/nfs4state.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> Oops, I've had this sitting around a couple weeks but I must have
> forgotten to send it in.  This is needed for 5.9.
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 4b70657385f2..0e5302f6df52 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4598,6 +4598,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
> 	if (!i_am_nfsd())
> 		return NULL;
> 	rqst = kthread_data(current);
> +	if (!rqst->rq_lease_breaker)
> +		return NULL;
> 	clp = *(rqst->rq_lease_breaker);
> 	return dl->dl_stid.sc_client == clp;
> }
> -- 
> 2.26.2
> 

--
Chuck Lever




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access
  2020-08-20 19:42 ` Chuck Lever
@ 2020-08-20 19:44   ` Bruce Fields
  0 siblings, 0 replies; 6+ messages in thread
From: Bruce Fields @ 2020-08-20 19:44 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Linux NFS Mailing List

On Thu, Aug 20, 2020 at 03:42:14PM -0400, Chuck Lever wrote:
> 
> 
> > On Aug 20, 2020, at 3:39 PM, Bruce Fields <bfields@fieldses.org> wrote:
> > 
> > From: "J. Bruce Fields" <bfields@redhat.com>
> > 
> > If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a
> > NULL dereference in nfsd_breaker_owns_lease().
> > 
> > Easily reproduceable with for example
> > 
> > 	mount -overs=4.2 server:/export /mnt/
> > 	sleep 1h </mnt/file &
> > 	mount -overs=3 server:/export /mnt2/
> > 	touch /mnt2/file
> > 
> > Reported-by: Robert Dinse <nanook@eskimo.com>
> > Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations")
> > Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> 
> I think I've got this queued already. Is this different than:
> 
> http://git.linux-nfs.org/?p=cel/cel-2.6.git;a=commit;h=34b09af4f54e6485e28f138ccad159611a240cc1

Oh, OK, great.--b.

> 
> 
> > ---
> > fs/nfsd/nfs4state.c | 2 ++
> > 1 file changed, 2 insertions(+)
> > 
> > Oops, I've had this sitting around a couple weeks but I must have
> > forgotten to send it in.  This is needed for 5.9.
> > 
> > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > index 4b70657385f2..0e5302f6df52 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -4598,6 +4598,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
> > 	if (!i_am_nfsd())
> > 		return NULL;
> > 	rqst = kthread_data(current);
> > +	if (!rqst->rq_lease_breaker)
> > +		return NULL;
> > 	clp = *(rqst->rq_lease_breaker);
> > 	return dl->dl_stid.sc_client == clp;
> > }
> > -- 
> > 2.26.2
> > 
> 
> --
> Chuck Lever
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-20 19:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-05 19:10 [PATCH] nfsd: fix oops on mixed NFSv4/NFSv3 client access J. Bruce Fields
2020-08-05 19:17 ` Chuck Lever
2020-08-05 20:04   ` Bruce Fields
  -- strict thread matches above, loose matches on Subject: below --
2020-08-20 19:39 Bruce Fields
2020-08-20 19:42 ` Chuck Lever
2020-08-20 19:44   ` Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox