<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs/exfat, branch linux-5.17.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>exfat: check if cluster num is valid</title>
<updated>2022-06-06T06:47:51+00:00</updated>
<author>
<name>Tadeusz Struk</name>
<email>tadeusz.struk@linaro.org</email>
</author>
<published>2022-05-16T23:13:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7c58b14b6f9cde9f69e7fa053ab73f6e013a7131'/>
<id>7c58b14b6f9cde9f69e7fa053ab73f6e013a7131</id>
<content type='text'>
commit 64ba4b15e5c045f8b746c6da5fc9be9a6b00b61d upstream.

Syzbot reported slab-out-of-bounds read in exfat_clear_bitmap.
This was triggered by reproducer calling truncute with size 0,
which causes the following trace:

BUG: KASAN: slab-out-of-bounds in exfat_clear_bitmap+0x147/0x490 fs/exfat/balloc.c:174
Read of size 8 at addr ffff888115aa9508 by task syz-executor251/365

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3c0 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 exfat_clear_bitmap+0x147/0x490 fs/exfat/balloc.c:174
 exfat_free_cluster+0x25a/0x4a0 fs/exfat/fatent.c:181
 __exfat_truncate+0x99e/0xe00 fs/exfat/file.c:217
 exfat_truncate+0x11b/0x4f0 fs/exfat/file.c:243
 exfat_setattr+0xa03/0xd40 fs/exfat/file.c:339
 notify_change+0xb76/0xe10 fs/attr.c:336
 do_truncate+0x1ea/0x2d0 fs/open.c:65

Move the is_valid_cluster() helper from fatent.c to a common
header to make it reusable in other *.c files. And add is_valid_cluster()
to validate if cluster number is within valid range in exfat_clear_bitmap()
and exfat_set_bitmap().

Link: https://syzkaller.appspot.com/bug?id=50381fc73821ecae743b8cf24b4c9a04776f767c
Reported-by: syzbot+a4087e40b9c13aad7892@syzkaller.appspotmail.com
Fixes: 1e49a94cf707 ("exfat: add bitmap operations")
Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: Tadeusz Struk &lt;tadeusz.struk@linaro.org&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 64ba4b15e5c045f8b746c6da5fc9be9a6b00b61d upstream.

Syzbot reported slab-out-of-bounds read in exfat_clear_bitmap.
This was triggered by reproducer calling truncute with size 0,
which causes the following trace:

BUG: KASAN: slab-out-of-bounds in exfat_clear_bitmap+0x147/0x490 fs/exfat/balloc.c:174
Read of size 8 at addr ffff888115aa9508 by task syz-executor251/365

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3c0 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 exfat_clear_bitmap+0x147/0x490 fs/exfat/balloc.c:174
 exfat_free_cluster+0x25a/0x4a0 fs/exfat/fatent.c:181
 __exfat_truncate+0x99e/0xe00 fs/exfat/file.c:217
 exfat_truncate+0x11b/0x4f0 fs/exfat/file.c:243
 exfat_setattr+0xa03/0xd40 fs/exfat/file.c:339
 notify_change+0xb76/0xe10 fs/attr.c:336
 do_truncate+0x1ea/0x2d0 fs/open.c:65

Move the is_valid_cluster() helper from fatent.c to a common
header to make it reusable in other *.c files. And add is_valid_cluster()
to validate if cluster number is within valid range in exfat_clear_bitmap()
and exfat_set_bitmap().

Link: https://syzkaller.appspot.com/bug?id=50381fc73821ecae743b8cf24b4c9a04776f767c
Reported-by: syzbot+a4087e40b9c13aad7892@syzkaller.appspotmail.com
Fixes: 1e49a94cf707 ("exfat: add bitmap operations")
Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: Tadeusz Struk &lt;tadeusz.struk@linaro.org&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: fix missing REQ_SYNC in exfat_update_bhs()</title>
<updated>2022-01-10T02:00:04+00:00</updated>
<author>
<name>Yuezhang.Mo</name>
<email>Yuezhang.Mo@sony.com</email>
</author>
<published>2021-08-16T03:30:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3d966521a824082952990492442c7b486fefb48c'/>
<id>3d966521a824082952990492442c7b486fefb48c</id>
<content type='text'>
If 'dirsync' is enabled, all directory updates within the
filesystem should be done synchronously. exfat_update_bh()
does as this, but exfat_update_bhs() does not.

Reviewed-by: Andy.Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama, Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Kobayashi, Kento &lt;Kento.A.Kobayashi@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Yuezhang.Mo &lt;Yuezhang.Mo@sony.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If 'dirsync' is enabled, all directory updates within the
filesystem should be done synchronously. exfat_update_bh()
does as this, but exfat_update_bhs() does not.

Reviewed-by: Andy.Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama, Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Kobayashi, Kento &lt;Kento.A.Kobayashi@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Yuezhang.Mo &lt;Yuezhang.Mo@sony.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: remove argument 'sector' from exfat_get_dentry()</title>
<updated>2022-01-10T02:00:03+00:00</updated>
<author>
<name>Yuezhang.Mo</name>
<email>Yuezhang.Mo@sony.com</email>
</author>
<published>2021-12-16T12:58:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c71510b3fa27f96840c5737d8a47dd7b370e376c'/>
<id>c71510b3fa27f96840c5737d8a47dd7b370e376c</id>
<content type='text'>
No any function uses argument 'sector', remove it.

Reviewed-by: Andy.Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama, Wataru &lt;wataru.aoyama@sony.com&gt;
Acked-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Yuezhang.Mo &lt;Yuezhang.Mo@sony.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No any function uses argument 'sector', remove it.

Reviewed-by: Andy.Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama, Wataru &lt;wataru.aoyama@sony.com&gt;
Acked-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Yuezhang.Mo &lt;Yuezhang.Mo@sony.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: move super block magic number to magic.h</title>
<updated>2022-01-10T02:00:03+00:00</updated>
<author>
<name>Namjae Jeon</name>
<email>linkinjeon@kernel.org</email>
</author>
<published>2021-11-25T12:01:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1ed147e29e505de819aaa5b57919c25348f72e1f'/>
<id>1ed147e29e505de819aaa5b57919c25348f72e1f</id>
<content type='text'>
Move exfat superblock magic number from local definition to magic.h.
It is also needed by userspace programs that call fstatfs().

Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move exfat superblock magic number from local definition to magic.h.
It is also needed by userspace programs that call fstatfs().

Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: fix i_blocks for files truncated over 4 GiB</title>
<updated>2022-01-10T02:00:02+00:00</updated>
<author>
<name>Christophe Vu-Brugier</name>
<email>christophe.vu-brugier@seagate.com</email>
</author>
<published>2021-11-22T13:02:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=92fba084b79e6bc7b12fc118209f1922c1a2df56'/>
<id>92fba084b79e6bc7b12fc118209f1922c1a2df56</id>
<content type='text'>
In exfat_truncate(), the computation of inode-&gt;i_blocks is wrong if
the file is larger than 4 GiB because a 32-bit variable is used as a
mask. This is fixed and simplified by using round_up().

Also fix the same buggy computation in exfat_read_root() and another
(correct) one in exfat_fill_inode(). The latter was fixed another way
last month but can be simplified by using round_up() as well. See:

  commit 0c336d6e33f4 ("exfat: fix incorrect loading of i_blocks for
                        large files")

Fixes: 98d917047e8b ("exfat: add file operations")
Cc: stable@vger.kernel.org # v5.7+
Suggested-by: Matthew Wilcox &lt;willy@infradead.org&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In exfat_truncate(), the computation of inode-&gt;i_blocks is wrong if
the file is larger than 4 GiB because a 32-bit variable is used as a
mask. This is fixed and simplified by using round_up().

Also fix the same buggy computation in exfat_read_root() and another
(correct) one in exfat_fill_inode(). The latter was fixed another way
last month but can be simplified by using round_up() as well. See:

  commit 0c336d6e33f4 ("exfat: fix incorrect loading of i_blocks for
                        large files")

Fixes: 98d917047e8b ("exfat: add file operations")
Cc: stable@vger.kernel.org # v5.7+
Suggested-by: Matthew Wilcox &lt;willy@infradead.org&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: reuse exfat_inode_info variable instead of calling EXFAT_I()</title>
<updated>2022-01-10T02:00:02+00:00</updated>
<author>
<name>Christophe Vu-Brugier</name>
<email>christophe.vu-brugier@seagate.com</email>
</author>
<published>2021-11-02T21:23:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7dee6f57d7f22a89dd214518c778aec448270d4c'/>
<id>7dee6f57d7f22a89dd214518c778aec448270d4c</id>
<content type='text'>
Also add a local "struct exfat_inode_info *ei" variable to
exfat_truncate() to simplify the code.

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also add a local "struct exfat_inode_info *ei" variable to
exfat_truncate() to simplify the code.

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: make exfat_find_location() static</title>
<updated>2022-01-10T02:00:01+00:00</updated>
<author>
<name>Christophe Vu-Brugier</name>
<email>christophe.vu-brugier@seagate.com</email>
</author>
<published>2021-11-02T21:23:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8cf058834b11c08b344fc4549b03d723f16c9241'/>
<id>8cf058834b11c08b344fc4549b03d723f16c9241</id>
<content type='text'>
Make exfat_find_location() static.

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make exfat_find_location() static.

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: fix typos in comments</title>
<updated>2022-01-10T02:00:01+00:00</updated>
<author>
<name>Christophe Vu-Brugier</name>
<email>christophe.vu-brugier@seagate.com</email>
</author>
<published>2021-11-02T21:23:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6fa96cd5ad7a0c8f3f3f6b2b5f062721e8f17a54'/>
<id>6fa96cd5ad7a0c8f3f3f6b2b5f062721e8f17a54</id>
<content type='text'>
Fix typos in comments.

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix typos in comments.

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: simplify is_valid_cluster()</title>
<updated>2022-01-10T02:00:00+00:00</updated>
<author>
<name>Christophe Vu-Brugier</name>
<email>christophe.vu-brugier@seagate.com</email>
</author>
<published>2021-11-02T21:23:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e21a28bbcc0c5dc8ab86af77edb530d6fc0c20ff'/>
<id>e21a28bbcc0c5dc8ab86af77edb530d6fc0c20ff</id>
<content type='text'>
Simplify is_valid_cluster().

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Simplify is_valid_cluster().

Signed-off-by: Christophe Vu-Brugier &lt;christophe.vu-brugier@seagate.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>exfat: fix incorrect loading of i_blocks for large files</title>
<updated>2021-10-31T22:49:21+00:00</updated>
<author>
<name>Sungjong Seo</name>
<email>sj1557.seo@samsung.com</email>
</author>
<published>2021-10-19T06:14:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0c336d6e33f4bedc443404c89f43c91c8bd9ee11'/>
<id>0c336d6e33f4bedc443404c89f43c91c8bd9ee11</id>
<content type='text'>
When calculating i_blocks, there was a mistake that was masked with a
32-bit variable. So i_blocks for files larger than 4 GiB had incorrect
values. Mask with a 64-bit variable instead of 32-bit one.

Fixes: 5f2aa075070c ("exfat: add inode operations")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: Ganapathi Kamath &lt;hgkamath@hotmail.com&gt;
Signed-off-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When calculating i_blocks, there was a mistake that was masked with a
32-bit variable. So i_blocks for files larger than 4 GiB had incorrect
values. Mask with a 64-bit variable instead of 32-bit one.

Fixes: 5f2aa075070c ("exfat: add inode operations")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: Ganapathi Kamath &lt;hgkamath@hotmail.com&gt;
Signed-off-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
