Commit 146c129
PM / devfreq: Fix buffer overflow in trans_stat_show
BugLink: https://bugs.launchpad.net/bugs/2059014
[ Upstream commit 08e23d0 ]
Fix buffer overflow in trans_stat_show().
Convert simple snprintf to the more secure scnprintf with size of
PAGE_SIZE.
Add condition checking if we are exceeding PAGE_SIZE and exit early from
loop. Also add at the end a warning that we exceeded PAGE_SIZE and that
stats is disabled.
Return -EFBIG in the case where we don't have enough space to write the
full transition table.
Also document in the ABI that this function can return -EFBIG error.
Link: https://lore.kernel.org/all/[email protected]/
Cc: [email protected]
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218041
Fixes: e552bba ("PM / devfreq: Add sysfs node for representing frequency transition information.")
Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Manuel Diewald <[email protected]>
Signed-off-by: Stefan Bader <[email protected]>1 parent f43fa36 commit 146c129
File tree
2 files changed
+43
-19
lines changed- Documentation/ABI/testing
- drivers/devfreq
2 files changed
+43
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1653 | 1653 | | |
1654 | 1654 | | |
1655 | 1655 | | |
1656 | | - | |
| 1656 | + | |
1657 | 1657 | | |
1658 | 1658 | | |
1659 | 1659 | | |
| |||
1662 | 1662 | | |
1663 | 1663 | | |
1664 | 1664 | | |
1665 | | - | |
| 1665 | + | |
1666 | 1666 | | |
1667 | 1667 | | |
1668 | 1668 | | |
| |||
1672 | 1672 | | |
1673 | 1673 | | |
1674 | 1674 | | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
1680 | 1685 | | |
1681 | | - | |
| 1686 | + | |
1682 | 1687 | | |
1683 | 1688 | | |
| 1689 | + | |
| 1690 | + | |
1684 | 1691 | | |
1685 | 1692 | | |
1686 | | - | |
| 1693 | + | |
1687 | 1694 | | |
1688 | | - | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
1689 | 1707 | | |
1690 | | - | |
1691 | | - | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
1695 | 1717 | | |
1696 | | - | |
1697 | | - | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
1698 | 1721 | | |
1699 | 1722 | | |
1700 | | - | |
1701 | | - | |
1702 | 1723 | | |
1703 | 1724 | | |
1704 | 1725 | | |
| |||
0 commit comments