B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <a@unstable.cc>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>,
	Sven Eckelmann <sven@narfation.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH maint v2] batman-adv: Avoid race in TT TVLV allocator helper
Date: Thu, 10 May 2018 21:27:34 +0800	[thread overview]
Message-ID: <fa30c030-a38d-904a-dd2d-a337614460ee@unstable.cc> (raw)
In-Reply-To: <20180509190740.11465-1-sven@narfation.org>


[-- Attachment #1.1: Type: text/plain, Size: 1423 bytes --]

On 10/05/18 03:07, Sven Eckelmann wrote:
> The functions batadv_tt_prepare_tvlv_local_data and
> batadv_tt_prepare_tvlv_global_data are responsible for preparing a buffer
> which can be used to store the TVLV container for TT and add the VLAN
> information to it.
> 
> This will be done in three phases:
> 
> 1. count the number of VLANs and their entries
> 2. allocate the buffer using the counters from the previous step and limits
>    from the caller (parameter tt_len)
> 3. insert the VLAN information to the buffer
> 
> The step 1 and 3 operate on a list which contains the VLANs. The access to
> these lists must be protected with an appropriate lock or otherwise they
> might operate on on different entries. This could for example happen when
> another context is adding VLAN entries to this list.
> 
> This could lead to a buffer overflow in these functions when enough entries
> were added between step 1 and 3 to the VLAN lists that the buffer room for
> the entries (*tt_change) is smaller then the now required extra buffer for
> new VLAN entries.
> 
> Fixes: 21a57f6e7a3b ("batman-adv: make the TT CRC logic VLAN specific")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>

Acked-by: Antonio Quartulli <a@unstable.cc>

Good catch. Unfortunately this issue was caused by my misunderstanding
of the RCU mechanism when used with lists.


Cheers,

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-05-10 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 19:07 [B.A.T.M.A.N.] [PATCH maint v2] batman-adv: Avoid race in TT TVLV allocator helper Sven Eckelmann
2018-05-10 13:27 ` Antonio Quartulli [this message]
2018-05-10 14:12   ` Sven Eckelmann

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=fa30c030-a38d-904a-dd2d-a337614460ee@unstable.cc \
    --to=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sven@narfation.org \
    /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