mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Deepanshu Kartikey <kartikey406@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+5fabc1ae99ff40690d84@syzkaller.appspotmail.com
Subject: Re: [PATCH] USB: serial: keyspan: fix use-after-free in keyspan_close
Date: Thu, 10 Sep 2026 14:54:28 +0200	[thread overview]
Message-ID: <aqKohDTyqN_MGKSf@hovoldconsulting.com> (raw)
In-Reply-To: <20260831023701.9579-1-kartikey406@gmail.com>

On Mon, Aug 31, 2026 at 08:07:01AM +0530, Deepanshu Kartikey wrote:
> keyspan_port_remove() frees the port's private data (p_priv) while
> keyspan_close() may still be running concurrently on another task,
> e.g. triggered by an explicit TIOCVHANGUP ioctl on an already-open
> tty racing with device disconnect. This results in keyspan_close()
> dereferencing freed memory.
> 
> Fix this by adding a mutex to keyspan_serial_private that serializes
> keyspan_close() against keyspan_port_remove(): the latter clears the
> port's private data pointer under the lock before freeing it, and
> the former re-fetches and checks that pointer under the same lock
> before use.
> 
> Reported-by: syzbot+5fabc1ae99ff40690d84@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=5fabc1ae99ff40690d84

This isn't a driver specific issue. I've just sent a fix for the tty
port implementation here:

	https://lore.kernel.org/r/20260910125114.640880-1-johan@kernel.org

Johan

      reply	other threads:[~2026-09-10 12:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  2:37 Deepanshu Kartikey
2026-09-10 12:54 ` Johan Hovold [this message]

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=aqKohDTyqN_MGKSf@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kartikey406@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=syzbot+5fabc1ae99ff40690d84@syzkaller.appspotmail.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

all inboxes | Powered by JetHome®