X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fcore%2Fscm.c;h=9adabedaf8ada06665674e5243c16f022e128b2d;hb=f63b2b3204ea962e9cc34a223771ec973694f8bf;hp=ff52ad0a51501c98891401d6e29f18dfab80ade9;hpb=e0d65113a70f1dc514e625cc4e7a7485a4bf72df;p=pandora-kernel.git diff --git a/net/core/scm.c b/net/core/scm.c index ff52ad0a5150..9adabedaf8ad 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -80,6 +80,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) *fplp = fpl; fpl->count = 0; fpl->max = SCM_MAX_FD; + fpl->user = NULL; } fpp = &fpl->fp[fpl->count]; @@ -100,6 +101,10 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) *fpp++ = file; fpl->count++; } + + if (!fpl->user) + fpl->user = get_uid(current_user()); + return num; } @@ -124,6 +129,7 @@ void __scm_destroy(struct scm_cookie *scm) list_del(&fpl->list); for (i=fpl->count-1; i>=0; i--) fput(fpl->fp[i]); + free_uid(fpl->user); kfree(fpl); } @@ -311,6 +317,8 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) err = put_user(cmlen, &cm->cmsg_len); if (!err) { cmlen = CMSG_SPACE(i*sizeof(int)); + if (msg->msg_controllen < cmlen) + cmlen = msg->msg_controllen; msg->msg_control += cmlen; msg->msg_controllen -= cmlen; } @@ -340,6 +348,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) for (i = 0; i < fpl->count; i++) get_file(fpl->fp[i]); new_fpl->max = new_fpl->count; + new_fpl->user = get_uid(fpl->user); } return new_fpl; }