From: Daniel Borkmann <dborkman@redhat.com>
To: Vlad Yasevich <vyasevich@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next 5/6] net: sctp: decouple cleaning some socket data from endpoint
Date: Tue, 25 Jun 2013 17:38:46 +0200 [thread overview]
Message-ID: <51C9B986.2030104@redhat.com> (raw)
In-Reply-To: <51C9B80C.6070905@gmail.com>
On 06/25/2013 05:32 PM, Vlad Yasevich wrote:
> On 06/25/2013 11:13 AM, Daniel Borkmann wrote:
>> Rather instead of having the endpoint clean the garbage from the
>> socket, use a sk_destruct handler sctp_destruct_sock(), that does
>> the job for that when there are no more references on the socket.
>> At least do this for our crypto transform through crypto_free_hash()
>> that is allocated when in listening state. Also, for now, move the
>> sctp_put_port() into the sk if body.
>
> This sentence is hard to parse without looking at the patch. Can
> you rephrase. May be say that we perform sctp_put_port() only when
> sk is valid.
>
>> At a later point in time we
>> can still determine if there's an option of placing this into
>> unhash() or sctp_endpoint_free() without any races. For now, leave
>> it in sctp_endpoint_destroy() though.
>>
>> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
>> ---
>> net/sctp/endpointola.c | 18 +++++++++---------
>> net/sctp/socket.c | 16 +++++++++++++++-
>> 2 files changed, 24 insertions(+), 10 deletions(-)
>>
>> diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
>> index a8b2674..8ad7781 100644
>> --- a/net/sctp/endpointola.c
>> +++ b/net/sctp/endpointola.c
>> @@ -247,10 +247,9 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
>> /* Final destructor for endpoint. */
>> static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
>> {
>> - SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return);
>> + struct sock *sk;
>>
>> - /* Free up the HMAC transform. */
>> - crypto_free_hash(sctp_sk(ep->base.sk)->hmac);
>> + SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return);
>>
>> /* Free the digest buffer */
>> kfree(ep->digest);
>> @@ -271,13 +270,14 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
>>
>> memset(ep->secret_key, 0, sizeof(ep->secret_key));
>>
>> - /* Remove and free the port */
>> - if (sctp_sk(ep->base.sk)->bind_hash)
>> - sctp_put_port(ep->base.sk);
>> -
>> /* Give up our hold on the sock. */
>> - if (ep->base.sk)
>> - sock_put(ep->base.sk);
>> + if ((sk = ep->base.sk)) {
>
> Can you either split the above into separate assignment and test (this is what checkpatchs.pl recommends) or at least comment that you mean to do assign and test in the above statement.
Ok, sure, I can make this separate and rephrase the above sentence for the log.
Thanks,
Daniel
next prev parent reply other threads:[~2013-06-25 15:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 15:13 [PATCH net-next 0/6] Further SCTP changes Daniel Borkmann
2013-06-25 15:13 ` [PATCH net-next 1/6] net: sctp: remove TEST_FRAME ifdef Daniel Borkmann
2013-06-25 15:13 ` [PATCH net-next 2/6] ktime: add ms_to_ktime() and ktime_add_ms() helpers Daniel Borkmann
2013-06-25 15:13 ` [PATCH net-next 3/6] net: sctp: migrate cookie life from timeval to ktime Daniel Borkmann
2013-06-25 15:13 ` [PATCH net-next 4/6] net: sctp: minor: sctp_seq_dump_local_addrs add missing newline Daniel Borkmann
2013-06-25 15:13 ` [PATCH net-next 5/6] net: sctp: decouple cleaning some socket data from endpoint Daniel Borkmann
2013-06-25 15:32 ` Vlad Yasevich
2013-06-25 15:38 ` Daniel Borkmann [this message]
2013-06-25 15:13 ` [PATCH net-next 6/6] net: sctp: simplify sctp_get_port Daniel Borkmann
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=51C9B986.2030104@redhat.com \
--to=dborkman@redhat.com \
--cc=davem@davemloft.net \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vyasevich@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).