diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-02-20 13:38:11 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-02-20 13:38:11 +0000 |
commit | c208b1a04f934b1102480a3a974f937927cb6c45 (patch) | |
tree | f5e4e3251335dfd94f064dfba851150d6613d894 /sys/security/audit | |
parent | 6d90d77c6f1443f51d62e743e3602792500d9d57 (diff) | |
download | FreeBSD-src-c208b1a04f934b1102480a3a974f937927cb6c45.zip FreeBSD-src-c208b1a04f934b1102480a3a974f937927cb6c45.tar.gz |
Update auditing of socket information for the inpcb new world order:
so_pcb will always be non-NULL, and lock the inpcb while non-atomically
accessing address data.
Diffstat (limited to 'sys/security/audit')
-rw-r--r-- | sys/security/audit/audit_arg.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/security/audit/audit_arg.c b/sys/security/audit/audit_arg.c index 7ec68a1..5147e29d 100644 --- a/sys/security/audit/audit_arg.c +++ b/sys/security/audit/audit_arg.c @@ -617,19 +617,17 @@ audit_arg_file(struct proc *p, struct file *fp) case DTYPE_SOCKET: so = (struct socket *)fp->f_data; - SOCK_LOCK(so); if (INP_CHECK_SOCKAF(so, PF_INET)) { - if (so->so_pcb == NULL) { - SOCK_UNLOCK(so); - return; - } + SOCK_LOCK(so); ar->k_ar.ar_arg_sockinfo.so_type = so->so_type; ar->k_ar.ar_arg_sockinfo.so_domain = INP_SOCKAF(so); ar->k_ar.ar_arg_sockinfo.so_protocol = so->so_proto->pr_protocol; + SOCK_UNLOCK(so); pcb = (struct inpcb *)so->so_pcb; + INP_LOCK(pcb); ar->k_ar.ar_arg_sockinfo.so_raddr = pcb->inp_faddr.s_addr; ar->k_ar.ar_arg_sockinfo.so_laddr = @@ -638,9 +636,9 @@ audit_arg_file(struct proc *p, struct file *fp) pcb->inp_fport; ar->k_ar.ar_arg_sockinfo.so_lport = pcb->inp_lport; + INP_UNLOCK(pcb); ARG_SET_VALID(ar, ARG_SOCKINFO); } - SOCK_UNLOCK(so); break; default: |