3.15.4-stable review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 3.15.4-stable review
This is the start of the stable review cycle for the 3.15.4 release. There are 66 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 Jul 6 22:13:57 UTC 2014. 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.15.4-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.15.4-rc1
Mengdong Lin <[email protected]>
ALSA: hda - restore BCLK M/N values when resuming HSW/BDW display controller
Takashi Iwai <[email protected]>
ALSA: hda - Adjust speaker HPF and add LED support for HP Spectre 13
Pierre Ossman <[email protected]>
ALSA: hda - hdmi: call overridden init on resume
Takashi Iwai <[email protected]>
ALSA: usb-audio: Fix races at disconnection and PCM closing
Oleg Nesterov <[email protected]>
tracing: Fix syscall_*regfunc() vs copy_process() race
Steven Rostedt (Red Hat) <[email protected]>
tracing: Try again for saved cmdline if failed due to locking
Jacob Keller <[email protected]>
Documentation/SubmittingPatches: describe the Fixes: tag
Greg Kroah-Hartman <[email protected]>
lz4: add overrun checks to lz4_uncompress_unknownoutputsize()
Tejun Heo <[email protected]>
ptrace,x86: force IRET path after a ptrace_stop()
Deng-Cheng Zhu <[email protected]>
MIPS: KVM: Fix memory leak on VCPU
James Hogan <[email protected]>
MIPS: KVM: Remove redundant NULL checks before kfree()
Aaron Plattner <[email protected]>
cpufreq: unlock when failing cpufreq_update_policy()
Ed Swarthout <[email protected]>
cpufreq: ppc-corenet-cpu-freq: do_div use quotient
Jeff Mahoney <[email protected]>
reiserfs: call truncate_setsize under tailpack mutex
Dave Chinner <[email protected]>
xfs: xfs_readsb needs to check for magic numbers
Scott Wood <[email protected]>
powerpc: Don't skip ePAPR spin-table CPUs
Benjamin Herrenschmidt <[email protected]>
powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support
Michael Neuling <[email protected]>
powerpc: Don't setup CPUs with bad status
Paul Bolle <[email protected]>
powerpc: fix typo 'CONFIG_PPC_CPU'
Michael Ellerman <[email protected]>
powerpc/perf: Ensure all EBB register state is cleared on fork()
Paul Bolle <[email protected]>
powerpc: fix typo 'CONFIG_PMAC'
Anton Blanchard <[email protected]>
powerpc: 64bit sendfile is capped at 2GB
Benjamin Herrenschmidt <[email protected]>
powerpc/serial: Use saner flags when creating legacy ports
Michael Ellerman <[email protected]>
powerpc/mm: Check paca psize is up to date for huge mappings
Anton Blanchard <[email protected]>
powernv: Fix permissions on sysparam sysfs entries
Gavin Shan <[email protected]>
powerpc/pseries: Fix overwritten PE state
Scott Mayhew <[email protected]>
nfs: Fix cache_validity check in nfs_write_pageuptodate()
Mateusz Guzik <[email protected]>
NFS: populate ->net in mount data when remounting
Trond Myklebust <[email protected]>
NFS: Use raw_write_seqcount_begin/end int nfs4_reclaim_open_state
Trond Myklebust <[email protected]>
NFS: Don't declare inode uptodate unless all attributes were checked
Christoph Hellwig <[email protected]>
nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer
J. Bruce Fields <[email protected]>
nfsd4: fix FREE_STATEID lockowner leak
Trond Myklebust <[email protected]>
pNFS: Handle allocation errors correctly in filelayout_alloc_layout_hdr()
Trond Myklebust <[email protected]>
SUNRPC: Fix a module reference leak in svc_handle_xprt
Bart Van Assche <[email protected]>
IB/umad: Fix use-after-free on close
Bart Van Assche <[email protected]>
IB/umad: Fix error handling
Bart Van Assche <[email protected]>
IB/srp: Fix a sporadic crash triggered by cable pulling
Dennis Dalessandro <[email protected]>
IB/ipath: Translate legacy diagpkt into newer extended diagpkt
Mike Marciniszyn <[email protected]>
IB/qib: Fix port in pkey change event
Yann Droneaud <[email protected]>
IB/mlx5: add missing padding at end of struct mlx5_ib_create_srq
Yann Droneaud <[email protected]>
IB/mlx5: add missing padding at end of struct mlx5_ib_create_cq
Don Zickus <[email protected]>
kernel/watchdog.c: remove preemption restrictions when restarting lockup detector
gundberg <[email protected]>
watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog
Gabor Juhos <[email protected]>
watchdog: ath79_wdt: avoid spurious restarts on AR934x
Viresh Kumar <[email protected]>
watchdog: sp805: Set watchdog_device->timeout from ->set_timeout()
Yann Droneaud <[email protected]>
RDMA/cxgb4: add missing padding at end of struct c4iw_alloc_ucontext_resp
Yann Droneaud <[email protected]>
RDMA/cxgb4: Add missing padding at end of struct c4iw_create_cq_resp
Christoph Jaeger <[email protected]>
RDMA/cxgb4: Fix memory leaks in c4iw_alloc() error paths
hujianyang <[email protected]>
UBIFS: Remove incorrect assertion in shrink_tnc()
hujianyang <[email protected]>
UBIFS: fix an mmap and fsync race condition
Joe Handzik <[email protected]>
hpsa: add new Smart Array PCI IDs (May 2014)
Markos Chandras <[email protected]>
MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region
Paul Burton <[email protected]>
Revert "MIPS: Save/restore MSA context around signals"
Alex Smith <[email protected]>
recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules
Asai Thambi S P <[email protected]>
mtip32xx: Remove dfs_parent after pci unregister
Asai Thambi S P <[email protected]>
mtip32xx: Increase timeout for STANDBY IMMEDIATE command
Asai Thambi S P <[email protected]>
mtip32xx: Fix ERO and NoSnoop values in PCIe upstream on AMD systems
Bjorn Helgaas <[email protected]>
PCI: Fix incorrect vgaarb conditional in WARN_ON()
Thomas Jarosch <[email protected]>
PCI: Add new ID for Intel GPU "spurious interrupt" quirk
Hans de Goede <[email protected]>
Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk is set
Hans de Goede <[email protected]>
Input: elantech - deal with clickpads reporting right button events
Benjamin Tissoires <[email protected]>
Input: synaptics - fix resolution for manually provided min/max
Mikulas Patocka <[email protected]>
iscsi-target: fix iscsit_del_np deadlock on unload
Nicholas Bellinger <[email protected]>
iscsi-target: Explicily clear login response PDU in exception path
Nicholas Bellinger <[email protected]>
iscsi-target: Avoid rejecting incorrect ITT for Data-Out
Nicholas Bellinger <[email protected]>
target: Fix left-over se_lun->lun_sep pointer OOPs
-------------
Diffstat:
Documentation/SubmittingPatches | 22 ++- Documentation/sound/alsa/HD-Audio-Models.txt | 5 + Makefile | 4 +- arch/mips/include/asm/sigcontext.h | 2 - arch/mips/include/uapi/asm/sigcontext.h | 8 - arch/mips/kernel/asm-offsets.c | 3 - arch/mips/kernel/irq-msc01.c | 2 +- arch/mips/kernel/r4k_fpu.S | 213 ------------------------- arch/mips/kernel/signal.c | 79 +-------- arch/mips/kernel/signal32.c | 74 +-------- arch/mips/kvm/kvm_mips.c | 13 +- arch/powerpc/include/asm/switch_to.h | 2 + arch/powerpc/include/asm/systbl.h | 2 +- arch/powerpc/include/uapi/asm/cputable.h | 1 + arch/powerpc/kernel/cputable.c | 3 +- arch/powerpc/kernel/legacy_serial.c | 15 +- arch/powerpc/kernel/setup-common.c | 10 +- arch/powerpc/kernel/time.c | 2 +- arch/powerpc/lib/sstep.c | 2 +- arch/powerpc/mm/hash_utils_64.c | 31 ++-- arch/powerpc/platforms/powernv/opal-sysparam.c | 4 +- arch/powerpc/platforms/pseries/eeh_pseries.c | 1 + arch/x86/include/asm/ptrace.h | 16 ++ drivers/block/mtip32xx/mtip32xx.c | 123 ++++++++++---- drivers/cpufreq/cpufreq.c | 10 +- drivers/cpufreq/ppc-corenet-cpufreq.c | 9 +- drivers/infiniband/core/user_mad.c | 75 +++++---- drivers/infiniband/hw/cxgb4/cq.c | 4 +- drivers/infiniband/hw/cxgb4/device.c | 2 + drivers/infiniband/hw/cxgb4/provider.c | 5 +- drivers/infiniband/hw/cxgb4/user.h | 2 + drivers/infiniband/hw/ipath/ipath_diag.c | 4 + drivers/infiniband/hw/mlx5/cq.c | 13 +- drivers/infiniband/hw/mlx5/srq.c | 14 +- drivers/infiniband/hw/mlx5/user.h | 2 + drivers/infiniband/hw/qib/qib_mad.c | 2 +- drivers/infiniband/ulp/srp/ib_srp.c | 6 + drivers/input/mouse/elantech.c | 27 +++- drivers/input/mouse/synaptics.c | 19 +-- drivers/pci/pci.c | 2 +- drivers/pci/quirks.c | 1 + drivers/scsi/hpsa.c | 12 ++ drivers/target/iscsi/iscsi_target.c | 2 +- drivers/target/iscsi/iscsi_target_login.c | 13 +- drivers/target/iscsi/iscsi_target_util.c | 2 + drivers/target/target_core_device.c | 1 + drivers/watchdog/ath79_wdt.c | 10 ++ drivers/watchdog/kempld_wdt.c | 2 +- drivers/watchdog/sp805_wdt.c | 4 +- fs/nfs/inode.c | 26 +-- fs/nfs/nfs4filelayout.c | 2 +- fs/nfs/nfs4state.c | 6 +- fs/nfs/super.c | 1 + fs/nfs/write.c | 4 +- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/nfs4xdr.c | 4 +- fs/reiserfs/inode.c | 8 +- fs/ubifs/file.c | 3 +- fs/ubifs/shrinker.c | 1 - fs/xfs/xfs_mount.c | 23 ++- include/linux/ptrace.h | 3 + include/trace/syscall.h | 15 ++ kernel/fork.c | 2 + kernel/trace/trace.c | 13 +- kernel/watchdog.c | 2 - lib/lz4/lz4_decompress.c | 6 +- net/sunrpc/svc_xprt.c | 2 + scripts/recordmcount.h | 4 +- sound/pci/hda/hda_intel.c | 65 +++++++- sound/pci/hda/patch_hdmi.c | 2 +- sound/pci/hda/patch_sigmatel.c | 58 ++++++- sound/usb/card.c | 13 +- sound/usb/endpoint.c | 17 +- sound/usb/endpoint.h | 1 + 74 files changed, 602 insertions(+), 561 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/66 target: Fix left-over se_lun->lun_sep pointer OOPs
3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 83ff42fcce070801a3aa1cd6a3269d7426271a8d upstream.
This patch fixes a left-over se_lun->lun_sep pointer OOPs when one of the /sys/kernel/config/target/$FABRIC/$WWPN/$TPGT/lun/$LUN/alua* attributes is accessed after the $DEVICE symlink has been removed.
To address this bug, go ahead and clear se_lun->lun_sep memory in core_dev_unexport(), so that the existing checks for show/store ALUA attributes in target_core_fabric_configfs.c work as expected.
--- drivers/target/target_core_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/target_core_device.c +1 -0
@@ -616,6 +616,7 @@ void core_dev_unexport( dev->export_count--;spin_unlock (&hba->device_lock); + lun->lun_sep =NULL ; lun->lun_se_dev =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 2/66 iscsi-target: Avoid rejecting incorrect ITT for Data-Out
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 97c99b47ac58bacb7c09e1f47d5d184434f6b06a upstream.
This patch changes iscsit_check_dataout_hdr() to dump the incoming Data-Out payload when the received ITT is not associated with a WRITE, instead of calling iscsit_reject_cmd() for the non WRITE ITT descriptor.
This addresses a bug where an initiator sending an Data-Out for an ITT associated with a READ would end up generating a reject for the READ, eventually resulting in list corruption.
--- drivers/target/iscsi/iscsi_target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target.c +1 -1
@@ -1309,7 +1309,7 @@ iscsit_check_dataout_hdr(struct iscsi_coif (cmd->data_direction !=DMA_TO_DEVICE ) {pr_err ("Command ITT: 0x%08x received DataOUT for a" " NON-WRITE command.\n" , cmd->init_task_tag); -return iscsit_reject_cmd (cmd,ISCSI_REASON_PROTOCOL_ERROR , buf); +return iscsit_dump_data_payload (conn, payload_length,1 ); } se_cmd = &cmd->se_cmd;iscsit_mod_dataout_timer (cmd);
Greg Kroah-Hartman
maintainerPATCH 3/66 iscsi-target: Explicily clear login response PDU in exception path
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 683497566d48f86e04d026de1ee658dd74fc1077 upstream.
This patch adds a explicit memset to the login response PDU exception path in iscsit_tx_login_rsp().
This addresses a regression bug introduced in commit baa4d64b where the initiator would end up not receiving the login response and associated status class + detail, before closing the login connection.
--- drivers/target/iscsi/iscsi_target_util.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/target/iscsi/iscsi_target_util.c +2 -0
@@ -1295,6 +1295,8 @@ int iscsit_tx_login_rsp(struct iscsi_con login->login_failed =1 ;iscsit_collect_login_stats (conn, status_class, status_detail); +memset (&login->rsp[0 ],0 ,ISCSI_HDR_LEN ); + hdr = (struct iscsi_login_rsp *)&login->rsp[0 ]; hdr->opcode =ISCSI_OP_LOGIN_RSP ; hdr->status_class = status_class;
Greg Kroah-Hartman
maintainerPATCH 4/66 iscsi-target: fix iscsit_del_np deadlock on unload
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 81a9c5e72bdf7109a65102ca61d8cbd722cf4021 upstream.
On uniprocessor preemptible kernel, target core deadlocks on unload. The following events happen:
* iscsit_del_np is called
* it calls send_sig(SIGINT, np->np_thread, 1);
* the scheduler switches to the np_thread
* the np_thread is woken up, it sees that kthread_should_stop() returns false, so it doesn't terminate
* the np_thread clears signals with flush_signals(current); and goes back to sleep in iscsit_accept_np
* the scheduler switches back to iscsit_del_np
* iscsit_del_np calls kthread_stop(np->np_thread);
* the np_thread is waiting in iscsit_accept_np and it doesn't respond to kthread_stop
The deadlock could be resolved if the administrator sends SIGINT signal to the np_thread with killall -INT iscsi_np
The reproducible deadlock was introduced in commit db6077fd0b7dd41dc6ff18329cec979379071f87, but the thread-stopping code was racy even before.
This patch fixes the problem. Using kthread_should_stop to stop the np_thread is unreliable, so we test np_thread_state instead. If np_thread_state equals ISCSI_NP_THREAD_SHUTDOWN, the thread exits.
--- drivers/target/iscsi/iscsi_target_login.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/target/iscsi/iscsi_target_login.c +7 -6
@@ -1216,7 +1216,7 @@ old_sess_out:static int __iscsi_target_login_thread (struct iscsi_np *np) {u8 *buffer, zero_tsih =0 ; -int ret =0 , rc, stop; +int ret =0 , rc;struct iscsi_conn *conn =NULL ;struct iscsi_login *login;struct iscsi_portal_group *tpg =NULL ;
@@ -1230,6 +1230,9 @@ static int __iscsi_target_login_thread(sif (np->np_thread_state ==ISCSI_NP_THREAD_RESET ) { np->np_thread_state =ISCSI_NP_THREAD_ACTIVE ;complete (&np->np_restart_comp); + }else if (np->np_thread_state ==ISCSI_NP_THREAD_SHUTDOWN ) { +spin_unlock_bh (&np->np_thread_lock); + goto exit; }else { np->np_thread_state =ISCSI_NP_THREAD_ACTIVE ; }
@@ -1422,10 +1425,8 @@ old_sess_out: } out: - stop =kthread_should_stop (); -/* Wait for another socket.. */ -if (!stop) -return 1 ; +return 1 ; + exit:iscsi_stop_login_thread_timer (np);spin_lock_bh (&np->np_thread_lock);
@@ -1442,7 +1443,7 @@ int iscsi_target_login_thread(void *arg)allow_signal (SIGINT ); -while (!kthread_should_stop ()) { +while (1 ) { ret =__iscsi_target_login_thread (np);/* * We break and exit here unless another sock_accept() call
Greg Kroah-Hartman
maintainerPATCH 5/66 Input: synaptics - fix resolution for manually provided min/max
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit d49cb7aeebb974713f9f7ab2991352d3050b095b upstream.
commit 421e08c41fda fixed the reported min/max for the X and Y axis, but unfortunately, it broke the resolution of those same axis.
On the t540p, the resolution is the same regarding X and Y. It is not a problem for xf86-input-synaptics because this driver is only interested in the ratio between X and Y.
Unfortunately, xf86-input-cmt uses directly the resolution, and having a null resolution leads to some divide by 0 errors, which are translated by -infinity in the resulting coordinates.
--- drivers/input/mouse/synaptics.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/input/mouse/synaptics.c +10 -9
@@ -347,15 +347,6 @@ static int synaptics_resolution(struct punsigned char resp[3 ];int i; -for (i =0 ; min_max_pnpid_table[i].pnp_ids; i++) -if (matches_pnp_id (psmouse, min_max_pnpid_table[i].pnp_ids)) { - priv->x_min = min_max_pnpid_table[i].x_min; - priv->x_max = min_max_pnpid_table[i].x_max; - priv->y_min = min_max_pnpid_table[i].y_min; - priv->y_max = min_max_pnpid_table[i].y_max; -return 0 ; - } -if (SYN_ID_MAJOR (priv->identity) <4 )return 0 ;
@@ -366,6 +357,16 @@ static int synaptics_resolution(struct p } } +for (i =0 ; min_max_pnpid_table[i].pnp_ids; i++) { +if (matches_pnp_id (psmouse, min_max_pnpid_table[i].pnp_ids)) { + priv->x_min = min_max_pnpid_table[i].x_min; + priv->x_max = min_max_pnpid_table[i].x_max; + priv->y_min = min_max_pnpid_table[i].y_min; + priv->y_max = min_max_pnpid_table[i].y_max; +return 0 ; + } + } +if (SYN_EXT_CAP_REQUESTS (priv->capabilities) >=5 &&SYN_CAP_MAX_DIMENSIONS (priv->ext_cap_0c)) {if (synaptics_send_cmd (psmouse,SYN_QUE_EXT_MAX_COORDS , resp)) {
Greg Kroah-Hartman
maintainerPATCH 6/66 Input: elantech - deal with clickpads reporting right button events
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit cd9e83e2754465856097f31c7ab933ce74c473f8 upstream.
At least the Dell Vostro 5470 elantech *clickpad* reports right button clicks when clicked in the right bottom area:
https://bugzilla.redhat.com/show_bug.cgi?id=1103528
This is different from how (elantech) clickpads normally operate, normally no matter where the user clicks on the pad the pad always reports a left button event, since there is only 1 hardware button beneath the path.
It looks like Dell has put 2 buttons under the pad, one under each bottom corner, causing this.
Since this however still clearly is a real clickpad hardware-wise, we still want to report it as such to userspace, so that things like finger movement in the bottom area can be properly ignored as it should be on clickpads.
So deal with this weirdness by simply mapping a right click to a left click on elantech clickpads. As an added advantage this is something which we can simply do on all elantech clickpads, so no need to add special quirks for this weird model.
--- drivers/input/mouse/elantech.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/input/mouse/elantech.c +18 -4
@@ -473,8 +473,15 @@ static void elantech_report_absolute_v3(input_report_key (dev,BTN_TOOL_FINGER , fingers ==1 );input_report_key (dev,BTN_TOOL_DOUBLETAP , fingers ==2 );input_report_key (dev,BTN_TOOL_TRIPLETAP , fingers ==3 ); -input_report_key (dev,BTN_LEFT , packet[0 ] &0x01 ); -input_report_key (dev,BTN_RIGHT , packet[0 ] &0x02 ); + +/* For clickpads map both buttons to BTN_LEFT */ +if (etd->fw_version &0x001000 ) { +input_report_key (dev,BTN_LEFT , packet[0 ] &0x03 ); + }else { +input_report_key (dev,BTN_LEFT , packet[0 ] &0x01 ); +input_report_key (dev,BTN_RIGHT , packet[0 ] &0x02 ); + } +input_report_abs (dev,ABS_PRESSURE , pres);input_report_abs (dev,ABS_TOOL_WIDTH , width);
@@ -484,10 +491,17 @@ static void elantech_report_absolute_v3(static void elantech_input_sync_v4 (struct psmouse *psmouse) {struct input_dev *dev = psmouse->dev; +struct elantech_data *etd = psmouse->private;unsigned char *packet = psmouse->packet; -input_report_key (dev,BTN_LEFT , packet[0 ] &0x01 ); -input_report_key (dev,BTN_RIGHT , packet[0 ] &0x02 ); +/* For clickpads map both buttons to BTN_LEFT */ +if (etd->fw_version &0x001000 ) { +input_report_key (dev,BTN_LEFT , packet[0 ] &0x03 ); + }else { +input_report_key (dev,BTN_LEFT , packet[0 ] &0x01 ); +input_report_key (dev,BTN_RIGHT , packet[0 ] &0x02 ); + } +input_mt_report_pointer_emulation (dev, true);input_sync (dev); }
Greg Kroah-Hartman
maintainerPATCH 7/66 Input: elantech - dont set bit 1 of reg_10 when the no_hw_res quirk is set
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit fb4f8f568a9def02240ef9bf7aabd246dc63a081 upstream.
The touchpad on the GIGABYTE U2442 not only stops communicating when we try to set bit 3 (enable real hardware resolution) of reg_10, but on some BIOS versions also when we set bit 1 (enable two finger mode auto correct).
I've asked the original reporter of:
https://bugzilla.kernel.org/show_bug.cgi?id=61151
To check that not setting bit 1 does not lead to any adverse effects on his model / BIOS revision, and it does not, so this commit fixes the touchpad not working on these versions by simply never setting bit 1 for laptop models with the no_hw_res quirk.
--- drivers/input/mouse/elantech.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/input/mouse/elantech.c +3 -2
@@ -849,7 +849,7 @@ static int elantech_set_absolute_mode(stif (etd->set_hw_resolution) etd->reg_10 =0x0b ;else - etd->reg_10 =0x03 ; + etd->reg_10 =0x01 ;if (elantech_write_reg (psmouse,0x10 , etd->reg_10)) rc =-1 ;
@@ -1350,7 +1350,8 @@ static int elantech_reconnect(struct psm }/* -* Some hw_version 3 models go into error state when we try to set bit 3 of r10 +* Some hw_version 3 models go into error state when we try to set +* bit 3 and/or bit 1 of r10. */ static const struct dmi_system_id no_hw_res_dmi_table[] = { #if defined(CONFIG_DMI) && defined(CONFIG_X86)
Greg Kroah-Hartman
maintainerPATCH 8/66 PCI: Add new ID for Intel GPU "spurious interrupt" quirk
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Jarosch <[email protected]>
commit 7c82126a94e69bbbac586f0249e7ef11e681246c upstream.
After a CPU upgrade while keeping the same mainboard, we faced "spurious interrupt" problems again.
It turned out that the new CPU also featured a new GPU with a different PCI ID.
Add this PCI ID to the quirk table. Probably all other Intel GPU PCI IDs are affected, too, but I don't want to add them without a test system.
See f67fd55fa96f ("PCI: Add quirk for still enabled interrupts on Intel Sandy Bridge GPUs") for some history.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -2954,6 +2954,7 @@ static void disable_igfx_irq(struct pci_ }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0102 , disable_igfx_irq);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x010a , disable_igfx_irq); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0152 , disable_igfx_irq);/* * PCI devices which are on Intel chips can skip the 10ms delay
Greg Kroah-Hartman
maintainerPATCH 9/66 PCI: Fix incorrect vgaarb conditional in WARN_ON()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 67ebd8140dc8923c65451fa0f6a8eee003c4dcd3 upstream.
3448a19da479 "vgaarb: use bridges to control VGA routing where possible" added the "flags & PCI_VGA_STATE_CHANGE_DECODES" condition to an existing WARN_ON(), but used bitwise AND (&) instead of logical AND (&&), so the condition is never true. Replace with logical AND.
Found by Coverity (CID 142811).
--- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
@@ -4126,7 +4126,7 @@ int pci_set_vga_state(struct pci_dev *deu16 cmd;int rc; -WARN_ON ((flags &PCI_VGA_STATE_CHANGE_DECODES ) & (command_bits & ~(PCI_COMMAND_IO |PCI_COMMAND_MEMORY ))); +WARN_ON ((flags &PCI_VGA_STATE_CHANGE_DECODES ) && (command_bits & ~(PCI_COMMAND_IO |PCI_COMMAND_MEMORY )));/* ARCH specific VGA enables */ rc =pci_set_vga_state_arch (dev, decode, command_bits, flags);
Greg Kroah-Hartman
maintainerPATCH 10/66 mtip32xx: Fix ERO and NoSnoop values in PCIe upstream on AMD systems
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asai Thambi S P <[email protected]>
commit d1e714db8129a1d3670e449b87719c78e2c76f9f upstream.
A hardware quirk in P320h/P420m interfere with PCIe transactions on some AMD chipsets, making P320h/P420m unusable. This workaround is to disable ERO and NoSnoop bits in the parent and root complex for normal functioning of these devices
NOTE: This workaround is specific to AMD chipset with a PCIe upstream device with device id 0x5aXX
--- drivers/block/mtip32xx/mtip32xx.c | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
drivers/block/mtip32xx/mtip32xx.c +53 -0
@@ -4479,6 +4479,57 @@ static DEFINE_HANDLER(5); static DEFINE_HANDLER(6); static DEFINE_HANDLER(7); +static void mtip_disable_link_opts (struct driver_data *dd,struct pci_dev *pdev) +{ +int pos; +unsigned short pcie_dev_ctrl; + + pos =pci_find_capability (pdev,PCI_CAP_ID_EXP ); +if (pos) { +pci_read_config_word (pdev, + pos +PCI_EXP_DEVCTL , + &pcie_dev_ctrl); +if (pcie_dev_ctrl & (1 <<11 ) || + pcie_dev_ctrl & (1 <<4 )) { +dev_info (&dd->pdev->dev, +"Disabling ERO/No-Snoop on bridge device %04x:%04x\n" , + pdev->vendor, pdev->device); + pcie_dev_ctrl &= ~(PCI_EXP_DEVCTL_NOSNOOP_EN | +PCI_EXP_DEVCTL_RELAX_EN ); +pci_write_config_word (pdev, + pos +PCI_EXP_DEVCTL , + pcie_dev_ctrl); + } + } +} + +static void mtip_fix_ero_nosnoop (struct driver_data *dd,struct pci_dev *pdev) +{ +/* +* This workaround is specific to AMD/ATI chipset with a PCI upstream +* device with device id 0x5aXX +*/ +if (pdev->bus && pdev->bus->self) { +if (pdev->bus->self->vendor ==PCI_VENDOR_ID_ATI && + ((pdev->bus->self->device &0xff00 ) ==0x5a00 )) { +mtip_disable_link_opts (dd, pdev->bus->self); + }else { +/* Check further up the topology */ +struct pci_dev *parent_dev = pdev->bus->self; +if (parent_dev->bus && + parent_dev->bus->parent && + parent_dev->bus->parent->self && + parent_dev->bus->parent->self->vendor == +PCI_VENDOR_ID_ATI && + (parent_dev->bus->parent->self->device & +0xff00 ) ==0x5a00 ) { +mtip_disable_link_opts (dd, + parent_dev->bus->parent->self); + } + } + } +} +/* * Called for each supported PCI device detected. *
@@ -4630,6 +4681,8 @@ static int mtip_pci_probe(struct pci_dev goto msi_initialize_err; } +mtip_fix_ero_nosnoop (dd, pdev); +/* Initialize the block layer. */ rv =mtip_block_initialize (dd);if (rv <0 ) {
Greg Kroah-Hartman
maintainerPATCH 11/66 mtip32xx: Increase timeout for STANDBY IMMEDIATE command
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asai Thambi S P <[email protected]>
commit 670a641420a3d9586eebe7429dfeec4e7ed447aa upstream.
Increased timeout for STANDBY IMMEDIATE command to 2 minutes.
--- drivers/block/mtip32xx/mtip32xx.c | 66 ++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 31 deletions(-)
drivers/block/mtip32xx/mtip32xx.c +35 -31
@@ -1529,6 +1529,37 @@ static inline void ata_swap_string(u16 *be16_to_cpus (&buf[i]); } +static void mtip_set_timeout (struct driver_data *dd, +struct host_to_dev_fis *fis, +unsigned int *timeout,u8 erasemode) +{ +switch (fis->command) { +case ATA_CMD_DOWNLOAD_MICRO : + *timeout =120000 ;/* 2 minutes */ +break ; +case ATA_CMD_SEC_ERASE_UNIT : +case 0xFC : +if (erasemode) + *timeout = ((*(dd->port->identify +90 ) *2 ) *60000 ); +else + *timeout = ((*(dd->port->identify +89 ) *2 ) *60000 ); +break ; +case ATA_CMD_STANDBYNOW1 : + *timeout =120000 ;/* 2 minutes */ +break ; +case 0xF7 : +case 0xFA : + *timeout =60000 ;/* 60 seconds */ +break ; +case ATA_CMD_SMART : + *timeout =15000 ;/* 15 seconds */ +break ; +default : + *timeout =MTIP_IOCTL_COMMAND_TIMEOUT_MS ; +break ; + } +} +/* * Request the device identity information. *
@@ -1644,6 +1675,7 @@ static int mtip_standby_immediate(structint rv;struct host_to_dev_fis fis;unsigned long start; +unsigned int timeout;/* Build the FIS. */ memset (&fis,0 ,sizeof (struct host_to_dev_fis ));
@@ -1651,6 +1683,8 @@ static int mtip_standby_immediate(struct fis.opts =1 <<7 ; fis.command =ATA_CMD_STANDBYNOW1 ; +mtip_set_timeout (port->dd, &fis, &timeout,0 ); + start = jiffies; rv = mtip_exec_internal_command(port, &fis,
@@ -1659,7 +1693,7 @@ static int mtip_standby_immediate(struct0 ,0 ,GFP_ATOMIC , - 15000); + timeout);dbg_printk (MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n" ,jiffies_to_msecs (jiffies - start));if (rv)
@@ -2202,36 +2236,6 @@ static unsigned int implicit_sector(unsi }return rv; } -static void mtip_set_timeout (struct driver_data *dd, -struct host_to_dev_fis *fis, -unsigned int *timeout,u8 erasemode) -{ -switch (fis->command) { -case ATA_CMD_DOWNLOAD_MICRO : - *timeout =120000 ;/* 2 minutes */ -break ; -case ATA_CMD_SEC_ERASE_UNIT : -case 0xFC : -if (erasemode) - *timeout = ((*(dd->port->identify +90 ) *2 ) *60000 ); -else - *timeout = ((*(dd->port->identify +89 ) *2 ) *60000 ); -break ; -case ATA_CMD_STANDBYNOW1 : - *timeout =120000 ;/* 2 minutes */ -break ; -case 0xF7 : -case 0xFA : - *timeout =60000 ;/* 60 seconds */ -break ; -case ATA_CMD_SMART : - *timeout =15000 ;/* 15 seconds */ -break ; -default : - *timeout =MTIP_IOCTL_COMMAND_TIMEOUT_MS ; -break ; - } -}/* * Executes a taskfile
Greg Kroah-Hartman
maintainerPATCH 12/66 mtip32xx: Remove dfs_parent after pci unregister
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asai Thambi S P <[email protected]>
commit af5ded8ccf21627f9614afc03b356712666ed225 upstream.
In module exit, dfs_parent and it's subtree were removed before unregistering with pci. When debugfs entry for each device is attempted to remove in pci_remove() context, they don't exist, as dfs_parent and its children were already ripped apart.
Modified to first unregister with pci and then remove dfs_parent.
--- drivers/block/mtip32xx/mtip32xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/mtip32xx/mtip32xx.c +2 -2
@@ -4992,13 +4992,13 @@ static int __init mtip_init(void)*/ static void __exit mtip_exit(void) { -debugfs_remove_recursive (dfs_parent); -/* Release the allocated major block device number. */ unregister_blkdev (mtip_major,MTIP_DRV_NAME );/* Unregister the PCI driver. */ pci_unregister_driver (&mtip_pci_driver); + +debugfs_remove_recursive (dfs_parent); }MODULE_AUTHOR ("Micron Technology, Inc" );
Greg Kroah-Hartman
maintainerPATCH 13/66 recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Smith <[email protected]>
commit 91ad11d7cc6f4472ebf177a6252fbf0fd100d798 upstream.
On MIPS calls to _mcount in modules generate 2 instructions to load the _mcount address (and therefore 2 relocations). The mcount_loc table should only reference the first of these, so the second is filtered out by checking the relocation offset and ignoring ones that immediately follow the previous one seen.
However if a module has an _mcount call at offset 0, the second relocation would not be filtered out due to old_r_offset == 0 being taken to mean that the current relocation is the first one seen, and both would end up in the mcount_loc table.
This results in ftrace_make_nop() patching both (adjacent) instructions to branches over the _mcount call sequence like so:
0xffffffffc08a8000: 04 00 00 10 b 0xffffffffc08a8014 0xffffffffc08a8004: 04 00 00 10 b 0xffffffffc08a8018 0xffffffffc08a8008: 2d 08 e0 03 move at,ra
...
The second branch is in the delay slot of the first, which is defined to be unpredictable - on the platform on which this bug was encountered, it triggers a reserved instruction exception.
Fix by initializing old_r_offset to ~0 and using that instead of 0 to determine whether the current relocation is the first seen.
Patchwork: https://patchwork.linux-mips.org/patch/7098/
--- scripts/recordmcount.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/recordmcount.h +2 -2
@@ -163,11 +163,11 @@ static int mcount_adjust = 0;static int MIPS_is_fake_mcount (Elf_Rel const *rp) { -static Elf_Addr old_r_offset; +static Elf_Addr old_r_offset = ~(Elf_Addr )0 ;Elf_Addr current_r_offset =_w (rp->r_offset);int is_fake; - is_fake = old_r_offset && + is_fake = (old_r_offset != ~(Elf_Addr )0 ) && (current_r_offset - old_r_offset ==MIPS_FAKEMCOUNT_OFFSET ); old_r_offset = current_r_offset;
Greg Kroah-Hartman
maintainerPATCH 14/66 Revert "MIPS: Save/restore MSA context around signals"
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Burton <[email protected]>
commit 16f77de82f2d2f628306dab9bc4799df0d28a199 upstream.
This reverts commit eec43a224cf1 "MIPS: Save/restore MSA context around signals" and the MSA parts of ca750649e08c "MIPS: kernel: signal:
Prevent save/restore FPU context in user memory" (the restore path of which appears incorrect anyway...).
The reverted patch took care not to break compatibility with userland users of struct sigcontext, but inadvertantly changed the offset of the uc_sigmask field of struct ucontext. Thus Linux v3.15 breaks the userland ABI. The MSA context will need to be saved via some other opt-in mechanism, but for now revert the change to reduce the fallout.
This will have minimal impact upon use of MSA since the only supported CPU which includes it (the P5600) is 32-bit and therefore requires that the experimental CONFIG_MIPS_O32_FP64_SUPPORT Kconfig option be selected before the kernel will set FR=1 for a task, a requirement for MSA use. Thus the users of MSA are limited to known small groups of people & this patch won't be breaking any previously working MSA-using userland outside of experimental settings.
[[email protected]: Fixed rejects.]
Patchwork: https://patchwork.linux-mips.org/patch/7107/
--- arch/mips/include/asm/sigcontext.h | 2 arch/mips/include/uapi/asm/sigcontext.h | 8 - arch/mips/kernel/asm-offsets.c | 3 arch/mips/kernel/r4k_fpu.S | 213 -------------------------------- arch/mips/kernel/signal.c | 79 +---------- arch/mips/kernel/signal32.c | 74 +---------- 6 files changed, 16 insertions(+), 363 deletions(-)
arch/mips/include/asm/sigcontext.h +0 -2
@@ -32,8 +32,6 @@ struct sigcontext32 {__u32 sc_lo2;__u32 sc_hi3;__u32 sc_lo3; -__u64 sc_msaregs[32 ];/* Most significant 64 bits */ -__u32 sc_msa_csr; };#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */ #endif /* _ASM_SIGCONTEXT_H */
arch/mips/include/uapi/asm/sigcontext.h +0 -8
@@ -12,10 +12,6 @@#include <linux/types.h> #include <asm/sgidefs.h> -/* Bits which may be set in sc_used_math */ -#define USEDMATH_FP (1 << 0) -#define USEDMATH_MSA (1 << 1) -#if _MIPS_SIM == _MIPS_SIM_ABI32/*
@@ -41,8 +37,6 @@ struct sigcontext {unsigned long sc_lo2;unsigned long sc_hi3; unsigned long sc_lo3; -unsigned long long sc_msaregs[32 ];/* Most significant 64 bits */ - unsigned long sc_msa_csr; };#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
@@ -76,8 +70,6 @@ struct sigcontext {__u32 sc_used_math;__u32 sc_dsp;__u32 sc_reserved; -__u64 sc_msaregs[32 ]; -__u32 sc_msa_csr; };
arch/mips/kernel/asm-offsets.c +0 -3
@@ -295,7 +295,6 @@ void output_sc_defines(void)OFFSET (SC_LO2 , sigcontext, sc_lo2);OFFSET (SC_HI3 , sigcontext, sc_hi3);OFFSET (SC_LO3 , sigcontext, sc_lo3); -OFFSET (SC_MSAREGS , sigcontext, sc_msaregs); BLANK(); }#endif
@@ -310,7 +309,6 @@ void output_sc_defines(void)OFFSET (SC_MDLO , sigcontext, sc_mdlo);OFFSET (SC_PC , sigcontext, sc_pc);OFFSET (SC_FPC_CSR , sigcontext, sc_fpc_csr); -OFFSET (SC_MSAREGS , sigcontext, sc_msaregs); BLANK(); }#endif
@@ -322,7 +320,6 @@ void output_sc32_defines(void)OFFSET (SC32_FPREGS , sigcontext32, sc_fpregs);OFFSET (SC32_FPC_CSR , sigcontext32, sc_fpc_csr);OFFSET (SC32_FPC_EIR , sigcontext32, sc_fpc_eir); -OFFSET (SC32_MSAREGS , sigcontext32, sc_msaregs); BLANK(); }#endif
arch/mips/kernel/r4k_fpu.S +0 -213
225 lines not on this page · raw message
arch/mips/kernel/signal.c +8 -71
172 lines not on this page · raw message
arch/mips/kernel/signal32.c +8 -66
150 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 15/66 MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremapd region
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
commit ab6c15bc6620ebe220970cc040b29bcb2757f373 upstream.
Previously, the lower limit for the MIPS SC initialization loop was set incorrectly allowing one extra loop leading to writes beyond the MSC ioremap'd space. More precisely, the value of the 'imp' in the last loop increased beyond the msc_irqmap_t boundaries and as a result of which, the 'n' variable was loaded with an incorrect value. This value was used later on to calculate the offset in the MSC01_IC_SUP which led to random crashes like the following one:
CPU 0 Unable to handle kernel paging request at virtual address e75c0200, epc == 8058dba4, ra == 8058db90
[...]
Call Trace: [<8058dba4>] init_msc_irqs+0x104/0x154 [<8058b5bc>] arch_init_irq+0xd8/0x154 [<805897b0>] start_kernel+0x220/0x36c Kernel panic - not syncing: Attempted to kill the idle task!
This patch fixes the problem
Patchwork: https://patchwork.linux-mips.org/patch/7118/
--- arch/mips/kernel/irq-msc01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/irq-msc01.c +1 -1
@@ -131,7 +131,7 @@ void __init init_msc_irqs(unsigned long board_bind_eic_interrupt = &msc_bind_eic_interrupt; -for (; nirq >=0 ; nirq--, imp++) { +for (; nirq >0 ; nirq--, imp++) {int n = imp->im_irq;switch (imp->im_type) {
Greg Kroah-Hartman
maintainerPATCH 16/66 hpsa: add new Smart Array PCI IDs (May 2014)
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Handzik <[email protected]>
commit 3b7a45e5ba85dc79c7714edd9eee9aaed730cd6b upstream.
--- drivers/scsi/hpsa.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/scsi/hpsa.c +12 -0
@@ -115,9 +115,15 @@ static const struct pci_device_id hpsa_p {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C3}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C4}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C5}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C6}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C7}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C8}, {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C9}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CA}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CB}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CC}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CD}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CE}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0076}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0087}, {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x007D},
@@ -165,9 +171,15 @@ static struct board_type products[] = { {0x21C3103C, "Smart Array", &SA5_access}, {0x21C4103C, "Smart Array", &SA5_access}, {0x21C5103C, "Smart Array", &SA5_access}, + {0x21C6103C, "Smart Array", &SA5_access}, {0x21C7103C, "Smart Array", &SA5_access}, {0x21C8103C, "Smart Array", &SA5_access}, {0x21C9103C, "Smart Array", &SA5_access}, + {0x21CA103C, "Smart Array", &SA5_access}, + {0x21CB103C, "Smart Array", &SA5_access}, + {0x21CC103C, "Smart Array", &SA5_access}, + {0x21CD103C, "Smart Array", &SA5_access}, + {0x21CE103C, "Smart Array", &SA5_access}, {0x00761590, "HP Storage P1224 Array Controller", &SA5_access}, {0x00871590, "HP Storage P1224e Array Controller", &SA5_access}, {0x007D1590, "HP Storage P1228 Array Controller", &SA5_access},
Greg Kroah-Hartman
maintainerPATCH 17/66 UBIFS: fix an mmap and fsync race condition
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: hujianyang <[email protected]>
commit 691a7c6f28ac90cccd0dbcf81348ea90b211bdd0 upstream.
There is a race condition in UBIFS:
Thread A (mmap) Thread B (fsync)
->__do_fault ->write_cache_pages
-> ubifs_vm_page_mkwrite
-> budget_space
-> lock_page
-> release/convert_page_budget
-> SetPagePrivate
-> TestSetPageDirty
-> unlock_page
-> lock_page
-> TestClearPageDirty
-> ubifs_writepage
-> do_writepage
-> release_budget
-> ClearPagePrivate
-> unlock_page
-> !(ret & VM_FAULT_LOCKED)
-> lock_page
-> set_page_dirty
-> ubifs_set_page_dirty
-> TestSetPageDirty (set page dirty without budgeting) -> unlock_page
This leads to situation where we have a diry page but no budget allocated for this page, so further write-back may fail with -ENOSPC.
In this fix we return from page_mkwrite without performing unlock_page. We return VM_FAULT_LOCKED instead. After doing this, the race above will not happen.
--- fs/ubifs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ubifs/file.c +1 -2
@@ -1525,8 +1525,7 @@ static int ubifs_vm_page_mkwrite(struct }wait_for_stable_page (page); -unlock_page (page); -return 0 ; +return VM_FAULT_LOCKED ; out_unlock:unlock_page (page);
Greg Kroah-Hartman
maintainerPATCH 18/66 UBIFS: Remove incorrect assertion in shrink_tnc()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: hujianyang <[email protected]>
commit 72abc8f4b4e8574318189886de627a2bfe6cd0da upstream.
I hit the same assert failed as Dolev Raviv reported in Kernel v3.10 shows like this:
[ 9641.164028] UBIFS assert failed in shrink_tnc at 131 (pid 13297) [ 9641.234078] CPU: 1 PID: 13297 Comm: mmap.test Tainted: G O 3.10.40 #1 [ 9641.234116] [<c0011a6c>] (unwind_backtrace+0x0/0x12c) from [<c000d0b0>] (show_stack+0x20/0x24) [ 9641.234137] [<c000d0b0>] (show_stack+0x20/0x24) from [<c0311134>] (dump_stack+0x20/0x28) [ 9641.234188] [<c0311134>] (dump_stack+0x20/0x28) from [<bf22425c>] (shrink_tnc_trees+0x25c/0x350 [ubifs]) [ 9641.234265] [<bf22425c>] (shrink_tnc_trees+0x25c/0x350 [ubifs]) from [<bf2245ac>] (ubifs_shrinker+0x25c/0x310 [ubifs]) [ 9641.234307] [<bf2245ac>] (ubifs_shrinker+0x25c/0x310 [ubifs]) from [<c00cdad8>] (shrink_slab+0x1d4/0x2f8) [ 9641.234327] [<c00cdad8>] (shrink_slab+0x1d4/0x2f8) from [<c00d03d0>] (do_try_to_free_pages+0x300/0x544) [ 9641.234344] [<c00d03d0>] (do_try_to_free_pages+0x300/0x544) from [<c00d0a44>] (try_to_free_pages+0x2d0/0x398) [ 9641.234363] [<c00d0a44>] (try_to_free_pages+0x2d0/0x398) from [<c00c6a60>] (__alloc_pages_nodemask+0x494/0x7e8) [ 9641.234382] [<c00c6a60>] (__alloc_pages_nodemask+0x494/0x7e8) from [<c00f62d8>] (new_slab+0x78/0x238) [ 9641.234400] [<c00f62d8>] (new_slab+0x78/0x238) from [<c031081c>] (__slab_alloc.constprop.42+0x1a4/0x50c) [ 9641.234419] [<c031081c>] (__slab_alloc.constprop.42+0x1a4/0x50c) from [<c00f80e8>] (kmem_cache_alloc_trace+0x54/0x188) [ 9641.234459] [<c00f80e8>] (kmem_cache_alloc_trace+0x54/0x188) from [<bf227908>] (do_readpage+0x168/0x468 [ubifs]) [ 9641.234553] [<bf227908>] (do_readpage+0x168/0x468 [ubifs]) from [<bf2296a0>] (ubifs_readpage+0x424/0x464 [ubifs]) [ 9641.234606] [<bf2296a0>] (ubifs_readpage+0x424/0x464 [ubifs]) from [<c00c17c0>] (filemap_fault+0x304/0x418) [ 9641.234638] [<c00c17c0>] (filemap_fault+0x304/0x418) from [<c00de694>] (__do_fault+0xd4/0x530) [ 9641.234665] [<c00de694>] (__do_fault+0xd4/0x530) from [<c00e10c0>] (handle_pte_fault+0x480/0xf54) [ 9641.234690] [<c00e10c0>] (handle_pte_fault+0x480/0xf54) from [<c00e2bf8>] (handle_mm_fault+0x140/0x184) [ 9641.234716] [<c00e2bf8>] (handle_mm_fault+0x140/0x184) from [<c0316688>] (do_page_fault+0x150/0x3ac) [ 9641.234737] [<c0316688>] (do_page_fault+0x150/0x3ac) from [<c000842c>] (do_DataAbort+0x3c/0xa0) [ 9641.234759] [<c000842c>] (do_DataAbort+0x3c/0xa0) from [<c0314e38>] (__dabt_usr+0x38/0x40)
After analyzing the code, I found a condition that may cause this failed in correct operations. Thus, I think this assertion is wrong and should be removed.
Suppose there are two clean znodes and one dirty znode in TNC. So the per-filesystem atomic_t @clean_zn_cnt is (2). If commit start, dirty_znode is set to COW_ZNODE in get_znodes_to_commit() in case of potentially ops on this znode. We clear COW bit and DIRTY bit in write_index() without @tnc_mutex locked. We don't increase @clean_zn_cnt in this place. As the comments in write_index() shows, if another process hold @tnc_mutex and dirty this znode after we clean it, @clean_zn_cnt would be decreased to (1). We will increase @clean_zn_cnt to (2) with @tnc_mutex locked in free_obsolete_znodes() to keep it right.
If shrink_tnc() performs between decrease and increase, it will release other 2 clean znodes it holds and found @clean_zn_cnt is less than zero (1 - 2 = -1), then hit the assertion. Because free_obsolete_znodes() will soon correct @clean_zn_cnt and no harm to fs in this case, I think this assertion could be removed.
2 clean zondes and 1 dirty znode, @clean_zn_cnt == 2
Thread A (commit) Thread B (write or others) Thread C (shrinker)
->write_index
->clear_bit(DIRTY_NODE)
->clear_bit(COW_ZNODE)
@clean_zn_cnt == 2
->mutex_locked(&tnc_mutex)
->dirty_cow_znode
->!ubifs_zn_cow(znode)
->!test_and_set_bit(DIRTY_NODE)
->atomic_dec(&clean_zn_cnt)
->mutex_unlocked(&tnc_mutex)
@clean_zn_cnt == 1
->mutex_locked(&tnc_mutex)
->shrink_tnc
->destroy_tnc_subtree
->atomic_sub(&clean_zn_cnt, 2)
->ubifs_assert <- hit
->mutex_unlocked(&tnc_mutex)
@clean_zn_cnt == -1->mutex_lock(&tnc_mutex)
->free_obsolete_znodes
->atomic_inc(&clean_zn_cnt)
->mutux_unlock(&tnc_mutex)
@clean_zn_cnt == 0 (correct after shrink)
--- fs/ubifs/shrinker.c | 1 - 1 file changed, 1 deletion(-)
fs/ubifs/shrinker.c +0 -1
@@ -128,7 +128,6 @@ static int shrink_tnc(struct ubifs_info freed =ubifs_destroy_tnc_subtree (znode);atomic_long_sub (freed, &ubifs_clean_zn_cnt);atomic_long_sub (freed, &c->clean_zn_cnt); -ubifs_assert (atomic_long_read (&c->clean_zn_cnt) >=0 ); total_freed += freed; znode = zprev; }
Greg Kroah-Hartman
maintainerPATCH 19/66 RDMA/cxgb4: Fix memory leaks in c4iw_alloc() error paths
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Jaeger <[email protected]>
commit 65b302ad31b02b0790417f4e65833af494cb35ce upstream.
c4iw_alloc() bails out without freeing the storage that 'devp' points to.
Picked up by Coverity - CID 1204241.
--- drivers/infiniband/hw/cxgb4/device.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/cxgb4/device.c +2 -0
@@ -736,6 +736,7 @@ static struct c4iw_dev *c4iw_alloc(const pci_resource_len(devp->rdev.lldi.pdev, 2));if (!devp->rdev.bar2_kva) {pr_err (MOD "Unable to ioremap BAR2\n" ); +ib_dealloc_device (&devp->ibdev);return ERR_PTR (-EINVAL ); } }else if (ocqp_supported (infop)) {
@@ -747,6 +748,7 @@ static struct c4iw_dev *c4iw_alloc(const devp->rdev.lldi.vr->ocq.size);if (!devp->rdev.oc_mw_kva) {pr_err (MOD "Unable to ioremap onchip mem\n" ); +ib_dealloc_device (&devp->ibdev);return ERR_PTR (-EINVAL ); } }
Greg Kroah-Hartman
maintainerPATCH 20/66 RDMA/cxgb4: Add missing padding at end of struct c4iw_create_cq_resp
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit b6f04d3d21458818073a2f5af5339f958864bf71 upstream.
The i386 ABI disagrees with most other ABIs regarding alignment of data types larger than 4 bytes: on most ABIs a padding must be added at end of the structures, while it is not required on i386.
So for most ABI struct c4iw_create_cq_resp gets implicitly padded to be aligned on a 8 bytes multiple, while for i386, such padding is not added.
The tool pahole can be used to find such implicit padding:
$ pahole --anon_include \
--nested_anon_include \
--recursive \
--class_name c4iw_create_cq_resp \
drivers/infiniband/hw/cxgb4/iw_cxgb4.oThen, structure layout can be compared between i386 and x86_64:
# +++ obj-i386/drivers/infiniband/hw/cxgb4/iw_cxgb4.o.pahole.txt 2014-03-28 11:43:05.547432195 +0100
# --- obj-x86_64/drivers/infiniband/hw/cxgb4/iw_cxgb4.o.pahole.txt 2014-03-28 10:55:10.990133017 +0100
# @@ -14,9 +13,8 @@ struct c4iw_create_cq_resp {
# __u32 size; /* 28 4 */
# __u32 qid_mask; /* 32 4 */
#
# - /* size: 36, cachelines: 1, members: 6 */
# - /* last cacheline: 36 bytes */
# + /* size: 40, cachelines: 1, members: 6 */
# + /* padding: 4 */
# + /* last cacheline: 40 bytes */# };
This ABI disagreement will make an x86_64 kernel try to write past the buffer provided by an i386 binary.
When boundary check will be implemented, the x86_64 kernel will refuse to write past the i386 userspace provided buffer and the uverbs will fail.
If the structure is on a page boundary and the next page is not mapped, ib_copy_to_udata() will fail and the uverb will fail.
This patch adds an explicit padding at end of structure c4iw_create_cq_resp, and, like 92b0ca7cb149 ("IB/mlx5: Fix stack info leak in mlx5_ib_alloc_ucontext()"), makes function c4iw_create_cq() not writting this padding field to userspace. This way, x86_64 kernel will be able to write struct c4iw_create_cq_resp as expected by unpatched and patched i386 libcxgb4.
--- drivers/infiniband/hw/cxgb4/cq.c | 4 ++-- drivers/infiniband/hw/cxgb4/user.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/cxgb4/cq.c +2 -2
@@ -940,7 +940,6 @@ struct ib_cq *c4iw_create_cq(struct ib_dif (!mm2) goto err4; -memset (&uresp,0 ,sizeof (uresp)); uresp.qid_mask = rhp->rdev.cqmask; uresp.cqid = chp->cq.cqid; uresp.size = chp->cq.size;
@@ -951,7 +950,8 @@ struct ib_cq *c4iw_create_cq(struct ib_d uresp.gts_key = ucontext->key; ucontext->key +=PAGE_SIZE ;spin_unlock (&ucontext->mmap_lock); - ret =ib_copy_to_udata (udata, &uresp,sizeof uresp); + ret =ib_copy_to_udata (udata, &uresp, +sizeof (uresp) -sizeof (uresp.reserved));if (ret) goto err5;
drivers/infiniband/hw/cxgb4/user.h +1 -0
@@ -48,6 +48,7 @@ struct c4iw_create_cq_resp {__u32 cqid;__u32 size;__u32 qid_mask; +__u32 reserved;/* explicit padding (optional for i386) */ };
Greg Kroah-Hartman
maintainerPATCH 21/66 RDMA/cxgb4: add missing padding at end of struct c4iw_alloc_ucontext_resp
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit b7dfa8895f64ffa371d0ed09c1d1ba8c6e19b956 upstream.
The i386 ABI disagrees with most other ABIs regarding alignment of data types larger than 4 bytes: on most ABIs a padding must be added at end of the structures, while it is not required on i386.
So for most ABI struct c4iw_alloc_ucontext_resp gets implicitly padded to be aligned on a 8 bytes multiple, while for i386, such padding is not added.
The tool pahole can be used to find such implicit padding:
$ pahole --anon_include \
--nested_anon_include \
--recursive \
--class_name c4iw_alloc_ucontext_resp \
drivers/infiniband/hw/cxgb4/iw_cxgb4.oThen, structure layout can be compared between i386 and x86_64:
# +++ obj-i386/drivers/infiniband/hw/cxgb4/iw_cxgb4.o.pahole.txt 2014-03-28 11:43:05.547432195 +0100
# --- obj-x86_64/drivers/infiniband/hw/cxgb4/iw_cxgb4.o.pahole.txt 2014-03-28 10:55:10.990133017 +0100
# @@ -2,9 +2,8 @@ struct c4iw_alloc_ucontext_resp {
# __u64 status_page_key; /* 0 8 */
# __u32 status_page_size; /* 8 4 */
#
# - /* size: 12, cachelines: 1, members: 2 */
# - /* last cacheline: 12 bytes */
# + /* size: 16, cachelines: 1, members: 2 */
# + /* padding: 4 */
# + /* last cacheline: 16 bytes */# };
This ABI disagreement will make an x86_64 kernel try to write past the buffer provided by an i386 binary.
When boundary check will be implemented, the x86_64 kernel will refuse to write past the i386 userspace provided buffer and the uverbs will fail.
If the structure is on a page boundary and the next page is not mapped, ib_copy_to_udata() will fail and the uverb will fail.
Additionally, as reported by Dan Carpenter, without the implicit padding being properly cleared, an information leak would take place in most architectures.
This patch adds an explicit padding to struct c4iw_alloc_ucontext_resp, and, like 92b0ca7cb149 ("IB/mlx5: Fix stack info leak in mlx5_ib_alloc_ucontext()"), makes function c4iw_alloc_ucontext() not writting this padding field to userspace. This way, x86_64 kernel will be able to write struct c4iw_alloc_ucontext_resp as expected by unpatched and patched i386 libcxgb4.
--- drivers/infiniband/hw/cxgb4/provider.c | 5 +++-- drivers/infiniband/hw/cxgb4/user.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/cxgb4/provider.c +3 -2
@@ -122,7 +122,7 @@ static struct ib_ucontext *c4iw_alloc_ucINIT_LIST_HEAD (&context->mmaps);spin_lock_init (&context->mmap_lock); -if (udata->outlen <sizeof (uresp)) { +if (udata->outlen <sizeof (uresp) -sizeof (uresp.reserved)) {if (!warned++)pr_err (MOD "Warning - downlevel libcxgb4 (non-fatal), device status page disabled." ); rhp->rdev.flags |=T4_STATUS_PAGE_DISABLED ;
@@ -140,7 +140,8 @@ static struct ib_ucontext *c4iw_alloc_uc context->key +=PAGE_SIZE ;spin_unlock (&context->mmap_lock); - ret =ib_copy_to_udata (udata, &uresp,sizeof (uresp)); + ret =ib_copy_to_udata (udata, &uresp, +sizeof (uresp) -sizeof (uresp.reserved));if (ret) goto err_mm;
drivers/infiniband/hw/cxgb4/user.h +1 -0
@@ -75,5 +75,6 @@ struct c4iw_create_qp_resp {struct c4iw_alloc_ucontext_resp {__u64 status_page_key;__u32 status_page_size; +__u32 reserved;/* explicit padding (optional for i386) */ };#endif
Greg Kroah-Hartman
maintainerPATCH 22/66 watchdog: sp805: Set watchdog_device->timeout from ->set_timeout()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 938626d96a3ffb9eb54552bb0d3a4f2b30ffdeb0 upstream.
Implementation of ->set_timeout() is supposed to set 'timeout' field of 'struct watchdog_device' passed to it. sp805 was rather setting this in a local variable. Fix it.
--- drivers/watchdog/sp805_wdt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/watchdog/sp805_wdt.c +1 -3
@@ -59,7 +59,6 @@* @adev: amba device structure of wdt * @status: current status of wdt * @load_val: load value to be set for current timeout -* @timeout: current programmed timeout */ struct sp805_wdt {struct watchdog_device wdd;
@@ -68,7 +67,6 @@ struct sp805_wdt {struct clk *clk;struct amba_device *adev;unsigned int load_val; -unsigned int timeout; };static bool nowayout =WATCHDOG_NOWAYOUT ;
@@ -98,7 +96,7 @@ static int wdt_setload(struct watchdog_dspin_lock (&wdt->lock); wdt->load_val = load;/* roundup timeout to closest positive integer value */ - wdt->timeout =div_u64 ((load +1 ) *2 + (rate /2 ), rate); + wdd->timeout =div_u64 ((load +1 ) *2 + (rate /2 ), rate);spin_unlock (&wdt->lock);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 23/66 watchdog: ath79_wdt: avoid spurious restarts on AR934x
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
commit 23afeb613ec0e10aecfae7838a14d485db62ac52 upstream.
On some AR934x based systems, where the frequency of the AHB bus is relatively high, the built-in watchdog causes a spurious restart when it gets enabled.
The possible cause of these restarts is that the timeout value written into the TIMER register does not reaches the hardware in time.
Add an explicit delay into the ath79_wdt_enable function to avoid the spurious restarts.
--- drivers/watchdog/ath79_wdt.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/watchdog/ath79_wdt.c +10 -0
@@ -20,6 +20,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/bitops.h> +#include <linux/delay.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/io.h>
@@ -90,6 +91,15 @@ static inline void ath79_wdt_keepalive(vstatic inline void ath79_wdt_enable (void ) {ath79_wdt_keepalive (); + +/* +* Updating the TIMER register requires a few microseconds +* on the AR934x SoCs at least. Use a small delay to ensure +* that the TIMER register is updated within the hardware +* before enabling the watchdog. +*/ +udelay (2 ); +ath79_wdt_wr (WDOG_REG_CTRL ,WDOG_CTRL_ACTION_FCR );/* flush write */ ath79_wdt_rr (WDOG_REG_CTRL );
Greg Kroah-Hartman
maintainerPATCH 24/66 watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: gundberg <[email protected]>
commit a9e0436b303e94ba57d3bd4b1fcbeaa744b7ebeb upstream.
Use the prescaler index, rather than its value, to configure the watchdog. This will prevent a mismatch with the prescaler used to calculate the cycles.
--- drivers/watchdog/kempld_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/kempld_wdt.c +1 -1
@@ -162,7 +162,7 @@ static int kempld_wdt_set_stage_timeout(kempld_get_mutex (pld); stage_cfg =kempld_read8 (pld,KEMPLD_WDT_STAGE_CFG (stage->id)); stage_cfg &= ~STAGE_CFG_PRESCALER_MASK ; - stage_cfg |=STAGE_CFG_SET_PRESCALER (prescaler); + stage_cfg |=STAGE_CFG_SET_PRESCALER (PRESCALER_21 );kempld_write8 (pld,KEMPLD_WDT_STAGE_CFG (stage->id), stage_cfg);kempld_write32 (pld,KEMPLD_WDT_STAGE_TIMEOUT (stage->id), stage_timeout);
Greg Kroah-Hartman
maintainerPATCH 25/66 kernel/watchdog.c: remove preemption restrictions when restarting lockup detector
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Don Zickus <[email protected]>
commit bde92cf455a03a91badb7046855592d8c008e929 upstream.
Peter Wu noticed the following splat on his machine when updating /proc/sys/kernel/watchdog_thresh:
BUG: sleeping function called from invalid context at mm/slub.c:965
in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: init
3 locks held by init/1:
#0: (sb_writers#3){.+.+.+}, at: [<ffffffff8117b663>] vfs_write+0x143/0x180
#1: (watchdog_proc_mutex){+.+.+.}, at: [<ffffffff810e02d3>] proc_dowatchdog+0x33/0x110
#2: (cpu_hotplug.lock){.+.+.+}, at: [<ffffffff810589c2>] get_online_cpus+0x32/0x80
Preemption disabled at:[<ffffffff810e0384>] proc_dowatchdog+0xe4/0x110
CPU: 0 PID: 1 Comm: init Not tainted 3.16.0-rc1-testing #34
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
dump_stack+0x4e/0x7a
__might_sleep+0x11d/0x190
kmem_cache_alloc_trace+0x4e/0x1e0
perf_event_alloc+0x55/0x440
perf_event_create_kernel_counter+0x26/0xe0
watchdog_nmi_enable+0x75/0x140
update_timers_all_cpus+0x53/0xa0
proc_dowatchdog+0xe4/0x110
proc_sys_call_handler+0xb3/0xc0
proc_sys_write+0x14/0x20
vfs_write+0xad/0x180
SyS_write+0x49/0xb0
system_call_fastpath+0x16/0x1b
NMI watchdog: disabled (cpu0): hardware events not enabledWhat happened is after updating the watchdog_thresh, the lockup detector is restarted to utilize the new value. Part of this process involved disabling preemption. Once preemption was disabled, perf tried to allocate a new event (as part of the restart). This caused the above BUG_ON as you can't sleep with preemption disabled.
The preemption restriction seemed agressive as we are not doing anything on that particular cpu, but with all the online cpus (which are protected by the get_online_cpus lock). Remove the restriction and the BUG_ON goes away.
--- kernel/watchdog.c | 2 -- 1 file changed, 2 deletions(-)
kernel/watchdog.c +0 -2
@@ -527,10 +527,8 @@ static void update_timers_all_cpus(void)int cpu;get_online_cpus (); -preempt_disable ();for_each_online_cpu (cpu)update_timers (cpu); -preempt_enable ();put_online_cpus (); }
Greg Kroah-Hartman
maintainerPATCH 26/66 IB/mlx5: add missing padding at end of struct mlx5_ib_create_cq
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit a8237b32a3faab155a5dc8f886452147ce73da3e upstream.
The i386 ABI disagrees with most other ABIs regarding alignment of data type larger than 4 bytes: on most ABIs a padding must be added at end of the structures, while it is not required on i386.
So for most ABI struct mlx5_ib_create_cq get padded to be aligned on a 8 bytes multiple, while for i386, such padding is not added.
The tool pahole can be used to find such implicit padding:
$ pahole --anon_include \ --nested_anon_include \ --recursive \ --class_name mlx5_ib_create_cq \ drivers/infiniband/hw/mlx5/mlx5_ib.o
Then, structure layout can be compared between i386 and x86_64:
# +++ obj-i386/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-28 11:43:07.386413682 +0100
# --- obj-x86_64/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-27 13:06:17.788472721 +0100
# @@ -34,9 +34,8 @@ struct mlx5_ib_create_cq {
# __u64 db_addr; /* 8 8 */
# __u32 cqe_size; /* 16 4 */
#
# - /* size: 20, cachelines: 1, members: 3 */
# - /* last cacheline: 20 bytes */
# + /* size: 24, cachelines: 1, members: 3 */
# + /* padding: 4 */
# + /* last cacheline: 24 bytes */# };
This ABI disagreement will make an x86_64 kernel try to read past the buffer provided by an i386 binary.
When boundary check will be implemented, a x86_64 kernel will refuse to read past the i386 userspace provided buffer and the uverb will fail.
Anyway, if the structure lies in memory on a page boundary and next page is not mapped, ib_copy_from_udata() will fail when trying to read the 4 bytes of padding and the uverb will fail.
This patch makes create_cq_user() takes care of the input data size to handle the case where no padding is provided.
This way, x86_64 kernel will be able to handle struct mlx5_ib_create_cq as sent by unpatched and patched i386 libmlx5.
--- drivers/infiniband/hw/mlx5/cq.c | 13 ++++++++++++- drivers/infiniband/hw/mlx5/user.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/cq.c +12 -1
@@ -32,6 +32,7 @@#include <linux/kref.h> #include <rdma/ib_umem.h> +#include <rdma/ib_user_verbs.h> #include "mlx5_ib.h" #include "user.h"
@@ -602,14 +603,24 @@ static int create_cq_user(struct mlx5_ib int *cqe_size, int *index, int *inlen) { struct mlx5_ib_create_cq ucmd; +size_t ucmdlen;int page_shift;int npages;int ncont;int err; -if (ib_copy_from_udata (&ucmd, udata,sizeof (ucmd))) + ucmdlen = + (udata->inlen -sizeof (struct ib_uverbs_cmd_hdr ) < +sizeof (ucmd)) ? (sizeof (ucmd) - +sizeof (ucmd.reserved)) :sizeof (ucmd); + +if (ib_copy_from_udata (&ucmd, udata, ucmdlen))return -EFAULT ; +if (ucmdlen ==sizeof (ucmd) && + ucmd.reserved !=0 ) +return -EINVAL ; +if (ucmd.cqe_size !=64 && ucmd.cqe_size !=128 )return -EINVAL ;
drivers/infiniband/hw/mlx5/user.h +1 -0
@@ -91,6 +91,7 @@ struct mlx5_ib_create_cq {__u64 buf_addr;__u64 db_addr;__u32 cqe_size; +__u32 reserved;/* explicit padding (optional on i386) */ };struct mlx5_ib_create_cq_resp {
Greg Kroah-Hartman
maintainerPATCH 27/66 IB/mlx5: add missing padding at end of struct mlx5_ib_create_srq
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit 43bc889380c2ad9aa230eccc03a15cc52cf710d4 upstream.
The i386 ABI disagrees with most other ABIs regarding alignment of data type larger than 4 bytes: on most ABIs a padding must be added at end of the structures, while it is not required on i386.
So for most ABIs struct mlx5_ib_create_srq gets implicitly padded to be aligned on a 8 bytes multiple, while for i386, such padding is not added.
Tool pahole could be used to find such implicit padding:
$ pahole --anon_include \
--nested_anon_include \
--recursive \
--class_name mlx5_ib_create_srq \
drivers/infiniband/hw/mlx5/mlx5_ib.oThen, structure layout can be compared between i386 and x86_64:
# +++ obj-i386/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-28 11:43:07.386413682 +0100
# --- obj-x86_64/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-27 13:06:17.788472721 +0100
# @@ -69,7 +68,6 @@ struct mlx5_ib_create_srq {
# __u64 db_addr; /* 8 8 */
# __u32 flags; /* 16 4 */
#
# - /* size: 20, cachelines: 1, members: 3 */
# - /* last cacheline: 20 bytes */
# + /* size: 24, cachelines: 1, members: 3 */
# + /* padding: 4 */
# + /* last cacheline: 24 bytes */# };
ABI disagreement will make an x86_64 kernel try to read past the buffer provided by an i386 binary.
When boundary check will be implemented, the x86_64 kernel will refuse to read past the i386 userspace provided buffer and the uverb will fail.
Anyway, if the structure lay in memory on a page boundary and next page is not mapped, ib_copy_from_udata() will fail and the uverb will fail.
This patch makes create_srq_user() takes care of the input data size to handle the case where no padding was provided.
This way, x86_64 kernel will be able to handle struct mlx5_ib_create_srq as sent by unpatched and patched i386 libmlx5.
--- drivers/infiniband/hw/mlx5/srq.c | 14 +++++++++++++- drivers/infiniband/hw/mlx5/user.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/srq.c +13 -1
@@ -35,6 +35,7 @@#include <linux/mlx5/srq.h> #include <linux/slab.h> #include <rdma/ib_umem.h> +#include <rdma/ib_user_verbs.h> #include "mlx5_ib.h" #include "user.h"
@@ -78,16 +79,27 @@ static int create_srq_user(struct ib_pd {struct mlx5_ib_dev *dev =to_mdev (pd->device);struct mlx5_ib_create_srq ucmd; +size_t ucmdlen;int err;int npages;int page_shift;int ncont;u32 offset; -if (ib_copy_from_udata (&ucmd, udata,sizeof (ucmd))) { + ucmdlen = + (udata->inlen -sizeof (struct ib_uverbs_cmd_hdr ) < +sizeof (ucmd)) ? (sizeof (ucmd) - +sizeof (ucmd.reserved)) :sizeof (ucmd); + +if (ib_copy_from_udata (&ucmd, udata, ucmdlen)) {mlx5_ib_dbg (dev,"failed copy udata\n" );return -EFAULT ; } + +if (ucmdlen ==sizeof (ucmd) && + ucmd.reserved !=0 ) +return -EINVAL ; + srq->wq_sig = !!(ucmd.flags &MLX5_SRQ_FLAG_SIGNATURE ); srq->umem = ib_umem_get(pd->uobject->context, ucmd.buf_addr, buf_size,
drivers/infiniband/hw/mlx5/user.h +1 -0
@@ -110,6 +110,7 @@ struct mlx5_ib_create_srq {__u64 buf_addr;__u64 db_addr;__u32 flags; +__u32 reserved;/* explicit padding (optional on i386) */ };struct mlx5_ib_create_srq_resp {
Greg Kroah-Hartman
maintainerPATCH 28/66 IB/qib: Fix port in pkey change event
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <[email protected]>
commit 911eccd284d13d78c92ec4f1f1092c03457d732a upstream.
The code used a literal 1 in dispatching an IB_EVENT_PKEY_CHANGE.
As of the dual port qib QDR card, this is not necessarily correct.
Change to use the port as specified in the call.
--- drivers/infiniband/hw/qib/qib_mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/qib/qib_mad.c +1 -1
@@ -1028,7 +1028,7 @@ static int set_pkeys(struct qib_devdata event.event =IB_EVENT_PKEY_CHANGE ; event.device = &dd->verbs_dev.ibdev; - event.element.port_num =1 ; + event.element.port_num = port;ib_dispatch_event (&event); }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 29/66 IB/ipath: Translate legacy diagpkt into newer extended diagpkt
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dennis Dalessandro <[email protected]>
commit 7e6d3e5c70f13874fb06e6b67696ed90ce79bd48 upstream.
This patch addresses an issue where the legacy diagpacket is sent in from the user, but the driver operates on only the extended diagpkt. This patch specifically initializes the extended diagpkt based on the legacy packet.
--- drivers/infiniband/hw/ipath/ipath_diag.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/ipath/ipath_diag.c +4 -0
@@ -346,6 +346,10 @@ static ssize_t ipath_diagpkt_write(struc ret = -EFAULT ; goto bail; } + dp.len = odp.len; + dp.unit = odp.unit; + dp.data = odp.data; + dp.pbc_wd =0 ; }else { ret = -EINVAL ; goto bail;
Greg Kroah-Hartman
maintainerPATCH 30/66 IB/srp: Fix a sporadic crash triggered by cable pulling
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 024ca90151f5e4296d30f72c13ff9a075e23c9ec upstream.
Avoid that the loops that iterate over the request ring can encounter a pointer to a SCSI command in req->scmnd that is no longer associated with that request. If the function srp_unmap_data() is invoked twice for a SCSI command that is not in flight then that would cause ib_fmr_pool_unmap() to be invoked with an invalid pointer as argument, resulting in a kernel oops.
Reference: http://thread.gmane.org/gmane.linux.drivers.rdma/19068/focus=19069
--- drivers/infiniband/ulp/srp/ib_srp.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/infiniband/ulp/srp/ib_srp.c +6 -0
@@ -1594,6 +1594,12 @@ err_unmap: err_iu:srp_put_tx_iu (target, iu,SRP_IU_CMD ); +/* +* Avoid that the loops that iterate over the request ring can +* encounter a dangling SCSI command pointer. +*/ + req->scmnd =NULL ; +spin_lock_irqsave (&target->lock, flags);list_add (&req->list, &target->free_reqs);
Greg Kroah-Hartman
maintainerPATCH 31/66 IB/umad: Fix error handling
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 8ec0a0e6b58218bdc1db91dd70ebfcd6ad8dd6cd upstream.
Avoid leaking a kref count in ib_umad_open() if port->ib_dev == NULL or if nonseekable_open() fails.
Avoid leaking a kref count, that sm_sem is kept down and also that the IB_PORT_SM capability mask is not cleared in ib_umad_sm_open() if nonseekable_open() fails.
Since container_of() never returns NULL, remove the code that tests whether container_of() returns NULL.
Moving the kref_get() call from the start of ib_umad_*open() to the end is safe since it is the responsibility of the caller of these functions to ensure that the cdev pointer remains valid until at least when these functions return.
[[email protected]: rework a bit to reduce the amount of code changed]
[ nonseekable_open() can't actually fail, but.... - Roland ]
--- drivers/infiniband/core/user_mad.c | 49 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 22 deletions(-)
drivers/infiniband/core/user_mad.c +27 -22
@@ -780,27 +780,19 @@ static int ib_umad_open(struct inode *in {struct ib_umad_port *port;struct ib_umad_file *file; -int ret; +int ret = -ENXIO ; port = container_of(inode->i_cdev, struct ib_umad_port, cdev); -if (port) -kref_get (&port->umad_dev->ref); -else -return -ENXIO ;mutex_lock (&port->file_mutex); -if (!port->ib_dev) { - ret = -ENXIO ; +if (!port->ib_dev) goto out; - } + ret = -ENOMEM ; file =kzalloc (sizeof *file,GFP_KERNEL ); -if (!file) { -kref_put (&port->umad_dev->ref, ib_umad_release_dev); - ret = -ENOMEM ; +if (!file) goto out; - }mutex_init (&file->mutex);spin_lock_init (&file->send_lock);
@@ -814,6 +806,13 @@ static int ib_umad_open(struct inode *inlist_add_tail (&file->port_list, &port->file_list); ret =nonseekable_open (inode, filp); +if (ret) { +list_del (&file->port_list); +kfree (file); + goto out; + } + +kref_get (&port->umad_dev->ref); out:mutex_unlock (&port->file_mutex);
@@ -880,10 +879,6 @@ static int ib_umad_sm_open(struct inodeint ret; port = container_of(inode->i_cdev, struct ib_umad_port, sm_cdev); -if (port) -kref_get (&port->umad_dev->ref); -else -return -ENXIO ;if (filp->f_flags &O_NONBLOCK ) {if (down_trylock (&port->sm_sem)) {
@@ -898,17 +893,27 @@ static int ib_umad_sm_open(struct inode } ret =ib_modify_port (port->ib_dev, port->port_num,0 , &props); -if (ret) { -up (&port->sm_sem); - goto fail; - } +if (ret) + goto err_up_sem; filp->private_data = port; -return nonseekable_open (inode, filp); + ret =nonseekable_open (inode, filp); +if (ret) + goto err_clr_sm_cap; + +kref_get (&port->umad_dev->ref); + +return 0 ; + +err_clr_sm_cap: +swap (props.set_port_cap_mask, props.clr_port_cap_mask); +ib_modify_port (port->ib_dev, port->port_num,0 , &props); + +err_up_sem: +up (&port->sm_sem); fail: -kref_put (&port->umad_dev->ref, ib_umad_release_dev);return ret; }
Greg Kroah-Hartman
maintainerPATCH 32/66 IB/umad: Fix use-after-free on close
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 60e1751cb52cc6d1ae04b6bd3c2b96e770b5823f upstream.
Avoid that closing /dev/infiniband/umad<n> or /dev/infiniband/issm<n> triggers a use-after-free. __fput() invokes f_op->release() before it invokes cdev_put(). Make sure that the ib_umad_device structure is freed by the cdev_put() call instead of f_op->release(). This avoids that changing the port mode from IB into Ethernet and back to IB followed by restarting opensmd triggers the following kernel oops:
general protection fault: 0000 [#1] PREEMPT SMP
RIP: 0010:[<ffffffff810cc65c>] [<ffffffff810cc65c>] module_put+0x2c/0x170
Call Trace:
[<ffffffff81190f20>] cdev_put+0x20/0x30
[<ffffffff8118e2ce>] __fput+0x1ae/0x1f0
[<ffffffff8118e35e>] ____fput+0xe/0x10
[<ffffffff810723bc>] task_work_run+0xac/0xe0
[<ffffffff81002a9f>] do_notify_resume+0x9f/0xc0
[<ffffffff814b8398>] int_signal+0x12/0x17Reference: https://bugzilla.kernel.org/show_bug.cgi?id=75051
--- drivers/infiniband/core/user_mad.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/infiniband/core/user_mad.c +19 -11
@@ -98,7 +98,7 @@ struct ib_umad_port {struct ib_umad_device {int start_port, end_port; -struct kref ref; +struct kobject kobj;struct ib_umad_port port[0 ]; };
@@ -134,14 +134,18 @@ static DECLARE_BITMAP(dev_map, IB_UMAD_Mstatic void ib_umad_add_one (struct ib_device *device);static void ib_umad_remove_one (struct ib_device *device); -static void ib_umad_release_dev (struct kref *ref) +static void ib_umad_release_dev (struct kobject *kobj) {struct ib_umad_device *dev = - container_of(ref, struct ib_umad_device, ref); + container_of(kobj, struct ib_umad_device, kobj);kfree (dev); } +static struct kobj_type ib_umad_dev_ktype = { + .release = ib_umad_release_dev, +}; +static int hdr_size (struct ib_umad_file *file) { return file->use_pkey_index ? sizeof (struct ib_user_mad_hdr) :
@@ -812,7 +816,7 @@ static int ib_umad_open(struct inode *in goto out; } -kref_get (&port->umad_dev->ref); +kobject_get (&port->umad_dev->kobj); out:mutex_unlock (&port->file_mutex);
@@ -851,7 +855,7 @@ static int ib_umad_close(struct inode *imutex_unlock (&file->port->file_mutex);kfree (file); -kref_put (&dev->ref, ib_umad_release_dev); +kobject_put (&dev->kobj);return 0 ; }
@@ -902,7 +906,7 @@ static int ib_umad_sm_open(struct inodeif (ret) goto err_clr_sm_cap; -kref_get (&port->umad_dev->ref); +kobject_get (&port->umad_dev->kobj);return 0 ;
@@ -932,7 +936,7 @@ static int ib_umad_sm_close(struct inodeup (&port->sm_sem); -kref_put (&port->umad_dev->ref, ib_umad_release_dev); +kobject_put (&port->umad_dev->kobj);return ret; }
@@ -1000,6 +1004,7 @@ static int find_overflow_devnum(void) }static int ib_umad_init_port (struct ib_device *device,int port_num, +struct ib_umad_device *umad_dev,struct ib_umad_port *port) {int devnum;
@@ -1032,6 +1037,7 @@ static int ib_umad_init_port(struct ib_dcdev_init (&port->cdev, &umad_fops); port->cdev.owner =THIS_MODULE ; + port->cdev.kobj.parent = &umad_dev->kobj;kobject_set_name (&port->cdev.kobj,"umad%d" , port->dev_num);if (cdev_add (&port->cdev, base,1 )) goto err_cdev;
@@ -1050,6 +1056,7 @@ static int ib_umad_init_port(struct ib_d base +=IB_UMAD_MAX_PORTS ;cdev_init (&port->sm_cdev, &umad_sm_fops); port->sm_cdev.owner =THIS_MODULE ; + port->sm_cdev.kobj.parent = &umad_dev->kobj;kobject_set_name (&port->sm_cdev.kobj,"issm%d" , port->dev_num);if (cdev_add (&port->sm_cdev, base,1 )) goto err_sm_cdev;
@@ -1143,7 +1150,7 @@ static void ib_umad_add_one(struct ib_deif (!umad_dev)return ; -kref_init (&umad_dev->ref); +kobject_init (&umad_dev->kobj, &ib_umad_dev_ktype); umad_dev->start_port = s; umad_dev->end_port = e;
@@ -1151,7 +1158,8 @@ static void ib_umad_add_one(struct ib_defor (i = s; i <= e; ++i) { umad_dev->port[i - s].umad_dev = umad_dev; -if (ib_umad_init_port (device, i, &umad_dev->port[i - s])) +if (ib_umad_init_port (device, i, umad_dev, + &umad_dev->port[i - s])) goto err; }
@@ -1163,7 +1171,7 @@ err:while (--i >= s)ib_umad_kill_port (&umad_dev->port[i - s]); -kref_put (&umad_dev->ref, ib_umad_release_dev); +kobject_put (&umad_dev->kobj); }static void ib_umad_remove_one (struct ib_device *device)
@@ -1177,7 +1185,7 @@ static void ib_umad_remove_one(struct ibfor (i =0 ; i <= umad_dev->end_port - umad_dev->start_port; ++i)ib_umad_kill_port (&umad_dev->port[i]); -kref_put (&umad_dev->ref, ib_umad_release_dev); +kobject_put (&umad_dev->kobj); }static char *umad_devnode (struct device *dev,umode_t *mode)
Greg Kroah-Hartman
maintainerPATCH 33/66 SUNRPC: Fix a module reference leak in svc_handle_xprt
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit c789102c20bbbdda6831a273e046715be9d6af79 upstream.
If the accept() call fails, we need to put the module reference.
--- net/sunrpc/svc_xprt.c | 2 ++ 1 file changed, 2 insertions(+)
net/sunrpc/svc_xprt.c +2 -0
@@ -730,6 +730,8 @@ static int svc_handle_xprt(struct svc_rq newxpt = xprt->xpt_ops->xpo_accept (xprt);if (newxpt)svc_add_new_temp_xprt (serv, newxpt); +else +module_put (xprt->xpt_class->xcl_owner); }else if (xprt->xpt_ops->xpo_has_wspace (xprt)) {/* XPT_DATA|XPT_DEFERRED case: */ dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n",
Greg Kroah-Hartman
maintainerPATCH 34/66 pNFS: Handle allocation errors correctly in filelayout_alloc_layout_hdr()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 6df200f5d5191bdde4d2e408215383890f956781 upstream.
Return the NULL pointer when the allocation fails.
--- fs/nfs/nfs4filelayout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4filelayout.c +1 -1
@@ -1330,7 +1330,7 @@ filelayout_alloc_layout_hdr(struct inodestruct nfs4_filelayout *flo; flo =kzalloc (sizeof (*flo), gfp_flags); -return &flo->generic_hdr; +return flo !=NULL ? &flo->generic_hdr :NULL ; } static void
Greg Kroah-Hartman
maintainerPATCH 35/66 nfsd4: fix FREE_STATEID lockowner leak
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 48385408b45523d9a432c66292d47ef43efcbb94 upstream.
27b11428b7de ("nfsd4: remove lockowner when removing lock stateid") introduced a memory leak.
--- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
@@ -3726,7 +3726,7 @@ nfsd4_free_lock_stateid(struct nfs4_ol_s* correspondance, and we have to delete the lockowner when we * delete the lock stateid: */ -unhash_lockowner (lo); +release_lockowner (lo);return nfs_ok; }
Greg Kroah-Hartman
maintainerPATCH 36/66 nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 12337901d654415d9f764b5f5ba50052e9700f37 upstream.
Note nobody's ever noticed because the typical client probably never requests FILES_AVAIL without also requesting something else on the list.
--- fs/nfsd/nfs4xdr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4xdr.c +2 -2
@@ -2095,8 +2095,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s err =vfs_getattr (&path, &stat);if (err) goto out_nfserr; -if ((bmval0 & (FATTR4_WORD0_FILES_FREE |FATTR4_WORD0_FILES_TOTAL | -FATTR4_WORD0_MAXNAME )) || +if ((bmval0 & (FATTR4_WORD0_FILES_AVAIL |FATTR4_WORD0_FILES_FREE | +FATTR4_WORD0_FILES_TOTAL |FATTR4_WORD0_MAXNAME )) || (bmval1 & (FATTR4_WORD1_SPACE_AVAIL |FATTR4_WORD1_SPACE_FREE |FATTR4_WORD1_SPACE_TOTAL ))) { err =vfs_statfs (&path, &statfs);
Greg Kroah-Hartman
maintainerPATCH 37/66 NFS: Dont declare inode uptodate unless all attributes were checked
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 43b6535e717d2f656f71d9bd16022136b781c934 upstream.
Fix a bug, whereby nfs_update_inode() was declaring the inode to be up to date despite not having checked all the attributes. The bug occurs because the temporary variable in which we cache the validity information is 'sanitised' before reapplying to nfsi->cache_validity.
--- fs/nfs/inode.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
fs/nfs/inode.c +17 -9
@@ -1575,18 +1575,20 @@ static int nfs_update_inode(struct inode inode->i_version = fattr->change_attr; } }else if (server->caps &NFS_CAP_CHANGE_ATTR ) - invalid |= save_cache_validity; + nfsi->cache_validity |= save_cache_validity;if (fattr->valid &NFS_ATTR_FATTR_MTIME ) {memcpy (&inode->i_mtime, &fattr->mtime,sizeof (inode->i_mtime)); }else if (server->caps &NFS_CAP_MTIME ) - invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATTR |NFS_INO_REVAL_FORCED );if (fattr->valid &NFS_ATTR_FATTR_CTIME ) {memcpy (&inode->i_ctime, &fattr->ctime,sizeof (inode->i_ctime)); }else if (server->caps &NFS_CAP_CTIME ) - invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATTR |NFS_INO_REVAL_FORCED );/* Check if our cached file size is stale */
@@ -1608,7 +1610,8 @@ static int nfs_update_inode(struct inode (long long)new_isize); } }else - invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATTR |NFS_INO_REVAL_PAGECACHE |NFS_INO_REVAL_FORCED );
@@ -1616,7 +1619,8 @@ static int nfs_update_inode(struct inodeif (fattr->valid &NFS_ATTR_FATTR_ATIME )memcpy (&inode->i_atime, &fattr->atime,sizeof (inode->i_atime));else if (server->caps &NFS_CAP_ATIME ) - invalid |= save_cache_validity & (NFS_INO_INVALID_ATIME + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATIME |NFS_INO_REVAL_FORCED );if (fattr->valid &NFS_ATTR_FATTR_MODE ) {
@@ -1627,7 +1631,8 @@ static int nfs_update_inode(struct inode invalid |=NFS_INO_INVALID_ATTR |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL ; } }else if (server->caps &NFS_CAP_MODE ) - invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATTR |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL |NFS_INO_REVAL_FORCED );
@@ -1638,7 +1643,8 @@ static int nfs_update_inode(struct inode inode->i_uid = fattr->uid; } }else if (server->caps &NFS_CAP_OWNER ) - invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATTR |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL |NFS_INO_REVAL_FORCED );
@@ -1649,7 +1655,8 @@ static int nfs_update_inode(struct inode inode->i_gid = fattr->gid; } }else if (server->caps &NFS_CAP_OWNER_GROUP ) - invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATTR |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL |NFS_INO_REVAL_FORCED );
@@ -1662,7 +1669,8 @@ static int nfs_update_inode(struct inodeset_nlink (inode, fattr->nlink); } }else if (server->caps &NFS_CAP_NLINK ) - invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_ATTR |NFS_INO_REVAL_FORCED );if (fattr->valid &NFS_ATTR_FATTR_SPACE_USED ) {
Greg Kroah-Hartman
maintainerPATCH 38/66 NFS: Use raw_write_seqcount_begin/end int nfs4_reclaim_open_state
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit abbec2da13f0e4c5d9b78b7e2c025a3e617228ba upstream.
The addition of lockdep code to write_seqcount_begin/end has lead to a bunch of false positive claims of ABBA deadlocks with the so_lock spinlock. Audits show that this simply cannot happen because the read side code does not spin while holding so_lock.
--- fs/nfs/nfs4state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/nfs/nfs4state.c +3 -3
@@ -1456,7 +1456,7 @@ static int nfs4_reclaim_open_state(struc* server that doesn't support a grace period. */ spin_lock (&sp->so_lock); -write_seqcount_begin (&sp->so_reclaim_seqcount); +raw_write_seqcount_begin (&sp->so_reclaim_seqcount); restart:list_for_each_entry (state, &sp->so_states, open_states) {if (!test_and_clear_bit (ops->state_flag_bit, &state->flags))
@@ -1519,13 +1519,13 @@ restart:spin_lock (&sp->so_lock); goto restart; } -write_seqcount_end (&sp->so_reclaim_seqcount); +raw_write_seqcount_end (&sp->so_reclaim_seqcount);spin_unlock (&sp->so_lock);return 0 ; out_err:nfs4_put_open_state (state);spin_lock (&sp->so_lock); -write_seqcount_end (&sp->so_reclaim_seqcount); +raw_write_seqcount_end (&sp->so_reclaim_seqcount);spin_unlock (&sp->so_lock);return status; }
Greg Kroah-Hartman
maintainerPATCH 39/66 NFS: populate ->net in mount data when remounting
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Guzik <[email protected]>
commit a914722f333b3359d2f4f12919380a334176bb89 upstream.
Otherwise the kernel oopses when remounting with IPv6 server because net is dereferenced in dev_get_by_name.
Use net ns of current thread so that dev_get_by_name does not operate on foreign ns. Changing the address is prohibited anyway so this should not affect anything.
--- fs/nfs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/super.c +1 -0
@@ -2248,6 +2248,7 @@ nfs_remount(struct super_block *sb, int data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; data->version = nfsvers; data->minorversion = nfss->nfs_client->cl_minorversion; + data->net = current->nsproxy->net_ns;memcpy (&data->nfs_server.address, &nfss->nfs_client->cl_addr, data->nfs_server.addrlen);
Greg Kroah-Hartman
maintainerPATCH 40/66 nfs: Fix cache_validity check in nfs_write_pageuptodate()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
commit 18dd78c427513fb0f89365138be66e6ee8700d1b upstream.
NFS_INO_INVALID_DATA cannot be ignored, even if we have a delegation.
We're still having some problems with data corruption when multiple clients are appending to a file and those clients are being granted write delegations on open.
To reproduce:
Client A:
vi /mnt/hostname -s
while :; do echo "XXXXXXXXXXXXXXX" >>/mnt/file; sleep $(( $RANDOM % 5 )); done
Client B:
vi /mnt/hostname -s
while :; do echo "YYYYYYYYYYYYYYY" >>/mnt/file; sleep $(( $RANDOM % 5 )); done
What's happening is that in nfs_update_inode() we're recognizing that the file size has changed and we're setting NFS_INO_INVALID_DATA accordingly, but then we ignore the cache_validity flags in nfs_write_pageuptodate() because we have a delegation. As a result, in nfs_updatepage() we're extending the write to cover the full page even though we've not read in the data to begin with.
--- fs/nfs/write.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/write.c +3 -1
@@ -913,12 +913,14 @@ static bool nfs_write_pageuptodate(strucif (nfs_have_delegated_attributes (inode)) goto out; -if (nfsi->cache_validity & (NFS_INO_INVALID_DATA |NFS_INO_REVAL_PAGECACHE )) +if (nfsi->cache_validity &NFS_INO_REVAL_PAGECACHE )return false;smp_rmb ();if (test_bit (NFS_INO_INVALIDATING , &nfsi->flags))return false; out: +if (nfsi->cache_validity &NFS_INO_INVALID_DATA ) +return false;return PageUptodate (page) !=0 ; }
Greg Kroah-Hartman
maintainerPATCH 41/66 powerpc/pseries: Fix overwritten PE state
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit 54f112a3837d4e7532bbedbbbf27c0de277be510 upstream.
In pseries_eeh_get_state(), EEH_STATE_UNAVAILABLE is always overwritten by EEH_STATE_NOT_SUPPORT because of the missed "break" there. The patch fixes the issue.
--- arch/powerpc/platforms/pseries/eeh_pseries.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/pseries/eeh_pseries.c +1 -0
@@ -464,6 +464,7 @@ static int pseries_eeh_get_state(struct }else { result =EEH_STATE_NOT_SUPPORT ; } +break ;default : result =EEH_STATE_NOT_SUPPORT ; }
Greg Kroah-Hartman
maintainerPATCH 42/66 powernv: Fix permissions on sysparam sysfs entries
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 1bd098903fda069cb96fe8b5cb4595b46c683385 upstream.
Everyone can write to these files, which is not what we want.
--- arch/powerpc/platforms/powernv/opal-sysparam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/powernv/opal-sysparam.c +2 -2
@@ -260,10 +260,10 @@ void __init opal_sys_param_init(void) attr[i].kobj_attr.attr.mode =S_IRUGO ;break ;case OPAL_SYSPARAM_WRITE : - attr[i].kobj_attr.attr.mode =S_IWUGO ; + attr[i].kobj_attr.attr.mode =S_IWUSR ;break ;case OPAL_SYSPARAM_RW : - attr[i].kobj_attr.attr.mode =S_IRUGO |S_IWUGO ; + attr[i].kobj_attr.attr.mode =S_IRUGO |S_IWUSR ;break ;default :break ;
Greg Kroah-Hartman
maintainerPATCH 43/66 powerpc/mm: Check paca psize is up to date for huge mappings
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 09567e7fd44291bfc08accfdd67ad8f467842332 upstream.
We have a bug in our hugepage handling which exhibits as an infinite loop of hash faults. If the fault is being taken in the kernel it will typically trigger the softlockup detector, or the RCU stall detector.
The bug is as follows:
1. mmap(0xa0000000, ..., MAP_FIXED | MAP_HUGE_TLB | MAP_ANONYMOUS ..)
2. Slice code converts the slice psize to 16M.
3. The code on lines 539-540 of slice.c in slice_get_unmapped_area() synchronises the mm->context with the paca->context. So the paca slice mask is updated to include the 16M slice.
3. Either:
* mmap() fails because there are no huge pages available.
* mmap() succeeds and the mapping is then munmapped.
In both cases the slice psize remains at 16M in both the paca & mm.
4. mmap(0xa0000000, ..., MAP_FIXED | MAP_ANONYMOUS ..)
5. The slice psize is converted back to 64K. Because of the check on line 539 of slice.c we DO NOT update the paca->context. The paca slice mask is now out of sync with the mm slice mask.
6. User/kernel accesses 0xa0000000.
7. The SLB miss handler slb_allocate_realmode() **uses the paca slice mask** to create an SLB entry and inserts it in the SLB.
18. With the 16M SLB entry in place the hardware does a hash lookup, no entry is found so a data access exception is generated.
19. The data access handler calls do_page_fault() -> handle_mm_fault().
10. __handle_mm_fault() creates a THP mapping with do_huge_pmd_anonymous_page().
11. The hardware retries the access, there is still nothing in the hash table so once again a data access exception is generated.
12. hash_page() calls into __hash_page_thp() and inserts a mapping in the hash. Although the THP mapping maps 16M the hashing is done using 64K as the segment page size.
13. hash_page() returns immediately after calling __hash_page_thp(), skipping over the code at line 1125. Resulting in the mismatch between the paca->context and mm->context not being detected.
14. The hardware retries the access, the hash it generates using the 16M SLB entry does NOT match the hash we inserted.
15. We take another data access and go into __hash_page_thp().
16. We see a valid entry in the hpte_slot_array and so we call updatepp() which succeeds.
17. Goto 14.
We could fix this in two ways. The first would be to remove or modify the check on line 539 of slice.c.
The second option is to cause the check of paca psize in hash_page() on line 1125 to also be done for THP pages.
We prefer the latter, because the check & update of the paca psize is not done until we know it's necessary. It's also done only on the current cpu, so we don't need to IPI all other cpus.
Without further rearranging the code, the simplest fix is to pull out the code that checks paca psize and call it in two places. Firstly for THP/hugetlb, and secondly for other mappings as before.
Thanks to Dave Jones for trinity, which originally found this bug.
--- arch/powerpc/mm/hash_utils_64.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
arch/powerpc/mm/hash_utils_64.c +20 -11
@@ -964,6 +964,22 @@ void hash_failure_debug(unsigned long ea trap, vsid, ssize, psize, lpsize, pte); } +static void check_paca_psize (unsigned long ea,struct mm_struct *mm, +int psize,bool user_region) +{ +if (user_region) { +if (psize !=get_paca_psize (ea)) { +get_paca ()->context = mm->context; +slb_flush_and_rebolt (); + } + }else if (get_paca ()->vmalloc_sllp != + mmu_psize_defs[mmu_vmalloc_psize].sllp) { +get_paca ()->vmalloc_sllp = + mmu_psize_defs[mmu_vmalloc_psize].sllp; +slb_vmalloc_update (); + } +} +/* Result code is: * 0 - handled * 1 - normal page fault
@@ -1085,6 +1101,8 @@ int hash_page(unsigned long ea, unsigned WARN_ON(1); }#endif +check_paca_psize (ea, mm, psize, user_region); + goto bail; }
@@ -1125,17 +1143,8 @@ int hash_page(unsigned long ea, unsigned #endif } } -if (user_region) { -if (psize !=get_paca_psize (ea)) { -get_paca ()->context = mm->context; -slb_flush_and_rebolt (); - } - }else if (get_paca ()->vmalloc_sllp != - mmu_psize_defs[mmu_vmalloc_psize].sllp) { -get_paca ()->vmalloc_sllp = - mmu_psize_defs[mmu_vmalloc_psize].sllp; -slb_vmalloc_update (); - } + +check_paca_psize (ea, mm, psize, user_region);#endif /* CONFIG_PPC_64K_PAGES */ #ifdef CONFIG_PPC_HAS_HASH_64K
Greg Kroah-Hartman
maintainerPATCH 44/66 powerpc/serial: Use saner flags when creating legacy ports
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit c4cad90f9e9dcb85afc5e75a02ae3522ed077296 upstream.
We had a mix & match of flags used when creating legacy ports depending on where we found them in the device-tree. Among others we were missing UPF_SKIP_TEST for some kind of ISA ports which is a problem as quite a few UARTs out there don't support the loopback test (such as a lot of BMCs).
Let's pick the set of flags used by the SoC code and generalize it which means autoconf, no loopback test, irq maybe shared and fixed port.
Sending to stable as the lack of UPF_SKIP_TEST is breaking serial on some machines so I want this back into distros
--- arch/powerpc/kernel/legacy_serial.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/powerpc/kernel/legacy_serial.c +9 -6
@@ -48,6 +48,9 @@ static struct of_device_id legacy_serialstatic unsigned int legacy_serial_count;static int legacy_serial_console =-1 ; +static const upf_t legacy_port_flags =UPF_BOOT_AUTOCONF |UPF_SKIP_TEST | +UPF_SHARE_IRQ |UPF_FIXED_PORT ; +static unsigned int tsi_serial_in (struct uart_port *p,int offset) {unsigned int tmp;
@@ -153,8 +156,6 @@ static int __init add_legacy_soc_port(st {u64 addr;const __be32 *addrp; -upf_t flags =UPF_BOOT_AUTOCONF |UPF_SKIP_TEST |UPF_SHARE_IRQ - |UPF_FIXED_PORT ;struct device_node *tsi =of_get_parent (np);/* We only support ports that have a clock frequency properly
@@ -185,9 +186,11 @@ static int __init add_legacy_soc_port(st* IO port value. It will be fixed up later along with the irq */ if (tsi && !strcmp (tsi->type,"tsi-bridge" )) -return add_legacy_port (np,-1 ,UPIO_TSI , addr, addr,NO_IRQ , flags,0 ); +return add_legacy_port (np,-1 ,UPIO_TSI , addr, addr, +NO_IRQ , legacy_port_flags,0 );else -return add_legacy_port (np,-1 ,UPIO_MEM , addr, addr,NO_IRQ , flags,0 ); +return add_legacy_port (np,-1 ,UPIO_MEM , addr, addr, +NO_IRQ , legacy_port_flags,0 ); } static int __init add_legacy_isa_port(struct device_node *np,
@@ -233,7 +236,7 @@ static int __init add_legacy_isa_port(st/* Add port, irq will be dealt with later */ return add_legacy_port (np, index,UPIO_PORT ,be32_to_cpu (reg[1 ]), - taddr,NO_IRQ ,UPF_BOOT_AUTOCONF ,0 ); + taddr,NO_IRQ , legacy_port_flags,0 ); }
@@ -306,7 +309,7 @@ static int __init add_legacy_pci_port(st* IO port value. It will be fixed up later along with the irq */ return add_legacy_port (np, index, iotype, base, addr,NO_IRQ , - UPF_BOOT_AUTOCONF, np != pci_dev); + legacy_port_flags, np != pci_dev); }#endif
Greg Kroah-Hartman
maintainerPATCH 45/66 powerpc: 64bit sendfile is capped at 2GB
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 5d73320a96fcce80286f1447864c481b5f0b96fa upstream.
commit 8f9c0119d7ba (compat: fs: Generic compat_sys_sendfile implementation) changed the PowerPC 64bit sendfile call from sys_sendile64 to sys_sendfile.
Unfortunately this broke sendfile of lengths greater than 2G because sys_sendfile caps at MAX_NON_LFS. Restore what we had previously which fixes the bug.
--- arch/powerpc/include/asm/systbl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/systbl.h +1 -1
@@ -190,7 +190,7 @@ SYSCALL_SPU(getcwd) SYSCALL_SPU(capget) SYSCALL_SPU(capset) COMPAT_SYS(sigaltstack) -COMPAT_SYS_SPU(sendfile) +SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile) SYSCALL(ni_syscall) SYSCALL(ni_syscall) PPC_SYS(vfork)
Greg Kroah-Hartman
maintainerPATCH 46/66 powerpc: fix typo CONFIG_PMAC
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Bolle <[email protected]>
commit 6e0fdf9af216887e0032c19d276889aad41cad00 upstream.
Commit b0d278b7d3ae ("powerpc/perf_event: Reduce latency of calling perf_event_do_pending") added a check for CONFIG_PMAC were a check for CONFIG_PPC_PMAC was clearly intended.
--- arch/powerpc/kernel/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/time.c +1 -1
@@ -551,7 +551,7 @@ void timer_interrupt(struct pt_regs * remay_hard_irq_enable (); -#if defined(CONFIG_PPC32 ) && defined(CONFIG_PMAC ) +#if defined(CONFIG_PPC32 ) && defined(CONFIG_PPC_PMAC )if (atomic_read (&ppc_n_lost_interrupts) !=0 )do_IRQ (regs);#endif
Greg Kroah-Hartman
maintainerPATCH 47/66 powerpc/perf: Ensure all EBB register state is cleared on fork()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 3df48c981d5a9610e02e9270b1bc4274fb536710 upstream.
In commit 330a1eb "Core EBB support for 64-bit book3s" I messed up clear_task_ebb(). It clears some but not all of the task's Event Based Branch (EBB) registers when we duplicate a task struct.
That allows a child task to observe the EBBHR & EBBRR of its parent, which it should not be able to do.
Fix it by clearing EBBHR & EBBRR.
--- arch/powerpc/include/asm/switch_to.h | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/include/asm/switch_to.h +2 -0
@@ -84,6 +84,8 @@ static inline void clear_task_ebb(struct {#ifdef CONFIG_PPC_BOOK3S_64 /* EBB perf events are not inherited, so clear all EBB state. */ + t->thread.ebbrr =0 ; + t->thread.ebbhr =0 ; t->thread.bescr =0 ; t->thread.mmcr2 =0 ; t->thread.mmcr0 =0 ;
Greg Kroah-Hartman
maintainerPATCH 48/66 powerpc: fix typo CONFIG_PPC_CPU
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Bolle <[email protected]>
commit b69a1da94f3d1589d1942b5d1b384d8cfaac4500 upstream.
Commit cd64d1697cf0 ("powerpc: mtmsrd not defined") added a check for CONFIG_PPC_CPU were a check for CONFIG_PPC_FPU was clearly intended.
--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/lib/sstep.c +1 -1
@@ -1470,7 +1470,7 @@ int __kprobes emulate_step(struct pt_reg regs->gpr[rd] =byterev_4 (val); goto ldst_done; -#ifdef CONFIG_PPC_CPU +#ifdef CONFIG_PPC_FPU case 535 :/* lfsx */ case 567 :/* lfsux */ if (!(regs->msr &MSR_FP ))
Greg Kroah-Hartman
maintainerPATCH 49/66 powerpc: Dont setup CPUs with bad status
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit 59a53afe70fd530040bdc69581f03d880157f15a upstream.
OPAL will mark a CPU that is guarded as "bad" in the status property of the CPU node.
Unfortunatley Linux doesn't check this property and will put the bad CPU in the present map. This has caused hangs on booting when we try to unsplit the core.
This patch checks the CPU is avaliable via this status property before putting it in the present map.
--- arch/powerpc/kernel/setup-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/setup-common.c +1 -1
@@ -461,7 +461,7 @@ void __init smp_setup_cpu_maps(void)for (j =0 ; j < nthreads && cpu < nr_cpu_ids; j++) {DBG (" thread %d -> cpu %d (hard id %d)\n" , j, cpu,be32_to_cpu (intserv[j])); -set_cpu_present (cpu, true); +set_cpu_present (cpu,of_device_is_available (dn));set_hard_smp_processor_id (cpu,be32_to_cpu (intserv[j]));set_cpu_possible (cpu, true); cpu++;
Greg Kroah-Hartman
maintainerPATCH 50/66 powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit dd58a092c4202f2bd490adab7285b3ff77f8e467 upstream.
The Vector Crypto category instructions are supported by current POWER8 chips, advertise them to userspace using a specific bit to properly differentiate with chips of the same architecture level that might not have them.
--- arch/powerpc/include/uapi/asm/cputable.h | 1 + arch/powerpc/kernel/cputable.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/include/uapi/asm/cputable.h +1 -0
@@ -41,5 +41,6 @@#define PPC_FEATURE2_EBB 0x10000000#define PPC_FEATURE2_ISEL 0x08000000#define PPC_FEATURE2_TAR 0x04000000 +#define PPC_FEATURE2_VEC_CRYPTO 0x02000000#endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
arch/powerpc/kernel/cputable.c +2 -1
@@ -109,7 +109,8 @@ extern void __restore_cpu_e6500(void); PPC_FEATURE_PSERIES_PERFMON_COMPAT)#define COMMON_USER2_POWER8 (PPC_FEATURE2_ARCH_2_07 | \ PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \ - PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR) + PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \ + PPC_FEATURE2_VEC_CRYPTO)#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\ PPC_FEATURE_TRUE_LE | \ PPC_FEATURE_HAS_ALTIVEC_COMP)
Greg Kroah-Hartman
maintainerPATCH 51/66 powerpc: Dont skip ePAPR spin-table CPUs
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Wood <[email protected]>
commit 6663a4fa6711050036562ddfd2086edf735fae21 upstream.
Commit 59a53afe70fd530040bdc69581f03d880157f15a "powerpc: Don't setup CPUs with bad status" broke ePAPR SMP booting. ePAPR says that CPUs that aren't presently running shall have status of disabled, with enable-method being used to determine whether the CPU can be enabled.
Fix by checking for spin-table, which is currently the only supported enable-method.
--- arch/powerpc/kernel/setup-common.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/powerpc/kernel/setup-common.c +9 -1
@@ -459,9 +459,17 @@ void __init smp_setup_cpu_maps(void) }for (j =0 ; j < nthreads && cpu < nr_cpu_ids; j++) { +bool avail; +DBG (" thread %d -> cpu %d (hard id %d)\n" , j, cpu,be32_to_cpu (intserv[j])); -set_cpu_present (cpu,of_device_is_available (dn)); + + avail =of_device_is_available (dn); +if (!avail) + avail = !of_property_match_string (dn, +"enable-method" ,"spin-table" ); + +set_cpu_present (cpu, avail);set_hard_smp_processor_id (cpu,be32_to_cpu (intserv[j]));set_cpu_possible (cpu, true); cpu++;
Greg Kroah-Hartman
maintainerPATCH 52/66 xfs: xfs_readsb needs to check for magic numbers
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit 556b8883cfac3d3203557e161ea8005f8b5479b2 upstream.
Commit daba542 ("xfs: skip verification on initial "guess" superblock read") dropped the use of a verifier for the initial superblock read so we can probe the sector size of the filesystem stored in the superblock. It, however, now fails to validate that what was read initially is actually an XFS superblock and hence will fail the sector size check and return ENOSYS.
This causes probe-based mounts to fail because it expects XFS to return EINVAL when it doesn't recognise the superblock format.
--- fs/xfs/xfs_mount.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
fs/xfs/xfs_mount.c +17 -6
@@ -323,8 +323,19 @@ reread:/* * Initialize the mount structure from the superblock. */ -xfs_sb_from_disk (&mp->m_sb,XFS_BUF_TO_SBP (bp)); -xfs_sb_quota_from_disk (&mp->m_sb); +xfs_sb_from_disk (sbp,XFS_BUF_TO_SBP (bp)); +xfs_sb_quota_from_disk (sbp); + +/* +* If we haven't validated the superblock, do so now before we try +* to check the sector size and reread the superblock appropriately. +*/ +if (sbp->sb_magicnum !=XFS_SB_MAGIC ) { +if (loud) +xfs_warn (mp,"Invalid superblock magic number" ); + error =EINVAL ; + goto release_buf; + }/* * We must be able to do sector-sized and sector-aligned IO.
@@ -337,11 +348,11 @@ reread: goto release_buf; } -/* -* Re-read the superblock so the buffer is correctly sized, -* and properly verified. -*/ if (buf_ops ==NULL ) { +/* +* Re-read the superblock so the buffer is correctly sized, +* and properly verified. +*/ xfs_buf_relse (bp); sector_size = sbp->sb_sectsize; buf_ops = loud ? &xfs_sb_buf_ops : &xfs_sb_quiet_buf_ops;
Greg Kroah-Hartman
maintainerPATCH 53/66 reiserfs: call truncate_setsize under tailpack mutex
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit 22e7478ddbcb670e33fab72d0bbe7c394c3a2c84 upstream.
Prior to commit 0e4f6a791b1e (Fix reiserfs_file_release()), reiserfs truncates serialized on i_mutex. They mostly still do, with the exception of reiserfs_file_release. That blocks out other writers via the tailpack mutex and the inode openers counter adjusted in reiserfs_file_open.
However, NFS will call reiserfs_setattr without having called ->open, so we end up with a race when nfs is calling ->setattr while another process is releasing the file. Ultimately, it triggers the BUG_ON(inode->i_size != new_file_size) check in maybe_indirect_to_direct.
The solution is to pull the lock into reiserfs_setattr to encompass the truncate_setsize call as well.
--- fs/reiserfs/inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/reiserfs/inode.c +7 -1
@@ -3220,8 +3220,14 @@ int reiserfs_setattr(struct dentry *dent attr->ia_size != i_size_read(inode)) { error =inode_newsize_ok (inode, attr->ia_size);if (!error) { +/* +* Could race against reiserfs_file_release +* if called from NFS, so take tailpack mutex. +*/ +mutex_lock (&REISERFS_I (inode)->tailpack);truncate_setsize (inode, attr->ia_size); -reiserfs_vfs_truncate_file (inode); +reiserfs_truncate_file (inode,1 ); +mutex_unlock (&REISERFS_I (inode)->tailpack); } }
Greg Kroah-Hartman
maintainerPATCH 54/66 cpufreq: ppc-corenet-cpu-freq: do_div use quotient
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ed Swarthout <[email protected]>
commit 906fe033145aab7d65a428bfda2cf19c75720894 upstream.
Commit 6712d2931933 (cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error) used the remainder from do_div instead of the quotient. Fix that and add one to ensure minimum is met.
--- drivers/cpufreq/ppc-corenet-cpufreq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/cpufreq/ppc-corenet-cpufreq.c +5 -4
@@ -138,7 +138,7 @@ static int corenet_cpufreq_cpu_init(strustruct cpufreq_frequency_table *table;struct cpu_data *data;unsigned int cpu = policy->cpu; -u64 transition_latency_hz; +u64 u64temp; np =of_get_cpu_node (cpu,NULL );if (!np)
@@ -206,9 +206,10 @@ static int corenet_cpufreq_cpu_init(strufor_each_cpu (i,per_cpu (cpu_mask, cpu))per_cpu (cpu_data, i) = data; - transition_latency_hz =12ULL *NSEC_PER_SEC ; - policy->cpuinfo.transition_latency = -do_div (transition_latency_hz,fsl_get_sys_freq ()); +/* Minimum transition latency is 12 platform clocks */ + u64temp =12ULL *NSEC_PER_SEC ; +do_div (u64temp,fsl_get_sys_freq ()); + policy->cpuinfo.transition_latency = u64temp +1 ;of_node_put (np);
Greg Kroah-Hartman
maintainerPATCH 55/66 cpufreq: unlock when failing cpufreq_update_policy()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Plattner <[email protected]>
commit fefa8ff810c5ab4c4206aed9d159c4d6fe8d4f1c upstream.
Commit bd0fa9bb455d introduced a failure path to cpufreq_update_policy() if cpufreq_driver->get(cpu) returns NULL. However, it jumps to the 'no_policy' label, which exits without unlocking any of the locks the function acquired earlier. This causes later calls into cpufreq to hang.
Fix this by creating a new 'unlock' label and jumping to that instead.
--- drivers/cpufreq/cpufreq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/cpufreq/cpufreq.c +4 -6
@@ -2166,10 +2166,8 @@ int cpufreq_update_policy(unsigned int cstruct cpufreq_policy new_policy;int ret; -if (!policy) { - ret = -ENODEV ; - goto no_policy; - } +if (!policy) +return -ENODEV ;down_write (&policy->rwsem);
@@ -2188,7 +2186,7 @@ int cpufreq_update_policy(unsigned int c new_policy.cur = cpufreq_driver->get (cpu);if (WARN_ON (!new_policy.cur)) { ret = -EIO ; - goto no_policy; + goto unlock; }if (!policy->cur) {
@@ -2203,10 +2201,10 @@ int cpufreq_update_policy(unsigned int c ret =cpufreq_set_policy (policy, &new_policy); +unlock:up_write (&policy->rwsem);cpufreq_cpu_put (policy); -no_policy:return ret; }EXPORT_SYMBOL (cpufreq_update_policy);
Greg Kroah-Hartman
maintainerPATCH 56/66 MIPS: KVM: Remove redundant NULL checks before kfree()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit c6c0a6637f9da54f9472144d44f71cf847f92e20 upstream.
The kfree() function already NULL checks the parameter so remove the redundant NULL checks before kfree() calls in arch/mips/kvm/.
--- arch/mips/kvm/kvm_mips.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
arch/mips/kvm/kvm_mips.c +3 -9
@@ -149,9 +149,7 @@ void kvm_mips_free_vcpus(struct kvm *kvmif (kvm->arch.guest_pmap[i] !=KVM_INVALID_PAGE )kvm_mips_release_pfn_clean (kvm->arch.guest_pmap[i]); } - -if (kvm->arch.guest_pmap) -kfree (kvm->arch.guest_pmap); +kfree (kvm->arch.guest_pmap);kvm_for_each_vcpu (i, vcpu, kvm) {kvm_arch_vcpu_free (vcpu);
@@ -389,12 +387,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpukvm_mips_dump_stats (vcpu); -if (vcpu->arch.guest_ebase) -kfree (vcpu->arch.guest_ebase); - -if (vcpu->arch.kseg0_commpage) -kfree (vcpu->arch.kseg0_commpage); - +kfree (vcpu->arch.guest_ebase); +kfree (vcpu->arch.kseg0_commpage); }void kvm_arch_vcpu_destroy (struct kvm_vcpu *vcpu)
Greg Kroah-Hartman
maintainerPATCH 57/66 MIPS: KVM: Fix memory leak on VCPU
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deng-Cheng Zhu <[email protected]>
commit 8c9eb041cf76038eb3b62ee259607eec9b89f48d upstream.
kvm_arch_vcpu_free() is called in 2 code paths:
1) kvm_vm_ioctl()
kvm_vm_ioctl_create_vcpu()
kvm_arch_vcpu_destroy()
kvm_arch_vcpu_free()
2) kvm_put_kvm()
kvm_destroy_vm()
kvm_arch_destroy_vm()
kvm_mips_free_vcpus()
kvm_arch_vcpu_free()
Neither of the paths handles VCPU free. We need to do it in kvm_arch_vcpu_free() corresponding to the memory allocation in kvm_arch_vcpu_create().
--- arch/mips/kvm/kvm_mips.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/kvm/kvm_mips.c +1 -0
@@ -389,6 +389,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpukfree (vcpu->arch.guest_ebase);kfree (vcpu->arch.kseg0_commpage); +kfree (vcpu); }void kvm_arch_vcpu_destroy (struct kvm_vcpu *vcpu)
Greg Kroah-Hartman
maintainerPATCH 58/66 ptrace,x86: force IRET path after a ptrace_stop()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit b9cd18de4db3c9ffa7e17b0dc0ca99ed5aa4d43a upstream.
The 'sysret' fastpath does not correctly restore even all regular registers, much less any segment registers or reflags values. That is very much part of why it's faster than 'iret'.
Normally that isn't a problem, because the normal ptrace() interface catches the process using the signal handler infrastructure, which always returns with an iret.
However, some paths can get caught using ptrace_event() instead of the signal path, and for those we need to make sure that we aren't going to return to user space using 'sysret'. Otherwise the modifications that may have been done to the register set by the tracer wouldn't necessarily take effect.
Fix it by forcing IRET path by setting TIF_NOTIFY_RESUME from arch_ptrace_stop_needed() which is invoked from ptrace_stop().
--- arch/x86/include/asm/ptrace.h | 16 ++++++++++++++++ include/linux/ptrace.h | 3 +++ 2 files changed, 19 insertions(+)
arch/x86/include/asm/ptrace.h +16 -0
@@ -231,6 +231,22 @@ static inline unsigned long regs_get_ker#define ARCH_HAS_USER_SINGLE_STEP_INFO +/* +* When hitting ptrace_stop(), we cannot return using SYSRET because +* that does not restore the full CPU state, only a minimal set. The +* ptracer can change arbitrary register values, which is usually okay +* because the usual ptrace stops run off the signal delivery path which +* forces IRET; however, ptrace_event() stops happen in arbitrary places +* in the kernel and don't force IRET path. +* +* So force IRET path after a ptrace stop. +*/ +#define arch_ptrace_stop_needed (code, info) \ +({ \ + set_thread_flag(TIF_NOTIFY_RESUME); \ + false; \ +}) +struct user_desc ;extern int do_get_thread_area (struct task_struct *p,int idx,struct user_desc __user *info);
include/linux/ptrace.h +3 -0
@@ -334,6 +334,9 @@ static inline void user_single_step_sigi* calling arch_ptrace_stop() when it would be superfluous. For example, * if the thread has not been back to user mode since the last stop, the * thread state might indicate that nothing needs to be done. +* +* This is guaranteed to be invoked once before a task stops for ptrace and +* may include arch-specific operations necessary prior to a ptrace stop. */ #define arch_ptrace_stop_needed (code, info) (0)#endif
Greg Kroah-Hartman
maintainerPATCH 59/66 lz4: add overrun checks to lz4_uncompress_unknownoutputsize()
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 4a3a99045177369700c60d074c0e525e8093b0fc upstream.
Jan points out that I forgot to make the needed fixes to the lz4_uncompress_unknownoutputsize() function to mirror the changes done in lz4_decompress() with regards to potential pointer overflows.
The only in-kernel user of this function is the zram code, which only takes data from a valid compressed buffer that it made itself, so it's not a big issue. But due to external kernel modules using this function, it's better to be safe here.
--- lib/lz4/lz4_decompress.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/lz4/lz4_decompress.c +5 -1
@@ -192,6 +192,8 @@ static int lz4_uncompress_unknownoutputsint s =255 ;while ((ip < iend) && (s ==255 )) { s = *ip++; +if (unlikely (length > (size_t )(length + s))) + goto _output_error; length += s; } }
@@ -232,6 +234,8 @@ static int lz4_uncompress_unknownoutputsif (length ==ML_MASK ) {while (ip < iend) {int s = *ip++; +if (unlikely (length > (size_t )(length + s))) + goto _output_error; length += s;if (s ==255 )continue ;
@@ -284,7 +288,7 @@ static int lz4_uncompress_unknownoutputs/* write overflow error detected */ _output_error: -return (int ) (-(((char *) ip) - source)); +return -1 ; } int lz4_decompress(const unsigned char *src, size_t *src_len,
Greg Kroah-Hartman
maintainerPATCH 60/66 Documentation/SubmittingPatches: describe the Fixes: tag
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
commit 8401aa1f59975c03eeebd3ac6d264cbdfe9af5de upstream.
Update the SubmittingPatches process to include howto about the new 'Fixes:' tag to be used when a patch fixes an issue in a previous commit (found by git-bisect for example).
--- Documentation/SubmittingPatches | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
Documentation/SubmittingPatches +21 -1
@@ -132,6 +132,20 @@ Example: platform_set_drvdata(), but left the variable "dev" unused, delete it. +If your patch fixes a bug in a specific commit, e.g. you found an issue using +git-bisect, please use the 'Fixes:' tag with the first 12 characters of the +SHA-1 ID, and the one line summary. +Example: + + Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()") + +The following git-config settings can be used to add a pretty format for +outputting the above style in the git log or git show commands + + [core] + abbrev = 12 + [pretty] + fixes = Fixes: %h (\"%s\") 3) Separate your changes.
@@ -443,7 +457,7 @@ person it names. This tag documents tha have been included in the discussion -14) Using Reported-by:, Tested-by:, Reviewed-by: and Suggested-by: +14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: If this patch fixes a problem reported by somebody else, consider adding a Reported-by: tag to credit the reporter for their contribution. Please
@@ -498,6 +512,12 @@ idea was not posted in a public forum. T idea reporters, they will, hopefully, be inspired to help us again in the future. +A Fixes: tag indicates that the patch fixes an issue in a previous commit. It +is used to make it easy to determine where a bug originated, which can help +review a bug fix. This tag also assists the stable kernel team in determining +which stable kernel versions should receive your fix. This is the preferred +method for indicating a bug fixed by the patch. See #2 above for more details. + 15) The canonical patch format
Greg Kroah-Hartman
maintainerPATCH 61/66 tracing: Try again for saved cmdline if failed due to locking
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 379cfdac37923653c9d4242d10052378b7563005 upstream.
In order to prevent the saved cmdline cache from being filled when tracing is not active, the comms are only recorded after a trace event is recorded.
The problem is, a comm can fail to be recorded if the trace_cmdline_lock is held. That lock is taken via a trylock to allow it to happen from any context (including NMI). If the lock fails to be taken, the comm is skipped. No big deal, as we will try again later.
But! Because of the code that was added to only record after an event, we may not try again later as the recording is made as a oneshot per event per CPU.
Only disable the recording of the comm if the comm is actually recorded.
--- kernel/trace/trace.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
kernel/trace/trace.c +7 -6
@@ -1461,12 +1461,12 @@ static void tracing_stop_tr(struct tracevoid trace_stop_cmdline_recording (void ); -static void trace_save_cmdline (struct task_struct *tsk) +static int trace_save_cmdline (struct task_struct *tsk) {unsigned pid, idx;if (!tsk->pid ||unlikely (tsk->pid >PID_MAX_DEFAULT )) -return ; +return 0 ;/* * It's not the end of the world if we don't get
@@ -1475,7 +1475,7 @@ static void trace_save_cmdline(struct ta* so if we miss here, then better luck next time. */ if (!arch_spin_trylock (&trace_cmdline_lock)) -return ; +return 0 ; idx = map_pid_to_cmdline[tsk->pid];if (idx ==NO_CMDLINE_MAP ) {
@@ -1500,6 +1500,8 @@ static void trace_save_cmdline(struct tamemcpy (&saved_cmdlines[idx], tsk->comm,TASK_COMM_LEN );arch_spin_unlock (&trace_cmdline_lock); + +return 1 ; }void trace_find_cmdline (int pid,char comm[])
@@ -1541,9 +1543,8 @@ void tracing_record_cmdline(struct task_if (!__this_cpu_read (trace_cmdline_save))return ; -__this_cpu_write (trace_cmdline_save, false); - -trace_save_cmdline (tsk); +if (trace_save_cmdline (tsk)) +__this_cpu_write (trace_cmdline_save, false); }void
Greg Kroah-Hartman
maintainerPATCH 62/66 tracing: Fix syscall_*regfunc() vs copy_process() race
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 4af4206be2bd1933cae20c2b6fb2058dbc887f7c upstream.
syscall_regfunc() and syscall_unregfunc() should set/clear TIF_SYSCALL_TRACEPOINT system-wide, but do_each_thread() can race with copy_process() and miss the new child which was not added to the process/thread lists yet.
Change copy_process() to update the child's TIF_SYSCALL_TRACEPOINT under tasklist.
--- include/trace/syscall.h | 15 +++++++++++++++ kernel/fork.c | 2 ++ 2 files changed, 17 insertions(+)
include/trace/syscall.h +15 -0
@@ -4,6 +4,7 @@#include <linux/tracepoint.h> #include <linux/unistd.h> #include <linux/ftrace_event.h> +#include <linux/thread_info.h> #include <asm/ptrace.h>
@@ -32,4 +33,18 @@ struct syscall_metadata { struct ftrace_event_call *exit_event; }; +#if defined(CONFIG_TRACEPOINTS ) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS ) +static inline void syscall_tracepoint_update (struct task_struct *p) +{ +if (test_thread_flag (TIF_SYSCALL_TRACEPOINT )) +set_tsk_thread_flag (p,TIF_SYSCALL_TRACEPOINT ); +else +clear_tsk_thread_flag (p,TIF_SYSCALL_TRACEPOINT ); +} +#else +static inline void syscall_tracepoint_update (struct task_struct *p) +{ +} +#endif +#endif /* _TRACE_SYSCALL_H */
kernel/fork.c +2 -0
@@ -1487,7 +1487,9 @@ static struct task_struct *copy_process( total_forks++;spin_unlock (¤t->sighand->siglock); +syscall_tracepoint_update (p);write_unlock_irq (&tasklist_lock); +proc_fork_connector (p);cgroup_post_fork (p);if (clone_flags &CLONE_THREAD )
Greg Kroah-Hartman
maintainerPATCH 63/66 ALSA: usb-audio: Fix races at disconnection and PCM closing
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 92a586bdc06de6629dae1b357dac221253f55ff8 upstream.
When a USB-audio device is disconnected while PCM is still running, we still see some race: the disconnect callback calls snd_usb_endpoint_free() that calls release_urbs() and then kfree() while a PCM stream would be closed at the same time and calls stop_endpoints() that leads to wait_clear_urbs(). That is, the EP object might be deallocated while a PCM stream is syncing with wait_clear_urbs() with the same EP.
Basically calling multiple wait_clear_urbs() would work fine, also calling wait_clear_urbs() and release_urbs() would work, too, as wait_clear_urbs() just reads some fields in ep. The problem is the succeeding kfree() in snd_pcm_endpoint_free().
This patch moves out the EP deallocation into the later point, the destructor callback. At this stage, all PCMs must have been already closed, so it's safe to free the objects.
--- sound/usb/card.c | 13 ++++++++++--- sound/usb/endpoint.c | 17 ++++++++++++++--- sound/usb/endpoint.h | 1 + 3 files changed, 25 insertions(+), 6 deletions(-)
sound/usb/card.c +10 -3
@@ -307,6 +307,11 @@ static int snd_usb_create_streams(structstatic int snd_usb_audio_free (struct snd_usb_audio *chip) { +struct list_head *p, *n; + +list_for_each_safe (p, n, &chip->ep_list) +snd_usb_endpoint_free (p); +mutex_destroy (&chip->mutex);kfree (chip);return 0 ;
@@ -585,7 +590,7 @@ static void snd_usb_audio_disconnect(str struct snd_usb_audio *chip) {struct snd_card *card; -struct list_head *p, *n; +struct list_head *p;if (chip == (void *)-1L )return ;
@@ -598,14 +603,16 @@ static void snd_usb_audio_disconnect(strmutex_lock (®ister_mutex); chip->num_interfaces--;if (chip->num_interfaces <=0 ) { +struct snd_usb_endpoint *ep; +snd_card_disconnect (card);/* release the pcm resources */ list_for_each (p, &chip->pcm_list) {snd_usb_stream_disconnect (p); }/* release the endpoint resources */ -list_for_each_safe (p, n, &chip->ep_list) { -snd_usb_endpoint_free (p); +list_for_each_entry (ep, &chip->ep_list, list) { +snd_usb_endpoint_release (ep); }/* release the midi resources */ list_for_each (p, &chip->midi_list) {
sound/usb/endpoint.c +14 -3
@@ -987,19 +987,30 @@ void snd_usb_endpoint_deactivate(struct }/** +* snd_usb_endpoint_release: Tear down an snd_usb_endpoint +* +* @ep: the endpoint to release +* +* This function does not care for the endpoint's use count but will tear +* down all the streaming URBs immediately. +*/ +void snd_usb_endpoint_release (struct snd_usb_endpoint *ep) +{ +release_urbs (ep,1 ); +} + +/** * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint * * @ep: the list header of the endpoint to free * -* This function does not care for the endpoint's use count but will tear -* down all the streaming URBs immediately and free all resources. +* This free all resources of the given ep. */ void snd_usb_endpoint_free (struct list_head *head) {struct snd_usb_endpoint *ep; ep = list_entry(head, struct snd_usb_endpoint, list); -release_urbs (ep,1 );kfree (ep); }
sound/usb/endpoint.h +1 -0
@@ -23,6 +23,7 @@ void snd_usb_endpoint_stop(struct snd_usvoid snd_usb_endpoint_sync_pending_stop (struct snd_usb_endpoint *ep);int snd_usb_endpoint_activate (struct snd_usb_endpoint *ep);void snd_usb_endpoint_deactivate (struct snd_usb_endpoint *ep); +void snd_usb_endpoint_release (struct snd_usb_endpoint *ep);void snd_usb_endpoint_free (struct list_head *head);int snd_usb_endpoint_implicit_feedback_sink (struct snd_usb_endpoint *ep);
Greg Kroah-Hartman
maintainerPATCH 64/66 ALSA: hda - hdmi: call overridden init on resume
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre Ossman <[email protected]>
commit a283368382c50345dff61525f493ea307f21ec9b upstream.
We need to call the proper init function in case it has been overridden, as it might restore things that the generic routing doesn't know anything about. E.g. AMD cards have special verbs that need resetting.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=77901
--- sound/pci/hda/patch_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +1 -1
@@ -2208,7 +2208,7 @@ static int generic_hdmi_resume(struct hdstruct hdmi_spec *spec = codec->spec;int pin_idx; -generic_hdmi_init (codec); + codec->patch_ops.init (codec);snd_hda_codec_resume_amp (codec);snd_hda_codec_resume_cache (codec);
Greg Kroah-Hartman
maintainerPATCH 65/66 ALSA: hda - Adjust speaker HPF and add LED support for HP Spectre 13
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 8b3dfdaf0c25a584cb31d04d2574115cf2d422ab upstream.
HP Spectre 13 has the IDT 92HD95 codec, and BIOS seems to set the default high-pass filter in some "safer" range, which results in the very soft tone from the built-in speakers in contrast to Windows. Also, the mute LED control is missing, since 92HD95 codec still has no HP-specific fixups for GPIO setups.
This patch adds these missing features: the HPF is adjusted by the vendor-specific verb, and the LED is set up from a DMI string (but with the default polarity = 0 assumption due to the incomplete BIOS on the given machine).
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=74841
--- Documentation/sound/alsa/HD-Audio-Models.txt | 5 ++ sound/pci/hda/patch_sigmatel.c | 58 ++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-)
Documentation/sound/alsa/HD-Audio-Models.txt +5 -0
@@ -286,6 +286,11 @@ STAC92HD83* hp-inv-led HP with broken BIOS for inverted mute LED auto BIOS setup (default) +STAC92HD95 +========== + hp-led LED support for HP laptops + hp-bass Bass HPF setup for HP Spectre 13 + STAC9872 ======== vaio VAIO laptop without SPDIF
sound/pci/hda/patch_sigmatel.c +57 -1
85 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 66/66 ALSA: hda - restore BCLK M/N values when resuming HSW/BDW display controller
In reply to Greg Kroah-Hartman3.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mengdong Lin <[email protected]>
commit a07187c992be945ab561b370cbb49cfd72064c3c upstream.
For Intel Haswell/Broadwell display HD-A controller, the 24MHz HD-A link BCLK is converted from Core Display Clock (CDCLK): BCLK = CDCLK * M / N And there are two registers EM4 and EM5 to program M, N value respectively. The EM4/EM5 values will be lost and when the display power well is disabled.
BIOS programs CDCLK selected by OEM and EM4/EM5, but BIOS has no idea about display power well on/off at runtime. So the M/N can be wrong if non-default CDCLK is used when the audio controller resumes, which results in an invalid BCLK and abnormal audio playback rate. So this patch saves and restores valid M/N values on controller suspend/resume.
And 'struct hda_intel' is defined to contain standard HD-A 'struct azx' and Intel specific fields, as Takashi suggested.
--- sound/pci/hda/hda_intel.c | 65 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 7 deletions(-)
sound/pci/hda/hda_intel.c +58 -7
@@ -282,6 +282,24 @@ static char *driver_short_names[] = { [AZX_DRIVER_GENERIC] = "HD-Audio Generic", }; + +/* Intel HSW/BDW display HDA controller Extended Mode registers. +* EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display +* Clock) to 24MHz BCLK: BCLK = CDCLK * M / N +* The values will be lost when the display power well is disabled. +*/ +#define ICH6_REG_EM4 0x100c +#define ICH6_REG_EM5 0x1010 + +struct hda_intel { +struct azx chip; + +/* HSW/BDW display HDA controller to restore BCLK from CDCLK */ +unsigned int bclk_m; +unsigned int bclk_n; +}; + +#ifdef CONFIG_X86 static void __mark_pages_wc (struct azx *chip,struct snd_dma_buffer *dmab,bool on) {
@@ -574,6 +592,22 @@ static int param_set_xint(const char *va#define azx_del_card_list (chip)/* NOP */ #endif /* CONFIG_PM */ +static void haswell_save_bclk (struct azx *chip) +{ + struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + + hda->bclk_m =azx_readw (chip,EM4 ); + hda->bclk_n =azx_readw (chip,EM5 ); +} + +static void haswell_restore_bclk (struct azx *chip) +{ + struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + +azx_writew (chip,EM4 , hda->bclk_m); +azx_writew (chip,EM5 , hda->bclk_n); +} +#if defined(CONFIG_PM_SLEEP ) || defined(SUPPORT_VGA_SWITCHEROO )/* * power management
@@ -600,6 +634,13 @@ static int azx_suspend(struct device *defree_irq (chip->irq, chip); chip->irq =-1 ; } + +/* Save BCLK M/N values before they become invalid in D3. +* Will test if display power well can be released now. +*/ +if (chip->driver_caps &AZX_DCAPS_I915_POWERWELL ) +haswell_save_bclk (chip); +if (chip->msi)pci_disable_msi (chip->pci);pci_disable_device (pci);
@@ -619,8 +660,10 @@ static int azx_resume(struct device *devif (chip->disabled)return 0 ; -if (chip->driver_caps &AZX_DCAPS_I915_POWERWELL ) +if (chip->driver_caps &AZX_DCAPS_I915_POWERWELL ) {hda_display_power (true); +haswell_restore_bclk (chip); + }pci_set_power_state (pci,PCI_D0 );pci_restore_state (pci);if (pci_enable_device (pci) <0 ) {
@@ -664,8 +707,10 @@ static int azx_runtime_suspend(struct deazx_stop_chip (chip);azx_enter_link_reset (chip);azx_clear_irq_pending (chip); -if (chip->driver_caps &AZX_DCAPS_I915_POWERWELL ) +if (chip->driver_caps &AZX_DCAPS_I915_POWERWELL ) { +haswell_save_bclk (chip);hda_display_power (false); + }return 0 ; }
@@ -683,8 +728,10 @@ static int azx_runtime_resume(struct devif (!(chip->driver_caps &AZX_DCAPS_PM_RUNTIME ))return 0 ; -if (chip->driver_caps &AZX_DCAPS_I915_POWERWELL ) +if (chip->driver_caps &AZX_DCAPS_I915_POWERWELL ) {hda_display_power (true); +haswell_restore_bclk (chip); + }/* Read STATESTS before controller reset */ status =azx_readw (chip,STATESTS );
@@ -877,6 +924,8 @@ static int register_vga_switcheroo(strucstatic int azx_free (struct azx *chip) {struct pci_dev *pci = chip->pci; + struct hda_intel *hda = container_of(chip, struct hda_intel, chip); +int i; if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
@@ -924,7 +973,7 @@ static int azx_free(struct azx *chip)hda_display_power (false);hda_i915_exit (); } -kfree (chip); +kfree (hda);return 0 ; }
@@ -1168,6 +1217,7 @@ static int azx_create(struct snd_card *cstatic struct snd_device_ops ops = { .dev_free = azx_dev_free, }; +struct hda_intel *hda;struct azx *chip;int err;
@@ -1177,13 +1227,14 @@ static int azx_create(struct snd_card *cif (err <0 )return err; - chip =kzalloc (sizeof (*chip),GFP_KERNEL ); -if (!chip) { -dev_err (card->dev,"Cannot allocate chip\n" ); + hda =kzalloc (sizeof (*hda),GFP_KERNEL ); +if (!hda) { +dev_err (card->dev,"Cannot allocate hda\n" );pci_disable_device (pci);return -ENOMEM ; } + chip = &hda->chip;spin_lock_init (&chip->reg_lock);mutex_init (&chip->open_mutex); chip->card = card;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.4 release. There are 66 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 Jul 6 22:13:57 UTC 2014. Anything received after that time might be too late.
Build results:
total: 144 pass: 136 skipped: 5 fail: 3
Failed builds:
powerpc:allmodconfig (binutils 2.23)
powerpc:allmodconfig (binutils 2.24)
unicore32:defconfig
Qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
On a side note, would be great if you can update the master branch of -stable at some point. It is still at -rc2.
Thanks,
Guenter
At Fri, 04 Jul 2014 22:48:02 -0700,
Quoted 18 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.15.4 release. There are 66 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 Jul 6 22:13:57 UTC 2014. Anything received after that time might be too late.
Build results:
total: 144 pass: 136 skipped: 5 fail: 3Failed builds:
powerpc:allmodconfig (binutils 2.23)
powerpc:allmodconfig (binutils 2.24)
unicore32:defconfig
Quoted 8 lines
Qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
On a side note, would be great if you can update the master branch of -stable at some point. It is still at -rc2.
This kernel passed my test.
- Test Cases:
- Build this kernel.
- Boot this kernel.
- Build the latest mainline kernel with this kernel.
- Test Tool:
https://github.com/satoru-takeuchi/test-linux-stable
- Test Result (kernel .config, ktest config and test log):
http://satoru-takeuchi.org/test-linux-stable/results/<version>-<test datetime>.tar.xz
- Build Environment:
- OS: Debian Jessy x86_64
- CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4
- memory: 8GB
- Test Target Environment:
- Debian Jessy x86_64 (KVM guest on the Build Environment)
- # of vCPU: 2
- memory: 2GB
Satoru
Quoted 4 lines
Thanks,
Guenter