aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2013-06-28 12:13:52 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-01 21:15:25 -0400
commit4ccb93ce7439b63c31bc7597bfffd13567fa483d (patch)
tree77194fb01868c4a63e34a3b957d9b55f745be9e2
parentaec0a40a6f78843c0ce73f7398230ee5184f896d (diff)
x25: Fix broken locking in ioctl error paths.
Two of the x25 ioctl cases have error paths that break out of the function without unlocking the socket, leading to this warning: ================================================ [ BUG: lock held when returning to user space! ] 3.10.0-rc7+ #36 Not tainted ------------------------------------------------ trinity-child2/31407 is leaving the kernel with locks still held! 1 lock held by trinity-child2/31407: #0: (sk_lock-AF_X25){+.+.+.}, at: [<ffffffffa024b6da>] x25_ioctl+0x8a/0x740 [x25] Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/x25/af_x25.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 1d964e23853f..45a3ab5612c1 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -1583,11 +1583,11 @@ out_cud_release:
1583 case SIOCX25CALLACCPTAPPRV: { 1583 case SIOCX25CALLACCPTAPPRV: {
1584 rc = -EINVAL; 1584 rc = -EINVAL;
1585 lock_sock(sk); 1585 lock_sock(sk);
1586 if (sk->sk_state != TCP_CLOSE) 1586 if (sk->sk_state == TCP_CLOSE) {
1587 break; 1587 clear_bit(X25_ACCPT_APPRV_FLAG, &x25->flags);
1588 clear_bit(X25_ACCPT_APPRV_FLAG, &x25->flags); 1588 rc = 0;
1589 }
1589 release_sock(sk); 1590 release_sock(sk);
1590 rc = 0;
1591 break; 1591 break;
1592 } 1592 }
1593 1593
@@ -1595,14 +1595,15 @@ out_cud_release:
1595 rc = -EINVAL; 1595 rc = -EINVAL;
1596 lock_sock(sk); 1596 lock_sock(sk);
1597 if (sk->sk_state != TCP_ESTABLISHED) 1597 if (sk->sk_state != TCP_ESTABLISHED)
1598 break; 1598 goto out_sendcallaccpt_release;
1599 /* must call accptapprv above */ 1599 /* must call accptapprv above */
1600 if (test_bit(X25_ACCPT_APPRV_FLAG, &x25->flags)) 1600 if (test_bit(X25_ACCPT_APPRV_FLAG, &x25->flags))
1601 break; 1601 goto out_sendcallaccpt_release;
1602 x25_write_internal(sk, X25_CALL_ACCEPTED); 1602 x25_write_internal(sk, X25_CALL_ACCEPTED);
1603 x25->state = X25_STATE_3; 1603 x25->state = X25_STATE_3;
1604 release_sock(sk);
1605 rc = 0; 1604 rc = 0;
1605out_sendcallaccpt_release:
1606 release_sock(sk);
1606 break; 1607 break;
1607 } 1608 }
1608 1609