Commit ca76ac3
ovl: fix wrong lowerdir number check for parameter Opt_lowerdir
The max count of lowerdir is OVL_MAX_STACK[500], which is broken by
commit 37f32f5("ovl: fix memory leak in ovl_parse_param()") for
parameter Opt_lowerdir. Since commit 819829f("ovl: refactor layer
parsing helpers") and commit 24e16e3("ovl: add support for
appending lowerdirs one by one") added check ovl_mount_dir_check() in
function ovl_parse_param_lowerdir(), the 'ctx->nr' should be smaller
than OVL_MAX_STACK, after commit 37f32f5("ovl: fix memory leak in
ovl_parse_param()") is applied, the 'ctx->nr' is updated before the
check ovl_mount_dir_check(), which leads the max count of lowerdir
to become 499 for parameter Opt_lowerdir.
Fix it by replacing lower layers parsing code with the existing helper
function ovl_parse_layer().
Fixes: 37f32f5 ("ovl: fix memory leak in ovl_parse_param()")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Link: https://lore.kernel.org/r/20240705011510.794025-3-chengzhihao1@huawei.com
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>1 parent 7eff345 commit ca76ac3
1 file changed
Lines changed: 7 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
356 | 358 | | |
357 | 359 | | |
358 | 360 | | |
| |||
375 | 377 | | |
376 | 378 | | |
377 | 379 | | |
378 | | - | |
| 380 | + | |
379 | 381 | | |
380 | 382 | | |
381 | 383 | | |
| |||
431 | 433 | | |
432 | 434 | | |
433 | 435 | | |
434 | | - | |
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
| |||
471 | 472 | | |
472 | 473 | | |
473 | 474 | | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | 475 | | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
| 476 | + | |
| 477 | + | |
492 | 478 | | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
| 479 | + | |
503 | 480 | | |
504 | 481 | | |
505 | 482 | | |
| |||
517 | 494 | | |
518 | 495 | | |
519 | 496 | | |
520 | | - | |
| 497 | + | |
521 | 498 | | |
522 | 499 | | |
523 | 500 | | |
| |||
531 | 508 | | |
532 | 509 | | |
533 | 510 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | 511 | | |
538 | 512 | | |
539 | 513 | | |
| |||
0 commit comments