Commit 279b8b78 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

gadgetfs: fix uninitialized variable in error handling

gcc warns about a bug in 3.18.y:

drivers/usb/gadget/legacy/inode.c:648:10: warning: 'value' may be used

This is caused by the backport of f01d35a1 from 4.0 to 3.18:
c81fc59b gadgetfs: use-after-free in ->aio_read()

The backported patch was buggy, but the mainline code was rewritten
in a larger patch directly following this one in a way that fixed the
bug.

For stable, we should need only a one-line change to make sure we
return an proper error code. It is very unlikely that anybody ever
ran into the out-of-memory case here in practice, but the compiler
is right in theory.

Fixes: c81fc59b ("gadgetfs: use-after-free in ->aio_read()")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f2d62e62
......@@ -654,6 +654,7 @@ ep_aio_rwtail(
GFP_KERNEL);
if (!priv->iv) {
kfree(priv);
value = -ENOMEM;
goto fail;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment