Skip to content

Commit

Permalink
Fix bug for missing files in /proc/driver/nvidia
Browse files Browse the repository at this point in the history
If one of the files (params, version, registry) in /proc/driver/nvidia
is missing the path for the next file is concatenated on the previous one.

This change ensures that the string storing the path is reset if one of
the files is not found.

Signed-off-by: Evan Lezar <[email protected]>
  • Loading branch information
elezar committed Nov 3, 2021
1 parent fc1b6c4 commit 6a25e88
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/deb/changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
libnvidia-container (1.6.0~rc.2-1) experimental; urgency=medium

-- NVIDIA CORPORATION <[email protected]> Tue, 26 Oct 2021 12:24:22 +0200
* Fix bug that lead to unexected mount error when /proc/driver/nvidia does not exist on the host

-- NVIDIA CORPORATION <[email protected]> Tue, 26 Oct 2021 12:24:22 +0200

libnvidia-container (1.6.0~rc.1-1) experimental; urgency=medium

Expand Down
1 change: 1 addition & 0 deletions pkg/rpm/SPECS/libnvidia-container.spec
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ This package contains command-line tools that facilitate using the library.

%changelog
* Tue Oct 26 2021 NVIDIA CORPORATION <[email protected]> 1.6.0-0.1.rc.2
- Fix bug that lead to unexected mount error when /proc/driver/nvidia does not exist on the host

* Mon Sep 20 2021 NVIDIA CORPORATION <[email protected]> 1.6.0-0.1.rc.1
- Add AARCH64 package for Amazon Linux 2
Expand Down
8 changes: 7 additions & 1 deletion src/nvc_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,14 @@ mount_procfs(struct error *err, const char *root, const struct nvc_container *cn
if (path_append(err, dst, files[i]) < 0)
goto fail;
if (file_mode(err, src, &mode) < 0) {
if (err->code == ENOENT)
if (err->code == ENOENT) {
log_warnf("%s not found; skipping", src);
// We reset the strings to ensure that the paths are
// not concatenated if one of the files is not found.
*src_end = '\0';
*dst_end = '\0';
continue;
}
goto fail;
}
if (file_read_text(err, src, &buf) < 0)
Expand Down

0 comments on commit 6a25e88

Please sign in to comment.