stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH, 3.18-stable regression] gadgetfs: fix uninitialized variable in error handling
@ 2017-04-21 13:06 Arnd Bergmann
  2017-04-27  9:57 ` Greg KH
  2017-04-27 10:04 ` Patch "gadgetfs: fix uninitialized variable in error handling" has been added to the 3.18-stable tree gregkh
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-04-21 13:06 UTC (permalink / raw)
  To: stable
  Cc: gregkh, Arnd Bergmann, Felipe Balbi, Bin Liu, Sasha Levin,
	linux-usb, linux-kernel

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 f01d35a15fa0416 from 4.0 to 3.18:
c81fc59be42c6e0 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: c81fc59be42c ("gadgetfs: use-after-free in ->aio_read()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/gadget/legacy/inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index 54f964bbc79a..fe45311f243e 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -654,6 +654,7 @@ fail:
 				   GFP_KERNEL);
 		if (!priv->iv) {
 			kfree(priv);
+			value = -ENOMEM;
 			goto fail;
 		}
 	}
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH, 3.18-stable regression] gadgetfs: fix uninitialized variable in error handling
  2017-04-21 13:06 [PATCH, 3.18-stable regression] gadgetfs: fix uninitialized variable in error handling Arnd Bergmann
@ 2017-04-27  9:57 ` Greg KH
  2017-04-27 10:04 ` Patch "gadgetfs: fix uninitialized variable in error handling" has been added to the 3.18-stable tree gregkh
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-04-27  9:57 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: stable, Felipe Balbi, Bin Liu, Sasha Levin, linux-usb,
	linux-kernel

On Fri, Apr 21, 2017 at 03:06:12PM +0200, Arnd Bergmann wrote:
> 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 f01d35a15fa0416 from 4.0 to 3.18:
> c81fc59be42c6e0 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: c81fc59be42c ("gadgetfs: use-after-free in ->aio_read()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/usb/gadget/legacy/inode.c | 1 +
>  1 file changed, 1 insertion(+)

Now queued up, thanks!

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Patch "gadgetfs: fix uninitialized variable in error handling" has been added to the 3.18-stable tree
  2017-04-21 13:06 [PATCH, 3.18-stable regression] gadgetfs: fix uninitialized variable in error handling Arnd Bergmann
  2017-04-27  9:57 ` Greg KH
@ 2017-04-27 10:04 ` gregkh
  1 sibling, 0 replies; 3+ messages in thread
From: gregkh @ 2017-04-27 10:04 UTC (permalink / raw)
  To: arnd, b-liu, balbi, gregkh, sasha.levin; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    gadgetfs: fix uninitialized variable in error handling

to the 3.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gadgetfs-fix-uninitialized-variable-in-error-handling.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From arnd@arndb.de  Thu Apr 27 11:56:31 2017
From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 21 Apr 2017 15:06:12 +0200
Subject: gadgetfs: fix uninitialized variable in error handling
To: stable@vger.kernel.org
Cc: gregkh@linuxfoundation.org, Arnd Bergmann <arnd@arndb.de>, Felipe Balbi <balbi@ti.com>, Bin Liu <b-liu@ti.com>, Sasha Levin <sasha.levin@oracle.com>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Message-ID: <20170421130623.2668561-1-arnd@arndb.de>

From: Arnd Bergmann <arnd@arndb.de>

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 f01d35a15fa0416 from 4.0 to 3.18:
c81fc59be42c6e0 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: c81fc59be42c ("gadgetfs: use-after-free in ->aio_read()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/gadget/legacy/inode.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -654,6 +654,7 @@ fail:
 				   GFP_KERNEL);
 		if (!priv->iv) {
 			kfree(priv);
+			value = -ENOMEM;
 			goto fail;
 		}
 	}


Patches currently in stable-queue which might be from arnd@arndb.de are

queue-3.18/acpi-power-avoid-maybe-uninitialized-warning.patch
queue-3.18/gadgetfs-fix-uninitialized-variable-in-error-handling.patch
queue-3.18/clk-at91-usb-fix-determine_rate-prototype-again.patch
queue-3.18/arm-psci-fix-header-file.patch
queue-3.18/dm-bufio-hide-bogus-warning.patch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-27 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-21 13:06 [PATCH, 3.18-stable regression] gadgetfs: fix uninitialized variable in error handling Arnd Bergmann
2017-04-27  9:57 ` Greg KH
2017-04-27 10:04 ` Patch "gadgetfs: fix uninitialized variable in error handling" has been added to the 3.18-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).