linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fork: fix pidfd_poll()'s return type
@ 2019-11-20  0:07 Luc Van Oostenryck
  2019-11-20  0:21 ` Christian Brauner
  0 siblings, 1 reply; 4+ messages in thread
From: Luc Van Oostenryck @ 2019-11-20  0:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Luc Van Oostenryck, Joel Fernandes, Christian Brauner

pidfd_poll() is defined as returning 'unsigned int' but the
.poll method is declared as returning '__poll_t', a bitwise type.

Fix this by using the proper return type and using the EPOLL
constants instead of the POLL ones, as required for __poll_t.

CC: Joel Fernandes (Google) <joel@joelfernandes.org>
CC: Christian Brauner <christian@brauner.io>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 kernel/fork.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 55af6931c6ec..13b38794efb5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1708,11 +1708,11 @@ static void pidfd_show_fdinfo(struct seq_file *m, struct file *f)
 /*
  * Poll support for process exit notification.
  */
-static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
+static __poll_t pidfd_poll(struct file *file, struct poll_table_struct *pts)
 {
 	struct task_struct *task;
 	struct pid *pid = file->private_data;
-	int poll_flags = 0;
+	__poll_t poll_flags = 0;
 
 	poll_wait(file, &pid->wait_pidfd, pts);
 
@@ -1724,7 +1724,7 @@ static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
 	 * group, then poll(2) should block, similar to the wait(2) family.
 	 */
 	if (!task || (task->exit_state && thread_group_empty(task)))
-		poll_flags = POLLIN | POLLRDNORM;
+		poll_flags = EPOLLIN | EPOLLRDNORM;
 	rcu_read_unlock();
 
 	return poll_flags;
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fork: fix pidfd_poll()'s return type
  2019-11-20  0:07 [PATCH] fork: fix pidfd_poll()'s return type Luc Van Oostenryck
@ 2019-11-20  0:21 ` Christian Brauner
  2019-11-20  0:33   ` [PATCH v2] " Luc Van Oostenryck
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Brauner @ 2019-11-20  0:21 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-kernel, Joel Fernandes

On Wed, Nov 20, 2019 at 01:07:22AM +0100, Luc Van Oostenryck wrote:
> pidfd_poll() is defined as returning 'unsigned int' but the
> .poll method is declared as returning '__poll_t', a bitwise type.
> 
> Fix this by using the proper return type and using the EPOLL
> constants instead of the POLL ones, as required for __poll_t.
> 
> CC: Joel Fernandes (Google) <joel@joelfernandes.org>
> CC: Christian Brauner <christian@brauner.io>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Yeah, that makes sense. Thanks.

This only misses two tags:

Fixes: b53b0b9d9a61 ("pidfd: add polling support")
Cc: stable@vger.kernel.org # 5.3

Can you add these two tags to the commit message for v1 and resend with
stable@vger.kernel.org Cced, please?

Otherwise:
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] fork: fix pidfd_poll()'s return type
  2019-11-20  0:21 ` Christian Brauner
@ 2019-11-20  0:33   ` Luc Van Oostenryck
  2019-11-20 10:52     ` Christian Brauner
  0 siblings, 1 reply; 4+ messages in thread
From: Luc Van Oostenryck @ 2019-11-20  0:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: stable, Luc Van Oostenryck, Joel Fernandes, Christian Brauner,
	Christian Brauner

pidfd_poll() is defined as returning 'unsigned int' but the
.poll method is declared as returning '__poll_t', a bitwise type.

Fix this by using the proper return type and using the EPOLL
constants instead of the POLL ones, as required for __poll_t.

Fixes: b53b0b9d9a61 ("pidfd: add polling support")
Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: Christian Brauner <christian@brauner.io>
Cc: stable@vger.kernel.org # 5.3
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 kernel/fork.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 55af6931c6ec..13b38794efb5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1708,11 +1708,11 @@ static void pidfd_show_fdinfo(struct seq_file *m, struct file *f)
 /*
  * Poll support for process exit notification.
  */
-static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
+static __poll_t pidfd_poll(struct file *file, struct poll_table_struct *pts)
 {
 	struct task_struct *task;
 	struct pid *pid = file->private_data;
-	int poll_flags = 0;
+	__poll_t poll_flags = 0;
 
 	poll_wait(file, &pid->wait_pidfd, pts);
 
@@ -1724,7 +1724,7 @@ static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
 	 * group, then poll(2) should block, similar to the wait(2) family.
 	 */
 	if (!task || (task->exit_state && thread_group_empty(task)))
-		poll_flags = POLLIN | POLLRDNORM;
+		poll_flags = EPOLLIN | EPOLLRDNORM;
 	rcu_read_unlock();
 
 	return poll_flags;
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] fork: fix pidfd_poll()'s return type
  2019-11-20  0:33   ` [PATCH v2] " Luc Van Oostenryck
@ 2019-11-20 10:52     ` Christian Brauner
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2019-11-20 10:52 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: linux-kernel, stable, Joel Fernandes, Christian Brauner

On Wed, Nov 20, 2019 at 01:33:20AM +0100, Luc Van Oostenryck wrote:
> pidfd_poll() is defined as returning 'unsigned int' but the
> .poll method is declared as returning '__poll_t', a bitwise type.
> 
> Fix this by using the proper return type and using the EPOLL
> constants instead of the POLL ones, as required for __poll_t.
> 
> Fixes: b53b0b9d9a61 ("pidfd: add polling support")
> Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
> Cc: Christian Brauner <christian@brauner.io>
> Cc: stable@vger.kernel.org # 5.3
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>

Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=fixes

Will likely send this as a fix for v5.4 still so stable only has to
backport this to 5.3 and not 5.4 too.

Thanks!
Christian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-20 10:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20  0:07 [PATCH] fork: fix pidfd_poll()'s return type Luc Van Oostenryck
2019-11-20  0:21 ` Christian Brauner
2019-11-20  0:33   ` [PATCH v2] " Luc Van Oostenryck
2019-11-20 10:52     ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).