[PATCH 2/2] modprobe: exit early when kmod_load_resources fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously, modprobe would exit silently and status 0 when the module
indicies went missing, such as in the case of replacing your currently
running kernel without rebooting. This is easily confused with success,
since modprobe is normally quiet about its work. Catch the failure from
kmod_load_resources and notify the user.

This requires adding builtin files to the modprobe test subdirectories
to ensure that tests continue to pass.
---
 .../lib/modules/3.5.4-1-ARCH/modules.builtin.bin         | Bin 0 -> 5115 bytes
 .../lib/modules/4.4.4/modules.builtin.bin                | Bin 0 -> 5115 bytes
 .../show-depends/lib/modules/4.4.4/modules.builtin.bin   | Bin 0 -> 5115 bytes
 .../softdep-loop/lib/modules/4.4.4/modules.builtin.bin   | Bin 0 -> 5115 bytes
 tools/modprobe.c                                         |   6 +++++-
 5 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.builtin.bin
 create mode 100644 testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.builtin.bin
 create mode 100644 testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.builtin.bin
 create mode 100644 testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.builtin.bin

diff --git a/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.builtin.bin b/testsuite/rootfs-pristine/test-depmod/modules-order-compressed/lib/modules/3.5.4-1-ARCH/modules.builtin.bin
new file mode 100644
index 0000000000000000000000000000000000000000..9a11ac74e8719f47bfc1ba18182fe677d37733e9
GIT binary patch
literal 5115
zcmdT|TWB0r82;04l1-CMHhqv55k|2}^`T8nVu}|63RV!o2NA*cbmq+L?yz&q%xuyW
zszJdU1+gHazN{2MAH*tHL9h(^Aczlr5foqcK~xkK@dhI5cXl$n|4ueGNquM!oSpOE
zzVn~kfBv&)hkt#DcF=%EyMORQi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r2O5o~a9aUd(@kjX
zRu*u5H^5E9ju%qgJj=&(#Dv{x)HBuzc=QGDxJhGoak^g{mQVHLXFOn>(^<^X10_iZ
zDVNB>w3V*Ol>2=l-!F9}a9z7bWSKndveZb&-Y?C<=4d~x|Kh>MMLih@q3sJ<4gCgl
zRhK;f^sE@Sd%eAbN-dzK<IyALWaQ7!&mIy}s?Ss$2{MqWjt?qUzXI8A3$d>BNsCH9
z_S0z6`1Q7l6ryTJak!#XQtWk0YdGoarK=(vz+YALr54~k-y6QF?Wq|58OUo>q54Rh
zQb^Zl`_PM9H2zQChlD1|s8>g}aD8@t_fk$SY<4=)eHgb7dmi{=^a4#R``A%RFLgL1
z8_Dd%Dz^msd3}0zPOQ6PSJ)A*#Ig}ae%Qs5%CCD-A8yjbrx_yXuUK1U3!Rcsd8lFV
z*xqw52I-M4-w(Y<tkBgR5%DLgV`1f4b|LL1mD>lT(*qhXMzkwG6Nui&axY~cZ!c^4
zV_2-MrSJA+5IuL8&6dp|Q9}pc<U0L>)2f}&WWkJ}`CeYqk8V-<vpl~^ljVbl)I(ha
zdKmG%I-e4=O{iY{3Mn1dEJEMpqj}^jmBv_J*oyDaf32TB_-7s4z~4O;rzg9fKhY%G
z*U#i~;^7a68NA$Xz-#PFJVp+qUeKs`8<NrnzV9MwIE5SUS&c?N(r65|^t49fIIQD!
fd{tsV8cp1+QF#yQOBzkyo{bOf^QxWD?$7@Pu#3b{

literal 0
HcmV?d00001

diff --git a/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.builtin.bin b/testsuite/rootfs-pristine/test-modprobe/install-cmd-loop/lib/modules/4.4.4/modules.builtin.bin
new file mode 100644
index 0000000000000000000000000000000000000000..9a11ac74e8719f47bfc1ba18182fe677d37733e9
GIT binary patch
literal 5115
zcmdT|TWB0r82;04l1-CMHhqv55k|2}^`T8nVu}|63RV!o2NA*cbmq+L?yz&q%xuyW
zszJdU1+gHazN{2MAH*tHL9h(^Aczlr5foqcK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W^1
z7(LUO!f+{}(Vo-LqS1HE{L$r!qpl_?U4U8)>+iNQY0&>YV!j%r2O5o~a9aUd(@kjX
zRu*u5H^5E9ju%qgJj=&(#Dv{x)HBuzc=QGDxJhGoak^g{mQVHLXFOn>(^<^X10_iZ
zDVNB>w3V*Ol>2=l-!F9}a9z7bWSKndveZb&-Y?C<=4d~x|Kh>MMLih@q3sJ<4gCgl
zRhK;f^sE@Sd%eAbN-dzK<IyALWaQ7!&mIy}s?Ss$2{MqWjt?qUzXI8A3$d>BNsCH9
z_S0z6`1Q7l6ryTJak!#XQtWk0YdGoarK=(vz+YALr54~k-y6QF?Wq|58OUo>q54Rh
zQb^Zl`_PM9H2zQChlD1|s8>g}aD8@t_fk$SY<4=)eHgb7dmi{=^a4#R``A%RFLgL1
z8_Dd%Dz^msd3}0zPOQ6PSJ)A*#Ig}ae%Qs5%CCD-A8yjbrx_yXuUK1U3!Rcsd8lFV
z*xqw52I-M4-w(Y<tkBgR5%DLgV`1f4b|LL1mD>lT(*qhXMzkwG6Nui&axY~cZ!c^4
zV_2-MrSJA+5IuL8&6dp|Q9}pc<U0L>)2f}&WWkJ}`CeYqk8V-<vpl~^ljVbl)I(ha
zdKmG%I-e4=O{iY{3Mn1dEJEMpqj}^jmBv_J*oyDaf32TB_-7s4z~4O;rzg9fKhY%G
z*U#i~;^7a68NA$Xz-#PFJVp+qUeKs`8<NrnzV9MwIE5SUS&c?N(r65|^t49fIIQD!
fd{tsV8cp1+QF#yQOBzkyo{bOf^QxWD?$7@Pu#3b{

literal 0
HcmV?d00001

diff --git a/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.builtin.bin b/testsuite/rootfs-pristine/test-modprobe/show-depends/lib/modules/4.4.4/modules.builtin.bin
new file mode 100644
index 0000000000000000000000000000000000000000..9a11ac74e8719f47bfc1ba18182fe677d37733e9
GIT binary patch
literal 5115
zcmdT|TWB0r82;04l1-CMHhqv55k|2}^`T8nVu}|63RV!o2NA*cbmq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)u1oCBnO0bRV+f|_y3O`+CFyCjYXNhD*tu)fFxfuySR$CqTHW^1
z7(LUO!f+{}(Vo-LqS1HE{L$r!qpl_?U4U8)>+iNQY0&>YV!j%r2O5o~a9aUd(@kjX
zRu*u5H^5E9ju%qgJj=&(#Dv{x)HBuzc=QGDxJhGoak^g{mQVHLXFOn>(^<^X10_iZ
zDVNB>w3V*Ol>2=l-!F9}a9z7bWSKndveZb&-Y?C<=4d~x|Kh>MMLih@q3sJ<4gCgl
zRhK;f^sE@Sd%eAbN-dzK<IyALWaQ7!&mIy}s?Ss$2{MqWjt?qUzXI8A3$d>BNsCH9
z_S0z6`1Q7l6ryTJak!#XQtWk0YdGoarK=(vz+YALr54~k-y6QF?Wq|58OUo>q54Rh
zQb^Zl`_PM9H2zQChlD1|s8>g}aD8@t_fk$SY<4=)eHgb7dmi{=^a4#R``A%RFLgL1
z8_Dd%Dz^msd3}0zPOQ6PSJ)A*#Ig}ae%Qs5%CCD-A8yjbrx_yXuUK1U3!Rcsd8lFV
z*xqw52I-M4-w(Y<tkBgR5%DLgV`1f4b|LL1mD>lT(*qhXMzkwG6Nui&axY~cZ!c^4
zV_2-MrSJA+5IuL8&6dp|Q9}pc<U0L>)2f}&WWkJ}`CeYqk8V-<vpl~^ljVbl)I(ha
zdKmG%I-e4=O{iY{3Mn1dEJEMpqj}^jmBv_J*oyDaf32TB_-7s4z~4O;rzg9fKhY%G
z*U#i~;^7a68NA$Xz-#PFJVp+qUeKs`8<NrnzV9MwIE5SUS&c?N(r65|^t49fIIQD!
fd{tsV8cp1+QF#yQOBzkyo{bOf^QxWD?$7@Pu#3b{

literal 0
HcmV?d00001

diff --git a/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.builtin.bin b/testsuite/rootfs-pristine/test-modprobe/softdep-loop/lib/modules/4.4.4/modules.builtin.bin
new file mode 100644
index 0000000000000000000000000000000000000000..9a11ac74e8719f47bfc1ba18182fe677d37733e9
GIT binary patch
literal 5115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_log(ctx, verbose);
 
-	kmod_load_resources(ctx);
+	err = kmod_load_resources(ctx);
+	if (err < 0) {
+		ERR("Failed to load module indicies: %s\n", strerror(-err));
+		goto done;
+	}
 
 	if (do_show_config)
 		err = show_config(ctx);
-- 
1.8.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux