aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2013-06-28 12:13:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-28 19:29:45 -0400
commitea4c218f2c3e67f1bca8078ff1f80d7e0c2ab791 (patch)
treee32540185bddd3512ed45d5aa3f81de5674d9cd5 /net
parentac294f13d331cb3e315fd922ae505619f853818b (diff)
x25: Fix broken locking in ioctl error paths.
[ Upstream commit 4ccb93ce7439b63c31bc7597bfffd13567fa483d ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '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 37ca9694aabe..22c88d2e6846 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