diff options
author | Antonio Quartulli <antonio@meshcoding.com> | 2014-01-30 00:12:24 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-06 22:06:16 -0800 |
commit | 7a2f20aab51e33ee083d5f285275dc8b54f74be4 (patch) | |
tree | a26fc5c8d86a8099dc12232c95a6a4bf14218558 /net | |
parent | b6cd79c3db913215ab2f162e58155527895d7f68 (diff) |
batman-adv: properly check pskb_may_pull return value
[ Upstream commit f1791425cf0bcda43ab9a9a37df1ad3ccb1f6654 ]
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.
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>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/routing.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 46278bfb8fdb..cd9ffdb831d9 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/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. */ |