netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: Fix error handling for switch statement case in the function sctp_cmd_interprete
@ 2016-04-05 21:36 Bastien Philbert
  2016-04-05 21:53 ` Daniel Borkmann
  2016-04-05 22:12 ` Marcelo Ricardo Leitner
  0 siblings, 2 replies; 7+ messages in thread
From: Bastien Philbert @ 2016-04-05 21:36 UTC (permalink / raw)
  To: vyasevich; +Cc: nhorman, davem, linux-sctp, netdev, linux-kernel

This fixes error handling for the switch statement case
SCTP_CMD_SEND_PKT by making the error value of the call
to sctp_packet_transmit equal the variable error due to
this function being able to fail with a error code. In
addition allow the call to sctp_ootb_pkt_free afterwards
to free up the no longer in use sctp packet even if the
call to the function sctp_packet_transmit fails in order
to avoid a memory leak here for not freeing the sctp

Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
---
 net/sctp/sm_sideeffect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 7fe56d0..f3a8b58 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1434,7 +1434,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
 		case SCTP_CMD_SEND_PKT:
 			/* Send a full packet to our peer.  */
 			packet = cmd->obj.packet;
-			sctp_packet_transmit(packet, gfp);
+			error = sctp_packet_transmit(packet, gfp);
 			sctp_ootb_pkt_free(packet);
 			break;
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-05 23:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 21:36 [PATCH] sctp: Fix error handling for switch statement case in the function sctp_cmd_interprete Bastien Philbert
2016-04-05 21:53 ` Daniel Borkmann
2016-04-05 21:58   ` Bastien Philbert
2016-04-05 23:29   ` David Miller
2016-04-05 23:34     ` Bastien Philbert
2016-04-05 22:12 ` Marcelo Ricardo Leitner
2016-04-05 23:03   ` Bastien Philbert

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).