diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-10-10 00:42:14 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-12 02:59:48 -0400 |
commit | effee6a00034a8d83a6dea6d221820d87364ac21 (patch) | |
tree | 7008bcfd7f2c2ece8e58365ff970a90292b6af08 /net/core/scm.c | |
parent | 6aa2551cf135f1d246d31482adc8c679eeea3a83 (diff) |
[NET]: File descriptor loss while receiving SCM_RIGHTS
If more than one file descriptor was sent with an SCM_RIGHTS message,
and on the receiving end, after installing a nonzero (but not all)
file descritpors the process runs out of fds, then the already
installed fds will be lost (userspace will have no way of knowing
about them).
The following patch makes sure, that at least the already installed
fds are sent to userspace. It doesn't solve the issue of losing file
descriptors in case of an EFAULT on the userspace buffer.
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/scm.c')
-rw-r--r-- | net/core/scm.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/core/scm.c b/net/core/scm.c index 649d01ef35b6..271cf060ef8c 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -245,8 +245,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) | |||
245 | if (i > 0) | 245 | if (i > 0) |
246 | { | 246 | { |
247 | int cmlen = CMSG_LEN(i*sizeof(int)); | 247 | int cmlen = CMSG_LEN(i*sizeof(int)); |
248 | if (!err) | 248 | err = put_user(SOL_SOCKET, &cm->cmsg_level); |
249 | err = put_user(SOL_SOCKET, &cm->cmsg_level); | ||
250 | if (!err) | 249 | if (!err) |
251 | err = put_user(SCM_RIGHTS, &cm->cmsg_type); | 250 | err = put_user(SCM_RIGHTS, &cm->cmsg_type); |
252 | if (!err) | 251 | if (!err) |