aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/af_unix.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index ecad42b72ad6..eacddb21a9b4 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2018,7 +2018,7 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl
2018 2018
2019#ifdef CONFIG_PROC_FS 2019#ifdef CONFIG_PROC_FS
2020struct unix_iter_state { 2020struct unix_iter_state {
2021 struct net *net; 2021 struct seq_net_private p;
2022 int i; 2022 int i;
2023}; 2023};
2024static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos) 2024static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos)
@@ -2027,7 +2027,7 @@ static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos)
2027 struct sock *s; 2027 struct sock *s;
2028 2028
2029 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) { 2029 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
2030 if (s->sk_net != iter->net) 2030 if (s->sk_net != iter->p.net)
2031 continue; 2031 continue;
2032 if (off == pos) 2032 if (off == pos)
2033 return s; 2033 return s;
@@ -2054,7 +2054,7 @@ static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2054 sk = first_unix_socket(&iter->i); 2054 sk = first_unix_socket(&iter->i);
2055 else 2055 else
2056 sk = next_unix_socket(&iter->i, sk); 2056 sk = next_unix_socket(&iter->i, sk);
2057 while (sk && (sk->sk_net != iter->net)) 2057 while (sk && (sk->sk_net != iter->p.net))
2058 sk = next_unix_socket(&iter->i, sk); 2058 sk = next_unix_socket(&iter->i, sk);
2059 return sk; 2059 return sk;
2060} 2060}
@@ -2118,27 +2118,8 @@ static const struct seq_operations unix_seq_ops = {
2118 2118
2119static int unix_seq_open(struct inode *inode, struct file *file) 2119static int unix_seq_open(struct inode *inode, struct file *file)
2120{ 2120{
2121 struct unix_iter_state *it; 2121 return seq_open_net(inode, file, &unix_seq_ops,
2122 2122 sizeof(struct unix_iter_state));
2123 it = __seq_open_private(file, &unix_seq_ops,
2124 sizeof(struct unix_iter_state));
2125 if (it == NULL)
2126 return -ENOMEM;
2127
2128 it->net = get_proc_net(inode);
2129 if (it->net == NULL) {
2130 seq_release_private(inode, file);
2131 return -ENXIO;
2132 }
2133 return 0;
2134}
2135
2136static int unix_seq_release(struct inode *inode, struct file *file)
2137{
2138 struct seq_file *seq = file->private_data;
2139 struct unix_iter_state *iter = seq->private;
2140 put_net(iter->net);
2141 return seq_release_private(inode, file);
2142} 2123}
2143 2124
2144static const struct file_operations unix_seq_fops = { 2125static const struct file_operations unix_seq_fops = {
@@ -2146,7 +2127,7 @@ static const struct file_operations unix_seq_fops = {
2146 .open = unix_seq_open, 2127 .open = unix_seq_open,
2147 .read = seq_read, 2128 .read = seq_read,
2148 .llseek = seq_lseek, 2129 .llseek = seq_lseek,
2149 .release = unix_seq_release, 2130 .release = seq_release_net,
2150}; 2131};
2151 2132
2152#endif 2133#endif