1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: validate string with lock mode

Check the dev_mode string is not NULL before use.
This commit is contained in:
Zdenek Kabelac 2024-10-30 11:54:42 +01:00
parent 6ebcb0015e
commit ae8ba49142

View File

@ -2905,7 +2905,7 @@ int lockd_lv(struct cmd_context *cmd, struct logical_volume *lv,
return 0; return 0;
} }
if (!_lvmlockd_connected && !strcmp(def_mode, "un")) { if (!_lvmlockd_connected && (def_mode && !strcmp(def_mode, "un"))) {
log_debug("Skip LV unlock: no lvmlockd"); log_debug("Skip LV unlock: no lvmlockd");
return 1; return 1;
} }
@ -2922,7 +2922,7 @@ int lockd_lv(struct cmd_context *cmd, struct logical_volume *lv,
* The command still attempts to deactivate the LVs, * The command still attempts to deactivate the LVs,
* which it should in case they are active for some reason. * which it should in case they are active for some reason.
*/ */
if (lv->vg->lockd_not_started && !strcmp(def_mode, "un")) { if (lv->vg->lockd_not_started && (def_mode && !strcmp(def_mode, "un"))) {
log_debug("Skip LV unlock: no lockspace"); log_debug("Skip LV unlock: no lockspace");
return 1; return 1;
} }