|
|
4d476f |
autofs-5.1.0 - dont allocate dev_ctl_ops too early
|
|
|
4d476f |
|
|
|
4d476f |
From: Ian Kent <raven@themaw.net>
|
|
|
4d476f |
|
|
|
4d476f |
If the standard io file descriptors have been closed by the cloning
|
|
|
4d476f |
process the file handle for autofs device control can correspond to
|
|
|
4d476f |
a descriptor number of one of the standard io descriptors which will
|
|
|
4d476f |
be closed when the process is daemonized.
|
|
|
4d476f |
|
|
|
4d476f |
Avoid this by closing the device control descriptor opened when
|
|
|
4d476f |
performing sanity checks at startup so that it can be opened
|
|
|
4d476f |
on a higher numbered file descriptor after the process has switched
|
|
|
4d476f |
to daemon mode.
|
|
|
4d476f |
---
|
|
|
4d476f |
CHANGELOG | 1 +
|
|
|
4d476f |
lib/mounts.c | 14 +++++++++++++-
|
|
|
4d476f |
2 files changed, 14 insertions(+), 1 deletion(-)
|
|
|
4d476f |
|
|
|
4d476f |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
4d476f |
+++ autofs-5.0.7/CHANGELOG
|
|
|
4d476f |
@@ -127,6 +127,7 @@
|
|
|
4d476f |
- allow empty value for some map options.
|
|
|
4d476f |
- allow empty value in macro selectors.
|
|
|
4d476f |
- add serialization to sasl init.
|
|
|
4d476f |
+- dont allocate dev_ctl_ops too early.
|
|
|
4d476f |
|
|
|
4d476f |
25/07/2012 autofs-5.0.7
|
|
|
4d476f |
=======================
|
|
|
4d476f |
--- autofs-5.0.7.orig/lib/mounts.c
|
|
|
4d476f |
+++ autofs-5.0.7/lib/mounts.c
|
|
|
4d476f |
@@ -90,7 +90,7 @@ unsigned int linux_version_code(void)
|
|
|
4d476f |
|
|
|
4d476f |
unsigned int query_kproto_ver(void)
|
|
|
4d476f |
{
|
|
|
4d476f |
- struct ioctl_ops *ops = get_ioctl_ops();
|
|
|
4d476f |
+ struct ioctl_ops *ops;
|
|
|
4d476f |
char dir[] = "/tmp/autoXXXXXX", *t_dir;
|
|
|
4d476f |
char options[MAX_OPTIONS_LEN + 1];
|
|
|
4d476f |
pid_t pgrp = getpgrp();
|
|
|
4d476f |
@@ -131,10 +131,19 @@ unsigned int query_kproto_ver(void)
|
|
|
4d476f |
return 0;
|
|
|
4d476f |
}
|
|
|
4d476f |
|
|
|
4d476f |
+ ops = get_ioctl_ops();
|
|
|
4d476f |
+ if (!ops) {
|
|
|
4d476f |
+ umount(t_dir);
|
|
|
4d476f |
+ close(pipefd[0]);
|
|
|
4d476f |
+ rmdir(t_dir);
|
|
|
4d476f |
+ return 0;
|
|
|
4d476f |
+ }
|
|
|
4d476f |
+
|
|
|
4d476f |
ops->open(LOGOPT_NONE, &ioctlfd, st.st_dev, t_dir);
|
|
|
4d476f |
if (ioctlfd == -1) {
|
|
|
4d476f |
umount(t_dir);
|
|
|
4d476f |
close(pipefd[0]);
|
|
|
4d476f |
+ close_ioctl_ctl();
|
|
|
4d476f |
rmdir(t_dir);
|
|
|
4d476f |
return 0;
|
|
|
4d476f |
}
|
|
|
4d476f |
@@ -146,6 +155,7 @@ unsigned int query_kproto_ver(void)
|
|
|
4d476f |
ops->close(LOGOPT_NONE, ioctlfd);
|
|
|
4d476f |
umount(t_dir);
|
|
|
4d476f |
close(pipefd[0]);
|
|
|
4d476f |
+ close_ioctl_ctl();
|
|
|
4d476f |
rmdir(t_dir);
|
|
|
4d476f |
return 0;
|
|
|
4d476f |
}
|
|
|
4d476f |
@@ -155,6 +165,7 @@ unsigned int query_kproto_ver(void)
|
|
|
4d476f |
ops->close(LOGOPT_NONE, ioctlfd);
|
|
|
4d476f |
umount(t_dir);
|
|
|
4d476f |
close(pipefd[0]);
|
|
|
4d476f |
+ close_ioctl_ctl();
|
|
|
4d476f |
rmdir(t_dir);
|
|
|
4d476f |
return 0;
|
|
|
4d476f |
}
|
|
|
4d476f |
@@ -162,6 +173,7 @@ unsigned int query_kproto_ver(void)
|
|
|
4d476f |
ops->close(LOGOPT_NONE, ioctlfd);
|
|
|
4d476f |
umount(t_dir);
|
|
|
4d476f |
close(pipefd[0]);
|
|
|
4d476f |
+ close_ioctl_ctl();
|
|
|
4d476f |
rmdir(t_dir);
|
|
|
4d476f |
|
|
|
4d476f |
return 1;
|