Skip to content

Commit 53ccdc7

Browse files
Rémi Denis-Courmontgregkh
authored andcommitted
phonet/pep: refuse to enable an unbound pipe
commit 75a2f31 upstream. This ioctl() implicitly assumed that the socket was already bound to a valid local socket name, i.e. Phonet object. If the socket was not bound, two separate problems would occur: 1) We'd send an pipe enablement request with an invalid source object. 2) Later socket calls could BUG on the socket unexpectedly being connected yet not bound to a valid object. Reported-by: [email protected] Signed-off-by: Rémi Denis-Courmont <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3cb5ae7 commit 53ccdc7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/phonet/pep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,8 @@ static int pep_ioctl(struct sock *sk, int cmd, unsigned long arg)
946946
ret = -EBUSY;
947947
else if (sk->sk_state == TCP_ESTABLISHED)
948948
ret = -EISCONN;
949+
else if (!pn->pn_sk.sobject)
950+
ret = -EADDRNOTAVAIL;
949951
else
950952
ret = pep_sock_enable(sk, NULL, 0);
951953
release_sock(sk);

0 commit comments

Comments
 (0)