Skip to content

Commit 66e2f5f

Browse files
zenczykowskidavem330
authored andcommitted
net: inet_is_local_reserved_port() port arg should be unsigned short
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4e81c0b commit 66e2f5f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/net/ip.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_o
339339
void inet_get_local_port_range(struct net *net, int *low, int *high);
340340

341341
#ifdef CONFIG_SYSCTL
342-
static inline bool inet_is_local_reserved_port(struct net *net, int port)
342+
static inline bool inet_is_local_reserved_port(struct net *net, unsigned short port)
343343
{
344344
if (!net->ipv4.sysctl_local_reserved_ports)
345345
return false;
@@ -357,7 +357,7 @@ static inline bool inet_port_requires_bind_service(struct net *net, unsigned sho
357357
}
358358

359359
#else
360-
static inline bool inet_is_local_reserved_port(struct net *net, int port)
360+
static inline bool inet_is_local_reserved_port(struct net *net, unsigned short port)
361361
{
362362
return false;
363363
}

0 commit comments

Comments
 (0)