public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rfcomm/sock.c: rfcomm_sock_sendmsg() does not return error on a connection faulure
@ 2008-12-18 14:48 Victor Shcherbatyuk
  2008-12-19  7:00 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Victor Shcherbatyuk @ 2008-12-18 14:48 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

Hi,

We noticed a problem, when a connection from the remote device is
dropper the write() function does not return the error in the user
space, returning 0 instead - indicating that 0 bytes are sent. We've
also noticed that with some older kernels it used to work (2.6.13 vs
2.6.23-17). The patch fixes the problem.

Regards,
    Victor.

[-- Attachment #2: sock.c.patch --]
[-- Type: application/octet-stream, Size: 461 bytes --]

--- a/net/bluetooth/rfcomm/sock.c	2008-12-18 15:20:15.000000000 +0100
+++ b/net/bluetooth/rfcomm/sock.c	2008-12-18 15:18:00.000000000 +0100
@@ -575,8 +575,11 @@
 
 		skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE,
 				msg->msg_flags & MSG_DONTWAIT, &err);
-		if (!skb)
+		if (!skb) {
+			if (sent == 0)
+				sent = err;
 			break;
+		}
 		skb_reserve(skb, RFCOMM_SKB_HEAD_RESERVE);
 
 		err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);

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

* Re: [PATCH] rfcomm/sock.c: rfcomm_sock_sendmsg() does not return error on a connection faulure
  2008-12-18 14:48 [PATCH] rfcomm/sock.c: rfcomm_sock_sendmsg() does not return error on a connection faulure Victor Shcherbatyuk
@ 2008-12-19  7:00 ` Marcel Holtmann
  2008-12-19 13:04   ` Victor Shcherbatyuk
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2008-12-19  7:00 UTC (permalink / raw)
  To: Victor Shcherbatyuk; +Cc: linux-bluetooth

Hi Victor,

> We noticed a problem, when a connection from the remote device is
> dropper the write() function does not return the error in the user
> space, returning 0 instead - indicating that 0 bytes are sent. We've
> also noticed that with some older kernels it used to work (2.6.13 vs
> 2.6.23-17). The patch fixes the problem.

that is a bug and your patch looks good. However can you use
git-format-patch and sent it again with proper Signed-off-by line for me
to apply.

Regards

Marcel



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

* RE: [PATCH] rfcomm/sock.c: rfcomm_sock_sendmsg() does not return error on a connection faulure
  2008-12-19  7:00 ` Marcel Holtmann
@ 2008-12-19 13:04   ` Victor Shcherbatyuk
  0 siblings, 0 replies; 3+ messages in thread
From: Victor Shcherbatyuk @ 2008-12-19 13:04 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

Hi Marcel,

Is this ok?

Regards,
   Victor.

-----Original Message-----
From: Marcel Holtmann [mailto:marcel@holtmann.org] 
Sent: Friday, December 19, 2008 8:01 AM
To: Victor Shcherbatyuk
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] rfcomm/sock.c: rfcomm_sock_sendmsg() does not
return error on a connection faulure

Hi Victor,

> We noticed a problem, when a connection from the remote device is
> dropper the write() function does not return the error in the user
> space, returning 0 instead - indicating that 0 bytes are sent. We've
> also noticed that with some older kernels it used to work (2.6.13 vs
> 2.6.23-17). The patch fixes the problem.

that is a bug and your patch looks good. However can you use
git-format-patch and sent it again with proper Signed-off-by line for me
to apply.

Regards

Marcel



[-- Attachment #2: 0001-Fixed-rfcomm_sock_sendmsg-to-return-an-error-on-th.patch --]
[-- Type: application/octet-stream, Size: 1000 bytes --]

From 7abbaf127fd62f5bd3b2a7fc02b5253bac299b40 Mon Sep 17 00:00:00 2001
From: Victor Shcherbatyuk <Victor.Shcherbatyuk@tomtom.com>
Date: Fri, 19 Dec 2008 13:56:58 +0100
Subject: [PATCH] Fixed rfcomm_sock_sendmsg() to return an error on the connection failure


Signed-off-by: Victor Shcherbatyuk <Victor.Shcherbatyuk@tomtom.com>
---
 net/bluetooth/rfcomm/sock.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 8a972b6..99e65af 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -575,8 +575,11 @@ static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
 
 		skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE,
 				msg->msg_flags & MSG_DONTWAIT, &err);
-		if (!skb)
+		if (!skb) {
+			if (sent == 0)
+				sent = err;
 			break;
+		}
 		skb_reserve(skb, RFCOMM_SKB_HEAD_RESERVE);
 
 		err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
-- 
1.5.4.3


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

end of thread, other threads:[~2008-12-19 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-18 14:48 [PATCH] rfcomm/sock.c: rfcomm_sock_sendmsg() does not return error on a connection faulure Victor Shcherbatyuk
2008-12-19  7:00 ` Marcel Holtmann
2008-12-19 13:04   ` Victor Shcherbatyuk

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