From patchwork Sat Jul 27 01:24:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 3241 Return-Path: Received: from mout.web.de (mout.web.de [212.227.17.11]) by open-mesh.org (Postfix) with ESMTP id 6A18A601C5E for ; Sat, 27 Jul 2013 03:24:59 +0200 (CEST) Received: from localhost ([46.246.33.183]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0Lzb94-1TyXHe0qCw-014o3v for ; Sat, 27 Jul 2013 03:24:58 +0200 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 27 Jul 2013 03:24:44 +0200 Message-Id: <1374888285-20775-1-git-send-email-linus.luessing@web.de> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 X-Provags-ID: V03:K0:NutjrJUHXT/qYvwqXJQW9m6afV1SnIULOggTlHyK1tVcpa0WBGP IAtIofcoX30L87lsnX4+5TSDgT/bRReDuzskK6WKrtf/g1UEBzyYUs0Itc2ph5TMMkpWl3N k9Y0Q8srimYjF3eSkBSbQsduGgFd+1+acZFXsP4ehO+EyXGF0DkVA/38VASaUY9bXFCz8+H UZW8aGQW6LvjYimBtLKIw== Subject: [B.A.T.M.A.N.] [PATCH next 1/2] batman-adv: check return type of unicast packet preparations X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2013 01:24:59 -0000 batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's data. And if it tries to do so then this can potentially fail. We shouldn't continue working on this skb in such a case. Signed-off-by: Linus Lüssing Acked-by: Antonio Quartulli --- unicast.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/unicast.c b/unicast.c index dc8b5d4..4c5a1aa 100644 --- a/unicast.c +++ b/unicast.c @@ -428,11 +428,13 @@ find_router: switch (packet_type) { case BATADV_UNICAST: - batadv_unicast_prepare_skb(skb, orig_node); + if (!batadv_unicast_prepare_skb(skb, orig_node)) + goto out; break; case BATADV_UNICAST_4ADDR: - batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node, - packet_subtype); + if (!batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node, + packet_subtype)) + goto out; break; default: /* this function supports UNICAST and UNICAST_4ADDR only. It