Commit 3456a40e authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by Greg Kroah-Hartman

staging: lustre: lustre: lov: lov_obd.c: Fix for possible null pointer dereference

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 597ae468
...@@ -277,7 +277,7 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) ...@@ -277,7 +277,7 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
osc_obd = class_exp2obd(tgt->ltd_exp); osc_obd = class_exp2obd(tgt->ltd_exp);
CDEBUG(D_CONFIG, "%s: disconnecting target %s\n", CDEBUG(D_CONFIG, "%s: disconnecting target %s\n",
obd->obd_name, osc_obd->obd_name); obd->obd_name, osc_obd ? osc_obd->obd_name : "NULL");
if (tgt->ltd_active) { if (tgt->ltd_active) {
tgt->ltd_active = 0; tgt->ltd_active = 0;
...@@ -285,11 +285,11 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) ...@@ -285,11 +285,11 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
tgt->ltd_exp->exp_obd->obd_inactive = 1; tgt->ltd_exp->exp_obd->obd_inactive = 1;
} }
if (osc_obd) {
lov_proc_dir = obd->obd_proc_private; lov_proc_dir = obd->obd_proc_private;
if (lov_proc_dir) if (lov_proc_dir) {
lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir); lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir);
}
if (osc_obd) {
/* Pass it on to our clients. /* Pass it on to our clients.
* XXX This should be an argument to disconnect, * XXX This should be an argument to disconnect,
* XXX not a back-door flag on the OBD. Ah well. * XXX not a back-door flag on the OBD. Ah well.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment