linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward AD <twuufnxlz@gmail.com>
To: wojciech.drewek@intel.com
Cc: davem@davemloft.net, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, reibax@gmail.com,
	richardcochran@gmail.com,
	syzbot+9704e6f099d952508943@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com, twuufnxlz@gmail.com
Subject: [PATCH net] ptp: ptp_read should not release queue
Date: Mon, 23 Oct 2023 17:55:50 +0800	[thread overview]
Message-ID: <20231023095549.719099-2-twuufnxlz@gmail.com> (raw)
In-Reply-To: <MW4PR11MB57763BDD2770028003988D8AFDD8A@MW4PR11MB5776.namprd11.prod.outlook.com>

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


  reply	other threads:[~2023-10-23  9:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22 18:37 [syzbot] [net?] KASAN: slab-use-after-free Read in ptp_read syzbot
2023-10-23  2:46 ` [PATCH] ptp: ptp_read should not release queue Edward AD
2023-10-23  9:01   ` Drewek, Wojciech
2023-10-23  9:55     ` Edward AD [this message]
2023-10-23 16:33       ` [PATCH net] " Jakub Kicinski
2023-10-24  0:34         ` Edward AD
2023-10-24  1:49           ` Jakub Kicinski
2023-10-23 16:32     ` [PATCH] " Jakub Kicinski
2023-12-10 21:38 ` [syzbot] [net?] KASAN: slab-use-after-free Read in ptp_read syzbot

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=20231023095549.719099-2-twuufnxlz@gmail.com \
    --to=twuufnxlz@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=reibax@gmail.com \
    --cc=richardcochran@gmail.com \
    --cc=syzbot+9704e6f099d952508943@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=wojciech.drewek@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).