From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roel Kluin Subject: [PATCH] ipv6: Keep index within tab_unreach[] Date: Tue, 16 Jun 2009 20:40:21 +0200 Message-ID: <4A37E715.4060504@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: netdev , Andrew Morton To: "David S. Miller" Return-path: Received: from mail-bw0-f213.google.com ([209.85.218.213]:45611 "EHLO mail-bw0-f213.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754843AbZFPQkQ (ORCPT ); Tue, 16 Jun 2009 12:40:16 -0400 Received: by bwz9 with SMTP id 9so4198615bwz.37 for ; Tue, 16 Jun 2009 09:40:18 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: Ensure that index `code' remains within array tab_unreach[] Signed-off-by: Roel Kluin --- diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 36dff88..8f850de 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -923,7 +923,7 @@ int icmpv6_err_convert(int type, int code, int *err) switch (type) { case ICMPV6_DEST_UNREACH: fatal = 1; - if (code <= ICMPV6_PORT_UNREACH) { + if (code <= ICMPV6_PORT_UNREACH && code >= 0) { *err = tab_unreach[code].err; fatal = tab_unreach[code].fatal; }