Skip to content

Commit ef84d8c

Browse files
edumazetdavem330
authored andcommitted
Revert "inet: fix double request socket freeing"
This reverts commit c697366. At the time of above commit, tcp_req_err() and dccp_req_err() were dead code, as SYN_RECV request sockets were not yet in ehash table. Real bug was fixed later in a different commit. We need to revert to not leak a refcount on request socket. inet_csk_reqsk_queue_drop_and_put() will be added in following commit to make clean inet_csk_reqsk_queue_drop() does not release the reference owned by caller. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 47ea032 commit ef84d8c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

net/dccp/ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ void dccp_req_err(struct sock *sk, u64 seq)
208208

209209
if (!between48(seq, dccp_rsk(req)->dreq_iss, dccp_rsk(req)->dreq_gss)) {
210210
NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
211-
reqsk_put(req);
212211
} else {
213212
/*
214213
* Still in RESPOND, just remove it silently.
@@ -218,6 +217,7 @@ void dccp_req_err(struct sock *sk, u64 seq)
218217
*/
219218
inet_csk_reqsk_queue_drop(req->rsk_listener, req);
220219
}
220+
reqsk_put(req);
221221
}
222222
EXPORT_SYMBOL(dccp_req_err);
223223

net/ipv4/tcp_ipv4.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,17 @@ void tcp_req_err(struct sock *sk, u32 seq)
324324

325325
if (seq != tcp_rsk(req)->snt_isn) {
326326
NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
327-
reqsk_put(req);
328327
} else {
329328
/*
330329
* Still in SYN_RECV, just remove it silently.
331330
* There is no good way to pass the error to the newly
332331
* created socket, and POSIX does not want network
333332
* errors returned from accept().
334333
*/
335-
NET_INC_STATS_BH(net, LINUX_MIB_LISTENDROPS);
336334
inet_csk_reqsk_queue_drop(req->rsk_listener, req);
335+
NET_INC_STATS_BH(net, LINUX_MIB_LISTENDROPS);
337336
}
337+
reqsk_put(req);
338338
}
339339
EXPORT_SYMBOL(tcp_req_err);
340340

0 commit comments

Comments
 (0)