linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nfs-utils PATCH] statd: fix use-after-free in monitor list if insertion fails
@ 2018-09-01  6:07 Frank Sorenson
  2018-09-05 14:10 ` Chuck Lever
  2018-09-06 14:24 ` Steve Dickson
  0 siblings, 2 replies; 3+ messages in thread
From: Frank Sorenson @ 2018-09-01  6:07 UTC (permalink / raw)
  To: linux-nfs

If nsm_insert_monitored_host() fails while saving the record to
stable storage, we can't just assume the entry was new. Existing
records must be removed from the list before being freed.

Signed-off-by: Frank Sorenson <sorenson@redhat.com>

diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c
index 45c4346..9400048 100644
--- a/utils/statd/monitor.c
+++ b/utils/statd/monitor.c
@@ -197,7 +197,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
 
 	if (!nsm_insert_monitored_host(dnsname,
 				(struct sockaddr *)(char *)&my_addr, argp)) {
-		nlist_free(NULL, clnt);
+		nlist_free(existing ? &rtnl : NULL, clnt);
 		goto failure;
 	}
 

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

* Re: [nfs-utils PATCH] statd: fix use-after-free in monitor list if insertion fails
  2018-09-01  6:07 [nfs-utils PATCH] statd: fix use-after-free in monitor list if insertion fails Frank Sorenson
@ 2018-09-05 14:10 ` Chuck Lever
  2018-09-06 14:24 ` Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2018-09-05 14:10 UTC (permalink / raw)
  To: Frank Sorenson; +Cc: Linux NFS Mailing List



> On Sep 1, 2018, at 2:07 AM, Frank Sorenson <sorenson@redhat.com> wrote:
> 
> If nsm_insert_monitored_host() fails while saving the record to
> stable storage, we can't just assume the entry was new. Existing
> records must be removed from the list before being freed.
> 
> Signed-off-by: Frank Sorenson <sorenson@redhat.com>

Reviewed-by: Chuck Lever <chuck.lever@oracle.com>


> diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c
> index 45c4346..9400048 100644
> --- a/utils/statd/monitor.c
> +++ b/utils/statd/monitor.c
> @@ -197,7 +197,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
> 
> 	if (!nsm_insert_monitored_host(dnsname,
> 				(struct sockaddr *)(char *)&my_addr, argp)) {
> -		nlist_free(NULL, clnt);
> +		nlist_free(existing ? &rtnl : NULL, clnt);
> 		goto failure;
> 	}
> 

--
Chuck Lever

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

* Re: [nfs-utils PATCH] statd: fix use-after-free in monitor list if insertion fails
  2018-09-01  6:07 [nfs-utils PATCH] statd: fix use-after-free in monitor list if insertion fails Frank Sorenson
  2018-09-05 14:10 ` Chuck Lever
@ 2018-09-06 14:24 ` Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Dickson @ 2018-09-06 14:24 UTC (permalink / raw)
  To: Frank Sorenson, linux-nfs



On 09/01/2018 02:07 AM, Frank Sorenson wrote:
> If nsm_insert_monitored_host() fails while saving the record to
> stable storage, we can't just assume the entry was new. Existing
> records must be removed from the list before being freed.
> 
> Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Committed.... 

steved.
> 
> diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c
> index 45c4346..9400048 100644
> --- a/utils/statd/monitor.c
> +++ b/utils/statd/monitor.c
> @@ -197,7 +197,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
>  
>  	if (!nsm_insert_monitored_host(dnsname,
>  				(struct sockaddr *)(char *)&my_addr, argp)) {
> -		nlist_free(NULL, clnt);
> +		nlist_free(existing ? &rtnl : NULL, clnt);
>  		goto failure;
>  	}
>  
> 

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

end of thread, other threads:[~2018-09-06 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-01  6:07 [nfs-utils PATCH] statd: fix use-after-free in monitor list if insertion fails Frank Sorenson
2018-09-05 14:10 ` Chuck Lever
2018-09-06 14:24 ` Steve Dickson

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).