Commit cb31ef485dd4c6a205d1064b42027f82076d00c8
Committed by
Mike Snitzer
1 parent
c0403ec0bb
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
init: fix regression by supporting devices with major:minor:offset format
Commit 283e7ad02 ("init: stricter checking of major:minor root= values") was so strict that it exposed the fact that a previously unknown device format was being used. Distributions like Ubuntu uses klibc (rather than uswsusp) to resume system from hibernation. klibc expressed the swap partition/file in the form of major:minor:offset. For example, 8:3:0 represents a swap partition in klibc, and klibc's resume process in initrd will finally echo 8:3:0 to /sys/power/resume for manually resuming. However, due to commit 283e7ad02's stricter checking, 8:3:0 will be treated as an invalid device format, and manual resuming from hibernation will fail. Fix this by adding support for devices with major:minor:offset format when resuming from hibernation. Reported-by: Prigent, Christophe <christophe.prigent@intel.com> Signed-off-by: Chen Yu <yu.c.chen@intel.com> Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
init/do_mounts.c
... | ... | @@ -225,10 +225,11 @@ |
225 | 225 | #endif |
226 | 226 | |
227 | 227 | if (strncmp(name, "/dev/", 5) != 0) { |
228 | - unsigned maj, min; | |
228 | + unsigned maj, min, offset; | |
229 | 229 | char dummy; |
230 | 230 | |
231 | - if (sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) { | |
231 | + if ((sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) || | |
232 | + (sscanf(name, "%u:%u:%u:%c", &maj, &min, &offset, &dummy) == 3)) { | |
232 | 233 | res = MKDEV(maj, min); |
233 | 234 | if (maj != MAJOR(res) || min != MINOR(res)) |
234 | 235 | goto fail; |