From patchwork Tue Nov 26 22:44:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Maciej_=C5=BBenczykowski?= X-Patchwork-Id: 1201243 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BMnTHtRi"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47MzVS2Bh8z9sS9 for ; Wed, 27 Nov 2019 09:44:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbfKZWob (ORCPT ); Tue, 26 Nov 2019 17:44:31 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:45274 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbfKZWob (ORCPT ); Tue, 26 Nov 2019 17:44:31 -0500 Received: by mail-pj1-f66.google.com with SMTP id r11so1129952pjp.12 for ; Tue, 26 Nov 2019 14:44:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uLUkE7GruPWMQQ52BTtxh38fV4cbrfRZ0q9F0W5fncU=; b=BMnTHtRi/FgtwpUjzI8sNRjRbmZUdGYpbSC87j2UTRk9TgEYBz/SBS0npfGL8I+CiQ /7Oe2L439iFFjbygm18RXX8WgMN3nFuqhut4C28hZp4wlCvWobob34lVa5v3WEPaXeHU nzpXf9p3qbpWi8vJRBjyI3E0yFAb7aPBk02uTug1kLRcCnSlOIGeRrW+K7JXOoDoAzZB J4xP3/R7MphQ4cX1nftXG1USS0qdVv4XhVIC4cE0emjkMDibObs0DmDG1adB7YoOdNgX QbSYC+CsT9vQMwKBeOd8i214+uoZ9/amyKItSnoeGyP+5px0zRBVqPssO78fuq3Af/g5 T7Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uLUkE7GruPWMQQ52BTtxh38fV4cbrfRZ0q9F0W5fncU=; b=Y9WzcsPtZEBCr9HQrisdAVsc3aLujwfEfWOYIrRgiQUyF8nReXGujXrd3KUvee5kSN 9cJmjCANzL7205/Dy+h5tuHu9m6JYYaYne17NkTHupD8z9yArk6SP/ZF+3rpf3l2xA3Q 4dmK2aJLj/RixFGAJKb4FoGJAWCQ2114GSrvAJIzNoV012JF161DS7H4qQH4zfjE6zA+ PwiR5tj9N0nEBfYEWXNYIJJLO00GFci/StI+t35X1h3YCBmLTBHbWC/MByE+nFSC00ZS 0r1R5mARWGoRYJCae6jBMa0Q90me9w4hU0s2CQbmgi2dxfvBvark0+VlmHWnqmwUJT7K 7Kyw== X-Gm-Message-State: APjAAAWkLrVgywpDlUth9iDeomVg6uIy8laWwRLlruMwT9YlMU2vEXHA 8Te9he8M8PC51FssxnizxN5H66Up X-Google-Smtp-Source: APXvYqwbfhNcKVyZaMFudh/azbyEA1DguTF+iLuqxt5iFzaT19Yb5N/NqRDf8jIE0d9A9boNLPQugQ== X-Received: by 2002:a17:902:7089:: with SMTP id z9mr743408plk.292.1574808270083; Tue, 26 Nov 2019 14:44:30 -0800 (PST) Received: from athina.mtv.corp.google.com ([2620:15c:211:0:c786:d9fd:ab91:6283]) by smtp.gmail.com with ESMTPSA id p3sm13614383pfb.163.2019.11.26.14.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 14:44:29 -0800 (PST) From: =?utf-8?q?Maciej_=C5=BBenczykowski?= To: =?utf-8?q?Maciej_=C5=BBenczykowski?= , "David S . Miller" Cc: netdev@vger.kernel.org Subject: [PATCH] net: inet_is_local_reserved_port() port arg should be unsigned short Date: Tue, 26 Nov 2019 14:44:16 -0800 Message-Id: <20191126224416.23883-1-zenczykowski@gmail.com> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maciej Żenczykowski Any argument outside of that range would result in an out of bound memory access, since the accessed array is 65536 bits long. Signed-off-by: Maciej Żenczykowski --- include/net/ip.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/ip.h b/include/net/ip.h index c823aa279d21..cea69efe5322 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -339,7 +339,7 @@ static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_o void inet_get_local_port_range(struct net *net, int *low, int *high); #ifdef CONFIG_SYSCTL -static inline bool inet_is_local_reserved_port(struct net *net, int port) +static inline bool inet_is_local_reserved_port(struct net *net, unsigned short port) { if (!net->ipv4.sysctl_local_reserved_ports) return false; @@ -358,7 +358,7 @@ static inline bool inet_port_requires_bind_service(struct net *net, unsigned sho } #else -static inline bool inet_is_local_reserved_port(struct net *net, int port) +static inline bool inet_is_local_reserved_port(struct net *net, unsigned short port) { return false; }