]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[IrDA]: Correctly handling socket error
authorOlaf Kirch <olaf.kirch@oracle.com>
Thu, 19 Apr 2007 23:45:09 +0000 (01:45 +0200)
committerAdrian Bunk <bunk@stusta.de>
Thu, 19 Apr 2007 23:45:09 +0000 (01:45 +0200)
This patch fixes an oops first reported in mid 2006 - see
http://lkml.org/lkml/2006/8/29/358 The cause of this bug report is that
when an error is signalled on the socket, irda_recvmsg_stream returns
without removing a local wait_queue variable from the socket's sk_sleep
queue. This causes havoc further down the road.

In response to this problem, a patch was made that invoked sock_orphan on
the socket when receiving a disconnect indication. This is not a good fix,
as this sets sk_sleep to NULL, causing applications sleeping in recvmsg
(and other places) to oops.

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/irda/af_irda.c

index 759445648667a8e178a6b6481e8021ab73e73ca7..f74b936ce8bf7b6d07021281cf9ead8a7bf0e5c2 100644 (file)
@@ -138,7 +138,6 @@ static void irda_disconnect_indication(void *instance, void *sap,
                sk->sk_shutdown |= SEND_SHUTDOWN;
 
                sk->sk_state_change(sk);
-               /* Uh-oh... Should use sock_orphan ? */
                 sock_set_flag(sk, SOCK_DEAD);
 
                /* Close our TSAP.
@@ -1441,7 +1440,7 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock,
                         */
                        ret = sock_error(sk);
                        if (ret)
-                               break;
+                               ;
                        else if (sk->sk_shutdown & RCV_SHUTDOWN)
                                ;
                        else if (noblock)