staging: lustre: lustre: ptlrpc: sec_config.c: Fix for possible null pointer dereference
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Mon, 19 May 2014 21:42:08 +0000 (23:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 12:05:36 +0000 (21:05 +0900)
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: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ptlrpc/sec_config.c

index bf56120abfaf788159d6a15feb52826937b1f786..231656ed7660e6463c552c9ddebfab156c9a4654 100644 (file)
@@ -745,11 +745,13 @@ void sptlrpc_conf_log_update_begin(const char *logname)
        mutex_lock(&sptlrpc_conf_lock);
 
        conf = sptlrpc_conf_get(fsname, 0);
-       if (conf && conf->sc_local) {
-               LASSERT(conf->sc_updated == 0);
-               sptlrpc_conf_free_rsets(conf);
+       if (conf) {
+               if(conf->sc_local) {
+                       LASSERT(conf->sc_updated == 0);
+                       sptlrpc_conf_free_rsets(conf);
+               }
+               conf->sc_modified = 0;
        }
-       conf->sc_modified = 0;
 
        mutex_unlock(&sptlrpc_conf_lock);
 }