public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ying Xue <ying.xue@windriver•com>
To: Jon Maloy <jon.maloy@ericsson•com>, <davem@davemloft•net>
Cc: <netdev@vger•kernel.org>,
	Paul Gortmaker <paul.gortmaker@windriver•com>,
	<erik.hugne@ericsson•com>, <maloy@donjonn•com>,
	<tipc-discussion@lists•sourceforge.net>
Subject: Re: [PATCH net 1/1] tipc: fix bug in multicast/broadcast message reassembly
Date: Mon, 7 Jul 2014 11:22:14 +0800	[thread overview]
Message-ID: <53BA1266.7090101@windriver.com> (raw)
In-Reply-To: <1404582253-21815-1-git-send-email-jon.maloy@ericsson.com>

On 07/06/2014 01:44 AM, Jon Maloy wrote:
> Since commit 37e22164a8a3c39bdad45aa463b1e69a1fdf4110 ("tipc: rename and
> move message reassembly function") reassembly of long broadcast messages
> has been broken. This is because we test for a non-NULL return value
> of the *buf parameter as criteria for succesful reassembly. However, this
> parameter is left defined even after reception of the first fragment,
> when reassebly is still incomplete. This leads to a kernel crash as soon
> as a the first fragment of a long broadcast message is received.
> 
> We fix this with this commit, by implementing a stricter behavior of the
> function and its return values.
> 
> This commit should be applied to both net and net-next.
> 
> Signed-off-by: Jon Maloy <jon.maloy@ericsson•com>

Acked-by: Ying Xue <ying.xue@windriver•com>

> ---
>  net/tipc/msg.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/net/tipc/msg.c b/net/tipc/msg.c
> index 8be6e94..0a37a47 100644
> --- a/net/tipc/msg.c
> +++ b/net/tipc/msg.c
> @@ -101,9 +101,11 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
>  }
>  
>  /* tipc_buf_append(): Append a buffer to the fragment list of another buffer
> - * Let first buffer become head buffer
> - * Returns 1 and sets *buf to headbuf if chain is complete, otherwise 0
> - * Leaves headbuf pointer at NULL if failure
> + * @*headbuf: in:  NULL for first frag, otherwise value returned from prev call
> + *            out: set when successful non-complete reassembly, otherwise NULL
> + * @*buf:     in:  the buffer to append. Always defined
> + *            out: head buf after sucessful complete reassembly, otherwise NULL
> + * Returns 1 when reassembly complete, otherwise 0
>   */
>  int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
>  {
> @@ -122,6 +124,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
>  			goto out_free;
>  		head = *headbuf = frag;
>  		skb_frag_list_init(head);
> +		*buf = NULL;
>  		return 0;
>  	}
>  	if (!head)
> @@ -150,5 +153,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
>  out_free:
>  	pr_warn_ratelimited("Unable to build fragment list\n");
>  	kfree_skb(*buf);
> +	kfree_skb(*headbuf);
> +	*buf = *headbuf = NULL;
>  	return 0;
>  }
> 

  reply	other threads:[~2014-07-07  3:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 17:44 [PATCH net 1/1] tipc: fix bug in multicast/broadcast message reassembly Jon Maloy
2014-07-07  3:22 ` Ying Xue [this message]
2014-07-08 22:55 ` 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=53BA1266.7090101@windriver.com \
    --to=ying.xue@windriver$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=erik.hugne@ericsson$(echo .)com \
    --cc=jon.maloy@ericsson$(echo .)com \
    --cc=maloy@donjonn$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=paul.gortmaker@windriver$(echo .)com \
    --cc=tipc-discussion@lists$(echo .)sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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