mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+d9890527385ab9767e03@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [netfs?] WARNING: refcount bug in netfs_put_subrequest
Date: Sat, 15 Feb 2025 07:13:53 +0800	[thread overview]
Message-ID: <20250214231356.2285-1-hdanton@sina.com> (raw)
In-Reply-To: <67aee51d.050a0220.21dd3.002f.GAE@google.com>

On Thu, 13 Feb 2025 22:39:25 -0800
> syzbot found the following issue on:
> 
> HEAD commit:    69b54314c975 Merge tag 'kbuild-fixes-v6.14' of git://git.k..
> git tree:       upstream
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=13aafdf8580000

#syz test upstream   master

--- x/fs/netfs/read_collect.c
+++ y/fs/netfs/read_collect.c
@@ -289,6 +289,10 @@ reassess:
 		/* Remove if completely consumed. */
 		stream->source = front->source;
 		spin_lock(&rreq->lock);
+		if (front != stream->front) {
+			spin_unlock(&rreq->lock);
+			goto reassess;
+		}
 
 		remove = front;
 		trace_netfs_sreq(front, netfs_sreq_trace_discard);
@@ -345,6 +349,7 @@ static void netfs_rreq_assess_dio(struct
 	struct netfs_io_subrequest *subreq;
 	struct netfs_io_stream *stream = &rreq->io_streams[0];
 	unsigned int i;
+	struct kiocb *iocb = NULL;
 
 	/* Collect unbuffered reads and direct reads, adding up the transfer
 	 * sizes until we find the first short or failed subrequest.
@@ -369,12 +374,16 @@ static void netfs_rreq_assess_dio(struct
 		}
 	}
 
+	spin_lock(&rreq->lock);
 	if (rreq->iocb) {
 		rreq->iocb->ki_pos += rreq->transferred;
 		if (rreq->iocb->ki_complete)
-			rreq->iocb->ki_complete(
-				rreq->iocb, rreq->error ? rreq->error : rreq->transferred);
+			iocb = rreq->iocb;
+		rreq->iocb = NULL;
 	}
+	spin_unlock(&rreq->lock);
+	if (iocb)
+		iocb->ki_complete(iocb, rreq->error ? rreq->error : rreq->transferred);
 	if (rreq->netfs_ops->done)
 		rreq->netfs_ops->done(rreq);
 	if (rreq->origin == NETFS_DIO_READ)
--

  parent reply	other threads:[~2025-02-14 23:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14  6:39 syzbot
2025-02-14 11:19 ` Hillf Danton
2025-02-14 11:42   ` syzbot
2025-02-14 23:13 ` Hillf Danton [this message]
2025-02-14 23:52   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250214231356.2285-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+d9890527385ab9767e03@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®