Bluetooth: Split error handling for SCO listen sockets
Subsystems (2)
Marcel Holtmann
maintainerPATCH 2/3 Bluetooth: Split error handling for SCO listen sockets
Split the checks for sk->sk_state and sk->sk_type for SCO listen sockets. This makes the code more readable.
Signed-off-by Marcel Holtmann <[email protected]>
--- net/bluetooth/sco.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
net/bluetooth/sco.c +6 -1
@@ -540,11 +540,16 @@ static int sco_sock_listen(struct socket *sock, int backlog)lock_sock (sk); -if (sk->sk_state !=BT_BOUND || sock->type !=SOCK_SEQPACKET ) { +if (sk->sk_state !=BT_BOUND ) { err = -EBADFD ; goto done; } +if (sk->sk_type !=SOCK_SEQPACKET ) { + err = -EINVAL ; + goto done; + } + sk->sk_max_ack_backlog = backlog; sk->sk_ack_backlog =0 ; sk->sk_state =BT_LISTEN ;
Signature · 1 line
1.7.7.6
Gustavo Padovan
AppliedHi Marcel,
Quoted 7 lines · Marcel Holtmann
Split the checks for
sk->sk_stateandsk->sk_typefor SCO listen sockets. This makes the code more readable.Signed-off-by Marcel Holtmann <[email protected]>--- net/bluetooth/sco.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
Applied to bluetooth-next, thanks.
Gustavo