All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>,
	Vlad Yasevich <vyasevich@gmail.com>,
	davem@davemloft.net
Subject: Re: [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete
Date: Wed, 08 Feb 2017 21:50:06 +0000	[thread overview]
Message-ID: <20170208215006.GG3414@localhost.localdomain> (raw)
In-Reply-To: <20170208214801.GF3414@localhost.localdomain>

On Wed, Feb 08, 2017 at 07:48:01PM -0200, Marcelo Ricardo Leitner wrote:
> Hi Xin,
> 
> On Thu, Feb 09, 2017 at 01:18:18AM +0800, Xin Long wrote:
> > This patch is to implement Sender-Side Procedures for the SSN/TSN
> > Reset Request Parameter descibed in rfc6525 section 5.1.4.
> > 
> > It is also to add sockopt SCTP_RESET_ASSOC in rfc6525 section 6.3.3
> > for users.
> > 
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ...
> > +
> > +int sctp_send_reset_assoc(struct sctp_association *asoc)
> > +{
> > +	struct sctp_chunk *chunk = NULL;
> > +	int retval;
> > +	__u16 i;
> > +
> > +	if (!asoc->peer.reconf_capable ||
> > +	    !(asoc->strreset_enable & SCTP_ENABLE_RESET_ASSOC_REQ))
> > +		return -ENOPROTOOPT;
> > +
> > +	if (asoc->strreset_outstanding)
> > +		return -EINPROGRESS;
> > +
> > +	chunk = sctp_make_strreset_tsnreq(asoc);
>           ^--- refcnf = 1 (as per sctp_chunkify())
> 
> > +	if (!chunk)
> > +		return -ENOMEM;
> > +
> > +	/* Block further xmit of data until this request is completed */
> > +	for (i = 0; i < asoc->stream->outcnt; i++)
> > +		asoc->stream->out[i].state = SCTP_STREAM_CLOSED;
> > +
> > +	asoc->strreset_chunk = chunk;
> > +	sctp_chunk_hold(asoc->strreset_chunk);
>                                  ^--- refcnf = 2
> > +
> > +	retval = sctp_send_reconf(asoc, chunk);
> > +	if (retval) {
> > +		sctp_chunk_put(asoc->strreset_chunk);
>                                           ^--- refcnf = 1
> 
> Won't we leak the chunk here?

No we won't, sctp_send_reconf() frees it for us, aye.



WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>,
	Vlad Yasevich <vyasevich@gmail.com>,
	davem@davemloft.net
Subject: Re: [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter
Date: Wed, 8 Feb 2017 19:50:06 -0200	[thread overview]
Message-ID: <20170208215006.GG3414@localhost.localdomain> (raw)
In-Reply-To: <20170208214801.GF3414@localhost.localdomain>

On Wed, Feb 08, 2017 at 07:48:01PM -0200, Marcelo Ricardo Leitner wrote:
> Hi Xin,
> 
> On Thu, Feb 09, 2017 at 01:18:18AM +0800, Xin Long wrote:
> > This patch is to implement Sender-Side Procedures for the SSN/TSN
> > Reset Request Parameter descibed in rfc6525 section 5.1.4.
> > 
> > It is also to add sockopt SCTP_RESET_ASSOC in rfc6525 section 6.3.3
> > for users.
> > 
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ...
> > +
> > +int sctp_send_reset_assoc(struct sctp_association *asoc)
> > +{
> > +	struct sctp_chunk *chunk = NULL;
> > +	int retval;
> > +	__u16 i;
> > +
> > +	if (!asoc->peer.reconf_capable ||
> > +	    !(asoc->strreset_enable & SCTP_ENABLE_RESET_ASSOC_REQ))
> > +		return -ENOPROTOOPT;
> > +
> > +	if (asoc->strreset_outstanding)
> > +		return -EINPROGRESS;
> > +
> > +	chunk = sctp_make_strreset_tsnreq(asoc);
>           ^--- refcnf = 1 (as per sctp_chunkify())
> 
> > +	if (!chunk)
> > +		return -ENOMEM;
> > +
> > +	/* Block further xmit of data until this request is completed */
> > +	for (i = 0; i < asoc->stream->outcnt; i++)
> > +		asoc->stream->out[i].state = SCTP_STREAM_CLOSED;
> > +
> > +	asoc->strreset_chunk = chunk;
> > +	sctp_chunk_hold(asoc->strreset_chunk);
>                                  ^--- refcnf = 2
> > +
> > +	retval = sctp_send_reconf(asoc, chunk);
> > +	if (retval) {
> > +		sctp_chunk_put(asoc->strreset_chunk);
>                                           ^--- refcnf = 1
> 
> Won't we leak the chunk here?

No we won't, sctp_send_reconf() frees it for us, aye.

  reply	other threads:[~2017-02-08 21:50 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 17:18 [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add streams Xin Long
2017-02-08 17:18 ` Xin Long
2017-02-08 17:18 ` [PATCHv6 net-next 1/6] sctp: drop unnecessary __packed from some stream reconf structures Xin Long
2017-02-08 17:18   ` Xin Long
2017-02-08 17:18   ` [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request Xin Long
2017-02-08 17:18     ` Xin Long
2017-02-08 17:18     ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chunk Xin Long
2017-02-08 17:18       ` Xin Long
2017-02-08 17:18       ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Xin Long
2017-02-08 17:18         ` Xin Long
2017-02-08 17:18         ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams Xin Long
2017-02-08 17:18           ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams request chunk Xin Long
2017-02-08 17:18           ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Requ Xin Long
2017-02-08 17:18             ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter Xin Long
2017-02-09 11:24             ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Marcelo Ricardo Leitner
2017-02-09 11:24               ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter Marcelo Ricardo Leitner
2017-02-09 11:23           ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing stre Marcelo Ricardo Leitner
2017-02-09 11:23             ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams request chunk Marcelo Ricardo Leitner
2017-02-08 21:48         ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Marcelo Ricardo Leitner
2017-02-08 21:48           ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Marcelo Ricardo Leitner
2017-02-08 21:50           ` Marcelo Ricardo Leitner [this message]
2017-02-08 21:50             ` Marcelo Ricardo Leitner
2017-02-09  7:58             ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Xin Long
2017-02-09  7:58               ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Xin Long
2017-02-09 11:23         ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Marcelo Ricardo Leitner
2017-02-09 11:23           ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Marcelo Ricardo Leitner
2017-02-08 21:57       ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chun Marcelo Ricardo Leitner
2017-02-08 21:57         ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chunk Marcelo Ricardo Leitner
2017-02-09  7:56         ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chun Xin Long
2017-02-09  7:56           ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chunk Xin Long
2017-02-08 21:56     ` [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request Marcelo Ricardo Leitner
2017-02-08 21:56       ` Marcelo Ricardo Leitner
2017-02-08 21:56   ` [PATCHv6 net-next 1/6] sctp: drop unnecessary __packed from some stream reconf structures Marcelo Ricardo Leitner
2017-02-08 21:56     ` Marcelo Ricardo Leitner
2017-02-09 12:30 ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add str Neil Horman
2017-02-09 12:30   ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add streams Neil Horman
2017-02-09 21:58 ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add str David Miller
2017-02-09 21:58   ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add streams David Miller

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=20170208215006.GG3414@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --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 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.