X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=net%2Fcore%2Frequest_sock.c;h=7552495aff7aef090d99654312d5365afa421e95;hb=1730554f253deb65fe5112c54b2f898d5318a328;hp=5f0818d815e6b700408f2dcea1986b87fdc09645;hpb=463e7c7cf9aaf95dd05e97e1a47854fdf5454cdc;p=linux-2.6 diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 5f0818d815..7552495aff 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c @@ -69,7 +69,38 @@ int reqsk_queue_alloc(struct request_sock_queue *queue, return 0; } -EXPORT_SYMBOL(reqsk_queue_alloc); +void __reqsk_queue_destroy(struct request_sock_queue *queue) +{ + struct listen_sock *lopt; + size_t lopt_size; + + /* + * this is an error recovery path only + * no locking needed and the lopt is not NULL + */ + + lopt = queue->listen_opt; + lopt_size = sizeof(struct listen_sock) + + lopt->nr_table_entries * sizeof(struct request_sock *); + + if (lopt_size > PAGE_SIZE) + vfree(lopt); + else + kfree(lopt); +} + +static inline struct listen_sock *reqsk_queue_yank_listen_sk( + struct request_sock_queue *queue) +{ + struct listen_sock *lopt; + + write_lock_bh(&queue->syn_wait_lock); + lopt = queue->listen_opt; + queue->listen_opt = NULL; + write_unlock_bh(&queue->syn_wait_lock); + + return lopt; +} void reqsk_queue_destroy(struct request_sock_queue *queue) { @@ -92,11 +123,10 @@ void reqsk_queue_destroy(struct request_sock_queue *queue) } } - BUG_TRAP(lopt->qlen == 0); + WARN_ON(lopt->qlen != 0); if (lopt_size > PAGE_SIZE) vfree(lopt); else kfree(lopt); } -EXPORT_SYMBOL(reqsk_queue_destroy);