* [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress
@ 2013-10-15 16:01 Sven Eckelmann
2013-10-15 16:01 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Finish resolving of mac address early Sven Eckelmann
2013-10-26 14:05 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress Marek Lindner
0 siblings, 2 replies; 4+ messages in thread
From: Sven Eckelmann @ 2013-10-15 16:01 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
The resolve_mac_* functions are currently not reentrant-safe because they are
using ether_aton. Thus all functions returning a mac address in a similar way
must also ensure that their data is in a statically allocated buffer and not on
a stack.
resolve_mac_from_cache did that for the wrong buffer.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
functions.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/functions.c b/functions.c
index 9e03e72..959784b 100644
--- a/functions.c
+++ b/functions.c
@@ -630,8 +630,8 @@ static int resolve_mac_from_cache_parse(struct ndmsg *ndmsg, size_t len_payload,
static struct ether_addr *resolve_mac_from_cache(int ai_family,
const void *l3addr)
{
- static uint8_t l3addr_tmp[16];
- struct ether_addr mac_tmp;
+ uint8_t l3addr_tmp[16];
+ static struct ether_addr mac_tmp;
struct ether_addr *mac_result = NULL;
void *buf = NULL;
size_t buflen;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [B.A.T.M.A.N.] [PATCH 2/2] batctl: Finish resolving of mac address early
2013-10-15 16:01 [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress Sven Eckelmann
@ 2013-10-15 16:01 ` Sven Eckelmann
2013-10-26 14:06 ` Marek Lindner
2013-10-26 14:05 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress Marek Lindner
1 sibling, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2013-10-15 16:01 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
It is not necessary to check the remaining msg buffer coming from the kernel
when already the correct mac address was found.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
functions.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/functions.c b/functions.c
index 959784b..f2b23f2 100644
--- a/functions.c
+++ b/functions.c
@@ -683,6 +683,7 @@ static struct ether_addr *resolve_mac_from_cache(int ai_family,
if (parsed) {
if (memcmp(&l3addr_tmp, l3addr, l3_len) == 0) {
mac_result = &mac_tmp;
+ finished = 1;
break;
}
}
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress
2013-10-15 16:01 [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress Sven Eckelmann
2013-10-15 16:01 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Finish resolving of mac address early Sven Eckelmann
@ 2013-10-26 14:05 ` Marek Lindner
1 sibling, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2013-10-26 14:05 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
On Tuesday 15 October 2013 18:01:08 Sven Eckelmann wrote:
> The resolve_mac_* functions are currently not reentrant-safe because they
> are using ether_aton. Thus all functions returning a mac address in a
> similar way must also ensure that their data is in a statically allocated
> buffer and not on a stack.
>
> resolve_mac_from_cache did that for the wrong buffer.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> functions.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied in revision ef41a8d.
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 2/2] batctl: Finish resolving of mac address early
2013-10-15 16:01 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Finish resolving of mac address early Sven Eckelmann
@ 2013-10-26 14:06 ` Marek Lindner
0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2013-10-26 14:06 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
On Tuesday 15 October 2013 18:01:09 Sven Eckelmann wrote:
> It is not necessary to check the remaining msg buffer coming from the kernel
> when already the correct mac address was found.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> functions.c | 1 +
> 1 file changed, 1 insertion(+)
Applied in revision 7cd9934.
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-26 14:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 16:01 [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress Sven Eckelmann
2013-10-15 16:01 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Finish resolving of mac address early Sven Eckelmann
2013-10-26 14:06 ` Marek Lindner
2013-10-26 14:05 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix static buffer for resolved mac adddress Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox