Commit 11990a5
committed
module: Correctly truncate sysfs sections output
The only-root-readable /sys/module/$module/sections/$section files
did not truncate their output to the available buffer size. While most
paths into the kernfs read handlers end up using PAGE_SIZE buffers,
it's possible to get there through other paths (e.g. splice, sendfile).
Actually limit the output to the "count" passed into the read function,
and report it back correctly. *sigh*
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/20200805002015.GE23458@shao2-debian
Fixes: ed66f99 ("module: Refactor section attr into bin attribute")
Cc: stable@vger.kernel.org
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>1 parent bcf8768 commit 11990a5
1 file changed
Lines changed: 19 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1520 | 1520 | | |
1521 | 1521 | | |
1522 | 1522 | | |
| 1523 | + | |
1523 | 1524 | | |
1524 | 1525 | | |
1525 | 1526 | | |
1526 | 1527 | | |
1527 | 1528 | | |
1528 | 1529 | | |
| 1530 | + | |
| 1531 | + | |
1529 | 1532 | | |
1530 | 1533 | | |
1531 | 1534 | | |
1532 | 1535 | | |
1533 | | - | |
1534 | | - | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
1535 | 1551 | | |
1536 | 1552 | | |
1537 | 1553 | | |
| |||
1580 | 1596 | | |
1581 | 1597 | | |
1582 | 1598 | | |
1583 | | - | |
| 1599 | + | |
1584 | 1600 | | |
1585 | 1601 | | |
1586 | 1602 | | |
| |||
0 commit comments