lkml.org 
[lkml]   [2021]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2021-12-30 20:51    [W:0.049 / U:1.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site