From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Vivek gautam <gautam.vivek@samsung.com>,
Sarah Sharp <sarah.a.sharp@linux.intel.com>,
Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 027/102] usb: xhci: Fix TRB transfer length macro used for Event TRB.
Date: Mon, 8 Apr 2013 10:49:42 +0100 [thread overview]
Message-ID: <1365414657-29191-28-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1365414657-29191-1-git-send-email-luis.henriques@canonical.com>
3.5.7.10 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vivek Gautam <gautam.vivek@samsung.com>
commit 1c11a172cb30492f5f6a82c6e118fdcd9946c34f upstream.
Use proper macro while extracting TRB transfer length from
Transfer event TRBs. Adding a macro EVENT_TRB_LEN (bits 0:23)
for the same, and use it instead of TRB_LEN (bits 0:16) in
case of event TRBs.
This patch should be backported to kernels as old as 2.6.31, that
contain the commit b10de142119a676552df3f0d2e3a9d647036c26a "USB: xhci:
Bulk transfer support". This patch will have issues applying to older
kernels.
Signed-off-by: Vivek gautam <gautam.vivek@samsung.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/usb/host/xhci-ring.c | 24 ++++++++++++------------
drivers/usb/host/xhci.h | 4 ++++
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 6f3043f..848d0bc 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2027,8 +2027,8 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
if (event_trb != ep_ring->dequeue &&
event_trb != td->last_trb)
td->urb->actual_length =
- td->urb->transfer_buffer_length
- - TRB_LEN(le32_to_cpu(event->transfer_len));
+ td->urb->transfer_buffer_length -
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
else
td->urb->actual_length = 0;
@@ -2060,7 +2060,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
/* Maybe the event was for the data stage? */
td->urb->actual_length =
td->urb->transfer_buffer_length -
- TRB_LEN(le32_to_cpu(event->transfer_len));
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
xhci_dbg(xhci, "Waiting for status "
"stage event\n");
return 0;
@@ -2096,7 +2096,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
/* handle completion code */
switch (trb_comp_code) {
case COMP_SUCCESS:
- if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
+ if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
frame->status = 0;
break;
}
@@ -2141,7 +2141,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2]));
}
len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -
- TRB_LEN(le32_to_cpu(event->transfer_len));
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
if (trb_comp_code != COMP_STOP_INVAL) {
frame->actual_length = len;
@@ -2199,7 +2199,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
case COMP_SUCCESS:
/* Double check that the HW transferred everything. */
if (event_trb != td->last_trb ||
- TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
xhci_warn(xhci, "WARN Successful completion "
"on short TX\n");
if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
@@ -2227,18 +2227,18 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
"%d bytes untransferred\n",
td->urb->ep->desc.bEndpointAddress,
td->urb->transfer_buffer_length,
- TRB_LEN(le32_to_cpu(event->transfer_len)));
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)));
/* Fast path - was this the last TRB in the TD for this URB? */
if (event_trb == td->last_trb) {
- if (TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
+ if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
td->urb->actual_length =
td->urb->transfer_buffer_length -
- TRB_LEN(le32_to_cpu(event->transfer_len));
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
if (td->urb->transfer_buffer_length <
td->urb->actual_length) {
xhci_warn(xhci, "HC gave bad length "
"of %d bytes left\n",
- TRB_LEN(le32_to_cpu(event->transfer_len)));
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)));
td->urb->actual_length = 0;
if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
*status = -EREMOTEIO;
@@ -2280,7 +2280,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
if (trb_comp_code != COMP_STOP_INVAL)
td->urb->actual_length +=
TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -
- TRB_LEN(le32_to_cpu(event->transfer_len));
+ EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
}
return finish_td(xhci, td, event_trb, event, ep, status, false);
@@ -2366,7 +2366,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
* transfer type
*/
case COMP_SUCCESS:
- if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
+ if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
break;
if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
trb_comp_code = COMP_SHORT_TX;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index b35bbbe..3e8bf2d 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -972,6 +972,10 @@ struct xhci_transfer_event {
__le32 flags;
};
+/* Transfer event TRB length bit mask */
+/* bits 0:23 */
+#define EVENT_TRB_LEN(p) ((p) & 0xffffff)
+
/** Transfer Event bit fields **/
#define TRB_TO_EP_ID(p) (((p) >> 16) & 0x1f)
--
1.8.1.2
next prev parent reply other threads:[~2013-04-08 9:51 UTC|newest]
Thread overview: 120+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 9:49 [ 3.5.y.z extended stable ] Linux 3.5.7.10 stable review Luis Henriques
2013-04-08 9:49 ` [PATCH 001/102] clockevents: Don't allow dummy broadcast timers Luis Henriques
2013-04-08 9:49 ` [PATCH 002/102] Bluetooth: Add support for Dell[QCA 0cf3:0036] Luis Henriques
2013-04-08 9:49 ` [PATCH 003/102] Bluetooth: Add support for Dell[QCA 0cf3:817a] Luis Henriques
2013-04-08 9:49 ` [PATCH 004/102] ath9k_hw: revert chainmask to user configuration after calibration Luis Henriques
2013-04-08 9:49 ` [PATCH 005/102] ath9k: limit tx path hang check to normal data queues Luis Henriques
2013-04-08 9:49 ` [PATCH 006/102] rtlwifi: usb: add missing freeing of skbuff Luis Henriques
2013-04-08 9:49 ` [PATCH 007/102] net/irda: add missing error path release_sock call Luis Henriques
2013-04-08 9:49 ` [PATCH 008/102] NFSv4: Fix the string length returned by the idmapper Luis Henriques
2013-04-08 9:49 ` [PATCH 009/102] pnfs-block: removing DM device maybe cause oops when call dev_remove Luis Henriques
2013-04-08 9:49 ` [PATCH 010/102] NFSv4.1: Fix a race in pNFS layoutcommit Luis Henriques
2013-04-08 9:49 ` [PATCH 011/102] IPoIB: Fix send lockup due to missed TX completion Luis Henriques
2013-04-08 9:49 ` [PATCH 012/102] SUNRPC: Add barriers to ensure read ordering in rpc_wake_up_task_queue_locked Luis Henriques
2013-04-08 9:49 ` [PATCH 013/102] Nest rename_lock inside vfsmount_lock Luis Henriques
2013-04-08 9:49 ` [PATCH 014/102] vt: synchronize_rcu() under spinlock is not nice Luis Henriques
2013-04-08 9:49 ` [PATCH 015/102] iommu/amd: Make sure dma_ops are set for hotplug devices Luis Henriques
2013-04-08 9:49 ` [PATCH 016/102] i915: initialize CADL in opregion Luis Henriques
2013-04-08 9:49 ` [PATCH 017/102] tracing: Protect tracer flags with trace_types_lock Luis Henriques
2013-04-08 9:49 ` [PATCH 018/102] tracing: Prevent buffer overwrite disabled for latency tracers Luis Henriques
2013-04-08 9:49 ` [PATCH 019/102] nohz: Make tick_nohz_irq_exit() irq safe Luis Henriques
2013-04-08 9:49 ` [PATCH 020/102] udf: Fix bitmap overflow on large filesystems with small block size Luis Henriques
2013-04-08 9:49 ` [PATCH 021/102] xen/blkback: correctly respond to unknown, non-native requests Luis Henriques
2013-04-08 9:49 ` [PATCH 022/102] tty: atmel_serial_probe(): index of atmel_ports[] fix Luis Henriques
2013-04-08 9:49 ` [PATCH 023/102] HID: usbhid: quirk for Realtek Multi-card reader Luis Henriques
2013-04-08 9:49 ` [PATCH 024/102] HID: usbhid: quirk for MSI GX680R led panel Luis Henriques
2013-04-08 9:49 ` [PATCH 025/102] xen-blkback: fix dispatch_rw_block_io() error path Luis Henriques
2013-04-08 9:49 ` [PATCH 026/102] sysfs: handle failure path correctly for readdir() Luis Henriques
2013-04-08 9:49 ` Luis Henriques [this message]
2013-04-08 9:49 ` [PATCH 028/102] staging: comedi: s626: fix continuous acquisition Luis Henriques
2013-04-08 9:49 ` [PATCH 029/102] USB: serial: fix hang when opening port Luis Henriques
2013-04-08 9:49 ` [PATCH 030/102] Btrfs: fix race between mmap writes and compression Luis Henriques
2013-04-08 9:49 ` [PATCH 031/102] Btrfs: fix space leak when we fail to reserve metadata space Luis Henriques
2013-04-08 9:49 ` [PATCH 032/102] Btrfs: limit the global reserve to 512mb Luis Henriques
2013-04-08 9:49 ` [PATCH 033/102] usb: ftdi_sio: Add support for Mitsubishi FX-USB-AW/-BD Luis Henriques
2013-04-08 9:49 ` [PATCH 034/102] Btrfs: don't drop path when printing out tree errors in scrub Luis Henriques
2013-04-08 9:49 ` [PATCH 035/102] USB: serial: add modem-status-change wait queue Luis Henriques
2013-04-08 10:01 ` Johan Hovold
2013-04-08 10:15 ` Luis Henriques
2013-04-08 9:49 ` [PATCH 036/102] USB: ark3116: fix use-after-free in TIOCMIWAIT Luis Henriques
2013-04-08 9:49 ` [PATCH 037/102] USB: ch341: " Luis Henriques
2013-04-08 9:49 ` [PATCH 038/102] USB: cypress_m8: " Luis Henriques
2013-04-08 9:49 ` [PATCH 039/102] USB: f81232: " Luis Henriques
2013-04-08 9:49 ` [PATCH 040/102] USB: ftdi_sio: " Luis Henriques
2013-04-08 9:49 ` [PATCH 041/102] USB: io_edgeport: " Luis Henriques
2013-04-08 9:49 ` [PATCH 042/102] USB: io_ti: " Luis Henriques
2013-04-08 9:49 ` [PATCH 043/102] USB: mct_u232: " Luis Henriques
2013-04-08 9:49 ` [PATCH 044/102] USB: mos7840: fix broken TIOCMIWAIT Luis Henriques
2013-04-08 9:50 ` [PATCH 045/102] USB: mos7840: fix use-after-free in TIOCMIWAIT Luis Henriques
2013-04-08 9:50 ` [PATCH 046/102] USB: oti6858: " Luis Henriques
2013-04-08 9:50 ` [PATCH 047/102] USB: pl2303: " Luis Henriques
2013-04-08 9:50 ` [PATCH 048/102] USB: quatech2: " Luis Henriques
2013-04-08 9:50 ` [PATCH 049/102] USB: spcp8x5: " Luis Henriques
2013-04-08 9:50 ` [PATCH 050/102] USB: ssu100: " Luis Henriques
2013-04-08 9:50 ` [PATCH 051/102] USB: ti_usb_3410_5052: " Luis Henriques
2013-04-08 9:50 ` [PATCH 052/102] Btrfs: use set_nlink if our i_nlink is 0 Luis Henriques
2013-04-08 9:50 ` [PATCH 053/102] Bluetooth: Fix not closing SCO sockets in the BT_CONNECT2 state Luis Henriques
2013-04-08 9:50 ` [PATCH 054/102] mwifiex: cancel cmd timer and free curr_cmd in shutdown process Luis Henriques
2013-04-08 18:03 ` Bing Zhao
2013-04-09 8:51 ` Luis Henriques
2013-04-08 9:50 ` [PATCH 055/102] HID: usbhid: fix build problem Luis Henriques
2013-04-08 9:50 ` [PATCH 056/102] sysfs: fix race between readdir and lseek Luis Henriques
2013-04-08 9:50 ` [PATCH 057/102] net: remove a WARN_ON() in net_enable_timestamp() Luis Henriques
2013-04-08 9:50 ` [PATCH 058/102] sky2: Receive Overflows not counted Luis Henriques
2013-04-08 9:50 ` [PATCH 059/102] sky2: Threshold for Pause Packet is set wrong Luis Henriques
2013-04-08 9:50 ` [PATCH 060/102] tcp: preserve ACK clocking in TSO Luis Henriques
2013-04-08 9:50 ` [PATCH 061/102] tcp: undo spurious timeout after SACK reneging Luis Henriques
2013-04-08 9:50 ` [PATCH 062/102] 8021q: fix a potential use-after-free Luis Henriques
2013-04-08 9:50 ` [PATCH 063/102] thermal: shorten too long mcast group name Luis Henriques
2013-04-08 9:50 ` [PATCH 064/102] genetlink: trigger BUG_ON if a group name is too long Luis Henriques
2013-04-08 9:50 ` [PATCH 065/102] unix: fix a race condition in unix_release() Luis Henriques
2013-04-08 9:50 ` [PATCH 066/102] bonding: remove already created master sysfs link on failure Luis Henriques
2013-04-08 9:50 ` [PATCH 067/102] bonding: fix miimon and arp_interval delayed work race conditions Luis Henriques
2013-04-08 9:50 ` [PATCH 068/102] bonding: fix disabling of arp_interval and miimon Luis Henriques
2013-04-08 9:50 ` [PATCH 069/102] drivers: net: ethernet: davinci_emac: use netif_wake_queue() while restarting tx queue Luis Henriques
2013-04-08 9:50 ` [PATCH 070/102] drivers: net: ethernet: cpsw: " Luis Henriques
2013-04-08 9:50 ` [PATCH 071/102] net: fix *_DIAG_MAX constants Luis Henriques
2013-04-08 9:50 ` [PATCH 072/102] aoe: reserve enough headroom on skbs Luis Henriques
2013-04-08 9:50 ` [PATCH 073/102] atl1e: drop pci-msi support because of packet corruption Luis Henriques
2013-04-08 9:50 ` [PATCH 074/102] DM9000B: driver initialization upgrade Luis Henriques
2013-04-08 9:50 ` [PATCH 075/102] ipv6: don't accept multicast traffic with scope 0 Luis Henriques
2013-04-08 9:50 ` [PATCH 076/102] ipv6: fix bad free of addrconf_init_net Luis Henriques
2013-04-08 9:50 ` [PATCH 077/102] ipv6: don't accept node local multicast traffic from the wire Luis Henriques
2013-04-08 9:50 ` [PATCH 078/102] ks8851: Fix interpretation of rxlen field Luis Henriques
2013-04-08 9:50 ` [PATCH 079/102] net: add a synchronize_net() in netdev_rx_handler_unregister() Luis Henriques
2013-04-08 9:50 ` [PATCH 080/102] pch_gbe: fix ip_summed checksum reporting on rx Luis Henriques
2013-04-08 9:50 ` [PATCH 081/102] smsc75xx: fix jumbo frame support Luis Henriques
2013-04-08 9:50 ` [PATCH 082/102] bonding: get netdev_rx_handler_unregister out of locks Luis Henriques
2013-04-08 9:50 ` [PATCH 083/102] mac80211: always synchronize_net() during station removal Luis Henriques
2013-04-08 9:50 ` [PATCH 084/102] regmap: cache Fix regcache-rbtree sync Luis Henriques
2013-04-08 9:50 ` [PATCH 085/102] iwlwifi: dvm: don't send HCMD in restart flow Luis Henriques
2013-04-08 9:50 ` [PATCH 086/102] nfsd4: reject "negative" acl lengths Luis Henriques
2013-04-08 9:50 ` [PATCH 087/102] can: sja1000: fix define conflict on SH Luis Henriques
2013-04-08 9:50 ` [PATCH 088/102] b43: N-PHY: increase initial value of "mind" in RSSI calibration Luis Henriques
2013-04-08 9:50 ` [PATCH 089/102] b43: A fix for DMA transmission sequence errors Luis Henriques
2013-04-08 9:50 ` [PATCH 090/102] b43: N-PHY: use more bits for offset in RSSI calibration Luis Henriques
2013-04-08 9:50 ` [PATCH 091/102] tg3: fix length overflow in VPD firmware parsing Luis Henriques
2013-04-08 9:50 ` [PATCH 092/102] tile: expect new initramfs name from hypervisor file system Luis Henriques
2013-04-08 9:50 ` [PATCH 093/102] virtio: console: rename cvq_lock to c_ivq_lock Luis Henriques
2013-04-08 9:50 ` [PATCH 094/102] virtio: console: add locking around c_ovq operations Luis Henriques
2013-04-08 9:50 ` [PATCH 095/102] ARM: cns3xxx: fix mapping of private memory region Luis Henriques
2013-04-08 9:50 ` [PATCH 096/102] loop: prevent bdev freeing while device in use Luis Henriques
2013-04-08 9:50 ` [PATCH 097/102] efivars: explicitly calculate length of VariableName Luis Henriques
2013-04-09 22:45 ` Ben Hutchings
2013-04-10 9:35 ` Luis Henriques
2013-04-10 10:27 ` Lingzhu Xiang
2013-04-10 12:17 ` Luis Henriques
2013-04-10 15:57 ` Seiji Aguchi
2013-04-11 9:12 ` Luis Henriques
2013-04-16 10:33 ` Luis Henriques
2013-04-17 4:37 ` Lingzhu Xiang
2013-04-17 11:56 ` Andy Whitcroft
2013-04-17 12:13 ` Lingzhu Xiang
2013-04-17 13:28 ` Luis Henriques
2013-04-18 3:27 ` Lingzhu Xiang
2013-04-18 8:58 ` Luis Henriques
2013-04-08 9:50 ` [PATCH 098/102] efivars: Handle duplicate names from get_next_variable() Luis Henriques
2013-04-08 9:50 ` [PATCH 099/102] thermal: return an error on failure to register thermal class Luis Henriques
2013-04-08 9:50 ` [PATCH 100/102] UBIFS: make space fixup work in the remount case Luis Henriques
2013-04-08 9:50 ` [PATCH 101/102] reiserfs: Fix warning and inode leak when deleting inode with xattrs Luis Henriques
2013-04-08 9:50 ` [PATCH 102/102] mm: prevent mmap_cache race in find_vma() Luis Henriques
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=1365414657-29191-28-git-send-email-luis.henriques@canonical.com \
--to=luis.henriques@canonical.com \
--cc=gautam.vivek@samsung.com \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sarah.a.sharp@linux.intel.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).