All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvid Brodin <arvid.brodin@xdin.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <shemminger@vyatta.com>,
	<joe@perches.com>, <jboticario@gmail.com>,
	<balferreira@googlemail.com>, <elias.molina@ehu.es>
Subject: Re: [PATCH v4] net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)
Date: Mon, 30 Sep 2013 17:09:35 +0200	[thread overview]
Message-ID: <5249942F.3090504@xdin.com> (raw)
In-Reply-To: <20130920.151017.2125552741552759738.davem@davemloft.net>

On 2013-09-20 21:10, David Miller wrote:
> From: Arvid Brodin <arvid.brodin@xdin.com>
> Date: Thu, 19 Sep 2013 03:11:58 +0200
> 
>> +#if !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
>> +		/* We need to memmove the whole header to work around
>> +		 * alignment problems caused by the 6-byte HSR tag.
>> +		 */
>> +		memmove(skb_deliver->data - HSR_TAGLEN, skb_deliver->data,
>> +			skb_headlen(skb_deliver));
>> +		skb_deliver->data -= HSR_TAGLEN;
>> +		skb_deliver->tail -= HSR_TAGLEN;
>> +#endif
> 
> You can't do this.
> 
> First of all, you have no idea if subtracting skb->data a given amount
> will underflow the skb buffer start.  You aren't even checking, all
> of the standard skb_*() data adjustment interfaces do.

(Shorter and more to the point than my previous replies:)

I _do_ know: this can't possibly underflow since strip_hsr_tag() a 
few lines above pulled the same amount of data. I will rename 
strip_hsr_tag() to hsr_pull_tag() to make this clearer.


> Secondly, everything after the header is now at the wrong offset from
> the beginning of the packet.

How does this matter? The memmove moves everything back (restores the 
changes made to the packet on the sending side) so that it is at the
"normal" position for an ethernet packet.


-- 
Arvid Brodin | Consultant (Linux)
XDIN AB | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden | xdin.com

  parent reply	other threads:[~2013-09-30 15:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19  1:11 [PATCH v4] net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0) Arvid Brodin
2013-09-20 19:10 ` David Miller
2013-09-21  0:43   ` Arvid Brodin
2013-09-21  1:03     ` Arvid Brodin
2013-09-21  1:28       ` Arvid Brodin
2013-09-30 15:09   ` Arvid Brodin [this message]
2013-10-15 19:59     ` Arvid Brodin

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=5249942F.3090504@xdin.com \
    --to=arvid.brodin@xdin.com \
    --cc=balferreira@googlemail.com \
    --cc=davem@davemloft.net \
    --cc=elias.molina@ehu.es \
    --cc=jboticario@gmail.com \
    --cc=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.