Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71531
b: refs/heads/master
c: a25de53
h: refs/heads/master
i:
  71529: 63413c8
  71527: 7a8358d
v: v3
  • Loading branch information
Anton Arapov authored and David S. Miller committed Oct 19, 2007
1 parent b24de14 commit 60df6a5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be702d5e38e2e7e554604b223794f87c12fa6811
refs/heads/master: a25de534f89c515c82d3553c42d3bb02c2d1a7da
5 changes: 3 additions & 2 deletions trunk/drivers/infiniband/core/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -2797,11 +2797,12 @@ static void cma_remove_one(struct ib_device *device)

static int cma_init(void)
{
int ret, low, high;
int ret, low, high, remaining;

get_random_bytes(&next_port, sizeof next_port);
inet_get_local_port_range(&low, &high);
next_port = ((unsigned int) next_port % (high - low)) + low;
remaining = (high - low) + 1;
next_port = ((unsigned int) next_port % remaining) + low;

cma_wq = create_singlethread_workqueue("rdma_cm");
if (!cma_wq)
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/inet_connection_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
int remaining, rover, low, high;

inet_get_local_port_range(&low, &high);
remaining = high - low;
remaining = (high - low) + 1;
rover = net_random() % remaining + low;

do {
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/inet_hashtables.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ int inet_hash_connect(struct inet_timewait_death_row *death_row,
struct inet_timewait_sock *tw = NULL;

inet_get_local_port_range(&low, &high);
remaining = high - low;
remaining = (high - low) + 1;

local_bh_disable();
for (i = 1; i <= remaining; i++) {
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp,
ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos);

if (write && ret == 0) {
if (range[1] <= range[0])
if (range[1] < range[0])
ret = -EINVAL;
else
set_local_port_range(range);
Expand Down Expand Up @@ -150,7 +150,7 @@ static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,

ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen);
if (ret == 0 && newval && newlen) {
if (range[1] <= range[0])
if (range[1] < range[0])
ret = -EINVAL;
else
set_local_port_range(range);
Expand Down
5 changes: 3 additions & 2 deletions trunk/net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
write_lock_bh(&udp_hash_lock);

if (!snum) {
int i, low, high;
int i, low, high, remaining;
unsigned rover, best, best_size_so_far;

inet_get_local_port_range(&low, &high);
remaining = (high - low) + 1;

best_size_so_far = UINT_MAX;
best = rover = net_random() % (high - low) + low;
best = rover = net_random() % remaining + low;

/* 1st pass: look for empty (or shortest) hash chain */
for (i = 0; i < UDP_HTABLE_SIZE; i++) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/inet6_hashtables.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row,
struct inet_timewait_sock *tw = NULL;

inet_get_local_port_range(&low, &high);
remaining = high - low;
remaining = (high - low) + 1;

local_bh_disable();
for (i = 1; i <= remaining; i++) {
Expand Down

0 comments on commit 60df6a5

Please sign in to comment.