diff mbox series

[net] eventpoll: Annotate data-race of busy_poll_usecs

Message ID 20240806123301.167557-1-jdamato@fastly.com (mailing list archive)
State New
Headers show
Series [net] eventpoll: Annotate data-race of busy_poll_usecs | expand

Commit Message

Joe Damato Aug. 6, 2024, 12:33 p.m. UTC
From: Martin Karsten <mkarsten@uwaterloo.ca>

A struct eventpoll's busy_poll_usecs field can be modified via a user
ioctl at any time. All reads of this field should be annotated with
READ_ONCE.

Fixes: 85455c795c07 ("eventpoll: support busy poll per epoll instance")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Karsten <mkarsten@uwaterloo.ca>
Reviewed-by: Joe Damato <jdamato@fastly.com>
---
 fs/eventpoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski Aug. 8, 2024, 3:22 a.m. UTC | #1
On Tue,  6 Aug 2024 12:33:01 +0000 Joe Damato wrote:
> From: Martin Karsten <mkarsten@uwaterloo.ca>
> 
> A struct eventpoll's busy_poll_usecs field can be modified via a user
> ioctl at any time. All reads of this field should be annotated with
> READ_ONCE.
> 
> Fixes: 85455c795c07 ("eventpoll: support busy poll per epoll instance")
> Cc: stable@vger.kernel.org
> Signed-off-by: Martin Karsten <mkarsten@uwaterloo.ca>
> Reviewed-by: Joe Damato <jdamato@fastly.com>

Christian took the net-next cleanup, I presume he'll take this too.
Christian Brauner Aug. 8, 2024, 7:13 a.m. UTC | #2
On Tue, 06 Aug 2024 12:33:01 +0000, Joe Damato wrote:
> A struct eventpoll's busy_poll_usecs field can be modified via a user
> ioctl at any time. All reads of this field should be annotated with
> READ_ONCE.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] eventpoll: Annotate data-race of busy_poll_usecs
      https://git.kernel.org/vfs/vfs/c/b4988e3bd1f0
diff mbox series

Patch

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index f53ca4f7fced..6d0e2f547ae7 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -420,7 +420,7 @@  static bool busy_loop_ep_timeout(unsigned long start_time,
 
 static bool ep_busy_loop_on(struct eventpoll *ep)
 {
-	return !!ep->busy_poll_usecs || net_busy_loop_on();
+	return !!READ_ONCE(ep->busy_poll_usecs) || net_busy_loop_on();
 }
 
 static bool ep_busy_loop_end(void *p, unsigned long start_time)