mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive()
@ 2013-12-13 22:56 Alexey Khoroshilov
  2013-12-17 20:16 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexey Khoroshilov @ 2013-12-13 22:56 UTC (permalink / raw)
  To: David S. Miller, David Howells; +Cc: Alexey Khoroshilov, netdev, linux-kernel

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(+)

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
-- 
1.8.3.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive()
  2013-12-13 22:56 [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive() Alexey Khoroshilov
@ 2013-12-17 20:16 ` David Miller
  2013-12-18 16:08 ` David Howells
  2013-12-18 16:10 ` David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-12-17 20:16 UTC (permalink / raw)
  To: khoroshilov; +Cc: dhowells, netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive()
  2013-12-13 22:56 [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive() Alexey Khoroshilov
  2013-12-17 20:16 ` David Miller
@ 2013-12-18 16:08 ` David Howells
  2013-12-18 16:10 ` David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2013-12-18 16:08 UTC (permalink / raw)
  To: Alexey Khoroshilov; +Cc: dhowells, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive()
  2013-12-13 22:56 [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive() Alexey Khoroshilov
  2013-12-17 20:16 ` David Miller
  2013-12-18 16:08 ` David Howells
@ 2013-12-18 16:10 ` David Howells
  2 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2013-12-18 16:10 UTC (permalink / raw)
  To: netdev; +Cc: dhowells, khoroshilov, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-18 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-13 22:56 [PATCH] [RXRPC]: do not unlock unheld spinlock in rxrpc_connect_exclusive() Alexey Khoroshilov
2013-12-17 20:16 ` David Miller
2013-12-18 16:08 ` David Howells
2013-12-18 16:10 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®