From patchwork Mon Jan 20 10:06:44 2014 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: 3728 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=212.227.17.11; helo=mout.web.de; envelope-from=linus.luessing@web.de; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from mout.web.de (mout.web.de [212.227.17.11]) by open-mesh.org (Postfix) with ESMTPS id 6FD84602380 for ; Mon, 20 Jan 2014 11:06:16 +0100 (CET) Received: from localhost ([95.211.148.154]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0Ljamy-1VTf8Z0oNk-00beN5 for ; Mon, 20 Jan 2014 11:06:16 +0100 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 20 Jan 2014 11:06:44 +0100 Message-Id: <1390212404-9726-1-git-send-email-linus.luessing@web.de> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 X-Provags-ID: V03:K0:zPUl+97deghX+PksDSFt7jraJ4YI4qZ8n5cdwgA1l3eTupXeDV4 GDZGR0Ym7ty9Fl/ukorczXCh3hOebqwAxVtVLzNiVoiKSDLS+d3mUapv4uEakFb8R/rGs65 TuVthpsOCDnC2xwAml7K+7gu5Pn1DK/I11cqxQ5AyFyXtuQTMf7vqvhFBJzwHT4gc+LQ2Id n6gzJJBwG39yz+f64Y9XA== Subject: [B.A.T.M.A.N.] [PATCHv4 maint] batman-adv: fix potential kernel paging error for unicast transmissions 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: Mon, 20 Jan 2014 10:06:16 -0000 batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's data. If it does then our ethhdr pointer is not valid anymore in batadv_send_skb_unicast(), resulting in a kernel paging error. Fixing this by refetching the ethhdr pointer after the potential reallocation. Introduced by b46c60b9e1ee7a1909c542413a85875a750955d6 ("batman-adv: improve unicast packet (re)routing") Signed-off-by: Linus Lüssing Acked-by: Antonio Quartulli --- Changes v4: * "s/Introduced-by:/Introduced by/" to make checkpatch happy send.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/send.c b/send.c index b0a3d76..50df184 100644 --- a/send.c +++ b/send.c @@ -281,6 +281,10 @@ static int batadv_send_skb_unicast(struct batadv_priv *bat_priv, goto out; } + /* skb->data might have been reallocated by + * batadv_send_skb_prepare_unicast* + */ + ethhdr = eth_hdr(skb); unicast_packet = (struct batadv_unicast_packet *)skb->data; /* inform the destination node that we are still missing a correct route