From: samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Olaf Kirch <olaf.kirch-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH 2/7] [IrDA] af_irda: Silence kernel message in irda_recvmsg_stream
Date: Thu, 19 Apr 2007 00:32:04 +0300 [thread overview]
Message-ID: <20070418214750.515230054@sortiz.org> (raw)
In-Reply-To: 20070418213202.214829666@sortiz.org
[-- Attachment #1: 0003-IrDA-net-2.6.22-af_irda-Silence-kernel-message.patch --]
[-- Type: text/plain, Size: 2888 bytes --]
From: Olaf Kirch <olaf.kirch-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
This patch silences an IRDA_ASSERT in irda_recvmsg_stream, as described in
http://bugzilla.kernel.org/show_bug.cgi?id=7512 irda_disconnect_indication
would set sk->sk_err to ECONNRESET, and a subsequent call to recvmsg
would print an irritating kernel message and return -1.
When a connected socket is closed by the peer, recvmsg should return 0
rather than an error. This patch fixes this.
Signed-off-by: Olaf Kirch <olaf.kirch-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
---
net/irda/af_irda.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
Index: net-2.6.22-quilt/net/irda/af_irda.c
===================================================================
--- net-2.6.22-quilt.orig/net/irda/af_irda.c 2007-04-18 02:10:56.000000000 +0300
+++ net-2.6.22-quilt/net/irda/af_irda.c 2007-04-18 02:14:24.000000000 +0300
@@ -131,15 +131,13 @@
}
/* Prevent race conditions with irda_release() and irda_shutdown() */
+ bh_lock_sock(sk);
if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) {
- lock_sock(sk);
sk->sk_state = TCP_CLOSE;
- sk->sk_err = ECONNRESET;
sk->sk_shutdown |= SEND_SHUTDOWN;
sk->sk_state_change(sk);
sock_orphan(sk);
- release_sock(sk);
/* Close our TSAP.
* If we leave it open, IrLMP put it back into the list of
@@ -159,6 +157,7 @@
self->tsap = NULL;
}
}
+ bh_unlock_sock(sk);
/* Note : once we are there, there is not much you want to do
* with the socket anymore, apart from closing it.
@@ -1062,7 +1061,8 @@
if (sk->sk_state != TCP_ESTABLISHED) {
sock->state = SS_UNCONNECTED;
- return sock_error(sk); /* Always set at this point */
+ err = sock_error(sk);
+ return err? err : -ECONNRESET;
}
sock->state = SS_CONNECTED;
@@ -1356,7 +1356,9 @@
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
IRDA_ASSERT(self != NULL, return -1;);
- IRDA_ASSERT(!sock_error(sk), return -1;);
+
+ if ((err = sock_error(sk)) < 0)
+ return err;
skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
flags & MSG_DONTWAIT, &err);
@@ -1403,13 +1405,15 @@
struct irda_sock *self = irda_sk(sk);
int noblock = flags & MSG_DONTWAIT;
size_t copied = 0;
- int target;
+ int target, err;
long timeo;
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
IRDA_ASSERT(self != NULL, return -1;);
- IRDA_ASSERT(!sock_error(sk), return -1;);
+
+ if ((err = sock_error(sk)) < 0)
+ return err;
if (sock->flags & __SO_ACCEPTCON)
return(-EINVAL);
--
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
next prev parent reply other threads:[~2007-04-18 21:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-18 21:32 [PATCH 0/7] [IrDA] net-2.6.22 fixes samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-18 21:32 ` [PATCH 1/7] [IrDA] af_irda: irda_recvmsg_stream cleanup samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:05 ` David Miller
2007-04-18 21:32 ` samuel-jcdQHdrhKHMdnm+yROfE0A [this message]
2007-04-21 5:09 ` [PATCH 2/7] [IrDA] af_irda: Silence kernel message in irda_recvmsg_stream David Miller
[not found] ` <20070420.220900.45154094.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-04-21 12:01 ` Samuel Ortiz
[not found] ` <20070421120152.GB4337-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-04-21 17:43 ` David Miller
2007-04-18 21:32 ` [PATCH 3/7] [IrDA] af_irda: irda_accept cleanup samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:09 ` David Miller
2007-04-18 21:32 ` [PATCH 4/7] [IrDA] af_irda: IRDA_ASSERT cleanups samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:10 ` David Miller
2007-04-18 21:32 ` [PATCH 5/7] [IrDA] IrDA monitor mode samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:11 ` David Miller
[not found] ` <20070420.221143.132446079.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-04-21 11:42 ` Samuel Ortiz
[not found] ` <20070421114239.GA4337-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-04-21 17:46 ` David Miller
2007-04-22 11:29 ` [irda-users] " Samuel Ortiz
2007-04-22 19:59 ` David Miller
2007-04-18 21:32 ` [PATCH 6/7] [IrDA] Adding carriage returns to mcs7780 debug statements samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:12 ` David Miller
2007-04-18 21:32 ` [PATCH 7/7] [IrDA] Misc spelling corrections samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:13 ` 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=20070418214750.515230054@sortiz.org \
--to=samuel-jcdqhdrhkhmdnm+yrofe0a@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=olaf.kirch-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).