]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/socket.c
cpufreq: CPPC: Don't set transition_latency
[mirror_ubuntu-bionic-kernel.git] / net / socket.c
index 05f361faec451cdd69168dd5e2cd7c2ca7c8f7fb..f2957aa205e6cfb36d2d216a86a8f537c6ae0548 100644 (file)
@@ -436,8 +436,10 @@ static int sock_map_fd(struct socket *sock, int flags)
 {
        struct file *newfile;
        int fd = get_unused_fd_flags(flags);
-       if (unlikely(fd < 0))
+       if (unlikely(fd < 0)) {
+               sock_release(sock);
                return fd;
+       }
 
        newfile = sock_alloc_file(sock, flags, NULL);
        if (likely(!IS_ERR(newfile))) {
@@ -542,7 +544,10 @@ static int sockfs_setattr(struct dentry *dentry, struct iattr *iattr)
        if (!err && (iattr->ia_valid & ATTR_UID)) {
                struct socket *sock = SOCKET_I(d_inode(dentry));
 
-               sock->sk->sk_uid = iattr->ia_uid;
+               if (sock->sk)
+                       sock->sk->sk_uid = iattr->ia_uid;
+               else
+                       err = -ENOENT;
        }
 
        return err;
@@ -592,12 +597,16 @@ EXPORT_SYMBOL(sock_alloc);
  *     an inode not a file.
  */
 
-void sock_release(struct socket *sock)
+static void __sock_release(struct socket *sock, struct inode *inode)
 {
        if (sock->ops) {
                struct module *owner = sock->ops->owner;
 
+               if (inode)
+                       inode_lock(inode);
                sock->ops->release(sock);
+               if (inode)
+                       inode_unlock(inode);
                sock->ops = NULL;
                module_put(owner);
        }
@@ -612,6 +621,11 @@ void sock_release(struct socket *sock)
        }
        sock->file = NULL;
 }
+
+void sock_release(struct socket *sock)
+{
+       __sock_release(sock, NULL);
+}
 EXPORT_SYMBOL(sock_release);
 
 void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags)
@@ -1126,7 +1140,7 @@ static int sock_mmap(struct file *file, struct vm_area_struct *vma)
 
 static int sock_close(struct inode *inode, struct file *filp)
 {
-       sock_release(SOCKET_I(inode));
+       __sock_release(SOCKET_I(inode), inode);
        return 0;
 }
 
@@ -2619,6 +2633,15 @@ out_fs:
 
 core_initcall(sock_init);      /* early initcall */
 
+static int __init jit_init(void)
+{
+#ifdef CONFIG_BPF_JIT_ALWAYS_ON
+       bpf_jit_enable = 1;
+#endif
+       return 0;
+}
+pure_initcall(jit_init);
+
 #ifdef CONFIG_PROC_FS
 void socket_seq_show(struct seq_file *seq)
 {