stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "Revert "usbtmc: convert to devm_kzalloc"" has been added to the 4.8-stable tree
@ 2016-10-06  7:31 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-10-06  7:31 UTC (permalink / raw)
  To: gregkh, andriy.shevchenko, ladis; +Cc: stable, stable-commits


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

    Revert "usbtmc: convert to devm_kzalloc"

to the 4.8-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:
     revert-usbtmc-convert-to-devm_kzalloc.patch
and it can be found in the queue-4.8 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 ab21b63e8aedfc73565dd9cdd51eb338341177cb Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed, 28 Sep 2016 11:48:44 +0200
Subject: Revert "usbtmc: convert to devm_kzalloc"

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ab21b63e8aedfc73565dd9cdd51eb338341177cb upstream.

This reverts commit e6c7efdcb76f11b04e3d3f71c8d764ab75c9423b.

Turns out it was totally wrong.  The memory is supposed to be bound to
the kref, as the original code was doing correctly, not the
device/driver binding as the devm_kzalloc() would cause.

This fixes an oops when read would be called after the device was
unbound from the driver.

Reported-by: Ladislav Michl <ladis@linux-mips.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/class/usbtmc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -141,6 +141,7 @@ static void usbtmc_delete(struct kref *k
 	struct usbtmc_device_data *data = to_usbtmc_data(kref);
 
 	usb_put_dev(data->usb_dev);
+	kfree(data);
 }
 
 static int usbtmc_open(struct inode *inode, struct file *filp)
@@ -1379,7 +1380,7 @@ static int usbtmc_probe(struct usb_inter
 
 	dev_dbg(&intf->dev, "%s called\n", __func__);
 
-	data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
+	data = kmalloc(sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 


Patches currently in stable-queue which might be from gregkh@linuxfoundation.org are

queue-4.8/usb-misc-legousbtower-fix-null-pointer-deference.patch
queue-4.8/usb-usbip-vudc-fix-left-shift-overflow.patch
queue-4.8/alsa-hda-adding-one-more-alc255-pin-definition-for-headset-problem.patch
queue-4.8/revert-usbtmc-convert-to-devm_kzalloc.patch
queue-4.8/usb-serial-cp210x-add-id-for-a-juniper-console.patch
queue-4.8/arm64-debug-avoid-resetting-stepping-state-machine-when-tif_singlestep.patch
queue-4.8/staging-fbtft-fix-bug-in-fbtft-core.patch
queue-4.8/using-bug_on-as-an-assert-is-_never_-acceptable.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-06  7:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-06  7:31 Patch "Revert "usbtmc: convert to devm_kzalloc"" has been added to the 4.8-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).