[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9279444f-b113-41ad-afaa-c6b550104906@kili.mountain>
Date: Wed, 31 May 2023 10:58:51 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: NeilBrown <neilb@...e.de>
Cc: Stanislav Kinsbursky <skinsbursky@...allels.com>,
Chuck Lever <chuck.lever@...cle.com>,
Jeff Layton <jlayton@...nel.org>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>,
"J. Bruce Fields" <bfields@...hat.com>, linux-nfs@...r.kernel.org,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] nfsd: fix double fget() bug in __write_ports_addfd()
On Wed, May 31, 2023 at 10:48:09AM +0300, Dan Carpenter wrote:
> err = nfsd_create_serv(net);
> if (err != 0)
> - return err;
> + goto out_put_sock;
>
> - err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);
> + err = svc_addsock(nn->nfsd_serv, so, buf, SIMPLE_TRANSACTION_LIMIT, cred);
> + if (err)
> + goto out_put_net;
Oops. This change is wrong. svc_addsock() actually does return
positive values on success.
>
> - if (err >= 0 &&
> - !nn->nfsd_serv->sv_nrthreads && !xchg(&nn->keep_active, 1))
> + if (!nn->nfsd_serv->sv_nrthreads && !xchg(&nn->keep_active, 1))
> svc_get(nn->nfsd_serv);
>
> nfsd_put(net);
> + return 0;
Also wrong (same bug).
> +
> +out_put_net:
> + nfsd_put(net);
> +out_put_sock:
> + sockfd_put(so);
> return err;
> }
regards,
dan carpenter
Powered by blists - more mailing lists