From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Cc: Sowmini Varadhan <sowmini05@gmail.com>,
netdev <netdev@vger.kernel.org>,
santosh.shilimkar@oracle.com, David Miller <davem@davemloft.net>,
rds-devel@oss.oracle.com
Subject: Re: [PATCH net] rds: Incorrect reference counting in TCP socket creation
Date: Thu, 1 Mar 2018 07:31:18 -0500 [thread overview]
Message-ID: <20180301123118.GB28739@oracle.com> (raw)
In-Reply-To: <7940eadb-a01c-172f-5c57-e372993f4bd9@oracle.com>
On (03/01/18 20:19), Ka-Cheong Poon wrote:
> >>
> >>- new_sock->type = sock->type;
> >>- new_sock->ops = sock->ops;
> >> ret = sock->ops->accept(sock, new_sock, O_NONBLOCK, true);
> >> if (ret < 0)
> >> goto out;
> >>
> >>+ new_sock->ops = sock->ops;
> >
> >How is this delta relevant to the commit comment? Seems unrelated?
>
>
> Note that sock_release() checks if sock->ops is set before
> decrementing the refcnt. By moving the ops assignment after
> the ops->accept() call, we save increasing the refcnt in
> case the ops->accept() fails. Otherwise, the __module_get()
> needs to be moved before ops->accept() to handle this failure
> case.
I see, thanks for clarification.
It may be helpful to have some comment in there, in case some other
module trips on something similar in the future.
--Sowmini
prev parent reply other threads:[~2018-03-01 12:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 4:44 [PATCH net] rds: Incorrect reference counting in TCP socket creation Ka-Cheong Poon
2018-03-01 11:54 ` Sowmini Varadhan
2018-03-01 12:19 ` Ka-Cheong Poon
2018-03-01 12:31 ` Sowmini Varadhan [this message]
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=20180301123118.GB28739@oracle.com \
--to=sowmini.varadhan@oracle.com \
--cc=davem@davemloft.net \
--cc=ka-cheong.poon@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=rds-devel@oss.oracle.com \
--cc=santosh.shilimkar@oracle.com \
--cc=sowmini05@gmail.com \
/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 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).