From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Shuah Khan <shuahkh@osg.samsung.com>
Subject: [PATCH 4.9 11/41] usb: usbip: set buffer pointers to NULL after free
Date: Mon, 10 Jul 2017 19:10:44 +0200 [thread overview]
Message-ID: <20170710171052.319309935@linuxfoundation.org> (raw)
In-Reply-To: <20170710171051.866846041@linuxfoundation.org>
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
commit b3b51417d0af63fb9a06662dc292200aed9ea53f upstream.
The usbip stack dynamically allocates the transfer_buffer and
setup_packet of each urb that got generated by the tcp to usb stub code.
As these pointers are always used only once we will set them to NULL
after use. This is done likewise to the free_urb code in vudc_dev.c.
This patch fixes double kfree situations where the usbip remote side
added the URB_FREE_BUFFER.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/usbip/stub_main.c | 4 ++++
drivers/usb/usbip/stub_tx.c | 4 ++++
2 files changed, 8 insertions(+)
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -262,7 +262,11 @@ void stub_device_cleanup_urbs(struct stu
kmem_cache_free(stub_priv_cache, priv);
kfree(urb->transfer_buffer);
+ urb->transfer_buffer = NULL;
+
kfree(urb->setup_packet);
+ urb->setup_packet = NULL;
+
usb_free_urb(urb);
}
}
--- a/drivers/usb/usbip/stub_tx.c
+++ b/drivers/usb/usbip/stub_tx.c
@@ -28,7 +28,11 @@ static void stub_free_priv_and_urb(struc
struct urb *urb = priv->urb;
kfree(urb->setup_packet);
+ urb->setup_packet = NULL;
+
kfree(urb->transfer_buffer);
+ urb->transfer_buffer = NULL;
+
list_del(&priv->list);
kmem_cache_free(stub_priv_cache, priv);
usb_free_urb(urb);
next prev parent reply other threads:[~2017-07-10 17:10 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 17:10 [PATCH 4.9 00/41] 4.9.37-stable review Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 01/41] fs: add a VALID_OPEN_FLAGS Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 02/41] fs: completely ignore unknown open flags Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 03/41] driver core: platform: fix race condition with driver_override Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 04/41] ceph: choose readdir frag based on previous readdir reply Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 05/41] tracing/kprobes: Allow to create probe with a module name starting with a digit Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 06/41] [media] media: entity: Fix stream count check Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 08/41] usb: dwc3: replace %p with %pK Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 09/41] USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 10/41] Add USB quirk for HVR-950q to avoid intermittent device resets Greg Kroah-Hartman
2017-07-10 17:10 ` Greg Kroah-Hartman [this message]
2017-07-10 17:10 ` [PATCH 4.9 12/41] usb: Fix typo in the definition of Endpoint[out]Request Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 13/41] USB: core: fix device node leak Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 14/41] mac80211_hwsim: Replace bogus hrtimer clockid Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 15/41] sysctl: dont print negative flag for proc_douintvec Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 16/41] sysctl: report EINVAL if value is larger than UINT_MAX " Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 17/41] pinctrl: qcom: ipq4019: add missing pingroups for pins > 70 Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 18/41] pinctrl: cherryview: Add a quirk to make Acer Chromebook keyboard work again Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 19/41] pinctrl: sh-pfc: r8a7794: Swap ATA signals Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 20/41] pinctrl: sh-pfc: r8a7791: Fix SCIF2 pinmux data Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 21/41] pinctrl: sh-pfc: r8a7791: Add missing DVC_MUTE signal Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 22/41] pinctrl: sh-pfc: r8a7795: Fix hscif2_clk_b and hscif4_ctrl Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 23/41] pinctrl: meson: meson8b: fix the NAND DQS pins Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 24/41] pinctrl: stm32: Fix bad function call Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 25/41] pinctrl: sunxi: Fix SPDIF function name for A83T Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 26/41] pinctrl: cherryview: Add terminate entry for dmi_system_id tables Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 28/41] pinctrl: sh-pfc: r8a7791: Add missing HSCIF1 pinmux data Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 29/41] pinctrl: sh-pfc: Update info pointer after SoC-specific init Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 32/41] xhci: Limit USB2 port wake support for AMD Promontory hosts Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 33/41] gfs2: Fix glock rhashtable rcu bug Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 34/41] tpm: fix a kernel memory leak in tpm-sysfs.c Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 36/41] x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 37/41] ath10k: override CE5 config for QCA9377 Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 38/41] KEYS: Fix an error code in request_master_key() Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 39/41] crypto: drbg - Fixes panic in wait_for_completion call Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 40/41] RDMA/uverbs: Check port number supplied by user verbs cmds Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 41/41] rt286: add Thinkpad Helix 2 to force_combo_jack_table Greg Kroah-Hartman
2017-07-10 22:31 ` [PATCH 4.9 00/41] 4.9.37-stable review Krister Johansen
2017-07-11 9:53 ` Greg Kroah-Hartman
2017-07-11 0:45 ` Guenter Roeck
2017-07-11 9:54 ` Sumit Semwal
2017-07-11 10:37 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170710171052.319309935@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=shuahkh@osg.samsung.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).