From: Ingo Rohloff <ingo.rohloff@lauterbach.com>
To: gregkh@linuxfoundation.org
Cc: viro@zeniv.linux.org.uk, nkapron@google.com, me@samcday.com,
michael.bommarito@gmail.com, linux-usb@vger.kernel.org,
Ingo Rohloff <ingo.rohloff@lauterbach.com>
Subject: [PATCH 3/3] usb: gadget: f_fs: Fix mmgrab()/mmdrop() balance.
Date: Tue, 1 Sep 2026 14:09:08 +0200 [thread overview]
Message-ID: <20260901120908.14386-4-ingo.rohloff@lauterbach.com> (raw)
In-Reply-To: <20260901120908.14386-1-ingo.rohloff@lauterbach.com>
This fixes commit 5eb5c72c72fe ("USB: gadget: ffs: fix mm lifetime
handling"). The problem is that the previous patch calls mmgrab() for
reads and writes, but it only calls mmdrop() for reads. So with each
completed async IO write (via an USB IN endpoint) the number of mm_count
increases.
Signed-off-by: Ingo Rohloff <ingo.rohloff@lauterbach.com>
---
drivers/usb/gadget/function/f_fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 9dec09d06ca9..0be989c7c23f 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -884,8 +884,8 @@ static void ffs_user_copy_worker(struct work_struct *work)
} else {
ret = -EFAULT;
}
- mmdrop(io_data->mm);
}
+ mmdrop(io_data->mm);
io_data->kiocb->ki_complete(io_data->kiocb, ret);
--
2.55.0
prev parent reply other threads:[~2026-09-01 12:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 12:09 [PATCH 0/3] usb: gadget: f_fs: cancellation and mm fixes Ingo Rohloff
2026-09-01 12:09 ` [PATCH 1/3] usb: gadget: f_fs: simplify error handling using goto Ingo Rohloff
2026-09-01 12:09 ` [PATCH 2/3] usb: gadget: f_fs: register cancellation handler only after request queueing Ingo Rohloff
2026-09-01 12:09 ` Ingo Rohloff [this message]
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=20260901120908.14386-4-ingo.rohloff@lauterbach.com \
--to=ingo.rohloff@lauterbach.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=me@samcday.com \
--cc=michael.bommarito@gmail.com \
--cc=nkapron@google.com \
--cc=viro@zeniv.linux.org.uk \
/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