Skip to content

Commit 91a9e4e

Browse files
committed
sctp: propagate cap rights on sctp_peeloff
PR: 201052 Reviewed by: oshogbo, tuexen Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46884
1 parent e4550c9 commit 91a9e4e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sys/netinet/sctp_syscalls.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ sys_sctp_peeloff(struct thread *td, struct sctp_peeloff_args *uap)
141141
{
142142
struct file *headfp, *nfp = NULL;
143143
struct socket *head, *so;
144+
struct filecaps fcaps;
144145
cap_rights_t rights;
145146
u_int fflag;
146147
int error, fd;
147148

148149
AUDIT_ARG_FD(uap->sd);
149-
error = getsock(td, uap->sd, cap_rights_init_one(&rights, CAP_PEELOFF),
150-
&headfp);
150+
error = getsock_cap(td, uap->sd,
151+
cap_rights_init_one(&rights, CAP_PEELOFF), &headfp, &fcaps);
151152
if (error != 0)
152153
goto done2;
153154
fflag = atomic_load_int(&headfp->f_flag);
@@ -165,7 +166,7 @@ sys_sctp_peeloff(struct thread *td, struct sctp_peeloff_args *uap)
165166
* but that is ok.
166167
*/
167168

168-
error = falloc(td, &nfp, &fd, 0);
169+
error = falloc_caps(td, &nfp, &fd, 0, &fcaps);
169170
if (error != 0)
170171
goto done;
171172
td->td_retval[0] = fd;

0 commit comments

Comments
 (0)