netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: erik.hugne@ericsson.com
Cc: netdev@vger.kernel.org, jon.maloy@ericsson.com,
	maloy@donjonn.com, paul.gortmaker@windriver.com,
	ying.xue@windriver.com
Subject: Re: [PATCH net-next v2 2/3] tipc: message reassembly using fragment chain
Date: Mon, 04 Nov 2013 16:12:54 -0500 (EST)	[thread overview]
Message-ID: <20131104.161254.1576011108092991976.davem@davemloft.net> (raw)
In-Reply-To: <1383208814-23476-3-git-send-email-erik.hugne@ericsson.com>

From: <erik.hugne@ericsson.com>
Date: Thu, 31 Oct 2013 09:40:13 +0100

> +	skb_pull(frag, msg_hdr_sz(msg));
> +	if (fragid == FIRST_FRAGMENT) {
> +		if (*head)
> +			goto out_free;
> +		*head = frag;
> +		skb_frag_list_init(*head);
>  		return 0;
> +	} else {
> +		if (!*head)
> +			goto out_free;
> +		if (!skb_has_frag_list(*head))
> +			skb_shinfo(*head)->frag_list = frag;
> +		else
> +			(*tail)->next = frag;
> +		*tail = frag;
> +		(*head)->truesize += frag->truesize;
> +	}
> +	if (fragid == LAST_FRAGMENT) {
> +		*fbuf = *head;
> +		*tail = *head = NULL;
> +		return LINK_REASM_COMPLETE;
>  	}

Please use skb_try_coalese(), and only use frag lists if that does not
succeed.

Also you must be certain to unclone the SKB if you are going to modify
it in this kind of way.

For a good example of how to attend to all of these things, see
ip_frag_reasm() in net/ipv4/ip_fragment.c

  reply	other threads:[~2013-11-04 21:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31  8:40 [PATCH net-next v2 0/3] tipc: message reassembly using fragment chain erik.hugne
2013-10-31  8:40 ` [PATCH net-next v2 1/3] tipc: don't reroute message fragments erik.hugne
2013-10-31  8:40 ` [PATCH net-next v2 2/3] tipc: message reassembly using fragment chain erik.hugne
2013-11-04 21:12   ` David Miller [this message]
2013-11-05  8:15     ` Erik Hugne
2013-10-31  8:40 ` [PATCH net-next v2 3/3] tipc: reassembly failures should cause link reset erik.hugne

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=20131104.161254.1576011108092991976.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=erik.hugne@ericsson.com \
    --cc=jon.maloy@ericsson.com \
    --cc=maloy@donjonn.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=ying.xue@windriver.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).