1 | From f14a14eea03ef4e500c8f6fb03cd695d41d4a542 Mon Sep 17 00:00:00 2001 |
---|
2 | From: Oliver Pinter <oliver.pinter@hardenedbsd.org> |
---|
3 | Date: Sat, 17 Dec 2016 20:04:20 +0100 |
---|
4 | Subject: [PATCH] smartmontools: fix panic on INVARIANTS enabled kernel after |
---|
5 | r308351 in base |
---|
6 | |
---|
7 | After r308351 commit the INVARIANTS enabled kernel gets too "eager" when |
---|
8 | checking the cam ccb flags. But the real problem was not the previous, but |
---|
9 | the smartmontools does not zeroed out the ccb on stack, and pass this |
---|
10 | dirty ccb to kernel, which is catched by an ASSERT. So fix this by filling |
---|
11 | up with 0 this ccb. This commit is similar, what's happen in r307684 |
---|
12 | in camcontrol. So this is the same followup patch in smartmontools. |
---|
13 | |
---|
14 | https://svnweb.freebsd.org/base?view=revision&revision=307684 |
---|
15 | https://svnweb.freebsd.org/base?view=revision&revision=308351 |
---|
16 | |
---|
17 | Sponsored-by: opBSD |
---|
18 | --- |
---|
19 | sysutils/smartmontools/files/patch-os__freebsd.cpp | 11 +++++++++++ |
---|
20 | 1 file changed, 11 insertions(+) |
---|
21 | create mode 100644 sysutils/smartmontools/files/patch-os__freebsd.cpp |
---|
22 | |
---|
23 | diff --git a/sysutils/smartmontools/files/patch-os__freebsd.cpp b/sysutils/smartmontools/files/patch-os__freebsd.cpp |
---|
24 | new file mode 100644 |
---|
25 | index 0000000..8a11cb5 |
---|
26 | --- /dev/null |
---|
27 | +++ b/sysutils/smartmontools/files/patch-os__freebsd.cpp |
---|
28 | @@ -0,0 +1,11 @@ |
---|
29 | +--- os_freebsd.cpp.orig 2016-12-17 18:42:22 UTC |
---|
30 | ++++ os_freebsd.cpp |
---|
31 | +@@ -1936,6 +1936,8 @@ smart_device * freebsd_smart_interface:: |
---|
32 | + int i; |
---|
33 | + const char * test_name = name; |
---|
34 | + |
---|
35 | ++ memset(&ccb, 0, sizeof(ccb)); |
---|
36 | ++ |
---|
37 | + // if dev_name null, or string length zero |
---|
38 | + if (!name || !*name) |
---|
39 | + return 0; |
---|
40 | -- |
---|
41 | 2.10.2 |
---|
42 | |
---|