* [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly check pskb_may_pull return value
@ 2014-01-29 23:12 Antonio Quartulli
2014-01-29 23:15 ` Antonio Quartulli
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2014-01-29 23:12 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Antonio Quartulli
pskb_may_pull() returns 1 on success and 0 in case of failure,
therefore checking for the return value being negative does
not make sense at all.
Fix this by doing the proper check.
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
routing.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routing.c b/routing.c
index f28920f..f7579d0 100644
--- a/routing.c
+++ b/routing.c
@@ -833,7 +833,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
int is_old_ttvn;
/* check if there is enough data before accessing it */
- if (pskb_may_pull(skb, hdr_len + ETH_HLEN) < 0)
+ if (!pskb_may_pull(skb, hdr_len + ETH_HLEN))
return 0;
/* create a copy of the skb (in case of for re-routing) to modify it. */
--
1.8.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly check pskb_may_pull return value
2014-01-29 23:12 [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly check pskb_may_pull return value Antonio Quartulli
@ 2014-01-29 23:15 ` Antonio Quartulli
2014-02-02 14:38 ` Marek Lindner
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2014-01-29 23:15 UTC (permalink / raw)
To: b.a.t.m.a.n
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
On 30/01/14 00:12, Antonio Quartulli wrote:
> pskb_may_pull() returns 1 on success and 0 in case of failure,
> therefore checking for the return value being negative does
> not make sense at all.
>
I should have added:
This way if the function fails we will probably read beyond the current
skb data buffer.
> Fix this by doing the proper check.
>
> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
--
Antonio Quartulli
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly check pskb_may_pull return value
2014-01-29 23:15 ` Antonio Quartulli
@ 2014-02-02 14:38 ` Marek Lindner
0 siblings, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2014-02-02 14:38 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Antonio Quartulli
[-- Attachment #1: Type: text/plain, Size: 442 bytes --]
On Thursday 30 January 2014 00:15:10 Antonio Quartulli wrote:
> On 30/01/14 00:12, Antonio Quartulli wrote:
> > pskb_may_pull() returns 1 on success and 0 in case of failure,
> > therefore checking for the return value being negative does
> > not make sense at all.
> >
> >
>
> I should have added:
>
> This way if the function fails we will probably read beyond the current
> skb data buffer.
Applied in revision eabdc31.
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-02 14:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 23:12 [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly check pskb_may_pull return value Antonio Quartulli
2014-01-29 23:15 ` Antonio Quartulli
2014-02-02 14:38 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox