3.10.5-stable review
Subsystems (58)
Greg Kroah-Hartman
maintainercover 3.10.5-stable review
This is the start of the stable review cycle for the 3.10.5 release. There are 99 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 4 10:00:45 UTC 2013. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.5-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.5-rc1
Yinghai Lu <[email protected]>
x86: Fix /proc/mtrr with base/size more than 44bits
Xiong Zhang <[email protected]>
drm/i915: Correct obj->mm_list link to dev_priv->dev_priv->mm.inactive_list
Michael Witten <[email protected]>
perf tools: Revert regression in configuration of Python support
Nicholas Bellinger <[email protected]>
iscsi-target: Fix iscsit_sequence_cmd reject handling for iser
Nicholas Bellinger <[email protected]>
iscsi-target: Fix iscsit_add_reject* usage for iser
Sergey Senozhatsky <[email protected]>
radeon kms: do not flush uninitialized hotplug work
David Vrabel <[email protected]>
xen/evtchn: avoid a deadlock when unbinding an event channel
Al Viro <[email protected]>
livelock avoidance in sget()
Gianluca Anzolin <[email protected]>
tty_port: Fix refcounting leak in tty_port_tty_hangup()
Oleg Nesterov <[email protected]>
mm: mempolicy: fix mbind_range() && vma_adjust() interaction
Rong Wang <[email protected]>
usb: gadget: udc-core: fix the typo of udc state attribute
Rick Farina (Zero_Chaos) <[email protected]>
USB: serial: ftdi_sio: add more RT Systems ftdi devices
Larry Finger <[email protected]>
rtlwifi: Initialize power-setting callback for USB devices
Alex Deucher <[email protected]>
drm/radeon/atom: initialize more atom interpretor elements to 0
Alex Deucher <[email protected]>
drm/radeon: fix audio dto programming on DCE4+
Maarten Lankhorst <[email protected]>
drm/nouveau: fix semaphore dmabuf obj
Ben Widawsky <[email protected]>
drm/i915: fix missed hunk after GT access breakage
Daniel Vetter <[email protected]>
drm/i915: fix up gt init sequence fallout
Chris Wilson <[email protected]>
drm/i915: Serialize almost all register access
Kamal Mostafa <[email protected]>
drm/i915: quirk no PCH_PWM_ENABLE for Dell XPS13 backlight
Daniel Vetter <[email protected]>
drm/i915: correctly restore fences with objects attached
Chris Wilson <[email protected]>
drm/i915: Fix dereferencing invalid connectors in is_crtc_connector_off()
Konstantin Khlebnikov <[email protected]>
drm/i915: fix long-standing SNB regression in power consumption after resume v2
Chris Wilson <[email protected]>
drm/i915: Fix incoherence with fence updates on Sandybridge+
Guenter Roeck <[email protected]>
Partially revert "drm/i915: unconditionally use mt forcewake on hsw/ivb"
Chris Wilson <[email protected]>
drm/i915: Fix write-read race with multiple rings
Daniel Vetter <[email protected]>
drm/i915: fix up ring cleanup for the i830/i845 CS tlb w/a
Alex Deucher <[email protected]>
drm/radeon: improve dac adjust heuristics for legacy pdac
Mark Kettenis <[email protected]>
drm/radeon: fix combios tables on older cards
Ondrej Zary <[email protected]>
drm/radeon: Another card with wrong primary dac adj
Alex Deucher <[email protected]>
drm/radeon: fix endian issues with DP handling (v3)
Alex Deucher <[email protected]>
drm/radeon: allow selection of alignment in the sub-allocator
Christian König <[email protected]>
drm/radeon: fix UVD fence emit
Alex Deucher <[email protected]>
drm/radeon/hdmi: make sure we have an afmt block assigned
Mikulas Patocka <[email protected]>
dm verity: fix inability to use a few specific devices sizes
Mikulas Patocka <[email protected]>
dm ioctl: set noio flag to avoid __vmalloc deadlock
Hannes Reinecke <[email protected]>
dm mpath: fix ioctl deadlock when no paths
Lan Tianyu <[email protected]>
ACPI / video: ignore BIOS initial backlight value for Fujitsu E753
Toshi Kani <[email protected]>
ACPI / memhotplug: Fix a stale pointer in error path
Rafael J. Wysocki <[email protected]>
ACPI / scan: Do not try to attach scan handlers to devices having them
Rafael J. Wysocki <[email protected]>
ACPI / scan: Always call acpi_bus_scan() for bus check notifications
Daniel Mack <[email protected]>
regmap: cache: bail in regmap_async_complete() for bus-less maps
K. Y. Srinivasan <[email protected]>
Drivers: hv: balloon: Do not post pressure status if interrupted
K. Y. Srinivasan <[email protected]>
Drivers: hv: balloon: Fix a bug in the hot-add code
K. Y. Srinivasan <[email protected]>
Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration
Harshula Jayasuriya <[email protected]>
nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file
Anton Blanchard <[email protected]>
powerpc/modules: Module CRC relocation fix causes perf issues
Vakul Garg <[email protected]>
crypto: caam - Fixed the memory out of bound overwrite issue
Dan Carpenter <[email protected]>
svcrdma: underflow issue in decode_write_list()
Tejun Heo <[email protected]>
libata: make it clear that sata_inic162x is experimental
Youquan Song <[email protected]>
ata: Fix DVD not dectected at some platform with Wellsburg PCH
NeilBrown <[email protected]>
md/raid10: remove use-after-free bug.
NeilBrown <[email protected]>
md/raid5: fix interaction of 'replace' and 'recovery'.
NeilBrown <[email protected]>
md/raid1: fix bio handling problems in process_checks()
NeilBrown <[email protected]>
md: Remove recent change which allows devices to skip recovery.
Kees Cook <[email protected]>
x86: make sure IDT is page aligned
H. Peter Anvin <[email protected]>
x86, suspend: Handle CPUs which fail to #GP on RDMSR
Konrad Rzeszutek Wilk <[email protected]>
xen/blkback: Check device permissions before allowing OP_DISCARD
Jan Beulich <[email protected]>
xen-netfront: pull on receive skb may need to happen earlier
Josef Bacik <[email protected]>
Btrfs: re-add root to dead root list if we stop dropping it
Josef Bacik <[email protected]>
Btrfs: fix lock leak when resuming snapshot deletion
Stefan Behrens <[email protected]>
Btrfs: fix wrong write offset when replacing a device
Dirk Brandewie <[email protected]>
cpufreq / intel_pstate: Change to scale off of max P-state
Karlis Ogsts <[email protected]>
staging: android: logger: Correct write offset reset on error
Ian Abbott <[email protected]>
staging: comedi: COMEDI_CANCEL ioctl should wake up read/write
Ian Abbott <[email protected]>
staging: comedi: fix a race between do_cmd_ioctl() and read/write
Alan Stern <[email protected]>
USB: global suspend and remote wakeup don't mix
William Gulland <[email protected]>
usb: Clear both buffers when clearing a control transfer TT buffer.
Jóhann B. Guðmundsson <[email protected]>
USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga
Johan Hovold <[email protected]>
USB: ti_usb_3410_5052: fix dynamic-id matching
Felipe Balbi <[email protected]>
usb: dwc3: gadget: don't prevent gadget from being probed if we fail
Huang Rui <[email protected]>
usb: dwc3: fix wrong bit mask in dwc3_event_type
Ruchika Kharwar <[email protected]>
usb: dwc3: fix the error returned with usb3_phy failure
Johan Hovold <[email protected]>
USB: mos7840: fix memory leak in open
Roger Quadros <[email protected]>
USB: EHCI: Fix resume signalling on remote wakeup
Sarah Sharp <[email protected]>
xhci: Avoid NULL pointer deref when host dies.
Oleksij Rempel <[email protected]>
xhci: fix null pointer dereference on ring_doorbell_for_active_rings
George Cherian <[email protected]>
usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0
Steven Rostedt (Red Hat) <[email protected]>
tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus()
Oleg Nesterov <[email protected]>
tracing: Kill the unbalanced tr->ref++ in tracing_buffers_open()
Alexander Z Lam <[email protected]>
tracing: Miscellaneous fixes for trace_array ref counting
Alexander Z Lam <[email protected]>
tracing: Fix error handling to ensure instances can always be removed
Saurav Kashyap <[email protected]>
SCSI: qla2xxx: Properly set the tagging for commands.
Ewan D. Milne <[email protected]>
SCSI: sd: fix crash when UA received on DIF enabled device
Jeff Skirvin <[email protected]>
SCSI: isci: Fix a race condition in the SSP task management path
Gregory CLEMENT <[email protected]>
ARM: 7722/1: zImage: Convert 32bits memory size and address from ATAG to 64bits DTB
Nicolin Chen <[email protected]>
ASoC: wm8962: Remove remaining direct register cache accesses
Richard Zhao <[email protected]>
ASoC: tegra: correct playback_dma_data setup
Chih-Chung Chang <[email protected]>
ASoC: max98088 - fix element type of the register cache.
Fabio Estevam <[email protected]>
ASoC: sglt5000: Fix the default value of CHIP_SSS_CTRL
Clemens Ladisch <[email protected]>
firewire: fix libdc1394/FlyCap2 iso event regression
David Henningsson <[email protected]>
ALSA: hda - Guess what, it's two more Dell headset mic quirks
David Henningsson <[email protected]>
ALSA: hda - Yet another Dell headset mic quirk
Ren Bigcren <[email protected]>
USB: storage: Add MicroVault Flash Drive to unusual_devs
Nicholas Bellinger <[email protected]>
iscsi-target: Fix ISCSI_OP_SCSI_TMFUNC handling for iser
Nicholas Bellinger <[email protected]>
iser-target: Fix session reset bug with RDMA_CM_EVENT_DISCONNECTED
Joern Engel <[email protected]>
iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow
Nicholas Bellinger <[email protected]>
iser-target: Fix isert_put_reject payload buffer post
Vineet Gupta <[email protected]>
mm: fix the TLB range flushed when __tlb_remove_page() runs out of slots
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/compressed/atags_to_fdt.c | 44 +++- arch/powerpc/include/asm/module.h | 5 +- arch/powerpc/kernel/vmlinux.lds.S | 3 - arch/x86/kernel/acpi/sleep.c | 18 +- arch/x86/kernel/cpu/mtrr/generic.c | 21 +- arch/x86/kernel/cpu/mtrr/main.c | 16 +- arch/x86/kernel/head_64.S | 2 +- drivers/acpi/acpi_memhotplug.c | 1 + drivers/acpi/scan.c | 13 +- drivers/acpi/video.c | 8 + drivers/ata/Kconfig | 2 +- drivers/ata/ata_piix.c | 2 +- drivers/ata/sata_inic162x.c | 14 ++ drivers/base/regmap/regmap.c | 2 +- drivers/block/xen-blkback/blkback.c | 13 +- drivers/cpufreq/intel_pstate.c | 12 +- drivers/crypto/caam/caamhash.c | 2 +- drivers/firewire/core-cdev.c | 3 + drivers/firewire/ohci.c | 10 +- drivers/gpu/drm/i915/i915_dma.c | 17 +- drivers/gpu/drm/i915/i915_drv.c | 13 +- drivers/gpu/drm/i915/i915_drv.h | 4 +- drivers/gpu/drm/i915/i915_gem.c | 54 ++++- drivers/gpu/drm/i915/intel_display.c | 39 +++- drivers/gpu/drm/i915/intel_panel.c | 3 +- drivers/gpu/drm/i915/intel_pm.c | 45 +++- drivers/gpu/drm/i915/intel_ringbuffer.c | 9 +- drivers/gpu/drm/nouveau/nv17_fence.c | 2 +- drivers/gpu/drm/nouveau/nv50_fence.c | 14 +- drivers/gpu/drm/radeon/atom.c | 5 + drivers/gpu/drm/radeon/atombios_dp.c | 43 +++- drivers/gpu/drm/radeon/evergreen_hdmi.c | 8 +- drivers/gpu/drm/radeon/r600.c | 2 +- drivers/gpu/drm/radeon/r600_hdmi.c | 6 + drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_combios.c | 159 +++++--------- drivers/gpu/drm/radeon/radeon_gart.c | 1 + drivers/gpu/drm/radeon/radeon_irq_kms.c | 9 +- drivers/gpu/drm/radeon/radeon_object.h | 2 +- drivers/gpu/drm/radeon/radeon_ring.c | 1 + drivers/gpu/drm/radeon/radeon_sa.c | 7 +- drivers/hv/hv_balloon.c | 21 +- drivers/infiniband/ulp/isert/ib_isert.c | 119 +++++++--- drivers/infiniband/ulp/isert/ib_isert.h | 1 + drivers/md/dm-ioctl.c | 3 + drivers/md/dm-mpath.c | 8 +- drivers/md/dm-verity.c | 5 +- drivers/md/dm.c | 9 +- drivers/md/md.c | 14 -- drivers/md/raid1.c | 53 +++-- drivers/md/raid10.c | 8 +- drivers/md/raid5.c | 15 +- drivers/md/raid5.h | 1 + drivers/net/wireless/rtlwifi/pci.c | 13 -- drivers/net/wireless/rtlwifi/ps.c | 12 + drivers/net/wireless/rtlwifi/ps.h | 1 + drivers/net/wireless/rtlwifi/usb.c | 2 + drivers/net/xen-netfront.c | 31 ++- drivers/scsi/isci/task.c | 9 +- drivers/scsi/qla2xxx/qla_iocb.c | 11 +- drivers/scsi/sd.c | 22 +- drivers/staging/android/logger.c | 4 +- drivers/staging/comedi/comedi_fops.c | 32 ++- drivers/target/iscsi/iscsi_target.c | 313 ++++++++++++--------------- drivers/target/iscsi/iscsi_target.h | 2 +- drivers/target/iscsi/iscsi_target_configfs.c | 2 +- drivers/target/iscsi/iscsi_target_core.h | 4 +- drivers/target/iscsi/iscsi_target_erl0.c | 8 +- drivers/target/iscsi/iscsi_target_erl1.c | 26 +-- drivers/target/iscsi/iscsi_target_util.c | 27 ++- drivers/target/iscsi/iscsi_target_util.h | 3 +- drivers/tty/tty_port.c | 5 +- drivers/usb/core/hub.c | 48 +++- drivers/usb/core/hub.h | 3 + drivers/usb/dwc3/core.c | 2 +- drivers/usb/dwc3/core.h | 4 +- drivers/usb/dwc3/gadget.c | 1 + drivers/usb/gadget/udc-core.c | 2 +- drivers/usb/host/ehci-hub.c | 1 + drivers/usb/host/xhci-pci.c | 1 - drivers/usb/host/xhci-ring.c | 2 +- drivers/usb/host/xhci.c | 13 +- drivers/usb/misc/sisusbvga/sisusb.c | 1 + drivers/usb/serial/ftdi_sio.c | 31 ++- drivers/usb/serial/ftdi_sio_ids.h | 34 ++- drivers/usb/serial/mos7840.c | 25 ++- drivers/usb/serial/ti_usb_3410_5052.c | 2 +- drivers/usb/storage/unusual_devs.h | 7 + drivers/xen/evtchn.c | 21 +- fs/btrfs/extent-tree.c | 13 ++ fs/btrfs/scrub.c | 2 +- fs/nfsd/vfs.c | 5 +- fs/super.c | 25 +-- include/linux/firewire.h | 1 + include/target/iscsi/iscsi_transport.h | 9 +- include/uapi/linux/firewire-cdev.h | 4 +- kernel/trace/trace.c | 33 ++- kernel/trace/trace_events.c | 21 +- mm/memory.c | 9 +- mm/mempolicy.c | 6 +- mm/mmap.c | 2 +- net/sunrpc/xprtrdma/svc_rdma_marshal.c | 20 +- sound/pci/hda/patch_realtek.c | 3 + sound/soc/codecs/max98088.c | 2 +- sound/soc/codecs/sgtl5000.c | 2 +- sound/soc/codecs/wm8962.c | 24 +- sound/soc/tegra/tegra20_ac97.c | 6 +- sound/soc/tegra/tegra20_spdif.c | 4 +- tools/hv/hv_kvp_daemon.c | 5 +- tools/perf/config/utilities.mak | 2 +- 111 files changed, 1121 insertions(+), 698 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/99 mm: fix the TLB range flushed when __tlb_remove_page() runs out of slots
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit e6c495a96ce02574e765d5140039a64c8d4e8c9e upstream.
zap_pte_range loops from @addr to @end. In the middle, if it runs out of batching slots, TLB entries needs to be flushed for @start to @interim, NOT @interim to @end.
Since ARC port doesn't use page free batching I can't test it myself but this seems like the right thing to do.
Observed this when working on a fix for the issue at thread:
http://www.spinics.net/lists/linux-arch/msg21736.html
--- mm/memory.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
mm/memory.c +6 -3
@@ -1101,6 +1101,7 @@ static unsigned long zap_pte_range(strucspinlock_t *ptl;pte_t *start_pte;pte_t *pte; +unsigned long range_start = addr; again:init_rss_vec (rss);
@@ -1206,12 +1207,14 @@ again: force_flush =0 ;#ifdef HAVE_GENERIC_MMU_GATHER - tlb->start = addr; - tlb->end = end; + tlb->start = range_start; + tlb->end = addr;#endif tlb_flush_mmu (tlb); -if (addr != end) +if (addr != end) { + range_start = addr; goto again; + } }return addr;
Greg Kroah-Hartman
maintainerPATCH 2/99 iser-target: Fix isert_put_reject payload buffer post
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 3df8f68aaf7ebe3d136a22262b41b350b0a1858b upstream.
This patch adds the missing isert_put_reject() logic to post a outgoing payload buffer to hold the 48 bytes of original PDU header request payload for the rejected cmd.
It also fixes ISTATE_SEND_REJECT handling in isert_response_completion() -> isert_do_control_comp() code, and drops incorrect iscsi_cmd_t->reject_comp usage.
--- drivers/infiniband/ulp/isert/ib_isert.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +22 -4
@@ -1222,6 +1222,9 @@ isert_put_cmd(struct isert_cmd *isert_cm* associated cmd->se_cmd needs to be released. */ if (cmd->se_cmd.se_tfo !=NULL ) { +pr_debug ("Calling transport_generic_free_cmd from" +" isert_put_cmd for 0x%02x\n" , + cmd->iscsi_opcode);transport_generic_free_cmd (&cmd->se_cmd,0 );break ; }
@@ -1318,8 +1321,8 @@ isert_do_control_comp(struct work_structatomic_dec (&isert_conn->post_send_buf_count); cmd->i_state =ISTATE_SENT_STATUS ; -complete (&cmd->reject_comp);isert_completion_put (&isert_cmd->tx_desc, isert_cmd, ib_dev); +break ;case ISTATE_SEND_LOGOUTRSP :pr_debug ("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n" );/*
@@ -1345,7 +1348,8 @@ isert_response_completion(struct iser_txstruct iscsi_cmd *cmd = &isert_cmd->iscsi_cmd;if (cmd->i_state ==ISTATE_SEND_TASKMGTRSP || - cmd->i_state ==ISTATE_SEND_LOGOUTRSP ) { + cmd->i_state ==ISTATE_SEND_LOGOUTRSP || + cmd->i_state ==ISTATE_SEND_REJECT ) {isert_unmap_tx_desc (tx_desc, ib_dev);INIT_WORK (&isert_cmd->comp_work, isert_do_control_comp);
@@ -1637,11 +1641,25 @@ isert_put_reject(struct iscsi_cmd *cmd, struct isert_cmd, iscsi_cmd);struct isert_conn *isert_conn = (struct isert_conn *)conn->context;struct ib_send_wr *send_wr = &isert_cmd->tx_desc.send_wr; +struct ib_device *ib_dev = isert_conn->conn_cm_id->device; +struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1 ]; +struct iscsi_reject *hdr = + (struct iscsi_reject *)&isert_cmd->tx_desc.iscsi_header;isert_create_send_desc (isert_conn, isert_cmd, &isert_cmd->tx_desc); -iscsit_build_reject (cmd, conn, (struct iscsi_reject *) - &isert_cmd->tx_desc.iscsi_header); +iscsit_build_reject (cmd, conn, hdr);isert_init_tx_hdrs (isert_conn, &isert_cmd->tx_desc); + +hton24 (hdr->dlength,ISCSI_HDR_LEN ); + isert_cmd->sense_buf_dma =ib_dma_map_single (ib_dev, + (void *)cmd->buf_ptr,ISCSI_HDR_LEN , +DMA_TO_DEVICE ); + isert_cmd->sense_buf_len =ISCSI_HDR_LEN ; + tx_dsg->addr = isert_cmd->sense_buf_dma; + tx_dsg->length =ISCSI_HDR_LEN ; + tx_dsg->lkey = isert_conn->conn_mr->lkey; + isert_cmd->tx_desc.num_sge =2 ; +isert_init_send_wr (isert_cmd, send_wr);pr_debug ("Posting Reject IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n" );
Greg Kroah-Hartman
maintainerPATCH 3/99 iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joern Engel <[email protected]>
commit 0fbfc46fb0b2f543a8b539e94c6c293ebc0b05a6 upstream.
This patch fixes a potential buffer overflow while processing iscsi_node_auth input for configfs attributes within NodeACL tfc_tpg_nacl_auth_cit context.
--- drivers/target/iscsi/iscsi_target_configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target_configfs.c +1 -1
@@ -474,7 +474,7 @@ static ssize_t __iscsi_##prefix##_store_if (!capable (CAP_SYS_ADMIN )) \return -EPERM ; \ \ -snprintf (auth->name,PAGE_SIZE ,"%s" , page); \ +snprintf (auth->name,sizeof (auth->name),"%s" , page); \if (!strncmp ("NULL" , auth->name,4 )) \ auth->naf_flags &= ~flags; \else \
Greg Kroah-Hartman
maintainerPATCH 4/99 iser-target: Fix session reset bug with RDMA_CM_EVENT_DISCONNECTED
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit b2cb96494d83b894a43ba8b9023eead8ff50684b upstream.
This patch addresses a bug where RDMA_CM_EVENT_DISCONNECTED may occur before the connection shutdown has been completed by rx/tx threads, that causes isert_free_conn() to wait indefinately on ->conn_wait.
This patch allows isert_disconnect_work code to invoke rdma_disconnect when isert_disconnect_work() process context is started by client session reset before isert_free_conn() code has been reached.
It also adds isert_conn->conn_mutex protection for ->state within isert_disconnect_work(), isert_cq_comp_err() and isert_free_conn() code, along with isert_check_state() for wait_event usage.
(v2: Add explicit iscsit_cause_connection_reinstatement call
during isert_disconnect_work() to force conn reset)
--- drivers/infiniband/ulp/isert/ib_isert.c | 70 ++++++++++++++++++++++++++----- drivers/infiniband/ulp/isert/ib_isert.h | 1 drivers/target/iscsi/iscsi_target_erl0.c | 1 include/target/iscsi/iscsi_transport.h | 4 + 4 files changed, 66 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +60 -10
@@ -388,6 +388,7 @@ isert_connect_request(struct rdma_cm_idinit_waitqueue_head (&isert_conn->conn_wait_comp_err);kref_init (&isert_conn->conn_kref);kref_get (&isert_conn->conn_kref); +mutex_init (&isert_conn->conn_mutex); cma_id->context = isert_conn; isert_conn->conn_cm_id = cma_id;
@@ -540,15 +541,32 @@ isert_disconnect_work(struct work_struct struct isert_conn, conn_logout_work);pr_debug ("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" ); - +mutex_lock (&isert_conn->conn_mutex); isert_conn->state =ISER_CONN_DOWN ;if (isert_conn->post_recv_buf_count ==0 &&atomic_read (&isert_conn->post_send_buf_count) ==0 ) {pr_debug ("Calling wake_up(&isert_conn->conn_wait);\n" ); -wake_up (&isert_conn->conn_wait); +mutex_unlock (&isert_conn->conn_mutex); + goto wake_up; + } +if (!isert_conn->conn_cm_id) { +mutex_unlock (&isert_conn->conn_mutex); +isert_put_conn (isert_conn); +return ; + } +if (!isert_conn->logout_posted) { +pr_debug ("Calling rdma_disconnect for !logout_posted from" +" isert_disconnect_work\n" ); +rdma_disconnect (isert_conn->conn_cm_id); +mutex_unlock (&isert_conn->conn_mutex); +iscsit_cause_connection_reinstatement (isert_conn->conn,0 ); + goto wake_up; } +mutex_unlock (&isert_conn->conn_mutex); +wake_up: +wake_up (&isert_conn->conn_wait);isert_put_conn (isert_conn); }
@@ -1423,7 +1441,11 @@ isert_cq_comp_err(struct iser_tx_desc *tpr_debug ("isert_cq_comp_err >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" );pr_debug ("Calling wake_up from isert_cq_comp_err\n" ); - isert_conn->state =ISER_CONN_TERMINATING ; +mutex_lock (&isert_conn->conn_mutex); +if (isert_conn->state !=ISER_CONN_DOWN ) + isert_conn->state =ISER_CONN_TERMINATING ; +mutex_unlock (&isert_conn->conn_mutex); +wake_up (&isert_conn->conn_wait_comp_err); } }
@@ -2193,6 +2215,17 @@ isert_free_np(struct iscsi_np *np)kfree (isert_np); } +static int isert_check_state (struct isert_conn *isert_conn,int state) +{ +int ret; + +mutex_lock (&isert_conn->conn_mutex); + ret = (isert_conn->state == state); +mutex_unlock (&isert_conn->conn_mutex); + +return ret; +} +static void isert_free_conn (struct iscsi_conn *conn) {struct isert_conn *isert_conn = conn->context;
@@ -2202,26 +2235,43 @@ static void isert_free_conn(struct iscsi* Decrement post_send_buf_count for special case when called * from isert_do_control_comp() -> iscsit_logout_post_handler() */ +mutex_lock (&isert_conn->conn_mutex);if (isert_conn->logout_posted)atomic_dec (&isert_conn->post_send_buf_count); -if (isert_conn->conn_cm_id) +if (isert_conn->conn_cm_id && isert_conn->state !=ISER_CONN_DOWN ) { +pr_debug ("Calling rdma_disconnect from isert_free_conn\n" );rdma_disconnect (isert_conn->conn_cm_id); + }/* * Only wait for conn_wait_comp_err if the isert_conn made it * into full feature phase.. */ -if (isert_conn->state >ISER_CONN_INIT ) { +if (isert_conn->state ==ISER_CONN_UP ) {pr_debug ("isert_free_conn: Before wait_event comp_err %d\n" , isert_conn->state); +mutex_unlock (&isert_conn->conn_mutex); +wait_event (isert_conn->conn_wait_comp_err, - isert_conn->state ==ISER_CONN_TERMINATING ); -pr_debug ("isert_free_conn: After wait_event #1 >>>>>>>>>>>>\n" ); + (isert_check_state (isert_conn,ISER_CONN_TERMINATING ))); + +wait_event (isert_conn->conn_wait, + (isert_check_state (isert_conn,ISER_CONN_DOWN ))); + +isert_put_conn (isert_conn); +return ; + } +if (isert_conn->state ==ISER_CONN_INIT ) { +mutex_unlock (&isert_conn->conn_mutex); +isert_put_conn (isert_conn); +return ; } +pr_debug ("isert_free_conn: wait_event conn_wait %d\n" , + isert_conn->state); +mutex_unlock (&isert_conn->conn_mutex); -pr_debug ("isert_free_conn: wait_event conn_wait %d\n" , isert_conn->state); -wait_event (isert_conn->conn_wait, isert_conn->state ==ISER_CONN_DOWN ); -pr_debug ("isert_free_conn: After wait_event #2 >>>>>>>>>>>>>>>>>>>>\n" ); +wait_event (isert_conn->conn_wait, + (isert_check_state (isert_conn,ISER_CONN_DOWN )));isert_put_conn (isert_conn); }
drivers/infiniband/ulp/isert/ib_isert.h +1 -0
@@ -102,6 +102,7 @@ struct isert_conn {struct ib_qp *conn_qp;struct isert_device *conn_device;struct work_struct conn_logout_work; +struct mutex conn_mutex;wait_queue_head_t conn_wait;wait_queue_head_t conn_wait_comp_err;struct kref conn_kref;
drivers/target/iscsi/iscsi_target_erl0.c +1 -0
@@ -909,6 +909,7 @@ void iscsit_cause_connection_reinstatemewait_for_completion (&conn->conn_wait_comp);complete (&conn->conn_post_wait_comp); } +EXPORT_SYMBOL (iscsit_cause_connection_reinstatement);void iscsit_fall_back_to_erl0 (struct iscsi_session *sess) {
include/target/iscsi/iscsi_transport.h +4 -0
@@ -67,6 +67,10 @@ extern int iscsit_logout_post_handler(st*/ extern void iscsit_increment_maxcmdsn (struct iscsi_cmd *,struct iscsi_session *);/* +* From iscsi_target_erl0.c +*/ +extern void iscsit_cause_connection_reinstatement (struct iscsi_conn *,int ); +/* * From iscsi_target_erl1.c */ extern void iscsit_stop_dataout_timer (struct iscsi_cmd *);
Greg Kroah-Hartman
maintainerPATCH 5/99 iscsi-target: Fix ISCSI_OP_SCSI_TMFUNC handling for iser
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 186a9647019587b3784694894c4d136fd00cfd7b upstream.
This patch adds target_get_sess_cmd reference counting for iscsit_handle_task_mgt_cmd(), and adds a target_put_sess_cmd() for the failure case.
It also fixes a bug where ISCSI_OP_SCSI_TMFUNC type commands where leaking iscsi_cmd->i_conn_node and eventually triggering an OOPs during struct isert_conn shutdown.
--- drivers/infiniband/ulp/isert/ib_isert.c | 16 ++++++++-------- drivers/target/iscsi/iscsi_target.c | 12 ++++++++++-- 2 files changed, 18 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +8 -8
@@ -1202,14 +1202,12 @@ isert_put_cmd(struct isert_cmd *isert_cm {struct iscsi_cmd *cmd = &isert_cmd->iscsi_cmd;struct isert_conn *isert_conn = isert_cmd->conn; -struct iscsi_conn *conn; +struct iscsi_conn *conn = isert_conn->conn;pr_debug ("Entering isert_put_cmd: %p\n" , isert_cmd);switch (cmd->iscsi_opcode) {case ISCSI_OP_SCSI_CMD : - conn = isert_conn->conn; -spin_lock_bh (&conn->cmd_lock);if (!list_empty (&cmd->i_conn_node))list_del (&cmd->i_conn_node);
@@ -1219,16 +1217,18 @@ isert_put_cmd(struct isert_cmd *isert_cmiscsit_stop_dataout_timer (cmd);isert_unmap_cmd (isert_cmd, isert_conn); -/* -* Fall-through -*/ +transport_generic_free_cmd (&cmd->se_cmd,0 ); +break ;case ISCSI_OP_SCSI_TMFUNC : +spin_lock_bh (&conn->cmd_lock); +if (!list_empty (&cmd->i_conn_node)) +list_del (&cmd->i_conn_node); +spin_unlock_bh (&conn->cmd_lock); +transport_generic_free_cmd (&cmd->se_cmd,0 );break ;case ISCSI_OP_REJECT :case ISCSI_OP_NOOP_OUT : - conn = isert_conn->conn; -spin_lock_bh (&conn->cmd_lock);if (!list_empty (&cmd->i_conn_node))list_del (&cmd->i_conn_node);
drivers/target/iscsi/iscsi_target.c +10 -2
@@ -1757,8 +1757,8 @@ iscsit_handle_task_mgt_cmd(struct iscsi_struct se_tmr_req *se_tmr;struct iscsi_tmr_req *tmr_req;struct iscsi_tm *hdr; -int out_of_order_cmdsn =0 ; -int ret; +int out_of_order_cmdsn =0 , ret; +bool sess_ref = false;u8 function; hdr = (struct iscsi_tm *) buf;
@@ -1814,6 +1814,9 @@ iscsit_handle_task_mgt_cmd(struct iscsi_ conn->sess->se_sess,0 ,DMA_NONE , MSG_SIMPLE_TAG, cmd->sense_buffer + 2); +target_get_sess_cmd (conn->sess->se_sess, &cmd->se_cmd, true); + sess_ref = true; +switch (function) {case ISCSI_TM_FUNC_ABORT_TASK : tcm_function =TMR_ABORT_TASK ;
@@ -1956,6 +1959,11 @@ attach:* For connection recovery, this is also the default action for * TMR TASK_REASSIGN. */ +if (sess_ref) { +pr_debug ("Handle TMR, using sess_ref=true check\n" ); +target_put_sess_cmd (conn->sess->se_sess, &cmd->se_cmd); + } +iscsit_add_cmd_to_response_queue (cmd, conn, cmd->i_state);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 6/99 USB: storage: Add MicroVault Flash Drive to unusual_devs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ren Bigcren <[email protected]>
commit e7a6121f4929c17215f0cdca3726f4bf3e4e9529 upstream.
The device report an error capacity when read_capacity_16(). Using read_capacity_10() can get the correct capacity.
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -665,6 +665,13 @@ UNUSUAL_DEV( 0x054c, 0x016a, 0x0000, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_INQUIRY ), +/* Submitted by Ren Bigcren <[email protected]> */ +UNUSUAL_DEV (0x054c ,0x02a5 ,0x0100 ,0x0100 , +"Sony Corp." , +"MicroVault Flash Drive" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_READ_CAPACITY_16 ), +/* floppy reports multiple luns */ UNUSUAL_DEV( 0x055d, 0x2020, 0x0000, 0x0210, "SAMSUNG",
Greg Kroah-Hartman
maintainerPATCH 7/99 ALSA: hda - Yet another Dell headset mic quirk
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit 6c29d68a82ec68db18241b818d03e7864c052be9 upstream.
This quirk is needed for the headset mic to work on this Dell machine.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -3498,6 +3498,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x0606 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0608 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0609 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x0613 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x1586 ,"HP" ,ALC269_FIXUP_HP_MUTE_LED_MIC2 ),SND_PCI_QUIRK (0x103c ,0x18e6 ,"HP" ,ALC269_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Greg Kroah-Hartman
maintainerPATCH 8/99 ALSA: hda - Guess what, its two more Dell headset mic quirks
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit cd6fb6793a33e2b02af6e05a8d3f735f7c88a943 upstream.
Add two more machines that need quirks for headset mics to work.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -3495,6 +3495,8 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x05f5 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x05f6 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x05f8 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x05f9 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x05fb ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0606 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0608 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 9/99 firewire: fix libdc1394/FlyCap2 iso event regression
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clemens Ladisch <[email protected]>
commit 0699a73af3811b66b1ab5650575acee5eea841ab upstream.
Commit 18d627113b83 (firewire: prevent dropping of completed iso packet header data) was intended to be an obvious bug fix, but libdc1394 and FlyCap2 depend on the old behaviour by ignoring all returned information and thus not noticing that not all packets have been received yet. The result was that the video frame buffers would be saved before they contained the correct data.
Reintroduce the old behaviour for old clients.
--- drivers/firewire/core-cdev.c | 3 +++ drivers/firewire/ohci.c | 10 ++++++++-- include/linux/firewire.h | 1 + include/uapi/linux/firewire-cdev.h | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-)
drivers/firewire/core-cdev.c +3 -0
@@ -54,6 +54,7 @@#define FW_CDEV_KERNEL_VERSION 5#define FW_CDEV_VERSION_EVENT_REQUEST2 4#define FW_CDEV_VERSION_ALLOCATE_REGION_END 4 +#define FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW 5struct client {u32 version;
@@ -1005,6 +1006,8 @@ static int ioctl_create_iso_context(stru a->channel, a->speed, a->header_size, cb, client);if (IS_ERR (context))return PTR_ERR (context); +if (client->version <FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW ) + context->drop_overflow_headers = true;/* We only support one context at this time. */ spin_lock_irq (&client->lock);
drivers/firewire/ohci.c +8 -2
@@ -2749,8 +2749,11 @@ static void copy_iso_headers(struct iso_ {u32 *ctx_hdr; -if (ctx->header_length + ctx->base.header_size >PAGE_SIZE ) +if (ctx->header_length + ctx->base.header_size >PAGE_SIZE ) { +if (ctx->base.drop_overflow_headers) +return ;flush_iso_completions (ctx); + } ctx_hdr = ctx->header + ctx->header_length; ctx->last_timestamp = (u16 )le32_to_cpu ((__force __le32 )dma_hdr[0 ]);
@@ -2910,8 +2913,11 @@ static int handle_it_packet(struct contesync_it_packet_for_cpu (context, d); -if (ctx->header_length +4 >PAGE_SIZE ) +if (ctx->header_length +4 >PAGE_SIZE ) { +if (ctx->base.drop_overflow_headers) +return 1 ;flush_iso_completions (ctx); + } ctx_hdr = ctx->header + ctx->header_length; ctx->last_timestamp =le16_to_cpu (last->res_count);
include/linux/firewire.h +1 -0
@@ -434,6 +434,7 @@ struct fw_iso_context {int type;int channel;int speed; +bool drop_overflow_headers;size_t header_size;union {fw_iso_callback_t sc;
include/uapi/linux/firewire-cdev.h +2 -2
@@ -215,8 +215,8 @@ struct fw_cdev_event_request2 {* with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets * without the interrupt bit set that the kernel's internal buffer for @header -* is about to overflow. (In the last case, kernels with ABI version < 5 drop -* header data up to the next interrupt packet.) +* is about to overflow. (In the last case, ABI versions < 5 drop header data +* up to the next interrupt packet.) * * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): *
Greg Kroah-Hartman
maintainerPATCH 10/99 ASoC: sglt5000: Fix the default value of CHIP_SSS_CTRL
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit 016fcab8ff46fca29375d484226ec91932aa4a07 upstream.
According to the sgtl5000 reference manual, the default value of CHIP_SSS_CTRL is 0x10.
--- sound/soc/codecs/sgtl5000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/sgtl5000.c +1 -1
@@ -37,7 +37,7 @@static const u16 sgtl5000_regs[SGTL5000_MAX_REG_OFFSET ] = { [SGTL5000_CHIP_CLK_CTRL ] =0x0008 , [SGTL5000_CHIP_I2S_CTRL ] =0x0010 , - [SGTL5000_CHIP_SSS_CTRL ] =0x0008 , + [SGTL5000_CHIP_SSS_CTRL ] =0x0010 , [SGTL5000_CHIP_DAC_VOL ] =0x3c3c , [SGTL5000_CHIP_PAD_STRENGTH ] =0x015f , [SGTL5000_CHIP_ANA_HP_CTRL ] =0x1818 ,
Greg Kroah-Hartman
maintainerPATCH 11/99 ASoC: max98088 - fix element type of the register cache.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chih-Chung Chang <[email protected]>
commit cb6f66a2d278e57a6c9d8fb59bd9ebd8ab3965c2 upstream.
The registers of max98088 are 8 bits, not 16 bits. This bug causes the contents of registers to be overwritten with bad values when the codec is suspended and then resumed.
--- sound/soc/codecs/max98088.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/max98088.c +1 -1
@@ -1612,7 +1612,7 @@ static int max98088_dai2_digital_mute(ststatic void max98088_sync_cache (struct snd_soc_codec *codec) { -u16 *reg_cache = codec->reg_cache; +u8 *reg_cache = codec->reg_cache;int i;if (!codec->cache_sync)
Greg Kroah-Hartman
maintainerPATCH 12/99 ASoC: tegra: correct playback_dma_data setup
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Zhao <[email protected]>
commit 647ab784c507763bfda79155f125b6edd1244806 upstream.
The errors were caused by copy/paste mistake in below commit since v3.10:
3489d50 ASoC: tegra: Use common DAI DMA data struct
It also corrects slave_id initialization in tegra20_ac97 driver.
--- sound/soc/tegra/tegra20_ac97.c | 6 +++--- sound/soc/tegra/tegra20_spdif.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/tegra/tegra20_ac97.c +3 -3
@@ -399,9 +399,9 @@ static int tegra20_ac97_platform_probe(s ac97->capture_dma_data.slave_id = of_dma[1 ]; ac97->playback_dma_data.addr = mem->start +TEGRA20_AC97_FIFO_TX1 ; - ac97->capture_dma_data.addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; - ac97->capture_dma_data.maxburst =4 ; - ac97->capture_dma_data.slave_id = of_dma[0 ]; + ac97->playback_dma_data.addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; + ac97->playback_dma_data.maxburst =4 ; + ac97->playback_dma_data.slave_id = of_dma[1 ]; ret =snd_soc_register_component (&pdev->dev, &tegra20_ac97_component, &tegra20_ac97_dai,1 );
sound/soc/tegra/tegra20_spdif.c +2 -2
@@ -323,8 +323,8 @@ static int tegra20_spdif_platform_probe( } spdif->playback_dma_data.addr = mem->start +TEGRA20_SPDIF_DATA_OUT ; - spdif->capture_dma_data.addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; - spdif->capture_dma_data.maxburst =4 ; + spdif->playback_dma_data.addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; + spdif->playback_dma_data.maxburst =4 ; spdif->playback_dma_data.slave_id = dmareq->start;pm_runtime_enable (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 13/99 ASoC: wm8962: Remove remaining direct register cache accesses
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit 2e7ee15ced914e109a1a5b6dfcd463d846a13bd5 upstream.
Also fix return values for headphone switch updates.
--- sound/soc/codecs/wm8962.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
sound/soc/codecs/wm8962.c +13 -11
@@ -1600,7 +1600,6 @@ static int wm8962_put_hp_sw(struct snd_k struct snd_ctl_elem_value *ucontrol) {struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); -u16 *reg_cache = codec->reg_cache;int ret;/* Apply the update (if any) */
@@ -1609,16 +1608,19 @@ static int wm8962_put_hp_sw(struct snd_kreturn 0 ;/* If the left PGA is enabled hit that VU bit... */ -if (snd_soc_read (codec,WM8962_PWR_MGMT_2 ) &WM8962_HPOUTL_PGA_ENA ) -return snd_soc_write (codec,WM8962_HPOUTL_VOLUME , - reg_cache[WM8962_HPOUTL_VOLUME ]); + ret =snd_soc_read (codec,WM8962_PWR_MGMT_2 ); +if (ret &WM8962_HPOUTL_PGA_ENA ) { +snd_soc_write (codec,WM8962_HPOUTL_VOLUME , +snd_soc_read (codec,WM8962_HPOUTL_VOLUME )); +return 1 ; + }/* ...otherwise the right. The VU is stereo. */ -if (snd_soc_read (codec,WM8962_PWR_MGMT_2 ) &WM8962_HPOUTR_PGA_ENA ) -return snd_soc_write (codec,WM8962_HPOUTR_VOLUME , - reg_cache[WM8962_HPOUTR_VOLUME ]); +if (ret &WM8962_HPOUTR_PGA_ENA ) +snd_soc_write (codec,WM8962_HPOUTR_VOLUME , +snd_soc_read (codec,WM8962_HPOUTR_VOLUME )); -return 0 ; +return 1 ; }/* The VU bits for the speakers are in a different register to the mute
@@ -3374,7 +3376,6 @@ static int wm8962_probe(struct snd_soc_cint ret;struct wm8962_priv *wm8962 =snd_soc_codec_get_drvdata (codec);struct wm8962_pdata *pdata =dev_get_platdata (codec->dev); -u16 *reg_cache = codec->reg_cache;int i, trigger, irq_pol;bool dmicclk, dmicdat;
@@ -3432,8 +3433,9 @@ static int wm8962_probe(struct snd_soc_c/* Put the speakers into mono mode? */ if (pdata->spk_mono) - reg_cache[WM8962_CLASS_D_CONTROL_2 ] - |=WM8962_SPK_MONO ; +snd_soc_update_bits (codec,WM8962_CLASS_D_CONTROL_2 , +WM8962_SPK_MONO_MASK ,WM8962_SPK_MONO ); +/* Micbias setup, detection enable and detection * threasholds. */
Greg Kroah-Hartman
maintainerPATCH 14/99 ARM: 7722/1: zImage: Convert 32bits memory size and address from ATAG to 64bits DTB
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory CLEMENT <[email protected]>
commit faefd550c45d8d314e8f260f21565320355c947f upstream.
When CONFIG_ARM_APPENDED_DTB is selected, if the bootloader provides an ATAG_MEM it replaces the memory size and the memory address in the memory node of the device tree. In the case of a system which can handle more than 4GB, the memory node cell size is 4: each data (memory size and memory address) are 64 bits and then use 2 cells.
The current code in atags_to_fdt.c made the assumption of a cell size of 2 (one cell for the memory size and one cell for the memory address), this leads to an improper write of the data and ends with a boot hang.
This patch writes the memory size and the memory address on the memory node in the device tree depending of the size of the memory node (32 bits or 64 bits).
It has been tested in the 2 cases:
- with a dtb using skeleton.dtsi
- and with a dtb using skeleton64.dtsi
--- arch/arm/boot/compressed/atags_to_fdt.c | 44 +++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-)
arch/arm/boot/compressed/atags_to_fdt.c +38 -6
@@ -53,6 +53,17 @@ static const void *getprop(const void *freturn fdt_getprop (fdt, offset, property, len); } +static uint32_t get_cell_size (const void *fdt) +{ +int len; +uint32_t cell_size =1 ; +const uint32_t *size_len =getprop (fdt,"/" ,"#size-cells" , &len); + +if (size_len) + cell_size =fdt32_to_cpu (*size_len); +return cell_size; +} +static void merge_fdt_bootargs (void *fdt,const char *fdt_cmdline) {char cmdline[COMMAND_LINE_SIZE ];
@@ -95,9 +106,11 @@ static void merge_fdt_bootargs(void *fdtint atags_to_fdt (void *atag_list,void *fdt,int total_space) {struct tag *atag = atag_list; -uint32_t mem_reg_property[2 *NR_BANKS ]; +/* In the case of 64 bits memory size, need to reserve 2 cells for +* address and size for each bank */ +uint32_t mem_reg_property[2 *2 *NR_BANKS ];int memcount =0 ; -int ret; +int ret, memsize;/* make sure we've got an aligned pointer */ if ((u32 )atag_list &0x3 )
@@ -137,8 +150,25 @@ int atags_to_fdt(void *atag_list, void *continue ;if (!atag->u.mem.size)continue ; - mem_reg_property[memcount++] =cpu_to_fdt32 (atag->u.mem.start); - mem_reg_property[memcount++] =cpu_to_fdt32 (atag->u.mem.size); + memsize =get_cell_size (fdt); + +if (memsize ==2 ) { +/* if memsize is 2, that means that +* each data needs 2 cells of 32 bits, +* so the data are 64 bits */ +uint64_t *mem_reg_prop64 = + (uint64_t *)mem_reg_property; + mem_reg_prop64[memcount++] = +cpu_to_fdt64 (atag->u.mem.start); + mem_reg_prop64[memcount++] = +cpu_to_fdt64 (atag->u.mem.size); + }else { + mem_reg_property[memcount++] = +cpu_to_fdt32 (atag->u.mem.start); + mem_reg_property[memcount++] = +cpu_to_fdt32 (atag->u.mem.size); + } + }else if (atag->hdr.tag ==ATAG_INITRD2 ) {uint32_t initrd_start, initrd_size; initrd_start = atag->u.initrd.start;
@@ -150,8 +180,10 @@ int atags_to_fdt(void *atag_list, void * } } -if (memcount) -setprop (fdt,"/memory" ,"reg" , mem_reg_property,4 *memcount); +if (memcount) { +setprop (fdt,"/memory" ,"reg" , mem_reg_property, +4 * memcount * memsize); + }return fdt_pack (fdt); }
Greg Kroah-Hartman
maintainerPATCH 15/99 SCSI: isci: Fix a race condition in the SSP task management path
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Skirvin <[email protected]>
commit 96f15f29038e58e1b0a96483e2b369ff446becf1 upstream.
This commit fixes a race condition in the isci driver abort task and SSP device task management path. The race is caused when an I/O termination in the SCU hardware is necessary because of an SSP target timeout condition, and the check of the I/O end state races against the HW-termination-driven end state. The failure of the race meant that no TMF was sent to the device to clean-up the pending I/O.
--- drivers/scsi/isci/task.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/scsi/isci/task.c +6 -3
@@ -491,6 +491,7 @@ int isci_task_abort_task(struct sas_taskstruct isci_tmf tmf;int ret =TMF_RESP_FUNC_FAILED ;unsigned long flags; +int target_done_already =0 ;/* Get the isci_request reference from the task. Note that * this check does not depend on the pending request list
@@ -505,9 +506,11 @@ int isci_task_abort_task(struct sas_task/* If task is already done, the request isn't valid */ if (!(task->task_state_flags &SAS_TASK_STATE_DONE ) && (task->task_state_flags &SAS_TASK_AT_INITIATOR ) && - old_request) + old_request) { idev =isci_get_device (task->dev->lldd_dev); - + target_done_already =test_bit (IREQ_COMPLETE_IN_TARGET , + &old_request->flags); + }spin_unlock (&task->task_state_lock);spin_unlock_irqrestore (&ihost->scic_lock, flags);
@@ -561,7 +564,7 @@ int isci_task_abort_task(struct sas_taskif (task->task_proto ==SAS_PROTOCOL_SMP ||sas_protocol_ata (task->task_proto) || -test_bit (IREQ_COMPLETE_IN_TARGET , &old_request->flags) || + target_done_already ||test_bit (IDEV_GONE , &idev->flags)) {spin_unlock_irqrestore (&ihost->scic_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 16/99 SCSI: sd: fix crash when UA received on DIF enabled device
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Ewan D. Milne" <[email protected]>
commit 085b513f97d8d799d28491239be4b451bcd8c2c5 upstream.
sd_prep_fn will allocate a larger CDB for the command via mempool_alloc for devices using DIF type 2 protection. This CDB was being freed in sd_done, which results in a kernel crash if the command is retried due to a UNIT ATTENTION. This change moves the code to free the larger CDB into sd_unprep_fn instead, which is invoked after the request is complete.
It is no longer necessary to call scsi_print_command separately for this case as the ->cmnd will no longer be NULL in the normal code path.
Also removed conditional test for DIF type 2 when freeing the larger CDB because the protection_type could have been changed via sysfs while the command was executing.
--- drivers/scsi/sd.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/scsi/sd.c +7 -15
@@ -828,10 +828,17 @@ static int scsi_setup_flush_cmnd(structstatic void sd_unprep_fn (struct request_queue *q,struct request *rq) { +struct scsi_cmnd *SCpnt = rq->special; +if (rq->cmd_flags &REQ_DISCARD ) {free_page ((unsigned long )rq->buffer); rq->buffer =NULL ; } +if (SCpnt->cmnd != rq->cmd) { +mempool_free (SCpnt->cmnd, sd_cdb_pool); + SCpnt->cmnd =NULL ; + SCpnt->cmd_len =0 ; + } }/**
@@ -1710,21 +1717,6 @@ static int sd_done(struct scsi_cmnd *SCpif (rq_data_dir (SCpnt->request) ==READ &&scsi_prot_sg_count (SCpnt))sd_dif_complete (SCpnt, good_bytes); -if (scsi_host_dif_capable (sdkp->device->host, sdkp->protection_type) - ==SD_DIF_TYPE2_PROTECTION && SCpnt->cmnd != SCpnt->request->cmd) { - -/* We have to print a failed command here as the -* extended CDB gets freed before scsi_io_completion() -* is called. -*/ -if (result) -scsi_print_command (SCpnt); - -mempool_free (SCpnt->cmnd, sd_cdb_pool); - SCpnt->cmnd =NULL ; - SCpnt->cmd_len =0 ; - } -return good_bytes; }
Greg Kroah-Hartman
maintainerPATCH 17/99 SCSI: qla2xxx: Properly set the tagging for commands.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saurav Kashyap <[email protected]>
commit c3ccb1d7cf4c4549151876dd37c0944a682fd9e1 upstream.
This fixes a regression where Xyratex controllers and disks were lost by the driver:
https://bugzilla.kernel.org/show_bug.cgi?id=59601
--- drivers/scsi/qla2xxx/qla_iocb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +9 -2
@@ -419,6 +419,8 @@ qla2x00_start_scsi(srb_t *sp)__constant_cpu_to_le16 (CF_SIMPLE_TAG );break ; } + }else { + cmd_pkt->control_flags =__constant_cpu_to_le16 (CF_SIMPLE_TAG ); }/* Load SCSI command packet. */
@@ -1308,11 +1310,11 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp fcp_cmnd->task_attribute =TSK_ORDERED ;break ;default : - fcp_cmnd->task_attribute =0 ; + fcp_cmnd->task_attribute =TSK_SIMPLE ;break ; } }else { - fcp_cmnd->task_attribute =0 ; + fcp_cmnd->task_attribute =TSK_SIMPLE ; } cmd_pkt->fcp_rsp_dseg_len =0 ;/* Let response come in status iocb */
@@ -1527,7 +1529,12 @@ qla24xx_start_scsi(srb_t *sp)case ORDERED_QUEUE_TAG : cmd_pkt->task =TSK_ORDERED ;break ; +default : + cmd_pkt->task =TSK_SIMPLE ; +break ; } + }else { + cmd_pkt->task =TSK_SIMPLE ; }/* Load SCSI command packet. */
Greg Kroah-Hartman
maintainerPATCH 18/99 tracing: Fix error handling to ensure instances can always be removed
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Z Lam <[email protected]>
commit 609e85a70bcd0eedf4ec60639dbcfb1ab011e054 upstream.
Remove debugfs directories for tracing instances during creation if an error occurs causing the trace_array for that instance to not be added to ftrace_trace_arrays. If the directory continues to exist after the error, it cannot be removed because the respective trace_array is not in ftrace_trace_arrays.
--- kernel/trace/trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace.c +3 -1
@@ -5926,8 +5926,10 @@ static int new_instance_create(const cha goto out_free_tr; ret =event_trace_add_tracer (tr->dir, tr); -if (ret) +if (ret) { +debugfs_remove_recursive (tr->dir); goto out_free_tr; + }init_tracer_debugfs (tr, tr->dir);
Greg Kroah-Hartman
maintainerPATCH 19/99 tracing: Miscellaneous fixes for trace_array ref counting
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Z Lam <[email protected]>
commit f77d09a384676bde6445413949d9d2c508ff3e62 upstream.
Some error paths did not handle ref counting properly, and some trace files need ref counting.
--- kernel/trace/trace.c | 24 ++++++++++++++++++------ kernel/trace/trace_events.c | 21 +++++++++++++++++++-- 2 files changed, 37 insertions(+), 8 deletions(-)
kernel/trace/trace.c +18 -6
@@ -2956,7 +2956,6 @@ static int tracing_release(struct inode iter = m->private; tr = iter->tr; -trace_array_put (tr);mutex_lock (&trace_types_lock);
@@ -2971,6 +2970,9 @@ static int tracing_release(struct inodeif (!iter->snapshot)/* reenable tracing if it was previously enabled */ tracing_start_tr (tr); + +__trace_array_put (tr); +mutex_unlock (&trace_types_lock);mutex_destroy (&iter->mutex);
@@ -3395,6 +3397,7 @@ tracing_trace_options_write(struct filestatic int tracing_trace_options_open (struct inode *inode,struct file *file) {struct trace_array *tr = inode->i_private; +int ret;if (tracing_disabled)return -ENODEV ;
@@ -3402,7 +3405,11 @@ static int tracing_trace_options_open(stif (trace_array_get (tr) <0 )return -ENODEV ; -return single_open (file, tracing_trace_options_show, inode->i_private); + ret =single_open (file, tracing_trace_options_show, inode->i_private); +if (ret <0 ) +trace_array_put (tr); + +return ret; }static const struct file_operations tracing_iter_fops = {
@@ -3906,6 +3913,7 @@ static int tracing_open_pipe(struct inod iter =kzalloc (sizeof (*iter),GFP_KERNEL );if (!iter) { ret = -ENOMEM ; +__trace_array_put (tr); goto out; }
@@ -4652,21 +4660,24 @@ static int tracing_snapshot_open(struct ret =PTR_ERR (iter); }else {/* Writes still need the seq_file to hold the private data */ + ret = -ENOMEM ; m =kzalloc (sizeof (*m),GFP_KERNEL );if (!m) -return -ENOMEM ; + goto out; iter =kzalloc (sizeof (*iter),GFP_KERNEL );if (!iter) {kfree (m); -return -ENOMEM ; + goto out; } + ret =0 ; + iter->tr = tr; iter->trace_buffer = &tc->tr->max_buffer; iter->cpu_file = tc->cpu; m->private = iter; file->private_data = m; } - +out:if (ret <0 )trace_array_put (tr);
@@ -5276,9 +5287,10 @@ tracing_stats_read(struct file *filp, ch }static const struct file_operations tracing_stats_fops = { - .open = tracing_open_generic, + .open = tracing_open_generic_tc, .read = tracing_stats_read, .llseek = generic_file_llseek, + .release = tracing_release_generic_tc, };#ifdef CONFIG_DYNAMIC_FTRACE
kernel/trace/trace_events.c +19 -2
@@ -1221,6 +1221,7 @@ show_header(struct file *filp, char __usstatic int ftrace_event_avail_open (struct inode *inode,struct file *file);static int ftrace_event_set_open (struct inode *inode,struct file *file); +static int ftrace_event_release (struct inode *inode,struct file *file);static const struct seq_operations show_event_seq_ops = { .start = t_start,
@@ -1248,7 +1249,7 @@ static const struct file_operations ftra .read = seq_read, .write = ftrace_event_write, .llseek = seq_lseek, - .release = seq_release, + .release = ftrace_event_release, };static const struct file_operations ftrace_enable_fops = {
@@ -1326,6 +1327,15 @@ ftrace_event_open(struct inode *inode, sreturn ret; } +static int ftrace_event_release (struct inode *inode,struct file *file) +{ +struct trace_array *tr = inode->i_private; + +trace_array_put (tr); + +return seq_release (inode, file); +} +static int ftrace_event_avail_open (struct inode *inode,struct file *file) {
@@ -1339,12 +1349,19 @@ ftrace_event_set_open(struct inode *inod {const struct seq_operations *seq_ops = &show_set_event_seq_ops;struct trace_array *tr = inode->i_private; +int ret; + +if (trace_array_get (tr) <0 ) +return -ENODEV ;if ((file->f_mode &FMODE_WRITE ) && (file->f_flags &O_TRUNC ))ftrace_clear_events (tr); -return ftrace_event_open (inode, file, seq_ops); + ret =ftrace_event_open (inode, file, seq_ops); +if (ret <0 ) +trace_array_put (tr); +return ret; } static struct event_subsystem *
Greg Kroah-Hartman
maintainerPATCH 20/99 tracing: Kill the unbalanced tr->ref++ in tracing_buffers_open()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit e70e78e3c83b536730e31231dd9b979768d8df3c upstream.
tracing_buffers_open() does trace_array_get() and then it wrongly inrcements tr->ref again under trace_types_lock. This means that every caller leaks trace_array:
# cd /sys/kernel/debug/tracing/ # mkdir instances/X # true < instances/X/per_cpu/cpu0/trace_pipe_raw # rmdir instances/X rmdir: failed to remove `instances/X': Device or resource busy
--- kernel/trace/trace.c | 2 -- 1 file changed, 2 deletions(-)
kernel/trace/trace.c +0 -2
@@ -4907,8 +4907,6 @@ static int tracing_buffers_open(struct imutex_lock (&trace_types_lock); - tr->ref++; - info->iter.tr = tr; info->iter.cpu_file = tc->cpu; info->iter.trace = tr->current_trace;
Greg Kroah-Hartman
maintainerPATCH 21/99 tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 09d8091c024ec88d1541d93eb8ddb2bd5cf10c39 upstream.
Commit a82274151af "tracing: Protect ftrace_trace_arrays list in trace_events.c" added taking the trace_types_lock mutex in trace_events.c as there were several locations that needed it for protection. Unfortunately, it also encapsulated a call to tracing_reset_all_online_cpus() which also takes the trace_types_lock, causing a deadlock.
This happens when a module has tracepoints and has been traced. When the module is removed, the trace events module notifier will grab the trace_types_lock, do a bunch of clean ups, and also clears the buffer by calling tracing_reset_all_online_cpus. This doesn't happen often which explains why it wasn't caught right away.
Commit a82274151af was marked for stable, which means this must be sent to stable too.
--- kernel/trace/trace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/trace/trace.c +1 -2
@@ -1163,18 +1163,17 @@ void tracing_reset_current(int cpu)tracing_reset (&global_trace.trace_buffer, cpu); } +/* Must have trace_types_lock held */ void tracing_reset_all_online_cpus (void ) {struct trace_array *tr; -mutex_lock (&trace_types_lock);list_for_each_entry (tr, &ftrace_trace_arrays, list) {tracing_reset_online_cpus (&tr->trace_buffer);#ifdef CONFIG_TRACER_MAX_TRACE tracing_reset_online_cpus (&tr->max_buffer);#endif } -mutex_unlock (&trace_types_lock); }#define SAVED_CMDLINES 128
Greg Kroah-Hartman
maintainerPATCH 22/99 usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Cherian <[email protected]>
commit 07f3cb7c28bf3f4dd80bfb136cf45810c46ac474 upstream.
Xhci controllers with hci_version > 0.96 gives spurious success events on short packet completion. During webcam capture the "ERROR Transfer event TRB DMA ptr not part of current TD" was observed. The same application works fine with synopsis controllers hci_version 0.96. The same issue is seen with Intel Pantherpoint xhci controller. So enabling this quirk in xhci_gen_setup if controller verion is greater than 0.96. For xhci-pci move the quirk to much generic place xhci_gen_setup.
Note from Sarah:
The xHCI 1.0 spec changed how hardware handles short packets. The HW will notify SW of the TRB where the short packet occurred, and it will also give a successful status for the last TRB in a TD (the one with the IOC flag set). On the second successful status, that warning will be triggered in the driver.
Software is now supposed to not assume the TD is not completed until it gets that last successful status. That means we have a slight race condition, although it should have little practical impact. This patch papers over that issue.
It's on my long-term to-do list to fix this race condition, but it is a much more involved patch that will probably be too big for stable. This patch is needed for stable to avoid serious log spam.
This patch should be backported to kernels as old as 3.0, that contain the commit ad808333d8201d53075a11bc8dd83b81f3d68f0b "Intel xhci:
Ignore spurious successful event."
The patch will have to be modified for kernels older than 3.2, since that kernel added the xhci_gen_setup function for xhci platform devices. The correct conflict resolution for kernels older than 3.2 is to set XHCI_SPURIOUS_SUCCESS in xhci_pci_quirks for all xHCI 1.0 hosts.
--- drivers/usb/host/xhci-pci.c | 1 - drivers/usb/host/xhci.c | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +0 -1
@@ -93,7 +93,6 @@ static void xhci_pci_quirks(struct devic }if (pdev->vendor ==PCI_VENDOR_ID_INTEL && pdev->device ==PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI ) { - xhci->quirks |=XHCI_SPURIOUS_SUCCESS ; xhci->quirks |=XHCI_EP_LIMIT_QUIRK ; xhci->limit_active_eps =64 ; xhci->quirks |=XHCI_SW_BW_CHECKING ;
drivers/usb/host/xhci.c +7 -0
@@ -4697,6 +4697,13 @@ int xhci_gen_setup(struct usb_hcd *hcd,get_quirks (dev, xhci); +/* In xhci controllers which follow xhci 1.0 spec gives a spurious +* success event after a short transfer. This quirk will ignore such +* spurious event. +*/ +if (xhci->hci_version >0x96 ) + xhci->quirks |=XHCI_SPURIOUS_SUCCESS ; +/* Make sure the HC is halted. */ retval =xhci_halt (xhci);if (retval)
Greg Kroah-Hartman
maintainerPATCH 23/99 xhci: fix null pointer dereference on ring_doorbell_for_active_rings
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
commit d66eaf9f89502971fddcb0de550b01fa6f409d83 upstream.
in some cases where device is attched to xhci port and do not responding, for example ath9k_htc with stalled firmware, kernel will crash on ring_doorbell_for_active_rings.
This patch check if pointer exist before it is used.
This patch should be backported to kernels as old as 2.6.35, that contain the commit e9df17eb1408cfafa3d1844bfc7f22c7237b31b8 "USB: xhci:
Correct assumptions about number of rings per endpoint"
--- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +1 -1
@@ -434,7 +434,7 @@ static void ring_doorbell_for_active_rin/* A ring has pending URBs if its TD list is not empty */ if (!(ep->ep_state &EP_HAS_STREAMS )) { -if (!(list_empty (&ep->ring->td_list))) +if (ep->ring && !(list_empty (&ep->ring->td_list)))xhci_ring_ep_doorbell (xhci, slot_id, ep_index,0 );return ; }
Greg Kroah-Hartman
maintainerPATCH 24/99 xhci: Avoid NULL pointer deref when host dies.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 203a86613fb3bf2767335659513fa98563a3eb71 upstream.
When the host controller fails to respond to an Enable Slot command, and the host fails to respond to the register write to abort the command ring, the xHCI driver will assume the host is dead, and call usb_hc_died().
The USB device's slot_id is still set to zero, and the pointer stored at xhci->devs[0] will always be NULL. The call to xhci_check_args in xhci_free_dev should have caught the NULL virt_dev pointer.
However, xhci_free_dev is designed to free the xhci_virt_device structures, even if the host is dead, so that we don't leak kernel memory. xhci_free_dev checks the return value from the generic xhci_check_args function. If the return value is -ENODEV, it carries on trying to free the virtual device.
The issue is that xhci_check_args looks at the host controller state before it looks at the xhci_virt_device pointer. It will return -ENIVAL because the host is dead, and xhci_free_dev will ignore the return value, and happily dereference the NULL xhci_virt_device pointer.
The fix is to make sure that xhci_check_args checks the xhci_virt_device pointer before it checks the host state.
See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1203453 for further details. This patch doesn't solve the underlying issue, but will ensure we don't see any more NULL pointer dereferences because of the issue.
This patch should be backported to kernels as old as 3.1, that contain the commit 7bd89b4017f46a9b92853940fd9771319acb578a "xhci: Don't submit commands or URBs to halted hosts."
--- drivers/usb/host/xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/xhci.c +3 -3
@@ -1171,9 +1171,6 @@ static int xhci_check_args(struct usb_hc } xhci =hcd_to_xhci (hcd); -if (xhci->xhc_state &XHCI_STATE_HALTED ) -return -ENODEV ; -if (check_virt_dev) {if (!udev->slot_id || !xhci->devs[udev->slot_id]) { printk(KERN_DEBUG "xHCI %s called with unaddressed "
@@ -1189,6 +1186,9 @@ static int xhci_check_args(struct usb_hc } } +if (xhci->xhc_state &XHCI_STATE_HALTED ) +return -ENODEV ; +return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 25/99 USB: EHCI: Fix resume signalling on remote wakeup
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit 47a64a13d54f6c669b00542848d5550be3d3310e upstream.
Set the ehci->resuming flag for the port we receive a remote wakeup on so that resume signalling can be completed.
Without this, the root hub timer will not fire again to check if the resume was completed and there will be a never-ending wait on on the port.
This effect is only observed if the HUB IRQ IN does not come after we have initiated the port resume.
--- drivers/usb/host/ehci-hub.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-hub.c +1 -0
@@ -858,6 +858,7 @@ static int ehci_hub_control ( ehci->reset_done[wIndex] = jiffies +msecs_to_jiffies (20 );usb_hcd_start_port_resume (&hcd->self, wIndex); +set_bit (wIndex, &ehci->resuming_ports);/* check the port again */ mod_timer (&ehci_to_hcd (ehci)->rh_timer, ehci->reset_done[wIndex]);
Greg Kroah-Hartman
maintainerPATCH 26/99 USB: mos7840: fix memory leak in open
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 5f8a2e68b679b41cc8e9b642f2f5aa45dd678641 upstream.
Allocated urbs and buffers were never freed on errors in open.
--- drivers/usb/serial/mos7840.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/usb/serial/mos7840.c +17 -8
@@ -914,20 +914,20 @@ static int mos7840_open(struct tty_struc status =mos7840_get_reg_sync (port, mos7840_port->SpRegOffset, &Data);if (status <0 ) {dev_dbg (&port->dev,"Reading Spreg failed\n" ); -return -1 ; + goto err; } Data |=0x80 ; status =mos7840_set_reg_sync (port, mos7840_port->SpRegOffset, Data);if (status <0 ) {dev_dbg (&port->dev,"writing Spreg failed\n" ); -return -1 ; + goto err; } Data &= ~0x80 ; status =mos7840_set_reg_sync (port, mos7840_port->SpRegOffset, Data);if (status <0 ) {dev_dbg (&port->dev,"writing Spreg failed\n" ); -return -1 ; + goto err; }/* End of block to be checked */
@@ -936,7 +936,7 @@ static int mos7840_open(struct tty_struc &Data);if (status <0 ) {dev_dbg (&port->dev,"Reading Controlreg failed\n" ); -return -1 ; + goto err; } Data |=0x08 ;/* Driver done bit */ Data |=0x20 ;/* rx_disable */
@@ -944,7 +944,7 @@ static int mos7840_open(struct tty_struc mos7840_port->ControlRegOffset, Data);if (status <0 ) {dev_dbg (&port->dev,"writing Controlreg failed\n" ); -return -1 ; + goto err; }/* do register settings here */ /* Set all regs to the device default values. */
@@ -955,21 +955,21 @@ static int mos7840_open(struct tty_struc status =mos7840_set_uart_reg (port,INTERRUPT_ENABLE_REGISTER , Data);if (status <0 ) {dev_dbg (&port->dev,"disabling interrupts failed\n" ); -return -1 ; + goto err; }/* Set FIFO_CONTROL_REGISTER to the default value */ Data =0x00 ; status =mos7840_set_uart_reg (port,FIFO_CONTROL_REGISTER , Data);if (status <0 ) {dev_dbg (&port->dev,"Writing FIFO_CONTROL_REGISTER failed\n" ); -return -1 ; + goto err; } Data =0xcf ; status =mos7840_set_uart_reg (port,FIFO_CONTROL_REGISTER , Data);if (status <0 ) {dev_dbg (&port->dev,"Writing FIFO_CONTROL_REGISTER failed\n" ); -return -1 ; + goto err; } Data =0x03 ;
@@ -1114,6 +1114,15 @@ static int mos7840_open(struct tty_struc/* mos7840_change_port_settings(mos7840_port,old_termios); */ return 0 ; +err: +for (j =0 ; j <NUM_URBS ; ++j) { + urb = mos7840_port->write_urb_pool[j]; +if (!urb) +continue ; +kfree (urb->transfer_buffer); +usb_free_urb (urb); + } +return status; }/*****************************************************************************
Greg Kroah-Hartman
maintainerPATCH 27/99 usb: dwc3: fix the error returned with usb3_phy failure
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruchika Kharwar <[email protected]>
commit 315955d707b50c8aad20a32ec0dd4c9fe243cabe upstream.
When there is an error with the usb3_phy probe or absence, the error returned is erroneously for usb2_phy.
--- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/core.c +1 -1
@@ -450,7 +450,7 @@ static int dwc3_probe(struct platform_de }if (IS_ERR (dwc->usb3_phy)) { - ret =PTR_ERR (dwc->usb2_phy); + ret =PTR_ERR (dwc->usb3_phy);/* * if -ENXIO is returned, it means PHY layer wasn't
Greg Kroah-Hartman
maintainerPATCH 28/99 usb: dwc3: fix wrong bit mask in dwc3_event_type
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Rui <[email protected]>
commit 1974d494dea05ea227cb42f5e918828801e237aa upstream.
Per dwc3 2.50a spec, the is_devspec bit is used to distinguish the Device Endpoint-Specific Event or Device-Specific Event (DEVT). If the bit is 1, the event is represented Device-Specific Event, then use [7:1] bits as Device Specific Event to marked the type. It has 7 bits, and we can see the reserved8_31 variable name which means from 8 to 31 bits marked reserved, actually there are 24 bits not 25 bits between that. And 1 + 7 + 24 = 32, the event size is 4 byes.
So in dwc3_event_type, the bit mask should be:is_devspec [0] 1 bit
type [7:1] 7 bitsreserved8_31 [31:8] 24 bits
This patch should be backported to kernels as old as 3.2, that contain the commit 72246da40f3719af3bfd104a2365b32537c27d83 "usb: Introduce DesignWare USB3 DRD Driver".
--- drivers/usb/dwc3/core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/core.h +2 -2
@@ -759,8 +759,8 @@ struct dwc3 {struct dwc3_event_type {u32 is_devspec:1 ; -u32 type:6 ; -u32 reserved8_31:25 ; +u32 type:7 ; +u32 reserved8_31:24 ; } __packed;#define DWC3_DEPEVT_XFERCOMPLETE 0x01
Greg Kroah-Hartman
maintainerPATCH 29/99 usb: dwc3: gadget: dont prevent gadget from being probed if we fail
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit cdcedd6981194e511cc206887db661d016069d68 upstream.
In case we fail our ->udc_start() callback, we should be ready to accept another modprobe following the failed one.
We had forgotten to clear dwc->gadget_driver back to NULL and, because of that, we were preventing gadget driver modprobe from being retried.
--- drivers/usb/dwc3/gadget.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/gadget.c +1 -0
@@ -1584,6 +1584,7 @@ err1:__dwc3_gadget_ep_disable (dwc->eps[0 ]); err0: + dwc->gadget_driver =NULL ;spin_unlock_irqrestore (&dwc->lock, flags);return ret;
Greg Kroah-Hartman
maintainerPATCH 30/99 USB: ti_usb_3410_5052: fix dynamic-id matching
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 1fad56424f5ad3ce4973505a357212b2e2282b3f upstream.
The driver failed to take the dynamic ids into account when determining the device type and therefore all devices were detected as 2-port devices when using the dynamic-id interface.
Match on the usb-serial-driver field instead of doing redundant id-table searches.
--- drivers/usb/serial/ti_usb_3410_5052.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/ti_usb_3410_5052.c +1 -1
@@ -371,7 +371,7 @@ static int ti_startup(struct usb_serialusb_set_serial_data (serial, tdev);/* determine device type */ -if (usb_match_id (serial->interface, ti_id_table_3410)) +if (serial->type == &ti_1port_device) tdev->td_is_3410 =1 ;dev_dbg (&dev->dev,"%s - device type is %s\n" , __func__, tdev->td_is_3410 ?"3410" :"5052" );
Greg Kroah-Hartman
maintainerPATCH 31/99 USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jóhann B. Guðmundsson <[email protected]>
commit 58fc90db8261b571c026bb8bf23aad48a7233118 upstream.
--- drivers/usb/misc/sisusbvga/sisusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/sisusbvga/sisusb.c +1 -0
@@ -3247,6 +3247,7 @@ static const struct usb_device_id sisusb { USB_DEVICE(0x0711, 0x0903) }, { USB_DEVICE(0x0711, 0x0918) }, { USB_DEVICE(0x0711, 0x0920) }, + { USB_DEVICE(0x0711, 0x0950) }, { USB_DEVICE(0x182d, 0x021c) }, { USB_DEVICE(0x182d, 0x0269) }, { }
Greg Kroah-Hartman
maintainerPATCH 32/99 usb: Clear both buffers when clearing a control transfer TT buffer.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Gulland <[email protected]>
commit 2c7b871b9102c497ba8f972aa5d38532f05b654d upstream.
Control transfers have both IN and OUT (or SETUP) packets, so when clearing TT buffers for a control transfer it's necessary to send two HUB_CLEAR_TT_BUFFER requests to the hub.
--- drivers/usb/core/hub.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/core/hub.c +9 -0
@@ -668,6 +668,15 @@ resubmit:static inline int hub_clear_tt_buffer (struct usb_device *hdev,u16 devinfo,u16 tt) { +/* Need to clear both directions for control ep */ +if (((devinfo >>11 ) &USB_ENDPOINT_XFERTYPE_MASK ) == +USB_ENDPOINT_XFER_CONTROL ) { +int status =usb_control_msg (hdev,usb_sndctrlpipe (hdev,0 ), +HUB_CLEAR_TT_BUFFER ,USB_RT_PORT , + devinfo ^0x8000 , tt,NULL ,0 ,1000 ); +if (status) +return status; + }return usb_control_msg (hdev,usb_sndctrlpipe (hdev,0 ),HUB_CLEAR_TT_BUFFER ,USB_RT_PORT , devinfo, tt,NULL ,0 ,1000 );
Greg Kroah-Hartman
maintainerPATCH 33/99 USB: global suspend and remote wakeup dont mix
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit e583d9db9960cf40e0bc8afee4946baa9d71596e upstream.
The hub driver was recently changed to use "global" suspend for system suspend transitions on non-SuperSpeed buses. This means that we don't suspend devices individually by setting the suspend feature on the upstream hub port; instead devices all go into suspend automatically when the root hub stops transmitting packets. The idea was to save time and to avoid certain kinds of wakeup races.
Now it turns out that many hubs are buggy; they don't relay wakeup requests from a downstream port to their upstream port if the downstream port's suspend feature is not set (depending on the speed of the downstream port, whether or not the hub is enabled for remote wakeup, and possibly other factors).
We can't have hubs dropping wakeup requests. Therefore this patch goes partway back to the old policy: It sets the suspend feature for a port if the device attached to that port or any of its descendants is enabled for wakeup. People will still be able to benefit from the time savings if they don't care about wakeup and leave it disabled on all their devices.
In order to accomplish this, the patch adds a new field to the usb_hub
structure: wakeup_enabled_descendants is a count of how many devices below a suspended hub are enabled for remote wakeup. A corresponding new subroutine determines the number of wakeup-enabled devices at or below an arbitrary suspended USB device.
This should be applied to the 3.10 stable kernel.
--- drivers/usb/core/hub.c | 39 +++++++++++++++++++++++++++++++-------- drivers/usb/core/hub.h | 3 +++ 2 files changed, 34 insertions(+), 8 deletions(-)
drivers/usb/core/hub.c +31 -8
@@ -2855,6 +2855,15 @@ static int usb_disable_function_remotewa USB_CTRL_SET_TIMEOUT); } +/* Count of wakeup-enabled devices at or below udev */ +static unsigned wakeup_enabled_descendants (struct usb_device *udev) +{ +struct usb_hub *hub =usb_hub_to_struct_hub (udev); + +return udev->do_remote_wakeup + + (hub ? hub->wakeup_enabled_descendants :0 ); +} +/* * usb_port_suspend - suspend a usb device's upstream port * @udev: device that's no longer in active use, not a root hub
@@ -2895,8 +2904,8 @@ static int usb_disable_function_remotewa* Linux (2.6) currently has NO mechanisms to initiate that: no khubd * timer, no SRP, no requests through sysfs. * -* If Runtime PM isn't enabled or used, non-SuperSpeed devices really get -* suspended only when their bus goes into global suspend (i.e., the root +* If Runtime PM isn't enabled or used, non-SuperSpeed devices may not get +* suspended until their bus goes into global suspend (i.e., the root * hub is suspended). Nevertheless, we change @udev->state to * USB_STATE_SUSPENDED as this is the device's "logical" state. The actual * upstream port setting is stored in @udev->port_is_suspended.
@@ -2967,15 +2976,21 @@ int usb_port_suspend(struct usb_device */* see 7.1.7.6 */ if (hub_is_superspeed (hub->hdev)) status =hub_set_port_link_state (hub, port1,USB_SS_PORT_LS_U3 ); -else if (PMSG_IS_AUTO (msg)) - status =set_port_feature (hub->hdev, port1, -USB_PORT_FEAT_SUSPEND ); +/* * For system suspend, we do not need to enable the suspend feature * on individual USB-2 ports. The devices will automatically go * into suspend a few ms after the root hub stops sending packets. * The USB 2.0 spec calls this "global suspend". +* +* However, many USB hubs have a bug: They don't relay wakeup requests +* from a downstream port if the port's suspend feature isn't on. +* Therefore we will turn on the suspend feature if udev or any of its +* descendants is enabled for remote wakeup. */ +else if (PMSG_IS_AUTO (msg) ||wakeup_enabled_descendants (udev) >0 ) + status =set_port_feature (hub->hdev, port1, +USB_PORT_FEAT_SUSPEND );else { really_suspend = false; status =0 ;
@@ -3010,15 +3025,16 @@ int usb_port_suspend(struct usb_device *if (!PMSG_IS_AUTO (msg)) status =0 ; }else { -/* device has up to 10 msec to fully suspend */ dev_dbg (&udev->dev,"usb %ssuspend, wakeup %d\n" , (PMSG_IS_AUTO (msg) ?"auto-" :"" ), udev->do_remote_wakeup); -usb_set_device_state (udev,USB_STATE_SUSPENDED );if (really_suspend) { udev->port_is_suspended =1 ; + +/* device has up to 10 msec to fully suspend */ msleep (10 ); } +usb_set_device_state (udev,USB_STATE_SUSPENDED ); }/*
@@ -3300,7 +3316,11 @@ static int hub_suspend(struct usb_interfunsigned port1;int status; -/* Warn if children aren't already suspended */ +/* +* Warn if children aren't already suspended. +* Also, add up the number of wakeup-enabled descendants. +*/ + hub->wakeup_enabled_descendants =0 ;for (port1 =1 ; port1 <= hdev->maxchild; port1++) {struct usb_device *udev;
@@ -3310,6 +3330,9 @@ static int hub_suspend(struct usb_interfif (PMSG_IS_AUTO (msg))return -EBUSY ; } +if (udev) + hub->wakeup_enabled_descendants += +wakeup_enabled_descendants (udev); }if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) {
drivers/usb/core/hub.h +3 -0
@@ -59,6 +59,9 @@ struct usb_hub {struct usb_tt tt;/* Transaction Translator */ unsigned mA_per_port;/* current for each child */ +#ifdef CONFIG_PM +unsigned wakeup_enabled_descendants; +#endif unsigned limited_power:1; unsigned quiescing:1;
Greg Kroah-Hartman
maintainerPATCH 34/99 staging: comedi: fix a race between do_cmd_ioctl() and read/write
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 4b18f08be01a7b3c7b6df497137b6e3cb28adaa3 upstream.
do_cmd_ioctl() is called with the comedi device's mutex locked to process the COMEDI_CMD ioctl to set up comedi's asynchronous command handling on a comedi subdevice. comedi_read() and comedi_write() are the read and write handlers for the comedi device, but do not lock the mutex (for performance reasons, as some things can hold the mutex for quite a long time).
There is a race condition if comedi_read() or comedi_write() is running at the same time and for the same file object and comedi subdevice as do_cmd_ioctl(). do_cmd_ioctl() sets the subdevice's busy pointer to the file object way before it sets the SRF_RUNNING flag in the subdevice's runflags member. comedi_read() and comedi_write() check the subdevice's busy pointer is pointing to the current file object, then if the SRF_RUNNING flag is not set, will call do_become_nonbusy()` to shut down the asyncronous command. Bad things can happen if the asynchronous command is being shutdown and set up at the same time.
To prevent the race, don't set the busy pointer until after the SRF_RUNNING flag has been set. Also, make sure the mutex is held in comedi_read() and comedi_write() while calling do_become_nonbusy() in order to avoid moving the race condition to a point within that function.
Change some error handling goto cleanup statements in do_cmd_ioctl() to simple return -ERRFOO statements as a result of changing when the busy pointer is set.
--- drivers/staging/comedi/comedi_fops.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
drivers/staging/comedi/comedi_fops.c +15 -10
@@ -1401,22 +1401,19 @@ static int do_cmd_ioctl(struct comedi_deDPRINTK ("subdevice busy\n" );return -EBUSY ; } - s->busy = file;/* make sure channel/gain list isn't too long */ if (cmd.chanlist_len > s->len_chanlist) {DPRINTK ("channel/gain list too long %u > %d\n" , cmd.chanlist_len, s->len_chanlist); - ret = -EINVAL ; - goto cleanup; +return -EINVAL ; }/* make sure channel/gain list isn't too short */ if (cmd.chanlist_len <1 ) {DPRINTK ("channel/gain list too short %u < 1\n" , cmd.chanlist_len); - ret = -EINVAL ; - goto cleanup; +return -EINVAL ; } async->cmd = cmd;
@@ -1426,8 +1423,7 @@ static int do_cmd_ioctl(struct comedi_dekmalloc (async->cmd.chanlist_len *sizeof (int ),GFP_KERNEL );if (!async->cmd.chanlist) {DPRINTK ("allocation failed\n" ); - ret = -ENOMEM ; - goto cleanup; +return -ENOMEM ; } if (copy_from_user(async->cmd.chanlist, user_chanlist,
@@ -1479,6 +1475,9 @@ static int do_cmd_ioctl(struct comedi_decomedi_set_subdevice_runflags (s, ~0 ,SRF_USER |SRF_RUNNING ); +/* set s->busy _after_ setting SRF_RUNNING flag to avoid race with +* comedi_read() or comedi_write() */ + s->busy = file; ret = s->do_cmd (dev, s);if (ret ==0 )return 0 ;
@@ -2041,11 +2040,13 @@ static ssize_t comedi_write(struct fileif (!comedi_is_subdevice_running (s)) {if (count ==0 ) { +mutex_lock (&dev->mutex);if (comedi_is_subdevice_in_error (s)) retval = -EPIPE ;else retval =0 ;do_become_nonbusy (dev, s); +mutex_unlock (&dev->mutex); }break ; }
@@ -2144,11 +2145,13 @@ static ssize_t comedi_read(struct file *if (n ==0 ) {if (!comedi_is_subdevice_running (s)) { +mutex_lock (&dev->mutex);do_become_nonbusy (dev, s);if (comedi_is_subdevice_in_error (s)) retval = -EPIPE ;else retval =0 ; +mutex_unlock (&dev->mutex);break ; }if (file->f_flags &O_NONBLOCK ) {
@@ -2186,9 +2189,11 @@ static ssize_t comedi_read(struct file * buf += n;break ;/* makes device work like a pipe */ } -if (comedi_is_subdevice_idle (s) && - async->buf_read_count - async->buf_write_count ==0 ) { -do_become_nonbusy (dev, s); +if (comedi_is_subdevice_idle (s)) { +mutex_lock (&dev->mutex); +if (async->buf_read_count - async->buf_write_count ==0 ) +do_become_nonbusy (dev, s); +mutex_unlock (&dev->mutex); }set_current_state (TASK_RUNNING );remove_wait_queue (&async->wait_head, &wait);
Greg Kroah-Hartman
maintainerPATCH 35/99 staging: comedi: COMEDI_CANCEL ioctl should wake up read/write
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 69acbaac303e8cb948801a9ddd0ac24e86cc4a1b upstream.
Comedi devices can do blocking read() or write() (or poll()) if an asynchronous command has been set up, blocking for data (for read()) or buffer space (for write()). Various events associated with the asynchronous command will wake up the blocked reader or writer (or poller). It is also possible to force the asynchronous command to terminate by issuing a COMEDI_CANCEL ioctl. That shuts down the asynchronous command, but does not currently wake up the blocked reader or writer (or poller). If the blocked task could be woken up, it would see that the command is no longer active and return. The caller of the COMEDI_CANCEL ioctl could attempt to wake up the blocked task by sending a signal, but that's a nasty workaround.
Change do_cancel_ioctl() to wake up the wait queue after it returns from do_cancel(). do_cancel() can propagate an error return value from the low-level comedi driver's cancel routine, but it always shuts the command down regardless, so do_cancel_ioctl() can wake up he wait queue regardless of the return value from do_cancel().
--- drivers/staging/comedi/comedi_fops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +6 -1
@@ -1692,6 +1692,7 @@ static int do_cancel_ioctl(struct comedi void *file) {struct comedi_subdevice *s; +int ret;if (arg >= dev->n_subdevices)return -EINVAL ;
@@ -1708,7 +1709,11 @@ static int do_cancel_ioctl(struct comediif (s->busy != file)return -EBUSY ; -return do_cancel (dev, s); + ret =do_cancel (dev, s); +if (comedi_get_subdevice_runflags (s) &SRF_USER ) +wake_up_interruptible (&s->async->wait_head); + +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 36/99 staging: android: logger: Correct write offset reset on error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karlis Ogsts <[email protected]>
commit 72bb99cfe9c57d2044445fb34bbc95b4c0bae6f2 upstream.
In the situation that a writer fails to copy data from userspace it will reset the write offset to the value it had before it went to sleep. This discarding any messages written while aquiring the mutex.
Therefore the reset offset needs to be retrieved after acquiring the mutex.
--- drivers/staging/android/logger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/android/logger.c +3 -1
@@ -469,7 +469,7 @@ static ssize_t logger_aio_write(struct k unsigned long nr_segs, loff_t ppos) {struct logger_log *log =file_get_log (iocb->ki_filp); -size_t orig = log->w_off; +size_t orig;struct logger_entry header;struct timespec now;ssize_t ret =0 ;
@@ -490,6 +490,8 @@ static ssize_t logger_aio_write(struct kmutex_lock (&log->mutex); + orig = log->w_off; +/* * Fix up any readers, pulling them forward to the first readable * entry after (what will be) the new write offset. We do this now
Greg Kroah-Hartman
maintainerPATCH 37/99 cpufreq / intel_pstate: Change to scale off of max P-state
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit 2134ed4d614349b2b4e8d7bb593baa9179b8dd1e upstream.
Change to using max P-state instead of max turbo P-state. This change resolves two issues.
On a quiet system intel_pstate can fail to respond to a load change.
On CPU SKUs that have a limited number of P-states and no turbo range intel_pstate fails to select the highest available P-state.
This change is suitable for stable v3.9+
References: https://bugzilla.kernel.org/show_bug.cgi?id=59481
--- drivers/cpufreq/intel_pstate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/cpufreq/intel_pstate.c +6 -6
@@ -103,10 +103,10 @@ struct pstate_adjust_policy {static struct pstate_adjust_policy default_policy = { .sample_rate_ms =10 , .deadband =0 , - .setpoint =109 , - .p_gain_pct =17 , + .setpoint =97 , + .p_gain_pct =20 , .d_gain_pct =0 , - .i_gain_pct =4 , + .i_gain_pct =0 , };struct perf_limits {
@@ -468,12 +468,12 @@ static inline void intel_pstate_set_sampstatic inline int intel_pstate_get_scaled_busy (struct cpudata *cpu) {int32_t busy_scaled; -int32_t core_busy, turbo_pstate, current_pstate; +int32_t core_busy, max_pstate, current_pstate; core_busy =int_tofp (cpu->samples[cpu->sample_ptr].core_pct_busy); - turbo_pstate =int_tofp (cpu->pstate.turbo_pstate); + max_pstate =int_tofp (cpu->pstate.max_pstate); current_pstate =int_tofp (cpu->pstate.current_pstate); - busy_scaled =mul_fp (core_busy,div_fp (turbo_pstate, current_pstate)); + busy_scaled =mul_fp (core_busy,div_fp (max_pstate, current_pstate));return fp_toint (busy_scaled); }
Greg Kroah-Hartman
maintainerPATCH 38/99 Btrfs: fix wrong write offset when replacing a device
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Behrens <[email protected]>
commit 115930cb2d444a684975cf2325759cb48ebf80cc upstream.
Miao Xie reported the following issue:
The filesystem was corrupted after we did a device replace.
Steps to reproduce:
# mkfs.btrfs -f -m single -d raid10 <device0>..<device3> # mount <device0> <mnt> # btrfs replace start -rfB 1 <device4> <mnt> # umount <mnt> # btrfsck <device4>
The reason for the issue is that we changed the write offset by mistake, introduced by commit 625f1c8dc.
We read the data from the source device at first, and then write the data into the corresponding place of the new device. In order to implement the "-r" option, the source location is remapped using btrfs_map_block(). The read takes place on the mapped location, and the write needs to take place on the unmapped location. Currently the write is using the mapped location, and this commit changes it back by undoing the change to the write address that the aforementioned commit added by mistake.
--- fs/btrfs/scrub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/scrub.c +1 -1
@@ -2501,7 +2501,7 @@ again: ret =scrub_extent (sctx, extent_logical, extent_len, extent_physical, extent_dev, flags, generation, extent_mirror_num, - extent_physical); + extent_logical - logical + physical);if (ret) goto out;
Greg Kroah-Hartman
maintainerPATCH 39/99 Btrfs: fix lock leak when resuming snapshot deletion
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit fec386ac1428f9c0e672df952cbca5cebd4e4e2f upstream.
We aren't setting path->locks[level] when we resume a snapshot deletion which means we won't unlock the buffer when we free the path. This causes deadlocks if we happen to re-allocate the block before we've evicted the extent buffer from cache. Thanks,
--- fs/btrfs/extent-tree.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/extent-tree.c +2 -0
@@ -7355,6 +7355,7 @@ int btrfs_drop_snapshot(struct btrfs_roowhile (1 ) {btrfs_tree_lock (path->nodes[level]);btrfs_set_lock_blocking (path->nodes[level]); + path->locks[level] =BTRFS_WRITE_LOCK_BLOCKING ; ret = btrfs_lookup_extent_info(trans, root, path->nodes[level]->start,
@@ -7370,6 +7371,7 @@ int btrfs_drop_snapshot(struct btrfs_roobreak ;btrfs_tree_unlock (path->nodes[level]); + path->locks[level] =0 ;WARN_ON (wc->refs[level] !=1 ); level--; }
Greg Kroah-Hartman
maintainerPATCH 40/99 Btrfs: re-add root to dead root list if we stop dropping it
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit d29a9f629e009c9b90e5859bce581070fd6247fc upstream.
If we stop dropping a root for whatever reason we need to add it back to the dead root list so that we will re-start the dropping next transaction commit. The other case this happens is if we recover a drop because we will add a root without adding it to the fs radix tree, so we can leak it's root and commit root extent buffer, adding this to the dead root list makes this cleanup happen. Thanks,
--- fs/btrfs/extent-tree.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/btrfs/extent-tree.c +11 -0
@@ -7298,6 +7298,7 @@ int btrfs_drop_snapshot(struct btrfs_rooint err =0 ;int ret;int level; +bool root_dropped = false; path =btrfs_alloc_path ();if (!path) {
@@ -7473,12 +7474,22 @@ int btrfs_drop_snapshot(struct btrfs_roofree_extent_buffer (root->commit_root);kfree (root); } + root_dropped = true; out_end_trans:btrfs_end_transaction_throttle (trans, tree_root); out_free:kfree (wc);btrfs_free_path (path); out: +/* +* So if we need to stop dropping the snapshot for whatever reason we +* need to make sure to add it back to the dead root list so that we +* keep trying to do the work later. This also cleans up roots if we +* don't have it in the radix (like when we recover after a power fail +* or unmount) so we don't leak memory. +*/ +if (root_dropped == false) +btrfs_add_dead_root (root);if (err)btrfs_std_error (root->fs_info, err);return err;
Greg Kroah-Hartman
maintainerPATCH 41/99 xen-netfront: pull on receive skb may need to happen earlier
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 093b9c71b6e450e375f4646ba86faed0195ec7df upstream.
Due to commit 3683243b ("xen-netfront: use __pskb_pull_tail to ensure linear area is big enough on RX") xennet_fill_frags() may end up filling MAX_SKB_FRAGS + 1 fragments in a receive skb, and only reduce the fragment count subsequently via __pskb_pull_tail(). That's a result of xennet_get_responses() allowing a maximum of one more slot to be consumed (and intermediately transformed into a fragment) if the head slot has a size less than or equal to RX_COPY_THRESHOLD.
Hence we need to adjust xennet_fill_frags() to pull earlier if we reached the maximum fragment count - due to the described behavior of xennet_get_responses() this guarantees that at least the first fragment will get completely consumed, and hence the fragment count reduced.
In order to not needlessly call __pskb_pull_tail() twice, make the original call conditional upon the pull target not having been reached yet, and defer the newly added one as much as possible (an alternative would have been to always call the function right before the call to xennet_fill_frags(), but that would imply more frequent cases of needing to call it twice).
--- drivers/net/xen-netfront.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
drivers/net/xen-netfront.c +13 -18
@@ -276,8 +276,7 @@ no_skb:break ; } -__skb_fill_page_desc (skb,0 , page,0 ,0 ); -skb_shinfo (skb)->nr_frags =1 ; +skb_add_rx_frag (skb,0 , page,0 ,0 ,PAGE_SIZE );__skb_queue_tail (&np->rx_batch, skb); }
@@ -822,7 +821,6 @@ static RING_IDX xennet_fill_frags(struct struct sk_buff_head *list) {struct skb_shared_info *shinfo =skb_shinfo (skb); -int nr_frags = shinfo->nr_frags;RING_IDX cons = np->rx.rsp_cons;struct sk_buff *nskb;
@@ -831,19 +829,21 @@ static RING_IDX xennet_fill_frags(structRING_GET_RESPONSE (&np->rx, ++cons);skb_frag_t *nfrag = &skb_shinfo (nskb)->frags[0 ]; -__skb_fill_page_desc (skb, nr_frags, -skb_frag_page (nfrag), - rx->offset, rx->status); +if (shinfo->nr_frags ==MAX_SKB_FRAGS ) { +unsigned int pull_to =NETFRONT_SKB_CB (skb)->pull_to; - skb->data_len += rx->status; +BUG_ON (pull_to <=skb_headlen (skb)); +__pskb_pull_tail (skb, pull_to -skb_headlen (skb)); + } +BUG_ON (shinfo->nr_frags >=MAX_SKB_FRAGS ); + +skb_add_rx_frag (skb, shinfo->nr_frags,skb_frag_page (nfrag), + rx->offset, rx->status,PAGE_SIZE );skb_shinfo (nskb)->nr_frags =0 ;kfree_skb (nskb); - - nr_frags++; } - shinfo->nr_frags = nr_frags;return cons; }
@@ -929,7 +929,8 @@ static int handle_incoming_queue(structwhile ((skb =__skb_dequeue (rxq)) !=NULL ) {int pull_to =NETFRONT_SKB_CB (skb)->pull_to; -__pskb_pull_tail (skb, pull_to -skb_headlen (skb)); +if (pull_to >skb_headlen (skb)) +__pskb_pull_tail (skb, pull_to -skb_headlen (skb));/* Ethernet work: Delayed to here as it peeks the header. */ skb->protocol =eth_type_trans (skb, dev);
@@ -1015,16 +1016,10 @@ err:skb_shinfo (skb)->frags[0 ].page_offset = rx->offset;skb_frag_size_set (&skb_shinfo (skb)->frags[0 ], rx->status); skb->data_len = rx->status; + skb->len += rx->status; i =xennet_fill_frags (np, skb, &tmpq); -/* -* Truesize is the actual allocation size, even if the -* allocation is only partially used. -*/ - skb->truesize +=PAGE_SIZE *skb_shinfo (skb)->nr_frags; - skb->len += skb->data_len; -if (rx->flags & XEN_NETRXF_csum_blank) skb->ip_summed =CHECKSUM_PARTIAL ;else if (rx->flags & XEN_NETRXF_data_validated)
Greg Kroah-Hartman
maintainerPATCH 42/99 xen/blkback: Check device permissions before allowing OP_DISCARD
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 604c499cbbcc3d5fe5fb8d53306aa0fae1990109 upstream.
We need to make sure that the device is not RO or that the request is not past the number of sectors we want to issue the DISCARD operation for.
This fixes CVE-2013-2140.
--- drivers/block/xen-blkback/blkback.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/block/xen-blkback/blkback.c +12 -1
@@ -647,7 +647,18 @@ static int dispatch_discard_io(struct xeint status =BLKIF_RSP_OKAY ;struct block_device *bdev = blkif->vbd.bdev;unsigned long secure; +struct phys_req preq; + preq.sector_number = req->u.discard.sector_number; + preq.nr_sects = req->u.discard.nr_sectors; + + err =xen_vbd_translate (&preq, blkif,WRITE ); +if (err) { +pr_warn (DRV_PFX "access denied: DISCARD [%llu->%llu] on dev=%04x\n" , + preq.sector_number, + preq.sector_number + preq.nr_sects, blkif->vbd.pdevice); + goto fail_response; + } blkif->st_ds_req++;xen_blkif_get (blkif);
@@ -658,7 +669,7 @@ static int dispatch_discard_io(struct xe err =blkdev_issue_discard (bdev, req->u.discard.sector_number, req->u.discard.nr_sectors,GFP_KERNEL , secure); - +fail_response:if (err == -EOPNOTSUPP ) {pr_debug (DRV_PFX "discard op failed, not supported\n" ); status =BLKIF_RSP_EOPNOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 43/99 x86, suspend: Handle CPUs which fail to #GP on RDMSR
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 5ff560fd48d5b3d82fa0c3aff625c9da1a301911 upstream.
There are CPUs which have errata causing RDMSR of a nonexistent MSR to not fault. We would then try to WRMSR to restore the value of that MSR, causing a crash. Specifically, some Pentium M variants would have this problem trying to save and restore the non-existent EFER, causing a crash on resume.
Work around this by making sure we can write back the result at suspend time.
Huge thanks to Christian Sünkenberg for finding the offending erratum that finally deciphered the mystery.
--- arch/x86/kernel/acpi/sleep.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
arch/x86/kernel/acpi/sleep.c +16 -2
@@ -48,9 +48,20 @@ int acpi_suspend_lowlevel(void)#ifndef CONFIG_64BIT native_store_gdt ((struct desc_ptr *)&header->pmode_gdt); +/* +* We have to check that we can write back the value, and not +* just read it. At least on 90 nm Pentium M (Family 6, Model +* 13), reading an invalid MSR is not guaranteed to trap, see +* Erratum X4 in "Intel Pentium M Processor on 90 nm Process +* with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90 +* nm process with 512-KB L2 Cache Specification Update". +*/ if (!rdmsr_safe (MSR_EFER , &header->pmode_efer_low, - &header->pmode_efer_high)) + &header->pmode_efer_high) && + !wrmsr_safe (MSR_EFER , + header->pmode_efer_low, + header->pmode_efer_high)) header->pmode_behavior |= (1 <<WAKEUP_BEHAVIOR_RESTORE_EFER );#endif /* !CONFIG_64BIT */
@@ -61,7 +72,10 @@ int acpi_suspend_lowlevel(void) }if (!rdmsr_safe (MSR_IA32_MISC_ENABLE , &header->pmode_misc_en_low, - &header->pmode_misc_en_high)) + &header->pmode_misc_en_high) && + !wrmsr_safe (MSR_IA32_MISC_ENABLE , + header->pmode_misc_en_low, + header->pmode_misc_en_high)) header->pmode_behavior |= (1 <<WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE ); header->realmode_flags = acpi_realmode_flags;
Greg Kroah-Hartman
maintainerPATCH 44/99 x86: make sure IDT is page aligned
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
based on 4df05f361937ee86e5a8c9ead8aeb6a19ea9b7d7 upstream.
Since the IDT is referenced from a fixmap, make sure it is page aligned. This avoids the risk of the IDT ever being moved in the bss and having the mapping be offset, resulting in calling incorrect handlers. In the current upstream kernel this is not a manifested bug, but heavily patched kernels (such as those using the PaX patch series) did encounter this bug.
--- arch/x86/kernel/head_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/head_64.S +1 -1
@@ -513,7 +513,7 @@ ENTRY(phys_base) #include "../../x86/xen/xen-head.S" .section .bss, "aw", @nobits - .align L1_CACHE_BYTES + .align PAGE_SIZE ENTRY(idt_table) .skip IDT_ENTRIES * 16
Greg Kroah-Hartman
maintainerPATCH 45/99 md: Remove recent change which allows devices to skip recovery.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 5024c298311f3b97c85cb034f9edaa333fdb9338 upstream.
commit 7ceb17e87bde79d285a8b988cfed9eaeebe60b86
md: Allow devices to be re-added to a read-only array.
allowed a bit more than just that. It also allows devices to be added to a read-write array and to end up skipping recovery.
This patch removes the offending piece of code pending a rewrite for a subsequent release.
More specifically:
If the array has a bitmap, then the device will still need a bitmap based resync ('saved_raid_disk' is set under different conditions is a bitmap is present).
If the array doesn't have a bitmap, then this is correct as long as nothing has been written to the array since the metadata was checked by ->validate_super. However there is no locking to ensure that there was no write.
Bug was introduced in 3.10 and causes data corruption so patch is suitable for 3.10-stable.
--- drivers/md/md.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/md/md.c +0 -14
@@ -7697,20 +7697,6 @@ static int remove_and_add_spares(structcontinue ; rdev->recovery_offset =0 ; -if (rdev->saved_raid_disk >=0 && mddev->in_sync) { -spin_lock_irq (&mddev->write_lock); -if (mddev->in_sync) -/* OK, this device, which is in_sync, -* will definitely be noticed before -* the next write, so recovery isn't -* needed. -*/ - rdev->recovery_offset = mddev->recovery_cp; -spin_unlock_irq (&mddev->write_lock); - } -if (mddev->ro && rdev->recovery_offset != MaxSector) -/* not safe to add this disk now */ -continue ;if (mddev->pers->hot_add_disk (mddev, rdev) ==0 ) {if (sysfs_link_rdev (mddev, rdev))
Greg Kroah-Hartman
maintainerPATCH 46/99 md/raid1: fix bio handling problems in process_checks()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 30bc9b53878a9921b02e3b5bc4283ac1c6de102a upstream.
Recent change to use bio_copy_data() in raid1 when repairing an array is faulty.
The underlying may have changed the bio in various ways using bio_advance and these need to be undone not just for the 'sbio' which is being copied to, but also the 'pbio' (primary) which is being copied from.
So perform the reset on all bios that were read from and do it early.
This also ensure that the sbio->bi_io_vec[j].bv_len passed to memcmp is correct.
This fixes a crash during a 'check' of a RAID1 array. The crash was introduced in 3.10 so this is suitable for 3.10-stable.
--- drivers/md/raid1.c | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-)
drivers/md/raid1.c +30 -23
@@ -1848,6 +1848,36 @@ static int process_checks(struct r1bio *int i;int vcnt; +/* Fix variable parts of all bios */ + vcnt = (r1_bio->sectors +PAGE_SIZE /512 -1 ) >> (PAGE_SHIFT -9 ); +for (i =0 ; i < conf->raid_disks *2 ; i++) { +int j; +int size; +struct bio *b = r1_bio->bios[i]; +if (b->bi_end_io != end_sync_read) +continue ; +/* fixup the bio for reuse */ +bio_reset (b); + b->bi_vcnt = vcnt; + b->bi_size = r1_bio->sectors <<9 ; + b->bi_sector = r1_bio->sector + + conf->mirrors[i].rdev->data_offset; + b->bi_bdev = conf->mirrors[i].rdev->bdev; + b->bi_end_io = end_sync_read; + b->bi_private = r1_bio; + + size = b->bi_size; +for (j =0 ; j < vcnt ; j++) { +struct bio_vec *bi; + bi = &b->bi_io_vec[j]; + bi->bv_offset =0 ; +if (size >PAGE_SIZE ) + bi->bv_len =PAGE_SIZE ; +else + bi->bv_len = size; + size -=PAGE_SIZE ; + } + }for (primary =0 ; primary < conf->raid_disks *2 ; primary++)if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&test_bit (BIO_UPTODATE , &r1_bio->bios[primary]->bi_flags)) {
@@ -1856,12 +1886,10 @@ static int process_checks(struct r1bio *break ; } r1_bio->read_disk = primary; - vcnt = (r1_bio->sectors +PAGE_SIZE /512 -1 ) >> (PAGE_SHIFT -9 );for (i =0 ; i < conf->raid_disks *2 ; i++) {int j;struct bio *pbio = r1_bio->bios[primary];struct bio *sbio = r1_bio->bios[i]; -int size;if (sbio->bi_end_io != end_sync_read)continue ;
@@ -1887,27 +1915,6 @@ static int process_checks(struct r1bio *rdev_dec_pending (conf->mirrors[i].rdev, mddev);continue ; } -/* fixup the bio for reuse */ -bio_reset (sbio); - sbio->bi_vcnt = vcnt; - sbio->bi_size = r1_bio->sectors <<9 ; - sbio->bi_sector = r1_bio->sector + - conf->mirrors[i].rdev->data_offset; - sbio->bi_bdev = conf->mirrors[i].rdev->bdev; - sbio->bi_end_io = end_sync_read; - sbio->bi_private = r1_bio; - - size = sbio->bi_size; -for (j =0 ; j < vcnt ; j++) { -struct bio_vec *bi; - bi = &sbio->bi_io_vec[j]; - bi->bv_offset =0 ; -if (size >PAGE_SIZE ) - bi->bv_len =PAGE_SIZE ; -else - bi->bv_len = size; - size -=PAGE_SIZE ; - }bio_copy_data (sbio, pbio); }
Greg Kroah-Hartman
maintainerPATCH 47/99 md/raid5: fix interaction of replace and recovery.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit f94c0b6658c7edea8bc19d13be321e3860a3fa54 upstream.
If a device in a RAID4/5/6 is being replaced while another is being recovered, then the writes to the replacement device currently don't happen, resulting in corruption when the replacement completes and the new drive takes over.
This is because the replacement writes are only triggered when 's.replacing' is set and not when the similar 's.sync' is set (which is the case during resync and recovery - it means all devices need to be read).
So schedule those writes when s.replacing is set as well.
In this case we cannot use "STRIPE_INSYNC" to record that the replacement has happened as that is needed for recording that any parity calculation is complete. So introduce STRIPE_REPLACED to record if the replacement has happened.
For safety we should also check that STRIPE_COMPUTE_RUN is not set. This has a similar effect to the "s.locked == 0" test. The latter ensure that now IO has been flagged but not started. The former checks if any parity calculation has been flagged by not started. We must wait for both of these to complete before triggering the 'replace'.
Add a similar test to the subsequent check for "are we finished yet". This possibly isn't needed (is subsumed in the STRIPE_INSYNC test), but it makes it more obvious that the REPLACE will happen before we think we are finished.
Finally if a NeedReplace device is not UPTODATE then that is an error. We really must trigger a warning.
This bug was introduced in commit 9a3e1101b827a59ac9036a672f5fa8d5279d0fe2 (md/raid5: detect and handle replacements during recovery.) which introduced replacement for raid5.
That was in 3.3-rc3, so any stable kernel since then would benefit from this fix.
--- drivers/md/raid5.c | 15 ++++++++++----- drivers/md/raid5.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/md/raid5.c +10 -5
@@ -3462,6 +3462,7 @@ static void handle_stripe(struct stripe_ test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) {set_bit (STRIPE_SYNCING , &sh->state);clear_bit (STRIPE_INSYNC , &sh->state); +clear_bit (STRIPE_REPLACED , &sh->state); }spin_unlock (&sh->stripe_lock); }
@@ -3607,19 +3608,23 @@ static void handle_stripe(struct stripe_handle_parity_checks5 (conf, sh, &s, disks); } -if (s.replacing && s.locked ==0 - && !test_bit (STRIPE_INSYNC , &sh->state)) { +if ((s.replacing || s.syncing) && s.locked ==0 + && !test_bit (STRIPE_COMPUTE_RUN , &sh->state) + && !test_bit (STRIPE_REPLACED , &sh->state)) {/* Write out to replacement devices where possible */ for (i =0 ; i < conf->raid_disks; i++) -if (test_bit (R5_UPTODATE , &sh->dev[i].flags) && -test_bit (R5_NeedReplace, &sh->dev[i].flags)) { +if (test_bit (R5_NeedReplace, &sh->dev[i].flags)) { +WARN_ON (!test_bit (R5_UPTODATE , &sh->dev[i].flags));set_bit (R5_WantReplace, &sh->dev[i].flags);set_bit (R5_LOCKED , &sh->dev[i].flags); s.locked++; } -set_bit (STRIPE_INSYNC , &sh->state); +if (s.replacing) +set_bit (STRIPE_INSYNC , &sh->state); +set_bit (STRIPE_REPLACED , &sh->state); }if ((s.syncing || s.replacing) && s.locked ==0 && + !test_bit (STRIPE_COMPUTE_RUN , &sh->state) &&test_bit (STRIPE_INSYNC , &sh->state)) {md_done_sync (conf->mddev,STRIPE_SECTORS ,1 );clear_bit (STRIPE_SYNCING , &sh->state);
drivers/md/raid5.h +1 -0
@@ -306,6 +306,7 @@ enum {STRIPE_SYNC_REQUESTED ,STRIPE_SYNCING ,STRIPE_INSYNC , +STRIPE_REPLACED ,STRIPE_PREREAD_ACTIVE ,STRIPE_DELAYED , STRIPE_DEGRADED,
Greg Kroah-Hartman
maintainerPATCH 48/99 md/raid10: remove use-after-free bug.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 0eb25bb027a100f5a9df8991f2f628e7d851bc1e upstream.
We always need to be careful when calling generic_make_request, as it can start a chain of events which might free something that we are using.
Here is one place I wasn't careful enough. If the wbio2 is not in use, then it might get freed at the first generic_make_request call. So perform all necessary tests first.
This bug was introduced in 3.3-rc3 (24afd80d99) and can cause an oops, so fix is suitable for any -stable since then.
--- drivers/md/raid10.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/md/raid10.c +7 -1
@@ -2268,12 +2268,18 @@ static void recovery_request_write(struc d = r10_bio->devs[1 ].devnum; wbio = r10_bio->devs[1 ].bio; wbio2 = r10_bio->devs[1 ].repl_bio; +/* Need to test wbio2->bi_end_io before we call +* generic_make_request as if the former is NULL, +* the latter is free to free wbio2. +*/ +if (wbio2 && !wbio2->bi_end_io) + wbio2 =NULL ;if (wbio->bi_end_io) {atomic_inc (&conf->mirrors[d].rdev->nr_pending);md_sync_acct (conf->mirrors[d].rdev->bdev,bio_sectors (wbio));generic_make_request (wbio); } -if (wbio2 && wbio2->bi_end_io) { +if (wbio2) {atomic_inc (&conf->mirrors[d].replacement->nr_pending);md_sync_acct (conf->mirrors[d].replacement->bdev,bio_sectors (wbio2));
Greg Kroah-Hartman
maintainerPATCH 49/99 ata: Fix DVD not dectected at some platform with Wellsburg PCH
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Youquan Song <[email protected]>
commit eac27f04a71e1f39f196f7e520d16dcefc955d77 upstream.
There is a patch b55f84e2d527182e7c611d466cd0bb6ddce201de "ata_piix: Fix DVD
not dectected at some Haswell platforms" to fix an issue of DVD not
recognized on Haswell Desktop platform with Lynx Point.
Recently, it is also found the same issue at some platformas with Wellsburg PCH.
So deliver a similar patch to fix it by disables 32bit PIO in IDE mode.
--- drivers/ata/ata_piix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ata_piix.c +1 -1
@@ -330,7 +330,7 @@ static const struct pci_device_id piix_p/* SATA Controller IDE (Wellsburg) */ { 0x8086, 0x8d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },/* SATA Controller IDE (Wellsburg) */ - { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb },/* SATA Controller IDE (Wellsburg) */ { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, /* SATA Controller IDE (Wellsburg) */
Greg Kroah-Hartman
maintainerPATCH 50/99 libata: make it clear that sata_inic162x is experimental
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit bb9696192826a7d9279caf872e95b41bc26c7eff upstream.
sata_inic162x never reached a state where it's reliable enough for production use and data corruption is a relatively common occurrence. Make the driver generate warning about the issues and mark the Kconfig option as experimental.
If the situation doesn't improve, we'd be better off making it depend on CONFIG_BROKEN. Let's wait for several cycles and see if the kernel message draws any attention.
--- drivers/ata/Kconfig | 2 +- drivers/ata/sata_inic162x.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/ata/Kconfig +1 -1
@@ -107,7 +107,7 @@ config SATA_FSL If unsure, say N. config SATA_INIC162X - tristate "Initio 162x SATA support" + tristate "Initio 162x SATA support (Very Experimental)" depends on PCI help This option enables support for Initio 162x Serial ATA.
drivers/ata/sata_inic162x.c +14 -0
@@ -6,6 +6,18 @@* * This file is released under GPL v2. * +* **** WARNING **** +* +* This driver never worked properly and unfortunately data corruption is +* relatively common. There isn't anyone working on the driver and there's +* no support from the vendor. Do not use this driver in any production +* environment. +* +* http://thread.gmane.org/gmane.linux.debian.devel.bugs.rc/378525/focus=54491 +* https://bugzilla.kernel.org/show_bug.cgi?id=60565 +* +* ***************** +* * This controller is eccentric and easily locks up if something isn't * right. Documentation is available at initio's website but it only * documents registers (not programming model).
@@ -807,6 +819,8 @@ static int inic_init_one(struct pci_devata_print_version_once (&pdev->dev,DRV_VERSION ); +dev_alert (&pdev->dev,"inic162x support is broken with common data corruption issues and will be disabled by default, contact [email protected] if in production use\n" ); +/* alloc host */ host =ata_host_alloc_pinfo (&pdev->dev, ppi,NR_PORTS ); hpriv =devm_kzalloc (&pdev->dev,sizeof (*hpriv),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 51/99 svcrdma: underflow issue in decode_write_list()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b2781e1021525649c0b33fffd005ef219da33926 upstream.
My static checker marks everything from ntohl() as untrusted and it complains we could have an underflow problem doing:
return (u32 *)&ary->wc_array[nchunks];
Also on 32 bit systems the upper bound check could overflow.
--- net/sunrpc/xprtrdma/svc_rdma_marshal.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
net/sunrpc/xprtrdma/svc_rdma_marshal.c +14 -6
@@ -98,6 +98,7 @@ void svc_rdma_rcl_chunk_counts(struct rp*/ static u32 *decode_write_list (u32 *va,u32 *vaend) { +unsigned long start, end;int nchunks; struct rpcrdma_write_array *ary =
@@ -113,9 +114,12 @@ static u32 *decode_write_list(u32 *va, ureturn NULL ; } nchunks =ntohl (ary->wc_nchunks); -if (((unsigned long )&ary->wc_array[0 ] + - (sizeof (struct rpcrdma_write_chunk ) * nchunks)) > - (unsigned long )vaend) { + + start = (unsigned long )&ary->wc_array[0 ]; + end = (unsigned long )vaend; +if (nchunks <0 || + nchunks > (SIZE_MAX - start) /sizeof (struct rpcrdma_write_chunk ) || + (start + (sizeof (struct rpcrdma_write_chunk ) * nchunks)) > end) {dprintk ("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n" , ary, nchunks, vaend);return NULL ;
@@ -129,6 +133,7 @@ static u32 *decode_write_list(u32 *va, ustatic u32 *decode_reply_array (u32 *va,u32 *vaend) { +unsigned long start, end;int nchunks;struct rpcrdma_write_array *ary = (struct rpcrdma_write_array *)va;
@@ -143,9 +148,12 @@ static u32 *decode_reply_array(u32 *va,return NULL ; } nchunks =ntohl (ary->wc_nchunks); -if (((unsigned long )&ary->wc_array[0 ] + - (sizeof (struct rpcrdma_write_chunk ) * nchunks)) > - (unsigned long )vaend) { + + start = (unsigned long )&ary->wc_array[0 ]; + end = (unsigned long )vaend; +if (nchunks <0 || + nchunks > (SIZE_MAX - start) /sizeof (struct rpcrdma_write_chunk ) || + (start + (sizeof (struct rpcrdma_write_chunk ) * nchunks)) > end) {dprintk ("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n" , ary, nchunks, vaend);return NULL ;
Greg Kroah-Hartman
maintainerPATCH 52/99 crypto: caam - Fixed the memory out of bound overwrite issue
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vakul Garg <[email protected]>
commit 9c23b7d3d6bda41e2a27375df705485523a96dc8 upstream.
When kernel is compiled with CONFIG_SLUB_DEBUG=y and CRYPTO_MANAGER_DISABLE_TESTS=n, during kernel bootup, the kernel reports error given below. The root cause is that in function hash_digest_key(), for allocating descriptor, insufficient memory was being allocated. The required number of descriptor words apart from input and output pointers are 8 (instead of 6).
=============================================================================
BUG dma-kmalloc-32 (Not tainted): Redzone overwritten
-----------------------------------------------------------------------------
Disabling lock debugging due to kernel taint
INFO: 0xdec5dec0-0xdec5dec3. First byte 0x0 instead of 0xcc
INFO: Allocated in ahash_setkey+0x60/0x594 age=7 cpu=1 pid=1257
__kmalloc+0x154/0x1b4
ahash_setkey+0x60/0x594
test_hash+0x260/0x5a0
alg_test_hash+0x48/0xb0
alg_test+0x84/0x228
cryptomgr_test+0x4c/0x54
kthread+0x98/0x9c
ret_from_kernel_thread+0x64/0x6cINFO: Slab 0xc0bd0ba0 objects=19 used=2 fp=0xdec5d0d0 flags=0x0081
INFO: Object 0xdec5dea0 @offset=3744 fp=0x5c200014
Bytes b4 dec5de90: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ
Object dec5dea0: b0 80 00 0a 84 41 00 0d f0 40 00 00 00 67 3f c0 [email protected]?.
Object dec5deb0: 00 00 00 50 2c 14 00 50 f8 40 00 00 1e c5 d0 00 ...P,..P.@......
Redzone dec5dec0: 00 00 00 14 ....
Padding dec5df68: 5a 5a 5a 5a 5a 5a 5a 5a
ZZZZZZZZ
Call Trace: [dec65b60] [c00071b4] show_stack+0x4c/0x168 (unreliable) [dec65ba0] [c00d4ec8] check_bytes_and_report+0xe4/0x11c [dec65bd0] [c00d507c] check_object+0x17c/0x23c [dec65bf0] [c0550a00] free_debug_processing+0xf4/0x294 [dec65c20] [c0550bdc] __slab_free+0x3c/0x294 [dec65c80] [c03f0744] ahash_setkey+0x4e0/0x594 [dec65cd0] [c01ef138] test_hash+0x260/0x5a0 [dec65e50] [c01ef4c0] alg_test_hash+0x48/0xb0 [dec65e70] [c01eecc4] alg_test+0x84/0x228 [dec65ee0] [c01ec640] cryptomgr_test+0x4c/0x54 [dec65ef0] [c005adc0] kthread+0x98/0x9c [dec65f40] [c000e1ac] ret_from_kernel_thread+0x64/0x6c
FIX dma-kmalloc-32: Restoring 0xdec5dec0-0xdec5dec3=0xcc
--- drivers/crypto/caam/caamhash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/caam/caamhash.c +1 -1
@@ -429,7 +429,7 @@ static int hash_digest_key(struct caam_hdma_addr_t src_dma, dst_dma;int ret =0 ; - desc =kmalloc (CAAM_CMD_SZ *6 +CAAM_PTR_SZ *2 ,GFP_KERNEL |GFP_DMA ); + desc =kmalloc (CAAM_CMD_SZ *8 +CAAM_PTR_SZ *2 ,GFP_KERNEL |GFP_DMA );if (!desc) {dev_err (jrdev,"unable to allocate key input memory\n" );return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 53/99 powerpc/modules: Module CRC relocation fix causes perf issues
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 0e0ed6406e61434d3f38fb58aa8464ec4722b77e upstream.
Module CRCs are implemented as absolute symbols that get resolved by a linker script. We build an intermediate .o that contains an unresolved symbol for each CRC. genksysms parses this .o, calculates the CRCs and writes a linker script that "resolves" the symbols to the calculated CRC.
Unfortunately the ppc64 relocatable kernel sees these CRCs as symbols that need relocating and relocates them at boot. Commit d4703aef (module: handle ppc64 relocating kcrctabs when CONFIG_RELOCATABLE=y) added a hook to reverse the bogus relocations. Part of this patch created a symbol at 0x0:
# head -2 /proc/kallsyms 0000000000000000 T reloc_start c000000000000000 T .__start
This reloc_start symbol is causing lots of confusion to perf. It thinks reloc_start is a massive function that stretches from 0x0 to 0xc000000000000000 and we get various cryptic errors out of perf, including:
problem incrementing symbol count, skipping event
This patch removes the reloc_start linker script label and instead defines it as PHYSICAL_START. We also need to wrap it with CONFIG_PPC64 because the ppc32 kernel can set a non zero PHYSICAL_START at compile time and we wouldn't want to subtract it from the CRCs in that case.
--- arch/powerpc/include/asm/module.h | 5 ++--- arch/powerpc/kernel/vmlinux.lds.S | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/module.h +2 -3
@@ -82,10 +82,9 @@ struct exception_table_entry;void sort_ex_table (struct exception_table_entry *start,struct exception_table_entry *finish); -#ifdef CONFIG_MODVERSIONS +#if defined(CONFIG_MODVERSIONS ) && defined(CONFIG_PPC64 )#define ARCH_RELOCATES_KCRCTAB - -extern const unsigned long reloc_start[]; +#define reloc_start PHYSICAL_START#endif #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MODULE_H */
arch/powerpc/kernel/vmlinux.lds.S +0 -3
@@ -38,9 +38,6 @@ jiffies = jiffies_64 + 4; #endif SECTIONS { - . = 0; - reloc_start = .; - . = KERNELBASE; /*
Greg Kroah-Hartman
maintainerPATCH 54/99 nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshula Jayasuriya <[email protected]>
commit e4daf1ffbe6cc3b12aab4d604e627829e93e9914 upstream.
The following call chain:
------------------------------------------------------------nfs4_get_vfs_file
- nfsd_open
- dentry_open
- do_dentry_open
- __get_file_write_access
- get_write_access
- return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY;
------------------------------------------------------------
can result in the following state:
------------------------------------------------------------
struct nfs4_file {
...
fi_fds = {0xffff880c1fa65c80, 0xffffffffffffffe6, 0x0},
fi_access = {{
counter = 0x1
}, {
counter = 0x0
}},...
------------------------------------------------------------
1) First time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is NULL, hence nfsd_open() is called where we get status set to an error and fp->fi_fds[O_WRONLY] to -ETXTBSY. Thus we do not reach nfs4_file_get_access() and fi_access[O_WRONLY] is not incremented.
2) Second time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is NOT NULL (-ETXTBSY), so nfsd_open() is NOT called, but nfs4_file_get_access() IS called and fi_access[O_WRONLY] is incremented. Thus we leave a landmine in the form of the nfs4_file data structure in an incorrect state.
3) Eventually, when __nfs4_file_put_access() is called it finds fi_access[O_WRONLY] being non-zero, it decrements it and calls nfs4_file_put_fd() which tries to fput -ETXTBSY.
------------------------------------------------------------
...
[exception RIP: fput+0x9]
RIP: ffffffff81177fa9 RSP: ffff88062e365c90 RFLAGS: 00010282
RAX: ffff880c2b3d99cc RBX: ffff880c2b3d9978 RCX: 0000000000000002
RDX: dead000000100101 RSI: 0000000000000001 RDI: ffffffffffffffe6
RBP: ffff88062e365c90 R8: ffff88041fe797d8 R9: ffff88062e365d58
R10: 0000000000000008 R11: 0000000000000000 R12: 0000000000000001
R13: 0000000000000007 R14: 0000000000000000 R15: 0000000000000000
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #9 [ffff88062e365c98] __nfs4_file_put_access at ffffffffa0562334 [nfsd]
#10 [ffff88062e365cc8] nfs4_file_put_access at ffffffffa05623ab [nfsd] #11 [ffff88062e365ce8] free_generic_stateid at ffffffffa056634d [nfsd] #12 [ffff88062e365d18] release_open_stateid at ffffffffa0566e4b [nfsd] #13 [ffff88062e365d38] nfsd4_close at ffffffffa0567401 [nfsd] #14 [ffff88062e365d88] nfsd4_proc_compound at ffffffffa0557f28 [nfsd] #15 [ffff88062e365dd8] nfsd_dispatch at ffffffffa054543e [nfsd] #16 [ffff88062e365e18] svc_process_common at ffffffffa04ba5a4 [sunrpc] #17 [ffff88062e365e98] svc_process at ffffffffa04babe0 [sunrpc] #18 [ffff88062e365eb8] nfsd at ffffffffa0545b62 [nfsd]
#19 [ffff88062e365ee8] kthread at ffffffff81090886
#20 [ffff88062e365f48] kernel_thread at ffffffff8100c14a
------------------------------------------------------------
--- fs/nfsd/vfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/vfs.c +3 -2
@@ -802,9 +802,10 @@ nfsd_open(struct svc_rqst *rqstp, struct flags =O_WRONLY |O_LARGEFILE ; } *filp =dentry_open (&path, flags,current_cred ()); -if (IS_ERR (*filp)) +if (IS_ERR (*filp)) { host_err =PTR_ERR (*filp); -else { + *filp =NULL ; + }else { host_err =ima_file_check (*filp, may_flags);if (may_flags &NFSD_MAY_64BIT_COOKIE )
Greg Kroah-Hartman
maintainerPATCH 55/99 Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit ed4bb9744b41d39ba35080c2390e201575121dc7 upstream.
Each subnet string needs to be separated with a semicolon. Fix this bug.
--- tools/hv/hv_kvp_daemon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/hv/hv_kvp_daemon.c +3 -2
@@ -1016,9 +1016,10 @@ kvp_get_ip_info(int family, char *if_namif (sn_offset ==0 )strcpy (sn_str, cidr_mask); -else +else { +strcat ((char *)ip_buffer->sub_net,";" );strcat (sn_str, cidr_mask); -strcat ((char *)ip_buffer->sub_net,";" ); + } sn_offset +=strlen (sn_str) +1 ; }
Greg Kroah-Hartman
maintainerPATCH 56/99 Drivers: hv: balloon: Fix a bug in the hot-add code
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit ed07ec93e83ec471d365ce084e43ad90fd205903 upstream.
As we hot-add 128 MB chunks of memory, we wait to ensure that the memory is onlined before attempting to hot-add the next chunk. If the udev rule for memory hot-add is not executed within the allowed time, we would rollback the state and abort further hot-add. Since the hot-add has succeeded and the only failure is that the memory is not onlined within the allowed time, we should not be rolling back the state. Fix this bug.
--- drivers/hv/hv_balloon.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/hv/hv_balloon.c +5 -8
@@ -562,7 +562,7 @@ static void hv_mem_hot_add(unsigned long struct hv_hotadd_state *has) {int ret =0 ; -int i, nid, t; +int i, nid;unsigned long start_pfn;unsigned long processed_pfn;unsigned long total_pfn = pfn_count;
@@ -607,14 +607,11 @@ static void hv_mem_hot_add(unsigned long/* * Wait for the memory block to be onlined. +* Since the hot add has succeeded, it is ok to +* proceed even if the pages in the hot added region +* have not been "onlined" within the allowed time. */ - t =wait_for_completion_timeout (&dm_device.ol_waitevent,5 *HZ ); -if (t ==0 ) { -pr_info ("hot_add memory timedout\n" ); - has->ha_end_pfn -=HA_CHUNK ; - has->covered_end_pfn -= processed_pfn; -break ; - } +wait_for_completion_timeout (&dm_device.ol_waitevent,5 *HZ ); }
Greg Kroah-Hartman
maintainerPATCH 57/99 Drivers: hv: balloon: Do not post pressure status if interrupted
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit c5e2254f8d63a6654149aa32ac5f2b7dd66a976d upstream.
When we are posting pressure status, we may get interrupted and handle the un-balloon operation. In this case just don't post the status as we know the pressure status is stale.
--- drivers/hv/hv_balloon.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hv/hv_balloon.c +8 -0
@@ -975,6 +975,14 @@ static void post_status(struct hv_dynmem dm->num_pages_ballooned +compute_balloon_floor (); +/* +* If our transaction ID is no longer current, just don't +* send the status. This can happen if we were interrupted +* after we picked our transaction ID. +*/ +if (status.hdr.trans_id !=atomic_read (&trans_id)) +return ; + vmbus_sendpacket(dm->dev->channel, &status, sizeof(struct dm_status), (unsigned long)NULL,
Greg Kroah-Hartman
maintainerPATCH 58/99 regmap: cache: bail in regmap_async_complete() for bus-less maps
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit f2e055e7c9c6084bfbaa68701e52562acf96419e upstream.
Commit f8bd822cb ("regmap: cache: Factor out block sync") made regcache_rbtree_sync() call regmap_async_complete(), which in turn does not check for map->bus before dereferencing it.
This causes a NULL pointer dereference on bus-less maps.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1717,7 +1717,7 @@ int regmap_async_complete(struct regmapint ret;/* Nothing to do with no async support */ -if (!map->bus->async_write) +if (!map->bus || !map->bus->async_write)return 0 ;trace_regmap_async_complete_start (map->dev);
Greg Kroah-Hartman
maintainerPATCH 59/99 ACPI / scan: Always call acpi_bus_scan() for bus check notifications
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 8832f7e43fa7f0f19bd54e13766a825dd1ed4d6f upstream.
An ACPI_NOTIFY_BUS_CHECK notification means that we should scan the entire namespace starting from the given handle even if the device represented by that handle is present (other devices below it may just have appeared).
For this reason, modify acpi_scan_bus_device_check() to always run acpi_bus_scan() if the notification being handled is of type ACPI_NOTIFY_BUS_CHECK.
--- drivers/acpi/scan.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/acpi/scan.c +6 -4
@@ -237,10 +237,12 @@ static void acpi_scan_bus_device_check(amutex_lock (&acpi_scan_lock); -acpi_bus_get_device (handle, &device); -if (device) { -dev_warn (&device->dev,"Attempt to re-insert\n" ); - goto out; +if (ost_source !=ACPI_NOTIFY_BUS_CHECK ) { +acpi_bus_get_device (handle, &device); +if (device) { +dev_warn (&device->dev,"Attempt to re-insert\n" ); + goto out; + } }acpi_evaluate_hotplug_ost (handle, ost_source,ACPI_OST_SC_INSERT_IN_PROGRESS ,NULL );
Greg Kroah-Hartman
maintainerPATCH 60/99 ACPI / scan: Do not try to attach scan handlers to devices having them
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 3a391a39593b48341f0908511590a6c0e55cc069 upstream.
In acpi_bus_device_attach(), if there is an ACPI device object for the given handle and that device object has a scan handler attached to it already, there's nothing more to do for that handle. Moreover, if acpi_scan_attach_handler() is called then, it may execute the .attach() callback of the ACPI scan handler already attached to the device object and that may lead to interesting breakage.
For this reason, make acpi_bus_device_attach() return success immediately when the handle's device object has a scan handler attached to it.
--- drivers/acpi/scan.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/scan.c +3 -0
@@ -1892,6 +1892,9 @@ static acpi_status acpi_bus_device_attacif (acpi_bus_get_device (handle, &device))return AE_CTRL_DEPTH ; +if (device->handler) +return AE_OK ; + ret =acpi_scan_attach_handler (device);if (ret)return ret >0 ?AE_OK :AE_CTRL_DEPTH ;
Greg Kroah-Hartman
maintainerPATCH 61/99 ACPI / memhotplug: Fix a stale pointer in error path
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit d19f503e22316a84c39bc19445e0e4fdd49b3532 upstream.
device->driver_data needs to be cleared when releasing its data, mem_device, in an error path of acpi_memory_device_add().
The function evaluates the _CRS of memory device objects, and fails when it gets an unexpected resource or cannot allocate memory. A kernel crash or data corruption may occur when the kernel accesses the stale pointer.
--- drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpi_memhotplug.c +1 -0
@@ -283,6 +283,7 @@ static int acpi_memory_device_add(struct/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; }
Greg Kroah-Hartman
maintainerPATCH 62/99 ACPI / video: ignore BIOS initial backlight value for Fujitsu E753
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit 9657a565a476d517451c10b0bcc106e300785aff upstream.
The BIOS of FUjitsu E753 reports an incorrect initial backlight value for WIN8 compatible OS, causing backlight to be dark during startup. This change causes the incorrect initial value from BIOS to be ignored.
References: https://bugzilla.kernel.org/show_bug.cgi?id=60161
--- drivers/acpi/video.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/video.c +8 -0
@@ -450,6 +450,14 @@ static struct dmi_system_id video_dmi_ta }, { .callback = video_ignore_initial_backlight, + .ident = "Fujitsu E753", + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E753"), + }, + }, + { + .callback = video_ignore_initial_backlight, .ident = "HP Pavilion dm4", .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
Greg Kroah-Hartman
maintainerPATCH 63/99 dm mpath: fix ioctl deadlock when no paths
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
commit 6c182cd88d179cbbd06f4f8a8a19b6977940753f upstream.
When multipath needs to retry an ioctl the reference to the current live table needs to be dropped. Otherwise a deadlock occurs when all paths are down:
- dm_blk_ioctl takes a reference to the current table and spins in multipath_ioctl().
- A new table is being loaded, but upon resume the process hangs in dm_table_destroy() waiting for references to drop to zero.
With this patch the reference to the old table is dropped prior to retry, thereby avoiding the deadlock.
--- drivers/md/dm-mpath.c | 8 ++------ drivers/md/dm.c | 9 ++++++++- 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/md/dm-mpath.c +2 -6
@@ -1561,7 +1561,6 @@ static int multipath_ioctl(struct dm_tarunsigned long flags;int r; -again: bdev =NULL ; mode =0 ; r =0 ;
@@ -1579,7 +1578,7 @@ again: }if ((pgpath && m->queue_io) || (!pgpath && m->queue_if_no_path)) - r = -EAGAIN ; + r = -ENOTCONN ;else if (!bdev) r = -EIO ;
@@ -1591,11 +1590,8 @@ again:if (!r && ti->len !=i_size_read (bdev->bd_inode) >>SECTOR_SHIFT ) r =scsi_verify_blk_ioctl (NULL , cmd); -if (r == -EAGAIN && !fatal_signal_pending (current)) { +if (r == -ENOTCONN && !fatal_signal_pending (current))queue_work (kmultipathd, &m->process_queued_ios); -msleep (10 ); - goto again; - }return r ? :__blkdev_driver_ioctl (bdev, mode, cmd, arg); }
drivers/md/dm.c +8 -1
@@ -386,10 +386,12 @@ static int dm_blk_ioctl(struct block_dev unsigned int cmd, unsigned long arg) {struct mapped_device *md = bdev->bd_disk->private_data; -struct dm_table *map =dm_get_live_table (md); +struct dm_table *map;struct dm_target *tgt;int r = -ENOTTY ; +retry: + map =dm_get_live_table (md);if (!map || !dm_table_get_size (map)) goto out;
@@ -410,6 +412,11 @@ static int dm_blk_ioctl(struct block_dev out:dm_table_put (map); +if (r == -ENOTCONN ) { +msleep (10 ); + goto retry; + } +return r; }
Greg Kroah-Hartman
maintainerPATCH 64/99 dm ioctl: set noio flag to avoid __vmalloc deadlock
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 1c0e883e86ece31880fac2f84b260545d66a39e0 upstream.
Set noio flag while calling __vmalloc() because it doesn't fully respect gfp flags to avoid a possible deadlock (see commit 502624bdad3dba45dfaacaf36b7d83e39e74b2d2).
This should be backported to stable kernels 3.8 and newer. The kernel 3.8 doesn't have memalloc_noio_save(), so we should set and restore process flag PF_MEMALLOC instead.
--- drivers/md/dm-ioctl.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/dm-ioctl.c +3 -0
@@ -1644,7 +1644,10 @@ static int copy_params(struct dm_ioctl _ }if (!dmi) { +unsigned noio_flag; + noio_flag =memalloc_noio_save (); dmi =__vmalloc (param_kernel->data_size,GFP_NOIO | __GFP_REPEAT | __GFP_HIGH,PAGE_KERNEL ); +memalloc_noio_restore (noio_flag);if (dmi) *param_flags |=DM_PARAMS_VMALLOC ; }
Greg Kroah-Hartman
maintainerPATCH 65/99 dm verity: fix inability to use a few specific devices sizes
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit b1bf2de07271932326af847a3c6a01fdfd29d4be upstream.
Fix a boundary condition that caused failure for certain device sizes.
The problem is reported at
http://code.google.com/p/cryptsetup/issues/detail?id=160
For certain device sizes the number of hashes at a specific level was calculated incorrectly.
It happens for example for a device with data and metadata block size 4096 that has 16385 blocks and algorithm sha256.
The user can test if he is affected by this bug by running the "veritysetup verify" command and also by activating the dm-verity kernel driver and reading the whole block device. If it passes without an error, then the user is not affected.
The condition for the bug is:
Split the total number of data blocks (data_block_bits) into bit strings, each string has hash_per_block_bits bits. hash_per_block_bits is rounddown(log2(metadata_block_size/hash_digest_size)). Equivalently, you can say that you convert data_blocks_bits to 2^hash_per_block_bits base.
If there some zero bit string below the most significant bit string and at least one bit below this zero bit string is set, then the bug happens.
The same bug exists in the userspace veritysetup tool, so you must use fixed veritysetup too if you want to use devices that are affected by this boundary condition.
--- drivers/md/dm-verity.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/md/dm-verity.c +2 -3
@@ -831,9 +831,8 @@ static int verity_ctr(struct dm_target *for (i = v->levels -1 ; i >=0 ; i--) {sector_t s; v->hash_level_block[i] = hash_position; - s =verity_position_at_level (v, v->data_blocks, i); - s = (s >> v->hash_per_block_bits) + - !!(s & ((1 << v->hash_per_block_bits) -1 )); + s = (v->data_blocks + ((sector_t )1 << ((i +1 ) * v->hash_per_block_bits)) -1 ) + >> ((i +1 ) * v->hash_per_block_bits);if (hash_position + s < hash_position) { ti->error ="Hash device offset overflow" ; r = -E2BIG ;
Greg Kroah-Hartman
maintainerPATCH 66/99 drm/radeon/hdmi: make sure we have an afmt block assigned
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit c2b4cacfe9816c1fe378c785ce8a678cf0635ec6 upstream.
Prevents a segfault if an afmt block is not assigned to the encoder such as in the LVDS or eDP case.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=66714
--- drivers/gpu/drm/radeon/evergreen_hdmi.c | 6 ++++++ drivers/gpu/drm/radeon/r600_hdmi.c | 6 ++++++ 2 files changed, 12 insertions(+)
drivers/gpu/drm/radeon/evergreen_hdmi.c +6 -0
@@ -177,6 +177,9 @@ void evergreen_hdmi_setmode(struct drm_euint32_t offset;ssize_t err; +if (!dig || !dig->afmt) +return ; +/* Silent, r600_hdmi_enable will raise WARN for us */ if (!dig->afmt->enabled)return ;
@@ -280,6 +283,9 @@ void evergreen_hdmi_enable(struct drm_enstruct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; +if (!dig || !dig->afmt) +return ; +/* Silent, r600_hdmi_enable will raise WARN for us */ if (enable && dig->afmt->enabled)return ;
drivers/gpu/drm/radeon/r600_hdmi.c +6 -0
@@ -266,6 +266,9 @@ void r600_hdmi_setmode(struct drm_encodeuint32_t offset;ssize_t err; +if (!dig || !dig->afmt) +return ; +/* Silent, r600_hdmi_enable will raise WARN for us */ if (!dig->afmt->enabled)return ;
@@ -448,6 +451,9 @@ void r600_hdmi_enable(struct drm_encoderstruct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;u32 hdmi =HDMI0_ERROR_ACK ; +if (!dig || !dig->afmt) +return ; +/* Silent, r600_hdmi_enable will raise WARN for us */ if (enable && dig->afmt->enabled)return ;
Greg Kroah-Hartman
maintainerPATCH 67/99 drm/radeon: fix UVD fence emit
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit c9a6ca4abd5f1978ef15b3ece3474f4372ae5fe7 upstream.
Currently doesn't matter cause we allocate the fence in the lower 265MB anyway.
--- drivers/gpu/drm/radeon/r600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r600.c +1 -1
@@ -2986,7 +2986,7 @@ void r600_uvd_fence_emit(struct radeon_d struct radeon_fence *fence) {struct radeon_ring *ring = &rdev->ring[fence->ring]; -uint32_t addr = rdev->fence_drv[fence->ring].gpu_addr; +uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr;radeon_ring_write (ring,PACKET0 (UVD_CONTEXT_ID ,0 ));radeon_ring_write (ring, fence->seq);
Greg Kroah-Hartman
maintainerPATCH 68/99 drm/radeon: allow selection of alignment in the sub-allocator
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 6c4f978b357bc779c703fda1f200e9179623d3e9 upstream.
There are cases where we need more than 4k alignment. No functional change with this commit.
--- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_gart.c | 1 + drivers/gpu/drm/radeon/radeon_object.h | 2 +- drivers/gpu/drm/radeon/radeon_ring.c | 1 + drivers/gpu/drm/radeon/radeon_sa.c | 7 ++++--- 5 files changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon.h +1 -0
@@ -408,6 +408,7 @@ struct radeon_sa_manager {uint64_t gpu_addr;void *cpu_ptr;uint32_t domain; +uint32_t align; };struct radeon_sa_bo ;
drivers/gpu/drm/radeon/radeon_gart.c +1 -0
@@ -467,6 +467,7 @@ int radeon_vm_manager_init(struct radeon size *=2 ; r =radeon_sa_bo_manager_init (rdev, &rdev->vm_manager.sa_manager,RADEON_GPU_PAGE_ALIGN (size), +RADEON_GPU_PAGE_SIZE ,RADEON_GEM_DOMAIN_VRAM );if (r) { dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n",
drivers/gpu/drm/radeon/radeon_object.h +1 -1
@@ -158,7 +158,7 @@ static inline void * radeon_sa_bo_cpu_adextern int radeon_sa_bo_manager_init (struct radeon_device *rdev,struct radeon_sa_manager *sa_manager, -unsigned size,u32 domain); +unsigned size,u32 align,u32 domain);extern void radeon_sa_bo_manager_fini (struct radeon_device *rdev,struct radeon_sa_manager *sa_manager); extern int radeon_sa_bo_manager_start(struct radeon_device *rdev,
drivers/gpu/drm/radeon/radeon_ring.c +1 -0
@@ -224,6 +224,7 @@ int radeon_ib_pool_init(struct radeon_de } r =radeon_sa_bo_manager_init (rdev, &rdev->ring_tmp_bo,RADEON_IB_POOL_SIZE *64 *1024 , +RADEON_GPU_PAGE_SIZE ,RADEON_GEM_DOMAIN_GTT );if (r) {return r;
drivers/gpu/drm/radeon/radeon_sa.c +4 -3
@@ -49,7 +49,7 @@ static void radeon_sa_bo_try_free(structint radeon_sa_bo_manager_init (struct radeon_device *rdev,struct radeon_sa_manager *sa_manager, -unsigned size,u32 domain) +unsigned size,u32 align,u32 domain) {int i, r;
@@ -57,13 +57,14 @@ int radeon_sa_bo_manager_init(struct rad sa_manager->bo =NULL ; sa_manager->size = size; sa_manager->domain = domain; + sa_manager->align = align; sa_manager->hole = &sa_manager->olist;INIT_LIST_HEAD (&sa_manager->olist);for (i =0 ; i <RADEON_NUM_RINGS ; ++i) {INIT_LIST_HEAD (&sa_manager->flist[i]); } - r =radeon_bo_create (rdev, size,RADEON_GPU_PAGE_SIZE , true, + r =radeon_bo_create (rdev, size, align, true, domain,NULL , &sa_manager->bo);if (r) {dev_err (rdev->dev,"(%d) failed to allocate bo for manager\n" , r);
@@ -317,7 +318,7 @@ int radeon_sa_bo_new(struct radeon_devicunsigned tries[RADEON_NUM_RINGS ];int i, r; -BUG_ON (align >RADEON_GPU_PAGE_SIZE ); +BUG_ON (align > sa_manager->align);BUG_ON (size > sa_manager->size); *sa_bo =kmalloc (sizeof (struct radeon_sa_bo ),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 69/99 drm/radeon: fix endian issues with DP handling (v3)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 34be8c9af7b8728465963740fc11136ae90dfc36 upstream.
The atom interpreter expects data in LE format, so swap the message buffer as apprioriate.
v2: properly handle non-dw aligned byte counts.
v3: properly handle remainder
--- drivers/gpu/drm/radeon/atombios_dp.c | 43 +++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +39 -4
@@ -44,6 +44,41 @@ static char *pre_emph_names[] = { };/***** radeon AUX functions *****/ + +/* Atom needs data in little endian format +* so swap as appropriate when copying data to +* or from atom. Note that atom operates on +* dw units. +*/ +static void radeon_copy_swap (u8 *dst,u8 *src,u8 num_bytes,bool to_le) +{ +#ifdef __BIG_ENDIAN +u8 src_tmp[20 ], dst_tmp[20 ];/* used for byteswapping */ +u32 *dst32, *src32; +int i; + +memcpy (src_tmp, src, num_bytes); + src32 = (u32 *)src_tmp; + dst32 = (u32 *)dst_tmp; +if (to_le) { +for (i =0 ; i < ((num_bytes +3 ) /4 ); i++) + dst32[i] =cpu_to_le32 (src32[i]); +memcpy (dst, dst_tmp, num_bytes); + }else { +u8 dws = num_bytes & ~3 ; +for (i =0 ; i < ((num_bytes +3 ) /4 ); i++) + dst32[i] =le32_to_cpu (src32[i]); +memcpy (dst, dst_tmp, dws); +if (num_bytes %4 ) { +for (i =0 ; i < (num_bytes %4 ); i++) + dst[dws+i] = dst_tmp[dws+i]; + } + } +#else +memcpy (dst, src, num_bytes); +#endif +} +union aux_channel_transaction {PROCESS_AUX_CHANNEL_TRANSACTION_PS_ALLOCATION v1;PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 v2;
@@ -65,10 +100,10 @@ static int radeon_process_aux_ch(struct base = (unsigned char *)(rdev->mode_info.atom_context->scratch +1 ); -memcpy (base, send, send_bytes); +radeon_copy_swap (base, send, send_bytes, true); - args.v1.lpAuxRequest =0 +4 ; - args.v1.lpDataOut =16 +4 ; + args.v1.lpAuxRequest =cpu_to_le16 ((u16)(0 +4 )); + args.v1.lpDataOut =cpu_to_le16 ((u16)(16 +4 )); args.v1.ucDataOutLen =0 ; args.v1.ucChannelID = chan->rec.i2c_id; args.v1.ucDelay = delay /10 ;
@@ -102,7 +137,7 @@ static int radeon_process_aux_ch(struct recv_bytes = recv_size;if (recv && recv_size) -memcpy (recv, base +16 , recv_bytes); +radeon_copy_swap (recv, base +16 , recv_bytes, false);return recv_bytes; }
Greg Kroah-Hartman
maintainerPATCH 70/99 drm/radeon: Another card with wrong primary dac adj
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Zary <[email protected]>
commit f7929f34fa0e0bb6736a2484fdc07d77a1653081 upstream.
Hello,
got another card with "too bright" problem:
Sapphire Radeon VE 7000 DDR (VGA+S-Video)
lspci -vnn:
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee ATI RV100 QY [Radeon 7000/VE] [1002:5159] (prog-if 00 [VGA controller])
Subsystem: PC Partner Limited Sapphire Radeon VE 7000 DDR [174b:7c28]
The patch below fixes the problem for this card.
But I don't like the blacklist, couldn't some heuristic be used instead? The interesting thing is that the manufacturer is the same as the other card needing the same quirk. I wonder how many different types are broken this way.
The "wrong" ps2_pdac_adj value that comes from BIOS on this card is 0x300.
====================
drm/radeon: Add primary dac adj quirk for Sapphire Radeon VE 7000 DDR
Values from BIOS are wrong, causing too bright colors. Use default values instead.
--- drivers/gpu/drm/radeon/radeon_combios.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_combios.c +6 -2
@@ -971,10 +971,14 @@ struct radeon_encoder_primary_dac *radeo }/* quirks */ +/* Radeon 7000 (RV100) */ +if (((dev->pdev->device ==0x5159 ) && + (dev->pdev->subsystem_vendor ==0x174B ) && + (dev->pdev->subsystem_device ==0x7c28 )) ||/* Radeon 9100 (R200) */ -if ((dev->pdev->device ==0x514D ) && + ((dev->pdev->device ==0x514D ) && (dev->pdev->subsystem_vendor ==0x174B ) && - (dev->pdev->subsystem_device ==0x7149 )) { + (dev->pdev->subsystem_device ==0x7149 ))) {/* vbios value is bad, use the default */ found =0 ; }
Greg Kroah-Hartman
maintainerPATCH 71/99 drm/radeon: fix combios tables on older cards
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Kettenis <[email protected]>
commit cef1d00cd56f600121ad121875655ad410a001b8 upstream.
Noticed that my old Radeon 7500 hung after printing
drm: GPU not posted. posting now...
when it wasn't selected as the primary card the BIOS. Some digging revealed that it was hanging in combios_parse_mmio_table() while parsing the ASIC INIT 3 table. Looking at the BIOS ROM for the card, it becomes obvious that there is no ASIC INIT 3 table in the BIOS. The code is just processing random garbage. No surprise it hangs!
Why do I say that there is no ASIC INIT 3 table is the BIOS? This table is found through the MISC INFO table. The MISC INFO table can be found at offset 0x5e in the COMBIOS header. But the header is smaller than that. The COMBIOS header starts at offset 0x126. The standard PCI Data Structure (the bit that starts with 'PCIR') lives at offset 0x180. That means that the COMBIOS header can not be larger than 0x5a bytes and therefore cannot contain a MISC INFO table.
I looked at a dozen or so BIOS images, some my own, some downloaded from:
<http://www.techpowerup.com/vgabios/index.php?manufacturer=ATI&page=1>
It is fairly obvious that the size of the COMBIOS header can be found at offset 0x6 of the header. Not sure if it is a 16-bit number or just an 8-bit number, but that doesn't really matter since the tables seems to be always smaller than 256 bytes.
So I think combios_get_table_offset() should check if the requested table is present. This can be done by checking the offset against the size of the header. See the diff below. The diff is against the WIP OpenBSD codebase that roughly corresponds to Linux 3.8.13 at this point. But I don't think this bit of the code changed much since then.
For what it is worth:
--- drivers/gpu/drm/radeon/radeon_combios.c | 145 +++++++++----------------------- 1 file changed, 41 insertions(+), 104 deletions(-)
drivers/gpu/drm/radeon/radeon_combios.c +41 -104
@@ -147,7 +147,7 @@ static uint16_t combios_get_table_offset enum radeon_combios_table_offset table) {struct radeon_device *rdev = dev->dev_private; -int rev; +int rev, size;uint16_t offset =0 , check_offset;if (!rdev->bios)
@@ -156,174 +156,106 @@ static uint16_t combios_get_table_offsetswitch (table) {/* absolute offset tables */ case COMBIOS_ASIC_INIT_1_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0xc ); -if (check_offset) - offset = check_offset; + check_offset =0xc ;break ;case COMBIOS_BIOS_SUPPORT_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x14 ); -if (check_offset) - offset = check_offset; + check_offset =0x14 ;break ;case COMBIOS_DAC_PROGRAMMING_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x2a ); -if (check_offset) - offset = check_offset; + check_offset =0x2a ;break ;case COMBIOS_MAX_COLOR_DEPTH_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x2c ); -if (check_offset) - offset = check_offset; + check_offset =0x2c ;break ;case COMBIOS_CRTC_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x2e ); -if (check_offset) - offset = check_offset; + check_offset =0x2e ;break ;case COMBIOS_PLL_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x30 ); -if (check_offset) - offset = check_offset; + check_offset =0x30 ;break ;case COMBIOS_TV_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x32 ); -if (check_offset) - offset = check_offset; + check_offset =0x32 ;break ;case COMBIOS_DFP_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x34 ); -if (check_offset) - offset = check_offset; + check_offset =0x34 ;break ;case COMBIOS_HW_CONFIG_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x36 ); -if (check_offset) - offset = check_offset; + check_offset =0x36 ;break ;case COMBIOS_MULTIMEDIA_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x38 ); -if (check_offset) - offset = check_offset; + check_offset =0x38 ;break ;case COMBIOS_TV_STD_PATCH_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x3e ); -if (check_offset) - offset = check_offset; + check_offset =0x3e ;break ;case COMBIOS_LCD_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x40 ); -if (check_offset) - offset = check_offset; + check_offset =0x40 ;break ;case COMBIOS_MOBILE_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x42 ); -if (check_offset) - offset = check_offset; + check_offset =0x42 ;break ;case COMBIOS_PLL_INIT_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x46 ); -if (check_offset) - offset = check_offset; + check_offset =0x46 ;break ;case COMBIOS_MEM_CONFIG_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x48 ); -if (check_offset) - offset = check_offset; + check_offset =0x48 ;break ;case COMBIOS_SAVE_MASK_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x4a ); -if (check_offset) - offset = check_offset; + check_offset =0x4a ;break ;case COMBIOS_HARDCODED_EDID_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x4c ); -if (check_offset) - offset = check_offset; + check_offset =0x4c ;break ;case COMBIOS_ASIC_INIT_2_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x4e ); -if (check_offset) - offset = check_offset; + check_offset =0x4e ;break ;case COMBIOS_CONNECTOR_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x50 ); -if (check_offset) - offset = check_offset; + check_offset =0x50 ;break ;case COMBIOS_DYN_CLK_1_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x52 ); -if (check_offset) - offset = check_offset; + check_offset =0x52 ;break ;case COMBIOS_RESERVED_MEM_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x54 ); -if (check_offset) - offset = check_offset; + check_offset =0x54 ;break ;case COMBIOS_EXT_TMDS_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x58 ); -if (check_offset) - offset = check_offset; + check_offset =0x58 ;break ;case COMBIOS_MEM_CLK_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x5a ); -if (check_offset) - offset = check_offset; + check_offset =0x5a ;break ;case COMBIOS_EXT_DAC_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x5c ); -if (check_offset) - offset = check_offset; + check_offset =0x5c ;break ;case COMBIOS_MISC_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x5e ); -if (check_offset) - offset = check_offset; + check_offset =0x5e ;break ;case COMBIOS_CRT_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x60 ); -if (check_offset) - offset = check_offset; + check_offset =0x60 ;break ;case COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x62 ); -if (check_offset) - offset = check_offset; + check_offset =0x62 ;break ;case COMBIOS_COMPONENT_VIDEO_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x64 ); -if (check_offset) - offset = check_offset; + check_offset =0x64 ;break ;case COMBIOS_FAN_SPEED_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x66 ); -if (check_offset) - offset = check_offset; + check_offset =0x66 ;break ;case COMBIOS_OVERDRIVE_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x68 ); -if (check_offset) - offset = check_offset; + check_offset =0x68 ;break ;case COMBIOS_OEM_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x6a ); -if (check_offset) - offset = check_offset; + check_offset =0x6a ;break ;case COMBIOS_DYN_CLK_2_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x6c ); -if (check_offset) - offset = check_offset; + check_offset =0x6c ;break ;case COMBIOS_POWER_CONNECTOR_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x6e ); -if (check_offset) - offset = check_offset; + check_offset =0x6e ;break ;case COMBIOS_I2C_INFO_TABLE : - check_offset =RBIOS16 (rdev->bios_header_start +0x70 ); -if (check_offset) - offset = check_offset; + check_offset =0x70 ;break ;/* relative offset tables */ case COMBIOS_ASIC_INIT_3_TABLE :/* offset from misc info */
@@ -439,11 +371,16 @@ static uint16_t combios_get_table_offset }break ;default : + check_offset =0 ;break ; } -return offset; + size =RBIOS8 (rdev->bios_header_start +0x6 ); +/* check absolute offset tables */ +if (table <COMBIOS_ASIC_INIT_3_TABLE && check_offset && check_offset < size) + offset =RBIOS16 (rdev->bios_header_start + check_offset); +return offset; }bool radeon_combios_check_hardcoded_edid (struct radeon_device *rdev)
Greg Kroah-Hartman
maintainerPATCH 72/99 drm/radeon: improve dac adjust heuristics for legacy pdac
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 03ed8cf9b28d886c64c7e705c7bb1a365fd8fb95 upstream.
Hopefully avoid more quirks in the future due to bogus vbios dac data.
--- drivers/gpu/drm/radeon/radeon_combios.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_combios.c +4 -2
@@ -902,8 +902,10 @@ struct radeon_encoder_primary_dac *radeo dac =RBIOS8 (dac_info +0x3 ) &0xf ; p_dac->ps2_pdac_adj = (bg <<8 ) | (dac); } -/* if the values are all zeros, use the table */ -if (p_dac->ps2_pdac_adj) +/* if the values are zeros, use the table */ +if ((dac ==0 ) || (bg ==0 )) + found =0 ; +else found =1 ; }
Greg Kroah-Hartman
maintainerPATCH 73/99 drm/i915: fix up ring cleanup for the i830/i845 CS tlb w/a
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit aaf8a5167291b65e9116cb8736d862965b57c13a upstream.
It's not a good idea to also run the pipe_control cleanup.
This regression has been introduced whith the original cs tlb w/a in
commit b45305fce5bb1abec263fcff9d81ebecd6306ede
Author: Daniel Vetter <[email protected]> Date: Mon Dec 17 16:21:27 2012 +0100
drm/i915: Implement workaround for broken CS tlb on i830/845
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64610
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -5
@@ -490,9 +490,6 @@ cleanup_pipe_control(struct intel_ring_bstruct pipe_control *pc = ring->private;struct drm_i915_gem_object *obj; -if (!ring->private) -return ; - obj = pc->obj;kunmap (sg_page (obj->pages->sgl));
@@ -500,7 +497,6 @@ cleanup_pipe_control(struct intel_ring_bdrm_gem_object_unreference (&obj->base);kfree (pc); - ring->private =NULL ; }static int init_render_ring (struct intel_ring_buffer *ring)
@@ -571,7 +567,10 @@ static void render_ring_cleanup(struct iif (HAS_BROKEN_CS_TLB (dev))drm_gem_object_unreference (to_gem_object (ring->private)); -cleanup_pipe_control (ring); +if (INTEL_INFO (dev)->gen >=5 ) +cleanup_pipe_control (ring); + + ring->private =NULL ; } static void
Greg Kroah-Hartman
maintainerPATCH 74/99 drm/i915: Fix write-read race with multiple rings
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 02978ff57a5bdfbf703d2bc5a4d933a53ede3144 upstream.
Daniel noticed a problem where is we wrote to an object with ring A in the middle of a very long running batch, then executed a quick batch on ring B before a batch that reads from the same object, its obj->ring would now point to ring B, but its last_write_seqno would be still relative to ring A. This would allow for the user to read from the object before the GPU had completed the write, as set_domain would only check that ring B had passed the last_write_seqno.
To fix this simply (and inelegantly), we bump the last_write_seqno when switching rings so that the last_write_seqno is always relative to the current obj->ring.
This fixes igt/tests/gem_write_read_ring_switch.
--- drivers/gpu/drm/i915/i915_gem.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +4 -0
@@ -1881,6 +1881,10 @@ i915_gem_object_move_to_active(struct dru32 seqno =intel_ring_get_seqno (ring);BUG_ON (ring ==NULL ); +if (obj->ring != ring && obj->last_write_seqno) { +/* Keep the seqno relative to the current ring */ + obj->last_write_seqno = seqno; + } obj->ring = ring;/* Add a reference if we're newly entering the active list. */
Greg Kroah-Hartman
maintainerPATCH 75/99 Partially revert "drm/i915: unconditionally use mt forcewake on hsw/ivb"
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit c11e5f35ab490bd30591563816fbc83526521777 upstream.
This patch partially reverts commit 36ec8f877481449bdfa072e6adf2060869e2b970 for IvyBridge CPUs.
The original commit results in repeated 'Timed out waiting for forcewake old ack to clear' messages on a Supermicro C7H61 board (BIOS version 2.00 and 2.00b) with i7-3770K CPU. It ultimately results in a hangup if the system is highly loaded. Reverting the commit for IvyBridge CPUs fixes the issue.
Issue a warning if the CPU is IvyBridge and mt forcewake is disabled, since this condition can result in secondary issues.
v2: Only revert patch for Ivybridge CPUs
Issue info message if mt forcewake is disabled on Ivybridge
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60541
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66139
--- drivers/gpu/drm/i915/intel_pm.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +30 -1
@@ -4510,9 +4510,38 @@ void intel_gt_init(struct drm_device *deif (IS_VALLEYVIEW (dev)) { dev_priv->gt.force_wake_get = vlv_force_wake_get; dev_priv->gt.force_wake_put = vlv_force_wake_put; - }else if (IS_IVYBRIDGE (dev) ||IS_HASWELL (dev)) { + }else if (IS_HASWELL (dev)) { dev_priv->gt.force_wake_get = __gen6_gt_force_wake_mt_get; dev_priv->gt.force_wake_put = __gen6_gt_force_wake_mt_put; + }else if (IS_IVYBRIDGE (dev)) { +u32 ecobus; + +/* IVB configs may use multi-threaded forcewake */ + +/* A small trick here - if the bios hasn't configured +* MT forcewake, and if the device is in RC6, then +* force_wake_mt_get will not wake the device and the +* ECOBUS read will return zero. Which will be +* (correctly) interpreted by the test below as MT +* forcewake being disabled. +*/ +mutex_lock (&dev->struct_mutex); +__gen6_gt_force_wake_mt_get (dev_priv); + ecobus =I915_READ_NOTRACE (ECOBUS ); +__gen6_gt_force_wake_mt_put (dev_priv); +mutex_unlock (&dev->struct_mutex); + +if (ecobus &FORCEWAKE_MT_ENABLE ) { + dev_priv->gt.force_wake_get = + __gen6_gt_force_wake_mt_get; + dev_priv->gt.force_wake_put = + __gen6_gt_force_wake_mt_put; + }else { +DRM_INFO ("No MT forcewake available on Ivybridge, this can result in issues\n" ); +DRM_INFO ("when using vblank-synced partial screen updates.\n" ); + dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; + dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; + } }else if (IS_GEN6 (dev)) { dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
Greg Kroah-Hartman
maintainerPATCH 76/99 drm/i915: Fix incoherence with fence updates on Sandybridge+
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit d18b9619034230b6f945e215276425636ca401fe upstream.
This hopefully fixes the root cause behind the workaround added in
commit 25ff1195f8a0b3724541ae7bbe331b4296de9c06
Author: Chris Wilson <[email protected]> Date: Thu Apr 4 21:31:03 2013 +0100
drm/i915: Workaround incoherence between fences and LLC across multiple CPUs
Thanks to further investigation by Jon Bloomfield, he realised that the 64-bit register might be broken up by the hardware into two 32-bit writes (a problem we have encountered elsewhere). This non-atomicity would then cause an issue where a second thread would see an intermediate register state (new high dword, old low dword), and this register would randomly be used in preference to its own thread register. This would cause the second thread to read from and write into a fairly random tiled location. Breaking the operation into 3 explicit 32-bit updates (first disable the fence, poke the upper bits, then poke the lower bits and enable) ensures that, given proper serialisation between the 32-bit register write and the memory transfer, that the fence value is always consistent.
Armed with this knowledge, we can explain how the previous workaround work. The key to the corruption is that a second thread sees an erroneous fence register that conflicts and overrides its own. By serialising the fence update across all CPUs, we have a small window where no GTT access is occurring and so hide the potential corruption. This also leads to the conclusion that the earlier workaround was incomplete.
v2: Be overly paranoid about the order in which fence updates become visible to the GPU to make really sure that we turn the fence off before doing the update, and then only switch the fence on afterwards.
--- drivers/gpu/drm/i915/i915_gem.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +24 -6
@@ -2538,7 +2538,6 @@ static void i965_write_fence_reg(structdrm_i915_private_t *dev_priv = dev->dev_private;int fence_reg;int fence_pitch_shift; -uint64_t val;if (INTEL_INFO (dev)->gen >=6 ) { fence_reg =FENCE_REG_SANDYBRIDGE_0 ;
@@ -2548,8 +2547,23 @@ static void i965_write_fence_reg(struct fence_pitch_shift =I965_FENCE_PITCH_SHIFT ; } + fence_reg += reg *8 ; + +/* To w/a incoherency with non-atomic 64-bit register updates, +* we split the 64-bit update into two 32-bit writes. In order +* for a partial fence not to be evaluated between writes, we +* precede the update with write to turn off the fence register, +* and only enable the fence as the last step. +* +* For extra levels of paranoia, we make sure each step lands +* before applying the next step. +*/ +I915_WRITE (fence_reg,0 ); +POSTING_READ (fence_reg); +if (obj) {u32 size = obj->gtt_space->size; +uint64_t val; val = (uint64_t )((obj->gtt_offset + size -4096 ) &0xfffff000 ) <<32 ;
@@ -2558,12 +2572,16 @@ static void i965_write_fence_reg(structif (obj->tiling_mode ==I915_TILING_Y ) val |=1 <<I965_FENCE_TILING_Y_SHIFT ; val |=I965_FENCE_REG_VALID ; - }else - val =0 ; - fence_reg += reg *8 ; -I915_WRITE64 (fence_reg, val); -POSTING_READ (fence_reg); +I915_WRITE (fence_reg +4 , val >>32 ); +POSTING_READ (fence_reg +4 ); + +I915_WRITE (fence_reg +0 , val); +POSTING_READ (fence_reg); + }else { +I915_WRITE (fence_reg +4 ,0 ); +POSTING_READ (fence_reg +4 ); + } } static void i915_write_fence_reg(struct drm_device *dev, int reg,
Greg Kroah-Hartman
maintainerPATCH 77/99 drm/i915: fix long-standing SNB regression in power consumption after resume v2
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 7dcd2677ea912573d9ed4bcd629b0023b2d11505 upstream.
This patch fixes regression in power consumtion of sandy bridge gpu, which exists since v3.6 Sometimes after resuming from s2ram gpu starts thinking that it's extremely busy. After that it never reaches rc6 state.
Bug exists since kernel v3.6:
commit b4ae3f22d238617ca11610b29fde16cf8c0bc6e0
Author: Jesse Barnes <[email protected]> Date: Thu Jun 14 11:04:48 2012 -0700
drm/i915: load boot context at driver init time
For some reason RC6 is already enabled at the beginning of resuming process. Following initliaztion breaks some internal state and confuses RPS engine. This patch disables RC6 at the beginnig of resume and initialization.
I've rearranged initialization sequence, because intel_disable_gt_powersave() needs initialized force_wake_get/put and some locks from the dev_priv.
Note: The culprit in the initialization sequence seems to be the write to MBCTL added in the above mentioned commit. The first version of this patch just held a forcewake reference across the clock gating init functions, which seems to have been enought to gather quite a few positive test reports. But since that smelled a bit like ad-hoc duct-tape v2 now just disables rps/rc6 across the entire hw setup.
[danvet: Add note about v1 vs. v2 of this patch and use standard layout for the commit citation. Also add the tested-bys from v1 and a cc:
stable.]
References https://bugs.freedesktop.org/show_bug.cgi?id=54089
References https://bugzilla.kernel.org/show_bug.cgi?id=58971
References https://patchwork.kernel.org/patch/2827634/ (patch v1)
--- drivers/gpu/drm/i915/i915_dma.c | 16 ++++++++-------- drivers/gpu/drm/i915/intel_pm.c | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +8 -8
@@ -1511,6 +1511,13 @@ int i915_driver_load(struct drm_device * dev_priv->dev = dev; dev_priv->info = info; +spin_lock_init (&dev_priv->irq_lock); +spin_lock_init (&dev_priv->gpu_error.lock); +spin_lock_init (&dev_priv->rps.lock); +mutex_init (&dev_priv->dpio_lock); +mutex_init (&dev_priv->rps.hw_lock); +mutex_init (&dev_priv->modeset_restore_lock); +i915_dump_device_info (dev_priv);if (i915_get_bridge_dev (dev)) {
@@ -1602,6 +1609,7 @@ int i915_driver_load(struct drm_device *intel_irq_init (dev);intel_gt_init (dev); +intel_gt_reset (dev);/* Try to make sure MCHBAR is enabled before poking at it */ intel_setup_mchbar (dev);
@@ -1626,14 +1634,6 @@ int i915_driver_load(struct drm_device *if (!IS_I945G (dev) && !IS_I945GM (dev))pci_enable_msi (dev->pdev); -spin_lock_init (&dev_priv->irq_lock); -spin_lock_init (&dev_priv->gpu_error.lock); -spin_lock_init (&dev_priv->rps.lock); -mutex_init (&dev_priv->dpio_lock); - -mutex_init (&dev_priv->rps.hw_lock); -mutex_init (&dev_priv->modeset_restore_lock); - dev_priv->num_plane =1 ;if (IS_VALLEYVIEW (dev)) dev_priv->num_plane =2 ;
drivers/gpu/drm/i915/intel_pm.c +3 -2
@@ -4497,6 +4497,9 @@ void intel_gt_reset(struct drm_device *dif (IS_IVYBRIDGE (dev) ||IS_HASWELL (dev))__gen6_gt_force_wake_mt_reset (dev_priv); } + +/* BIOS often leaves RC6 enabled, but disable it for hw init */ +intel_disable_gt_powersave (dev); }void intel_gt_init (struct drm_device *dev)
@@ -4505,8 +4508,6 @@ void intel_gt_init(struct drm_device *despin_lock_init (&dev_priv->gt_lock); -intel_gt_reset (dev); -if (IS_VALLEYVIEW (dev)) { dev_priv->gt.force_wake_get = vlv_force_wake_get; dev_priv->gt.force_wake_put = vlv_force_wake_put;
Greg Kroah-Hartman
maintainerPATCH 78/99 drm/i915: Fix dereferencing invalid connectors in is_crtc_connector_off()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 2e57f47d317dd035b18634b0c602272529368fcc upstream.
In commit e3de42b68478a8c95dd27520e9adead2af9477a5
Author: Imre Deak <[email protected]> Date: Fri May 3 19:44:07 2013 +0200
drm/i915: force full modeset if the connector is in DPMS OFF mode
a new function was added that walked over the set of connectors to see if any of the currently associated CRTC was switched off. This function walked an array of connectors, rather than the array of pointers to connectors contained in the drm_mode_set - i.e. it was dereferencing far past the end of the first connector. This only becomes an issue if we attempt to use a clone mode (i.e. more than one connector per CRTC) such that set->num_connectors > 1.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65927
--- drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -10
@@ -8146,15 +8146,20 @@ static void intel_set_config_restore_sta }static bool -is_crtc_connector_off (struct drm_crtc *crtc,struct drm_connector *connectors, -int num_connectors) +is_crtc_connector_off (struct drm_mode_set *set) {int i; -for (i =0 ; i < num_connectors; i++) -if (connectors[i].encoder && - connectors[i].encoder->crtc == crtc && - connectors[i].dpms !=DRM_MODE_DPMS_ON ) +if (set->num_connectors ==0 ) +return false; + +if (WARN_ON (set->connectors ==NULL )) +return false; + +for (i =0 ; i < set->num_connectors; i++) +if (set->connectors[i]->encoder && + set->connectors[i]->encoder->crtc == set->crtc && + set->connectors[i]->dpms !=DRM_MODE_DPMS_ON )return true;return false;
@@ -8167,10 +8172,8 @@ intel_set_config_compute_mode_changes(st/* We should be able to check here if the fb has the same properties * and then just flip_or_move it */ -if (set->connectors !=NULL && -is_crtc_connector_off (set->crtc, *set->connectors, - set->num_connectors)) { - config->mode_changed = true; +if (is_crtc_connector_off (set)) { + config->mode_changed = true; }else if (set->crtc->fb != set->fb) {/* If we have no fb then treat it as a full mode set */ if (set->crtc->fb ==NULL ) {
Greg Kroah-Hartman
maintainerPATCH 79/99 drm/i915: correctly restore fences with objects attached
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 94a335dba34ff47cad3d6d0c29b452d43a1be3c8 upstream.
To avoid stalls we delay tiling changes and especially hold of committing the new fence state for as long as possible. Synchronization points are in the execbuf code and in our gtt fault handler.
Unfortunately we've missed that tricky detail when adding proper fence restore code in
commit 19b2dbde5732170a03bd82cc8bd442cf88d856f7
Author: Chris Wilson <[email protected]> Date: Wed Jun 12 10:15:12 2013 +0100
drm/i915: Restore fences after resume and GPU resets
The result was that we've restored fences for objects with no tiling, since the object<->fence link still existed after resume. Now that wouldn't have been too bad since any subsequent access would have fixed things up, but if we've changed from tiled to untiled real havoc happened:
The tiling stride is stored -1 in the fence register, so a stride of 0 resulted in all 1s in the top 32bits, and so a completely bogus fence spanning everything from the start of the object to the top of the GTT. The tell-tale in the register dumps looks like:
FENCE START 2: 0x0214d001
FENCE END 2: 0xfffff3ffBit 11 isn't set since the hw doesn't store it, even when writing all 1s (at least on my snb here).
To prevent such a gaffle in the future add a sanity check for fences with an untiled object attached in i915_gem_write_fence.
v2: Fix the WARN, spotted by Chris.
v3: Trying to reuse get_fences looked ugly and obfuscated the code. Instead reuse update_fence and to make it really dtrt also move the fence dirty state clearing into update_fence.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60530
--- drivers/gpu/drm/i915/i915_gem.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +16 -2
@@ -2138,7 +2138,17 @@ void i915_gem_restore_fences(struct drm_for (i =0 ; i < dev_priv->num_fence_regs; i++) {struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; -i915_gem_write_fence (dev, i, reg->obj); + +/* +* Commit delayed tiling changes if we have an object still +* attached to the fence, otherwise just clear the fence. +*/ +if (reg->obj) { +i915_gem_object_update_fence (reg->obj, reg, + reg->obj->tiling_mode); + }else { +i915_gem_write_fence (dev, i,NULL ); + } } }
@@ -2676,6 +2686,10 @@ static void i915_gem_write_fence(structif (i915_gem_object_needs_mb (dev_priv->fence_regs[reg].obj))mb (); +WARN (obj && (!obj->stride || !obj->tiling_mode), +"bogus fence setup with stride: 0x%x, tiling mode: %i\n" , + obj->stride, obj->tiling_mode); +switch (INTEL_INFO (dev)->gen) {case 7 :case 6 :
@@ -2735,6 +2749,7 @@ static void i915_gem_object_update_fence fence->obj =NULL ;list_del_init (&fence->lru_list); } + obj->fence_dirty = false; } static int
@@ -2864,7 +2879,6 @@ i915_gem_object_get_fence(struct drm_i91return 0 ;i915_gem_object_update_fence (obj, reg, enable); - obj->fence_dirty = false;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 80/99 drm/i915: quirk no PCH_PWM_ENABLE for Dell XPS13 backlight
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Mostafa <[email protected]>
commit e85843bec6c2ea7c10ec61238396891cc2b753a9 upstream.
Some machines suffer from non-functional backlight controls if BLM_PCH_PWM_ENABLE is set, so provide a quirk to avoid doing so. Apply this quirk to Dell XPS 13 models.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++++++ drivers/gpu/drm/i915/intel_panel.c | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -491,6 +491,7 @@ enum intel_sbi_destination {#define QUIRK_PIPEA_FORCE (1<<0)#define QUIRK_LVDS_SSC_DISABLE (1<<1)#define QUIRK_INVERT_BRIGHTNESS (1<<2) +#define QUIRK_NO_PCH_PWM_ENABLE (1<<3)struct intel_fbdev ;struct intel_fbc_work ;
drivers/gpu/drm/i915/intel_display.c +16 -0
@@ -8917,6 +8917,17 @@ static void quirk_invert_brightness(struDRM_INFO ("applying inverted panel brightness quirk\n" ); } +/* +* Some machines (Dell XPS13) suffer broken backlight controls if +* BLM_PCH_PWM_ENABLE is set. +*/ +static void quirk_no_pcm_pwm_enable (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + dev_priv->quirks |=QUIRK_NO_PCH_PWM_ENABLE ; +DRM_INFO ("applying no-PCH_PWM_ENABLE quirk\n" ); +} +struct intel_quirk {int device;int subsystem_vendor;
@@ -8986,6 +8997,11 @@ static struct intel_quirk intel_quirks[]/* Acer Aspire 4736Z */ { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness }, + +/* Dell XPS13 HD Sandy Bridge */ + { 0x0116, 0x1028, 0x052e, quirk_no_pcm_pwm_enable }, +/* Dell XPS13 HD and XPS13 FHD Ivy Bridge */ + { 0x0166, 0x1028, 0x058b, quirk_no_pcm_pwm_enable }, };static void intel_init_quirks (struct drm_device *dev)
drivers/gpu/drm/i915/intel_panel.c +2 -1
@@ -354,7 +354,8 @@ void intel_panel_enable_backlight(structPOSTING_READ (reg);I915_WRITE (reg, tmp |BLM_PWM_ENABLE ); -if (HAS_PCH_SPLIT (dev)) { +if (HAS_PCH_SPLIT (dev) && + !(dev_priv->quirks &QUIRK_NO_PCH_PWM_ENABLE )) { tmp =I915_READ (BLC_PWM_PCH_CTL1 ); tmp |=BLM_PCH_PWM_ENABLE ; tmp &= ~BLM_PCH_OVERRIDE_ENABLE ;
Greg Kroah-Hartman
maintainerPATCH 81/99 drm/i915: Serialize almost all register access
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit a7cd1b8fea2f341b626b255d9898a5ca5fabbf0a upstream.
In theory, the different register blocks were meant to be only ever touched when holding either the struct_mutex, mode_config.lock or even a specific localised lock. This does not seem to be the case, and the hardware reacts extremely badly if we attempt to concurrently access two registers within the same cacheline.
The HSD suggests that we only need to do this workaround for display range registers. However, upon review we need to serialize the multiple stages in our register write functions - if only for preemption protection.
Irrespective of the hardware requirements, the current io functions are a little too loose with respect to the combination of pre- and post-condition testing that we do in conjunction with the actual io. As a result, we may be pre-empted and generate both false-postive and false-negative errors.
Note well that this is a "90%" solution, there remains a few direct users of ioread/iowrite which will be fixed up in the next few patches. Since they are more invasive and that this simple change will prevent almost all lockups on Haswell, we kept this patch simple to facilitate backporting to stable.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63914
--- drivers/gpu/drm/i915/i915_drv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +6 -3
@@ -1247,21 +1247,21 @@ hsw_unclaimed_reg_check(struct drm_i915_#define __i915_read (x, y) \ u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ + unsigned long irqflags; \ u##x val = 0; \ + spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ if (IS_GEN5(dev_priv->dev)) \ ilk_dummy_write(dev_priv); \ if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ - unsigned long irqflags; \ - spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ if (dev_priv->forcewake_count == 0) \ dev_priv->gt.force_wake_get(dev_priv); \ val = read##y(dev_priv->regs + reg); \ if (dev_priv->forcewake_count == 0) \ dev_priv->gt.force_wake_put(dev_priv); \ - spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ } else { \ val = read##y(dev_priv->regs + reg); \ } \ + spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ trace_i915_reg_rw(false, reg, val, sizeof(val)); \ return val; \ }
@@ -1274,8 +1274,10 @@ __i915_read(64, q)#define __i915_write (x, y) \ void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \ + unsigned long irqflags; \ u32 __fifo_ret = 0; \ trace_i915_reg_rw(true, reg, val, sizeof(val)); \ + spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ __fifo_ret = __gen6_gt_wait_for_fifo(dev_priv); \ } \
@@ -1287,6 +1289,7 @@ void i915_write##x(struct drm_i915_privagen6_gt_check_fifodbg (dev_priv); \ } \hsw_unclaimed_reg_check (dev_priv, reg); \ +spin_unlock_irqrestore (&dev_priv->gt_lock, irqflags); \ } __i915_write(8, b)__i915_write (16 , w)
Greg Kroah-Hartman
maintainerPATCH 82/99 drm/i915: fix up gt init sequence fallout
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 181d1b9e31c668259d3798c521672afb8edd355c upstream.
The regression fix for gen6+ rps fallout
commit 7dcd2677ea912573d9ed4bcd629b0023b2d11505
Author: Konstantin Khlebnikov <[email protected]> Date: Wed Jul 17 10:22:58 2013 +0400
drm/i915: fix long-standing SNB regression in power consumption after resume
unintentionally also changed the init sequence ordering between gt_init and gt_reset - we need to reset BIOS damage like leftover forcewake references before we run our own code. Otherwise we can get nasty dmesg noise like
[drm:__gen6_gt_force_wake_mt_get] *ERROR* Timed out waiting for forcewake old ack to clear.
again. Since _reset suggests that we first need to have stuff initialized (which isn't the case here) call it sanitze instead.
While at it also block out the rps disable introduced by the above commit on ilk: We don't have any knowledge of ilk rps being broken in similar ways. And the disable functions uses the default hw state which is only read out when we're enabling rps. So essentially we've been writing random grabage into that register.
--- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 4 ++-- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_pm.c | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +1 -1
@@ -1608,8 +1608,8 @@ int i915_driver_load(struct drm_device *intel_detect_pch (dev);intel_irq_init (dev); +intel_gt_sanitize (dev);intel_gt_init (dev); -intel_gt_reset (dev);/* Try to make sure MCHBAR is enabled before poking at it */ intel_setup_mchbar (dev);
drivers/gpu/drm/i915/i915_drv.c +2 -2
@@ -685,7 +685,7 @@ static int i915_drm_thaw(struct drm_devi {int error =0 ; -intel_gt_reset (dev); +intel_gt_sanitize (dev);if (drm_core_check_feature (dev,DRIVER_MODESET )) {mutex_lock (&dev->struct_mutex);
@@ -711,7 +711,7 @@ int i915_resume(struct drm_device *dev)pci_set_master (dev->pdev); -intel_gt_reset (dev); +intel_gt_sanitize (dev);/* * Platforms with opregion should have sane BIOS, older ones (gen3 and
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -1477,7 +1477,7 @@ void i915_handle_error(struct drm_deviceextern void intel_irq_init (struct drm_device *dev);extern void intel_hpd_init (struct drm_device *dev);extern void intel_gt_init (struct drm_device *dev); -extern void intel_gt_reset (struct drm_device *dev); +extern void intel_gt_sanitize (struct drm_device *dev);void i915_error_state_free (struct kref *error_ref);
drivers/gpu/drm/i915/intel_pm.c +3 -2
@@ -4486,7 +4486,7 @@ static void vlv_force_wake_put(struct drgen6_gt_check_fifodbg (dev_priv); } -void intel_gt_reset (struct drm_device *dev) +void intel_gt_sanitize (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4499,7 +4499,8 @@ void intel_gt_reset(struct drm_device *d }/* BIOS often leaves RC6 enabled, but disable it for hw init */ -intel_disable_gt_powersave (dev); +if (INTEL_INFO (dev)->gen >=6 ) +intel_disable_gt_powersave (dev); }void intel_gt_init (struct drm_device *dev)
Greg Kroah-Hartman
maintainerPATCH 83/99 drm/i915: fix missed hunk after GT access breakage
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Widawsky <[email protected]>
commit e1b4d3036c07ff137955fb1c0197ab62534f46ec upstream.
Upon some code refactoring, a hunk was missed. This was fixed for next, but missed the current trees, and hasn't yet been merged by Dave Airlie. It is fixed in:
commit 907b28c56ea40629aa6595ddfa414ec2fc7da41c
Author: Chris Wilson <[email protected]> Date: Fri Jul 19 20:36:52 2013 +0100
drm/i915: Colocate all GT access routines in the same file
It is introduced by:
commit 181d1b9e31c668259d3798c521672afb8edd355c
Author: Daniel Vetter <[email protected]> Date: Sun Jul 21 13:16:24 2013 +0200
drm/i915: fix up gt init sequence fallout
--- drivers/gpu/drm/i915/i915_dma.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +1 -0
@@ -1608,6 +1608,7 @@ int i915_driver_load(struct drm_device *intel_detect_pch (dev);intel_irq_init (dev); +intel_pm_init (dev);intel_gt_sanitize (dev);intel_gt_init (dev);
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1475,6 +1475,7 @@ void i915_hangcheck_elapsed(unsigned lonvoid i915_handle_error (struct drm_device *dev,bool wedged);extern void intel_irq_init (struct drm_device *dev); +extern void intel_pm_init (struct drm_device *dev);extern void intel_hpd_init (struct drm_device *dev);extern void intel_gt_init (struct drm_device *dev);extern void intel_gt_sanitize (struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -4548,6 +4548,12 @@ void intel_gt_init(struct drm_device *de dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; } +} + +void intel_pm_init (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +INIT_DELAYED_WORK (&dev_priv->rps.delayed_resume_work, intel_gen6_powersave_work); }
Greg Kroah-Hartman
maintainerPATCH 84/99 drm/nouveau: fix semaphore dmabuf obj
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
commit 7a7da592cbb22a1d360638dbecc393470c5effe3 upstream.
Fixes some dmabuf object errors on nv50 chipset and below.
--- drivers/gpu/drm/nouveau/nv17_fence.c | 2 +- drivers/gpu/drm/nouveau/nv50_fence.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nv17_fence.c +1 -1
@@ -76,7 +76,7 @@ nv17_fence_context_new(struct nouveau_chstruct ttm_mem_reg *mem = &priv->bo->bo.mem;struct nouveau_object *object;u32 start = mem->start *PAGE_SIZE ; -u32 limit = mem->start + mem->size -1 ; +u32 limit = start + mem->size -1 ;int ret =0 ; fctx = chan->fence =kzalloc (sizeof (*fctx),GFP_KERNEL );
drivers/gpu/drm/nouveau/nv50_fence.c +9 -5
@@ -39,6 +39,8 @@ nv50_fence_context_new(struct nouveau_chstruct nv10_fence_chan *fctx;struct ttm_mem_reg *mem = &priv->bo->bo.mem;struct nouveau_object *object; +u32 start = mem->start *PAGE_SIZE ; +u32 limit = start + mem->size -1 ;int ret, i; fctx = chan->fence =kzalloc (sizeof (*fctx),GFP_KERNEL );
@@ -51,26 +53,28 @@ nv50_fence_context_new(struct nouveau_ch fctx->base.sync = nv17_fence_sync; ret =nouveau_object_new (nv_object (chan->cli), chan->handle, - NvSema,0x0002 , + NvSema,0x003d , &(struct nv_dma_class ) { .flags =NV_DMA_TARGET_VRAM |NV_DMA_ACCESS_RDWR , - .start = mem->start *PAGE_SIZE , - .limit = mem->size -1 , + .start = start, + .limit = limit, },sizeof (struct nv_dma_class ), &object);/* dma objects for display sync channel semaphore blocks */ for (i =0 ; !ret && i < dev->mode_config.num_crtc; i++) {struct nouveau_bo *bo =nv50_display_crtc_sema (dev, i); +u32 start = bo->bo.mem.start *PAGE_SIZE ; +u32 limit = start + bo->bo.mem.size -1 ; ret =nouveau_object_new (nv_object (chan->cli), chan->handle, NvEvoSema0 + i,0x003d , &(struct nv_dma_class ) { .flags =NV_DMA_TARGET_VRAM |NV_DMA_ACCESS_RDWR , - .start = bo->bo.offset, - .limit = bo->bo.offset +0xfff , + .start = start, + .limit = limit, },sizeof (struct nv_dma_class ), &object); }
Greg Kroah-Hartman
maintainerPATCH 85/99 drm/radeon: fix audio dto programming on DCE4+
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 7d61d835824f73dc4097b51f800382467c8049c5 upstream.
We need to set the dto source before setting the dividers otherwise we may get stability problems with the dto leading to audio playback problems.
--- drivers/gpu/drm/radeon/evergreen_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/evergreen_hdmi.c +1 -1
@@ -157,9 +157,9 @@ static void evergreen_audio_set_dto(stru* number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator */ +WREG32 (DCCG_AUDIO_DTO_SOURCE ,DCCG_AUDIO_DTO0_SOURCE_SEL (radeon_crtc->crtc_id));WREG32 (DCCG_AUDIO_DTO0_PHASE , base_rate *100 );WREG32 (DCCG_AUDIO_DTO0_MODULE , clock *100 ); -WREG32 (DCCG_AUDIO_DTO_SOURCE ,DCCG_AUDIO_DTO0_SOURCE_SEL (radeon_crtc->crtc_id)); }
Greg Kroah-Hartman
maintainerPATCH 86/99 drm/radeon/atom: initialize more atom interpretor elements to 0
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 42a21826dc54583cdb79cc8477732e911ac9c376 upstream.
The ProcessAuxChannel table on some rv635 boards assumes the divmul members are initialized to 0 otherwise we get an invalid fb offset since it has a bad mask set when setting the fb base. While here initialize all the atom interpretor elements to 0.
Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=60639
--- drivers/gpu/drm/radeon/atom.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/radeon/atom.c +5 -0
@@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_conteint r;mutex_lock (&ctx->mutex); +/* reset data block */ + ctx->data_block =0 ;/* reset reg block */ ctx->reg_block =0 ;/* reset fb window */ ctx->fb_base =0 ;/* reset io mode */ ctx->io_mode =ATOM_IO_MM ; +/* reset divmul */ + ctx->divmul[0 ] =0 ; + ctx->divmul[1 ] =0 ; r =atom_execute_table_locked (ctx, index, params);mutex_unlock (&ctx->mutex);return r;
Greg Kroah-Hartman
maintainerPATCH 87/99 rtlwifi: Initialize power-setting callback for USB devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit bcfb879432094c267c35a7ff75d953d3a66c193a upstream.
Commit a269913c5 entitled "rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue" has two bugs for USB drivers. Firstly, the work queue in question was not initialized. Secondly, the callback routine used by this queue is contained within the file used for PCI devices. As a result, it is not available for architectures without PCI hardware.
--- drivers/net/wireless/rtlwifi/pci.c | 13 ------------- drivers/net/wireless/rtlwifi/ps.c | 12 ++++++++++++ drivers/net/wireless/rtlwifi/ps.h | 1 + drivers/net/wireless/rtlwifi/usb.c | 2 ++ 4 files changed, 15 insertions(+), 13 deletions(-)
drivers/net/wireless/rtlwifi/pci.c +0 -13
@@ -1008,19 +1008,6 @@ static void _rtl_pci_prepare_bcn_taskletreturn ; } -static void rtl_lps_change_work_callback (struct work_struct *work) -{ -struct rtl_works *rtlworks = - container_of(work, struct rtl_works, lps_change_work); -struct ieee80211_hw *hw = rtlworks->hw; -struct rtl_priv *rtlpriv =rtl_priv (hw); - -if (rtlpriv->enter_ps) -rtl_lps_enter (hw); -else -rtl_lps_leave (hw); -} -static void _rtl_pci_init_trx_var (struct ieee80211_hw *hw) {struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw));
drivers/net/wireless/rtlwifi/ps.c +12 -0
@@ -611,6 +611,18 @@ void rtl_swlps_rf_sleep(struct ieee80211 MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40)); } +void rtl_lps_change_work_callback (struct work_struct *work) +{ +struct rtl_works *rtlworks = + container_of(work, struct rtl_works, lps_change_work); +struct ieee80211_hw *hw = rtlworks->hw; +struct rtl_priv *rtlpriv =rtl_priv (hw); + +if (rtlpriv->enter_ps) +rtl_lps_enter (hw); +else +rtl_lps_leave (hw); +}void rtl_swlps_wq_callback (void *data) {
drivers/net/wireless/rtlwifi/ps.h +1 -0
@@ -49,5 +49,6 @@ void rtl_swlps_rf_awake(struct ieee80211void rtl_swlps_rf_sleep (struct ieee80211_hw *hw);void rtl_p2p_ps_cmd (struct ieee80211_hw *hw,u8 p2p_ps_state);void rtl_p2p_info (struct ieee80211_hw *hw,void *data,unsigned int len); +void rtl_lps_change_work_callback (struct work_struct *work);#endif
drivers/net/wireless/rtlwifi/usb.c +2 -0
@@ -1070,6 +1070,8 @@ int rtl_usb_probe(struct usb_interface *spin_lock_init (&rtlpriv->locks.usb_lock);INIT_WORK (&rtlpriv->works.fill_h2c_cmd, rtl_fill_h2c_cmd_work_callback); +INIT_WORK (&rtlpriv->works.lps_change_work, + rtl_lps_change_work_callback); rtlpriv->usb_data_index =0 ;init_completion (&rtlpriv->firmware_loading_complete);
Greg Kroah-Hartman
maintainerPATCH 88/99 USB: serial: ftdi_sio: add more RT Systems ftdi devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rick Farina (Zero_Chaos)" <[email protected]>
commit fed1f1ed90bce42ea010e2904cbc04e7b8304940 upstream.
RT Systems makes many usb serial cables based on the ftdi_sio driver for programming various amateur radios. This patch is a full listing of their current product offerings and should allow these cables to all be recognized.
--- drivers/usb/serial/ftdi_sio.c | 31 ++++++++++++++++++++++++++++--- drivers/usb/serial/ftdi_sio_ids.h | 34 +++++++++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 8 deletions(-)
drivers/usb/serial/ftdi_sio.c +28 -3
@@ -735,9 +735,34 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29A_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29F_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S01_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29C_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_81B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_82B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5D_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K4Y_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5G_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S05_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_60_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_61_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_64_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_65_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92D_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_W5R_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_A5R_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_PW1_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
drivers/usb/serial/ftdi_sio_ids.h +29 -5
@@ -815,11 +815,35 @@/* * RT Systems programming cables for various ham radios */ -#define RTSYSTEMS_VID 0x2100/* Vendor ID */ -#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52/* Serial converter for VX-7 Radios using FT232RL */ -#define RTSYSTEMS_CT29B_PID 0x9e54/* CT29B Radio Cable */ -#define RTSYSTEMS_RTS01_PID 0x9e57/* USB-RTS01 Radio Cable */ - +#define RTSYSTEMS_VID 0x2100/* Vendor ID */ +#define RTSYSTEMS_USB_S03_PID 0x9001/* RTS-03 USB to Serial Adapter */ +#define RTSYSTEMS_USB_59_PID 0x9e50/* USB-59 USB to 8 pin plug */ +#define RTSYSTEMS_USB_57A_PID 0x9e51/* USB-57A USB to 4pin 3.5mm plug */ +#define RTSYSTEMS_USB_57B_PID 0x9e52/* USB-57B USB to extended 4pin 3.5mm plug */ +#define RTSYSTEMS_USB_29A_PID 0x9e53/* USB-29A USB to 3.5mm stereo plug */ +#define RTSYSTEMS_USB_29B_PID 0x9e54/* USB-29B USB to 6 pin mini din */ +#define RTSYSTEMS_USB_29F_PID 0x9e55/* USB-29F USB to 6 pin modular plug */ +#define RTSYSTEMS_USB_62B_PID 0x9e56/* USB-62B USB to 8 pin mini din plug*/ +#define RTSYSTEMS_USB_S01_PID 0x9e57/* USB-RTS01 USB to 3.5 mm stereo plug*/ +#define RTSYSTEMS_USB_63_PID 0x9e58/* USB-63 USB to 9 pin female*/ +#define RTSYSTEMS_USB_29C_PID 0x9e59/* USB-29C USB to 4 pin modular plug*/ +#define RTSYSTEMS_USB_81B_PID 0x9e5A/* USB-81 USB to 8 pin mini din plug*/ +#define RTSYSTEMS_USB_82B_PID 0x9e5B/* USB-82 USB to 2.5 mm stereo plug*/ +#define RTSYSTEMS_USB_K5D_PID 0x9e5C/* USB-K5D USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_K4Y_PID 0x9e5D/* USB-K4Y USB to 2.5/3.5 mm plugs*/ +#define RTSYSTEMS_USB_K5G_PID 0x9e5E/* USB-K5G USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_S05_PID 0x9e5F/* USB-RTS05 USB to 2.5 mm stereo plug*/ +#define RTSYSTEMS_USB_60_PID 0x9e60/* USB-60 USB to 6 pin din*/ +#define RTSYSTEMS_USB_61_PID 0x9e61/* USB-61 USB to 6 pin mini din*/ +#define RTSYSTEMS_USB_62_PID 0x9e62/* USB-62 USB to 8 pin mini din*/ +#define RTSYSTEMS_USB_63B_PID 0x9e63/* USB-63 USB to 9 pin female*/ +#define RTSYSTEMS_USB_64_PID 0x9e64/* USB-64 USB to 9 pin male*/ +#define RTSYSTEMS_USB_65_PID 0x9e65/* USB-65 USB to 9 pin female null modem*/ +#define RTSYSTEMS_USB_92_PID 0x9e66/* USB-92 USB to 12 pin plug*/ +#define RTSYSTEMS_USB_92D_PID 0x9e67/* USB-92D USB to 12 pin plug data*/ +#define RTSYSTEMS_USB_W5R_PID 0x9e68/* USB-W5R USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_A5R_PID 0x9e69/* USB-A5R USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_PW1_PID 0x9e6A/* USB-PW1 USB to 8 pin modular plug*/ /* * Physik Instrumente
Greg Kroah-Hartman
maintainerPATCH 89/99 usb: gadget: udc-core: fix the typo of udc state attribute
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rong Wang <[email protected]>
commit 1894870eb4240399fabc6f0cb8c6fff4e6edbe83 upstream.
The name of udc state attribute file under sysfs is registered as "state", while usb_gadget_set_state take it as "status" when it's going to update. This patch fixes the typo.
--- drivers/usb/gadget/udc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc-core.c +1 -1
@@ -105,7 +105,7 @@ void usb_gadget_set_state(struct usb_gad enum usb_device_state state) { gadget->state = state; -sysfs_notify (&gadget->dev.kobj,NULL ,"status" ); +sysfs_notify (&gadget->dev.kobj,NULL ,"state" ); }EXPORT_SYMBOL_GPL (usb_gadget_set_state);
Greg Kroah-Hartman
maintainerPATCH 90/99 mm: mempolicy: fix mbind_range() && vma_adjust() interaction
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 3964acd0dbec123aa0a621973a2a0580034b4788 upstream.
vma_adjust() does vma_set_policy(vma, vma_policy(next)) and this is doubly wrong:
1. This leaks vma->vm_policy if it is not NULL and not equal to next->vm_policy.
This can happen if vma_merge() expands "area", not prev (case 8).
2. This sets the wrong policy if vma_merge() joins prev and area, area is the vma the caller needs to update and it still has the old policy.
Revert commit 1444f92c8498 ("mm: merging memory blocks resets mempolicy") which introduced these problems.
Change mbind_range() to recheck mpol_equal() after vma_merge() to fix the problem that commit tried to address.
--- mm/mempolicy.c | 6 +++++- mm/mmap.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
mm/mempolicy.c +5 -1
@@ -732,7 +732,10 @@ static int mbind_range(struct mm_structif (prev) { vma = prev; next = vma->vm_next; -continue ; +if (mpol_equal (vma_policy (vma), new_pol)) +continue ; +/* vma_merge() joined vma && vma->next, case 8 */ + goto replace; }if (vma->vm_start != vmstart) { err =split_vma (vma->vm_mm, vma, vmstart,1 );
@@ -744,6 +747,7 @@ static int mbind_range(struct mm_structif (err) goto out; } + replace: err =vma_replace_policy (vma, new_pol);if (err) goto out;
mm/mmap.c +1 -1
@@ -865,7 +865,7 @@ again: remove_next = 1 + (end > next->if (next->anon_vma)anon_vma_merge (vma, next); mm->map_count--; -vma_set_policy (vma,vma_policy (next)); +mpol_put (vma_policy (next));kmem_cache_free (vm_area_cachep, next);/* * In mprotect's case 6 (see comments on vma_merge),
Greg Kroah-Hartman
maintainerPATCH 91/99 tty_port: Fix refcounting leak in tty_port_tty_hangup()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gianluca Anzolin <[email protected]>
commit 1d9e689c934bd5ecb0f273c6c65e0655c5cfee5f upstream.
The function tty_port_tty_hangup() could leak a reference to the tty_struct:
struct tty_struct *tty = tty_port_tty_get(port);
if (tty && (!check_clocal || !C_CLOCAL(tty))) {
tty_hangup(tty);
tty_kref_put(tty);
}If tty != NULL and the second condition is false we never call tty_kref_put and the reference is leaked.
Fix by always calling tty_kref_put() which accepts a NULL argument.
The patch fixes a regression introduced by commit aa27a094.
--- drivers/tty/tty_port.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/tty_port.c +2 -3
@@ -256,10 +256,9 @@ void tty_port_tty_hangup(struct tty_port {struct tty_struct *tty =tty_port_tty_get (port); -if (tty && (!check_clocal || !C_CLOCAL (tty))) { +if (tty && (!check_clocal || !C_CLOCAL (tty)))tty_hangup (tty); -tty_kref_put (tty); - } +tty_kref_put (tty); }EXPORT_SYMBOL_GPL (tty_port_tty_hangup);
Greg Kroah-Hartman
maintainerPATCH 92/99 livelock avoidance in sget()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit acfec9a5a892f98461f52ed5770de99a3e571ae2 upstream.
Eric Sandeen has found a nasty livelock in sget() - take a mount(2) about to fail. The superblock is on ->fs_supers, ->s_umount is held exclusive, ->s_active is 1. Along comes two more processes, trying to mount the same thing; sget() in each is picking that superblock, bumping ->s_count and trying to grab ->s_umount. ->s_active is 3 now. Original mount(2) finally gets to deactivate_locked_super() on failure; ->s_active is 2, superblock is still ->fs_supers because shutdown will *not* happen until ->s_active hits 0. ->s_umount is dropped and now we have two processes chasing each other:s_active = 2, A acquired ->s_umount, B blocked
A sees that the damn thing is stillborn, does deactivate_locked_super() s_active = 1, A drops ->s_umount, B gets it
A restarts the search and finds the same superblock. And bumps it ->s_active. s_active = 2, B holds ->s_umount, A blocked on trying to get it ... and we are in the earlier situation with A and B switched places.
The root cause, of course, is that ->s_active should not grow until we'd got MS_BORN. Then failing ->mount() will have deactivate_locked_super() shut the damn thing down. Fortunately, it's easy to do - the key point is that grab_super() is called only for superblocks currently on ->fs_supers, so it can bump ->s_count and grab ->s_umount first, then check MS_BORN and bump ->s_active; we must never increment ->s_count for superblocks past ->kill_sb(), but grab_super() is never called for those.
The bug is pretty old; we would've caught it by now, if not for accidental exclusion between sget() for block filesystems; the things like cgroup or e.g. mtd-based filesystems don't have anything of that sort, so they get bitten. The right way to deal with that is obviously to fix sget()...
--- fs/super.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
fs/super.c +10 -15
@@ -336,19 +336,19 @@ EXPORT_SYMBOL(deactivate_super);* and want to turn it into a full-blown active reference. grab_super() * is called with sb_lock held and drops it. Returns 1 in case of * success, 0 if we had failed (superblock contents was already dead or -* dying when grab_super() had been called). +* dying when grab_super() had been called). Note that this is only +* called for superblocks not in rundown mode (== ones still on ->fs_supers +* of their type), so increment of ->s_count is OK here. */ static int grab_super (struct super_block *s)__releases (sb_lock) { -if (atomic_inc_not_zero (&s->s_active)) { -spin_unlock (&sb_lock); -return 1 ; - } -/* it's going away */ s->s_count++;spin_unlock (&sb_lock); -/* wait for it to die */ down_write (&s->s_umount); +if ((s->s_flags &MS_BORN ) &&atomic_inc_not_zero (&s->s_active)) { +put_super (s); +return 1 ; + }up_write (&s->s_umount);put_super (s);return 0 ;
@@ -463,11 +463,6 @@ retry:destroy_super (s); s =NULL ; } -down_write (&old->s_umount); -if (unlikely (!(old->s_flags &MS_BORN ))) { -deactivate_locked_super (old); - goto retry; - }return old; } }
@@ -660,10 +655,10 @@ restart:if (hlist_unhashed (&sb->s_instances))continue ;if (sb->s_bdev == bdev) { -if (grab_super (sb))/* drops sb_lock */ -return sb; -else +if (!grab_super (sb)) goto restart; +up_write (&sb->s_umount); +return sb; } }spin_unlock (&sb_lock);
Greg Kroah-Hartman
maintainerPATCH 93/99 xen/evtchn: avoid a deadlock when unbinding an event channel
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
commit 179fbd5a45f0d4034cc6fd37b8d367a3b79663c4 upstream.
Unbinding an event channel (either with the ioctl or when the evtchn device is closed) may deadlock because disable_irq() is called with port_user_lock held which is also locked by the interrupt handler.
Think of the IOCTL_EVTCHN_UNBIND is being serviced, the routine has just taken the lock, and an interrupt happens. The evtchn_interrupt is invoked, tries to take the lock and spins forever.
A quick glance at the code shows that the spinlock is a local IRQ variant. Unfortunately that does not help as "disable_irq() waits for the interrupt handler on all CPUs to stop running. If the irq occurs on another VCPU, it tries to take port_user_lock and can't because the unbind ioctl is holding it." (from David). Hence we cannot depend on the said spinlock to protect us. We could make it a system wide IRQ disable spinlock but there is a better way.
We can piggyback on the fact that the existence of the spinlock is to make get_port_user() checks be up-to-date. And we can alter those checks to not depend on the spin lock (as it's protected by u->bind_mutex in the ioctl) and can remove the unnecessary locking (this is IOCTL_EVTCHN_UNBIND) path.
In the interrupt handler we cannot use the mutex, but we do not need it.
"The unbind disables the irq before making the port user stale, so when you clear it you are guaranteed that the interrupt handler that might use that port cannot be running." (from David).
Hence this patch removes the spinlock usage on the teardown path and piggybacks on disable_irq happening before we muck with the get_port_user() data. This ensures that the interrupt handler will never run on stale data.
--- drivers/xen/evtchn.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
drivers/xen/evtchn.c +2 -19
@@ -377,18 +377,12 @@ static long evtchn_ioctl(struct file *fiif (unbind.port >=NR_EVENT_CHANNELS )break ; -spin_lock_irq (&port_user_lock); - rc = -ENOTCONN ; -if (get_port_user (unbind.port) != u) { -spin_unlock_irq (&port_user_lock); +if (get_port_user (unbind.port) != u)break ; - }disable_irq (irq_from_evtchn (unbind.port)); -spin_unlock_irq (&port_user_lock); -evtchn_unbind_from_user (u, unbind.port); rc =0 ;
@@ -488,26 +482,15 @@ static int evtchn_release(struct inode *int i;struct per_user_data *u = filp->private_data; -spin_lock_irq (&port_user_lock); - -free_page ((unsigned long )u->ring); -for (i =0 ; i <NR_EVENT_CHANNELS ; i++) {if (get_port_user (i) != u)continue ;disable_irq (irq_from_evtchn (i)); - } - -spin_unlock_irq (&port_user_lock); - -for (i =0 ; i <NR_EVENT_CHANNELS ; i++) { -if (get_port_user (i) != u) -continue ; -evtchn_unbind_from_user (get_port_user (i), i); } +free_page ((unsigned long )u->ring);kfree (u->name);kfree (u);
Greg Kroah-Hartman
maintainerPATCH 94/99 radeon kms: do not flush uninitialized hotplug work
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
commit a01c34f72e7cd2624570818f579b5ab464f93de2 upstream.
Fix a warning from lockdep caused by calling flush_work() for uninitialized hotplug work. Initialize hotplug_work, audio_work and reset_work upon successful radeon_irq_kms_init() completion and thus perform hotplug flush_work only when rdev->irq.installed is true.
[ 4.790019] [drm] Loading CEDAR Microcode [ 4.790943] r600_cp: Failed to load firmware "radeon/CEDAR_smc.bin" [ 4.791152] [drm:evergreen_startup] *ERROR* Failed to load firmware! [ 4.791330] radeon 0000:01:00.0: disabling GPU acceleration
[ 4.792633] INFO: trying to register non-static key. [ 4.792792] the code is fine but needs lockdep annotation. [ 4.792953] turning off the locking correctness validator.
[ 4.793114] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.11.0-rc0-dbg-10676-gfe56456-dirty #1816 [ 4.793314] Hardware name: Acer Aspire 5741G /Aspire 5741G , BIOS V1.20 02/08/2011 [ 4.793507] ffffffff821fd810 ffff8801530b9a18 ffffffff8160434e 0000000000000002 [ 4.794155] ffff8801530b9ad8 ffffffff810b8404 ffff8801530b0798 ffff8801530b0000 [ 4.794789] ffff8801530b9b00 0000000000000046 00000000000004c0 ffffffff00000000 [ 4.795418] Call Trace: [ 4.795573] [<ffffffff8160434e>] dump_stack+0x4e/0x82 [ 4.795731] [<ffffffff810b8404>] __lock_acquire+0x1a64/0x1d30 [ 4.795893] [<ffffffff814a87f0>] ? dev_vprintk_emit+0x50/0x60 [ 4.796034] [<ffffffff810b8fb4>] lock_acquire+0xa4/0x200 [ 4.796216] [<ffffffff8106cd75>] ? flush_work+0x5/0x280 [ 4.796375] [<ffffffff8106cdad>] flush_work+0x3d/0x280 [ 4.796520] [<ffffffff8106cd75>] ? flush_work+0x5/0x280 [ 4.796682] [<ffffffff810b659d>] ? trace_hardirqs_on_caller+0xfd/0x1c0 [ 4.796862] [<ffffffff8131d775>] ? delay_tsc+0x95/0xf0 [ 4.797024] [<ffffffff8141bb8b>] radeon_irq_kms_fini+0x2b/0x70 [ 4.797186] [<ffffffff814557c9>] evergreen_init+0x2a9/0x2e0 [ 4.797347] [<ffffffff813ebb1f>] radeon_device_init+0x5ef/0x700 [ 4.797511] [<ffffffff81335bc7>] ? pci_find_capability+0x47/0x50 [ 4.797672] [<ffffffff813edaed>] radeon_driver_load_kms+0x8d/0x150 [ 4.797843] [<ffffffff813ce426>] drm_get_pci_dev+0x166/0x280 [ 4.798007] [<ffffffff8116cff5>] ? kfree+0xf5/0x2e0 [ 4.798168] [<ffffffff813ea298>] ? radeon_pci_probe+0x98/0xd0 [ 4.798329] [<ffffffff813ea2aa>] radeon_pci_probe+0xaa/0xd0 [ 4.798489] [<ffffffff81339404>] pci_device_probe+0x84/0xe0 [ 4.798644] [<ffffffff814ac7d6>] driver_probe_device+0x76/0x240 [ 4.798805] [<ffffffff814aca73>] __driver_attach+0x93/0xa0 [ 4.798948] [<ffffffff814ac9e0>] ? __device_attach+0x40/0x40 [ 4.799126] [<ffffffff814aa82b>] bus_for_each_dev+0x6b/0xb0 [ 4.799272] [<ffffffff814ac2be>] driver_attach+0x1e/0x20 [ 4.799434] [<ffffffff814abec0>] bus_add_driver+0x1f0/0x280 [ 4.799596] [<ffffffff814ad0e4>] driver_register+0x74/0x150 [ 4.799758] [<ffffffff8133923d>] __pci_register_driver+0x5d/0x60 [ 4.799936] [<ffffffff81d16efc>] ? ttm_init+0x67/0x67 [ 4.800081] [<ffffffff813ce655>] drm_pci_init+0x115/0x130 [ 4.800243] [<ffffffff81d16efc>] ? ttm_init+0x67/0x67 [ 4.800405] [<ffffffff81d16f98>] radeon_init+0x9c/0xba [ 4.800586] [<ffffffff810002ca>] do_one_initcall+0xfa/0x150 [ 4.800746] [<ffffffff81073f60>] ? parse_args+0x120/0x330 [ 4.800909] [<ffffffff81cdafae>] kernel_init_freeable+0x111/0x191 [ 4.801052] [<ffffffff81cda87a>] ? do_early_param+0x88/0x88 [ 4.801233] [<ffffffff815fb670>] ? rest_init+0x140/0x140 [ 4.801393] [<ffffffff815fb67e>] kernel_init+0xe/0x180 [ 4.801556] [<ffffffff8160dcac>] ret_from_fork+0x7c/0xb0 [ 4.801718] [<ffffffff815fb670>] ? rest_init+0x140/0x140
---
drivers/gpu/drm/radeon/radeon_irq_kms.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_irq_kms.c +5 -4
@@ -241,9 +241,6 @@ int radeon_irq_kms_init(struct radeon_de {int r =0 ; -INIT_WORK (&rdev->hotplug_work, radeon_hotplug_work_func); -INIT_WORK (&rdev->audio_work, r600_audio_update_hdmi); -spin_lock_init (&rdev->irq.lock); r =drm_vblank_init (rdev->ddev, rdev->num_crtc);if (r) {
@@ -265,6 +262,10 @@ int radeon_irq_kms_init(struct radeon_de rdev->irq.installed = false;return r; } + +INIT_WORK (&rdev->hotplug_work, radeon_hotplug_work_func); +INIT_WORK (&rdev->audio_work, r600_audio_update_hdmi); +DRM_INFO ("radeon: irq initialized.\n" );return 0 ; }
@@ -284,8 +285,8 @@ void radeon_irq_kms_fini(struct radeon_d rdev->irq.installed = false;if (rdev->msi_enabled)pci_disable_msi (rdev->pdev); +flush_work (&rdev->hotplug_work); } -flush_work (&rdev->hotplug_work); }/**
Greg Kroah-Hartman
maintainerPATCH 95/99 iscsi-target: Fix iscsit_add_reject* usage for iser
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit ba159914086f06532079fc15141f46ffe7e04a41 upstream
This patch changes iscsit_add_reject() + iscsit_add_reject_from_cmd() usage to not sleep on iscsi_cmd->reject_comp to address a free-after-use usage bug in v3.10 with iser-target code.
It saves ->reject_reason for use within iscsit_build_reject() so the correct value for both transport cases. It also drops the legacy fail_conn parameter usage throughput iscsi-target code and adds two iscsit_add_reject_cmd() and iscsit_reject_cmd helper functions, along with various small cleanups.
(v2: Re-enable target_put_sess_cmd() to be called from
iscsit_add_reject_from_cmd() for rejects invoked after target_get_sess_cmd() has been called)
--- drivers/infiniband/ulp/isert/ib_isert.c | 5 drivers/target/iscsi/iscsi_target.c | 251 ++++++++++++------------------- drivers/target/iscsi/iscsi_target.h | 2 drivers/target/iscsi/iscsi_target_core.h | 4 drivers/target/iscsi/iscsi_target_erl0.c | 7 drivers/target/iscsi/iscsi_target_erl1.c | 20 +- drivers/target/iscsi/iscsi_target_util.c | 1 include/target/iscsi/iscsi_transport.h | 2 8 files changed, 116 insertions(+), 176 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +0 -5
@@ -957,11 +957,6 @@ sequence_cmd:if (!rc && dump_payload == false && unsol_data)iscsit_set_unsoliticed_dataout (cmd); -if (rc ==CMDSN_ERROR_CANNOT_RECOVER ) -return iscsit_add_reject_from_cmd ( -ISCSI_REASON_PROTOCOL_ERROR , -1 ,0 , (unsigned char *)hdr, cmd); -return 0 ; }
drivers/target/iscsi/iscsi_target.c +101 -150
576 lines not on this page · raw message
drivers/target/iscsi/iscsi_target.h +1 -1
@@ -15,7 +15,7 @@ extern struct iscsi_np *iscsit_add_np(stextern int iscsit_reset_np_thread (struct iscsi_np *,struct iscsi_tpg_np *,struct iscsi_portal_group *);extern int iscsit_del_np (struct iscsi_np *); -extern int iscsit_add_reject_from_cmd (u8 ,int ,int ,unsigned char *,struct iscsi_cmd *); +extern int iscsit_reject_cmd (struct iscsi_cmd *cmd,u8 ,unsigned char *);extern void iscsit_set_unsoliticed_dataout (struct iscsi_cmd *);extern int iscsit_logout_closesession (struct iscsi_cmd *,struct iscsi_conn *);extern int iscsit_logout_closeconnection (struct iscsi_cmd *,struct iscsi_conn *);
drivers/target/iscsi/iscsi_target_core.h +2 -2
@@ -132,7 +132,6 @@ enum cmd_flags_table {ICF_CONTIG_MEMORY =0x00000020 ,ICF_ATTACHED_TO_RQUEUE =0x00000040 , ICF_OOO_CMDSN = 0x00000080, - ICF_REJECT_FAIL_CONN = 0x00000100, };/* struct iscsi_cmd->i_state */
@@ -366,6 +365,8 @@ struct iscsi_cmd {u8 maxcmdsn_inc;/* Immediate Unsolicited Dataout */ u8 unsolicited_data; +/* Reject reason code */ +u8 reject_reason;/* CID contained in logout PDU when opcode == ISCSI_INIT_LOGOUT_CMND */ u16 logout_cid;/* Command flags */
@@ -446,7 +447,6 @@ struct iscsi_cmd {struct list_head datain_list;/* R2T List */ struct list_head cmd_r2t_list; -struct completion reject_comp;/* Timer for DataOUT */ struct timer_list dataout_timer;/* Iovecs for SCSI data payload RX/TX w/ kernel level sockets */
drivers/target/iscsi/iscsi_target_erl0.c +3 -4
@@ -746,13 +746,12 @@ int iscsit_check_post_dataout(if (!conn->sess->sess_ops->ErrorRecoveryLevel) {pr_err ("Unable to recover from DataOUT CRC" " failure while ERL=0, closing session.\n" ); -iscsit_add_reject_from_cmd (ISCSI_REASON_DATA_DIGEST_ERROR , -1 ,0 , buf, cmd); +iscsit_reject_cmd (cmd,ISCSI_REASON_DATA_DIGEST_ERROR , + buf);return DATAOUT_CANNOT_RECOVER ; } -iscsit_add_reject_from_cmd (ISCSI_REASON_DATA_DIGEST_ERROR , -0 ,0 , buf, cmd); +iscsit_reject_cmd (cmd,ISCSI_REASON_DATA_DIGEST_ERROR , buf);return iscsit_dataout_post_crc_failed (cmd, buf); } }
drivers/target/iscsi/iscsi_target_erl1.c +9 -11
@@ -162,9 +162,8 @@ static int iscsit_handle_r2t_snack(" protocol error.\n" , cmd->init_task_tag, begrun, (begrun + runlength), cmd->acked_data_sn); -return iscsit_add_reject_from_cmd ( -ISCSI_REASON_PROTOCOL_ERROR , -1 ,0 , buf, cmd); +return iscsit_reject_cmd (cmd, +ISCSI_REASON_PROTOCOL_ERROR , buf); }if (runlength) {
@@ -173,8 +172,8 @@ static int iscsit_handle_r2t_snack(" with BegRun: 0x%08x, RunLength: 0x%08x, exceeds" " current R2TSN: 0x%08x, protocol error.\n" , cmd->init_task_tag, begrun, runlength, cmd->r2t_sn); -return iscsit_add_reject_from_cmd ( -ISCSI_REASON_BOOKMARK_INVALID ,1 ,0 , buf, cmd); +return iscsit_reject_cmd (cmd, +ISCSI_REASON_BOOKMARK_INVALID , buf); } last_r2tsn = (begrun + runlength); }else
@@ -433,8 +432,7 @@ static int iscsit_handle_recovery_datain" protocol error.\n" , cmd->init_task_tag, begrun, (begrun + runlength), cmd->acked_data_sn); -return iscsit_add_reject_from_cmd (ISCSI_REASON_PROTOCOL_ERROR , -1 ,0 , buf, cmd); +return iscsit_reject_cmd (cmd,ISCSI_REASON_PROTOCOL_ERROR , buf); }/*
@@ -445,14 +443,14 @@ static int iscsit_handle_recovery_datainpr_err ("Initiator requesting BegRun: 0x%08x, RunLength" ": 0x%08x greater than maximum DataSN: 0x%08x.\n" , begrun, runlength, (cmd->data_sn -1 )); -return iscsit_add_reject_from_cmd (ISCSI_REASON_BOOKMARK_INVALID , -1 ,0 , buf, cmd); +return iscsit_reject_cmd (cmd,ISCSI_REASON_BOOKMARK_INVALID , + buf); } dr =iscsit_allocate_datain_req ();if (!dr) -return iscsit_add_reject_from_cmd (ISCSI_REASON_BOOKMARK_NO_RESOURCES , -1 ,0 , buf, cmd); +return iscsit_reject_cmd (cmd,ISCSI_REASON_BOOKMARK_NO_RESOURCES , + buf); dr->data_sn = dr->begrun = begrun; dr->runlength = runlength;
drivers/target/iscsi/iscsi_target_util.c +0 -1
@@ -178,7 +178,6 @@ struct iscsi_cmd *iscsit_allocate_cmd(stINIT_LIST_HEAD (&cmd->i_conn_node);INIT_LIST_HEAD (&cmd->datain_list);INIT_LIST_HEAD (&cmd->cmd_r2t_list); -init_completion (&cmd->reject_comp);spin_lock_init (&cmd->datain_lock);spin_lock_init (&cmd->dataout_timeout_lock);spin_lock_init (&cmd->istate_lock);
include/target/iscsi/iscsi_transport.h +0 -2
@@ -34,8 +34,6 @@ extern void iscsit_put_transport(struct/* * From iscsi_target.c */ -extern int iscsit_add_reject_from_cmd (u8 ,int ,int ,unsigned char *, -struct iscsi_cmd *);extern int iscsit_setup_scsi_cmd (struct iscsi_conn *,struct iscsi_cmd *,unsigned char *);extern void iscsit_set_unsoliticed_dataout (struct iscsi_cmd *);
Greg Kroah-Hartman
maintainerPATCH 96/99 iscsi-target: Fix iscsit_sequence_cmd reject handling for iser
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 561bf15892375597ee59d473a704a3e634c4f311 upstream
This patch moves ISCSI_OP_REJECT failures into iscsit_sequence_cmd() in order to avoid external iscsit_reject_cmd() reject usage for all PDU types.
It also updates PDU specific handlers for traditional iscsi-target code to not reset the session after posting a ISCSI_OP_REJECT during setup.
(v2: Fix CMDSN_LOWER_THAN_EXP for ISCSI_OP_SCSI to call
target_put_sess_cmd() after iscsit_sequence_cmd() failure)
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 - drivers/target/iscsi/iscsi_target.c | 50 +++++++++++++++++++------------ drivers/target/iscsi/iscsi_target_erl1.c | 6 +-- drivers/target/iscsi/iscsi_target_util.c | 26 ++++++++++++---- drivers/target/iscsi/iscsi_target_util.h | 3 + include/target/iscsi/iscsi_transport.h | 3 + 6 files changed, 60 insertions(+), 30 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +1 -1
@@ -952,7 +952,7 @@ isert_handle_scsi_cmd(struct isert_conn } sequence_cmd: - rc =iscsit_sequence_cmd (conn, cmd, hdr->cmdsn); + rc =iscsit_sequence_cmd (conn, cmd, buf, hdr->cmdsn);if (!rc && dump_payload == false && unsol_data)iscsit_set_unsoliticed_dataout (cmd);
drivers/target/iscsi/iscsi_target.c +32 -18
119 lines not on this page · raw message
drivers/target/iscsi/iscsi_target_erl1.c +3 -3
@@ -1088,7 +1088,7 @@ int iscsit_handle_ooo_cmdsn( ooo_cmdsn =iscsit_allocate_ooo_cmdsn ();if (!ooo_cmdsn) -return CMDSN_ERROR_CANNOT_RECOVER ; +return -ENOMEM ; ooo_cmdsn->cmd = cmd; ooo_cmdsn->batch_count = (batch) ?
@@ -1099,10 +1099,10 @@ int iscsit_handle_ooo_cmdsn(if (iscsit_attach_ooo_cmdsn (sess, ooo_cmdsn) <0 ) {kmem_cache_free (lio_ooo_cache, ooo_cmdsn); -return CMDSN_ERROR_CANNOT_RECOVER ; +return -ENOMEM ; } -return CMDSN_HIGHER_THAN_EXP ; +return 0 ; } static int iscsit_set_dataout_timeout_values(
drivers/target/iscsi/iscsi_target_util.c +20 -6
@@ -283,13 +283,12 @@ static inline int iscsit_check_received_* Commands may be received out of order if MC/S is in use. * Ensure they are executed in CmdSN order. */ -int iscsit_sequence_cmd ( -struct iscsi_conn *conn, -struct iscsi_cmd *cmd, -__be32 cmdsn) +int iscsit_sequence_cmd (struct iscsi_conn *conn,struct iscsi_cmd *cmd, +unsigned char *buf,__be32 cmdsn) { -int ret; -int cmdsn_ret; +int ret, cmdsn_ret; +bool reject = false; +u8 reason =ISCSI_REASON_BOOKMARK_NO_RESOURCES ;mutex_lock (&conn->sess->cmdsn_mutex);
@@ -299,9 +298,19 @@ int iscsit_sequence_cmd( ret =iscsit_execute_cmd (cmd,0 );if ((ret >=0 ) && !list_empty (&conn->sess->sess_ooo_cmdsn_list))iscsit_execute_ooo_cmdsns (conn->sess); +else if (ret <0 ) { + reject = true; + ret =CMDSN_ERROR_CANNOT_RECOVER ; + }break ;case CMDSN_HIGHER_THAN_EXP : ret =iscsit_handle_ooo_cmdsn (conn->sess, cmd,be32_to_cpu (cmdsn)); +if (ret <0 ) { + reject = true; + ret =CMDSN_ERROR_CANNOT_RECOVER ; +break ; + } + ret =CMDSN_HIGHER_THAN_EXP ;break ;case CMDSN_LOWER_THAN_EXP : cmd->i_state =ISTATE_REMOVE ;
@@ -309,11 +318,16 @@ int iscsit_sequence_cmd( ret = cmdsn_ret;break ;default : + reason =ISCSI_REASON_PROTOCOL_ERROR ; + reject = true; ret = cmdsn_ret;break ; }mutex_unlock (&conn->sess->cmdsn_mutex); +if (reject) +iscsit_reject_cmd (cmd, reason, buf); +return ret; }EXPORT_SYMBOL (iscsit_sequence_cmd);
drivers/target/iscsi/iscsi_target_util.h +2 -1
@@ -13,7 +13,8 @@ extern struct iscsi_cmd *iscsit_allocateextern struct iscsi_seq *iscsit_get_seq_holder_for_datain (struct iscsi_cmd *,u32 );extern struct iscsi_seq *iscsit_get_seq_holder_for_r2t (struct iscsi_cmd *);extern struct iscsi_r2t *iscsit_get_holder_for_r2tsn (struct iscsi_cmd *,u32 ); -int iscsit_sequence_cmd (struct iscsi_conn *conn,struct iscsi_cmd *cmd,__be32 cmdsn); +extern int iscsit_sequence_cmd (struct iscsi_conn *conn,struct iscsi_cmd *cmd, +unsigned char * ,__be32 cmdsn);extern int iscsit_check_unsolicited_dataout (struct iscsi_cmd *,unsigned char *);extern struct iscsi_cmd *iscsit_find_cmd_from_itt (struct iscsi_conn *,itt_t ); extern struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump(struct iscsi_conn *,
include/target/iscsi/iscsi_transport.h +2 -1
@@ -82,4 +82,5 @@ extern int iscsit_tmr_post_handler(struc* From iscsi_target_util.c */ extern struct iscsi_cmd *iscsit_allocate_cmd (struct iscsi_conn *,gfp_t ); -extern int iscsit_sequence_cmd (struct iscsi_conn *,struct iscsi_cmd *,__be32 ); +extern int iscsit_sequence_cmd (struct iscsi_conn *,struct iscsi_cmd *, +unsigned char *,__be32 );
Greg Kroah-Hartman
maintainerPATCH 97/99 perf tools: Revert regression in configuration of Python support
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Witten <[email protected]>
commit a363a9da65d253fa7354ce5fd630f4f94df934cc upstream.
Among other things, the following:
commit 31160d7feab786c991780d7f0ce2755a469e0e5e
Date: Tue Jan 8 16:22:36 2013 -0500
perf tools: Fix GNU make v3.80 compatibility issue
attempts to aid the user by tapping into an existing error message, as described in the commit message:
... Also fix an issue where _get_attempt was called with only one argument. This prevented the error message from printing the name of the variable that can be used to fix the problem.
or more precisely:
-$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) +$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2),$(1)))
However, The "missing" argument was in fact missing on purpose; it's absence is a signal that the error message should be skipped, because the failure would be due to the default value, not any user-supplied value. This can be seen in how _ge_attempt' uses gea_err' (in the config/utilities.mak file):
_ge_attempt = $(if $(get-executable),$(get-executable),$(_gea_warn)$(call _gea_err,$(2))) _gea_warn = $(warning The path '$(1)' is not executable.) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately))
That is, because the argument is no longer missing, the value $(1)' (associated with _gea_err') always evaluates to true, thus always triggering the error condition that is meant to be reserved for only the case when a user explicitly supplies an invalid value.
Concretely, the result is a regression in the Makefile's configuration of python support; rather than gracefully disable support when the relevant executables cannot be found according to default values, the build process halts in error as though the user explicitly supplied the values.
This new commit simply reverts the offending one-line change.
--- tools/perf/config/utilities.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/config/utilities.mak +1 -1
@@ -173,7 +173,7 @@ _ge-abspath = $(if $(is-executable),$(1) # Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default) # define get-executable-or-default -$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2),$(1))) +$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) endef _ge_attempt = $(if $(get-executable),$(get-executable),$(_gea_warn)$(call _gea_err,$(2))) _gea_warn = $(warning The path '$(1)' is not executable.)
Greg Kroah-Hartman
maintainerPATCH 98/99 drm/i915: Correct obj->mm_list link to dev_priv->dev_priv->mm.inactive_list
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiong Zhang <[email protected]>
commit 067556084a0e412013af6b0250a3143ae5afde6d upstream.
obj->mm_list link to dev_priv->mm.inactive_list/active_list obj->global_list link to dev_priv->mm.unbound_list/bound_list
This regression has been introduced in
commit 93927ca52a55c23e0a6a305e7e9082e8411ac9fa
Author: Daniel Vetter <[email protected]> Date: Thu Jan 10 18:03:00 2013 +0100
drm/i915: Revert shrinker changes from "Track unbound pages"
--- drivers/gpu/drm/i915/i915_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -4493,7 +4493,7 @@ i915_gem_inactive_shrink(struct shrinkerlist_for_each_entry (obj, &dev_priv->mm.unbound_list, gtt_list)if (obj->pages_pin_count ==0 ) cnt += obj->base.size >>PAGE_SHIFT ; -list_for_each_entry (obj, &dev_priv->mm.inactive_list, gtt_list) +list_for_each_entry (obj, &dev_priv->mm.inactive_list, mm_list)if (obj->pin_count ==0 && obj->pages_pin_count ==0 ) cnt += obj->base.size >>PAGE_SHIFT ;
Greg Kroah-Hartman
maintainerPATCH 99/99 x86: Fix /proc/mtrr with base/size more than 44bits
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yinghai Lu <[email protected]>
commit d5c78673b1b28467354c2c30c3d4f003666ff385 upstream.
On one sytem that mtrr range is more then 44bits, in dmesg we have
[ 0.000000] MTRR default type: write-back [ 0.000000] MTRR fixed ranges enabled: [ 0.000000] 00000-9FFFF write-back [ 0.000000] A0000-BFFFF uncachable [ 0.000000] C0000-DFFFF write-through [ 0.000000] E0000-FFFFF write-protect [ 0.000000] MTRR variable ranges enabled: [ 0.000000] 0 [000080000000-0000FFFFFFFF] mask 3FFF80000000 uncachable [ 0.000000] 1 [380000000000-38FFFFFFFFFF] mask 3F0000000000 uncachable [ 0.000000] 2 [000099000000-000099FFFFFF] mask 3FFFFF000000 write-through [ 0.000000] 3 [00009A000000-00009AFFFFFF] mask 3FFFFF000000 write-through [ 0.000000] 4 [381FFA000000-381FFBFFFFFF] mask 3FFFFE000000 write-through [ 0.000000] 5 [381FFC000000-381FFC0FFFFF] mask 3FFFFFF00000 write-through [ 0.000000] 6 [0000AD000000-0000ADFFFFFF] mask 3FFFFF000000 write-through [ 0.000000] 7 [0000BD000000-0000BDFFFFFF] mask 3FFFFF000000 write-through [ 0.000000] 8 disabled [ 0.000000] 9 disabled
but /proc/mtrr report wrong:
reg00: base=0x080000000 ( 2048MB), size= 2048MB, count=1: uncachable
reg01: base=0x80000000000 (8388608MB), size=1048576MB, count=1: uncachable
reg02: base=0x099000000 ( 2448MB), size= 16MB, count=1: write-through
reg03: base=0x09a000000 ( 2464MB), size= 16MB, count=1: write-through
reg04: base=0x81ffa000000 (8519584MB), size= 32MB, count=1: write-through
reg05: base=0x81ffc000000 (8519616MB), size= 1MB, count=1: write-through
reg06: base=0x0ad000000 ( 2768MB), size= 16MB, count=1: write-through
reg07: base=0x0bd000000 ( 3024MB), size= 16MB, count=1: write-through
reg08: base=0x09b000000 ( 2480MB), size= 16MB, count=1: write-combining
so bit 44 and bit 45 get cut off.
We have problems in arch/x86/kernel/cpu/mtrr/generic.c::generic_get_mtrr().
1. for base, we miss cast base_lo to 64bit before shifting.
Fix that by adding u64 casting.
2. for size, it only can handle 44 bits aka 32bits + page_shift Fix that with 64bit mask instead of 32bit mask_lo, then range could be more than 44bits.
At the same time, we need to update size_or_mask for old cpus that does support cpuid 0x80000008 to get phys_addr. Need to set high 32bits to all 1s, otherwise will not get correct size for them.
Also fix mtrr_add_page: it should check base and (base + size - 1) instead of base and size, as base and size could be small but base + size could bigger enough to be out of boundary. We can use boot_cpu_data.x86_phys_bits directly to avoid size_or_mask.
So When are we going to have size more than 44bits? that is 16TiB.
after patch we have right ouput:
reg00: base=0x080000000 ( 2048MB), size= 2048MB, count=1: uncachable
reg01: base=0x380000000000 (58720256MB), size=1048576MB, count=1: uncachable
reg02: base=0x099000000 ( 2448MB), size= 16MB, count=1: write-through
reg03: base=0x09a000000 ( 2464MB), size= 16MB, count=1: write-through
reg04: base=0x381ffa000000 (58851232MB), size= 32MB, count=1: write-through
reg05: base=0x381ffc000000 (58851264MB), size= 1MB, count=1: write-through
reg06: base=0x0ad000000 ( 2768MB), size= 16MB, count=1: write-through
reg07: base=0x0bd000000 ( 3024MB), size= 16MB, count=1: write-through
reg08: base=0x09b000000 ( 2480MB), size= 16MB, count=1: write-combining
-v2: simply checking in mtrr_add_page according to hpa.
[ hpa: This probably wants to go into -stable only after having sat in
mainline for a bit. It is not a regression. ]
--- arch/x86/kernel/cpu/mtrr/generic.c | 21 +++++++++++---------- arch/x86/kernel/cpu/mtrr/main.c | 16 +++++++++------- 2 files changed, 20 insertions(+), 17 deletions(-)
arch/x86/kernel/cpu/mtrr/generic.c +11 -10
@@ -510,8 +510,9 @@ generic_get_free_region(unsigned long bastatic void generic_get_mtrr (unsigned int reg,unsigned long *base,unsigned long *size,mtrr_type *type) { -unsigned int mask_lo, mask_hi, base_lo, base_hi; -unsigned int tmp, hi; +u32 mask_lo, mask_hi, base_lo, base_hi; +unsigned int hi; +u64 tmp, mask;/* * get_mtrr doesn't need to update mtrr_state, also it could be called
@@ -532,18 +533,18 @@ static void generic_get_mtrr(unsigned inrdmsr (MTRRphysBase_MSR (reg), base_lo, base_hi);/* Work out the shifted address mask: */ - tmp = mask_hi << (32 -PAGE_SHIFT ) | mask_lo >>PAGE_SHIFT ; - mask_lo = size_or_mask | tmp; + tmp = (u64 )mask_hi << (32 -PAGE_SHIFT ) | mask_lo >>PAGE_SHIFT ; + mask = size_or_mask | tmp;/* Expand tmp with high bits to all 1s: */ - hi =fls (tmp); + hi =fls64 (tmp);if (hi >0 ) { - tmp |= ~((1 <<(hi -1 )) -1 ); + tmp |= ~((1ULL <<(hi -1 )) -1 ); -if (tmp != mask_lo) { +if (tmp != mask) {printk (KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n" );add_taint (TAINT_FIRMWARE_WORKAROUND ,LOCKDEP_STILL_OK ); - mask_lo = tmp; + mask = tmp; } }
@@ -551,8 +552,8 @@ static void generic_get_mtrr(unsigned in* This works correctly if size is a power of two, i.e. a * contiguous range: */ - *size = -mask_lo; - *base = base_hi << (32 -PAGE_SHIFT ) | base_lo >>PAGE_SHIFT ; + *size = -mask; + *base = (u64 )base_hi << (32 -PAGE_SHIFT ) | base_lo >>PAGE_SHIFT ; *type = base_lo &0xff ; out_put_cpu:
arch/x86/kernel/cpu/mtrr/main.c +9 -7
@@ -305,7 +305,8 @@ int mtrr_add_page(unsigned long base, unreturn -EINVAL ; } -if (base & size_or_mask || size & size_or_mask) { +if ((base | (base + size -1 )) >> + (boot_cpu_data.x86_phys_bits -PAGE_SHIFT )) {pr_warning ("mtrr: base or size exceeds the MTRR width\n" );return -EINVAL ; }
@@ -583,6 +584,7 @@ static struct syscore_ops mtrr_syscore_oint __initdata changed_by_mtrr_cleanup; +#define SIZE_OR_MASK_BITS (n) (~((1ULL << ((n) - PAGE_SHIFT)) - 1))/** * mtrr_bp_init - initialize mtrrs on the boot CPU *
@@ -600,7 +602,7 @@ void __init mtrr_bp_init(void)if (cpu_has_mtrr) { mtrr_if = &generic_mtrr_ops; - size_or_mask =0xff000000 ;/* 36 bits */ + size_or_mask =SIZE_OR_MASK_BITS (36 ); size_and_mask =0x00f00000 ; phys_addr =36 ;
@@ -619,7 +621,7 @@ void __init mtrr_bp_init(void) boot_cpu_data.x86_mask == 0x4)) phys_addr =36 ; - size_or_mask = ~((1ULL << (phys_addr -PAGE_SHIFT )) -1 ); + size_or_mask =SIZE_OR_MASK_BITS (phys_addr); size_and_mask = ~size_or_mask &0xfffff00000ULL ; }else if (boot_cpu_data.x86_vendor ==X86_VENDOR_CENTAUR && boot_cpu_data.x86 ==6 ) {
@@ -627,7 +629,7 @@ void __init mtrr_bp_init(void)* VIA C* family have Intel style MTRRs, * but don't support PAE */ - size_or_mask =0xfff00000 ;/* 32 bits */ + size_or_mask =SIZE_OR_MASK_BITS (32 ); size_and_mask =0 ; phys_addr =32 ; }
@@ -637,21 +639,21 @@ void __init mtrr_bp_init(void)if (cpu_has_k6_mtrr) {/* Pre-Athlon (K6) AMD CPU MTRRs */ mtrr_if = mtrr_ops[X86_VENDOR_AMD ]; - size_or_mask =0xfff00000 ;/* 32 bits */ + size_or_mask =SIZE_OR_MASK_BITS (32 ); size_and_mask =0 ; }break ;case X86_VENDOR_CENTAUR :if (cpu_has_centaur_mcr) { mtrr_if = mtrr_ops[X86_VENDOR_CENTAUR ]; - size_or_mask =0xfff00000 ;/* 32 bits */ + size_or_mask =SIZE_OR_MASK_BITS (32 ); size_and_mask =0 ; }break ;case X86_VENDOR_CYRIX :if (cpu_has_cyrix_arr) { mtrr_if = mtrr_ops[X86_VENDOR_CYRIX ]; - size_or_mask =0xfff00000 ;/* 32 bits */ + size_or_mask =SIZE_OR_MASK_BITS (32 ); size_and_mask =0 ; }break ;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.5 release. There are 99 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 4 10:00:45 UTC 2013. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.5-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Patches applied cleanly to 3.0.88, 3.4.55 and 3.10.4
Compiled and booted on the following systems:
Samsung Series 9 900X4C Intel Corei5:
(3.4.56-rc1, 3.10.5-rc1)
HP ProBook 6475b AMD A10-4600M APU with Radeon(tm) HD Graphics:
(3.0.89-rc1, 3.4.56-rc1, and 3.10.5-rc1)dmesgs for all releases look good. No regressions compared to the previous dmesgs for each of these releases. dmesg emerg, crit, alert, err are clean. No regressions in warn.
Cross-compile testing:
HP Compaq dc7700 SFF desktop: x86-64 Intel Core-i2:
(3.0.89-rc1, 3.4.56-rc1, and 3.10.5-rc1)
Cross-compile tests results:
alpha: defconfig passed on all
arm: defconfig passed on all
arm64: not applicable to 3.0.y, 3.4.y. defconfig passed on 3.10.y
c6x: not applicable to 3.0.y, defconfig passed on 3.4.y, and 3.10.y
mips: defconfig passed on all
mipsel: defconfig passed on all
powerpc: wii_defconfig passed on all
sh: defconfig passed on all
sparc: defconfig passed on all
tile: tilegx_defconfig passed on all
-- Shuah
Shuah Khan, Linux Kernel Developer - Open Source Group Samsung Research America (Silicon Valley) [email protected] | (970) 672-0658
Greg Kroah-Hartman
maintainerQuoted 13 lines · Shuah Khan
Quoted 12 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.5 release. There are 99 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 4 10:00:45 UTC 2013. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.5-rc1.gzand the diffstat can be found below.
Quoted 8 lines
Quoted 4 lines
thanks,
greg k-h
Patches applied cleanly to 3.0.88, 3.4.55 and 3.10.4
Compiled and booted on the following systems:
Wonderful, thanks for testing and letting me know.
greg k-h
Quoted 16 lines · Greg Kroah-Hartman
Quoted 15 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.5 release. There are 99 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 4 10:00:45 UTC 2013. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.5-rc1.gzand the diffstat can be found below.
thanks,
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
greg k-h
Patches applied cleanly to 3.0.88, 3.4.55 and 3.10.4
Compiled and booted on the following systems:
Wonderful, thanks for testing and letting me know.
And just to complete this, it now boots fine on the ARM-based motherboard that required a patch in 3.10.3, and looks OK on my laptop which uses the i915 driver.
Cheers,
Willy
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.5 release. There are 99 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Responses should be made by Sun Aug 4 10:00:45 UTC 2013. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.5-rc1.gzand the diffstat can be found below.
Cross build looks good.
Summary:
Total builds: 64 Total build errors: 3
Details:
http://desktop.roeck-us.net/buildlogs/v3.10/v3.10.4-99-g069bbeb.2013-08-03.02:22:12
Guenter
Greg Kroah-Hartman
maintainerQuoted 13 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.5 release. There are 99 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Responses should be made by Sun Aug 4 10:00:45 UTC 2013. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.5-rc1.gzand the diffstat can be found below.
Quoted 7 lines
Cross build looks good.
Summary:
Total builds: 64 Total build errors: 3Details:
http://desktop.roeck-us.net/buildlogs/v3.10/v3.10.4-99-g069bbeb.2013-08-03.02:22:12
Thanks for testing and letting me know.
greg k-h