<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/fs/orangefs, branch v5.15.208</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-12-06T21:09:24+00:00</updated>
<entry>
<title>orangefs: fix xattr related buffer overflow...</title>
<updated>2025-12-06T21:09:24+00:00</updated>
<author>
<name>Mike Marshall</name>
<email>hubcap@omnibond.com</email>
</author>
<published>2025-09-15T21:40:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=15afebb9597449c444801d1ff0b8d8b311f950ab'/>
<id>urn:sha1:15afebb9597449c444801d1ff0b8d8b311f950ab</id>
<content type='text'>
[ Upstream commit 025e880759c279ec64d0f754fe65bf45961da864 ]

Willy Tarreau &lt;w@1wt.eu&gt; forwarded me a message from
Disclosure &lt;disclosure@aisle.com&gt; with the following
warning:

&gt; The helper `xattr_key()` uses the pointer variable in the loop condition
&gt; rather than dereferencing it. As `key` is incremented, it remains non-NULL
&gt; (until it runs into unmapped memory), so the loop does not terminate on
&gt; valid C strings and will walk memory indefinitely, consuming CPU or hanging
&gt; the thread.

I easily reproduced this with setfattr and getfattr, causing a kernel
oops, hung user processes and corrupted orangefs files. Disclosure
sent along a diff (not a patch) with a suggested fix, which I based
this patch on.

After xattr_key started working right, xfstest generic/069 exposed an
xattr related memory leak that lead to OOM. xattr_key returns
a hashed key.  When adding xattrs to the orangefs xattr cache, orangefs
used hash_add, a kernel hashing macro. hash_add also hashes the key using
hash_log which resulted in additions to the xattr cache going to the wrong
hash bucket. generic/069 tortures a single file and orangefs does a
getattr for the xattr "security.capability" every time. Orangefs
negative caches on xattrs which includes a kmalloc. Since adds to the
xattr cache were going to the wrong bucket, every getattr for
"security.capability" resulted in another kmalloc, none of which were
ever freed.

I changed the two uses of hash_add to hlist_add_head instead
and the memory leak ceased and generic/069 quit throwing furniture.

Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Reported-by: Stanislav Fort of Aisle Research &lt;stanislav.fort@aisle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>fs/orangefs: use snprintf() instead of sprintf()</title>
<updated>2025-08-28T14:24:23+00:00</updated>
<author>
<name>Amir Mohammad Jahangirzad</name>
<email>a.jahangirzad@gmail.com</email>
</author>
<published>2025-06-08T16:35:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dacfd8cf9c23ef166dab8caadb582d8ade63c968'/>
<id>urn:sha1:dacfd8cf9c23ef166dab8caadb582d8ade63c968</id>
<content type='text'>
[ Upstream commit cdfa1304657d6f23be8fd2bb0516380a3c89034e ]

sprintf() is discouraged for use with bounded destination buffers
as it does not prevent buffer overflows when the formatted output
exceeds the destination buffer size. snprintf() is a safer
alternative as it limits the number of bytes written and ensures
NUL-termination.

Replace sprintf() with snprintf() for copying the debug string
into a temporary buffer, using ORANGEFS_MAX_DEBUG_STRING_LEN as
the maximum size to ensure safe formatting and prevent memory
corruption in edge cases.

EDIT: After this patch sat on linux-next for a few days, Dan
Carpenter saw it and suggested that I use scnprintf instead of
snprintf. I made the change and retested.

Signed-off-by: Amir Mohammad Jahangirzad &lt;a.jahangirzad@gmail.com&gt;
Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>fs/orangefs: Allow 2 more characters in do_c_string()</title>
<updated>2025-08-28T14:24:10+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@linaro.org</email>
</author>
<published>2025-07-19T14:19:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bbe6cd4da912a3756d7d37512847a8abfa237d98'/>
<id>urn:sha1:bbe6cd4da912a3756d7d37512847a8abfa237d98</id>
<content type='text'>
[ Upstream commit 2138e89cb066b40386b1d9ddd61253347d356474 ]

The do_k_string() and do_c_string() functions do essentially the same
thing which is they add a string and a comma onto the end of an existing
string.  At the end, the caller will overwrite the last comma with a
newline.  Later, in orangefs_kernel_debug_init(), we add a newline to
the string.

The change to do_k_string() is just cosmetic.  I moved the "- 1" to
the other side of the comparison and made it "+ 1".  This has no
effect on runtime, I just wanted the functions to match each other
and the rest of the file.

However in do_c_string(), I removed the "- 2" which allows us to print
two extra characters.  I noticed this issue while reviewing the code
and I doubt affects anything in real life.  My guess is that this was
double counting the comma and the newline.  The "+ 1" accounts for
the newline, and the caller will delete the final comma which ensures
there is enough space for the newline.

Removing the "- 2" lets us print 2 more characters, but mainly it makes
the code more consistent and understandable for reviewers.

Fixes: 44f4641073f1 ("orangefs: clean up debugfs globals")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>orangefs: Do not truncate file size</title>
<updated>2025-06-04T12:37:58+00:00</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2025-03-05T20:47:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5111227d7f1f57f6804666b3abf780a23f44fc1d'/>
<id>urn:sha1:5111227d7f1f57f6804666b3abf780a23f44fc1d</id>
<content type='text'>
[ Upstream commit 062e8093592fb866b8e016641a8b27feb6ac509d ]

'len' is used to store the result of i_size_read(), so making 'len'
a size_t results in truncation to 4GiB on 32-bit systems.

Signed-off-by: "Matthew Wilcox (Oracle)" &lt;willy@infradead.org&gt;
Link: https://lore.kernel.org/r/20250305204734.1475264-2-willy@infradead.org
Tested-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>orangefs: fix a oob in orangefs_debug_write</title>
<updated>2025-03-13T11:50:37+00:00</updated>
<author>
<name>Mike Marshall</name>
<email>hubcap@omnibond.com</email>
</author>
<published>2025-01-08T19:21:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8725882b0f691f8113b230aea9df0256030a63a6'/>
<id>urn:sha1:8725882b0f691f8113b230aea9df0256030a63a6</id>
<content type='text'>
[ Upstream commit f7c848431632598ff9bce57a659db6af60d75b39 ]

I got a syzbot report: slab-out-of-bounds Read in
orangefs_debug_write... several people suggested fixes,
I tested Al Viro's suggestion and made this patch.

Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Reported-by: syzbot+fc519d7875f2d9186c1f@syzkaller.appspotmail.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>orangefs: fix out-of-bounds fsid access</title>
<updated>2024-07-18T11:07:29+00:00</updated>
<author>
<name>Mike Marshall</name>
<email>hubcap@omnibond.com</email>
</author>
<published>2024-05-01T20:20:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=137a06dc0ff8b2d2069c2345d015ef0fa71df1ed'/>
<id>urn:sha1:137a06dc0ff8b2d2069c2345d015ef0fa71df1ed</id>
<content type='text'>
[ Upstream commit 53e4efa470d5fc6a96662d2d3322cfc925818517 ]

Arnd Bergmann sent a patch to fsdevel, he says:

"orangefs_statfs() copies two consecutive fields of the superblock into
the statfs structure, which triggers a warning from the string fortification
helpers"

Jan Kara suggested an alternate way to do the patch to make it more readable.

I ran both ideas through xfstests and both seem fine. This patch
is based on Jan Kara's suggestion.

Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>orangefs: Fix kmemleak in orangefs_{kernel,client}_debug_init()</title>
<updated>2022-12-31T12:14:44+00:00</updated>
<author>
<name>Zhang Xiaoxu</name>
<email>zhangxiaoxu5@huawei.com</email>
</author>
<published>2022-10-18T04:40:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c8853267289c55b1acbe4dc3641374887584834d'/>
<id>urn:sha1:c8853267289c55b1acbe4dc3641374887584834d</id>
<content type='text'>
[ Upstream commit 31720a2b109b3080eb77e97b8f6f50a27b4ae599 ]

When insert and remove the orangefs module, there are memory leaked
as below:

unreferenced object 0xffff88816b0cc000 (size 2048):
  comm "insmod", pid 783, jiffies 4294813439 (age 65.512s)
  hex dump (first 32 bytes):
    6e 6f 6e 65 0a 00 00 00 00 00 00 00 00 00 00 00  none............
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000005b405fee&gt;] orangefs_debugfs_init.cold+0xaf/0x17f
    [&lt;00000000e5a0085b&gt;] 0xffffffffa02780f9
    [&lt;000000004232d9f7&gt;] do_one_initcall+0x87/0x2a0
    [&lt;0000000054f22384&gt;] do_init_module+0xdf/0x320
    [&lt;000000003263bdea&gt;] load_module+0x2f98/0x3330
    [&lt;0000000052cd4153&gt;] __do_sys_finit_module+0x113/0x1b0
    [&lt;00000000250ae02b&gt;] do_syscall_64+0x35/0x80
    [&lt;00000000f11c03c7&gt;] entry_SYSCALL_64_after_hwframe+0x46/0xb0

Use the golbal variable as the buffer rather than dynamic allocate to
slove the problem.

Signed-off-by: Zhang Xiaoxu &lt;zhangxiaoxu5@huawei.com&gt;
Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>orangefs: Fix kmemleak in orangefs_prepare_debugfs_help_string()</title>
<updated>2022-12-31T12:14:44+00:00</updated>
<author>
<name>Zhang Xiaoxu</name>
<email>zhangxiaoxu5@huawei.com</email>
</author>
<published>2022-10-18T04:40:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=39529b79b023713d4f2d3479dc0ca43ba99df726'/>
<id>urn:sha1:39529b79b023713d4f2d3479dc0ca43ba99df726</id>
<content type='text'>
[ Upstream commit d23417a5bf3a3afc55de5442eb46e1e60458b0a1 ]

When insert and remove the orangefs module, then debug_help_string will
be leaked:

  unreferenced object 0xffff8881652ba000 (size 4096):
    comm "insmod", pid 1701, jiffies 4294893639 (age 13218.530s)
    hex dump (first 32 bytes):
      43 6c 69 65 6e 74 20 44 65 62 75 67 20 4b 65 79  Client Debug Key
      77 6f 72 64 73 20 61 72 65 20 75 6e 6b 6e 6f 77  words are unknow
    backtrace:
      [&lt;0000000004e6f8e3&gt;] kmalloc_trace+0x27/0xa0
      [&lt;0000000006f75d85&gt;] orangefs_prepare_debugfs_help_string+0x5e/0x480 [orangefs]
      [&lt;0000000091270a2a&gt;] _sub_I_65535_1+0x57/0xf70 [crc_itu_t]
      [&lt;000000004b1ee1a3&gt;] do_one_initcall+0x87/0x2a0
      [&lt;000000001d0614ae&gt;] do_init_module+0xdf/0x320
      [&lt;00000000efef068c&gt;] load_module+0x2f98/0x3330
      [&lt;000000006533b44d&gt;] __do_sys_finit_module+0x113/0x1b0
      [&lt;00000000a0da6f99&gt;] do_syscall_64+0x35/0x80
      [&lt;000000007790b19b&gt;] entry_SYSCALL_64_after_hwframe+0x46/0xb0

When remove the module, should always free debug_help_string. Should
always free the allocated buffer when change the free_debug_help_string.

Signed-off-by: Zhang Xiaoxu &lt;zhangxiaoxu5@huawei.com&gt;
Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>orangefs: Fix sysfs not cleanup when dev init failed</title>
<updated>2022-12-31T12:14:26+00:00</updated>
<author>
<name>Zhang Xiaoxu</name>
<email>zhangxiaoxu5@huawei.com</email>
</author>
<published>2022-10-18T04:40:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e27fb26e75cf1e5a6c6a9f18ca571d5b2d0c55c5'/>
<id>urn:sha1:e27fb26e75cf1e5a6c6a9f18ca571d5b2d0c55c5</id>
<content type='text'>
[ Upstream commit ea60a4ad0cf88b411cde6888b8c890935686ecd7 ]

When the dev init failed, should cleanup the sysfs, otherwise, the
module will never be loaded since can not create duplicate sysfs
directory:

  sysfs: cannot create duplicate filename '/fs/orangefs'

  CPU: 1 PID: 6549 Comm: insmod Tainted: G        W          6.0.0+ #44
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014
  Call Trace:
   &lt;TASK&gt;
   dump_stack_lvl+0x34/0x44
   sysfs_warn_dup.cold+0x17/0x24
   sysfs_create_dir_ns+0x16d/0x180
   kobject_add_internal+0x156/0x3a0
   kobject_init_and_add+0xcf/0x120
   orangefs_sysfs_init+0x7e/0x3a0 [orangefs]
   orangefs_init+0xfe/0x1000 [orangefs]
   do_one_initcall+0x87/0x2a0
   do_init_module+0xdf/0x320
   load_module+0x2f98/0x3330
   __do_sys_finit_module+0x113/0x1b0
   do_syscall_64+0x35/0x80
   entry_SYSCALL_64_after_hwframe+0x46/0xb0

  kobject_add_internal failed for orangefs with -EEXIST, don't try to register things with the same name in the same directory.

Fixes: 2f83ace37181 ("orangefs: put register_chrdev immediately before register_filesystem")
Signed-off-by: Zhang Xiaoxu &lt;zhangxiaoxu5@huawei.com&gt;
Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>orangefs: Fix the size of a memory allocation in orangefs_bufmap_alloc()</title>
<updated>2022-01-20T08:13:13+00:00</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2021-12-27T18:09:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b07490067dbcce915686257b0821da44d744b682'/>
<id>urn:sha1:b07490067dbcce915686257b0821da44d744b682</id>
<content type='text'>
commit 40a74870b2d1d3d44e13b3b73c6571dd34f5614d upstream.

'buffer_index_array' really looks like a bitmap. So it should be allocated
as such.
When kzalloc is called, a number of bytes is expected, but a number of
longs is passed instead.

In get(), if not enough memory is allocated, un-allocated memory may be
read or written.

So use bitmap_zalloc() to safely allocate the correct memory size and
avoid un-expected behavior.

While at it, change the corresponding kfree() into bitmap_free() to keep
the semantic.

Fixes: ea2c9c9f6574 ("orangefs: bufmap rewrite")
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Signed-off-by: Mike Marshall &lt;hubcap@omnibond.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
