aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorCedric Hombourger <chombourger@gmail.com>2009-04-25 03:38:21 -0400
committerSam Ravnborg <sam@ravnborg.org>2009-05-01 04:54:03 -0400
commit99e3a1eb3c22bb671c6f3d22d8244bfc9fad8185 (patch)
tree9ef6d2953c553538732e0e9a4f444957422e2b53 /scripts/mod/modpost.c
parent64e3da109404eed27f825ee3eb1fe465ded47979 (diff)
kbuild: fix Module.markers permission error under cygwin
While building the kernel, we end-up calling modpost with -K and -M options for the same file (Modules.markers). This is resulting in modpost's main function calling read_markers() and then write_markers() on the same file. We then have read_markers() mmap'ing the file, and writer_markers() opening that same file for writing. The issue is that read_markers() exits without munmap'ing the file and is as a matter holding a reference on Modules.markers. When write_markers() is opening that very same file for writing, we still have a reference on it and cygwin (Windows?) is then making fopen() fail with EPERM. Calling release_file() before exiting read_markers() clears that reference (and memory leak) and fopen() then succeeds. Tested on both cygwin (1.3.22) and Linux. Also ran modpost within valgrind on Linux to make sure that the munmap'ed file was not accessed after read_markers() Signed-off-by: Cedric Hombourger <chombourger@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 8d46ea7d6715..57d71a5f31b6 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1990,6 +1990,7 @@ static void read_markers(const char *fname)
1990 if (!mod->skip) 1990 if (!mod->skip)
1991 add_marker(mod, marker, fmt); 1991 add_marker(mod, marker, fmt);
1992 } 1992 }
1993 release_file(file, size);
1993 return; 1994 return;
1994fail: 1995fail:
1995 fatal("parse error in markers list file\n"); 1996 fatal("parse error in markers list file\n");