diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/core/pktgen.c | 42 | ||||
| -rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 2 | ||||
| -rw-r--r-- | net/irda/ircomm/ircomm_tty_attach.c | 6 | ||||
| -rw-r--r-- | net/netfilter/nf_conntrack_core.c | 4 | ||||
| -rw-r--r-- | net/sched/sch_choke.c | 2 | ||||
| -rw-r--r-- | net/sctp/associola.c | 16 | ||||
| -rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 | ||||
| -rw-r--r-- | net/sunrpc/cache.c | 1 |
8 files changed, 29 insertions, 48 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 6048fc1da1c2..5c217427a669 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
| @@ -2198,7 +2198,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev) | |||
| 2198 | pkt_dev->curfl = 0; /*reset */ | 2198 | pkt_dev->curfl = 0; /*reset */ |
| 2199 | } | 2199 | } |
| 2200 | } else { | 2200 | } else { |
| 2201 | flow = random32() % pkt_dev->cflows; | 2201 | flow = prandom_u32() % pkt_dev->cflows; |
| 2202 | pkt_dev->curfl = flow; | 2202 | pkt_dev->curfl = flow; |
| 2203 | 2203 | ||
| 2204 | if (pkt_dev->flows[flow].count > pkt_dev->lflow) { | 2204 | if (pkt_dev->flows[flow].count > pkt_dev->lflow) { |
| @@ -2246,7 +2246,7 @@ static void set_cur_queue_map(struct pktgen_dev *pkt_dev) | |||
| 2246 | else if (pkt_dev->queue_map_min <= pkt_dev->queue_map_max) { | 2246 | else if (pkt_dev->queue_map_min <= pkt_dev->queue_map_max) { |
| 2247 | __u16 t; | 2247 | __u16 t; |
| 2248 | if (pkt_dev->flags & F_QUEUE_MAP_RND) { | 2248 | if (pkt_dev->flags & F_QUEUE_MAP_RND) { |
| 2249 | t = random32() % | 2249 | t = prandom_u32() % |
| 2250 | (pkt_dev->queue_map_max - | 2250 | (pkt_dev->queue_map_max - |
| 2251 | pkt_dev->queue_map_min + 1) | 2251 | pkt_dev->queue_map_min + 1) |
| 2252 | + pkt_dev->queue_map_min; | 2252 | + pkt_dev->queue_map_min; |
| @@ -2278,7 +2278,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2278 | __u32 tmp; | 2278 | __u32 tmp; |
| 2279 | 2279 | ||
| 2280 | if (pkt_dev->flags & F_MACSRC_RND) | 2280 | if (pkt_dev->flags & F_MACSRC_RND) |
| 2281 | mc = random32() % pkt_dev->src_mac_count; | 2281 | mc = prandom_u32() % pkt_dev->src_mac_count; |
| 2282 | else { | 2282 | else { |
| 2283 | mc = pkt_dev->cur_src_mac_offset++; | 2283 | mc = pkt_dev->cur_src_mac_offset++; |
| 2284 | if (pkt_dev->cur_src_mac_offset >= | 2284 | if (pkt_dev->cur_src_mac_offset >= |
| @@ -2304,7 +2304,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2304 | __u32 tmp; | 2304 | __u32 tmp; |
| 2305 | 2305 | ||
| 2306 | if (pkt_dev->flags & F_MACDST_RND) | 2306 | if (pkt_dev->flags & F_MACDST_RND) |
| 2307 | mc = random32() % pkt_dev->dst_mac_count; | 2307 | mc = prandom_u32() % pkt_dev->dst_mac_count; |
| 2308 | 2308 | ||
| 2309 | else { | 2309 | else { |
| 2310 | mc = pkt_dev->cur_dst_mac_offset++; | 2310 | mc = pkt_dev->cur_dst_mac_offset++; |
| @@ -2331,21 +2331,21 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2331 | for (i = 0; i < pkt_dev->nr_labels; i++) | 2331 | for (i = 0; i < pkt_dev->nr_labels; i++) |
| 2332 | if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM) | 2332 | if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM) |
| 2333 | pkt_dev->labels[i] = MPLS_STACK_BOTTOM | | 2333 | pkt_dev->labels[i] = MPLS_STACK_BOTTOM | |
| 2334 | ((__force __be32)random32() & | 2334 | ((__force __be32)prandom_u32() & |
| 2335 | htonl(0x000fffff)); | 2335 | htonl(0x000fffff)); |
| 2336 | } | 2336 | } |
| 2337 | 2337 | ||
| 2338 | if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0xffff)) { | 2338 | if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0xffff)) { |
| 2339 | pkt_dev->vlan_id = random32() & (4096-1); | 2339 | pkt_dev->vlan_id = prandom_u32() & (4096 - 1); |
| 2340 | } | 2340 | } |
| 2341 | 2341 | ||
| 2342 | if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0xffff)) { | 2342 | if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0xffff)) { |
| 2343 | pkt_dev->svlan_id = random32() & (4096 - 1); | 2343 | pkt_dev->svlan_id = prandom_u32() & (4096 - 1); |
| 2344 | } | 2344 | } |
| 2345 | 2345 | ||
| 2346 | if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) { | 2346 | if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) { |
| 2347 | if (pkt_dev->flags & F_UDPSRC_RND) | 2347 | if (pkt_dev->flags & F_UDPSRC_RND) |
| 2348 | pkt_dev->cur_udp_src = random32() % | 2348 | pkt_dev->cur_udp_src = prandom_u32() % |
| 2349 | (pkt_dev->udp_src_max - pkt_dev->udp_src_min) | 2349 | (pkt_dev->udp_src_max - pkt_dev->udp_src_min) |
| 2350 | + pkt_dev->udp_src_min; | 2350 | + pkt_dev->udp_src_min; |
| 2351 | 2351 | ||
| @@ -2358,7 +2358,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2358 | 2358 | ||
| 2359 | if (pkt_dev->udp_dst_min < pkt_dev->udp_dst_max) { | 2359 | if (pkt_dev->udp_dst_min < pkt_dev->udp_dst_max) { |
| 2360 | if (pkt_dev->flags & F_UDPDST_RND) { | 2360 | if (pkt_dev->flags & F_UDPDST_RND) { |
| 2361 | pkt_dev->cur_udp_dst = random32() % | 2361 | pkt_dev->cur_udp_dst = prandom_u32() % |
| 2362 | (pkt_dev->udp_dst_max - pkt_dev->udp_dst_min) | 2362 | (pkt_dev->udp_dst_max - pkt_dev->udp_dst_min) |
| 2363 | + pkt_dev->udp_dst_min; | 2363 | + pkt_dev->udp_dst_min; |
| 2364 | } else { | 2364 | } else { |
| @@ -2375,7 +2375,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2375 | if (imn < imx) { | 2375 | if (imn < imx) { |
| 2376 | __u32 t; | 2376 | __u32 t; |
| 2377 | if (pkt_dev->flags & F_IPSRC_RND) | 2377 | if (pkt_dev->flags & F_IPSRC_RND) |
| 2378 | t = random32() % (imx - imn) + imn; | 2378 | t = prandom_u32() % (imx - imn) + imn; |
| 2379 | else { | 2379 | else { |
| 2380 | t = ntohl(pkt_dev->cur_saddr); | 2380 | t = ntohl(pkt_dev->cur_saddr); |
| 2381 | t++; | 2381 | t++; |
| @@ -2396,17 +2396,15 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2396 | __be32 s; | 2396 | __be32 s; |
| 2397 | if (pkt_dev->flags & F_IPDST_RND) { | 2397 | if (pkt_dev->flags & F_IPDST_RND) { |
| 2398 | 2398 | ||
| 2399 | t = random32() % (imx - imn) + imn; | 2399 | do { |
| 2400 | s = htonl(t); | 2400 | t = prandom_u32() % |
| 2401 | 2401 | (imx - imn) + imn; | |
| 2402 | while (ipv4_is_loopback(s) || | ||
| 2403 | ipv4_is_multicast(s) || | ||
| 2404 | ipv4_is_lbcast(s) || | ||
| 2405 | ipv4_is_zeronet(s) || | ||
| 2406 | ipv4_is_local_multicast(s)) { | ||
| 2407 | t = random32() % (imx - imn) + imn; | ||
| 2408 | s = htonl(t); | 2402 | s = htonl(t); |
| 2409 | } | 2403 | } while (ipv4_is_loopback(s) || |
| 2404 | ipv4_is_multicast(s) || | ||
| 2405 | ipv4_is_lbcast(s) || | ||
| 2406 | ipv4_is_zeronet(s) || | ||
| 2407 | ipv4_is_local_multicast(s)); | ||
| 2410 | pkt_dev->cur_daddr = s; | 2408 | pkt_dev->cur_daddr = s; |
| 2411 | } else { | 2409 | } else { |
| 2412 | t = ntohl(pkt_dev->cur_daddr); | 2410 | t = ntohl(pkt_dev->cur_daddr); |
| @@ -2437,7 +2435,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2437 | 2435 | ||
| 2438 | for (i = 0; i < 4; i++) { | 2436 | for (i = 0; i < 4; i++) { |
| 2439 | pkt_dev->cur_in6_daddr.s6_addr32[i] = | 2437 | pkt_dev->cur_in6_daddr.s6_addr32[i] = |
| 2440 | (((__force __be32)random32() | | 2438 | (((__force __be32)prandom_u32() | |
| 2441 | pkt_dev->min_in6_daddr.s6_addr32[i]) & | 2439 | pkt_dev->min_in6_daddr.s6_addr32[i]) & |
| 2442 | pkt_dev->max_in6_daddr.s6_addr32[i]); | 2440 | pkt_dev->max_in6_daddr.s6_addr32[i]); |
| 2443 | } | 2441 | } |
| @@ -2447,7 +2445,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
| 2447 | if (pkt_dev->min_pkt_size < pkt_dev->max_pkt_size) { | 2445 | if (pkt_dev->min_pkt_size < pkt_dev->max_pkt_size) { |
| 2448 | __u32 t; | 2446 | __u32 t; |
| 2449 | if (pkt_dev->flags & F_TXSIZE_RND) { | 2447 | if (pkt_dev->flags & F_TXSIZE_RND) { |
| 2450 | t = random32() % | 2448 | t = prandom_u32() % |
| 2451 | (pkt_dev->max_pkt_size - pkt_dev->min_pkt_size) | 2449 | (pkt_dev->max_pkt_size - pkt_dev->min_pkt_size) |
| 2452 | + pkt_dev->min_pkt_size; | 2450 | + pkt_dev->min_pkt_size; |
| 2453 | } else { | 2451 | } else { |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 362ba47968e4..41ac7938268b 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
| @@ -328,7 +328,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
| 328 | spin_unlock_irqrestore(&port->lock, flags); | 328 | spin_unlock_irqrestore(&port->lock, flags); |
| 329 | 329 | ||
| 330 | while (1) { | 330 | while (1) { |
| 331 | if (tty->termios.c_cflag & CBAUD) | 331 | if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags)) |
| 332 | tty_port_raise_dtr_rts(port); | 332 | tty_port_raise_dtr_rts(port); |
| 333 | 333 | ||
| 334 | set_current_state(TASK_INTERRUPTIBLE); | 334 | set_current_state(TASK_INTERRUPTIBLE); |
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c index edab393e0c82..a2a508f5f268 100644 --- a/net/irda/ircomm/ircomm_tty_attach.c +++ b/net/irda/ircomm/ircomm_tty_attach.c | |||
| @@ -997,12 +997,8 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, | |||
| 997 | self->settings.dce = IRCOMM_DELTA_CD; | 997 | self->settings.dce = IRCOMM_DELTA_CD; |
| 998 | ircomm_tty_check_modem_status(self); | 998 | ircomm_tty_check_modem_status(self); |
| 999 | } else { | 999 | } else { |
| 1000 | struct tty_struct *tty = tty_port_tty_get(&self->port); | ||
| 1001 | IRDA_DEBUG(0, "%s(), hanging up!\n", __func__ ); | 1000 | IRDA_DEBUG(0, "%s(), hanging up!\n", __func__ ); |
| 1002 | if (tty) { | 1001 | tty_port_tty_hangup(&self->port, false); |
| 1003 | tty_hangup(tty); | ||
| 1004 | tty_kref_put(tty); | ||
| 1005 | } | ||
| 1006 | } | 1002 | } |
| 1007 | break; | 1003 | break; |
| 1008 | default: | 1004 | default: |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index c8e001a9c45b..f84965af4a4e 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -264,7 +264,7 @@ static void death_by_event(unsigned long ul_conntrack) | |||
| 264 | if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) { | 264 | if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) { |
| 265 | /* bad luck, let's retry again */ | 265 | /* bad luck, let's retry again */ |
| 266 | ecache->timeout.expires = jiffies + | 266 | ecache->timeout.expires = jiffies + |
| 267 | (random32() % net->ct.sysctl_events_retry_timeout); | 267 | (prandom_u32() % net->ct.sysctl_events_retry_timeout); |
| 268 | add_timer(&ecache->timeout); | 268 | add_timer(&ecache->timeout); |
| 269 | return; | 269 | return; |
| 270 | } | 270 | } |
| @@ -283,7 +283,7 @@ void nf_ct_dying_timeout(struct nf_conn *ct) | |||
| 283 | /* set a new timer to retry event delivery */ | 283 | /* set a new timer to retry event delivery */ |
| 284 | setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct); | 284 | setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct); |
| 285 | ecache->timeout.expires = jiffies + | 285 | ecache->timeout.expires = jiffies + |
| 286 | (random32() % net->ct.sysctl_events_retry_timeout); | 286 | (prandom_u32() % net->ct.sysctl_events_retry_timeout); |
| 287 | add_timer(&ecache->timeout); | 287 | add_timer(&ecache->timeout); |
| 288 | } | 288 | } |
| 289 | EXPORT_SYMBOL_GPL(nf_ct_dying_timeout); | 289 | EXPORT_SYMBOL_GPL(nf_ct_dying_timeout); |
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index cc37dd52ecf9..ef53ab8d0aae 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
| @@ -80,7 +80,7 @@ struct choke_sched_data { | |||
| 80 | /* deliver a random number between 0 and N - 1 */ | 80 | /* deliver a random number between 0 and N - 1 */ |
| 81 | static u32 random_N(unsigned int N) | 81 | static u32 random_N(unsigned int N) |
| 82 | { | 82 | { |
| 83 | return reciprocal_divide(random32(), N); | 83 | return reciprocal_divide(prandom_u32(), N); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | /* number of elements in queue including holes */ | 86 | /* number of elements in queue including holes */ |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index d2709e2b7be6..fa261a3594c2 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
| @@ -66,13 +66,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work); | |||
| 66 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc); | 66 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc); |
| 67 | static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc); | 67 | static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc); |
| 68 | 68 | ||
| 69 | /* Keep track of the new idr low so that we don't re-use association id | ||
| 70 | * numbers too fast. It is protected by they idr spin lock is in the | ||
| 71 | * range of 1 - INT_MAX. | ||
| 72 | */ | ||
| 73 | static u32 idr_low = 1; | ||
| 74 | |||
| 75 | |||
| 76 | /* 1st Level Abstractions. */ | 69 | /* 1st Level Abstractions. */ |
| 77 | 70 | ||
| 78 | /* Initialize a new association from provided memory. */ | 71 | /* Initialize a new association from provided memory. */ |
| @@ -1601,13 +1594,8 @@ int sctp_assoc_set_id(struct sctp_association *asoc, gfp_t gfp) | |||
| 1601 | if (preload) | 1594 | if (preload) |
| 1602 | idr_preload(gfp); | 1595 | idr_preload(gfp); |
| 1603 | spin_lock_bh(&sctp_assocs_id_lock); | 1596 | spin_lock_bh(&sctp_assocs_id_lock); |
| 1604 | /* 0 is not a valid id, idr_low is always >= 1 */ | 1597 | /* 0 is not a valid assoc_id, must be >= 1 */ |
| 1605 | ret = idr_alloc(&sctp_assocs_id, asoc, idr_low, 0, GFP_NOWAIT); | 1598 | ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, 1, 0, GFP_NOWAIT); |
| 1606 | if (ret >= 0) { | ||
| 1607 | idr_low = ret + 1; | ||
| 1608 | if (idr_low == INT_MAX) | ||
| 1609 | idr_low = 1; | ||
| 1610 | } | ||
| 1611 | spin_unlock_bh(&sctp_assocs_id_lock); | 1599 | spin_unlock_bh(&sctp_assocs_id_lock); |
| 1612 | if (preload) | 1600 | if (preload) |
| 1613 | idr_preload_end(); | 1601 | idr_preload_end(); |
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c index 88edec929d73..1da52d1406fc 100644 --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c | |||
| @@ -130,8 +130,8 @@ gss_krb5_make_confounder(char *p, u32 conflen) | |||
| 130 | 130 | ||
| 131 | /* initialize to random value */ | 131 | /* initialize to random value */ |
| 132 | if (i == 0) { | 132 | if (i == 0) { |
| 133 | i = random32(); | 133 | i = prandom_u32(); |
| 134 | i = (i << 32) | random32(); | 134 | i = (i << 32) | prandom_u32(); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | switch (conflen) { | 137 | switch (conflen) { |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 25d58e766014..ce2d180d05a4 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
| @@ -1208,7 +1208,6 @@ EXPORT_SYMBOL_GPL(sunrpc_cache_pipe_upcall); | |||
| 1208 | * key and content are both parsed by cache | 1208 | * key and content are both parsed by cache |
| 1209 | */ | 1209 | */ |
| 1210 | 1210 | ||
| 1211 | #define isodigit(c) (isdigit(c) && c <= '7') | ||
| 1212 | int qword_get(char **bpp, char *dest, int bufsize) | 1211 | int qword_get(char **bpp, char *dest, int bufsize) |
| 1213 | { | 1212 | { |
| 1214 | /* return bytes copied, or -1 on error */ | 1213 | /* return bytes copied, or -1 on error */ |
