Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707806

[PATCH 4.4 28/58] mcs7780: Fix initialization when CONFIG_VMAP_STACK is enabled

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 28/58] mcs7780: Fix initialization when CONFIG_VMAP_STACK is enabled
Date 2017-08-09 21:50 +0200
Message-ID <ucF9r-3gT-87@gated-at.bofh.it> (permalink)
References <ucF9n-3gT-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Jarosch <thomas.jarosch@intra2net.com>


[ Upstream commit 9476d393667968b4a02afbe9d35a3558482b943e ]

DMA transfers are not allowed to buffers that are on the stack.
Therefore allocate a buffer to store the result of usb_control_message().

Fixes these bugreports:
https://bugzilla.kernel.org/show_bug.cgi?id=195217

https://bugzilla.redhat.com/show_bug.cgi?id=1421387
https://bugzilla.redhat.com/show_bug.cgi?id=1427398

Shortened kernel backtrace from 4.11.9-200.fc25.x86_64:
kernel: ------------[ cut here ]------------
kernel: WARNING: CPU: 3 PID: 2957 at drivers/usb/core/hcd.c:1587
kernel: transfer buffer not dma capable
kernel: Call Trace:
kernel: dump_stack+0x63/0x86
kernel: __warn+0xcb/0xf0
kernel: warn_slowpath_fmt+0x5a/0x80
kernel: usb_hcd_map_urb_for_dma+0x37f/0x570
kernel: ? try_to_del_timer_sync+0x53/0x80
kernel: usb_hcd_submit_urb+0x34e/0xb90
kernel: ? schedule_timeout+0x17e/0x300
kernel: ? del_timer_sync+0x50/0x50
kernel: ? __slab_free+0xa9/0x300
kernel: usb_submit_urb+0x2f4/0x560
kernel: ? urb_destroy+0x24/0x30
kernel: usb_start_wait_urb+0x6e/0x170
kernel: usb_control_msg+0xdc/0x120
kernel: mcs_get_reg+0x36/0x40 [mcs7780]
kernel: mcs_net_open+0xb5/0x5c0 [mcs7780]
...

Regression goes back to 4.9, so it's a good candidate for -stable.
Though it's the decision of the maintainer.

Thanks to Dan Williams for adding the "transfer buffer not dma capable"
warning in the first place. It instantly pointed me in the right direction.

Patch has been tested with transferring data from a Polar watch.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/irda/mcs7780.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -141,9 +141,19 @@ static int mcs_set_reg(struct mcs_cb *mc
 static int mcs_get_reg(struct mcs_cb *mcs, __u16 reg, __u16 * val)
 {
 	struct usb_device *dev = mcs->usbdev;
-	int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
-				  MCS_RD_RTYPE, 0, reg, val, 2,
-				  msecs_to_jiffies(MCS_CTRL_TIMEOUT));
+	void *dmabuf;
+	int ret;
+
+	dmabuf = kmalloc(sizeof(__u16), GFP_KERNEL);
+	if (!dmabuf)
+		return -ENOMEM;
+
+	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
+			      MCS_RD_RTYPE, 0, reg, dmabuf, 2,
+			      msecs_to_jiffies(MCS_CTRL_TIMEOUT));
+
+	memcpy(val, dmabuf, sizeof(__u16));
+	kfree(dmabuf);
 
 	return ret;
 }

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/58] 4.4.81-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 02/58] libata: array underflow in ata_find_dev() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 12/58] target: Avoid mappedlun symlink creation during lun shutdown Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 29/58] openvswitch: fix potential out of bound access in parse_ct Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 51/58] virtio_blk: fix panic in initialization error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 55/58] signal: protect SIGNAL_UNKILLABLE from unintentional clearing. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 49/58] scsi: qla2xxx: Get mutex lock before checking optrom_state Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 15/58] iscsi-target: Fix initial login PDU asynchronous socket close OOPs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
    Re: [PATCH 4.4 15/58] iscsi-target: Fix initial login PDU  asynchronous socket close OOPs Ben Hutchings <ben.hutchings@codethink.co.uk> - 2017-08-11 18:20 +0200
  [PATCH 4.4 33/58] dccp: fix a memleak that dccp_ipv6 doesnt put reqsk properly Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 45/58] net: phy: dp83867: fix irq generation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 53/58] mm, slab: make sure that KMALLOC_MAX_SIZE will fit into MAX_ORDER Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 57/58] ipv4: Should use consistent conditional judgement for ip fragment in __ip_append_data and ip_finish_output Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 18/58] mm, mprotect: flush TLB if potentially racing with a parallel reclaim leaving stale TLB entries Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
    Re: [PATCH 4.4 18/58] mm, mprotect: flush TLB if potentially racing  with a parallel reclaim leaving stale TLB entries Ben Hutchings <ben.hutchings@codethink.co.uk> - 2017-08-11 19:50 +0200
  [PATCH 4.4 23/58] ipv4: ipv6: initialize treq->txhash in cookie_v[46]_check() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 52/58] ARM: 8632/1: ftrace: fix syscall name matching Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 04/58] ALSA: hda - Fix speaker output from VAIO VPCL14M1R Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 37/58] sctp: fix the check for _sctp_walk_params and _sctp_walk_errors Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 48/58] phy state machine: failsafe leave invalid RUNNING state Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 28/58] mcs7780: Fix initialization when CONFIG_VMAP_STACK is enabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 03/58] workqueue: restore WQ_UNBOUND/max_active==1 to be ordered Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 42/58] sparc64: Prevent perf from running during super critical sections Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
    Re: [PATCH 4.4 42/58] sparc64: Prevent perf from running during  super critical sections Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-10 18:30 +0200
  [PATCH 4.4 46/58] tg3: Fix race condition in tg3_get_stats64(). Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 21:50 +0200
  [PATCH 4.4 31/58] ipv6: Dont increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 27/58] rtnetlink: allocate more memory for dev_set_mac_address() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 10/58] ARM: dts: armada-38x: Fix irq type for pca955 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 20/58] f2fs: sanity check checkpoint segno and blkoff Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 21/58] drm: rcar-du: fix backport bug Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 38/58] net/mlx5: Fix command bad flow on command entry allocation failure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 35/58] dccp: fix a memleak for dccp_feat_init err process Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 34/58] dccp: fix a memleak that dccp_ipv4 doesnt put reqsk properly Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 24/58] net: Zero terminate ifr_name in dev_ifname(). Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 14/58] iscsi-target: Fix early sk_data_ready LOGIN_FLAGS_READY race Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 09/58] ext4: fix overflow caused by missing cast in ext4_resize_fs() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 22/58] [media] saa7164: fix double fetch PCIe access condition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 26/58] ipv4: initialize fib_trie prior to register_netdev_notifier call. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 05/58] ASoC: do not close shared backend dailink Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  [PATCH 4.4 25/58] ipv6: avoid overflow of offset in ip6_find_1stfragopt Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 22:00 +0200
  Re: [PATCH 4.4 00/58] 4.4.81-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-08-10 02:10 +0200
  Re: [PATCH 4.4 00/58] 4.4.81-stable review Guenter Roeck <linux@roeck-us.net> - 2017-08-10 02:40 +0200
    Re: [PATCH 4.4 00/58] 4.4.81-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-10 18:20 +0200
      Re: [PATCH 4.4 00/58] 4.4.81-stable review Guenter Roeck <linux@roeck-us.net> - 2017-08-10 19:40 +0200
    Re: [PATCH 4.4 00/58] 4.4.81-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-10 18:30 +0200
  Re: [PATCH 4.4 00/58] 4.4.81-stable review Guenter Roeck <linux@roeck-us.net> - 2017-08-10 03:00 +0200
    Re: [PATCH 4.4 00/58] 4.4.81-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-10 18:20 +0200

csiph-web