summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2017-09-19 09:34:46 -0700
committerAaron Plattner <aplattner@nvidia.com>2017-09-19 09:34:46 -0700
commit03051f61b2614a2ef294dc96277eb6d92b84c0f6 (patch)
treec212875fc18a5624bf9e07829c03b674653fb076
parent98b72cbcfa8f10f82d64a70cc831768b367e248e (diff)
340.101340.101
-rw-r--r--kernel.c35
-rw-r--r--nvidia-installer.h1
-rw-r--r--version.mk2
3 files changed, 27 insertions, 11 deletions
diff --git a/kernel.c b/kernel.c
index 16aff2b..8c17fc8 100644
--- a/kernel.c
+++ b/kernel.c
@@ -1667,6 +1667,10 @@ static int modprobe_helper(Options *op, const char *module_name,
char *cmd, *data;
int ret, old_loglevel, loglevel_set;
+ if (op->skip_module_load) {
+ return TRUE;
+ }
+
cmd = nvstrcat(op->utils[MODPROBE],
quiet ? " -q" : "",
unload ? " -r" : "",
@@ -1977,7 +1981,7 @@ PrecompiledInfo *find_precompiled_kernel_interface(Options *op, Package *p)
/*
* get_kernel_name() - get the kernel name: this is either what
- * the user specified via the --kernel-name option, or `name -r`.
+ * the user specified via the --kernel-name option, or `uname -r`.
*/
char __kernel_name[256];
@@ -1986,18 +1990,29 @@ char *get_kernel_name(Options *op)
{
struct utsname uname_buf;
- if (op->kernel_name) {
- return op->kernel_name;
+ __kernel_name[0] = '\0';
+
+ if (uname(&uname_buf) == -1) {
+ ui_warn(op, "Unable to determine the version of the running kernel "
+ "(%s).", strerror(errno));
} else {
- if (uname(&uname_buf) == -1) {
- ui_warn(op, "Unable to determine kernel version (%s).",
- strerror(errno));
- return NULL;
- } else {
- strncpy(__kernel_name, uname_buf.release, 256);
- return __kernel_name;
+ strncpy(__kernel_name, uname_buf.release, sizeof(__kernel_name));
+ __kernel_name[sizeof(__kernel_name) - 1] = '\0';
+ }
+
+ if (op->kernel_name) {
+ if (strcmp(op->kernel_name, __kernel_name) != 0) {
+ /* Don't load kernel modules built against a non-running kernel */
+ op->skip_module_load = TRUE;
}
+ return op->kernel_name;
}
+
+ if (__kernel_name[0]) {
+ return __kernel_name;
+ }
+
+ return NULL;
} /* get_kernel_name() */
diff --git a/nvidia-installer.h b/nvidia-installer.h
index b1edacf..502dd42 100644
--- a/nvidia-installer.h
+++ b/nvidia-installer.h
@@ -168,6 +168,7 @@ typedef struct __options {
int install_uvm;
int uvm_files_packaged;
int x_files_packaged;
+ int skip_module_load;
NVOptionalBool install_vdpau_wrapper;
diff --git a/version.mk b/version.mk
index b77a6a6..e8d1aa4 100644
--- a/version.mk
+++ b/version.mk
@@ -1 +1 @@
-NVIDIA_VERSION = 340.98
+NVIDIA_VERSION = 340.101