On Thu, Apr 14 2016, Lars-Peter Clausen wrote: > Calling the ki_complete() callback will free the underlying data structure. > Make sure that it is no longer accessed beyond that point, otherwise > undefined behaviour might occur. > > Fixes: 2e4c7553cd6f ("usb: gadget: f_fs: add aio support") > Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx> And obviously, moments after I sent an email asking a question I tracked down ki_complete. The commit message could benefit from being more detailed regardless. Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx> This probably also deserves Cc: <stable@xxxxxxxxxxxxxxx> # 3.14+ > --- > drivers/usb/gadget/function/f_fs.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c > index e21ca2bd..15b648c 100644 > --- a/drivers/usb/gadget/function/f_fs.c > +++ b/drivers/usb/gadget/function/f_fs.c > @@ -646,6 +646,7 @@ static void ffs_user_copy_worker(struct work_struct *work) > work); > int ret = io_data->req->status ? io_data->req->status : > io_data->req->actual; > + bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; > > if (io_data->read && ret > 0) { > use_mm(io_data->mm); > @@ -657,13 +658,11 @@ static void ffs_user_copy_worker(struct work_struct *work) > > io_data->kiocb->ki_complete(io_data->kiocb, ret, ret); > > - if (io_data->ffs->ffs_eventfd && > - !(io_data->kiocb->ki_flags & IOCB_EVENTFD)) > + if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) > eventfd_signal(io_data->ffs->ffs_eventfd, 1); > > usb_ep_free_request(io_data->ep, io_data->req); > > - io_data->kiocb->private = NULL; > if (io_data->read) > kfree(io_data->to_free); > kfree(io_data->buf); > -- > 2.1.4 > -- Best regards ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ «If at first you don’t succeed, give up skydiving» -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html