From patchwork Tue May 7 11:25:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 2969 Return-Path: Received: from nm24-vm7.bullet.mail.sg3.yahoo.com (nm24-vm7.bullet.mail.sg3.yahoo.com [106.10.151.86]) by open-mesh.org (Postfix) with SMTP id 2A15B601BAF for ; Tue, 7 May 2013 13:25:27 +0200 (CEST) Received: from [106.10.166.112] by nm24.bullet.mail.sg3.yahoo.com with NNFMP; 07 May 2013 11:25:25 -0000 Received: from [106.10.167.214] by tm1.bullet.mail.sg3.yahoo.com with NNFMP; 07 May 2013 11:25:25 -0000 Received: from [127.0.0.1] by smtp187.mail.sg3.yahoo.com with NNFMP; 07 May 2013 11:25:25 -0000 X-Yahoo-Newman-Id: 81716.8583.bm@smtp187.mail.sg3.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: v3A2nyIVM1k3s7jud2luyU6rCx5VAGc65Jv4t7B6mdiOyBR hCppjfNGNBPctDjOzNREMpyfc9lRV9ByTLwhSxr.pl3XnsmsWt1WZVEbeVeY 7UPnIvf8JqMKBYaDlbfPSKxqVtgoM.TkoOQrDcqOwAI2KPu3kqnesOm2vZOe 7n.PUgV3ImI2ftw6usZtdrbnC9A1Cvw.T3hq.ESdLRspnSjP2Qp13S1LxSyK Ncw50JhOTelw0OiWDzCjRt3N_GZhvXH.7hzrT0nqGyIvkU7p7W86axmBkoF2 WdUgAhvLGU5h3z4TL2nLcD3BjJBI_2csTzPdbUh1_uhxPBRMBk3TX7ntz9DD WVNotk9QYHuHFOmShizCNrbzGw25KnU4LgcDbi2zmHcJZcqViYIdjFKFOPHZ i4TidGNSsNKzRbXgnA35L.QREnbpGGTwSuPxaKACAbONputQ- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- X-Rocket-Received: from localhost (lindner_marek@42.98.130.246 with plain) by smtp187.mail.sg3.yahoo.com with SMTP; 07 May 2013 04:25:24 -0700 PDT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 7 May 2013 19:25:02 +0800 Message-Id: <1367925902-31578-1-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.10.4 Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: check return value of pskb_trim_rcsum() 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: Tue, 07 May 2013 11:25:29 -0000 Reported-by: Sven Eckelmann Signed-off-by: Marek Lindner Acked-by: Martin Hundebøll --- network-coding.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/network-coding.c b/network-coding.c index f7c5430..e84629e 100644 --- a/network-coding.c +++ b/network-coding.c @@ -1514,6 +1514,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, struct ethhdr *ethhdr, ethhdr_tmp; uint8_t *orig_dest, ttl, ttvn; unsigned int coding_len; + int err; /* Save headers temporarily */ memcpy(&coded_packet_tmp, skb->data, sizeof(coded_packet_tmp)); @@ -1568,8 +1569,11 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, coding_len); /* Resize decoded skb if decoded with larger packet */ - if (nc_packet->skb->len > coding_len + h_size) - pskb_trim_rcsum(skb, coding_len + h_size); + if (nc_packet->skb->len > coding_len + h_size) { + err = pskb_trim_rcsum(skb, coding_len + h_size); + if (err) + return NULL; + } /* Create decoded unicast packet */ unicast_packet = (struct batadv_unicast_packet *)skb->data;