diff options
author | Brian Wood <brian.j.wood@intel.com> | 2017-02-27 16:58:40 -0800 |
---|---|---|
committer | Brian Wood <brian.j.wood@intel.com> | 2017-02-28 15:35:14 -0800 |
commit | b7147432cf0d58533bd21fe594d0be1d153f91a6 (patch) | |
tree | aec042cd9c91432c09285381c5d5af85072975c9 /net/unix/garbage.c | |
parent | ce7cfcfa1251122880d34fae7259309b64a78434 (diff) | |
parent | ec55e7c2bf49a426b6f8204505bd267c77554d37 (diff) | |
download | edison-v3.10-fb423a5ef3c2f2222ea1562eb9accb78e4e53e6a.tar.gz |
Merge remote-tracking branch 'remotes/origin/brillo/linux-3.10.y' into Brillo-20170221-3.10_kernelandroid-n-iot-preview-4n-iot-preview-4
Conflicts:
crypto/blkcipher.c
drivers/platform/x86/intel_scu_ipcutil.c
drivers/usb/gadget/u_ether.c
fs/ext4/extents.c
net/bluetooth/sco.c
net/wireless/scan.c
Change-Id: Iaea6d22acb3da6b0477d71cf546858d35295e3d2
Diffstat (limited to 'net/unix/garbage.c')
-rw-r--r-- | net/unix/garbage.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 9bc73f87f64..a72182d6750 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -122,12 +122,15 @@ struct sock *unix_get_socket(struct file *filp) * descriptor if it is for an AF_UNIX socket. */ -void unix_inflight(struct file *fp) +void unix_inflight(struct user_struct *user, struct file *fp) { struct sock *s = unix_get_socket(fp); + + spin_lock(&unix_gc_lock); + if (s) { struct unix_sock *u = unix_sk(s); - spin_lock(&unix_gc_lock); + if (atomic_long_inc_return(&u->inflight) == 1) { BUG_ON(!list_empty(&u->link)); list_add_tail(&u->link, &gc_inflight_list); @@ -135,22 +138,27 @@ void unix_inflight(struct file *fp) BUG_ON(list_empty(&u->link)); } unix_tot_inflight++; - spin_unlock(&unix_gc_lock); } + user->unix_inflight++; + spin_unlock(&unix_gc_lock); } -void unix_notinflight(struct file *fp) +void unix_notinflight(struct user_struct *user, struct file *fp) { struct sock *s = unix_get_socket(fp); + + spin_lock(&unix_gc_lock); + if (s) { struct unix_sock *u = unix_sk(s); - spin_lock(&unix_gc_lock); + BUG_ON(list_empty(&u->link)); if (atomic_long_dec_and_test(&u->inflight)) list_del_init(&u->link); unix_tot_inflight--; - spin_unlock(&unix_gc_lock); } + user->unix_inflight--; + spin_unlock(&unix_gc_lock); } static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), |