From: Jakub Kicinski <kuba@kernel.org>
To: Yajun Deng <yajun.deng@linux.dev>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: socket: integrate sockfd_lookup() and sockfd_lookup_light()
Date: Thu, 23 Sep 2021 08:24:53 -0700 [thread overview]
Message-ID: <20210923082453.42096cc7@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20210922063106.4272-1-yajun.deng@linux.dev>
On Wed, 22 Sep 2021 14:31:06 +0800 Yajun Deng wrote:
> As commit 6cb153cab92a("[NET]: use fget_light() in net/socket.c") said,
> sockfd_lookup_light() is lower load than sockfd_lookup(). So we can
> remove sockfd_lookup() but keep the name. As the same time, move flags
> to sockfd_put().
You just assume that each caller of sockfd_lookup() already meets the
criteria under which sockfd_lookup_light() can be used? Am I reading
this right?
Please extend the commit message clearly walking us thru why this is
safe now (and perhaps why it wasn't in the past).
> static ssize_t sockfs_listxattr(struct dentry *dentry, char *buffer,
> size_t size)
> @@ -1680,9 +1659,9 @@ int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
> {
> struct socket *sock;
> struct sockaddr_storage address;
> - int err, fput_needed;
> + int err;
>
> - sock = sockfd_lookup_light(fd, &err, &fput_needed);
> + sock = sockfd_lookup(fd, &err);
> if (sock) {
> err = move_addr_to_kernel(umyaddr, addrlen, &address);
> if (!err) {
> @@ -1694,7 +1673,7 @@ int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
> (struct sockaddr *)
> &address, addrlen);
> }
> - fput_light(sock->file, fput_needed);
> + sockfd_put(sock);
And we just replace fput_light() with fput() even tho the reference was
taken with fdget()? fdget() == __fget_light().
Maybe you missed fget() vs fdget()?
All these changes do not immediately strike me as correct.
> }
> return err;
> }
next prev parent reply other threads:[~2021-09-23 15:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 6:31 [PATCH net-next] net: socket: integrate sockfd_lookup() and sockfd_lookup_light() Yajun Deng
2021-09-23 15:24 ` Jakub Kicinski [this message]
2021-09-23 16:49 ` Eric Dumazet
2021-09-24 2:39 ` yajun.deng
2021-09-24 2:49 ` yajun.deng
2021-09-24 2:56 ` Al Viro
2021-09-24 3:39 ` yajun.deng
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=20210923082453.42096cc7@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yajun.deng@linux.dev \
/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.