<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs, branch v6.1.2</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range</title>
<updated>2022-12-31T12:33:11+00:00</updated>
<author>
<name>Filipe Manana</name>
<email>fdmanana@suse.com</email>
</author>
<published>2022-11-28T15:07:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1baf3370e2dc5e6bd1368348736189457dab2a27'/>
<id>1baf3370e2dc5e6bd1368348736189457dab2a27</id>
<content type='text'>
commit 162d053e15fe985f754ef495a96eb3db970c43ed upstream.

If we get -ENOMEM while dropping file extent items in a given range, at
btrfs_drop_extents(), due to failure to allocate memory when attempting to
increment the reference count for an extent or drop the reference count,
we handle it with a BUG_ON(). This is excessive, instead we can simply
abort the transaction and return the error to the caller. In fact most
callers of btrfs_drop_extents(), directly or indirectly, already abort
the transaction if btrfs_drop_extents() returns any error.

Also, we already have error paths at btrfs_drop_extents() that may return
-ENOMEM and in those cases we abort the transaction, like for example
anything that changes the b+tree may return -ENOMEM due to a failure to
allocate a new extent buffer when COWing an existing extent buffer, such
as a call to btrfs_duplicate_item() for example.

So replace the BUG_ON() calls with proper logic to abort the transaction
and return the error.

Reported-by: syzbot+0b1fb6b0108c27419f9f@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-btrfs/00000000000089773e05ee4b9cb4@google.com/
CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Josef Bacik &lt;josef@toxicpanda.com&gt;
Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&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 162d053e15fe985f754ef495a96eb3db970c43ed upstream.

If we get -ENOMEM while dropping file extent items in a given range, at
btrfs_drop_extents(), due to failure to allocate memory when attempting to
increment the reference count for an extent or drop the reference count,
we handle it with a BUG_ON(). This is excessive, instead we can simply
abort the transaction and return the error to the caller. In fact most
callers of btrfs_drop_extents(), directly or indirectly, already abort
the transaction if btrfs_drop_extents() returns any error.

Also, we already have error paths at btrfs_drop_extents() that may return
-ENOMEM and in those cases we abort the transaction, like for example
anything that changes the b+tree may return -ENOMEM due to a failure to
allocate a new extent buffer when COWing an existing extent buffer, such
as a call to btrfs_duplicate_item() for example.

So replace the BUG_ON() calls with proper logic to abort the transaction
and return the error.

Reported-by: syzbot+0b1fb6b0108c27419f9f@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-btrfs/00000000000089773e05ee4b9cb4@google.com/
CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Josef Bacik &lt;josef@toxicpanda.com&gt;
Signed-off-by: Filipe Manana &lt;fdmanana@suse.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ovl: fix use inode directly in rcu-walk mode</title>
<updated>2022-12-31T12:33:11+00:00</updated>
<author>
<name>Chen Zhongjin</name>
<email>chenzhongjin@huawei.com</email>
</author>
<published>2022-11-28T10:33:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ac551b1f500b99ab05fb7ade8ba61fd61f3cfbe7'/>
<id>ac551b1f500b99ab05fb7ade8ba61fd61f3cfbe7</id>
<content type='text'>
commit 672e4268b2863d7e4978dfed29552b31c2f9bd4e upstream.

ovl_dentry_revalidate_common() can be called in rcu-walk mode.  As document
said, "in rcu-walk mode, d_parent and d_inode should not be used without
care".

Check inode here to protect access under rcu-walk mode.

Fixes: bccece1ead36 ("ovl: allow remote upper")
Reported-and-tested-by: syzbot+a4055c78774bbf3498bb@syzkaller.appspotmail.com
Signed-off-by: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v5.7
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&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 672e4268b2863d7e4978dfed29552b31c2f9bd4e upstream.

ovl_dentry_revalidate_common() can be called in rcu-walk mode.  As document
said, "in rcu-walk mode, d_parent and d_inode should not be used without
care".

Check inode here to protect access under rcu-walk mode.

Fixes: bccece1ead36 ("ovl: allow remote upper")
Reported-and-tested-by: syzbot+a4055c78774bbf3498bb@syzkaller.appspotmail.com
Signed-off-by: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v5.7
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>reiserfs: Add missing calls to reiserfs_security_free()</title>
<updated>2022-12-31T12:33:10+00:00</updated>
<author>
<name>Roberto Sassu</name>
<email>roberto.sassu@huawei.com</email>
</author>
<published>2022-11-10T09:46:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=02ed209aa6f1b5a58a2fef3dbf84132d0bc663c8'/>
<id>02ed209aa6f1b5a58a2fef3dbf84132d0bc663c8</id>
<content type='text'>
commit 572302af1258459e124437b8f3369357447afac7 upstream.

Commit 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes
during inode creation") defined reiserfs_security_free() to free the name
and value of a security xattr allocated by the active LSM through
security_old_inode_init_security(). However, this function is not called
in the reiserfs code.

Thus, add a call to reiserfs_security_free() whenever
reiserfs_security_init() is called, and initialize value to NULL, to avoid
to call kfree() on an uninitialized pointer.

Finally, remove the kfree() for the xattr name, as it is not allocated
anymore.

Fixes: 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes during inode creation")
Cc: stable@vger.kernel.org
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Reported-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Reported-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Signed-off-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Reviewed-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Signed-off-by: Paul Moore &lt;paul@paul-moore.com&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 572302af1258459e124437b8f3369357447afac7 upstream.

Commit 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes
during inode creation") defined reiserfs_security_free() to free the name
and value of a security xattr allocated by the active LSM through
security_old_inode_init_security(). However, this function is not called
in the reiserfs code.

Thus, add a call to reiserfs_security_free() whenever
reiserfs_security_init() is called, and initialize value to NULL, to avoid
to call kfree() on an uninitialized pointer.

Finally, remove the kfree() for the xattr name, as it is not allocated
anymore.

Fixes: 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes during inode creation")
Cc: stable@vger.kernel.org
Cc: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Reported-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Reported-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Signed-off-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Reviewed-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Signed-off-by: Paul Moore &lt;paul@paul-moore.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES</title>
<updated>2022-12-31T12:33:08+00:00</updated>
<author>
<name>John Stultz</name>
<email>jstultz@google.com</email>
</author>
<published>2022-12-21T05:18:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=475add46170dc1b634cb31c85c74c6487ad04414'/>
<id>475add46170dc1b634cb31c85c74c6487ad04414</id>
<content type='text'>
[ Upstream commit 2f4fec5943407318b9523f01ce1f5d668c028332 ]

In commit 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex
to avoid priority inversion") I changed a lock to an rt_mutex.

However, its possible that CONFIG_RT_MUTEXES is not enabled,
which then results in a build failure, as the 0day bot detected:
  https://lore.kernel.org/linux-mm/202212211244.TwzWZD3H-lkp@intel.com/

Thus this patch changes CONFIG_PSTORE_PMSG to select
CONFIG_RT_MUTEXES, which ensures the build will not fail.

Cc: Wei Wang &lt;wvw@google.com&gt;
Cc: Midas Chien&lt;midaschieh@google.com&gt;
Cc: Connor O'Brien &lt;connoro@google.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Anton Vorontsov &lt;anton@enomsg.org&gt;
Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: kernel test robot &lt;lkp@intel.com&gt;
Cc: kernel-team@android.com
Fixes: 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: John Stultz &lt;jstultz@google.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20221221051855.15761-1-jstultz@google.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 2f4fec5943407318b9523f01ce1f5d668c028332 ]

In commit 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex
to avoid priority inversion") I changed a lock to an rt_mutex.

However, its possible that CONFIG_RT_MUTEXES is not enabled,
which then results in a build failure, as the 0day bot detected:
  https://lore.kernel.org/linux-mm/202212211244.TwzWZD3H-lkp@intel.com/

Thus this patch changes CONFIG_PSTORE_PMSG to select
CONFIG_RT_MUTEXES, which ensures the build will not fail.

Cc: Wei Wang &lt;wvw@google.com&gt;
Cc: Midas Chien&lt;midaschieh@google.com&gt;
Cc: Connor O'Brien &lt;connoro@google.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Anton Vorontsov &lt;anton@enomsg.org&gt;
Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: kernel test robot &lt;lkp@intel.com&gt;
Cc: kernel-team@android.com
Fixes: 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: John Stultz &lt;jstultz@google.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20221221051855.15761-1-jstultz@google.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>afs: Fix lost servers_outstanding count</title>
<updated>2022-12-31T12:33:08+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2022-12-21T14:30:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b4a59fd2e50b733d0182b65266121ffb2e72a8e9'/>
<id>b4a59fd2e50b733d0182b65266121ffb2e72a8e9</id>
<content type='text'>
[ Upstream commit 36f82c93ee0bd88f1c95a52537906b8178b537f1 ]

The afs_fs_probe_dispatcher() work function is passed a count on
net-&gt;servers_outstanding when it is scheduled (which may come via its
timer).  This is passed back to the work_item, passed to the timer or
dropped at the end of the dispatcher function.

But, at the top of the dispatcher function, there are two checks which
skip the rest of the function: if the network namespace is being destroyed
or if there are no fileservers to probe.  These two return paths, however,
do not drop the count passed to the dispatcher, and so, sometimes, the
destruction of a network namespace, such as induced by rmmod of the kafs
module, may get stuck in afs_purge_servers(), waiting for
net-&gt;servers_outstanding to become zero.

Fix this by adding the missing decrements in afs_fs_probe_dispatcher().

Fixes: f6cbb368bcb0 ("afs: Actively poll fileservers to maintain NAT or firewall openings")
Reported-by: Marc Dionne &lt;marc.dionne@auristor.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-by: Marc Dionne &lt;marc.dionne@auristor.com&gt;
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/167164544917.2072364.3759519569649459359.stgit@warthog.procyon.org.uk/
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 36f82c93ee0bd88f1c95a52537906b8178b537f1 ]

The afs_fs_probe_dispatcher() work function is passed a count on
net-&gt;servers_outstanding when it is scheduled (which may come via its
timer).  This is passed back to the work_item, passed to the timer or
dropped at the end of the dispatcher function.

But, at the top of the dispatcher function, there are two checks which
skip the rest of the function: if the network namespace is being destroyed
or if there are no fileservers to probe.  These two return paths, however,
do not drop the count passed to the dispatcher, and so, sometimes, the
destruction of a network namespace, such as induced by rmmod of the kafs
module, may get stuck in afs_purge_servers(), waiting for
net-&gt;servers_outstanding to become zero.

Fix this by adding the missing decrements in afs_fs_probe_dispatcher().

Fixes: f6cbb368bcb0 ("afs: Actively poll fileservers to maintain NAT or firewall openings")
Reported-by: Marc Dionne &lt;marc.dionne@auristor.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-by: Marc Dionne &lt;marc.dionne@auristor.com&gt;
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/167164544917.2072364.3759519569649459359.stgit@warthog.procyon.org.uk/
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion</title>
<updated>2022-12-31T12:33:07+00:00</updated>
<author>
<name>John Stultz</name>
<email>jstultz@google.com</email>
</author>
<published>2022-12-14T23:18:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e84276c8dd8867690bf20ef2ed613eeaca134dc7'/>
<id>e84276c8dd8867690bf20ef2ed613eeaca134dc7</id>
<content type='text'>
[ Upstream commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721 ]

Wei Wang reported seeing priority inversion caused latencies
caused by contention on pmsg_lock, and suggested it be switched
to a rt_mutex.

I was initially hesitant this would help, as the tasks in that
trace all seemed to be SCHED_NORMAL, so the benefit would be
limited to only nice boosting.

However, another similar issue was raised where the priority
inversion was seen did involve a blocked RT task so it is clear
this would be helpful in that case.

Cc: Wei Wang &lt;wvw@google.com&gt;
Cc: Midas Chien&lt;midaschieh@google.com&gt;
Cc: Connor O'Brien &lt;connoro@google.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Anton Vorontsov &lt;anton@enomsg.org&gt;
Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: kernel-team@android.com
Fixes: 9d5438f462ab ("pstore: Add pmsg - user-space accessible pstore object")
Reported-by: Wei Wang &lt;wvw@google.com&gt;
Signed-off-by: John Stultz &lt;jstultz@google.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20221214231834.3711880-1-jstultz@google.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721 ]

Wei Wang reported seeing priority inversion caused latencies
caused by contention on pmsg_lock, and suggested it be switched
to a rt_mutex.

I was initially hesitant this would help, as the tasks in that
trace all seemed to be SCHED_NORMAL, so the benefit would be
limited to only nice boosting.

However, another similar issue was raised where the priority
inversion was seen did involve a blocked RT task so it is clear
this would be helpful in that case.

Cc: Wei Wang &lt;wvw@google.com&gt;
Cc: Midas Chien&lt;midaschieh@google.com&gt;
Cc: Connor O'Brien &lt;connoro@google.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Anton Vorontsov &lt;anton@enomsg.org&gt;
Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: kernel-team@android.com
Fixes: 9d5438f462ab ("pstore: Add pmsg - user-space accessible pstore object")
Reported-by: Wei Wang &lt;wvw@google.com&gt;
Signed-off-by: John Stultz &lt;jstultz@google.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20221214231834.3711880-1-jstultz@google.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>orangefs: Fix kmemleak in orangefs_{kernel,client}_debug_init()</title>
<updated>2022-12-31T12:33:06+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.tavy.me/linux-stable.git/commit/?id=0cd303aad220fafa595e0ed593e99aa51b90412b'/>
<id>0cd303aad220fafa595e0ed593e99aa51b90412b</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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ 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;
</pre>
</div>
</content>
</entry>
<entry>
<title>orangefs: Fix kmemleak in orangefs_sysfs_init()</title>
<updated>2022-12-31T12:33:06+00:00</updated>
<author>
<name>Zhang Xiaoxu</name>
<email>zhangxiaoxu5@huawei.com</email>
</author>
<published>2022-10-18T04:40:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=22409490294180c39be7dd0e5b2667d41556307d'/>
<id>22409490294180c39be7dd0e5b2667d41556307d</id>
<content type='text'>
[ Upstream commit 1f2c0e8a587bcafad85019a2d80f158d8d41a868 ]

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

unreferenced object 0xffff88810f95af00 (size 64):
  comm "insmod", pid 783, jiffies 4294813439 (age 65.512s)
  hex dump (first 32 bytes):
    a0 83 af 01 81 88 ff ff 08 af 95 0f 81 88 ff ff  ................
    08 af 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000005a6e4dfe&gt;] orangefs_sysfs_init+0x42/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ae80 (size 64):
  comm "insmod", pid 783, jiffies 4294813439 (age 65.512s)
  hex dump (first 32 bytes):
    c8 90 0f 02 81 88 ff ff 88 ae 95 0f 81 88 ff ff  ................
    88 ae 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000001a4841fa&gt;] orangefs_sysfs_init+0xc7/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ae00 (size 64):
  comm "insmod", pid 783, jiffies 4294813440 (age 65.511s)
  hex dump (first 32 bytes):
    60 87 a1 00 81 88 ff ff 08 ae 95 0f 81 88 ff ff  `...............
    08 ae 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000005915e797&gt;] orangefs_sysfs_init+0x12b/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ad80 (size 64):
  comm "insmod", pid 783, jiffies 4294813440 (age 65.511s)
  hex dump (first 32 bytes):
    78 90 0f 02 81 88 ff ff 88 ad 95 0f 81 88 ff ff  x...............
    88 ad 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000007a14eb35&gt;] orangefs_sysfs_init+0x1ac/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ac00 (size 64):
  comm "insmod", pid 783, jiffies 4294813440 (age 65.531s)
  hex dump (first 32 bytes):
    e0 ff 67 02 81 88 ff ff 08 ac 95 0f 81 88 ff ff  ..g.............
    08 ac 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000001f38adcb&gt;] orangefs_sysfs_init+0x291/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ab80 (size 64):
  comm "insmod", pid 783, jiffies 4294813441 (age 65.530s)
  hex dump (first 32 bytes):
    50 bf 2f 02 81 88 ff ff 88 ab 95 0f 81 88 ff ff  P./.............
    88 ab 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000009cc7d95b&gt;] orangefs_sysfs_init+0x2f5/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

Should add release function for each kobject_type to free the memory.

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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 1f2c0e8a587bcafad85019a2d80f158d8d41a868 ]

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

unreferenced object 0xffff88810f95af00 (size 64):
  comm "insmod", pid 783, jiffies 4294813439 (age 65.512s)
  hex dump (first 32 bytes):
    a0 83 af 01 81 88 ff ff 08 af 95 0f 81 88 ff ff  ................
    08 af 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000005a6e4dfe&gt;] orangefs_sysfs_init+0x42/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ae80 (size 64):
  comm "insmod", pid 783, jiffies 4294813439 (age 65.512s)
  hex dump (first 32 bytes):
    c8 90 0f 02 81 88 ff ff 88 ae 95 0f 81 88 ff ff  ................
    88 ae 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000001a4841fa&gt;] orangefs_sysfs_init+0xc7/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ae00 (size 64):
  comm "insmod", pid 783, jiffies 4294813440 (age 65.511s)
  hex dump (first 32 bytes):
    60 87 a1 00 81 88 ff ff 08 ae 95 0f 81 88 ff ff  `...............
    08 ae 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000005915e797&gt;] orangefs_sysfs_init+0x12b/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ad80 (size 64):
  comm "insmod", pid 783, jiffies 4294813440 (age 65.511s)
  hex dump (first 32 bytes):
    78 90 0f 02 81 88 ff ff 88 ad 95 0f 81 88 ff ff  x...............
    88 ad 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000007a14eb35&gt;] orangefs_sysfs_init+0x1ac/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ac00 (size 64):
  comm "insmod", pid 783, jiffies 4294813440 (age 65.531s)
  hex dump (first 32 bytes):
    e0 ff 67 02 81 88 ff ff 08 ac 95 0f 81 88 ff ff  ..g.............
    08 ac 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000001f38adcb&gt;] orangefs_sysfs_init+0x291/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

unreferenced object 0xffff88810f95ab80 (size 64):
  comm "insmod", pid 783, jiffies 4294813441 (age 65.530s)
  hex dump (first 32 bytes):
    50 bf 2f 02 81 88 ff ff 88 ab 95 0f 81 88 ff ff  P./.............
    88 ab 95 0f 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [&lt;0000000031ab7788&gt;] kmalloc_trace+0x27/0xa0
    [&lt;000000009cc7d95b&gt;] orangefs_sysfs_init+0x2f5/0x3a0
    [&lt;00000000722645ca&gt;] 0xffffffffa02780fe
    [&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

Should add release function for each kobject_type to free the memory.

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;
</pre>
</div>
</content>
</entry>
<entry>
<title>orangefs: Fix kmemleak in orangefs_prepare_debugfs_help_string()</title>
<updated>2022-12-31T12:33:06+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.tavy.me/linux-stable.git/commit/?id=19be31668552a198e887762e25bdcc560800ecb4'/>
<id>19be31668552a198e887762e25bdcc560800ecb4</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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ 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;
</pre>
</div>
</content>
</entry>
<entry>
<title>hugetlbfs: fix null-ptr-deref in hugetlbfs_parse_param()</title>
<updated>2022-12-31T12:33:05+00:00</updated>
<author>
<name>Hawkins Jiawei</name>
<email>yin31149@gmail.com</email>
</author>
<published>2022-10-20T23:16:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f2207145693ae5697a7b59e2add4b92f9e5b0e3c'/>
<id>f2207145693ae5697a7b59e2add4b92f9e5b0e3c</id>
<content type='text'>
[ Upstream commit 26215b7ee923b9251f7bb12c4e5f09dc465d35f2 ]

Syzkaller reports a null-ptr-deref bug as follows:
======================================================
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:hugetlbfs_parse_param+0x1dd/0x8e0 fs/hugetlbfs/inode.c:1380
[...]
Call Trace:
 &lt;TASK&gt;
 vfs_parse_fs_param fs/fs_context.c:148 [inline]
 vfs_parse_fs_param+0x1f9/0x3c0 fs/fs_context.c:129
 vfs_parse_fs_string+0xdb/0x170 fs/fs_context.c:191
 generic_parse_monolithic+0x16f/0x1f0 fs/fs_context.c:231
 do_new_mount fs/namespace.c:3036 [inline]
 path_mount+0x12de/0x1e20 fs/namespace.c:3370
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
 [...]
 &lt;/TASK&gt;
======================================================

According to commit "vfs: parse: deal with zero length string value",
kernel will set the param-&gt;string to null pointer in vfs_parse_fs_string()
if fs string has zero length.

Yet the problem is that, hugetlbfs_parse_param() will dereference the
param-&gt;string, without checking whether it is a null pointer.  To be more
specific, if hugetlbfs_parse_param() parses an illegal mount parameter,
such as "size=,", kernel will constructs struct fs_parameter with null
pointer in vfs_parse_fs_string(), then passes this struct fs_parameter to
hugetlbfs_parse_param(), which triggers the above null-ptr-deref bug.

This patch solves it by adding sanity check on param-&gt;string
in hugetlbfs_parse_param().

Link: https://lkml.kernel.org/r/20221020231609.4810-1-yin31149@gmail.com
Reported-by: syzbot+a3e6acd85ded5c16a709@syzkaller.appspotmail.com
Tested-by: syzbot+a3e6acd85ded5c16a709@syzkaller.appspotmail.com
  Link: https://lore.kernel.org/all/0000000000005ad00405eb7148c6@google.com/
Signed-off-by: Hawkins Jiawei &lt;yin31149@gmail.com&gt;
Reviewed-by: Mike Kravetz &lt;mike.kravetz@oracle.com&gt;
Cc: Hawkins Jiawei &lt;yin31149@gmail.com&gt;
Cc: Muchun Song &lt;songmuchun@bytedance.com&gt;
Cc: Ian Kent &lt;raven@themaw.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 26215b7ee923b9251f7bb12c4e5f09dc465d35f2 ]

Syzkaller reports a null-ptr-deref bug as follows:
======================================================
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:hugetlbfs_parse_param+0x1dd/0x8e0 fs/hugetlbfs/inode.c:1380
[...]
Call Trace:
 &lt;TASK&gt;
 vfs_parse_fs_param fs/fs_context.c:148 [inline]
 vfs_parse_fs_param+0x1f9/0x3c0 fs/fs_context.c:129
 vfs_parse_fs_string+0xdb/0x170 fs/fs_context.c:191
 generic_parse_monolithic+0x16f/0x1f0 fs/fs_context.c:231
 do_new_mount fs/namespace.c:3036 [inline]
 path_mount+0x12de/0x1e20 fs/namespace.c:3370
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
 [...]
 &lt;/TASK&gt;
======================================================

According to commit "vfs: parse: deal with zero length string value",
kernel will set the param-&gt;string to null pointer in vfs_parse_fs_string()
if fs string has zero length.

Yet the problem is that, hugetlbfs_parse_param() will dereference the
param-&gt;string, without checking whether it is a null pointer.  To be more
specific, if hugetlbfs_parse_param() parses an illegal mount parameter,
such as "size=,", kernel will constructs struct fs_parameter with null
pointer in vfs_parse_fs_string(), then passes this struct fs_parameter to
hugetlbfs_parse_param(), which triggers the above null-ptr-deref bug.

This patch solves it by adding sanity check on param-&gt;string
in hugetlbfs_parse_param().

Link: https://lkml.kernel.org/r/20221020231609.4810-1-yin31149@gmail.com
Reported-by: syzbot+a3e6acd85ded5c16a709@syzkaller.appspotmail.com
Tested-by: syzbot+a3e6acd85ded5c16a709@syzkaller.appspotmail.com
  Link: https://lore.kernel.org/all/0000000000005ad00405eb7148c6@google.com/
Signed-off-by: Hawkins Jiawei &lt;yin31149@gmail.com&gt;
Reviewed-by: Mike Kravetz &lt;mike.kravetz@oracle.com&gt;
Cc: Hawkins Jiawei &lt;yin31149@gmail.com&gt;
Cc: Muchun Song &lt;songmuchun@bytedance.com&gt;
Cc: Ian Kent &lt;raven@themaw.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
