[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yc4NfWuIxJOVZail@rowland.harvard.edu>
Date: Thu, 30 Dec 2021 14:50:21 -0500
From: Alan Stern <stern@...land.harvard.edu>
To: Hangyu Hua <hbh25y@...il.com>
Cc: balbi@...nel.org, gregkh@...uxfoundation.org, axboe@...nel.dk,
jj251510319013@...il.com, dan.carpenter@...cle.com,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] usb: gadget: clear related members when goto fail
On Thu, Dec 30, 2021 at 02:46:00PM -0500, Alan Stern wrote:
> On Thu, Dec 30, 2021 at 01:11:32PM +0800, Hangyu Hua wrote:
> > dev->config and dev->hs_config and dev->dev need to be cleaned if
> > dev_config fails to avoid UAF.
> > @@ -1875,6 +1875,9 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
> >
> > value = usb_gadget_probe_driver(&gadgetfs_driver);
> > if (value != 0) {
> > + dev->dev = NULL;
> > + dev->hs_config = NULL;
> > + dev->config = NULL;
> > kfree (dev->buf);
> > dev->buf = NULL;
>
> Why not just grep the lock and goto fail?
Wrong word: I meant to write "grab", not "grep".
Alan Stern
Powered by blists - more mailing lists