diff options
author | jmg <jmg@FreeBSD.org> | 2004-08-20 04:15:30 +0000 |
---|---|---|
committer | jmg <jmg@FreeBSD.org> | 2004-08-20 04:15:30 +0000 |
commit | b0492852c808023760154a3f6546baa90dd59540 (patch) | |
tree | 8e40df10b81e2d3c02a4f8be7d5833ef77331acc /sys | |
parent | fe9f220a60f1f7aff5b43db98748277f5d22754d (diff) | |
download | FreeBSD-src-b0492852c808023760154a3f6546baa90dd59540.zip FreeBSD-src-b0492852c808023760154a3f6546baa90dd59540.tar.gz |
make sure that the socket is either accepting connections or is connected
when attaching a knote to it... otherwise return EINVAL...
Pointed out by: benno
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_socket.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 9b6c423..dc20608 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2136,8 +2136,10 @@ soo_kqfilter(struct file *fp, struct knote *kn) case EVFILT_READ: if (so->so_options & SO_ACCEPTCONN) kn->kn_fop = &solisten_filtops; - else + else if (so->so_state & SS_ISCONNECTED) kn->kn_fop = &soread_filtops; + else + return (EINVAL); sb = &so->so_rcv; break; case EVFILT_WRITE: |