From: Hyunwoo Kim <imv4bel@gmail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: arnd@arndb.de, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>,
imv4bel@gmail.com
Subject: Re: [PATCH v3] char: pcmcia: synclink_cs: Fix use-after-free in mgslpc_ops
Date: Fri, 16 Sep 2022 07:03:53 -0700 [thread overview]
Message-ID: <20220916140353.GA235538@ubuntu> (raw)
In-Reply-To: <21d84319-4d1a-8d8e-a098-947772406faf@linux.intel.com>
On Fri, Sep 16, 2022 at 04:54:11PM +0300, Ilpo Järvinen wrote:
> On Fri, 16 Sep 2022, Hyunwoo Kim wrote:
>
> > A race condition may occur if the user physically removes
> > the pcmcia device while calling ioctl() for this tty device node.
> >
> > This is a race condition between the mgslpc_ioctl() function and
> > the mgslpc_detach() function, which may eventually result in UAF.
> >
> > So, add a refcount check to mgslpc_detach() to free the structure
> > after the tty device node is close()d.
> >
> > Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
>
> > @@ -2517,9 +2548,14 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
> > if (debug_level >= DEBUG_LEVEL_INFO)
> > printk("%s(%d):mgslpc_open(%s) success\n",
> > __FILE__, __LINE__, info->device_name);
> > +
> > + kref_get(&info->refcnt);
> > retval = 0;
> > + mutex_unlock(&remove_mutex);
> >
> > + return retval;
> > cleanup:
> > + mutex_unlock(&remove_mutex);
> > return retval;
>
> Just move the cleanup label instead.
I'm sorry, but could you please explain a bit more?
Best Regards,
Hyunwoo Kim.
next prev parent reply other threads:[~2022-09-16 14:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 13:47 [PATCH v3] char: pcmcia: synclink_cs: Fix use-after-free in mgslpc_ops Hyunwoo Kim
2022-09-16 13:54 ` Ilpo Järvinen
2022-09-16 14:03 ` Hyunwoo Kim [this message]
2022-09-16 14:05 ` Ilpo Järvinen
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=20220916140353.GA235538@ubuntu \
--to=imv4bel@gmail.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
/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