[PATCH] ptp: ptp_read should not release queue

Edward AD posted 1 patch 2 years, 2 months ago
There is a newer version of this series
drivers/ptp/ptp_chardev.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] ptp: ptp_read should not release queue
Posted by Edward AD 2 years, 2 months ago
Firstly, queue is not the memory allocated in ptp_read;
Secondly, other processes may block at ptp_read and wait for conditions to be 
met to perform read operations.

Reported-and-tested-by: syzbot+9704e6f099d952508943@syzkaller.appspotmail.com
Fixes: 8f5de6fb2453 ("ptp: support multiple timestamp event readers")
Signed-off-by: Edward AD <twuufnxlz@gmail.com>
---
 drivers/ptp/ptp_chardev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 282cd7d24077..27c1ef493617 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -585,7 +585,5 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
 free_event:
 	kfree(event);
 exit:
-	if (result < 0)
-		ptp_release(pccontext);
 	return result;
 }
-- 
2.25.1
RE: [PATCH] ptp: ptp_read should not release queue
Posted by Drewek, Wojciech 2 years, 2 months ago

> -----Original Message-----
> From: Edward AD <twuufnxlz@gmail.com>
> Sent: Monday, October 23, 2023 4:46 AM
> To: syzbot+9704e6f099d952508943@syzkaller.appspotmail.com
> Cc: davem@davemloft.net; linux-kernel@vger.kernel.org; netdev@vger.kernel.org; reibax@gmail.com; richardcochran@gmail.com;
> syzkaller-bugs@googlegroups.com
> Subject: [PATCH] ptp: ptp_read should not release queue
> 
> Firstly, queue is not the memory allocated in ptp_read;
> Secondly, other processes may block at ptp_read and wait for conditions to be
> met to perform read operations.
> 
> Reported-and-tested-by: syzbot+9704e6f099d952508943@syzkaller.appspotmail.com
> Fixes: 8f5de6fb2453 ("ptp: support multiple timestamp event readers")
> Signed-off-by: Edward AD <twuufnxlz@gmail.com>

Hi Edward,

Consider adding a target to the subject: [PATCH net] in this case

> ---
>  drivers/ptp/ptp_chardev.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 282cd7d24077..27c1ef493617 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -585,7 +585,5 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
>  free_event:
>  	kfree(event);
>  exit:
> -	if (result < 0)
> -		ptp_release(pccontext);
>  	return result;
>  }
> --
> 2.25.1
> 
Re: [PATCH] ptp: ptp_read should not release queue
Posted by Jakub Kicinski 2 years, 2 months ago
On Mon, 23 Oct 2023 09:01:40 +0000 Drewek, Wojciech wrote:
> Consider adding a target to the subject: [PATCH net] in this case

The buggy commit only exists in net-next, [PATCH net-next] 
is the correct prefix.
[PATCH net] ptp: ptp_read should not release queue
Posted by Edward AD 2 years, 2 months ago
Firstly, queue is not the memory allocated in ptp_read;
Secondly, other processes may block at ptp_read and wait for conditions to be 
met to perform read operations.

Reported-and-tested-by: syzbot+9704e6f099d952508943@syzkaller.appspotmail.com
Fixes: 8f5de6fb2453 ("ptp: support multiple timestamp event readers")
Signed-off-by: Edward AD <twuufnxlz@gmail.com>
---
 drivers/ptp/ptp_chardev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 282cd7d24077..27c1ef493617 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -585,7 +585,5 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
 free_event:
 	kfree(event);
 exit:
-	if (result < 0)
-		ptp_release(pccontext);
 	return result;
 }
-- 
2.25.1
Re: [PATCH net] ptp: ptp_read should not release queue
Posted by Jakub Kicinski 2 years, 2 months ago
On Mon, 23 Oct 2023 17:55:50 +0800 Edward AD wrote:
> Signed-off-by: Edward AD <twuufnxlz@gmail.com>

We need a legal name for the signoff, not initials.
Re: [PATCH net] ptp: ptp_read should not release queue
Posted by Edward AD 2 years, 2 months ago
On Mon, 23 Oct 2023 09:33:34 -0700 Jakub Kicinski wrote:
>> Signed-off-by: Edward AD <twuufnxlz@gmail.com>
> 
> We need a legal name for the signoff, not initials.
You may have some misunderstandings about my name, AD is not an acronym. 
This is my full and legal name 'Edward AD'.
Re: [PATCH net] ptp: ptp_read should not release queue
Posted by Jakub Kicinski 2 years, 2 months ago
On Tue, 24 Oct 2023 08:34:58 +0800 Edward AD wrote:
> > We need a legal name for the signoff, not initials.  
> You may have some misunderstandings about my name, AD is not an acronym. 
> This is my full and legal name 'Edward AD'.

Is there any public person with the surname 'AD' you can point me to?
Or any reference that would educate me about it?