public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC v0] Bluetooth: Fix lost socket error code
@ 2012-06-19 14:20 Mikel Astiz
  2012-06-29 13:24 ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Mikel Astiz @ 2012-06-19 14:20 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

Using sock_error() here to check the status of the socket is wrong
because it resets sk->sk_err to zero. For RFCOMM sockets, this means the
disconnect reason is not exposed to userland in the socket options.

Signed-off-by: Mikel Astiz <mikel.astiz@bmw-carit.de>
---
This a second attempt to expose ACL disconnect reason to userland, as proposed first in "[RFC v0] Bluetooth: mgmt: Add device disconnect reason".

The motivation behind was explained in the userspace patchset "[RFC BlueZ v0 0/5] ACL disconnect reason".

This second approach focuses on RFCOMM sockets given that L2CAP is already exposing such information.

 net/bluetooth/af_bluetooth.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index f7db579..4799338 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -313,7 +313,7 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
 			if (copied >= target)
 				break;
 
-			err = sock_error(sk);
+			err = sk->sk_err;
 			if (err)
 				break;
 			if (sk->sk_shutdown & RCV_SHUTDOWN)
-- 
1.7.7.6


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

end of thread, other threads:[~2012-07-03 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-19 14:20 [RFC v0] Bluetooth: Fix lost socket error code Mikel Astiz
2012-06-29 13:24 ` Johan Hedberg
2012-07-03  7:44   ` Mikel Astiz
2012-07-03  8:18     ` Johan Hedberg
2012-07-03 13:42     ` Mike
2012-07-03 15:46       ` Mikel Astiz

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