Skip to content

Commit

Permalink
[IrDA]: Correctly handling socket error
Browse files Browse the repository at this point in the history
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.

This is against the latest net-2.6 and should be considered for -stable
inclusion. 

Signed-off-by: Olaf Kirch <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Olaf Kirch authored and davem330 committed Apr 18, 2007
1 parent d0cf0d9 commit bfb6709
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/irda/af_irda.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ static void irda_disconnect_indication(void *instance, void *sap,
sk->sk_shutdown |= SEND_SHUTDOWN;

sk->sk_state_change(sk);
sock_orphan(sk);
release_sock(sk);

/* Close our TSAP.
Expand Down Expand Up @@ -1446,7 +1445,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)
Expand Down

0 comments on commit bfb6709

Please sign in to comment.