netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: inet_is_local_reserved_port() port arg should be unsigned short
@ 2019-11-26 22:44 Maciej Żenczykowski
  2019-11-26 23:15 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej Żenczykowski @ 2019-11-26 22:44 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller; +Cc: netdev

From: Maciej Żenczykowski <maze@google.com>

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 <maze@google.com>
---
 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;
 }
-- 
2.24.0.432.g9d3f5f5b63-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: inet_is_local_reserved_port() port arg should be unsigned short
  2019-11-26 22:44 [PATCH] net: inet_is_local_reserved_port() port arg should be unsigned short Maciej Żenczykowski
@ 2019-11-26 23:15 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-11-26 23:15 UTC (permalink / raw)
  To: zenczykowski; +Cc: maze, netdev

From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Tue, 26 Nov 2019 14:44:16 -0800

> From: Maciej Żenczykowski <maze@google.com>
> 
> 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 <maze@google.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-26 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-26 22:44 [PATCH] net: inet_is_local_reserved_port() port arg should be unsigned short Maciej Żenczykowski
2019-11-26 23:15 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).