diff options
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 03ee4d359f6a..94f658235fb4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2064,6 +2064,11 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) | |||
2064 | goto out; | 2064 | goto out; |
2065 | } | 2065 | } |
2066 | 2066 | ||
2067 | if (flags & MSG_PEEK) | ||
2068 | skip = sk_peek_offset(sk, flags); | ||
2069 | else | ||
2070 | skip = 0; | ||
2071 | |||
2067 | do { | 2072 | do { |
2068 | int chunk; | 2073 | int chunk; |
2069 | struct sk_buff *skb, *last; | 2074 | struct sk_buff *skb, *last; |
@@ -2112,7 +2117,6 @@ unlock: | |||
2112 | break; | 2117 | break; |
2113 | } | 2118 | } |
2114 | 2119 | ||
2115 | skip = sk_peek_offset(sk, flags); | ||
2116 | while (skip >= unix_skb_len(skb)) { | 2120 | while (skip >= unix_skb_len(skb)) { |
2117 | skip -= unix_skb_len(skb); | 2121 | skip -= unix_skb_len(skb); |
2118 | last = skb; | 2122 | last = skb; |
@@ -2181,6 +2185,17 @@ unlock: | |||
2181 | 2185 | ||
2182 | sk_peek_offset_fwd(sk, chunk); | 2186 | sk_peek_offset_fwd(sk, chunk); |
2183 | 2187 | ||
2188 | if (UNIXCB(skb).fp) | ||
2189 | break; | ||
2190 | |||
2191 | skip = 0; | ||
2192 | last = skb; | ||
2193 | last_len = skb->len; | ||
2194 | unix_state_lock(sk); | ||
2195 | skb = skb_peek_next(skb, &sk->sk_receive_queue); | ||
2196 | if (skb) | ||
2197 | goto again; | ||
2198 | unix_state_unlock(sk); | ||
2184 | break; | 2199 | break; |
2185 | } | 2200 | } |
2186 | } while (size); | 2201 | } while (size); |