aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/net.h2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/unix/af_unix.c8
3 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/net.h b/include/linux/net.h
index 0c4ae5d94de9..65545ac6fb9c 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -180,7 +180,7 @@ struct proto_ops {
180 int offset, size_t size, int flags); 180 int offset, size_t size, int flags);
181 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, 181 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
182 struct pipe_inode_info *pipe, size_t len, unsigned int flags); 182 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
183 void (*set_peek_off)(struct sock *sk, int val); 183 int (*set_peek_off)(struct sock *sk, int val);
184}; 184};
185 185
186#define DECLARE_SOCKADDR(type, dst, src) \ 186#define DECLARE_SOCKADDR(type, dst, src) \
diff --git a/net/core/sock.c b/net/core/sock.c
index 6565431b0e6d..50a345e5a26f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -885,7 +885,7 @@ set_rcvbuf:
885 885
886 case SO_PEEK_OFF: 886 case SO_PEEK_OFF:
887 if (sock->ops->set_peek_off) 887 if (sock->ops->set_peek_off)
888 sock->ops->set_peek_off(sk, val); 888 ret = sock->ops->set_peek_off(sk, val);
889 else 889 else
890 ret = -EOPNOTSUPP; 890 ret = -EOPNOTSUPP;
891 break; 891 break;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 8664ad0d5797..2ee993c7732a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -529,13 +529,17 @@ static int unix_seqpacket_sendmsg(struct kiocb *, struct socket *,
529static int unix_seqpacket_recvmsg(struct kiocb *, struct socket *, 529static int unix_seqpacket_recvmsg(struct kiocb *, struct socket *,
530 struct msghdr *, size_t, int); 530 struct msghdr *, size_t, int);
531 531
532static void unix_set_peek_off(struct sock *sk, int val) 532static int unix_set_peek_off(struct sock *sk, int val)
533{ 533{
534 struct unix_sock *u = unix_sk(sk); 534 struct unix_sock *u = unix_sk(sk);
535 535
536 mutex_lock(&u->readlock); 536 if (mutex_lock_interruptible(&u->readlock))
537 return -EINTR;
538
537 sk->sk_peek_off = val; 539 sk->sk_peek_off = val;
538 mutex_unlock(&u->readlock); 540 mutex_unlock(&u->readlock);
541
542 return 0;
539} 543}
540 544
541 545