From: David Miller <davem@davemloft.net>
To: lucien.xin@gmail.com
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
marcelo.leitner@gmail.com, vyasevich@gmail.com,
daniel@iogearbox.net
Subject: Re: [PATCH net] sctp: fix a success return may hide an error
Date: Fri, 12 Aug 2016 21:11:13 -0700 (PDT) [thread overview]
Message-ID: <20160812.211113.1099230839994600349.davem@davemloft.net> (raw)
In-Reply-To: <31f3b581258d0458edcf30f65ef9513bdc41acc1.1470919978.git.lucien.xin@gmail.com>
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 11 Aug 2016 20:52:58 +0800
> Now in the end of sctp_outq_flush, sctp calls sctp_packet_transmit
> in a loop. The return of current sctp_packet_transmit always covers
> the prior one's. If the last call of sctp_packet_transmit return a
> success, it may hide the error that returns from the prior call.
>
> This patch is to fix this by keeping the old error until the new
> error returns from sctp_packet_transmit. Did TAHI test against this
> fix, no regression is found.
>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
This style of error handling is dangerous. The first error can be
lost.
For example, if sctp_outq_flush_rtx() earlier in this function returns
an error, it will be lost if any invocation of the function
sctp_packet_transmit() at the end function signals an error.
I think you should always preserve the first error that is recorded
into 'error'.
I also wonder about why sctp_outq_flush_rtx() errors are completely
ignored and don't influence the control flow here in any way.
next prev parent reply other threads:[~2016-08-13 4:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 12:52 [PATCH net] sctp: fix a success return may hide an error Xin Long
2016-08-11 13:11 ` Marcelo Ricardo Leitner
2016-08-11 15:36 ` Neil Horman
2016-08-13 4:11 ` David Miller [this message]
2016-08-13 7:47 ` Xin Long
2016-08-16 9:16 ` David Laight
2016-08-16 11:34 ` Xin Long
2016-08-16 16:01 ` David Laight
2016-08-16 17:24 ` Marcelo Ricardo Leitner
2016-08-16 18:24 ` Xin Long
2016-08-16 18:33 ` Marcelo Ricardo Leitner
2016-08-16 18:45 ` Marcelo Ricardo Leitner
2016-08-17 11:42 ` Xin Long
2016-08-17 9:01 ` David Laight
2016-08-18 17:44 ` 'Marcelo Ricardo Leitner'
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=20160812.211113.1099230839994600349.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=daniel@iogearbox.net \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--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).