Commit c755201eb5c1e09f3477d0e83ae1e3aadac0e8d1

Authored by Kees Cook
Committed by Linus Torvalds
1 parent fdb5950754

ramoops: update parameters only after successful init

If a platform device exists on the system, but ramoops fails to attach to
it, the module parameters are overridden before ramoops can fall back and
try to use passed module parameters.  Move update to end of init routine.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Marco Stornelli <marco.stornelli@gmail.com>
Cc: Sergiu Iordache <sergiu@chromium.org>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 9 additions and 8 deletions Side-by-side Diff

drivers/char/ramoops.c
... ... @@ -147,14 +147,6 @@
147 147 cxt->phys_addr = pdata->mem_address;
148 148 cxt->record_size = pdata->record_size;
149 149 cxt->dump_oops = pdata->dump_oops;
150   - /*
151   - * Update the module parameter variables as well so they are visible
152   - * through /sys/module/ramoops/parameters/
153   - */
154   - mem_size = pdata->mem_size;
155   - mem_address = pdata->mem_address;
156   - record_size = pdata->record_size;
157   - dump_oops = pdata->dump_oops;
158 150  
159 151 if (!request_mem_region(cxt->phys_addr, cxt->size, "ramoops")) {
160 152 pr_err("request mem region failed\n");
... ... @@ -174,6 +166,15 @@
174 166 pr_err("registering kmsg dumper failed\n");
175 167 goto fail1;
176 168 }
  169 +
  170 + /*
  171 + * Update the module parameter variables as well so they are visible
  172 + * through /sys/module/ramoops/parameters/
  173 + */
  174 + mem_size = pdata->mem_size;
  175 + mem_address = pdata->mem_address;
  176 + record_size = pdata->record_size;
  177 + dump_oops = pdata->dump_oops;
177 178  
178 179 return 0;
179 180