<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ack, this is a real bug.&nbsp;</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Konstantin Khorenko &lt;khorenko@virtuozzo.com&gt;<br>
<b>Sent:</b> 06 July 2026 20:39<br>
<b>To:</b> Alexey Kuznetsov &lt;kuznet@virtuozzo.com&gt;; Kui Liu &lt;kui.liu@virtuozzo.com&gt;<br>
<b>Cc:</b> vzdevel &lt;devel@openvz.org&gt;<br>
<b>Subject:</b> Re: [PATCH vz10 03/24] fuse: also take req_lock when walking open_files in fusectl</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Guys, please, review the patch.<br>
<br>
--<br>
Best regards,<br>
<br>
Konstantin Khorenko,<br>
Virtuozzo Linux Kernel Team<br>
<br>
On 7/6/26 12:59, Konstantin Khorenko wrote:<br>
&gt; Commit 56ef1ee0584c switched the fusectl seq-file iterator from an<br>
&gt; unconditional spin_lock(&amp;fcp-&gt;conn-&gt;lock) to spin_lock(fcp-&gt;req_lock),<br>
&gt; so that each fusectl list is walked under the lock that actually<br>
&gt; protects it. It set -&gt;req_lock for the &quot;pending_req&quot; file (and the<br>
&gt; #if 0 processing/io variants), but missed the second consumer of the<br>
&gt; same start/next/stop callbacks: the &quot;open_files&quot; seq-file has its own<br>
&gt; open handler, fuse_conn_files_open().<br>
&gt; <br>
&gt; fuse_conn_priv is allocated with __seq_open_private() (kzalloc), so for<br>
&gt; open_files -&gt;req_lock stayed NULL. The first read of<br>
&gt; /sys/fs/fuse/connections/&lt;dev&gt;/open_files then calls fuse_req_start()<br>
&gt; -&gt; spin_lock(NULL) and the kernel panics with a NULL pointer<br>
&gt; dereference in the qspinlock slow path.<br>
&gt; <br>
&gt; The conn_files list is added to and removed from under conn-&gt;lock<br>
&gt; (fuse_file_alloc()/fuse_file_list_del()), so point -&gt;req_lock at<br>
&gt; conn-&gt;lock for the open_files file too. This restores the exact lock<br>
&gt; that was used before 56ef1ee0584c for this path.<br>
&gt; <br>
&gt; Fixes: 56ef1ee0584c (&quot;fuse: lock the input-queue lock when walking pending_req in fusectl&quot;)<br>
&gt; Feature: vStorage<br>
&gt; <a href="https://virtuozzo.atlassian.net/browse/VSTOR-137234">https://virtuozzo.atlassian.net/browse/VSTOR-137234</a><br>
&gt; Signed-off-by: Konstantin Khorenko &lt;khorenko@virtuozzo.com&gt;<br>
&gt; ---<br>
&gt;&nbsp; fs/fuse/control.c | 1 +<br>
&gt;&nbsp; 1 file changed, 1 insertion(+)<br>
&gt; <br>
&gt; diff --git a/fs/fuse/control.c b/fs/fuse/control.c<br>
&gt; index 1f5d998be23d..6d210ac80610 100644<br>
&gt; --- a/fs/fuse/control.c<br>
&gt; +++ b/fs/fuse/control.c<br>
&gt; @@ -441,6 +441,7 @@ static int fuse_conn_files_open(struct inode *inode, struct file *filp)<br>
&gt;&nbsp; <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fcp-&gt;conn = conn;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fcp-&gt;req_list = &amp;conn-&gt;conn_files;<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp; fcp-&gt;req_lock = &amp;conn-&gt;lock;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br>
&gt;&nbsp; }<br>
&gt;&nbsp; <br>
<br>
</div>
</span></font></div>
</body>
</html>