All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Bernard Pidoux <bpidoux@free.fr>,
	Ralf Baechle DL5RB <ralf@linux-mips.org>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: [ROSE/AX25] af_rose: rose_release() fix
Date: Wed, 2 Apr 2008 06:41:07 +0000	[thread overview]
Message-ID: <20080402064107.GA3975@ff.dom.local> (raw)
In-Reply-To: <47F29CEE.10307@free.fr>

On Tue, Apr 01, 2008 at 10:37:02PM +0200, Bernard Pidoux wrote:
...
> Three Linux boxes have been are running for more than 24 hours now with  
> only patch #5. They handled a lot of AX25 connections with no problems.
>
> Thus, we can reasonably expect that things are going to stay stable.
>
> If you want to commit patch#5 I will sustain it very much.
>
> I hope that it will be accepted quickly in order to make a coherent  
> system with AX25 patches already applied or not yet applied (if any).
>
> Thank you very much Jarek for this very nice job.

The same to you Bernard!


David & Ralf:

Here I resend the testing patch #5 from this thread: (the only change
- it's against current netdev tree, so 1 line offset added).

Thanks,
Jarek P.

-------------------->

Subject: [ROSE/AX25] af_rose: rose_release() fix

rose_release() doesn't release sockets properly, e.g. it skips
sock_orphan(), so OOPSes are triggered in sock_def_write_space(),
which was observed especially while ROSE skbs were kfreed from
ax25_frames_acked(). There is also sock_hold() and lock_sock()
added - similarly to ax25_release(). Thanks to Bernard Pidoux for
substantial help in debugging this problem.


Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Reported-and-tested-by: Bernard Pidoux <bpidoux@free.fr>
Cc: Ralf Baechle DL5RB <ralf@linux-mips.org>

---

 net/rose/af_rose.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 92d85c3..d1ff3f8 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -598,17 +598,24 @@ static int rose_release(struct socket *sock)
 
 	if (sk == NULL) return 0;
 
+	sock_hold(sk);
+	sock_orphan(sk);
+	lock_sock(sk);
 	rose = rose_sk(sk);
 
 	switch (rose->state) {
 	case ROSE_STATE_0:
+		release_sock(sk);
 		rose_disconnect(sk, 0, -1, -1);
+		lock_sock(sk);
 		rose_destroy_socket(sk);
 		break;
 
 	case ROSE_STATE_2:
 		rose->neighbour->use--;
+		release_sock(sk);
 		rose_disconnect(sk, 0, -1, -1);
+		lock_sock(sk);
 		rose_destroy_socket(sk);
 		break;
 
@@ -633,6 +640,8 @@ static int rose_release(struct socket *sock)
 	}
 
 	sock->sk = NULL;
+	release_sock(sk);
+	sock_put(sk);
 
 	return 0;
 }

  reply	other threads:[~2008-04-02  6:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-18 10:44 [AX25] kernel panic Bernard Pidoux F6BVP
2008-03-18 21:25 ` Francois Romieu
2008-03-19  7:36   ` Bernard Pidoux F6BVP
2008-03-19 20:57     ` Bernard Pidoux
2008-03-20  7:30       ` Jarek Poplawski
2008-03-20 22:58         ` Bernard Pidoux
2008-03-21  0:28           ` Jarek Poplawski
2008-03-21  9:52             ` Bernard Pidoux
2008-03-21 11:22               ` Jarek Poplawski
2008-03-21  9:40           ` Bernard Pidoux
2008-03-22 11:36           ` Jarek Poplawski
2008-03-23 17:00             ` Bernard Pidoux
2008-03-24 20:51               ` Jarek Poplawski
2008-03-25 13:23                 ` Bernard Pidoux
2008-03-25 20:51                   ` Jarek Poplawski
2008-03-26 18:35                   ` Jarek Poplawski
2008-03-28  8:24                     ` Bernard Pidoux
2008-03-28  8:27                     ` Bernard Pidoux
2008-03-28 12:07                     ` Jarek Poplawski
2008-03-29 12:04                       ` Bernard Pidoux
2008-03-29 12:24                         ` Jarek Poplawski
2008-03-30  8:43                           ` Bernard Pidoux
2008-03-30  9:16                             ` Jarek Poplawski
2008-03-30 17:38                               ` Bernard Pidoux
2008-03-30 18:49                                 ` Jarek Poplawski
2008-03-30  9:00                           ` Bernard Pidoux
     [not found]                           ` <47EE38BA.9090500@free.fr>
     [not found]                             ` <20080329130451.GC3407@ami.dom.local>
     [not found]                               ` <47EF6479.7030702@free.fr>
     [not found]                                 ` <20080330115958.GA4975@ami.dom.local>
2008-04-01 20:37                                   ` Bernard Pidoux
2008-04-02  6:41                                     ` Jarek Poplawski [this message]
2008-04-02  6:56                                       ` [ROSE/AX25] af_rose: rose_release() fix David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080402064107.GA3975@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=bpidoux@free.fr \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.