diff mbox

[RXRPC] : do not unlock unheld spinlock in rxrpc_connect_exclusive()

Message ID 1386975369-30837-1-git-send-email-khoroshilov@ispras.ru
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Alexey Khoroshilov Dec. 13, 2013, 10:56 p.m. UTC
If rx->conn is not NULL, rxrpc_connect_exclusive() does not
acquire the transport's client lock, but it still releases it.

The patch adds locking of the spinlock to this path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 net/rxrpc/ar-connection.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

David Miller Dec. 17, 2013, 8:16 p.m. UTC | #1
From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Sat, 14 Dec 2013 02:56:09 +0400

> +		_net("CONNECT EXCL old %d on TRANS %d",
> +		     conn->debug_id, conn->trans->debug_id);

Please do not add more of these ad-hoc kernel log tracing entries.

Thanks.
--
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
David Howells Dec. 18, 2013, 4:08 p.m. UTC | #2
Alexey Khoroshilov <khoroshilov@ispras.ru> wrote:

> If rx->conn is not NULL, rxrpc_connect_exclusive() does not
> acquire the transport's client lock, but it still releases it.
> 
> The patch adds locking of the spinlock to this path.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Looks good, thanks!  I've added it to my AFS branch.

David
--
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
David Howells Dec. 18, 2013, 4:10 p.m. UTC | #3
David Miller <davem@davemloft.net> wrote:

> From: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Date: Sat, 14 Dec 2013 02:56:09 +0400
> 
> > +		_net("CONNECT EXCL old %d on TRANS %d",
> > +		     conn->debug_id, conn->trans->debug_id);
> 
> Please do not add more of these ad-hoc kernel log tracing entries.

Why not?  They're useful for debugging and they give me more control than
plain printk().

I presume you want all the debugging statements in net/rxrpc/ changing to
something else - but what?

David
--
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
diff mbox

Patch

diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c
index 4106ca95ec86..4790140a1722 100644
--- a/net/rxrpc/ar-connection.c
+++ b/net/rxrpc/ar-connection.c
@@ -381,6 +381,11 @@  static int rxrpc_connect_exclusive(struct rxrpc_sock *rx,
 
 		rxrpc_assign_connection_id(conn);
 		rx->conn = conn;
+	} else {
+		spin_lock(&trans->client_lock);
+
+		_net("CONNECT EXCL old %d on TRANS %d",
+		     conn->debug_id, conn->trans->debug_id);
 	}
 
 	/* we've got a connection with a free channel and we can now attach the