diff mbox series

ptp: ptp_read should not release queue

Message ID 20231023024622.323905-2-twuufnxlz@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series ptp: ptp_read should not release queue | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1363 this patch: 1363
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 1388 this patch: 1388
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1388 this patch: 1388
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Edward AD Oct. 23, 2023, 2:46 a.m. UTC
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(-)

Comments

Wojciech Drewek Oct. 23, 2023, 9:01 a.m. UTC | #1
> -----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
>
Jakub Kicinski Oct. 23, 2023, 4:32 p.m. UTC | #2
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.
diff mbox series

Patch

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;
 }