OpenBCM V1.08-5-g2f4a (Linux)

Packet Radio Mailbox

IZ3LSV

[San Dona' di P. JN]

 Login: GUEST





  
VK7AX  > LINHAM   18.06.08 01:26l 86 Lines 2910 Bytes #999 (0) @ WW
BID : VK7AX-1806GA
Read: GUEST
Subj: [PATCH]: Consolidate ax25 socket grafting.
Path: IZ3LSV<IK2XDE<DB0RES<DK0WUE<7M3TJZ<ON0BEL<VK7AX
Sent: 080617/2327Z @:VK7AX.#ULV.TAS.AUS.OC #:47473 [Ulverstone] FBB7.00g $:VK7A
From: VK7AX@VK7AX.#ULV.TAS.AUS.OC
To  : LINHAM@WW


From: David Miller <davem(AT)davemloft.net>
Date: Tue, 17 Jun 2008 02:32:01 -0700 (PDT)
To: netdev(AT)vger.kernel.org
CC: ralf(AT)linux-mips.org, linux-hams(AT)vger.kernel.org


[ For the AX.25 folks: I'm basically walking the tree auditing
  how parent sockets get grafted to child socks and making protocols
  use sock_graft() and sock_orphan() when they are open-coding that
  construct. ]

Applied and pushed to net-next-2.6

ax25: Use sock_graft() and remove bogus sk_socket and sk_sleep init.

The way that listening sockets work in ax25 is that the packet input
code path creates new socks via ax25_make_new() and attaches them
to the incoming SKB.  This SKB gets queued up into the listening
socket's receive queue.

When accept()'d the sock gets hooked up to the real parent socket.
Alternatively, if the listening socket is closed and released, any
unborn socks stuff up in the receive queue get released.

So during this time period these sockets are unreachable in any
other way, so no wakeup events nor references to their ->sk_socket
and ->sk_sleep members can occur.  And even if they do, all such
paths have to make NULL checks.

So do not deceptively initialize them in ax25_make_new() to the
values in the listening socket.  Leave them at NULL.

Finally, use sock_graft() in ax25_accept().

Signed-off-by: David S. Miller <davem(AT)davemloft.net>
---
 net/ax25/af_ax25.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 2712544..97eaa23 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
(AT)(AT) -893,13 +893,11 (AT)(AT) struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
 
 	sk->sk_destruct = ax25_free_sock;
 	sk->sk_type     = osk->sk_type;
-	sk->sk_socket   = osk->sk_socket;
 	sk->sk_priority = osk->sk_priority;
 	sk->sk_protocol = osk->sk_protocol;
 	sk->sk_rcvbuf   = osk->sk_rcvbuf;
 	sk->sk_sndbuf   = osk->sk_sndbuf;
 	sk->sk_state    = TCP_ESTABLISHED;
-	sk->sk_sleep    = osk->sk_sleep;
 	sock_copy_flags(sk, osk);
 
 	oax25 = ax25_sk(osk);
(AT)(AT) -1361,13 +1359,11 (AT)(AT) static int ax25_accept(struct socket *sock, struct socket *newsock, int flags)
 		goto out;
 
 	newsk		 = skb->sk;
-	newsk->sk_socket = newsock;
-	newsk->sk_sleep	 = &newsock->wait;
+	sock_graft(newsk, newsock);
 
 	/* Now attach up the new socket */
 	kfree_skb(skb);
 	sk->sk_ack_backlog--;
-	newsock->sk    = newsk;
 	newsock->state = SS_CONNECTED;
 
 out:
-- 1.5.5.1.308.g1fbb5 -- 

*******************************************************************
 ABOVE IS A CROSS POST TO THE PACKET RADIO NETWORK IN AN EFFORT TO 
 PROMOTE FURTHER INTEREST IN HAM SOFTWARE USING LINUX OPERATING 
 SYSTEMS AND PACKET RADIO
          Courtesy Tony VK7AX  VK7AX(AT)VK7AX.#ULV.TAS.AUS.OC 

*******************************************************************


Read previous mail | Read next mail


 20.10.2024 10:30:49lGo back Go up