Commit 95848dc
zram: take device and not only bvec offset into account
Commit af8b04c ("zram: simplify bvec iteration in
__zram_make_request") changed the bio iteration in zram to rely on the
implicit capping to page boundaries in bio_for_each_segment. But it
failed to care for the fact zram not only care about the page alignment
of the bio payload, but also the page alignment into the device. For
buffered I/O and swap those are the same, but for direct I/O or kernel
internal I/O like XFS log buffer writes they can differ.
Fix this by open coding bio_for_each_segment and limiting the bvec len
so that it never crosses over a page alignment boundary in the device
in addition to the payload boundary already taken care of by
bio_iter_iovec.
Cc: stable@vger.kernel.org
Fixes: af8b04c ("zram: simplify bvec iteration in __zram_make_request")
Reported-by: Dusty Mabe <dusty@dustymabe.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Link: https://lore.kernel.org/r/20230805055537.147835-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent a592ab6 commit 95848dc
1 file changed
Lines changed: 20 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1870 | 1870 | | |
1871 | 1871 | | |
1872 | 1872 | | |
1873 | | - | |
1874 | | - | |
1875 | | - | |
| 1873 | + | |
| 1874 | + | |
1876 | 1875 | | |
1877 | | - | |
1878 | | - | |
| 1876 | + | |
1879 | 1877 | | |
1880 | 1878 | | |
1881 | 1879 | | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
1882 | 1883 | | |
1883 | 1884 | | |
1884 | 1885 | | |
| |||
1890 | 1891 | | |
1891 | 1892 | | |
1892 | 1893 | | |
1893 | | - | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
1894 | 1898 | | |
1895 | 1899 | | |
1896 | 1900 | | |
1897 | 1901 | | |
1898 | 1902 | | |
1899 | 1903 | | |
1900 | | - | |
1901 | | - | |
1902 | | - | |
| 1904 | + | |
| 1905 | + | |
1903 | 1906 | | |
1904 | | - | |
1905 | | - | |
| 1907 | + | |
1906 | 1908 | | |
1907 | 1909 | | |
1908 | 1910 | | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
1909 | 1914 | | |
1910 | 1915 | | |
1911 | 1916 | | |
| |||
1916 | 1921 | | |
1917 | 1922 | | |
1918 | 1923 | | |
1919 | | - | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
1920 | 1928 | | |
1921 | 1929 | | |
1922 | 1930 | | |
| |||
0 commit comments