| Submitter | Eric Dumazet |
|---|---|
| Date | March 13, 2012, 4:01 a.m. |
| Message ID | <1331611319.7787.37.camel@edumazet-glaptop> |
| Download | mbox | patch |
| Permalink | /patch/146329/ |
| State | Deferred |
| Delegated to: | David Miller |
| Headers | show |
Comments
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Mon, 12 Mar 2012 21:01:59 -0700 > [PATCH net-next] inet: embed icsk_accept_queue in an union > > icsk_accept_queue is currently used only for LISTEN sockets. We could > share its space with fields used for other kind of inet sockets. > > For active connections, this area is zeroed in socket setup, and for > passive ones, we clear the whole area in inet_csk_clone_lock() to make > sure we dont use content inherited from (listener) parent. > > /* Deinitialize accept_queue to trap illegal accesses. */ > memset(&newicsk->icsk_accept_queue, 0, sizeof(newicsk->icsk_accept_queue)); > > For 100% safety, we could do the same in inet_csk_listen_stop(), or we can > double check that fields added in this union later are only accessed by non > LISTEN sockets. > > All these fields must have a null default value. > > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> > Suggested-by: Tom Herbert <therbert@google.com> We can put this in when something that makes use of the new union is added. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index dbf9aab..d3ccaf9 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -86,7 +86,9 @@ struct inet_connection_sock_af_ops { struct inet_connection_sock { /* inet_sock has to be the first member! */ struct inet_sock icsk_inet; - struct request_sock_queue icsk_accept_queue; + union { + struct request_sock_queue icsk_accept_queue; + }; struct inet_bind_bucket *icsk_bind_hash; unsigned long icsk_timeout; struct timer_list icsk_retransmit_timer;