Re: [PATCH v3 2/2] greybus: raw: fix use-after-free if write is called after disconnect
From: Johan Hovold
Date: Tue Mar 24 2026 - 04:11:11 EST
On Tue, Mar 24, 2026 at 08:52:12AM +0100, Johan Hovold wrote:
> On Mon, Mar 23, 2026 at 10:25:10PM -0400, Damien Riégel wrote:
> > + retval = gb_raw_send(raw, count, buf);
> > + if (!retval)
> > + retval = count;
>
> I'd invert this so that we test for errors consistently:
>
> if (retval)
> goto exit;
>
> retval = count;
>
> > +exit:
> > + up_read(&raw->disconnect_lock);
> > +
> > + return retval;
> > }
> >
> > static ssize_t raw_read(struct file *file, char __user *buf, size_t count,
Forgot to say you can include my:
Reviewed-by: Johan Hovold <johan@xxxxxxxxxx>
when respinning.
Johan