Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277502
b: refs/heads/master
c: e56c57d
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 8, 2011
1 parent 08bdb45 commit 0f64b3b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 14 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: 9ecd04bc04af7df98b3a93c571e31b6ef6a90681
refs/heads/master: e56c57d0d3fdbbdf583d3af96bfb803b8dfa713e
6 changes: 3 additions & 3 deletions trunk/include/net/inet_connection_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ static inline void *inet_csk_ca(const struct sock *sk)
return (void *)inet_csk(sk)->icsk_ca_priv;
}

extern struct sock *inet_csk_clone(struct sock *sk,
const struct request_sock *req,
const gfp_t priority);
extern struct sock *inet_csk_clone_lock(const struct sock *sk,
const struct request_sock *req,
const gfp_t priority);

enum inet_csk_ack_state_t {
ICSK_ACK_SCHED = 1,
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -1089,8 +1089,8 @@ extern struct sock *sk_alloc(struct net *net, int family,
struct proto *prot);
extern void sk_free(struct sock *sk);
extern void sk_release_kernel(struct sock *sk);
extern struct sock *sk_clone(const struct sock *sk,
const gfp_t priority);
extern struct sock *sk_clone_lock(const struct sock *sk,
const gfp_t priority);

extern struct sk_buff *sock_wmalloc(struct sock *sk,
unsigned long size, int force,
Expand Down
11 changes: 9 additions & 2 deletions trunk/net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,14 @@ void sk_release_kernel(struct sock *sk)
}
EXPORT_SYMBOL(sk_release_kernel);

struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
/**
* sk_clone_lock - clone a socket, and lock its clone
* @sk: the socket to clone
* @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc)
*
* Caller must unlock socket even in error path (bh_unlock_sock(newsk))
*/
struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
{
struct sock *newsk;

Expand Down Expand Up @@ -1297,7 +1304,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
out:
return newsk;
}
EXPORT_SYMBOL_GPL(sk_clone);
EXPORT_SYMBOL_GPL(sk_clone_lock);

void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/dccp/minisocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
* (* Generate a new socket and switch to that socket *)
* Set S := new socket for this port pair
*/
struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
struct sock *newsk = inet_csk_clone_lock(sk, req, GFP_ATOMIC);

if (newsk != NULL) {
struct dccp_request_sock *dreq = dccp_rsk(req);
Expand Down
17 changes: 13 additions & 4 deletions trunk/net/ipv4/inet_connection_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,19 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
}
EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune);

struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req,
const gfp_t priority)
/**
* inet_csk_clone_lock - clone an inet socket, and lock its clone
* @sk: the socket to clone
* @req: request_sock
* @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc)
*
* Caller must unlock socket even in error path (bh_unlock_sock(newsk))
*/
struct sock *inet_csk_clone_lock(const struct sock *sk,
const struct request_sock *req,
const gfp_t priority)
{
struct sock *newsk = sk_clone(sk, priority);
struct sock *newsk = sk_clone_lock(sk, priority);

if (newsk != NULL) {
struct inet_connection_sock *newicsk = inet_csk(newsk);
Expand All @@ -615,7 +624,7 @@ struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req,
}
return newsk;
}
EXPORT_SYMBOL_GPL(inet_csk_clone);
EXPORT_SYMBOL_GPL(inet_csk_clone_lock);

/*
* At this point, there should be no process reference to this
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/tcp_minisocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static inline void TCP_ECN_openreq_child(struct tcp_sock *tp,
*/
struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, struct sk_buff *skb)
{
struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
struct sock *newsk = inet_csk_clone_lock(sk, req, GFP_ATOMIC);

if (newsk != NULL) {
const struct inet_request_sock *ireq = inet_rsk(req);
Expand Down

0 comments on commit 0f64b3b

Please sign in to comment.