<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/md/dm-log.c, branch linux-5.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-06-29T06:59:45Z</updated>
<entry>
<title>dm mirror log: clear log bits up to BITS_PER_LONG boundary</title>
<updated>2022-06-29T06:59:45Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2022-06-23T18:53:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f6a266e0dc6fc024767cd15b8f9de477f4efdfc2'/>
<id>urn:sha1:f6a266e0dc6fc024767cd15b8f9de477f4efdfc2</id>
<content type='text'>
commit 90736eb3232d208ee048493f371075e4272e0944 upstream.

Commit 85e123c27d5c ("dm mirror log: round up region bitmap size to
BITS_PER_LONG") introduced a regression on 64-bit architectures in the
lvm testsuite tests: lvcreate-mirror, mirror-names and vgsplit-operation.

If the device is shrunk, we need to clear log bits beyond the end of the
device. The code clears bits up to a 32-bit boundary and then calculates
lc-&gt;sync_count by summing set bits up to a 64-bit boundary (the commit
changed that; previously, this boundary was 32-bit too). So, it was using
some non-zeroed bits in the calculation and this caused misbehavior.

Fix this regression by clearing bits up to BITS_PER_LONG boundary.

Fixes: 85e123c27d5c ("dm mirror log: round up region bitmap size to BITS_PER_LONG")
Cc: stable@vger.kernel.org
Reported-by: Benjamin Marzinski &lt;bmarzins@redhat.com&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dm mirror log: round up region bitmap size to BITS_PER_LONG</title>
<updated>2022-06-22T12:13:19Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2022-06-16T17:28:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ba751f0d25f07aa21ce9b85372a3792bf7969d13'/>
<id>urn:sha1:ba751f0d25f07aa21ce9b85372a3792bf7969d13</id>
<content type='text'>
commit 85e123c27d5cbc22cfdc01de1e2ca1d9003a02d0 upstream.

The code in dm-log rounds up bitset_size to 32 bits. It then uses
find_next_zero_bit_le on the allocated region. find_next_zero_bit_le
accesses the bitmap using unsigned long pointers. So, on 64-bit
architectures, it may access 4 bytes beyond the allocated size.

Fix this bug by rounding up bitset_size to BITS_PER_LONG.

This bug was found by running the lvm2 testsuite with kasan.

Fixes: 29121bd0b00e ("[PATCH] dm mirror log: bitset_size fix")
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>block,fs: use REQ_* flags directly</title>
<updated>2016-11-01T15:43:26Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2016-11-01T13:40:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=70fd76140a6cb63262bd47b68d57b42e889c10ee'/>
<id>urn:sha1:70fd76140a6cb63262bd47b68d57b42e889c10ee</id>
<content type='text'>
Remove the WRITE_* and READ_SYNC wrappers, and just use the flags
directly.  Where applicable this also drops usage of the
bio_set_op_attrs wrapper.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>dm log: fix unitialized bio operation flags</title>
<updated>2016-08-25T01:55:05Z</updated>
<author>
<name>Heinz Mauelshagen</name>
</author>
<published>2016-08-23T19:17:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c5a559d9495bba6e5b6c5ee4e8e2f2b71088684'/>
<id>urn:sha1:9c5a559d9495bba6e5b6c5ee4e8e2f2b71088684</id>
<content type='text'>
Commit e6047149db ("dm: use bio op accessors") switched DM over to
using bio_set_op_attrs() but didn't take care to initialize
lc-&gt;io_req.bi_op_flags in dm-log.c:rw_header().  This caused
rw_header()'s call to dm_io() to make bio-&gt;bi_op_flags be uninitialized
in dm-io.c:do_region(), which ultimately resulted in a SCSI BUG() in
sd_init_command().

Also, adjust rw_header() and its callers to use REQ_OP_{READ|WRITE}.

Fixes: e6047149db ("dm: use bio op accessors")
Signed-off-by: Heinz Mauelshagen &lt;heinzm@redhat.com&gt;
Reviewed-by: Shaun Tancheff &lt;shaun.tancheff@seagate.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm: use bio op accessors</title>
<updated>2016-06-07T19:41:38Z</updated>
<author>
<name>Mike Christie</name>
</author>
<published>2016-06-05T19:32:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e6047149db702374f240dc18bab665479e25a8cc'/>
<id>urn:sha1:e6047149db702374f240dc18bab665479e25a8cc</id>
<content type='text'>
Separate the op from the rq_flag_bits and have dm
set/get the bio using bio_set_op_attrs/bio_op.

Signed-off-by: Mike Christie &lt;mchristi@redhat.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>dm: use memweight()</title>
<updated>2012-07-31T00:25:16Z</updated>
<author>
<name>Akinobu Mita</name>
</author>
<published>2012-07-30T21:40:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8fb980e35b41bbb79aa47f48839d95f0354af3c4'/>
<id>urn:sha1:8fb980e35b41bbb79aa47f48839d95f0354af3c4</id>
<content type='text'>
Use memweight() to count the total number of bits set in memory area.

Signed-off-by: Akinobu Mita &lt;akinobu.mita@gmail.com&gt;
Cc: Alasdair Kergon &lt;agk@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>dm: reject trailing characters in sccanf input</title>
<updated>2012-03-28T17:41:26Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2012-03-28T17:41:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=31998ef19385c944600d9a981b96252f98204bee'/>
<id>urn:sha1:31998ef19385c944600d9a981b96252f98204bee</id>
<content type='text'>
Device mapper uses sscanf to convert arguments to numbers. The problem is that
the way we use it ignores additional unmatched characters in the scanned string.

For example, this `if (sscanf(string, "%d", &amp;number) == 1)' will match a number,
but also it will match number with some garbage appended, like "123abc".

As a result, device mapper accepts garbage after some numbers. For example
the command `dmsetup create vg1-new --table "0 16384 linear 254:1bla 34816bla"'
will pass without an error.

This patch fixes all sscanf uses in device mapper. It appends "%c" with
a pointer to a dummy character variable to every sscanf statement.

The construct `if (sscanf(string, "%d%c", &amp;number, &amp;dummy) == 1)' succeeds
only if string is a null-terminated number (optionally preceded by some
whitespace characters). If there is some character appended after the number,
sscanf matches "%c", writes the character to the dummy variable and returns 2.
We check the return value for 1 and consequently reject numbers with some
garbage appended.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Acked-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm: use vzalloc</title>
<updated>2011-08-02T11:32:02Z</updated>
<author>
<name>Joe Perches</name>
</author>
<published>2011-08-02T11:32:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e29e65aacbd9e628378084905cbcf62a9fa4a8cc'/>
<id>urn:sha1:e29e65aacbd9e628378084905cbcf62a9fa4a8cc</id>
<content type='text'>
Use vzalloc() instead of vmalloc()+memset().

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm log: clean up bit little endian bitops</title>
<updated>2011-08-02T11:32:01Z</updated>
<author>
<name>Akinobu Mita</name>
</author>
<published>2011-08-02T11:32:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c8f543e0786785d8c7118fc2878e42bc0193a88d'/>
<id>urn:sha1:c8f543e0786785d8c7118fc2878e42bc0193a88d</id>
<content type='text'>
Using __test_and_{set,clear}_bit_le() with ignoring its return value
can be replaced with __{set,clear}_bit_le().

This also removes unnecessary casts.

Signed-off-by: Akinobu Mita &lt;akinobu.mita@gmail.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm: suppress endian warnings</title>
<updated>2011-08-02T11:32:01Z</updated>
<author>
<name>Alasdair G Kergon</name>
</author>
<published>2011-08-02T11:32:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=283a8328ca5b987e547848de8ff0e28edcfb9e08'/>
<id>urn:sha1:283a8328ca5b987e547848de8ff0e28edcfb9e08</id>
<content type='text'>
Suppress sparse warnings about cpu_to_le32() by using __le32 types for
on-disk data etc.

Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
</feed>
