From patchwork Sun Nov 21 14:33:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 525 Return-Path: Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.22]) by open-mesh.org (Postfix) with SMTP id D8DF51544AE for ; Sun, 21 Nov 2010 15:32:53 +0100 (CET) Received: (qmail invoked by alias); 21 Nov 2010 14:32:53 -0000 Received: from i59F6D67A.versanet.de (EHLO sven-desktop.lazhur.ath.cx) [89.246.214.122] by mail.gmx.net (mp050) with SMTP; 21 Nov 2010 15:32:53 +0100 X-Authenticated: #15668376 X-Provags-ID: V01U2FsdGVkX18b15wWOM4bB2lAujwYiE1nqWYiIpkNHC/kRL7roe FpViOkGZ6kdGag From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org, lesniak@sra.uni-hannover.de Date: Sun, 21 Nov 2010 15:33:01 +0100 Message-Id: <1290349981-23883-1-git-send-email-sven.eckelmann@gmx.de> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <201011211432.44862.lindner_marek@yahoo.de> References: <201011211432.44862.lindner_marek@yahoo.de> X-Y-GMX-Trusted: 0 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Ensure that eth_type_trans gets linear memory X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 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: Sun, 21 Nov 2010 14:32:54 -0000 eth_type_trans tries to pull data with the length of the ethernet header from the skb. We only ensured that enough data for the first ethernet header and the batman header is available in non-paged memory of the skb and not for the ethernet after the batman header. eth_type_trans would fail sometimes with drivers which don't ensure that all there data is perfectly linearised. Reported-by: thorkill Signed-off-by: Sven Eckelmann --- batman-adv/soft-interface.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/batman-adv/soft-interface.c b/batman-adv/soft-interface.c index e93a99f..e89ede1 100644 --- a/batman-adv/soft-interface.c +++ b/batman-adv/soft-interface.c @@ -494,6 +494,8 @@ void interface_rx(struct net_device *soft_iface, } /* skb->dev & skb->pkt_type are set here */ + if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) + goto dropped; skb->protocol = eth_type_trans(skb, soft_iface); /* should not be neccesary anymore as we use skb_pull_rcsum()