Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760602AbcDEV6n (ORCPT ); Tue, 5 Apr 2016 17:58:43 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:34661 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760464AbcDEV6l (ORCPT ); Tue, 5 Apr 2016 17:58:41 -0400 Subject: Re: [PATCH] sctp: Fix error handling for switch statement case in the function sctp_cmd_interprete To: Daniel Borkmann , vyasevich@gmail.com References: <1459892201-21397-1-git-send-email-bastienphilbert@gmail.com> <570433F0.6040506@iogearbox.net> Cc: nhorman@tuxdriver.com, davem@davemloft.net, linux-sctp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: Bastien Philbert Message-ID: <5704350E.5080403@gmail.com> Date: Tue, 5 Apr 2016 17:58:38 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <570433F0.6040506@iogearbox.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1744 Lines: 45 On 2016-04-05 05:53 PM, Daniel Borkmann wrote: > On 04/05/2016 11:36 PM, Bastien Philbert wrote: >> 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 > > What actual issue have you observed that you fix? > The issue here is basically that sctp_packet_transmit can return a error if it unsuccessfully transmit the sk_buff as a parameter. Seems that we should signal the user/caller(s) when a sctp packet transmission fails here. If you would like I can resend with a better commit message in a V2 if this explains the issue better. Bastien >> 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 > > Not sure how this relates to your code? > >> Signed-off-by: Bastien Philbert >> --- >> 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; >> >> >