The current code in dso__load() calls is_regular_file(), but it checks
its return value only after calling symsrc__init().
That can make symsrc__init() block in elf_* functions on reading
the file if the file happens to be device and not regular one.
Call symsrc__init() only for regular files. Also remove the
symsrc__destroy() cleanup, which is not needed now, because we call
symsrc__init() only for regular files.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180215122635.24029-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
                bool next_slot = false;
                bool is_reg;
                bool nsexit;
-               int sirc;
+               int sirc = -1;
 
                enum dso_binary_type symtab_type = binary_type_symtab[i];
 
                        nsinfo__mountns_exit(&nsc);
 
                is_reg = is_regular_file(name);
-               sirc = symsrc__init(ss, dso, name, symtab_type);
+               if (is_reg)
+                       sirc = symsrc__init(ss, dso, name, symtab_type);
 
                if (nsexit)
                        nsinfo__mountns_enter(dso->nsinfo, &nsc);
 
-               if (!is_reg || sirc < 0) {
-                       if (sirc >= 0)
-                               symsrc__destroy(ss);
+               if (!is_reg || sirc < 0)
                        continue;
-               }
 
                if (!syms_ss && symsrc__has_symtab(ss)) {
                        syms_ss = ss;