ovl: allow zero size xattr
Subsystems (105)
[added to the 4.1 stable tree] USB: serial: ftdi_sio: add support for Yaesu SCU-18 cable
In reply to Sasha LevinFrom: Greg Kroah-Hartman <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit e03cdf22a2727c60307be6a729233edab3bfda9c ]
Harald Linden reports that the ftdi_sio driver works properly for the Yaesu SCU-18 cable if the device ids are added to the driver. So let's add them.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 1 + 2 files changed, 2 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -824,6 +824,7 @@ static const struct usb_device_id id_table_combined[] = { { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, + { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_SCU18) }, { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },/* Papouch devices based on FTDI chip */
drivers/usb/serial/ftdi_sio_ids.h +1 -0
@@ -615,6 +615,7 @@*/ #define RATOC_VENDOR_ID 0x0584#define RATOC_PRODUCT_ID_USB60F 0xb020 +#define RATOC_PRODUCT_ID_SCU18 0xb03a/* * Infineon Technologies
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] USB: cp210x: add ID for IAI USB to RS485 adaptor
In reply to Sasha LevinFrom: Peter Dedecker <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit f487c54ddd544e1c9172cd510954f697b77b76e3 ]
Added the USB serial console device ID for IAI Corp. RCB-CV-USB USB to RS485 adaptor.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -98,6 +98,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */ { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */ { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ + { USB_DEVICE(0x10C4, 0x81D7) }, /* IAI Corp. RCB-CV-USB USB to RS485 Adaptor */ { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ { USB_DEVICE(0x10C4, 0x81E8) }, /* Zephyr Bioharness */
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: compress: Disable GET_CODEC_CAPS ioctl for some architectures
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 462b3f161beb62eeb290f4ec52f5ead29a2f8ac7 ]
Some architectures like PowerPC can handle the maximum struct size in an ioctl only up to 13 bits, and struct snd_compr_codec_caps used by SNDRV_COMPRESS_GET_CODEC_CAPS ioctl overflows this limit. This problem was revealed recently by a powerpc change, as it's now treated as a fatal build error.
This patch is a stop-gap for that: for architectures with less than 14 bit ioctl struct size, get rid of the handling of the relevant ioctl. We should provide an alternative equivalent ioctl code later, but for now just paper over it. Luckily, the compress API hasn't been used on such architectures, so the impact must be effectively zero.
--- sound/core/compress_offload.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/core/compress_offload.c +11 -0
@@ -44,6 +44,13 @@#include <sound/compress_offload.h> #include <sound/compress_driver.h> +/* struct snd_compr_codec_caps overflows the ioctl bit size for some +* architectures, so we need to disable the relevant ioctls. +*/ +#if _IOC_SIZEBITS <14 +#define COMPR_CODEC_CAPS_OVERFLOW +#endif +/* TODO: * - add substream support for multiple devices in case of * SND_DYNAMIC_MINORS is not used
@@ -438,6 +445,7 @@ out:return retval; } +#ifndef COMPR_CODEC_CAPS_OVERFLOW static int snd_compr_get_codec_caps (struct snd_compr_stream *stream,unsigned long arg) {
@@ -461,6 +469,7 @@ out:kfree (caps);return retval; } +#endif /* !COMPR_CODEC_CAPS_OVERFLOW */ /* revisit this with snd_pcm_preallocate_xxx */ static int snd_compr_allocate_buffer(struct snd_compr_stream *stream,
@@ -799,9 +808,11 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)case _IOC_NR (SNDRV_COMPRESS_GET_CAPS ): retval =snd_compr_get_caps (stream, arg);break ; +#ifndef COMPR_CODEC_CAPS_OVERFLOW case _IOC_NR (SNDRV_COMPRESS_GET_CODEC_CAPS ): retval =snd_compr_get_codec_caps (stream, arg);break ; +#endif case _IOC_NR (SNDRV_COMPRESS_SET_PARAMS ): retval =snd_compr_set_params (stream, arg);break ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] panic: release stale console lock to always get the logbuf printed out
In reply to Sasha LevinFrom: Vitaly Kuznetsov <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 08d78658f393fefaa2e6507ea052c6f8ef4002a2 ]
In some cases we may end up killing the CPU holding the console lock while still having valuable data in logbuf. E.g. I'm observing the following:
- A crash is happening on one CPU and console_unlock() is being called on some other.
- console_unlock() tries to print out the buffer before releasing the lock and on slow console it takes time.
- in the meanwhile crashing CPU does lots of printk()-s with valuable data (which go to the logbuf) and sends IPIs to all other CPUs.
- console_unlock() finishes printing previous chunk and enables interrupts before trying to print out the rest, the CPU catches the IPI and never releases console lock.
This is not the only possible case: in VT/fb subsystems we have many other console_lock()/console_unlock() users. Non-masked interrupts (or receiving NMI in case of extreme slowness) will have the same result. Getting the whole console buffer printed out on crash should be top priority.
--- kernel/panic.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kernel/panic.c +10 -0
@@ -23,6 +23,7 @@#include <linux/sysrq.h> #include <linux/init.h> #include <linux/nmi.h> +#include <linux/console.h> #define PANIC_TIMER_STEP 100#define PANIC_BLINK_SPD 18
@@ -146,6 +147,15 @@ void panic(const char *fmt, ...)bust_spinlocks (0 ); +/* +* We may have ended up stopping the CPU holding the lock (in +* smp_send_stop()) while still having some valuable data in the console +* buffer. Try to acquire the lock then release it regardless of the +* result. The release will also print the buffers out. +*/ +console_trylock (); +console_unlock (); +if (!panic_blink) panic_blink = no_blink;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ideapad-laptop: Add Lenovo Yoga 700 to no_hw_rfkill dmi list
In reply to Sasha LevinFrom: Josh Boyer <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 6b31de3e698582fe0b8f7f4bab15831b73204800 ]
Like the Yoga 900 models the Lenovo Yoga 700 does not have a hw rfkill switch, and trying to read the hw rfkill switch through the ideapad module causes it to always reported blocking breaking wifi.
This commit adds the Lenovo Yoga 700 to the no_hw_rfkill dmi list, fixing the wifi breakage.
--- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/ideapad-laptop.c +7 -0
@@ -873,6 +873,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { }, }, { + .ident = "Lenovo Yoga 700", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 700"), + }, + }, + { .ident ="Lenovo Yoga 900" , .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] virtio_pci: fix use after free on release
In reply to Sasha LevinFrom: "Michael S. Tsirkin" <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2989be09a8a9d62a785137586ad941f916e08f83 ]
KASan detected a use-after-free error in virtio-pci remove code. In virtio_pci_remove(), vp_dev is still used after being freed in unregister_virtio_device() (in virtio_pci_release_dev() more precisely).
To fix, keep a reference until cleanup is done.
--- drivers/virtio/virtio_pci_common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/virtio/virtio_pci_common.c +2 -0
@@ -554,6 +554,7 @@ err_enable_device:static void virtio_pci_remove (struct pci_dev *pci_dev) {struct virtio_pci_device *vp_dev =pci_get_drvdata (pci_dev); +struct device *dev =get_device (&vp_dev->vdev.dev);unregister_virtio_device (&vp_dev->vdev);
@@ -564,6 +565,7 @@ static void virtio_pci_remove(struct pci_dev *pci_dev)pci_release_regions (pci_dev);pci_disable_device (pci_dev); +put_device (dev); }static struct pci_driver virtio_pci_driver = {
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] iscsi-target: Fix potential dead-lock during node acl delete
In reply to Sasha LevinFrom: Nicholas Bellinger <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 26a99c19f810b2593410899a5b304b21b47428a6 ]
This patch is a iscsi-target specific bug-fix for a dead-lock that can occur during explicit struct se_node_acl->acl_group se_session deletion via configfs rmdir(2), when iscsi-target time2retain timer is still active.
It changes iscsi-target to obtain se_portal_group->session_lock internally using spin_in_locked() to check for the specific se_node_acl configfs shutdown rmdir(2) case.
Note this patch is intended for stable, and the subsequent v4.5-rc patch converts target_core_tpg.c to use proper se_sess->sess_kref reference counting for both se_node_acl deletion + se_node_acl->queue_depth se_session restart.
--- drivers/target/iscsi/iscsi_target_configfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target_configfs.c +15 -1
@@ -1907,7 +1907,8 @@ static void lio_tpg_release_fabric_acl( }/* -* Called with spin_lock_bh(struct se_portal_group->session_lock) held.. +* Called with spin_lock_irq(struct se_portal_group->session_lock) held +* or not held. * * Also, this function calls iscsit_inc_session_usage_count() on the * struct iscsi_session in question.
@@ -1915,19 +1916,32 @@ static void lio_tpg_release_fabric_acl(static int lio_tpg_shutdown_session (struct se_session *se_sess) {struct iscsi_session *sess = se_sess->fabric_sess_ptr; +struct se_portal_group *se_tpg = se_sess->se_tpg; +bool local_lock = false; + +if (!spin_is_locked (&se_tpg->session_lock)) { +spin_lock_irq (&se_tpg->session_lock); + local_lock = true; + }spin_lock (&sess->conn_lock);if (atomic_read (&sess->session_fall_back_to_erl0) ||atomic_read (&sess->session_logout) || (sess->time2retain_timer_flags &ISCSI_TF_EXPIRED )) {spin_unlock (&sess->conn_lock); +if (local_lock) +spin_unlock_irq (&sess->conn_lock);return 0 ; }atomic_set (&sess->session_reinstatement,1 );spin_unlock (&sess->conn_lock);iscsit_stop_time2retain_timer (sess); +spin_unlock_irq (&se_tpg->session_lock); +iscsit_stop_session (sess,1 ,1 ); +if (!local_lock) +spin_lock_irq (&se_tpg->session_lock);return 1 ; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] USB: option: fix Cinterion AHxx enumeration
In reply to Sasha LevinFrom: John Ernberg <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 4152b387da81617c80cb2946b2d56e3958906b3e ]
In certain kernel configurations where the cdc_ether and option drivers are compiled as modules there can occur a race condition in enumeration. This causes the option driver to enumerate the ethernet(wwan) interface as usb-serial interfaces.
usb-devices output for the modem:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 5 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1e2d ProdID=0055 Rev=00.00 S: Manufacturer=Cinterion S: Product=AHx C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=10mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 4 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether I: If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
--- drivers/usb/serial/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/option.c +1 -1
@@ -1707,7 +1707,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: usb-audio: Fix TEAC UD-501/UD-503/NT-503 usb delay
In reply to Sasha LevinFrom: Guillaume Fougnies <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 5a4ff9ec8d6edd2ab1cfe8ce6a080d6e57cbea9a ]
TEAC UD-501/UD-503/NT-503 fail to switch properly between different rate/format. Similar to 'Playback Design', this patch corrects the invalid clock source error for TEAC products and avoids complete freeze of the usb interface of 503 series.
--- sound/usb/quirks.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
sound/usb/quirks.c +13 -1
@@ -1202,8 +1202,12 @@ void snd_usb_set_interface_quirk(struct usb_device *dev)* "Playback Design" products need a 50ms delay after setting the * USB interface. */ -if (le16_to_cpu (dev->descriptor.idVendor) ==0x23ba ) +switch (le16_to_cpu (dev->descriptor.idVendor)) { +case 0x23ba :/* Playback Design */ +case 0x0644 :/* TEAC Corp. */ mdelay (50 ); +break ; + } } void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
@@ -1218,6 +1222,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)mdelay (20 ); +/* +* "TEAC Corp." products need a 20ms delay after each +* class compliant request +*/ +if ((le16_to_cpu (dev->descriptor.idVendor) ==0x0644 ) && + (requesttype &USB_TYPE_MASK ) ==USB_TYPE_CLASS ) +mdelay (20 ); +/* Marantz/Denon devices with USB DAC functionality need a delay * after each class compliant request */
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: bebob: Use a signed return type for get_formation_index
In reply to Sasha LevinFrom: Lucas Tanure <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 07905298e4d5777eb58516cdc242f7ac1ca387a2 ]
The return type "unsigned int" was used by the get_formation_index function
despite of the aspect that it will eventually return a negative error code.
So, change to signed int and get index by reference in the parameters.
Done with the help of Coccinelle.
[Fix the missing braces suggested by Julia Lawall -- tiwai]
--- sound/firewire/bebob/bebob_stream.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
sound/firewire/bebob/bebob_stream.c +9 -5
@@ -47,14 +47,16 @@ static const unsigned int bridgeco_freq_table[] = { [6] = 0x07, }; -static unsigned int -get_formation_index (unsigned int rate) +static int +get_formation_index (unsigned int rate,unsigned int *index) {unsigned int i;for (i =0 ; i <ARRAY_SIZE (snd_bebob_rate_table); i++) { -if (snd_bebob_rate_table[i] == rate) -return i; +if (snd_bebob_rate_table[i] == rate) { + *index = i; +return 0 ; + } }return -EINVAL ; }
@@ -367,7 +369,9 @@ make_both_connections(struct snd_bebob *bebob, unsigned int rate) goto end;/* confirm params for both streams */ - index =get_formation_index (rate); + err =get_formation_index (rate, &index); +if (err <0 ) + goto end; pcm_channels = bebob->tx_stream_formations[index].pcm; midi_channels = bebob->tx_stream_formations[index].midi; amdtp_stream_set_parameters(&bebob->tx_stream,
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ocfs2/dlm: ignore cleaning the migration mle that is inuse
In reply to Sasha LevinFrom: xuejiufei <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit bef5502de074b6f6fa647b94b73155d675694420 ]
We have found that migration source will trigger a BUG that the refcount of mle is already zero before put when the target is down during migration. The situation is as follows:
dlm_migrate_lockres
dlm_add_migration_mle
dlm_mark_lockres_migrating
dlm_get_mle_inuse
<<<<<< Now the refcount of the mle is 2. dlm_send_one_lockres and wait for the target to become the new master.
<<<<<< o2hb detect the target down and clean the migration mle. Now the refcount is 1.
dlm_migrate_lockres woken, and put the mle twice when found the target goes down which trigger the BUG with the following message:
"ERROR: bad mle: ".
--- fs/ocfs2/dlm/dlmmaster.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
fs/ocfs2/dlm/dlmmaster.c +15 -11
@@ -2518,6 +2518,11 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,spin_lock (&dlm->master_lock); ret =dlm_add_migration_mle (dlm, res, mle, &oldmle, name, namelen, target, dlm->node_num); +/* get an extra reference on the mle. +* otherwise the assert_master from the new +* master will destroy this. +*/ +dlm_get_mle_inuse (mle);spin_unlock (&dlm->master_lock);spin_unlock (&dlm->spinlock);
@@ -2553,6 +2558,7 @@ fail:if (mle_added) {dlm_mle_detach_hb_events (dlm, mle);dlm_put_mle (mle); +dlm_put_mle_inuse (mle); }else if (mle) {kmem_cache_free (dlm_mle_cache, mle); mle =NULL ;
@@ -2570,17 +2576,6 @@ fail:* ensure that all assert_master work is flushed. */ flush_workqueue (dlm->dlm_worker); -/* get an extra reference on the mle. -* otherwise the assert_master from the new -* master will destroy this. -* also, make sure that all callers of dlm_get_mle -* take both dlm->spinlock and dlm->master_lock */ -spin_lock (&dlm->spinlock); -spin_lock (&dlm->master_lock); -dlm_get_mle_inuse (mle); -spin_unlock (&dlm->master_lock); -spin_unlock (&dlm->spinlock); -/* notify new node and send all lock state */ /* call send_one_lockres with migration flag. * this serves as notice to the target node that a
@@ -3309,6 +3304,15 @@ top: mle->new_master != dead_node)continue ; +if (mle->new_master == dead_node && mle->inuse) { +mlog (ML_NOTICE ,"%s: target %u died during " +"migration from %u, the MLE is " +"still keep used, ignore it!\n" , + dlm->name, dead_node, + mle->master); +continue ; + } +/* If we have reached this point, this mle needs to be * removed from the list and freed. */ dlm_clean_migration_mle (dlm, mle);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] SCSI: fix crashes in sd and sr runtime PM
In reply to Sasha LevinFrom: Alan Stern <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 13b4389143413a1f18127c07f72c74cad5b563e8 ]
Runtime suspend during driver probe and removal can cause problems. The driver's runtime_suspend or runtime_resume callbacks may invoked before the driver has finished binding to the device or after the driver has unbound from the device.
This problem shows up with the sd and sr drivers, and can cause disk or CD/DVD drives to become unusable as a result. The fix is simple. The drivers store a pointer to the scsi_disk or scsi_cd structure as their private device data when probing is finished, so we simply have to be sure to clear the private data during removal and test it during runtime suspend/resume.
This fixes <https://bugs.debian.org/801925>.
--- drivers/scsi/sd.c | 7 +++++-- drivers/scsi/sr.c | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/scsi/sd.c +5 -2
@@ -3141,8 +3141,8 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)struct scsi_disk *sdkp =dev_get_drvdata (dev);int ret =0 ; -if (!sdkp) -return 0 ;/* this can happen */ +if (!sdkp)/* E.g.: runtime suspend following sd_remove() */ +return 0 ;if (sdkp->WCE && sdkp->media_present) {sd_printk (KERN_NOTICE , sdkp,"Synchronizing SCSI cache\n" );
@@ -3181,6 +3181,9 @@ static int sd_resume(struct device *dev) {struct scsi_disk *sdkp =dev_get_drvdata (dev); +if (!sdkp)/* E.g.: runtime resume at the start of sd_probe() */ +return 0 ; +if (!sdkp->device->manage_start_stop)return 0 ;
drivers/scsi/sr.c +4 -0
@@ -144,6 +144,9 @@ static int sr_runtime_suspend(struct device *dev) {struct scsi_cd *cd =dev_get_drvdata (dev); +if (!cd)/* E.g.: runtime suspend following sr_remove() */ +return 0 ; +if (cd->media_present)return -EBUSY ;else
@@ -985,6 +988,7 @@ static int sr_remove(struct device *dev)scsi_autopm_get_device (cd->device);del_gendisk (cd->disk); +dev_set_drvdata (dev,NULL );mutex_lock (&sr_ref_mutex);kref_put (&cd->kref, sr_kref_release);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] tty: Fix unsafe ldisc reference via ioctl(TIOCGETD)
In reply to Sasha LevinFrom: Peter Hurley <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 5c17c861a357e9458001f021a7afa7aab9937439 ]
ioctl(TIOCGETD) retrieves the line discipline id directly from the ldisc because the line discipline id (c_line) in termios is untrustworthy; userspace may have set termios via ioctl(TCSETS*) without actually changing the line discipline via ioctl(TIOCSETD).
However, directly accessing the current ldisc via tty->ldisc is unsafe; the ldisc ptr dereferenced may be stale if the line discipline is changing via ioctl(TIOCSETD) or hangup.
Wait for the line discipline reference (just like read() or write()) to retrieve the "current" line discipline id.
--- drivers/tty/tty_io.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
drivers/tty/tty_io.c +23 -1
@@ -2670,6 +2670,28 @@ static int tiocsetd(struct tty_struct *tty, int __user *p) }/** +* tiocgetd - get line discipline +* @tty: tty device +* @p: pointer to user data +* +* Retrieves the line discipline id directly from the ldisc. +* +* Locking: waits for ldisc reference (in case the line discipline +* is changing or the tty is being hungup) +*/ + +static int tiocgetd (struct tty_struct *tty,int __user *p) +{ +struct tty_ldisc *ld; +int ret; + + ld =tty_ldisc_ref_wait (tty); + ret =put_user (ld->ops->num, p); +tty_ldisc_deref (ld); +return ret; +} + +/** * send_break - performed time break * @tty: device to break on * @duration: timeout in mS
@@ -2895,7 +2917,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)case TIOCGSID :return tiocgsid (tty, real_tty, p);case TIOCGETD : -return put_user (tty->ldisc->ops->num, (int __user *)p); +return tiocgetd (tty, p);case TIOCSETD :return tiocsetd (tty, p);case TIOCVHANGUP :
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] n_tty: Fix unsafe reference to "other" ldisc
In reply to Sasha LevinFrom: Peter Hurley <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 6d27a63caad3f13e96cf065d2d96828c2006be6b ]
Although n_tty_check_unthrottle() has a valid ldisc reference (since the tty core gets the ldisc ref in tty_read() before calling the line discipline read() method), it does not have a valid ldisc reference to the "other" pty of a pty pair. Since getting an ldisc reference for tty->link essentially open-codes tty_wakeup(), just replace with the equivalent tty_wakeup().
--- drivers/tty/n_tty.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/tty/n_tty.c +2 -5
@@ -258,16 +258,13 @@ static void n_tty_check_throttle(struct tty_struct *tty)static void n_tty_check_unthrottle (struct tty_struct *tty) { -if (tty->driver->type ==TTY_DRIVER_TYPE_PTY && - tty->link->ldisc->ops->write_wakeup == n_tty_write_wakeup) { +if (tty->driver->type ==TTY_DRIVER_TYPE_PTY ) {if (chars_in_buffer (tty) >TTY_THRESHOLD_UNTHROTTLE )return ;if (!tty->count)return ;n_tty_kick_worker (tty); -n_tty_write_wakeup (tty->link); -if (waitqueue_active (&tty->link->write_wait)) -wake_up_interruptible_poll (&tty->link->write_wait,POLLOUT ); +tty_wakeup (tty->link);return ; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] staging/speakup: Use tty_ldisc_ref() for paste kworker
In reply to Sasha LevinFrom: Peter Hurley <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit f4f9edcf9b5289ed96113e79fa65a7bf27ecb096 ]
As the function documentation for tty_ldisc_ref_wait() notes, it is only callable from a tty file_operations routine; otherwise there is no guarantee the ref won't be NULL.
The key difference with the VT's paste_selection() is that is an ioctl, where __speakup_paste_selection() is completely async kworker, kicked off from interrupt context.
tty (ab)usage to match vt")
--- drivers/staging/speakup/selection.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/speakup/selection.c +4 -1
@@ -141,7 +141,9 @@ static void __speakup_paste_selection(struct work_struct *work)struct tty_ldisc *ld;DECLARE_WAITQUEUE (wait, current); - ld =tty_ldisc_ref_wait (tty); + ld =tty_ldisc_ref (tty); +if (!ld) + goto tty_unref;tty_buffer_lock_exclusive (&vc->port);add_wait_queue (&vc->paste_wait, &wait);
@@ -161,6 +163,7 @@ static void __speakup_paste_selection(struct work_struct *work)tty_buffer_unlock_exclusive (&vc->port);tty_ldisc_deref (ld); +tty_unref:tty_kref_put (tty); }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] arm64: kernel: fix architected PMU registers unconditional access
In reply to Sasha LevinFrom: Lorenzo Pieralisi <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit f436b2ac90a095746beb6729b8ee8ed87c9eaede ]
The Performance Monitors extension is an optional feature of the AArch64 architecture, therefore, in order to access Performance Monitors registers safely, the kernel should detect the architected PMU unit presence through the ID_AA64DFR0_EL1 register PMUVer field before accessing them.
This patch implements a guard by reading the ID_AA64DFR0_EL1 register PMUVer field to detect the architected PMU presence and prevent accessing PMU system registers if the Performance Monitors extension is not implemented in the core.
--- arch/arm64/kernel/head.S | 5 +++++ arch/arm64/mm/proc-macros.S | 12 ++++++++++++ arch/arm64/mm/proc.S | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-)
arch/arm64/kernel/head.S +5 -0
@@ -566,9 +566,14 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems #endif /* EL2 debug */ + mrs x0, id_aa64dfr0_el1 // Check ID_AA64DFR0_EL1 PMUVer + sbfx x0, x0, #8, #4 + cmp x0, #1 + b.lt 4f // Skip if no PMU present mrs x0, pmcr_el0 // Disable debug access traps ubfx x0, x0, #11, #5 // to EL2 and allow access to msr mdcr_el2, x0 // all PMU counters from EL1 +4: /* Stage-2 translation */ msr vttbr_el2, xzr
arch/arm64/mm/proc-macros.S +12 -0
@@ -62,3 +62,15 @@ bfi \valreg, \tmpreg, #TCR_T0SZ_OFFSET, #TCR_TxSZ_WIDTH #endif .endm + +/* + * reset_pmuserenr_el0 - reset PMUSERENR_EL0 if PMUv3 present + */ + .macro reset_pmuserenr_el0, tmpreg + mrs \tmpreg, id_aa64dfr0_el1 // Check ID_AA64DFR0_EL1 PMUVer + sbfx \tmpreg, \tmpreg, #8, #4 + cmp \tmpreg, #1 // Skip if no PMU present + b.lt 9000f + msr pmuserenr_el0, xzr // Disable PMU access from EL0 +9000: + .endm
arch/arm64/mm/proc.S +2 -2
@@ -165,7 +165,7 @@ ENTRY(cpu_do_resume) */ ubfx x11, x11, #1, #1 msr oslar_el1, x11 - msr pmuserenr_el0, xzr // Disable PMU access from EL0 + reset_pmuserenr_el0 x0 // Disable PMU access from EL0 mov x0, x12 dsb nsh // Make sure local tlb invalidation completed isb
@@ -205,7 +205,7 @@ ENTRY(__cpu_setup) msr cpacr_el1, x0 // Enable FP/ASIMD mov x0, #1 << 12 // Reset mdscr_el1 and disable msr mdscr_el1, x0 // access to the DCC from EL0 - msr pmuserenr_el0, xzr // Disable PMU access from EL0 + reset_pmuserenr_el0 x0 // Disable PMU access from EL0 /* * Memory region attributes for LPAE: *
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] powerpc/eeh: Fix PE location code
In reply to Sasha LevinFrom: Gavin Shan <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 7e56f627768da4e6480986b5145dc3422bc448a5 ]
In eeh_pe_loc_get(), the PE location code is retrieved from the "ibm,loc-code" property of the device node for the bridge of the PE's primary bus. It's not correct because the property indicates the parent PE's location code.
This reads the correct PE location code from "ibm,io-base-loc-code" or "ibm,slot-location-code" property of PE parent bus's device node.
--- arch/powerpc/kernel/eeh_pe.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)
arch/powerpc/kernel/eeh_pe.c +15 -18
@@ -861,32 +861,29 @@ void eeh_pe_restore_bars(struct eeh_pe *pe)const char *eeh_pe_loc_get (struct eeh_pe *pe) {struct pci_bus *bus =eeh_pe_bus_get (pe); -struct device_node *dn =pci_bus_to_OF_node (bus); +struct device_node *dn;const char *loc =NULL ; -if (!dn) - goto out; +while (bus) { + dn =pci_bus_to_OF_node (bus); +if (!dn) { + bus = bus->parent; +continue ; + } -/* PHB PE or root PE ? */ -if (pci_is_root_bus (bus)) { - loc =of_get_property (dn,"ibm,loc-code" ,NULL ); -if (!loc) +if (pci_is_root_bus (bus)) loc =of_get_property (dn,"ibm,io-base-loc-code" ,NULL ); +else + loc =of_get_property (dn,"ibm,slot-location-code" , +NULL ); +if (loc) - goto out; +return loc; -/* Check the root port */ - dn = dn->child; -if (!dn) - goto out; + bus = bus->parent; } - loc =of_get_property (dn,"ibm,loc-code" ,NULL ); -if (!loc) - loc =of_get_property (dn,"ibm,slot-location-code" ,NULL ); - -out: -return loc ? loc :"N/A" ; +return "N/A" ; }/**
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] seccomp: always propagate NO_NEW_PRIVS on tsync
In reply to Sasha LevinFrom: Jann Horn <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 103502a35cfce0710909da874f092cb44823ca03 ]
Before this patch, a process with some permissive seccomp filter that was applied by root without NO_NEW_PRIVS was able to add more filters to itself without setting NO_NEW_PRIVS by setting the new filter from a throwaway thread with NO_NEW_PRIVS.
--- kernel/seccomp.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
kernel/seccomp.c +11 -11
@@ -317,24 +317,24 @@ static inline void seccomp_sync_threads(void)put_seccomp_filter (thread);smp_store_release (&thread->seccomp.filter, caller->seccomp.filter); + +/* +* Don't let an unprivileged task work around +* the no_new_privs restriction by creating +* a thread that sets it up, enters seccomp, +* then dies. +*/ +if (task_no_new_privs (caller)) +task_set_no_new_privs (thread); +/* * Opt the other thread into seccomp if needed. * As threads are considered to be trust-realm * equivalent (see ptrace_may_access), it is safe to * allow one thread to transition the other. */ -if (thread->seccomp.mode ==SECCOMP_MODE_DISABLED ) { -/* -* Don't let an unprivileged task work around -* the no_new_privs restriction by creating -* a thread that sets it up, enters seccomp, -* then dies. -*/ -if (task_no_new_privs (caller)) -task_set_no_new_privs (thread); - +if (thread->seccomp.mode ==SECCOMP_MODE_DISABLED )seccomp_assign_mode (thread,SECCOMP_MODE_FILTER ); - } } }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/radeon: rework audio modeset to handle non-audio hdmi features
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 7726e72b3d6879ee5fc743a230eb6f5afa12844b ]
Need to setup the deep color and avi packets regardless of audio setup.
--- drivers/gpu/drm/radeon/atombios_encoders.c | 3 +- drivers/gpu/drm/radeon/radeon_audio.c | 67 ++++++++++++++++++------------ 2 files changed, 41 insertions(+), 29 deletions(-)
drivers/gpu/drm/radeon/atombios_encoders.c +1 -2
@@ -2310,8 +2310,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, encoder_mode =atombios_get_encoder_mode (encoder);if (connector && (radeon_audio !=0 ) && ((encoder_mode ==ATOM_ENCODER_MODE_HDMI ) || - (ENCODER_MODE_IS_DP (encoder_mode) && -drm_detect_monitor_audio (radeon_connector_edid (connector))))) +ENCODER_MODE_IS_DP (encoder_mode)))radeon_audio_mode_set (encoder, adjusted_mode); }
drivers/gpu/drm/radeon/radeon_audio.c +40 -27
90 lines not on this page · raw message
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/radeon: Add a common function for DFS handling
In reply to Sasha LevinFrom: Slava Grigorev <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit a64c9dab1c4d05c87ec8a1cb9b48915816462143 ]
Move encoding of DFS (digital frequency synthesizer) divider into a separate function and improve calculation precision.
--- drivers/gpu/drm/radeon/dce6_afmt.c | 12 ++---------- drivers/gpu/drm/radeon/radeon_audio.c | 12 ++++++++++++ drivers/gpu/drm/radeon/radeon_audio.h | 1 + 3 files changed, 15 insertions(+), 10 deletions(-)
drivers/gpu/drm/radeon/dce6_afmt.c +2 -10
@@ -285,18 +285,10 @@ void dce6_dp_audio_set_dto(struct radeon_device *rdev,unsigned int div = (RREG32 (DENTIST_DISPCLK_CNTL ) &DENTIST_DPREFCLK_WDIVIDER_MASK ) >>DENTIST_DPREFCLK_WDIVIDER_SHIFT ; - -if (div <128 && div >=96 ) - div -=64 ; -else if (div >=64 ) - div = div /2 -16 ; -else if (div >=8 ) - div /=4 ; -else - div =0 ; + div =radeon_audio_decode_dfs_div (div);if (div) - clock /= div; + clock = clock *100 / div;WREG32 (DCE8_DCCG_AUDIO_DTO1_PHASE ,24000 );WREG32 (DCE8_DCCG_AUDIO_DTO1_MODULE , clock);
drivers/gpu/drm/radeon/radeon_audio.c +12 -0
@@ -775,3 +775,15 @@ void radeon_audio_dpms(struct drm_encoder *encoder, int mode)if (radeon_encoder->audio && radeon_encoder->audio->dpms) radeon_encoder->audio->dpms (encoder, mode ==DRM_MODE_DPMS_ON ); } + +unsigned int radeon_audio_decode_dfs_div (unsigned int div) +{ +if (div >=8 && div <64 ) +return (div -8 ) *25 +200 ; +else if (div >=64 && div <96 ) +return (div -64 ) *50 +1600 ; +else if (div >=96 && div <128 ) +return (div -96 ) *100 +3200 ; +else +return 0 ; +}
drivers/gpu/drm/radeon/radeon_audio.h +1 -0
@@ -79,5 +79,6 @@ void radeon_audio_fini(struct radeon_device *rdev);void radeon_audio_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode);void radeon_audio_dpms (struct drm_encoder *encoder,int mode); +unsigned int radeon_audio_decode_dfs_div (unsigned int div);#endif
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/radeon: cleaned up VCO output settings for DP audio
In reply to Sasha LevinFrom: Slava Grigorev <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit c9a392eac18409f51a071520cf508c0b4ad990e2 ]
This is preparation for the fixes in the following patches.
--- drivers/gpu/drm/radeon/dce6_afmt.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_atombios.c | 12 +++++++----- drivers/gpu/drm/radeon/radeon_audio.c | 8 +------- 4 files changed, 10 insertions(+), 14 deletions(-)
drivers/gpu/drm/radeon/dce6_afmt.c +1 -1
@@ -296,7 +296,7 @@ void dce6_dp_audio_set_dto(struct radeon_device *rdev, div =0 ;if (div) - clock = rdev->clock.gpupll_outputfreq *10 / div; + clock /= div;WREG32 (DCE8_DCCG_AUDIO_DTO1_PHASE ,24000 );WREG32 (DCE8_DCCG_AUDIO_DTO1_MODULE , clock);
drivers/gpu/drm/radeon/radeon.h +1 -1
@@ -268,7 +268,7 @@ struct radeon_clock {uint32_t current_dispclk;uint32_t dp_extclk;uint32_t max_pixel_clock; -uint32_t gpupll_outputfreq; +uint32_t vco_freq; };/*
drivers/gpu/drm/radeon/radeon_atombios.c +7 -5
@@ -1257,12 +1257,14 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) rdev->mode_info.firmware_flags =le16_to_cpu (firmware_info->info.usFirmwareCapability.susAccess); -if (ASIC_IS_DCE8 (rdev)) { - rdev->clock.gpupll_outputfreq = +if (ASIC_IS_DCE8 (rdev)) + rdev->clock.vco_freq =le32_to_cpu (firmware_info->info_22.ulGPUPLL_OutputFreq); -if (rdev->clock.gpupll_outputfreq ==0 ) - rdev->clock.gpupll_outputfreq =360000 ;/* 3.6 GHz */ - } +else + rdev->clock.vco_freq = rdev->clock.current_dispclk; + +if (rdev->clock.vco_freq ==0 ) + rdev->clock.vco_freq =360000 ;/* 3.6 GHz */ return true; }
drivers/gpu/drm/radeon/radeon_audio.c +1 -7
@@ -739,9 +739,6 @@ static void radeon_audio_dp_mode_set(struct drm_encoder *encoder,struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;struct drm_connector *connector =radeon_get_connector_for_encoder (encoder); -struct radeon_connector *radeon_connector =to_radeon_connector (connector); -struct radeon_connector_atom_dig *dig_connector = - radeon_connector->con_priv;if (!dig || !dig->afmt)return ;
@@ -753,10 +750,7 @@ static void radeon_audio_dp_mode_set(struct drm_encoder *encoder,radeon_audio_write_speaker_allocation (encoder);radeon_audio_write_sad_regs (encoder);radeon_audio_write_latency_fields (encoder, mode); -if (rdev->clock.dp_extclk ||ASIC_IS_DCE5 (rdev)) -radeon_audio_set_dto (encoder, rdev->clock.default_dispclk *10 ); -else -radeon_audio_set_dto (encoder, dig_connector->dp_clock); +radeon_audio_set_dto (encoder, rdev->clock.vco_freq *10 );radeon_audio_set_audio_packet (encoder);radeon_audio_select_pin (encoder);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/radeon: fix DP audio support for APU with DCE4.1 display engine
In reply to Sasha LevinFrom: Slava Grigorev <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit fe6fc1f132b4300c1f6defd43a5d673eb60a820d ]
Properly setup the DFS divider for DP audio for DCE4.1.
--- drivers/gpu/drm/radeon/evergreen_hdmi.c | 10 +++++++++ drivers/gpu/drm/radeon/evergreend.h | 5 +++++ drivers/gpu/drm/radeon/radeon_atombios.c | 37 +++++++++++++++++++++++++------- 3 files changed, 44 insertions(+), 8 deletions(-)
drivers/gpu/drm/radeon/evergreen_hdmi.c +10 -0
@@ -289,6 +289,16 @@ void dce4_dp_audio_set_dto(struct radeon_device *rdev,* number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator */ +if (ASIC_IS_DCE41 (rdev)) { +unsigned int div = (RREG32 (DCE41_DENTIST_DISPCLK_CNTL ) & +DENTIST_DPREFCLK_WDIVIDER_MASK ) >> +DENTIST_DPREFCLK_WDIVIDER_SHIFT ; + div =radeon_audio_decode_dfs_div (div); + +if (div) + clock =100 * clock / div; + } +WREG32 (DCCG_AUDIO_DTO1_PHASE ,24000 );WREG32 (DCCG_AUDIO_DTO1_MODULE , clock); }
drivers/gpu/drm/radeon/evergreend.h +5 -0
@@ -511,6 +511,11 @@#define DCCG_AUDIO_DTO1_CNTL 0x05cc# define DCCG_AUDIO_DTO1_USE_512FBR_DTO (1 << 3) +#define DCE41_DENTIST_DISPCLK_CNTL 0x049c +# define DENTIST_DPREFCLK_WDIVIDER (x) (((x) & 0x7f) << 24) +# define DENTIST_DPREFCLK_WDIVIDER_MASK (0x7f << 24) +# define DENTIST_DPREFCLK_WDIVIDER_SHIFT 24 +/* DCE 4.0 AFMT */ #define HDMI_CONTROL 0x7030# define HDMI_KEEPOUT_MODE (1 << 0)
drivers/gpu/drm/radeon/radeon_atombios.c +29 -8
@@ -1106,6 +1106,31 @@ union firmware_info {ATOM_FIRMWARE_INFO_V2_2 info_22; }; +union igp_info { +struct _ATOM_INTEGRATED_SYSTEM_INFO info; +struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2; +struct _ATOM_INTEGRATED_SYSTEM_INFO_V6 info_6; +struct _ATOM_INTEGRATED_SYSTEM_INFO_V1_7 info_7; +struct _ATOM_INTEGRATED_SYSTEM_INFO_V1_8 info_8; +}; + +static void radeon_atombios_get_dentist_vco_freq (struct radeon_device *rdev) +{ +struct radeon_mode_info *mode_info = &rdev->mode_info; +int index =GetIndexIntoMasterTable (DATA , IntegratedSystemInfo); +union igp_info *igp_info; +u8 frev, crev; +u16 data_offset; + +if (atom_parse_data_header (mode_info->atom_context, index,NULL , + &frev, &crev, &data_offset)) { + igp_info = (union igp_info *)(mode_info->atom_context->bios + + data_offset); + rdev->clock.vco_freq = +le32_to_cpu (igp_info->info_6.ulDentistVCOFreq); + } +} +bool radeon_atom_get_clock_info (struct drm_device *dev) {struct radeon_device *rdev = dev->dev_private;
@@ -1260,6 +1285,10 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)if (ASIC_IS_DCE8 (rdev)) rdev->clock.vco_freq =le32_to_cpu (firmware_info->info_22.ulGPUPLL_OutputFreq); +else if (ASIC_IS_DCE5 (rdev)) + rdev->clock.vco_freq = rdev->clock.current_dispclk; +else if (ASIC_IS_DCE41 (rdev)) +radeon_atombios_get_dentist_vco_freq (rdev);else rdev->clock.vco_freq = rdev->clock.current_dispclk;
@@ -1272,14 +1301,6 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)return false; } -union igp_info { -struct _ATOM_INTEGRATED_SYSTEM_INFO info; -struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2; -struct _ATOM_INTEGRATED_SYSTEM_INFO_V6 info_6; -struct _ATOM_INTEGRATED_SYSTEM_INFO_V1_7 info_7; -struct _ATOM_INTEGRATED_SYSTEM_INFO_V1_8 info_8; -}; -bool radeon_atombios_sideport_present (struct radeon_device *rdev) {struct radeon_mode_info *mode_info = &rdev->mode_info;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] x86/mm: Fix types used in pgprot cacheability flags translations
In reply to Sasha LevinFrom: Jan Beulich <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 3625c2c234ef66acf21a72d47a5ffa94f6c5ebf2 ]
For PAE kernels "unsigned long" is not suitable to hold page protection flags, since _PAGE_NX doesn't fit there. This is the reason for quite a few W+X pages getting reported as insecure during boot (observed namely for the entire initrd range).
--- arch/x86/include/asm/pgtable_types.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/include/asm/pgtable_types.h +2 -4
@@ -337,20 +337,18 @@ static inline enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) }static inline pgprot_t pgprot_4k_2_large (pgprot_t pgprot) { +pgprotval_t val =pgprot_val (pgprot);pgprot_t new; -unsigned long val; - val =pgprot_val (pgprot);pgprot_val (new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | ((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));return new; }static inline pgprot_t pgprot_large_2_4k (pgprot_t pgprot) { +pgprotval_t val =pgprot_val (pgprot);pgprot_t new; -unsigned long val; - val =pgprot_val (pgprot);pgprot_val (new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | ((val & _PAGE_PAT_LARGE) >> (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] KEYS: refcount bug fix
In reply to Sasha LevinFrom: Mimi Zohar <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 1d6d167c2efcfe9539d9cffb1a1be9c92e39c2c0 ]
This patch fixes the key_ref leak, removes the unnecessary KEY_FLAG_KEEP test before setting the flag, and cleans up the if/then brackets style introduced in commit:
d3600bc KEYS: prevent keys from being removed from specified keyrings
--- security/keys/key.c | 3 +-- security/keys/keyctl.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-)
security/keys/key.c +1 -2
@@ -430,8 +430,7 @@ static int __key_instantiate_and_link(struct key *key,/* and link it into the destination keyring */ if (keyring) { -if (test_bit (KEY_FLAG_KEEP , &keyring->flags)) -set_bit (KEY_FLAG_KEEP , &key->flags); +set_bit (KEY_FLAG_KEEP , &key->flags);__key_link (key, _edit); }
security/keys/keyctl.c +7 -10
@@ -387,12 +387,11 @@ long keyctl_revoke_key(key_serial_t id) } key =key_ref_to_ptr (key_ref); + ret =0 ;if (test_bit (KEY_FLAG_KEEP , &key->flags)) -return -EPERM ; -else { + ret = -EPERM ; +else key_revoke (key); - ret =0 ; - }key_ref_put (key_ref); error:
@@ -438,12 +437,11 @@ long keyctl_invalidate_key(key_serial_t id) invalidate: key =key_ref_to_ptr (key_ref); + ret =0 ;if (test_bit (KEY_FLAG_KEEP , &key->flags)) ret = -EPERM ; -else { +else key_invalidate (key); - ret =0 ; - } error_put:key_ref_put (key_ref); error:
@@ -1358,12 +1356,11 @@ long keyctl_set_timeout(key_serial_t id, unsigned timeout) okay: key =key_ref_to_ptr (key_ref); + ret =0 ;if (test_bit (KEY_FLAG_KEEP , &key->flags)) ret = -EPERM ; -else { +else key_set_timeout (key, timeout); - ret =0 ; - }key_put (key); error:
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] KEYS: prevent keys from being removed from specified keyrings
In reply to Sasha LevinFrom: Mimi Zohar <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit d3600bcf9d64d88dc1d189a754dcfab960ce751f ]
Userspace should not be allowed to remove keys from certain keyrings (eg. blacklist), though the keys themselves can expire.
This patch defines a new key flag named KEY_FLAG_KEEP to prevent userspace from being able to unlink, revoke, invalidate or timed out a key on a keyring. When this flag is set on the keyring, all keys subsequently added are flagged.
In addition, when this flag is set, the keyring itself can not be cleared.
--- include/linux/key.h | 1 + security/keys/key.c | 6 +++++- security/keys/keyctl.c | 56 +++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 52 insertions(+), 11 deletions(-)
include/linux/key.h +1 -0
@@ -172,6 +172,7 @@ struct key {#define KEY_FLAG_TRUSTED_ONLY 9/* set if keyring only accepts links to trusted keys */ #define KEY_FLAG_BUILTIN 10/* set if key is builtin */ #define KEY_FLAG_ROOT_CAN_INVAL 11/* set if key can be invalidated by root without permission */ +#define KEY_FLAG_KEEP 12/* set if key should not be removed */ /* the key type and key description string * - the desc is used to match a key against search criteria
security/keys/key.c +5 -1
@@ -429,8 +429,12 @@ static int __key_instantiate_and_link(struct key *key, awaken =1 ;/* and link it into the destination keyring */ -if (keyring) +if (keyring) { +if (test_bit (KEY_FLAG_KEEP , &keyring->flags)) +set_bit (KEY_FLAG_KEEP , &key->flags); +__key_link (key, _edit); + }/* disable the authorisation key */ if (authkey)
security/keys/keyctl.c +46 -10
137 lines not on this page · raw message
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/vmwgfx: respect 'nomodeset'
In reply to Sasha LevinFrom: Rob Clark <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 96c5d076f0a5e2023ecdb44d8261f87641ee71e0 ]
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +7 -0
@@ -25,6 +25,7 @@* **************************************************************************/ #include <linux/module.h> +#include <linux/console.h> #include <drm/drmP.h> #include "vmwgfx_drv.h"
@@ -1447,6 +1448,12 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)static int __init vmwgfx_init (void ) {int ret; + +#ifdef CONFIG_VGA_CONSOLE +if (vgacon_text_force ()) +return -EINVAL ; +#endif + ret =drm_pci_init (&driver, &vmw_pci_driver);if (ret)DRM_ERROR ("Failed initializing DRM.\n" );
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: dummy: Disable switching timer backend via sysfs
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 7ee96216c31aabe1eb42fb91ff50dae9fcd014b2 ]
ALSA dummy driver can switch the timer backend between system timer and hrtimer via its hrtimer module option. This can be also switched dynamically via sysfs, but it may lead to a memory corruption when switching is done while a PCM stream is running; the stream instance for the newly switched timer method tries to access the memory that was allocated by another timer method although the sizes differ.
As the simplest fix, this patch just disables the switch via sysfs by dropping the writable bit.
--- sound/drivers/dummy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/drivers/dummy.c +1 -1
@@ -87,7 +87,7 @@ MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-128) for dummy driver.");module_param (fake_buffer, bool,0444 );MODULE_PARM_DESC (fake_buffer,"Fake buffer allocations." );#ifdef CONFIG_HIGH_RES_TIMERS -module_param (hrtimer, bool,0644 ); +module_param (hrtimer, bool,0444 );MODULE_PARM_DESC (hrtimer,"Use hrtimer as the timer source." );#endif
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] KEYS: Only apply KEY_FLAG_KEEP to a key if a parent keyring has it set
In reply to Sasha LevinFrom: David Howells <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit eee045021fb22aeac7f5d6f2092430b530c880ee ]
KEY_FLAG_KEEP should only be applied to a key if the keyring it is being linked into has KEY_FLAG_KEEP set.
To this end, partially revert the following patch:
commit 1d6d167c2efcfe9539d9cffb1a1be9c92e39c2c0 Author: Mimi Zohar <[email protected]> Date: Thu Jan 7 07:46:36 2016 -0500 KEYS: refcount bug fix
to undo the change that made it unconditional (Mimi got it right the first time).
Without undoing this change, it becomes impossible to delete, revoke or invalidate keys added to keyrings through __key_instantiate_and_link() where the keyring has itself been linked to. To test this, run the following command sequence:
keyctl newring foo @s
keyctl add user a a %:foo
keyctl unlink %user:a %:foo
keyctl clear %:foo
With the commit mentioned above the third and fourth commands fail with EPERM when they should succeed.
--- security/keys/key.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/key.c +2 -1
@@ -430,7 +430,8 @@ static int __key_instantiate_and_link(struct key *key,/* and link it into the destination keyring */ if (keyring) { -set_bit (KEY_FLAG_KEEP , &key->flags); +if (test_bit (KEY_FLAG_KEEP , &keyring->flags)) +set_bit (KEY_FLAG_KEEP , &key->flags);__key_link (key, _edit); }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] arm64: mm: avoid calling apply_to_page_range on empty range
In reply to Sasha LevinFrom: Mika Penttilä <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 57adec866c0440976c96a4b8f5b59fb411b1cacb ]
Calling apply_to_page_range with an empty range results in a BUG_ON from the core code. This can be triggered by trying to load the st_drv module with CONFIG_DEBUG_SET_MODULE_RONX enabled:
kernel BUG at mm/memory.c:1874!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in: CPU: 3 PID: 1764 Comm: insmod Not tainted 4.5.0-rc1+ #2 Hardware name: ARM Juno development board (r0) (DT) task: ffffffc9763b8000 ti: ffffffc975af8000 task.ti: ffffffc975af8000 PC is at apply_to_page_range+0x2cc/0x2d0 LR is at change_memory_common+0x80/0x108
This patch fixes the issue by making change_memory_common (called by the set_memory_* functions) a NOP when numpages == 0, therefore avoiding the erroneous call to apply_to_page_range and bringing us into line with x86 and s390.
--- arch/arm64/mm/pageattr.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/mm/pageattr.c +3 -0
@@ -57,6 +57,9 @@ static int change_memory_common(unsigned long addr, int numpages,if (end <MODULES_VADDR || end >=MODULES_END )return -EINVAL ; +if (!numpages) +return 0 ; + data.set_mask = set_mask; data.clear_mask = clear_mask;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] Staging: speakup: Fix getting port information
In reply to Sasha LevinFrom: Samuel Thibault <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 327b882d3bcc1fba82dbd39b5cf5a838c81218e2 ]
Commit f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h>") broke the port information in the speakup
driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included, and no other header includes asm/serial.h.
We here make sure serialio.c does get the arch-specific definition of SERIAL_PORT_DFNS from asm/serial.h, if any.
Along the way, this makes sure that we do have information for the requested serial port number (index)
--- drivers/staging/speakup/serialio.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/staging/speakup/serialio.c +12 -1
@@ -6,6 +6,11 @@#include "spk_priv.h" #include "serialio.h" +#include <linux/serial_core.h> +/* WARNING: Do not change this to <linux/serial.h> without testing that +* SERIAL_PORT_DFNS does get defined to the appropriate value. */ +#include <asm/serial.h> +#ifndef SERIAL_PORT_DFNS #define SERIAL_PORT_DFNS #endif
@@ -23,9 +28,15 @@ const struct old_serial_port *spk_serial_init(int index)int baud =9600 , quot =0 ;unsigned int cval =0 ;int cflag =CREAD |HUPCL |CLOCAL |B9600 |CS8 ; -const struct old_serial_port *ser = rs_table + index; +const struct old_serial_port *ser;int err; +if (index >=ARRAY_SIZE (rs_table)) { +pr_info ("no port info for ttyS%d\n" , index); +return NULL ; + } + ser = rs_table + index; +/* Divisor, bytesize and parity */ quot = ser->baud_base / baud; cval = cflag & (CSIZE |CSTOPB );
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] serial: 8250_pci: Add Intel Broadwell ports
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 6c55d9b98335f7f6bd5f061866ff1633401f3a44 ]
Some recent (early 2015) macbooks have Intel Broadwell where LPSS UARTs are PCI enumerated instead of ACPI. The LPSS UART block is pretty much same as used on Intel Baytrail so we can reuse the existing Baytrail setup code.
Add both Broadwell LPSS UART ports to the list of supported devices.
--- drivers/tty/serial/8250/8250_pci.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/tty/serial/8250/8250_pci.c +29 -0
@@ -1380,6 +1380,9 @@ ce4100_serial_setup(struct serial_private *priv,#define PCI_DEVICE_ID_INTEL_BSW_UART1 0x228a#define PCI_DEVICE_ID_INTEL_BSW_UART2 0x228c +#define PCI_DEVICE_ID_INTEL_BDW_UART1 0x9ce3 +#define PCI_DEVICE_ID_INTEL_BDW_UART2 0x9ce4 +#define BYT_PRV_CLK 0x800#define BYT_PRV_CLK_EN (1 << 0)#define BYT_PRV_CLK_M_VAL_SHIFT 1
@@ -1458,11 +1461,13 @@ byt_serial_setup(struct serial_private *priv,switch (pdev->device) {case PCI_DEVICE_ID_INTEL_BYT_UART1 :case PCI_DEVICE_ID_INTEL_BSW_UART1 : +case PCI_DEVICE_ID_INTEL_BDW_UART1 : rx_param->src_id =3 ; tx_param->dst_id =2 ;break ;case PCI_DEVICE_ID_INTEL_BYT_UART2 :case PCI_DEVICE_ID_INTEL_BSW_UART2 : +case PCI_DEVICE_ID_INTEL_BDW_UART2 : rx_param->src_id =5 ; tx_param->dst_id =4 ;break ;
@@ -2154,6 +2159,20 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .subdevice = PCI_ANY_ID, .setup = byt_serial_setup, }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_BDW_UART1, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = byt_serial_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_BDW_UART2, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = byt_serial_setup, + }, /* * ITE */
@@ -5603,6 +5622,16 @@ static struct pci_device_id serial_pci_tbl[] = {PCI_CLASS_COMMUNICATION_SERIAL <<8 ,0xff0000 , pbn_byt }, +/* Intel Broadwell */ + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BDW_UART1, +PCI_ANY_ID ,PCI_ANY_ID , +PCI_CLASS_COMMUNICATION_SERIAL <<8 ,0xff0000 , + pbn_byt }, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BDW_UART2, +PCI_ANY_ID ,PCI_ANY_ID , +PCI_CLASS_COMMUNICATION_SERIAL <<8 ,0xff0000 , + pbn_byt }, +/* * Intel Penwell */
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ocfs2: NFS hangs in __ocfs2_cluster_lock due to race with ocfs2_unblock_lock
In reply to Sasha LevinFrom: Tariq Saeed <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit b1b1e15ef6b80facf76d6757649dfd7295eda29f ]
NFS on a 2 node ocfs2 cluster each node exporting dir. The lock causing the hang is the global bit map inode lock. Node 1 is master, has the lock granted in PR mode; Node 2 is in the converting list (PR -> EX). There are no holders of the lock on the master node so it should downconvert to NL and grant EX to node 2 but that does not happen. BLOCKED + QUEUED in lock res are set and it is on osb blocked list. Threads are waiting in __ocfs2_cluster_lock on BLOCKED. One thread wants EX, rest want PR. So it is as though the downconvert thread needs to be kicked to complete the conv.
The hang is caused by an EX req coming into __ocfs2_cluster_lock on the heels of a PR req after it sets BUSY (drops l_lock, releasing EX thread), forcing the incoming EX to wait on BUSY without doing anything. PR has called ocfs2_dlm_lock, which sets the node 1 lock from NL -> PR, queues ast.
At this time, upconvert (PR ->EX) arrives from node 2, finds conflict with node 1 lock in PR, so the lock res is put on dlm thread's dirty listt.
After ret from ocf2_dlm_lock, PR thread now waits behind EX on BUSY till awoken by ast.
Now it is dlm_thread that serially runs dlm_shuffle_lists, ast, bast, in that order. dlm_shuffle_lists ques a bast on behalf of node 2 (which will be run by dlm_thread right after the ast). ast does its part, sets UPCONVERT_FINISHING, clears BUSY and wakes its waiters. Next, dlm_thread runs bast. It sets BLOCKED and kicks dc thread. dc thread runs ocfs2_unblock_lock, but since UPCONVERT_FINISHING set, skips doing anything and reques.
Inside of __ocfs2_cluster_lock, since EX has been waiting on BUSY ahead of PR, it wakes up first, finds BLOCKED set and skips doing anything but clearing UPCONVERT_FINISHING (which was actually "meant" for the PR thread), and this time waits on BLOCKED. Next, the PR thread comes out of wait but since UPCONVERT_FINISHING is not set, it skips updating the l_ro_holders and goes straight to wait on BLOCKED. So there, we have a hang! Threads in __ocfs2_cluster_lock wait on BLOCKED, lock res in osb blocked list. Only when dc thread is awoken, it will run ocfs2_unblock_lock and things will unhang.
One way to fix this is to wake the dc thread on the flag after clearing UPCONVERT_FINISHING
Orabug: 20933419
--- fs/ocfs2/dlmglue.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ocfs2/dlmglue.c +6 -0
@@ -1390,6 +1390,7 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,unsigned int gen;int noqueue_attempted =0 ;int dlm_locked =0 ; +int kick_dc =0 ;if (!(lockres->l_flags &OCFS2_LOCK_INITIALIZED )) {mlog_errno (-EINVAL );
@@ -1524,7 +1525,12 @@ update_holders: unlock:lockres_clear_flags (lockres,OCFS2_LOCK_UPCONVERT_FINISHING ); +/* ocfs2_unblock_lock reques on seeing OCFS2_LOCK_UPCONVERT_FINISHING */ + kick_dc = (lockres->l_flags &OCFS2_LOCK_BLOCKED ); +spin_unlock_irqrestore (&lockres->l_lock, flags); +if (kick_dc) +ocfs2_wake_downconvert_thread (osb); out:/* * This is helping work around a lock inversion between the page lock
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
In reply to Sasha LevinFrom: Insu Yun <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2c3033a0664dfae91e1dee7fabac10f24354b958 ]
In acpiphp_enable_slot(), there is a missing unlock path when error occurred. It needs to be unlocked before returning an error.
--- drivers/pci/hotplug/acpiphp_glue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/hotplug/acpiphp_glue.c +3 -1
@@ -954,8 +954,10 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) {pci_lock_rescan_remove (); -if (slot->flags &SLOT_IS_GOING_AWAY ) +if (slot->flags &SLOT_IS_GOING_AWAY ) { +pci_unlock_rescan_remove ();return -ENODEV ; + }/* configure all functions */ if (!(slot->flags &SLOT_ENABLED ))
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] rfkill: fix rfkill_fop_read wait_event usage
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 6736fde9672ff6717ac576e9bba2fd5f3dfec822 ]
The code within wait_event_interruptible() is called with !TASK_RUNNING, so mustn't call any functions that can sleep, like mutex_lock().
Since we re-check the list_empty() in a loop after the wait, it's safe to simply use list_empty() without locking.
This bug has existed forever, but was only discovered now because all userspace implementations, including the default 'rfkill' tool, use poll() or select() to get a readable fd before attempting to read.
--- net/rfkill/core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
net/rfkill/core.c +4 -12
@@ -1081,17 +1081,6 @@ static unsigned int rfkill_fop_poll(struct file *file, poll_table *wait)return res; } -static bool rfkill_readable (struct rfkill_data *data) -{ -bool r; - -mutex_lock (&data->mtx); - r = !list_empty (&data->events); -mutex_unlock (&data->mtx); - -return r; -} -static ssize_t rfkill_fop_read (struct file *file,char __user *buf,size_t count,loff_t *pos) {
@@ -1108,8 +1097,11 @@ static ssize_t rfkill_fop_read(struct file *file, char __user *buf, goto out; }mutex_unlock (&data->mtx); +/* since we re-check and it just compares pointers, +* using !list_empty() without locking isn't a problem +*/ ret =wait_event_interruptible (data->read_wait, -rfkill_readable (data)); + !list_empty (&data->events));mutex_lock (&data->mtx);if (ret)
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] x86/mm/pat: Avoid truncation when converting cpa->numpages to address
In reply to Sasha LevinFrom: Matt Fleming <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 742563777e8da62197d6cb4b99f4027f59454735 ]
There are a couple of nasty truncation bugs lurking in the pageattr code that can be triggered when mapping EFI regions, e.g. when we pass a cpa->pgd pointer. Because cpa->numpages is a 32-bit value, shifting left by PAGE_SHIFT will truncate the resultant address to 32-bits.
Viorel-Cătălin managed to trigger this bug on his Dell machine that provides a ~5GB EFI region which requires 1236992 pages to be mapped. When calling populate_pud() the end of the region gets calculated incorrectly in the following buggy expression,
end = start + (cpa->numpages << PAGE_SHIFT);
And only 188416 pages are mapped. Next, populate_pud() gets invoked for a second time because of the loop in __change_page_attr_set_clr(), only this time no pages get mapped because shifting the remaining number of pages (1048576) by PAGE_SHIFT is zero. At which point the loop in __change_page_attr_set_clr() spins forever because we fail to map progress.
Hitting this bug depends very much on the virtual address we pick to map the large region at and how many pages we map on the initial run through the loop. This explains why this issue was only recently hit with the introduction of commit
a5caa209ba9c ("x86/efi: Fix boot crash by mapping EFI memmap
entries bottom-up at runtime, instead of top-down")
It's interesting to note that safe uses of cpa->numpages do exist in the pageattr code. If instead of shifting ->numpages we multiply by PAGE_SIZE, no truncation occurs because PAGE_SIZE is a UL value, and so the result is unsigned long.
To avoid surprises when users try to convert very large cpa->numpages values to addresses, change the data type from 'int' to 'unsigned long', thereby making it suitable for shifting by PAGE_SHIFT without any type casting.
The alternative would be to make liberal use of casting, but that is far more likely to cause problems in the future when someone adds more code and fails to cast properly; this bug was difficult enough to track down in the first place.
--- arch/x86/mm/pageattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/pageattr.c +2 -2
@@ -33,7 +33,7 @@ struct cpa_data {pgd_t *pgd;pgprot_t mask_set;pgprot_t mask_clr; -int numpages; +unsigned long numpages;int flags;unsigned long pfn; unsigned force_split : 1;
@@ -1324,7 +1324,7 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)* CPA operation. Either a large page has been * preserved or a single page update happened. */ -BUG_ON (cpa->numpages > numpages); +BUG_ON (cpa->numpages > numpages || !cpa->numpages); numpages -= cpa->numpages;if (cpa->flags & (CPA_PAGES_ARRAY |CPA_ARRAY )) cpa->curpage++;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
In reply to Sasha LevinFrom: Milo Kim <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 49f34134aea74f19ca016f055d25ee55ec359dee ]
Atmel AIC has common structure for SMR (Source Mode Register).
bit[6:5] Interrupt source type
bit[2:0] Priority level
Other bits are unused.
To update new priority value, bit[2:0] should be cleared first and then new priority level can be written. However, aic_common_set_priority() helper clears source type bits instead of priority bits. This patch fixes wrong mask bit operation.
--- drivers/irqchip/irq-atmel-aic-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -1
@@ -86,7 +86,7 @@ int aic_common_set_priority(int priority, unsigned *val) priority > AT91_AIC_IRQ_MAX_PRIORITY)return -EINVAL ; - *val &=AT91_AIC_PRIOR ; + *val &= ~AT91_AIC_PRIOR ; *val |= priority;return 0 ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] mac80211: Requeue work after scan complete for all VIF types.
In reply to Sasha LevinFrom: Sachin Kulkarni <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 4fa11ec726a32ea6dd768dbb2e2af3453a98ec0a ]
During a sw scan ieee80211_iface_work ignores work items for all vifs. However after the scan complete work is requeued only for STA, ADHOC and MESH iftypes.
This occasionally results in event processing getting delayed/not processed for iftype AP when it coexists with a STA. This can result in data halt and eventually disconnection on the AP interface.
--- net/mac80211/ibss.c | 1 - net/mac80211/mesh.c | 11 ----------- net/mac80211/mesh.h | 4 ---- net/mac80211/mlme.c | 2 -- net/mac80211/scan.c | 12 +++++++++++- 5 files changed, 11 insertions(+), 19 deletions(-)
net/mac80211/ibss.c +0 -1
@@ -1727,7 +1727,6 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local)if (sdata->vif.type !=NL80211_IFTYPE_ADHOC )continue ; sdata->u.ibss.last_scan_completed = jiffies; -ieee80211_queue_work (&local->hw, &sdata->work); }mutex_unlock (&local->iflist_mtx); }
net/mac80211/mesh.c +0 -11
@@ -1299,17 +1299,6 @@ out:sdata_unlock (sdata); } -void ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local) -{ -struct ieee80211_sub_if_data *sdata; - -rcu_read_lock (); -list_for_each_entry_rcu (sdata, &local->interfaces, list) -if (ieee80211_vif_is_mesh (&sdata->vif) && -ieee80211_sdata_running (sdata)) -ieee80211_queue_work (&local->hw, &sdata->work); -rcu_read_unlock (); -}void ieee80211_mesh_init_sdata (struct ieee80211_sub_if_data *sdata) {
net/mac80211/mesh.h +0 -4
@@ -358,14 +358,10 @@ static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata) return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP; } -void ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local); -void mesh_path_flush_by_iface (struct ieee80211_sub_if_data *sdata);void mesh_sync_adjust_tbtt (struct ieee80211_sub_if_data *sdata);void ieee80211s_stop (void );#else -static inline void -ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local) {}static inline bool mesh_path_sel_is_hwmp (struct ieee80211_sub_if_data *sdata) {return false; }static inline void mesh_path_flush_by_iface (struct ieee80211_sub_if_data *sdata)
net/mac80211/mlme.c +0 -2
@@ -4002,8 +4002,6 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)if (!(flags &IEEE80211_HW_CONNECTION_MONITOR ))ieee80211_queue_work (&sdata->local->hw, &sdata->u.mgd.monitor_work); -/* and do all the other regular work too */ -ieee80211_queue_work (&sdata->local->hw, &sdata->work); } }
net/mac80211/scan.c +11 -1
@@ -310,6 +310,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)bool was_scanning = local->scanning;struct cfg80211_scan_request *scan_req;struct ieee80211_sub_if_data *scan_sdata; +struct ieee80211_sub_if_data *sdata;lockdep_assert_held (&local->mtx);
@@ -369,7 +370,16 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)ieee80211_mlme_notify_scan_completed (local);ieee80211_ibss_notify_scan_completed (local); -ieee80211_mesh_notify_scan_completed (local); + +/* Requeue all the work that might have been ignored while +* the scan was in progress; if there was none this will +* just be a no-op for the particular interface. +*/ +list_for_each_entry_rcu (sdata, &local->interfaces, list) { +if (ieee80211_sdata_running (sdata)) +ieee80211_queue_work (&sdata->local->hw, &sdata->work); + } +if (was_scanning)ieee80211_start_next_roc (local); }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: dts: at91: sama5d4ek: add phy address and IRQ for macb0
In reply to Sasha LevinFrom: Wenyou Yang <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit aae6b18f5c95b9dc78de66d1e27e8afeee2763b7 ]
On SAMA5D4EK board, the Ethernet doesn't work after resuming from the suspend state.
--- arch/arm/boot/dts/at91-sama5d4ek.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/at91-sama5d4ek.dts +11 -0
@@ -141,8 +141,15 @@ }; macb0: ethernet@f8020000 { + pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>; phy-mode = "rmii"; status = "okay"; + + ethernet-phy@1 { + reg = <0x1>; + interrupt-parent = <&pioE>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>; + }; }; mmc1: mmc@fc000000 {
@@ -174,6 +181,10 @@ pinctrl@fc06a000 { board { + pinctrl_macb0_phy_irq: macb0_phy_irq { + atmel,pins = + <AT91_PIOE 1 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; pinctrl_mmc0_cd: mmc0_cd { atmel,pins = <AT91_PIOE 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: dts: at91: sama5d4 xplained: fix phy0 IRQ type
In reply to Sasha LevinFrom: Nicolas Ferre <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit e873cc022ce5e2c04bbc53b5874494b657e29d3f ]
For phy0 KSZ8081, the type of GPIO IRQ should be "level low" instead of "edge falling".
--- arch/arm/boot/dts/at91-sama5d4_xplained.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/at91-sama5d4_xplained.dts +1 -1
@@ -98,7 +98,7 @@ phy0: ethernet-phy@1 { interrupt-parent = <&pioE>; - interrupts = <1 IRQ_TYPE_EDGE_FALLING>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>; reg = <1>; }; };
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/i915/dp: fall back to 18 bpp when sink capability is unknown
In reply to Sasha LevinFrom: Jani Nikula <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 5efd407674068dede403551bea3b0b134c32513a ]
Per DP spec, the source device should fall back to 18 bpp, VESA range RGB when the sink capability is unknown. Fix the color depth clamping. 18 bpp color depth should ensure full color range in automatic mode.
The clamping has been HDMI specific since its introduction in
commit 996a2239f93b03c5972923f04b097f65565c5bed
Author: Daniel Vetter <[email protected]> Date: Fri Apr 19 11:24:34 2013 +0200
drm/i915: Disable high-bpc on pre-1.4 EDID screens
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=105331
--- drivers/gpu/drm/i915/intel_display.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +15 -5
@@ -10391,11 +10391,21 @@ connected_sink_compute_bpp(struct intel_connector *connector, pipe_config->pipe_bpp = connector->base.display_info.bpc*3 ; } -/* Clamp bpp to 8 on screens without EDID 1.4 */ -if (connector->base.display_info.bpc ==0 && bpp >24 ) { -DRM_DEBUG_KMS ("clamping display bpp (was %d) to default limit of 24\n" , - bpp); - pipe_config->pipe_bpp =24 ; +/* Clamp bpp to default limit on screens without EDID 1.4 */ +if (connector->base.display_info.bpc ==0 ) { +int type = connector->base.connector_type; +int clamp_bpp =24 ; + +/* Fall back to 18 bpp when DP sink capability is unknown. */ +if (type == DRM_MODE_CONNECTOR_DisplayPort || + type == DRM_MODE_CONNECTOR_eDP) + clamp_bpp =18 ; + +if (bpp > clamp_bpp) { +DRM_DEBUG_KMS ("clamping display bpp (was %d) to default limit of %d\n" , + bpp, clamp_bpp); + pipe_config->pipe_bpp = clamp_bpp; + } } }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: dts: at91: sama5d4: fix instance id of DBGU
In reply to Sasha LevinFrom: Mohamed Jamsheeth Hajanajubudeen <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 929e883f2bfdf68d4bd3aec43912e956417005c7 ]
Change instance id of DBGU to 45.
--- arch/arm/boot/dts/sama5d4.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d4.dtsi +1 -1
@@ -1219,7 +1219,7 @@ dbgu: serial@fc069000 { compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; reg = <0xfc069000 0x200>; - interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; + interrupts = <45 IRQ_TYPE_LEVEL_HIGH 7>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_dbgu>; clocks = <&dbgu_clk>;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] crypto: shash - Fix has_key setting
In reply to Sasha LevinFrom: Herbert Xu <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 00420a65fa2beb3206090ead86942484df2275f3 ]
The has_key logic is wrong for shash algorithms as they always have a setkey function. So we should instead be testing against shash_no_setkey.
--- crypto/shash.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
crypto/shash.c +3 -4
@@ -354,11 +354,10 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm) crt->final = shash_async_final; crt->finup = shash_async_finup; crt->digest = shash_async_digest; + crt->setkey = shash_async_setkey; + + crt->has_setkey = alg->setkey != shash_no_setkey; -if (alg->setkey) { - crt->setkey = shash_async_setkey; - crt->has_setkey = true; - }if (alg->export) crt->export = shash_async_export;if (alg->import)
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: usb-audio: Fix OPPO HA-1 vendor ID
In reply to Sasha LevinFrom: Jurgen Kramer <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 5327d6ba975042fd3da50ac6e94d1e9551ebeaec ]
In my patch adding native DSD support for the Oppo HA-1, the wrong vendor ID got through. This patch fixes the vendor ID and aligns the comment.
--- sound/usb/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/quirks.c +1 -1
@@ -1278,7 +1278,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,case USB_ID (0x20b1 ,0x3008 ):/* iFi Audio micro/nano iDSD */ case USB_ID (0x20b1 ,0x2008 ):/* Matrix Audio X-Sabre */ case USB_ID (0x20b1 ,0x300a ):/* Matrix Audio Mini-i Pro */ -case USB_ID (0x22d8 ,0x0416 ):/* OPPO HA-1*/ +case USB_ID (0x22d9 ,0x0416 ):/* OPPO HA-1 */ if (fp->altsetting ==2 )return SNDRV_PCM_FMTBIT_DSD_U32_BE ;break ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: usb-audio: Add native DSD support for PS Audio NuWave DAC
In reply to Sasha LevinFrom: Jurgen Kramer <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit ad678b4ccd41aa51cf5f142c0e8cffe9d61fc2bf ]
This patch adds native DSD support for the PS Audio NuWave DAC.
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1287,6 +1287,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,case USB_ID (0x20b1 ,0x2009 ):/* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ case USB_ID (0x20b1 ,0x2023 ):/* JLsounds I2SoverUSB */ case USB_ID (0x20b1 ,0x3023 ):/* Aune X1S 32BIT/384 DSD DAC */ +case USB_ID (0x2616 ,0x0106 ):/* PS Audio NuWave DAC */ if (fp->altsetting ==3 )return SNDRV_PCM_FMTBIT_DSD_U32_BE ;break ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: usb-audio: Add quirk for Microsoft LifeCam HD-6000
In reply to Sasha LevinFrom: Lev Lybin <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 1b3c993a699bed282e47c3f7c49d539c331dae04 ]
Microsoft LifeCam HD-6000 (045e:076f) requires the similar quirk for avoiding the stall due to the invalid sample rate reads.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111491
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1118,6 +1118,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)switch (chip->usb_id) {case USB_ID (0x045E ,0x075D ):/* MS Lifecam Cinema */ case USB_ID (0x045E ,0x076D ):/* MS Lifecam HD-5000 */ +case USB_ID (0x045E ,0x076F ):/* MS Lifecam HD-6000 */ case USB_ID (0x045E ,0x0772 ):/* MS Lifecam Studio */ case USB_ID (0x045E ,0x0779 ):/* MS Lifecam HD-3000 */ case USB_ID (0x04D8 ,0xFEEA ):/* Benchmark DAC1 Pre */
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: seq: Fix race at closing in virmidi driver
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2d1b5c08366acd46c35a2e9aba5d650cb5bf5c19 ]
The virmidi driver has an open race at closing its assigned rawmidi device, and this may lead to use-after-free in snd_seq_deliver_single_event().
Plug the hole by properly protecting the linked list deletion and calling in the right order in snd_virmidi_input_close().
--- sound/core/seq/seq_virmidi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/core/seq/seq_virmidi.c +5 -1
@@ -254,9 +254,13 @@ static int snd_virmidi_output_open(struct snd_rawmidi_substream *substream)*/ static int snd_virmidi_input_close (struct snd_rawmidi_substream *substream) { +struct snd_virmidi_dev *rdev = substream->rmidi->private_data;struct snd_virmidi *vmidi = substream->runtime->private_data; -snd_midi_event_free (vmidi->parser); + +write_lock_irq (&rdev->filelist_lock);list_del (&vmidi->list); +write_unlock_irq (&rdev->filelist_lock); +snd_midi_event_free (vmidi->parser); substream->runtime->private_data =NULL ;kfree (vmidi);return 0 ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] crypto: algif_hash - wait for crypto_ahash_init() to complete
In reply to Sasha LevinFrom: "Wang, Rui Y" <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit fe09786178f9df713a4b2dd6b93c0a722346bf5e ]
hash_sendmsg/sendpage() need to wait for the completion of crypto_ahash_init() otherwise it can cause panic.
--- crypto/algif_hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
crypto/algif_hash.c +3 -1
@@ -54,7 +54,8 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,lock_sock (sk);if (!ctx->more) { - err =crypto_ahash_init (&ctx->req); + err =af_alg_wait_for_completion (crypto_ahash_init (&ctx->req), + &ctx->completion);if (err) goto unlock; }
@@ -125,6 +126,7 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page, }else {if (!ctx->more) { err =crypto_ahash_init (&ctx->req); + err =af_alg_wait_for_completion (err, &ctx->completion);if (err) goto unlock; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: rawmidi: Remove kernel WARNING for NULL user-space buffer check
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit cc85f7a634cfaf9f0713c6aa06d08817424db37a ]
NULL user-space buffer can be passed even in a normal path, thus it's not good to spew a kernel warning with stack trace at each time. Just drop snd_BUG_ON() macro usage there.
--- sound/core/rawmidi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/rawmidi.c +1 -1
@@ -1178,7 +1178,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,long count1, result;struct snd_rawmidi_runtime *runtime = substream->runtime; -if (snd_BUG_ON (!kernelbuf && !userbuf)) +if (!kernelbuf && !userbuf)return -EINVAL ;if (snd_BUG_ON (!runtime->buffer))return -EINVAL ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: pcm: Fix potential deadlock in OSS emulation
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit b248371628aad599a48540962f6b85a21a8a0c3f ]
There are potential deadlocks in PCM OSS emulation code while accessing read/write and mmap concurrently. This comes from the infamous mmap_sem usage in copy_from/to_user(). Namely,
snd_pcm_oss_write() ->
&runtime->oss.params_lock ->
copy_to_user() ->
&mm->mmap_sem
mmap() ->
&mm->mmap_sem ->
snd_pcm_oss_mmap() ->
&runtime->oss.params_lockSince we can't avoid taking params_lock from mmap code path, use trylock variant and aborts with -EAGAIN as a workaround of this AB/BA deadlock.
--- sound/core/oss/pcm_oss.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
sound/core/oss/pcm_oss.c +15 -6
@@ -834,7 +834,8 @@ static int choose_rate(struct snd_pcm_substream *substream,return snd_pcm_hw_param_near (substream, params,SNDRV_PCM_HW_PARAM_RATE , best_rate,NULL ); } -static int snd_pcm_oss_change_params (struct snd_pcm_substream *substream) +static int snd_pcm_oss_change_params (struct snd_pcm_substream *substream, +bool trylock) {struct snd_pcm_runtime *runtime = substream->runtime;struct snd_pcm_hw_params *params, *sparams;
@@ -848,7 +849,10 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)struct snd_mask sformat_mask;struct snd_mask mask; -if (mutex_lock_interruptible (&runtime->oss.params_lock)) +if (trylock) { +if (!(mutex_trylock (&runtime->oss.params_lock))) +return -EAGAIN ; + }else if (mutex_lock_interruptible (&runtime->oss.params_lock))return -EINTR ; sw_params =kmalloc (sizeof (*sw_params),GFP_KERNEL ); params =kmalloc (sizeof (*params),GFP_KERNEL );
@@ -1092,7 +1096,7 @@ static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_filif (asubstream ==NULL ) asubstream = substream;if (substream->runtime->oss.params) { - err =snd_pcm_oss_change_params (substream); + err =snd_pcm_oss_change_params (substream, false);if (err <0 )return err; }
@@ -1132,7 +1136,7 @@ static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream)return 0 ; runtime = substream->runtime;if (runtime->oss.params) { - err =snd_pcm_oss_change_params (substream); + err =snd_pcm_oss_change_params (substream, false);if (err <0 )return err; }
@@ -2163,7 +2167,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre runtime = substream->runtime;if (runtime->oss.params && - (err =snd_pcm_oss_change_params (substream)) <0 ) + (err =snd_pcm_oss_change_params (substream, false)) <0 )return err; info.fragsize = runtime->oss.period_bytes;
@@ -2800,7 +2804,12 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)return -EIO ;if (runtime->oss.params) { -if ((err =snd_pcm_oss_change_params (substream)) <0 ) +/* use mutex_trylock() for params_lock for avoiding a deadlock +* between mmap_sem and params_lock taken by +* copy_from/to_user() in snd_pcm_oss_write/read() +*/ + err =snd_pcm_oss_change_params (substream, true); +if (err <0 )return err; }#ifdef CONFIG_SND_PCM_OSS_PLUGINS
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: seq: Fix yet another races among ALSA timer accesses
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2cdc7b636d55cbcf42e1e6c8accd85e62d3e9ae8 ]
ALSA sequencer may open/close and control ALSA timer instance dynamically either via sequencer events or direct ioctls. These are done mostly asynchronously, and it may call still some timer action like snd_timer_start() while another is calling snd_timer_close(). Since the instance gets removed by snd_timer_close(), it may lead to a use-after-free.
This patch tries to address such a race by protecting each snd_timer_*() call via the existing spinlock and also by avoiding the access to timer during close call.
--- sound/core/seq/seq_timer.c | 87 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 20 deletions(-)
sound/core/seq/seq_timer.c +67 -20
@@ -90,6 +90,9 @@ void snd_seq_timer_delete(struct snd_seq_timer **tmr)void snd_seq_timer_defaults (struct snd_seq_timer * tmr) { +unsigned long flags; + +spin_lock_irqsave (&tmr->lock, flags);/* setup defaults */ tmr->ppq =96 ;/* 96 PPQ */ tmr->tempo =500000 ;/* 120 BPM */
@@ -105,21 +108,25 @@ void snd_seq_timer_defaults(struct snd_seq_timer * tmr) tmr->preferred_resolution = seq_default_timer_resolution; tmr->skew = tmr->skew_base =SKEW_BASE ; +spin_unlock_irqrestore (&tmr->lock, flags); } -void snd_seq_timer_reset (struct snd_seq_timer * tmr) +static void seq_timer_reset (struct snd_seq_timer *tmr) { -unsigned long flags; - -spin_lock_irqsave (&tmr->lock, flags); -/* reset time & songposition */ tmr->cur_time.tv_sec =0 ; tmr->cur_time.tv_nsec =0 ; tmr->tick.cur_tick =0 ; tmr->tick.fraction =0 ; +} + +void snd_seq_timer_reset (struct snd_seq_timer *tmr) +{ +unsigned long flags; +spin_lock_irqsave (&tmr->lock, flags); +seq_timer_reset (tmr);spin_unlock_irqrestore (&tmr->lock, flags); }
@@ -138,8 +145,11 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, tmr = q->timer;if (tmr ==NULL )return ; -if (!tmr->running) +spin_lock_irqsave (&tmr->lock, flags); +if (!tmr->running) { +spin_unlock_irqrestore (&tmr->lock, flags);return ; + } resolution *= ticks;if (tmr->skew != tmr->skew_base) {
@@ -148,8 +158,6 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, (((resolution &0xffff ) * tmr->skew) >>16 ); } -spin_lock_irqsave (&tmr->lock, flags); -/* update timer */ snd_seq_inc_time_nsec (&tmr->cur_time, resolution);
@@ -296,26 +304,30 @@ int snd_seq_timer_open(struct snd_seq_queue *q) t->callback = snd_seq_timer_interrupt; t->callback_data = q; t->flags |=SNDRV_TIMER_IFLG_AUTO ; +spin_lock_irq (&tmr->lock); tmr->timeri = t; +spin_unlock_irq (&tmr->lock);return 0 ; }int snd_seq_timer_close (struct snd_seq_queue *q) {struct snd_seq_timer *tmr; +struct snd_timer_instance *t; tmr = q->timer;if (snd_BUG_ON (!tmr))return -EINVAL ; -if (tmr->timeri) { -snd_timer_stop (tmr->timeri); -snd_timer_close (tmr->timeri); - tmr->timeri =NULL ; - } +spin_lock_irq (&tmr->lock); + t = tmr->timeri; + tmr->timeri =NULL ; +spin_unlock_irq (&tmr->lock); +if (t) +snd_timer_close (t);return 0 ; } -int snd_seq_timer_stop (struct snd_seq_timer * tmr) +static int seq_timer_stop (struct snd_seq_timer *tmr) {if (! tmr->timeri)return -EINVAL ;
@@ -326,6 +338,17 @@ int snd_seq_timer_stop(struct snd_seq_timer * tmr)return 0 ; } +int snd_seq_timer_stop (struct snd_seq_timer *tmr) +{ +unsigned long flags; +int err; + +spin_lock_irqsave (&tmr->lock, flags); + err =seq_timer_stop (tmr); +spin_unlock_irqrestore (&tmr->lock, flags); +return err; +} +static int initialize_timer (struct snd_seq_timer *tmr) {struct snd_timer *t;
@@ -358,13 +381,13 @@ static int initialize_timer(struct snd_seq_timer *tmr)return 0 ; } -int snd_seq_timer_start (struct snd_seq_timer * tmr) +static int seq_timer_start (struct snd_seq_timer *tmr) {if (! tmr->timeri)return -EINVAL ;if (tmr->running) -snd_seq_timer_stop (tmr); -snd_seq_timer_reset (tmr); +seq_timer_stop (tmr); +seq_timer_reset (tmr);if (initialize_timer (tmr) <0 )return -EINVAL ;snd_timer_start (tmr->timeri, tmr->ticks);
@@ -373,14 +396,25 @@ int snd_seq_timer_start(struct snd_seq_timer * tmr)return 0 ; } -int snd_seq_timer_continue (struct snd_seq_timer * tmr) +int snd_seq_timer_start (struct snd_seq_timer *tmr) +{ +unsigned long flags; +int err; + +spin_lock_irqsave (&tmr->lock, flags); + err =seq_timer_start (tmr); +spin_unlock_irqrestore (&tmr->lock, flags); +return err; +} + +static int seq_timer_continue (struct snd_seq_timer *tmr) {if (! tmr->timeri)return -EINVAL ;if (tmr->running)return -EBUSY ;if (! tmr->initialized) { -snd_seq_timer_reset (tmr); +seq_timer_reset (tmr);if (initialize_timer (tmr) <0 )return -EINVAL ; }
@@ -390,11 +424,24 @@ int snd_seq_timer_continue(struct snd_seq_timer * tmr)return 0 ; } +int snd_seq_timer_continue (struct snd_seq_timer *tmr) +{ +unsigned long flags; +int err; + +spin_lock_irqsave (&tmr->lock, flags); + err =seq_timer_continue (tmr); +spin_unlock_irqrestore (&tmr->lock, flags); +return err; +} +/* return current 'real' time. use timeofday() to get better granularity. */ snd_seq_real_time_t snd_seq_timer_get_cur_time (struct snd_seq_timer *tmr) {snd_seq_real_time_t cur_time; +unsigned long flags; +spin_lock_irqsave (&tmr->lock, flags); cur_time = tmr->cur_time;if (tmr->running) {struct timeval tm;
@@ -410,7 +457,7 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) }snd_seq_sanity_real_time (&cur_time); } - +spin_unlock_irqrestore (&tmr->lock, flags);return cur_time; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: timer: Code cleanup
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit c3b1681375dc6e71d89a3ae00cc3ce9e775a8917 ]
This is a minor code cleanup without any functional changes:
- Kill keep_flag argument from _snd_timer_stop(), as all callers pass only it false.
- Remove redundant NULL check in _snd_timer_stop().
--- sound/core/timer.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
sound/core/timer.c +11 -17
@@ -305,8 +305,7 @@ int snd_timer_open(struct snd_timer_instance **ti,return 0 ; } -static int _snd_timer_stop (struct snd_timer_instance *timeri, -int keep_flag,int event); +static int _snd_timer_stop (struct snd_timer_instance *timeri,int event);/* * close a timer instance
@@ -348,7 +347,7 @@ int snd_timer_close(struct snd_timer_instance *timeri)spin_unlock_irq (&timer->lock);mutex_lock (®ister_mutex);list_del (&timeri->open_list); -if (timer &&list_empty (&timer->open_list_head) && +if (list_empty (&timer->open_list_head) && timer->hw.close) timer->hw.close (timer);/* remove slave links */
@@ -493,8 +492,7 @@ int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)return result; } -static int _snd_timer_stop (struct snd_timer_instance * timeri, -int keep_flag,int event) +static int _snd_timer_stop (struct snd_timer_instance *timeri,int event) {struct snd_timer *timer;unsigned long flags;
@@ -503,13 +501,11 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri,return -ENXIO ;if (timeri->flags &SNDRV_TIMER_IFLG_SLAVE ) { -if (!keep_flag) { -spin_lock_irqsave (&slave_active_lock, flags); - timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING ; -list_del_init (&timeri->ack_list); -list_del_init (&timeri->active_list); -spin_unlock_irqrestore (&slave_active_lock, flags); - } +spin_lock_irqsave (&slave_active_lock, flags); + timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING ; +list_del_init (&timeri->ack_list); +list_del_init (&timeri->active_list); +spin_unlock_irqrestore (&slave_active_lock, flags); goto __end; } timer = timeri->timer;
@@ -534,9 +530,7 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, } } } -if (!keep_flag) - timeri->flags &= - ~(SNDRV_TIMER_IFLG_RUNNING |SNDRV_TIMER_IFLG_START ); + timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING |SNDRV_TIMER_IFLG_START );spin_unlock_irqrestore (&timer->lock, flags); __end:if (event !=SNDRV_TIMER_EVENT_RESOLUTION )
@@ -555,7 +549,7 @@ int snd_timer_stop(struct snd_timer_instance *timeri)unsigned long flags;int err; - err =_snd_timer_stop (timeri,0 ,SNDRV_TIMER_EVENT_STOP ); + err =_snd_timer_stop (timeri,SNDRV_TIMER_EVENT_STOP );if (err <0 )return err; timer = timeri->timer;
@@ -601,7 +595,7 @@ int snd_timer_continue(struct snd_timer_instance *timeri)*/ int snd_timer_pause (struct snd_timer_instance * timeri) { -return _snd_timer_stop (timeri,0 ,SNDRV_TIMER_EVENT_PAUSE ); +return _snd_timer_stop (timeri,SNDRV_TIMER_EVENT_PAUSE ); }/*
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: timer: Fix link corruption due to double start or stop
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit f784beb75ce82f4136f8a0960d3ee872f7109e09 ]
Although ALSA timer code got hardening for races, it still causes use-after-free error. This is however rather a corrupted linked list, not actually the concurrent accesses. Namely, when timer start is triggered twice, list_add_tail() is called twice, too. This ends up with the link corruption and triggers KASAN error.
The simplest fix would be replacing list_add_tail() with list_move_tail(), but fundamentally it's the problem that we don't check the double start/stop correctly. So, the right fix here is to add the proper checks to snd_timer_start() and snd_timer_stop() (and their variants).
--- sound/core/timer.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
sound/core/timer.c +28 -2
@@ -451,6 +451,10 @@ static int snd_timer_start_slave(struct snd_timer_instance *timeri)unsigned long flags;spin_lock_irqsave (&slave_active_lock, flags); +if (timeri->flags &SNDRV_TIMER_IFLG_RUNNING ) { +spin_unlock_irqrestore (&slave_active_lock, flags); +return -EBUSY ; + } timeri->flags |=SNDRV_TIMER_IFLG_RUNNING ;if (timeri->master && timeri->timer) {spin_lock (&timeri->timer->lock);
@@ -475,7 +479,8 @@ int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)return -EINVAL ;if (timeri->flags &SNDRV_TIMER_IFLG_SLAVE ) { result =snd_timer_start_slave (timeri); -snd_timer_notify1 (timeri,SNDRV_TIMER_EVENT_START ); +if (result >=0 ) +snd_timer_notify1 (timeri,SNDRV_TIMER_EVENT_START );return result; } timer = timeri->timer;
@@ -484,11 +489,18 @@ int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)if (timer->card && timer->card->shutdown)return -ENODEV ;spin_lock_irqsave (&timer->lock, flags); +if (timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | +SNDRV_TIMER_IFLG_START )) { + result = -EBUSY ; + goto unlock; + } timeri->ticks = timeri->cticks = ticks; timeri->pticks =0 ; result =snd_timer_start1 (timer, timeri, ticks); + unlock:spin_unlock_irqrestore (&timer->lock, flags); -snd_timer_notify1 (timeri,SNDRV_TIMER_EVENT_START ); +if (result >=0 ) +snd_timer_notify1 (timeri,SNDRV_TIMER_EVENT_START );return result; }
@@ -502,6 +514,10 @@ static int _snd_timer_stop(struct snd_timer_instance *timeri, int event)if (timeri->flags &SNDRV_TIMER_IFLG_SLAVE ) {spin_lock_irqsave (&slave_active_lock, flags); +if (!(timeri->flags &SNDRV_TIMER_IFLG_RUNNING )) { +spin_unlock_irqrestore (&slave_active_lock, flags); +return -EBUSY ; + } timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING ;list_del_init (&timeri->ack_list);list_del_init (&timeri->active_list);
@@ -512,6 +528,11 @@ static int _snd_timer_stop(struct snd_timer_instance *timeri, int event)if (!timer)return -EINVAL ;spin_lock_irqsave (&timer->lock, flags); +if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | +SNDRV_TIMER_IFLG_START ))) { +spin_unlock_irqrestore (&timer->lock, flags); +return -EBUSY ; + }list_del_init (&timeri->ack_list);list_del_init (&timeri->active_list);if (timer->card && timer->card->shutdown) {
@@ -581,10 +602,15 @@ int snd_timer_continue(struct snd_timer_instance *timeri)if (timer->card && timer->card->shutdown)return -ENODEV ;spin_lock_irqsave (&timer->lock, flags); +if (timeri->flags &SNDRV_TIMER_IFLG_RUNNING ) { + result = -EBUSY ; + goto unlock; + }if (!timeri->cticks) timeri->cticks =1 ; timeri->pticks =0 ; result =snd_timer_start1 (timer, timeri, timer->sticks); + unlock:spin_unlock_irqrestore (&timer->lock, flags);snd_timer_notify1 (timeri,SNDRV_TIMER_EVENT_CONTINUE );return result;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/radeon: Always disable RADEON_GEM_GTT_UC along with RADEON_GEM_GTT_WC
In reply to Sasha LevinFrom: Michel Dänzer <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit a28bbd5824d4a2af98de45b300ab8d8fb39739fc ]
Write-combining is a CPU feature. From the GPU POV, these both simply mean no GPU<->CPU cache coherency.
--- drivers/gpu/drm/radeon/radeon_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_object.c +2 -2
@@ -225,7 +225,7 @@ int radeon_bo_create(struct radeon_device *rdev,/* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit * See https://bugs.freedesktop.org/show_bug.cgi?id=84627 */ - bo->flags &= ~RADEON_GEM_GTT_WC ; + bo->flags &= ~(RADEON_GEM_GTT_WC |RADEON_GEM_GTT_UC );#elif defined(CONFIG_X86 ) && !defined(CONFIG_X86_PAT )/* Don't try to enable write-combining when it can't work, or things * may be slow
@@ -237,7 +237,7 @@ int radeon_bo_create(struct radeon_device *rdev,DRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " "better performance thanks to write-combining\n" ); - bo->flags &= ~RADEON_GEM_GTT_WC ; + bo->flags &= ~(RADEON_GEM_GTT_WC |RADEON_GEM_GTT_UC );#endif radeon_ttm_placement_from_domain (bo, domain);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: hda - Add fixup for Mac Mini 7,1 model
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2154cc0e2d4ae15132d005d17e473327c70c9a06 ]
Mac Mini 7,1 model with CS4208 codec reports the headphone jack detection wrongly in an inverted way. Moreover, the advertised pins for the audio input and SPDIF output have actually no jack detection.
This patch addresses these issues. The inv_jack_detect flag is set for fixing the headphone jack detection, and the pin configs for audio input and SPDIF output are marked as non-detectable.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=105161
--- sound/pci/hda/patch_cirrus.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
sound/pci/hda/patch_cirrus.c +27 -0
@@ -614,6 +614,7 @@ enum {CS4208_MAC_AUTO ,CS4208_MBA6 ,CS4208_MBP11 , +CS4208_MACMINI , CS4208_GPIO0, };
@@ -621,6 +622,7 @@ static const struct hda_model_fixup cs4208_models[] = { { .id = CS4208_GPIO0, .name = "gpio0" }, { .id = CS4208_MBA6, .name = "mba6" }, { .id = CS4208_MBP11, .name = "mbp11" }, + { .id = CS4208_MACMINI, .name = "macmini" }, {} };
@@ -632,6 +634,7 @@ static const struct snd_pci_quirk cs4208_fixup_tbl[] = {/* codec SSID matching */ static const struct snd_pci_quirk cs4208_mac_fixup_tbl[] = {SND_PCI_QUIRK (0x106b ,0x5e00 ,"MacBookPro 11,2" ,CS4208_MBP11 ), +SND_PCI_QUIRK (0x106b ,0x6c00 ,"MacMini 7,1" ,CS4208_MACMINI ),SND_PCI_QUIRK (0x106b ,0x7100 ,"MacBookAir 6,1" ,CS4208_MBA6 ),SND_PCI_QUIRK (0x106b ,0x7200 ,"MacBookAir 6,2" ,CS4208_MBA6 ),SND_PCI_QUIRK (0x106b ,0x7b00 ,"MacBookPro 12,1" ,CS4208_MBP11 ),
@@ -666,6 +669,24 @@ static void cs4208_fixup_mac(struct hda_codec *codec,snd_hda_apply_fixup (codec, action); } +/* MacMini 7,1 has the inverted jack detection */ +static void cs4208_fixup_macmini (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +static const struct hda_pintbl pincfgs[] = { + {0x18 ,0x00ab9150 },/* mic (audio-in) jack: disable detect */ + {0x21 ,0x004be140 },/* SPDIF: disable detect */ + { } + }; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { +/* HP pin (0x10) has an inverted detection */ + codec->inv_jack_detect =1 ; +/* disable the bogus Mic and SPDIF jack detections */ +snd_hda_apply_pincfgs (codec, pincfgs); + } +} +static int cs4208_spdif_sw_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) {
@@ -709,6 +730,12 @@ static const struct hda_fixup cs4208_fixups[] = { .chained = true, .chain_id = CS4208_GPIO0, }, + [CS4208_MACMINI] = { + .type = HDA_FIXUP_FUNC, + .v.func = cs4208_fixup_macmini, + .chained = true, + .chain_id = CS4208_GPIO0, + }, [CS4208_GPIO0] = { .type = HDA_FIXUP_FUNC, .v.func = cs4208_fixup_gpio0,
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm: add helper to check for wc memory support
In reply to Sasha LevinFrom: Dave Airlie <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 4b0e4e4af6c6dc8354dcb72182d52c1bc55f12fc ]
--- include/drm/drm_cache.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/drm/drm_cache.h +9 -0
@@ -35,4 +35,13 @@void drm_clflush_pages (struct page *pages[],unsigned long num_pages); +static inline bool drm_arch_can_wc_memory (void ) +{ +#if defined(CONFIG_PPC ) && !defined(CONFIG_NOT_COHERENT_CACHE ) +return false; +#else +return true; +#endif +} +#endif
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: rawmidi: Fix race at copying & updating the position
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 81f577542af15640cbcb6ef68baa4caa610cbbfc ]
The rawmidi read and write functions manage runtime stream status such as runtime->appl_ptr and runtime->avail. These point where to copy the new data and how many bytes have been copied (or to be read). The problem is that rawmidi read/write call copy_from_user() or copy_to_user(), and the runtime spinlock is temporarily unlocked and relocked while copying user-space. Since the current code advances and updates the runtime status after the spin unlock/relock, the copy and the update may be asynchronous, and eventually runtime->avail might go to a negative value when many concurrent accesses are done. This may lead to memory corruption in the end.
For fixing this race, in this patch, the status update code is performed in the same lock before the temporary unlock. Also, the spinlock is now taken more widely in snd_rawmidi_kernel_read1() for protecting more properly during the whole operation.
--- sound/core/rawmidi.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
sound/core/rawmidi.c +22 -12
@@ -942,31 +942,36 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,unsigned long flags;long result =0 , count1;struct snd_rawmidi_runtime *runtime = substream->runtime; +unsigned long appl_ptr; +spin_lock_irqsave (&runtime->lock, flags);while (count >0 && runtime->avail) { count1 = runtime->buffer_size - runtime->appl_ptr;if (count1 > count) count1 = count; -spin_lock_irqsave (&runtime->lock, flags);if (count1 > (int )runtime->avail) count1 = runtime->avail; + +/* update runtime->appl_ptr before unlocking for userbuf */ + appl_ptr = runtime->appl_ptr; + runtime->appl_ptr += count1; + runtime->appl_ptr %= runtime->buffer_size; + runtime->avail -= count1; +if (kernelbuf) -memcpy (kernelbuf + result, runtime->buffer + runtime->appl_ptr, count1); +memcpy (kernelbuf + result, runtime->buffer + appl_ptr, count1);if (userbuf) {spin_unlock_irqrestore (&runtime->lock, flags);if (copy_to_user (userbuf + result, - runtime->buffer + runtime->appl_ptr, count1)) { + runtime->buffer + appl_ptr, count1)) {return result >0 ? result : -EFAULT ; }spin_lock_irqsave (&runtime->lock, flags); } - runtime->appl_ptr += count1; - runtime->appl_ptr %= runtime->buffer_size; - runtime->avail -= count1; -spin_unlock_irqrestore (&runtime->lock, flags); result += count1; count -= count1; } +spin_unlock_irqrestore (&runtime->lock, flags);return result; }
@@ -1223,6 +1228,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,unsigned long flags;long count1, result;struct snd_rawmidi_runtime *runtime = substream->runtime; +unsigned long appl_ptr;if (!kernelbuf && !userbuf)return -EINVAL ;
@@ -1243,12 +1249,19 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, count1 = count;if (count1 > (long )runtime->avail) count1 = runtime->avail; + +/* update runtime->appl_ptr before unlocking for userbuf */ + appl_ptr = runtime->appl_ptr; + runtime->appl_ptr += count1; + runtime->appl_ptr %= runtime->buffer_size; + runtime->avail -= count1; +if (kernelbuf) -memcpy (runtime->buffer + runtime->appl_ptr, +memcpy (runtime->buffer + appl_ptr, kernelbuf + result, count1);else if (userbuf) {spin_unlock_irqrestore (&runtime->lock, flags); -if (copy_from_user (runtime->buffer + runtime->appl_ptr, +if (copy_from_user (runtime->buffer + appl_ptr, userbuf + result, count1)) {spin_lock_irqsave (&runtime->lock, flags); result = result >0 ? result : -EFAULT ;
@@ -1256,9 +1269,6 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, }spin_lock_irqsave (&runtime->lock, flags); } - runtime->appl_ptr += count1; - runtime->appl_ptr %= runtime->buffer_size; - runtime->avail -= count1; result += count1; count -= count1; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/radeon: mask out WC from BO on unsupported arches
In reply to Sasha LevinFrom: Oded Gabbay <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit c5244987394648913ae1a03879c58058a2fc2cee ]
--- drivers/gpu/drm/radeon/radeon_object.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +7 -0
@@ -33,6 +33,7 @@#include <linux/slab.h> #include <drm/drmP.h> #include <drm/radeon_drm.h> +#include <drm/drm_cache.h> #include "radeon.h" #include "radeon_trace.h"
@@ -238,6 +239,12 @@ int radeon_bo_create(struct radeon_device *rdev,DRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " "better performance thanks to write-combining\n" ); bo->flags &= ~(RADEON_GEM_GTT_WC |RADEON_GEM_GTT_UC ); +#else +/* For architectures that don't support WC memory, +* mask out the WC flag from the BO +*/ +if (!drm_arch_can_wc_memory ()) + bo->flags &= ~RADEON_GEM_GTT_WC ;#endif radeon_ttm_placement_from_domain (bo, domain);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: rawmidi: Make snd_rawmidi_transmit() race-free
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 06ab30034ed9c200a570ab13c017bde248ddb2a6 ]
A kernel WARNING in snd_rawmidi_transmit_ack() is triggered by syzkaller fuzzer:
WARNING: CPU: 1 PID: 20739 at sound/core/rawmidi.c:1136 Call Trace: [< inline >] __dump_stack lib/dump_stack.c:15 [<ffffffff82999e2d>] dump_stack+0x6f/0xa2 lib/dump_stack.c:50 [<ffffffff81352089>] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482 [<ffffffff813522b9>] warn_slowpath_null+0x29/0x30 kernel/panic.c:515 [<ffffffff84f80bd5>] snd_rawmidi_transmit_ack+0x275/0x400 sound/core/rawmidi.c:1136 [<ffffffff84fdb3c1>] snd_virmidi_output_trigger+0x4b1/0x5a0 sound/core/seq/seq_virmidi.c:163 [< inline >] snd_rawmidi_output_trigger sound/core/rawmidi.c:150 [<ffffffff84f87ed9>] snd_rawmidi_kernel_write1+0x549/0x780 sound/core/rawmidi.c:1223 [<ffffffff84f89fd3>] snd_rawmidi_write+0x543/0xb30 sound/core/rawmidi.c:1273 [<ffffffff817b0323>] __vfs_write+0x113/0x480 fs/read_write.c:528 [<ffffffff817b1db7>] vfs_write+0x167/0x4a0 fs/read_write.c:577 [< inline >] SYSC_write fs/read_write.c:624 [<ffffffff817b50a1>] SyS_write+0x111/0x220 fs/read_write.c:616 [<ffffffff86336c36>] entry_SYSCALL_64_fastpath+0x16/0x7a arch/x86/entry/entry_64.S:185
Also a similar warning is found but in another path:
Call Trace: [< inline >] __dump_stack lib/dump_stack.c:15 [<ffffffff82be2c0d>] dump_stack+0x6f/0xa2 lib/dump_stack.c:50 [<ffffffff81355139>] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482 [<ffffffff81355369>] warn_slowpath_null+0x29/0x30 kernel/panic.c:515 [<ffffffff8527e69a>] rawmidi_transmit_ack+0x24a/0x3b0 sound/core/rawmidi.c:1133 [<ffffffff8527e851>] snd_rawmidi_transmit_ack+0x51/0x80 sound/core/rawmidi.c:1163 [<ffffffff852d9046>] snd_virmidi_output_trigger+0x2b6/0x570 sound/core/seq/seq_virmidi.c:185 [< inline >] snd_rawmidi_output_trigger sound/core/rawmidi.c:150 [<ffffffff85285a0b>] snd_rawmidi_kernel_write1+0x4bb/0x760 sound/core/rawmidi.c:1252 [<ffffffff85287b73>] snd_rawmidi_write+0x543/0xb30 sound/core/rawmidi.c:1302 [<ffffffff817ba5f3>] __vfs_write+0x113/0x480 fs/read_write.c:528 [<ffffffff817bc087>] vfs_write+0x167/0x4a0 fs/read_write.c:577 [< inline >] SYSC_write fs/read_write.c:624 [<ffffffff817bf371>] SyS_write+0x111/0x220 fs/read_write.c:616 [<ffffffff86660276>] entry_SYSCALL_64_fastpath+0x16/0x7a arch/x86/entry/entry_64.S:185
In the former case, the reason is that virmidi has an open code calling snd_rawmidi_transmit_ack() with the value calculated outside
the spinlock. We may use snd_rawmidi_transmit() in a loop just for
consuming the input data, but even there, there is a race between snd_rawmidi_transmit_peek() and snd_rawmidi_tranmit_ack().
Similarly in the latter case, it calls snd_rawmidi_transmit_peek() and snd_rawmidi_tranmit_ack() separately without protection, so they are racy as well.
The patch tries to address these issues by the following ways:
- Introduce the unlocked versions of snd_rawmidi_transmit_peek() and snd_rawmidi_transmit_ack() to be called inside the explicit lock.
- Rewrite snd_rawmidi_transmit() to be race-free (the former case).
- Make the split calls (the latter case) protected in the rawmidi spin lock.
--- include/sound/rawmidi.h | 4 ++ sound/core/rawmidi.c | 98 ++++++++++++++++++++++++++++++++------------ sound/core/seq/seq_virmidi.c | 17 +++++--- 3 files changed, 88 insertions(+), 31 deletions(-)
include/sound/rawmidi.h +4 -0
@@ -167,6 +167,10 @@ int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,int snd_rawmidi_transmit_ack (struct snd_rawmidi_substream *substream,int count);int snd_rawmidi_transmit (struct snd_rawmidi_substream *substream,unsigned char *buffer,int count); +int __snd_rawmidi_transmit_peek (struct snd_rawmidi_substream *substream, +unsigned char *buffer,int count); +int __snd_rawmidi_transmit_ack (struct snd_rawmidi_substream *substream, +int count);/* main midi functions */
sound/core/rawmidi.c +72 -26
155 lines not on this page · raw message
sound/core/seq/seq_virmidi.c +12 -5
@@ -155,21 +155,26 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,struct snd_virmidi *vmidi = substream->runtime->private_data;int count, res;unsigned char buf[32 ], *pbuf; +unsigned long flags;if (up) { vmidi->trigger =1 ;if (vmidi->seq_mode ==SNDRV_VIRMIDI_SEQ_DISPATCH && !(vmidi->rdev->flags &SNDRV_VIRMIDI_SUBSCRIBE )) { -snd_rawmidi_transmit_ack (substream, substream->runtime->buffer_size - substream->runtime->avail); -return ;/* ignored */ +while (snd_rawmidi_transmit (substream, buf, +sizeof (buf)) >0 ) { +/* ignored */ + } +return ; }if (vmidi->event.type !=SNDRV_SEQ_EVENT_NONE ) {if (snd_seq_kernel_client_dispatch (vmidi->client, &vmidi->event,in_atomic (),0 ) <0 )return ; vmidi->event.type =SNDRV_SEQ_EVENT_NONE ; } +spin_lock_irqsave (&substream->runtime->lock, flags);while (1 ) { - count =snd_rawmidi_transmit_peek (substream, buf,sizeof (buf)); + count =__snd_rawmidi_transmit_peek (substream, buf,sizeof (buf));if (count <=0 )break ; pbuf = buf;
@@ -179,16 +184,18 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,snd_midi_event_reset_encode (vmidi->parser);continue ; } -snd_rawmidi_transmit_ack (substream, res); +__snd_rawmidi_transmit_ack (substream, res); pbuf += res; count -= res;if (vmidi->event.type !=SNDRV_SEQ_EVENT_NONE ) {if (snd_seq_kernel_client_dispatch (vmidi->client, &vmidi->event,in_atomic (),0 ) <0 ) -return ; + goto out; vmidi->event.type =SNDRV_SEQ_EVENT_NONE ; } } } + out: +spin_unlock_irqrestore (&substream->runtime->lock, flags); }else { vmidi->trigger =0 ; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: seq: Fix lockdep warnings due to double mutex locks
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 7f0973e973cd74aa40747c9d38844560cd184ee8 ]
The port subscription code uses double mutex locks for source and destination ports, and this may become racy once when wrongly set up. It leads to lockdep warning splat, typically triggered by fuzzer like syzkaller, although the actual deadlock hasn't been seen, so far.
This patch simplifies the handling by reducing to two single locks, so that no lockdep warning will be trigger any longer.
By splitting to two actions, a still-in-progress element shall be added in one list while handling another. For ignoring this element, a new check is added in deliver_to_subscribers().
Along with it, the code to add/remove the subscribers list element was cleaned up and refactored.
--- sound/core/seq/seq_clientmgr.c | 3 + sound/core/seq/seq_ports.c | 233 +++++++++++++++++++++++------------------ 2 files changed, 133 insertions(+), 103 deletions(-)
sound/core/seq/seq_clientmgr.c +3 -0
@@ -678,6 +678,9 @@ static int deliver_to_subscribers(struct snd_seq_client *client,else down_read (&grp->list_mutex);list_for_each_entry (subs, &grp->list_head, src_list) { +/* both ports ready? */ +if (atomic_read (&subs->ref_count) !=2 ) +continue ; event->dest = subs->info.dest;if (subs->info.flags &SNDRV_SEQ_PORT_SUBS_TIMESTAMP )/* convert time according to flag with subscription */
sound/core/seq/seq_ports.c +130 -103
319 lines not on this page · raw message
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] xhci: Workaround to get D3 working in Intel xHCI
In reply to Sasha LevinFrom: Rajmohan Mani <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit abce329c27b315cfc01be1a305ee976ee13ed4cf ]
The xHCI in Intel CherryView / Braswell Platform requires a driver workaround to get xHCI D3 working. Without this workaround, xHCI might not enter D3.
Workaround is to configure SSIC PORT as "unused" before D3 entry and "used" after D3 exit. This is done through a vendor specific register (PORT2_SSIC_CONFIG_REG2 at offset 0x883c), in xhci suspend / resume callbacks.
Verified xHCI D3 works fine in CherryView / Braswell platform.
--- drivers/usb/host/xhci-pci.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-pci.c +37 -3
@@ -27,6 +27,10 @@#include "xhci.h" #include "xhci-trace.h" +#define PORT2_SSIC_CONFIG_REG2 0x883c +#define PROG_DONE (1 << 30) +#define SSIC_PORT_UNUSED (1 << 31) +/* Device for a quirk */ #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73#define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000
@@ -170,14 +174,44 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) }/* +* In some Intel xHCI controllers, in order to get D3 working, +* through a vendor specific SSIC CONFIG register at offset 0x883c, +* SSIC PORT need to be marked as "unused" before putting xHCI +* into D3. After D3 exit, the SSIC port need to be marked as "used". +* Without this change, xHCI might not enter D3 state. * Make sure PME works on some Intel xHCI controllers by writing 1 to clear * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 */ -static void xhci_pme_quirk (struct xhci_hcd *xhci) +static void xhci_pme_quirk (struct usb_hcd *hcd,bool suspend) { +struct xhci_hcd *xhci =hcd_to_xhci (hcd); +struct pci_dev *pdev =to_pci_dev (hcd->self.controller);u32 val;void __iomem *reg; +if (pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ) { + + reg = (void __iomem *) xhci->cap_regs +PORT2_SSIC_CONFIG_REG2 ; + +/* Notify SSIC that SSIC profile programming is not done */ + val =readl (reg) & ~PROG_DONE ; +writel (val, reg); + +/* Mark SSIC port as unused(suspend) or used(resume) */ + val =readl (reg); +if (suspend) + val |=SSIC_PORT_UNUSED ; +else + val &= ~SSIC_PORT_UNUSED ; +writel (val, reg); + +/* Notify SSIC that SSIC profile programming is done */ + val =readl (reg) |PROG_DONE ; +writel (val, reg); +readl (reg); + } + reg = (void __iomem *) xhci->cap_regs +0x80a4 ; val =readl (reg);writel (val |BIT (28 ), reg);
@@ -309,7 +343,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) pdev->no_d3cold = true;if (xhci->quirks &XHCI_PME_STUCK_QUIRK ) -xhci_pme_quirk (xhci); +xhci_pme_quirk (hcd, true);return xhci_suspend (xhci, do_wakeup); }
@@ -342,7 +376,7 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)usb_enable_intel_xhci_ports (pdev);if (xhci->quirks &XHCI_PME_STUCK_QUIRK ) -xhci_pme_quirk (xhci); +xhci_pme_quirk (hcd, false); retval =xhci_resume (xhci, hibernated);return retval;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] xhci: call BIOS workaround to enable runtime suspend on Intel Braswell
In reply to Sasha LevinFrom: Mathias Nyman <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit c3c5819a350952439c3198aa46581f9e4c46557f ]
Intel xhci hw that require XHCI_PME_STUCK quirk have as default disabled xhci from going to D3 state in runtime suspend. Driver needs to verify it can deal with the hw by calling an ACPI _DSM method to get D3 enabled.
--- drivers/usb/host/xhci-pci.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/usb/host/xhci-pci.c +17 -0
@@ -23,6 +23,7 @@#include <linux/pci.h> #include <linux/slab.h> #include <linux/module.h> +#include <linux/acpi.h> #include "xhci.h" #include "xhci-trace.h"
@@ -218,6 +219,19 @@ static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend)readl (reg); } +#ifdef CONFIG_ACPI +static void xhci_pme_acpi_rtd3_enable (struct pci_dev *dev) +{ +static const u8 intel_dsm_uuid[] = { +0xb7 ,0x0c ,0x34 ,0xac ,0x01 ,0xe9 ,0xbf ,0x45 , +0xb7 ,0xe6 ,0x2b ,0x34 ,0xec ,0x93 ,0x1e ,0x23 , + }; +acpi_evaluate_dsm (ACPI_HANDLE (&dev->dev), intel_dsm_uuid,3 ,1 ,NULL ); +} +#else +static void xhci_pme_acpi_rtd3_enable (struct pci_dev *dev) { } +#endif /* CONFIG_ACPI */ +/* called during probe() after chip reset completes */ static int xhci_pci_setup (struct usb_hcd *hcd) {
@@ -297,6 +311,9 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) HCC_MAX_PSA(xhci->hcc_params) >= 4) xhci->shared_hcd->can_do_streams =1 ; +if (xhci->quirks &XHCI_PME_STUCK_QUIRK ) +xhci_pme_acpi_rtd3_enable (dev); +/* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ pm_runtime_put_noidle (&dev->dev);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: OMAP2+: Fix wait_dll_lock_timed for rodata
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit d9db59103305eb5ec2a86369f32063e9921b6ac5 ]
We don't want to be writing to .text so it can be set rodata. Fix error "Unable to handle kernel paging request at virtual address c012396c" in wait_dll_lock_timed if CONFIG_DEBUG_RODATA is selected.
As these counters are for debugging only and unused, we can just remove them.
non-executable")
--- arch/arm/mach-omap2/sleep34xx.S | 22 ---------------------- 1 file changed, 22 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +0 -22
@@ -289,12 +289,6 @@ wait_sdrc_ready: bic r5, r5, #0x40 str r5, [r4] -/* - * PC-relative stores lead to undefined behaviour in Thumb-2: use a r7 as a - * base instead. - * Be careful not to clobber r7 when maintaing this code. - */ - is_dll_in_lock_mode: /* Is dll in lock mode? */ ldr r4, sdrc_dlla_ctrl
@@ -302,11 +296,7 @@ is_dll_in_lock_mode: tst r5, #0x4 bne exit_nonoff_modes @ Return if locked /* wait till dll locks */ - adr r7, kick_counter wait_dll_lock_timed: - ldr r4, wait_dll_lock_counter - add r4, r4, #1 - str r4, [r7, #wait_dll_lock_counter - kick_counter] ldr r4, sdrc_dlla_status /* Wait 20uS for lock */ mov r6, #8
@@ -330,9 +320,6 @@ kick_dll: orr r6, r6, #(1<<3) @ enable dll str r6, [r4] dsb - ldr r4, kick_counter - add r4, r4, #1 - str r4, [r7] @ kick_counter b wait_dll_lock_timed exit_nonoff_modes:
@@ -360,15 +347,6 @@ sdrc_dlla_status: .word SDRC_DLLA_STATUS_V sdrc_dlla_ctrl: .word SDRC_DLLA_CTRL_V - /* - * When exporting to userspace while the counters are in SRAM, - * these 2 words need to be at the end to facilitate retrival! - */ -kick_counter: - .word 0 -wait_dll_lock_counter: - .word 0 - ENTRY(omap3_do_wfi_sz) .word . - omap3_do_wfi
Signature · 1 line
2.5.0
RE: [added to the 4.1 stable tree] ARM: OMAP2+: Fix wait_dll_lock_timed for rodata
Quoted 10 lines
From: Sasha Levin [mailto:[email protected]]
Sent: Wednesday, February 10, 2016 9:11 AM
To: [email protected]; [email protected]
Cc: Tony Lindgren; Kees Cook; Laura Abbott; Menon, Nishanth; Woodruff, Richard; Russell King; Kristo, Tero; Sasha Levin
Subject: [added to the 4.1 stable tree] ARM: OMAP2+: Fixwait_dll_lock_timedfor rodataAs these counters are for debugging only and unused, we can just remove them.
This statement is false.
The kick counters were there to work around HW quirks/bugs not for any kind of debugging. Code in this area was added reactively to customer production failures not for expirmentation.
It seems likely the assembly with some effort could be made to keep its function.
Regards,
Richard W.
Tony Lindgren
maintainerRe: [added to the 4.1 stable tree] ARM: OMAP2+: Fix wait_dll_lock_timed for rodata
Hi,
Quoted 8 lines · Woodruff, Richard
Quoted 7 lines
From: Sasha Levin [mailto:[email protected]]
Sent: Wednesday, February 10, 2016 9:11 AM
To: [email protected]; [email protected]
Cc: Tony Lindgren; Kees Cook; Laura Abbott; Menon, Nishanth; Woodruff, Richard; Russell King; Kristo, Tero; Sasha Levin
Subject: [added to the 4.1 stable tree] ARM: OMAP2+: Fixwait_dll_lock_timedfor rodata
Quoted 4 lines
Quoted 2 lines
As these counters are for debugging only and unused, we can just remove them.
This statement is false.
Care to check again with the mainline kernel? All the mainline code was doing was incrementing these.
Quoted 3 lines
The kick counters were there to work around HW quirks/bugs not for any kind of debugging. Code in this area was added reactively to customer production failures not for expirmentation.
It seems likely the assembly with some effort could be made to keep its function.
It sounds like we have never had those pieces in the mainline kernel though?
Regards,
Tony
RE: [added to the 4.1 stable tree] ARM: OMAP2+: Fix wait_dll_lock_timed for rodata
Quoted 7 lines
From: Tony Lindgren [mailto:[email protected]]
Sent: Thursday, February 11, 2016 10:21 AMQuoted 1 line
This statement is false.
Care to check again with the mainline kernel? All the mainline code was doing was incrementing these.
It may have regressed. I 'know' it was correct in customer patched kernels as it fixed production stop bugs.
I 'believe' it was correct in mainline long back. Perhaps it regressed during one of the refactoring passes.
Quoted 2 lines
It sounds like we have never had those pieces in the mainline kernel though?
I don't think this is the case but maybe... The code was perpetually broken in mainline for one reason or the other except for the most trivial case.
Customer phones did hang without a kick in production volumes for their use cases.
I will see if I can dig up an older image to cross check in the next few days...
Regards,
Richard W.
Tony Lindgren
maintainerRe: [added to the 4.1 stable tree] ARM: OMAP2+: Fix wait_dll_lock_timed for rodata
Quoted 8 lines · Woodruff, Richard
Quoted 7 lines
From: Tony Lindgren [mailto:[email protected]]
Sent: Thursday, February 11, 2016 10:21 AMQuoted 1 line
This statement is false.
Care to check again with the mainline kernel? All the mainline code was doing was incrementing these.
Quoted 8 lines
It may have regressed. I 'know' it was correct in customer patched kernels as it fixed production stop bugs.
I 'believe' it was correct in mainline long back. Perhaps it regressed during one of the refactoring passes.
Quoted 2 lines
It sounds like we have never had those pieces in the mainline kernel though?
I don't think this is the case but maybe... The code was perpetually broken in mainline for one reason or the other except for the most trivial case.
The mainline kernel PM code has been certainly working reliably for me on omap3 for several years with off idle. That's how I keep noticing various driver and PM regressions.
Quoted 3 lines
Customer phones did hang without a kick in production volumes for their use cases.
I will see if I can dig up an older image to cross check in the next few days...
OK thanks.
Regards,
Tony
RE: [added to the 4.1 stable tree] ARM: OMAP2+: Fix wait_dll_lock_timed for rodata
In reply to Tony LindgrenHi Tony,
Quoted 9 lines
From: Tony Lindgren [mailto:[email protected]]
Sent: Thursday, February 11, 2016 10:21 AMCare to check again with the mainline kernel? All the mainline code was doing was incrementing these.
Quoted 1 line
The kick counters were there to work around HW quirks/bugs not for any
kind of debugging. Code in this area was added reactively to customer production failures not for expirmentation.
I was able to check code over time.
You are correct the counters were debug only. The DLL wait spin and kick was added to work around a HW errata for OMAP3430. This work around is mandatory. The kick_counter was used as a debug aid to help characterize the time of unlock condition. My initial comment wrongly conflated the kick function with the counter. These are separate. Sorry for any misdirection and delay in being able to check more carefully.
Regards,
Richard W.
Tony Lindgren
maintainerRe: [added to the 4.1 stable tree] ARM: OMAP2+: Fix wait_dll_lock_timed for rodata
Quoted 8 lines · Woodruff, Richard
Hi Tony,
Quoted 6 lines
From: Tony Lindgren [mailto:[email protected]]
Sent: Thursday, February 11, 2016 10:21 AMCare to check again with the mainline kernel? All the mainline code was doing was incrementing these.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
The kick counters were there to work around HW quirks/bugs not for any
kind of debugging. Code in this area was added reactively to customer production failures not for expirmentation.
I was able to check code over time.
You are correct the counters were debug only. The DLL wait spin and kick was added to work around a HW errata for OMAP3430. This work around is mandatory. The
kick_counterwas used as a debug aid to help characterize the time of unlock condition. My initial comment wrongly conflated the kick function with the counter. These are separate. Sorry for any misdirection and delay in being able to check more carefully.
OK thanks for checking!
Regards,
Tony
[added to the 4.1 stable tree] xhci: Move xhci_pme_quirk() behind #ifdef CONFIG_PM
In reply to Sasha LevinFrom: Tomer Barletz <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2b7627b73e81e5d23d5ae1490fe8e690af86e053 ]
xhci_pme_quirk() is only used when CONFIG_PM is defined. Compiling a kernel without PM complains about this function
--- drivers/usb/host/xhci-pci.c | 90 ++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 45 deletions(-)
drivers/usb/host/xhci-pci.c +45 -45
@@ -174,51 +174,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) "QUIRK: Resetting on resume"); } -/* -* In some Intel xHCI controllers, in order to get D3 working, -* through a vendor specific SSIC CONFIG register at offset 0x883c, -* SSIC PORT need to be marked as "unused" before putting xHCI -* into D3. After D3 exit, the SSIC port need to be marked as "used". -* Without this change, xHCI might not enter D3 state. -* Make sure PME works on some Intel xHCI controllers by writing 1 to clear -* the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 -*/ -static void xhci_pme_quirk (struct usb_hcd *hcd,bool suspend) -{ -struct xhci_hcd *xhci =hcd_to_xhci (hcd); -struct pci_dev *pdev =to_pci_dev (hcd->self.controller); -u32 val; -void __iomem *reg; - -if (pdev->vendor ==PCI_VENDOR_ID_INTEL && - pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ) { - - reg = (void __iomem *) xhci->cap_regs +PORT2_SSIC_CONFIG_REG2 ; - -/* Notify SSIC that SSIC profile programming is not done */ - val =readl (reg) & ~PROG_DONE ; -writel (val, reg); - -/* Mark SSIC port as unused(suspend) or used(resume) */ - val =readl (reg); -if (suspend) - val |=SSIC_PORT_UNUSED ; -else - val &= ~SSIC_PORT_UNUSED ; -writel (val, reg); - -/* Notify SSIC that SSIC profile programming is done */ - val =readl (reg) |PROG_DONE ; -writel (val, reg); -readl (reg); - } - - reg = (void __iomem *) xhci->cap_regs +0x80a4 ; - val =readl (reg); -writel (val |BIT (28 ), reg); -readl (reg); -} -#ifdef CONFIG_ACPI static void xhci_pme_acpi_rtd3_enable (struct pci_dev *dev) {
@@ -347,6 +302,51 @@ static void xhci_pci_remove(struct pci_dev *dev) }#ifdef CONFIG_PM +/* +* In some Intel xHCI controllers, in order to get D3 working, +* through a vendor specific SSIC CONFIG register at offset 0x883c, +* SSIC PORT need to be marked as "unused" before putting xHCI +* into D3. After D3 exit, the SSIC port need to be marked as "used". +* Without this change, xHCI might not enter D3 state. +* Make sure PME works on some Intel xHCI controllers by writing 1 to clear +* the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 +*/ +static void xhci_pme_quirk (struct usb_hcd *hcd,bool suspend) +{ +struct xhci_hcd *xhci =hcd_to_xhci (hcd); +struct pci_dev *pdev =to_pci_dev (hcd->self.controller); +u32 val; +void __iomem *reg; + +if (pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ) { + + reg = (void __iomem *) xhci->cap_regs +PORT2_SSIC_CONFIG_REG2 ; + +/* Notify SSIC that SSIC profile programming is not done */ + val =readl (reg) & ~PROG_DONE ; +writel (val, reg); + +/* Mark SSIC port as unused(suspend) or used(resume) */ + val =readl (reg); +if (suspend) + val |=SSIC_PORT_UNUSED ; +else + val &= ~SSIC_PORT_UNUSED ; +writel (val, reg); + +/* Notify SSIC that SSIC profile programming is done */ + val =readl (reg) |PROG_DONE ; +writel (val, reg); +readl (reg); + } + + reg = (void __iomem *) xhci->cap_regs +0x80a4 ; + val =readl (reg); +writel (val |BIT (28 ), reg); +readl (reg); +} +static int xhci_pci_suspend (struct usb_hcd *hcd,bool do_wakeup) {struct xhci_hcd *xhci =hcd_to_xhci (hcd);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] radix-tree: fix race in gang lookup
In reply to Sasha LevinFrom: Matthew Wilcox <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 46437f9a554fbe3e110580ca08ab703b59f2f95a ]
If the indirect_ptr bit is set on a slot, that indicates we need to redo the lookup. Introduce a new function radix_tree_iter_retry() which forces the loop to retry the lookup by setting 'slot' to NULL and turning the iterator back to point at the problematic entry.
This is a pretty rare problem to hit at the moment; the lookup has to race with a grow of the radix tree from a height of 0. The consequences of hitting this race are that gang lookup could return a pointer to a radix_tree_node instead of a pointer to whatever the user had inserted in the tree.
--- include/linux/radix-tree.h | 16 ++++++++++++++++ lib/radix-tree.c | 12 ++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-)
include/linux/radix-tree.h +16 -0
@@ -370,6 +370,22 @@ void **radix_tree_next_chunk(struct radix_tree_root *root, struct radix_tree_iter *iter, unsigned flags);/** +* radix_tree_iter_retry - retry this chunk of the iteration +* @iter: iterator state +* +* If we iterate over a tree protected only by the RCU lock, a race +* against deletion or creation may result in seeing a slot for which +* radix_tree_deref_retry() returns true. If so, call this function +* and continue the iteration. +*/ +static inline __must_check +void **radix_tree_iter_retry (struct radix_tree_iter *iter) +{ + iter->next_index = iter->index; +return NULL ; +} + +/** * radix_tree_chunk_size - get current chunk size * * @iter: pointer to radix tree iterator
lib/radix-tree.c +10 -2
@@ -1014,9 +1014,13 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,return 0 ;radix_tree_for_each_slot (slot, root, &iter, first_index) { - results[ret] =indirect_to_ptr (rcu_dereference_raw (*slot)); + results[ret] =rcu_dereference_raw (*slot);if (!results[ret])continue ; +if (radix_tree_is_indirect_ptr (results[ret])) { + slot =radix_tree_iter_retry (&iter); +continue ; + }if (++ret == max_items)break ; }
@@ -1093,9 +1097,13 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,return 0 ;radix_tree_for_each_tagged (slot, root, &iter, first_index, tag) { - results[ret] =indirect_to_ptr (rcu_dereference_raw (*slot)); + results[ret] =rcu_dereference_raw (*slot);if (!results[ret])continue ; +if (radix_tree_is_indirect_ptr (results[ret])) { + slot =radix_tree_iter_retry (&iter); +continue ; + }if (++ret == max_items)break ; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] xhci: create one unified function to calculate TRB TD remainder.
In reply to Sasha LevinFrom: Mathias Nyman <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit c840d6ce772d47c777070ca4bbbfbf21d8d727a3 ]
xhci versions 1.0 and later report the untransferred data remaining in a TD a bit differently than older hosts.
We used to have separate functions for these, and needed to check host version before calling the right function.
Now Mediatek host has an additional quirk on how it uses the TD Size field for remaining data. To prevent yet another function for calculating remainder we instead want to make one quirk friendly unified function.
--- drivers/usb/host/xhci-ring.c | 106 ++++++++++++++++++------------------------- drivers/usb/host/xhci.h | 2 + 2 files changed, 46 insertions(+), 62 deletions(-)
drivers/usb/host/xhci-ring.c +44 -62
@@ -3001,21 +3001,6 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, }/* -* The TD size is the number of bytes remaining in the TD (including this TRB), -* right shifted by 10. -* It must fit in bits 21:17, so it can't be bigger than 31. -*/ -static u32 xhci_td_remainder (unsigned int remainder) -{ -u32 max = (1 << (21 -17 +1 )) -1 ; - -if ((remainder >>10 ) >= max) -return max <<17 ; -else -return (remainder >>10 ) <<17 ; -} - -/* * For xHCI 1.0 host controllers, TD size is the number of max packet sized * packets remaining in the TD (*not* including this TRB). *
@@ -3027,30 +3012,36 @@ static u32 xhci_td_remainder(unsigned int remainder)* * TD size = total_packet_count - packets_transferred * -* It must fit in bits 21:17, so it can't be bigger than 31. +* For xHCI 0.96 and older, TD size field should be the remaining bytes +* including this TRB, right shifted by 10 +* +* For all hosts it must fit in bits 21:17, so it can't be bigger than 31. +* This is taken care of in the TRB_TD_SIZE() macro +* * The last TRB in a TD must have the TD size set to zero. */ -static u32 xhci_v1_0_td_remainder (int running_total,int trb_buff_len, -unsigned int total_packet_count,struct urb *urb, -unsigned int num_trbs_left) +static u32 xhci_td_remainder (struct xhci_hcd *xhci,int transferred, +int trb_buff_len,unsigned int td_total_len, +struct urb *urb,unsigned int num_trbs_left) { -int packets_transferred; +u32 maxp, total_packet_count; + +if (xhci->hci_version <0x100 ) +return ((td_total_len - transferred) >>10 ); + + maxp =GET_MAX_PACKET (usb_endpoint_maxp (&urb->ep->desc)); + total_packet_count =DIV_ROUND_UP (td_total_len, maxp);/* One TRB with a zero-length data packet. */ -if (num_trbs_left ==0 || (running_total ==0 && trb_buff_len ==0 )) +if (num_trbs_left ==0 || (transferred ==0 && trb_buff_len ==0 ) || + trb_buff_len == td_total_len)return 0 ; -/* All the TRB queueing functions don't count the current TRB in -* running_total. -*/ - packets_transferred = (running_total + trb_buff_len) / -GET_MAX_PACKET (usb_endpoint_maxp (&urb->ep->desc)); - -if ((total_packet_count - packets_transferred) >31 ) -return 31 <<17 ; -return (total_packet_count - packets_transferred) <<17 ; +/* Queueing functions don't count the current TRB into transferred */ +return (total_packet_count - ((transferred + trb_buff_len) / maxp)); } +static int queue_bulk_sg_tx (struct xhci_hcd *xhci,gfp_t mem_flags,struct urb *urb,int slot_id,unsigned int ep_index) {
@@ -3172,17 +3163,12 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, }/* Set the TRB length, TD size, and interrupter fields. */ -if (xhci->hci_version <0x100 ) { - remainder =xhci_td_remainder ( - urb->transfer_buffer_length - - running_total); - }else { - remainder =xhci_v1_0_td_remainder (running_total, - trb_buff_len, total_packet_count, urb, - num_trbs -1 ); - } + remainder =xhci_td_remainder (xhci, running_total, trb_buff_len, + urb->transfer_buffer_length, + urb, num_trbs -1 ); + length_field =TRB_LEN (trb_buff_len) | - remainder | +TRB_TD_SIZE (remainder) |TRB_INTR_TARGET (0 );if (num_trbs >1 )
@@ -3345,17 +3331,12 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, field |=TRB_ISP ;/* Set the TRB length, TD size, and interrupter fields. */ -if (xhci->hci_version <0x100 ) { - remainder =xhci_td_remainder ( - urb->transfer_buffer_length - - running_total); - }else { - remainder =xhci_v1_0_td_remainder (running_total, - trb_buff_len, total_packet_count, urb, - num_trbs -1 ); - } + remainder =xhci_td_remainder (xhci, running_total, trb_buff_len, + urb->transfer_buffer_length, + urb, num_trbs -1 ); + length_field =TRB_LEN (trb_buff_len) | - remainder | +TRB_TD_SIZE (remainder) |TRB_INTR_TARGET (0 );if (num_trbs >1 )
@@ -3393,7 +3374,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,struct usb_ctrlrequest *setup;struct xhci_generic_trb *start_trb;int start_cycle; -u32 field, length_field; +u32 field, length_field, remainder;struct urb_priv *urb_priv;struct xhci_td *td;
@@ -3466,9 +3447,15 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,else field =TRB_TYPE (TRB_DATA ); + remainder =xhci_td_remainder (xhci,0 , + urb->transfer_buffer_length, + urb->transfer_buffer_length, + urb,1 ); + length_field =TRB_LEN (urb->transfer_buffer_length) | -xhci_td_remainder (urb->transfer_buffer_length) | +TRB_TD_SIZE (remainder) |TRB_INTR_TARGET (0 ); +if (urb->transfer_buffer_length >0 ) {if (setup->bRequestType &USB_DIR_IN ) field |=TRB_DIR_IN ;
@@ -3691,17 +3678,12 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, trb_buff_len = td_remain_len;/* Set the TRB length, TD size, & interrupter fields. */ -if (xhci->hci_version <0x100 ) { - remainder =xhci_td_remainder ( - td_len - running_total); - }else { - remainder =xhci_v1_0_td_remainder ( - running_total, trb_buff_len, - total_packet_count, urb, - (trbs_per_td - j -1 )); - } + remainder =xhci_td_remainder (xhci, running_total, + trb_buff_len, td_len, + urb, trbs_per_td - j -1 ); + length_field =TRB_LEN (trb_buff_len) | - remainder | +TRB_TD_SIZE (remainder) |TRB_INTR_TARGET (0 ); queue_trb(xhci, ep_ring, more_trbs_coming,
drivers/usb/host/xhci.h +2 -0
@@ -1130,6 +1130,8 @@ enum xhci_setup_dev {/* Normal TRB fields */ /* transfer_len bitmasks - bits 0:16 */ #define TRB_LEN (p) ((p) & 0x1ffff) +/* TD Size, packets remaining in this TD, bits 21:17 (5 bits, so max 31) */ +#define TRB_TD_SIZE (p) (min((p), (u32)31) << 17)/* Interrupter Target - which MSI-X vector to target the completion event at */ #define TRB_INTR_TARGET (p) (((p) & 0x3ff) << 22)#define GET_INTR_TARGET (p) (((p) >> 22) & 0x3ff)
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] usb: xhci: Makefile: move xhci-pci and xhci-plat-hcd after xhci-hcd
In reply to Sasha LevinFrom: "Lu, Baolu" <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 8451a34ff6c7c756e9e0f0094a3ba856c9734e5d ]
Module xhci-pci and xhci-plat-hcd depend on xhci-hcd. Module xhci-hcd should be put at a place before xhci-pci and xhci-plat-hcd. Otherwise, xhci_hcd_init() might be executed after other functions in xhci-hcd if they are all selected to be built in.
--- drivers/usb/host/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/Makefile +2 -3
@@ -26,9 +26,6 @@ obj-$(CONFIG_USB_WHCI_HCD) += whci/ obj-$(CONFIG_PCI) += pci-quirks.o -obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o -obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o - obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
@@ -63,6 +60,8 @@ obj-$(CONFIG_USB_OHCI_HCD_PXA27X) += ohci-pxa27x.o obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o obj-$(CONFIG_USB_FHCI_HCD) += fhci.o obj-$(CONFIG_USB_XHCI_HCD) += xhci-hcd.o +obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o +obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o obj-$(CONFIG_USB_SL811_HCD) += sl811-hcd.o obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 0a0b13275558c32bbf6241464a7244b1ffd5afb3 ]
We don't want to write to .text, so let's move l2_inv_api_params to .data and access it via a pointer.
non-executable")
--- arch/arm/mach-omap2/sleep34xx.S | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +9 -3
@@ -436,12 +436,14 @@ skipl2dis: and r1, #0x700 cmp r1, #0x300 beq l2_inv_gp + adr r0, l2_inv_api_params_offset + ldr r3, [r0] + add r3, r3, r0 @ r3 points to dummy parameters mov r0, #40 @ set service ID for PPA mov r12, r0 @ copy secure Service ID in r12 mov r1, #0 @ set task id for ROM code in r1 mov r2, #4 @ set some flags in r2, r6 mov r6, #0xff - adr r3, l2_inv_api_params @ r3 points to dummy parameters dsb @ data write barrier dmb @ data memory barrier smc #1 @ call SMI monitor (smi #1)
@@ -475,8 +477,8 @@ skipl2dis: b logic_l1_restore .align -l2_inv_api_params: - .word 0x1, 0x00 +l2_inv_api_params_offset: + .long l2_inv_api_params - . l2_inv_gp: /* Execute smi to invalidate L2 cache */ mov r12, #0x1 @ set up to invalidate L2
@@ -531,6 +533,10 @@ l2dis_3630_offset: l2dis_3630: .word 0 + .data +l2_inv_api_params: + .word 0x1, 0x00 + /* * Internal functions */
Signature · 1 line
2.5.0
RE: [added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
Quoted 2 lines
From: Sasha Levin [mailto:[email protected]]
Sent: Wednesday, February 10, 2016 9:11 AM
Did you test these changes?
Quoted 2 lines
We don't want to write to .text, so let's move
l2_inv_api_paramsto .data and access it via a pointer.
At one point in time some of these functions were copied from DRAM load address into SRAM and executed from there.
Some of these sections had to be executed outside of DDR due to issues. The copy assumed contagious section. If you move some of the data into a separate section and any copy is still in code the result won't work as expected. If the code has changed then maybe its OK. Back when this code was entered it was hand stepped to ensure correct behavior.
Regards,
Richard W.
Re: [added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
Quoted 8 lines · Richard
Quoted 2 lines
From: Sasha Levin [mailto:[email protected]]
Sent: Wednesday, February 10, 2016 9:11 AMDid you test these changes?
Quoted 2 lines
We don't want to write to .text, so let's move
l2_inv_api_paramsto .data and access it via a pointer.
Quoted 8 lines
At one point in time some of these functions were copied from DRAM load address into SRAM and executed from there.
Some of these sections had to be executed outside of DDR due to issues. The copy assumed contagious section. If you move some of the data into a separate section and any copy is still in code the result won't work
as expected. If the code has changed then maybe its OK. Back when
this code was entered it was hand stepped to ensure correct behavior.
Yes, this isn't going to work if it is copied out of the DDR, because moving the data to the .data section and introducing a PC relative access to it will make the code expect to access data at a relative offset from the SRAM.
Sascha, please drop this for now.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Re: [added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
Quoted 17 lines · Russell King - ARM Linux
Quoted 8 lines · Richard
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
From: Sasha Levin [mailto:[email protected]]
Sent: Wednesday, February 10, 2016 9:11 AMDid you test these changes?
Quoted 2 lines
Quoted 2 lines
We don't want to write to .text, so let's move
l2_inv_api_paramsto .data and access it via a pointer.Quoted 8 lines
Quoted 8 lines
At one point in time some of these functions were copied from DRAM load address into SRAM and executed from there.
Some of these sections had to be executed outside of DDR due to issues. The copy assumed contagious section. If you move some of the data into a separate section and any copy is still in code the result won't work
as expected. If the code has changed then maybe its OK. Back when
this code was entered it was hand stepped to ensure correct behavior.
Quoted 6 lines
Yes, this isn't going to work if it is copied out of the DDR, because moving the data to the .data section and introducing a PC relative access to it will make the code expect to access data at a relative offset from the SRAM.
Sascha, please drop this for now.
Dropped.
Thanks,
Sasha
Tony Lindgren
maintainerRe: [added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
In reply to Russell King - ARM LinuxHi,
Quoted 5 lines · Russell King - ARM Linux
Quoted 4 lines · Richard
Quoted 2 lines
From: Sasha Levin [mailto:[email protected]]
Sent: Wednesday, February 10, 2016 9:11 AMDid you test these changes?
I certainly did with off idle and retention idle for omap3 on 3430 and 36xx. And on n900 that's the HS omap 3430. And we don't have any HS 36xx in the mainline.
Quoted 12 lines
Quoted 11 lines
Quoted 2 lines
We don't want to write to .text, so let's move
l2_inv_api_paramsto .data and access it via a pointer.At one point in time some of these functions were copied from DRAM load address into SRAM and executed from there.
Some of these sections had to be executed outside of DDR due to issues. The copy assumed contagious section. If you move some of the data into a separate section and any copy is still in code the result won't work
as expected. If the code has changed then maybe its OK. Back when
this code was entered it was hand stepped to ensure correct behavior.
Quoted 6 lines
Yes, this isn't going to work if it is copied out of the DDR, because moving the data to the .data section and introducing a PC relative access to it will make the code expect to access data at a relative offset from the SRAM.
Sascha, please drop this for now.
Hmm did I miss something? Since commit 46e130d298a3 ("ARM: pm: omap3:
run the ASM sleep code from DDR") we only run minimal parts of the code in SRAM. Naturally if any SRAM code uses PC relative access things won't work.
Here are the only pieces running in SRAM:
- omap3_do_wfi running in SRAM only for retention idle as off idle restores DDR for us
- For HS omaps, save_secure_ram_context is already in .data as it's only run in SRAM
- For some revisions, we have es3_sdrc_fix dynamically copied to SRAM
If there are other places that I've missed, please let me know and I'll take a look ASAP!
Regards,
Tony
Re: [added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
Quoted 20 lines · Tony Lindgren
Hi,
Quoted 6 lines · Russell King - ARM Linux
Yes, this isn't going to work if it is copied out of the DDR, because moving the data to the .data section and introducing a PC relative access to it will make the code expect to access data at a relative offset from the SRAM.
Sascha, please drop this for now.
Hmm did I miss something? Since commit
46e130d298a3("ARM: pm: omap3:
run the ASM sleep code from DDR") we only run minimal parts of the code in SRAM. Naturally if any SRAM code uses PC relative access things won't work.Here are the only pieces running in SRAM:
-
omap3_do_wfirunning in SRAM only for retention idle as off idle restores DDR for us
Quoted 8 lines
- For HS omaps,
save_secure_ram_contextis already in .data as it's only run in SRAM- For some revisions, we have
es3_sdrc_fixdynamically copied to SRAMIf there are other places that I've missed, please let me know and I'll take a look ASAP!
Hmm, ok, I missed that. It looks fine, but now that I'm looking deeper, I'm wondering what the point of this particular change is.
Quoted 1 line
From what I can see, you're moving both
l2dis_3630andl2_inv_api_params
into the .data section, and adding extra complication to access those in a position-relative manner. However, I'm unable to locate anything which writes to either of these: they're only read from - nothing can, they're not even global symbols, so aren't referencable outside of sleep34xx.S.
So I don't see why this should be Cc'd for stable kernels, since as far as I can see, it's not fixing any bug.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Tony Lindgren
maintainerRe: [added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
Quoted 33 lines · Russell King - ARM Linux
Quoted 20 lines · Tony Lindgren
Hi,
Quoted 6 lines · Russell King - ARM Linux
Yes, this isn't going to work if it is copied out of the DDR, because moving the data to the .data section and introducing a PC relative access to it will make the code expect to access data at a relative offset from the SRAM.
Sascha, please drop this for now.
Hmm did I miss something? Since commit
46e130d298a3("ARM: pm: omap3:
run the ASM sleep code from DDR") we only run minimal parts of the code in SRAM. Naturally if any SRAM code uses PC relative access things won't work.Here are the only pieces running in SRAM:
-
omap3_do_wfirunning in SRAM only for retention idle as off idle restores DDR for usQuoted 8 lines
- For HS omaps,
save_secure_ram_contextis already in .data as it's only run in SRAM- For some revisions, we have
es3_sdrc_fixdynamically copied to SRAMIf there are other places that I've missed, please let me know and I'll take a look ASAP!
Hmm, ok, I missed that. It looks fine, but now that I'm looking deeper, I'm wondering what the point of this particular change is.
Quoted 8 lines
From what I can see, you're moving both
l2dis_3630andl2_inv_api_paramsinto the .data section, and adding extra complication to access those in a position-relative manner. However, I'm unable to locate anything which writes to either of these: they're only read from - nothing can, they're not even global symbols, so aren't referencable outside ofsleep34xx.S.So I don't see why this should be Cc'd for stable kernels, since as far as I can see, it's not fixing any bug.
We have enable_omap3630_toggle_l2_on_restore toggle l2dis_3630 from pm34xx.c. That won't work if CONFIG_DEBUG_RODATA is selected.
But for l2_inv_api_params, it seems you're right. That's read only data!
Regards,
Tony
Tony Lindgren
maintainerRe: [added to the 4.1 stable tree] ARM: OMAP2+: Fix l2_inv_api_params for rodata
In reply to Tony LindgrenQuoted 4 lines · Tony Lindgren
I certainly did with off idle and retention idle for omap3 on 3430 and 36xx. And on n900 that's the HS omap 3430. And we don't have any HS 36xx in the mainline.
Slight correction to the above.. We do have HS 36xx booting in mainline for n9 and n950, but the PM support seems to be incomplete for those in the mainline kernel.
Regards,
Tony
[added to the 4.1 stable tree] usb: xhci: handle both SSIC ports in PME stuck quirk
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit fa89537783cb442263fa5a14df6c7693eaf32f11 ]
Commit abce329c27b3 ("xhci: Workaround to get D3 working in Intel xHCI") adds a workaround for a limitation of PME storm caused by SSIC port in some Intel SoCs. This commit only handled one SSIC port, while there are actually two SSIC ports in the chips. This patch handles both SSIC ports. Without this fix, users still see PME storm.
--- drivers/usb/host/xhci-pci.c | 48 +++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 19 deletions(-)
drivers/usb/host/xhci-pci.c +29 -19
@@ -28,7 +28,9 @@#include "xhci.h" #include "xhci-trace.h" -#define PORT2_SSIC_CONFIG_REG2 0x883c +#define SSIC_PORT_NUM 2 +#define SSIC_PORT_CFG2 0x880c +#define SSIC_PORT_CFG2_OFFSET 0x30#define PROG_DONE (1 << 30)#define SSIC_PORT_UNUSED (1 << 31)
@@ -317,28 +319,36 @@ static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend)struct pci_dev *pdev =to_pci_dev (hcd->self.controller);u32 val;void __iomem *reg; +int i;if (pdev->vendor ==PCI_VENDOR_ID_INTEL && pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ) { - reg = (void __iomem *) xhci->cap_regs +PORT2_SSIC_CONFIG_REG2 ; - -/* Notify SSIC that SSIC profile programming is not done */ - val =readl (reg) & ~PROG_DONE ; -writel (val, reg); - -/* Mark SSIC port as unused(suspend) or used(resume) */ - val =readl (reg); -if (suspend) - val |=SSIC_PORT_UNUSED ; -else - val &= ~SSIC_PORT_UNUSED ; -writel (val, reg); - -/* Notify SSIC that SSIC profile programming is done */ - val =readl (reg) |PROG_DONE ; -writel (val, reg); -readl (reg); +for (i =0 ; i <SSIC_PORT_NUM ; i++) { + reg = (void __iomem *) xhci->cap_regs + +SSIC_PORT_CFG2 + + i *SSIC_PORT_CFG2_OFFSET ; + +/* +* Notify SSIC that SSIC profile programming +* is not done. +*/ + val =readl (reg) & ~PROG_DONE ; +writel (val, reg); + +/* Mark SSIC port as unused(suspend) or used(resume) */ + val =readl (reg); +if (suspend) + val |=SSIC_PORT_UNUSED ; +else + val &= ~SSIC_PORT_UNUSED ; +writel (val, reg); + +/* Notify SSIC that SSIC profile programming is done */ + val =readl (reg) |PROG_DONE ; +writel (val, reg); +readl (reg); + } } reg = (void __iomem *) xhci->cap_regs +0x80a4 ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] usb: xhci: add a quirk bit for ssic port unused
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 7e70cbffe236721051bbaff965e477df06dcb190 ]
Two workarounds introduced by commit b8cb91e058cd ("xhci: Workaround for PME stuck issues in Intel xhci") and commit abce329c27b3 ("xhci:
Workaround to get D3 working in Intel xHCI") share a single quirk bit XHCI_PME_STUCK_QUIRK. These two workarounds actually are different and might happen on different hardwares. Need to separate them by adding a quirk bit for the later.
--- drivers/usb/host/xhci-pci.c | 79 ++++++++++++++++++++++++++------------------- drivers/usb/host/xhci.h | 1 + 2 files changed, 46 insertions(+), 34 deletions(-)
drivers/usb/host/xhci-pci.c +45 -34
@@ -150,6 +150,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI)) { xhci->quirks |=XHCI_PME_STUCK_QUIRK ; } +if (pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ) { + xhci->quirks |=XHCI_SSIC_PORT_UNUSED ; + }if (pdev->vendor ==PCI_VENDOR_ID_ETRON && pdev->device ==PCI_DEVICE_ID_EJ168 ) { xhci->quirks |=XHCI_RESET_ON_RESUME ;
@@ -310,46 +314,47 @@ static void xhci_pci_remove(struct pci_dev *dev)* SSIC PORT need to be marked as "unused" before putting xHCI * into D3. After D3 exit, the SSIC port need to be marked as "used". * Without this change, xHCI might not enter D3 state. -* Make sure PME works on some Intel xHCI controllers by writing 1 to clear -* the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 */ -static void xhci_pme_quirk (struct usb_hcd *hcd,bool suspend) +static void xhci_ssic_port_unused_quirk (struct usb_hcd *hcd,bool suspend) {struct xhci_hcd *xhci =hcd_to_xhci (hcd); -struct pci_dev *pdev =to_pci_dev (hcd->self.controller);u32 val;void __iomem *reg;int i; -if (pdev->vendor ==PCI_VENDOR_ID_INTEL && - pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ) { - -for (i =0 ; i <SSIC_PORT_NUM ; i++) { - reg = (void __iomem *) xhci->cap_regs + -SSIC_PORT_CFG2 + - i *SSIC_PORT_CFG2_OFFSET ; - -/* -* Notify SSIC that SSIC profile programming -* is not done. -*/ - val =readl (reg) & ~PROG_DONE ; -writel (val, reg); - -/* Mark SSIC port as unused(suspend) or used(resume) */ - val =readl (reg); -if (suspend) - val |=SSIC_PORT_UNUSED ; -else - val &= ~SSIC_PORT_UNUSED ; -writel (val, reg); - -/* Notify SSIC that SSIC profile programming is done */ - val =readl (reg) |PROG_DONE ; -writel (val, reg); -readl (reg); - } +for (i =0 ; i <SSIC_PORT_NUM ; i++) { + reg = (void __iomem *) xhci->cap_regs + +SSIC_PORT_CFG2 + + i *SSIC_PORT_CFG2_OFFSET ; + +/* Notify SSIC that SSIC profile programming is not done. */ + val =readl (reg) & ~PROG_DONE ; +writel (val, reg); + +/* Mark SSIC port as unused(suspend) or used(resume) */ + val =readl (reg); +if (suspend) + val |=SSIC_PORT_UNUSED ; +else + val &= ~SSIC_PORT_UNUSED ; +writel (val, reg); + +/* Notify SSIC that SSIC profile programming is done */ + val =readl (reg) |PROG_DONE ; +writel (val, reg); +readl (reg); } +} + +/* +* Make sure PME works on some Intel xHCI controllers by writing 1 to clear +* the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 +*/ +static void xhci_pme_quirk (struct usb_hcd *hcd) +{ +struct xhci_hcd *xhci =hcd_to_xhci (hcd); +void __iomem *reg; +u32 val; reg = (void __iomem *) xhci->cap_regs +0x80a4 ; val =readl (reg);
@@ -370,7 +375,10 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) pdev->no_d3cold = true;if (xhci->quirks &XHCI_PME_STUCK_QUIRK ) -xhci_pme_quirk (hcd, true); +xhci_pme_quirk (hcd); + +if (xhci->quirks &XHCI_SSIC_PORT_UNUSED ) +xhci_ssic_port_unused_quirk (hcd, true);return xhci_suspend (xhci, do_wakeup); }
@@ -402,8 +410,11 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)if (pdev->vendor ==PCI_VENDOR_ID_INTEL )usb_enable_intel_xhci_ports (pdev); +if (xhci->quirks &XHCI_SSIC_PORT_UNUSED ) +xhci_ssic_port_unused_quirk (hcd, false); +if (xhci->quirks &XHCI_PME_STUCK_QUIRK ) -xhci_pme_quirk (hcd, false); +xhci_pme_quirk (hcd); retval =xhci_resume (xhci, hibernated);return retval;
drivers/usb/host/xhci.h +1 -0
@@ -1570,6 +1570,7 @@ struct xhci_hcd {/* For controllers with a broken beyond repair streams implementation */ #define XHCI_BROKEN_STREAMS (1 << 19)#define XHCI_PME_STUCK_QUIRK (1 << 20) +#define XHCI_SSIC_PORT_UNUSED (1 << 22)unsigned int num_active_eps;unsigned int limit_active_eps;/* There are two roothubs to keep track of bus suspend info for */
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: OMAP2+: Fix l2dis_3630 for rodata
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit eeaf9646aca89d097861caa24d9818434e48810e ]
We don't want to write to .text section. Let's move l2dis_3630 to .data and access it via a pointer.
For calculating the offset, let's optimize out the add and do it in ldr/str as suggested by Nicolas Pitre <[email protected]>.
non-executable")
--- arch/arm/mach-omap2/sleep34xx.S | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +13 -4
@@ -86,8 +86,9 @@ ENTRY(enable_omap3630_toggle_l2_on_restore) stmfd sp!, {lr} @ save registers on stack /* Setup so that we will disable and enable l2 */ mov r1, #0x1 - adrl r2, l2dis_3630 @ may be too distant for plain adr - str r1, [r2] + adrl r3, l2dis_3630_offset @ may be too distant for plain adr + ldr r2, [r3] @ value for offset + str r1, [r2, r3] @ write to l2dis_3630 ldmfd sp!, {pc} @ restore regs and return ENDPROC(enable_omap3630_toggle_l2_on_restore)
@@ -415,7 +416,9 @@ ENTRY(omap3_restore) cmp r2, #0x0 @ Check if target power state was OFF or RET bne logic_l1_restore - ldr r0, l2dis_3630 + adr r1, l2dis_3630_offset @ address for offset + ldr r0, [r1] @ value for offset + ldr r0, [r1, r0] @ value at l2dis_3630 cmp r0, #0x1 @ should we disable L2 on 3630? bne skipl2dis mrc p15, 0, r0, c1, c0, 1
@@ -484,7 +487,9 @@ l2_inv_gp: mov r12, #0x2 smc #0 @ Call SMI monitor (smieq) logic_l1_restore: - ldr r1, l2dis_3630 + adr r0, l2dis_3630_offset @ adress for offset + ldr r1, [r0] @ value for offset + ldr r1, [r0, r1] @ value at l2dis_3630 cmp r1, #0x1 @ Test if L2 re-enable needed on 3630 bne skipl2reen mrc p15, 0, r1, c1, c0, 1
@@ -513,6 +518,10 @@ control_stat: .word CONTROL_STAT control_mem_rta: .word CONTROL_MEM_RTA_CTRL +l2dis_3630_offset: + .long l2dis_3630 - . + + .data l2dis_3630: .word 0
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Broxton-M platforms
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit ccc04afb72cddbdf7c0e1c17e92886405a71b754 ]
Intel Broxton M was verifed to require XHCI_PME_STUCK_QUIRK quirk as well.
--- drivers/usb/host/xhci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +3 -1
@@ -47,6 +47,7 @@#define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f +#define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8static const char hcd_name[] ="xhci_hcd" ;
@@ -147,7 +148,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)if (pdev->vendor ==PCI_VENDOR_ID_INTEL && (pdev->device ==PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || - pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI )) { + pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || + pdev->device ==PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI )) { xhci->quirks |=XHCI_PME_STUCK_QUIRK ; } if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: OMAP2+: Fix ppa_zero_params and ppa_por_params for rodata
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 4da597d16602d14405b71a18d45e1c59f28f0fd2 ]
We don't want to write to .text so let's move ppa_zero_params and ppa_por_params to .data and access them via pointers.
Note that I have not been able to test as we I don't have a HS omap4 to test with. The code has been changed in similar way as for omap3 though.
non-executable")
--- arch/arm/mach-omap2/sleep44xx.S | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/sleep44xx.S +17 -8
@@ -29,12 +29,6 @@ dsb .endm -ppa_zero_params: - .word 0x0 - -ppa_por_params: - .word 1, 0 - #ifdef CONFIG_ARCH_OMAP4 /*
@@ -266,7 +260,9 @@ ENTRY(omap4_cpu_resume) beq skip_ns_smp_enable ppa_actrl_retry: mov r0, #OMAP4_PPA_CPU_ACTRL_SMP_INDEX - adr r3, ppa_zero_params @ Pointer to parameters + adr r1, ppa_zero_params_offset + ldr r3, [r1] + add r3, r3, r1 @ Pointer to ppa_zero_params mov r1, #0x0 @ Process ID mov r2, #0x4 @ Flag mov r6, #0xff
@@ -303,7 +299,9 @@ skip_ns_smp_enable: ldr r0, =OMAP4_PPA_L2_POR_INDEX ldr r1, =OMAP44XX_SAR_RAM_BASE ldr r4, [r1, #L2X0_PREFETCH_CTRL_OFFSET] - adr r3, ppa_por_params + adr r1, ppa_por_params_offset + ldr r3, [r1] + add r3, r3, r1 @ Pointer to ppa_por_params str r4, [r3, #0x04] mov r1, #0x0 @ Process ID mov r2, #0x4 @ Flag
@@ -328,6 +326,8 @@ skip_l2en: #endif b cpu_resume @ Jump to generic resume +ppa_por_params_offset: + .long ppa_por_params - . ENDPROC(omap4_cpu_resume) #endif /* CONFIG_ARCH_OMAP4 */
@@ -382,4 +382,13 @@ ENTRY(omap_do_wfi) nop ldmfd sp!, {pc} +ppa_zero_params_offset: + .long ppa_zero_params - . ENDPROC(omap_do_wfi) + + .data +ppa_zero_params: + .word 0 + +ppa_por_params: + .word 1, 0
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] usb: xhci: set SSIC port unused only if xhci_suspend succeeds
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 92149c930cce1865d0d4aca2ab07c2b4b197b418 ]
XHCI_SSIC_PORT_UNUSED quirk was applied to the xHCI host controllers in some Intel SoC chips. With this quirk applied, SSIC port is set to "unused" prior to xhci_suspend(). This may cause problem if host fails to suspend. In this case, the port is set to unused without host further entering D3, and the port will not be usable anymore.
--- drivers/usb/host/xhci-pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +6 -1
@@ -366,6 +366,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) {struct xhci_hcd *xhci =hcd_to_xhci (hcd);struct pci_dev *pdev =to_pci_dev (hcd->self.controller); +int ret;/* * Systems with the TI redriver that loses port status change events
@@ -380,7 +381,11 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)if (xhci->quirks &XHCI_SSIC_PORT_UNUSED )xhci_ssic_port_unused_quirk (hcd, true); -return xhci_suspend (xhci, do_wakeup); + ret =xhci_suspend (xhci, do_wakeup); +if (ret && (xhci->quirks &XHCI_SSIC_PORT_UNUSED )) +xhci_ssic_port_unused_quirk (hcd, false); + +return ret; }static int xhci_pci_resume (struct usb_hcd *hcd,bool hibernated)
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: OMAP2+: Fix save_secure_ram_context for rodata
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit a5311d4d13df80bd71a9e47f9ecaf327f478fab1 ]
We don't want to write to .text and we can move save_secure_ram_context into .data as it all gets copied into SRAM anyways.
non-executable")
--- arch/arm/mach-omap2/sleep34xx.S | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +8 -2
@@ -92,8 +92,12 @@ ENTRY(enable_omap3630_toggle_l2_on_restore) ldmfd sp!, {pc} @ restore regs and return ENDPROC(enable_omap3630_toggle_l2_on_restore) - .text -/* Function to call rom code to save secure ram context */ +/* + * Function to call rom code to save secure ram context. This gets + * relocated to SRAM, so it can be all in .data section. Otherwise + * we need to initialize api_params separately. + */ + .data .align 3 ENTRY(save_secure_ram_context) stmfd sp!, {r4 - r11, lr} @ save registers on stack
@@ -127,6 +131,8 @@ ENDPROC(save_secure_ram_context) ENTRY(save_secure_ram_context_sz) .word . - save_secure_ram_context + .text + /* * ====================== * == Idle entry point ==
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] [media] tda1004x: only update the frontend properties if locked
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit e8beb02343e7582980c6705816cd957cf4f74c7a ]
The tda1004x was updating the properties cache before locking. If the device is not locked, the data at the registers are just random values with no real meaning.
This caused the driver to fail with libdvbv5, as such library calls GET_PROPERTY from time to time, in order to return the DVB stats.
Tested with a saa7134 card 78:
ASUSTeK P7131 Dual, vendor PCI ID: 1043:4862
--- drivers/media/dvb-frontends/tda1004x.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/dvb-frontends/tda1004x.c +9 -0
@@ -903,9 +903,18 @@ static int tda1004x_get_fe(struct dvb_frontend *fe) {struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache;struct tda1004x_state * state = fe->demodulator_priv; +int status;dprintk ("%s\n" , __func__); + status =tda1004x_read_byte (state,TDA1004X_STATUS_CD ); +if (status ==-1 ) +return -EIO ; + +/* Only update the properties cache if device is locked */ +if (!(status &8 )) +return 0 ; +// inversion status fe_params->inversion =INVERSION_OFF ;if (tda1004x_read_byte (state,TDA1004X_CONFC1 ) &0x20 )
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] xhci: Fix list corruption in urb dequeue at host removal
In reply to Sasha LevinFrom: Mathias Nyman <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 5c82171167adb8e4ac77b91a42cd49fb211a81a0 ]
xhci driver frees data for all devices, both usb2 and and usb3 the first time usb_remove_hcd() is called, including td_list and and xhci_ring structures.
When usb_remove_hcd() is called a second time for the second xhci bus it will try to dequeue all pending urbs, and touches td_list which is already freed for that endpoint.
--- drivers/usb/host/xhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +3 -1
@@ -1559,7 +1559,9 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb,"HW died, freeing TD." ); urb_priv = urb->hcpriv; -for (i = urb_priv->td_cnt; i < urb_priv->length; i++) { +for (i = urb_priv->td_cnt; + i < urb_priv->length && xhci->devs[urb->dev->slot_id]; + i++) { td = urb_priv->td[i];if (!list_empty (&td->td_list))list_del_init (&td->td_list);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] [media] saa7134-alsa: Only frees registered sound cards
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit ac75fe5d8fe4a0bf063be18fb29684405279e79e ]
That prevents this bug:
[ 2382.269496] BUG: unable to handle kernel NULL pointer dereference at 0000000000000540 [ 2382.270013] IP: [<ffffffffa01fe616>] snd_card_free+0x36/0x70 [snd] [ 2382.270013] PGD 0 [ 2382.270013] Oops: 0002 [#1] SMP [ 2382.270013] Modules linked in: saa7134_alsa(-) tda1004x saa7134_dvb videobuf2_dvb dvb_core tda827x tda8290 tuner saa7134 tveeprom videobuf2_dma_sg videobuf2_memops videobuf2_v4l2 videobuf2_core v4l2_common videodev media auth_rpcgss nfsv4 dns_resolver nfs lockd grace sunrpc tun bridge stp llc ebtables ip6table_filter ip6_tables nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack it87 hwmon_vid snd_hda_codec_idt snd_hda_codec_generic iTCO_wdt iTCO_vendor_support snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_seq pcspkr i2c_i801 snd_seq_device snd_pcm snd_timer lpc_ich snd mfd_core soundcore binfmt_misc i915 video i2c_algo_bit drm_kms_helper drm r8169 ata_generic serio_raw pata_acpi mii i2c_core [last unloaded: videobuf2_memops] [ 2382.270013] CPU: 0 PID: 4899 Comm: rmmod Not tainted 4.5.0-rc1+ #4 [ 2382.270013] Hardware name: PCCHIPS P17G/P17G, BIOS 080012 05/14/2008 [ 2382.270013] task: ffff880039c38000 ti: ffff88003c764000 task.ti: ffff88003c764000 [ 2382.270013] RIP: 0010:[<ffffffffa01fe616>] [<ffffffffa01fe616>] snd_card_free+0x36/0x70 [snd] [ 2382.270013] RSP: 0018:ffff88003c767ea0 EFLAGS: 00010286 [ 2382.270013] RAX: ffff88003c767eb8 RBX: 0000000000000000 RCX: 0000000000006260 [ 2382.270013] RDX: ffffffffa020a060 RSI: ffffffffa0206de1 RDI: ffff88003c767eb0 [ 2382.270013] RBP: ffff88003c767ed8 R08: 0000000000019960 R09: ffffffff811a5412 [ 2382.270013] R10: ffffea0000d7c200 R11: 0000000000000000 R12: ffff88003c767ea8 [ 2382.270013] R13: 00007ffe760617f7 R14: 0000000000000000 R15: 0000557625d7f1e0 [ 2382.270013] FS: 00007f80bb1c0700(0000) GS:ffff88003f400000(0000) knlGS:0000000000000000 [ 2382.270013] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2382.270013] CR2: 0000000000000540 CR3: 000000003c00f000 CR4: 00000000000006f0 [ 2382.270013] Stack: [ 2382.270013] 000000003c767ed8 ffffffff00000000 ffff880000000000 ffff88003c767eb8 [ 2382.270013] ffff88003c767eb8 ffffffffa049a890 00007ffe76060060 ffff88003c767ef0 [ 2382.270013] ffffffffa049889d ffffffffa049a500 ffff88003c767f48 ffffffff8111079c [ 2382.270013] Call Trace: [ 2382.270013] [<ffffffffa049889d>] saa7134_alsa_exit+0x1d/0x780 [saa7134_alsa] [ 2382.270013] [<ffffffff8111079c>] SyS_delete_module+0x19c/0x1f0 [ 2382.270013] [<ffffffff8170fc2e>] entry_SYSCALL_64_fastpath+0x12/0x71 [ 2382.270013] Code: 20 a0 48 c7 c6 e1 6d 20 a0 48 89 e5 41 54 53 4c 8d 65 d0 48 89 fb 48 83 ec 28 c7 45 d0 00 00 00 00 49 8d 7c 24 08 e8 7a 55 ed e0 <4c> 89 a3 40 05 00 00 48 89 df e8 eb fd ff ff 85 c0 75 1a 48 8d [ 2382.270013] RIP [<ffffffffa01fe616>] snd_card_free+0x36/0x70 [snd] [ 2382.270013] RSP <ffff88003c767ea0> [ 2382.270013] CR2: 0000000000000540
--- drivers/media/pci/saa7134/saa7134-alsa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/pci/saa7134/saa7134-alsa.c +4 -1
@@ -1218,6 +1218,8 @@ static int alsa_device_init(struct saa7134_dev *dev)static int alsa_device_exit (struct saa7134_dev *dev) { +if (!snd_saa7134_cards[dev->nr]) +return 1 ;snd_card_free (snd_saa7134_cards[dev->nr]); snd_saa7134_cards[dev->nr] =NULL ;
@@ -1267,7 +1269,8 @@ static void saa7134_alsa_exit(void)int idx;for (idx =0 ; idx <SNDRV_CARDS ; idx++) { -snd_card_free (snd_saa7134_cards[idx]); +if (snd_saa7134_cards[idx]) +snd_card_free (snd_saa7134_cards[idx]); } saa7134_dmasound_init =NULL ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drivers/scsi/sg.c: mark VMA as VM_IO to prevent migration
In reply to Sasha LevinFrom: "Kirill A. Shutemov" <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 461c7fa126794157484dca48e88effa4963e3af3 ]
Reduced testcase:
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <numaif.h>
#define SIZE 0x2000
int main()
{
int fd;
void *p;
fd = open("/dev/sg0", O_RDWR);
p = mmap(NULL, SIZE, PROT_EXEC, MAP_PRIVATE | MAP_LOCKED, fd, 0);
mbind(p, SIZE, 0, NULL, 0, MPOL_MF_MOVE);
return 0;
}We shouldn't try to migrate pages in sg VMA as we don't have a way to update Sg_scatter_hold::pages accordingly from mm core.
Let's mark the VMA as VM_IO to indicate to mm core that the VMA is not migratable.
--- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sg.c +1 -1
@@ -1255,7 +1255,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma) } sfp->mmap_called =1 ; - vma->vm_flags |=VM_DONTEXPAND |VM_DONTDUMP ; + vma->vm_flags |=VM_IO |VM_DONTEXPAND |VM_DONTDUMP ; vma->vm_private_data = sfp; vma->vm_ops = &sg_mmap_vm_ops;return 0 ;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ARM: nomadik: fix up SD/MMC DT settings
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 418d5516568b3fdbc4e7b53677dd78aed8514565 ]
The DTSI file for the Nomadik does not properly specify how the PL180 levelshifter is connected: the Nomadik actually needs all the five st,sig-dir-* flags set to properly control all lines out.
Further this board supports full power cycling of the card, and since this variant has no hardware clock gating, it needs a ridiculously low frequency setting to keep up with the ever overflowing FIFO.
The pin configuration set-up is a bit of a mystery, because of course these pins are a mix of inputs and outputs. However the reference implementation sets all pins to "output" with unspecified initial value, so let's do that here as well.
--- arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 37 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-)
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +20 -17
@@ -122,22 +122,14 @@ }; mmcsd_default_mode: mmcsd_default { mmcsd_default_cfg1 { - /* MCCLK */ - pins = "GPIO8_B10"; - ste,output = <0>; - }; - mmcsd_default_cfg2 { - /* MCCMDDIR, MCDAT0DIR, MCDAT31DIR, MCDATDIR2 */ - pins = "GPIO10_C11", "GPIO15_A12", - "GPIO16_C13", "GPIO23_D15"; - ste,output = <1>; - }; - mmcsd_default_cfg3 { - /* MCCMD, MCDAT3-0, MCMSFBCLK */ - pins = "GPIO9_A10", "GPIO11_B11", - "GPIO12_A11", "GPIO13_C12", - "GPIO14_B12", "GPIO24_C15"; - ste,input = <1>; + /* + * MCCLK, MCCMDDIR, MCDAT0DIR, MCDAT31DIR, MCDATDIR2 + * MCCMD, MCDAT3-0, MCMSFBCLK + */ + pins = "GPIO8_B10", "GPIO9_A10", "GPIO10_C11", "GPIO11_B11", + "GPIO12_A11", "GPIO13_C12", "GPIO14_B12", "GPIO15_A12", + "GPIO16_C13", "GPIO23_D15", "GPIO24_C15"; + ste,output = <2>; }; }; };
@@ -802,10 +794,21 @@ clock-names = "mclk", "apb_pclk"; interrupt-parent = <&vica>; interrupts = <22>; - max-frequency = <48000000>; + max-frequency = <400000>; bus-width = <4>; cap-mmc-highspeed; cap-sd-highspeed; + full-pwr-cycle; + /* + * The STw4811 circuit used with the Nomadik strictly + * requires that all of these signal direction pins be + * routed and used for its 4-bit levelshifter. + */ + st,sig-dir-dat0; + st,sig-dir-dat2; + st,sig-dir-dat31; + st,sig-dir-cmd; + st,sig-pin-fbclk; pinctrl-names = "default"; pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>; vmmc-supply = <&vmmc_regulator>;
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ALSA: timer: Fix leftover link at closing
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 094fd3be87b0f102589e2d5c3fa5d06b7e20496d ]
In ALSA timer core, the active timer instance is managed in active_list linked list. Each element is added / removed dynamically at timer start, stop and in timer interrupt. The problem is that snd_timer_interrupt() has a thinko and leaves the element in active_list when it's the last opened element. This eventually leads to list corruption or use-after-free error.
This hasn't been revealed because we used to delete the list forcibly in snd_timer_stop() in the past. However, the recent fix avoids the double-stop behavior (in commit [f784beb75ce8: ALSA: timer: Fix link corruption due to double start or stop]), and this leak hits reality.
This patch fixes the link management in snd_timer_interrupt(). Now it simply unlinks no matter which stream is.
--- sound/core/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/timer.c +2 -2
@@ -744,8 +744,8 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) ti->cticks = ti->ticks; }else { ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING ; -if (--timer->running) -list_del_init (&ti->active_list); + --timer->running; +list_del_init (&ti->active_list); }if ((timer->hw.flags &SNDRV_TIMER_HW_TASKLET ) || (ti->flags &SNDRV_TIMER_IFLG_FAST ))
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm: fix missing reference counting decrease
In reply to Sasha LevinFrom: Insu Yun <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit dabe19540af9e563d526113bb102e1b9b9fa73f9 ]
In drm_dp_mst_allocate_vcpi, it returns true in two paths, but in one path, there is no reference couting decrease.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -2396,6 +2396,7 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dpDRM_DEBUG_KMS ("payload: vcpi %d already allocated for pbn %d - requested pbn %d\n" , port->vcpi.vcpi, port->vcpi.pbn, pbn);if (pbn == port->vcpi.pbn) { *slots = port->vcpi.num_slots; +drm_dp_put_port (port);return true; } }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] MIPS: Fix some missing CONFIG_CPU_MIPSR6 #ifdefs
In reply to Sasha LevinFrom: Huacai Chen <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 4f33f6c522948fffc345261896042b58dea23754 ]
Commit be0c37c985eddc4 (MIPS: Rearrange PTE bits into fixed positions.) defines fixed PTE bits for MIPS R2. Then, commit d7b631419b3d230a4d383 (MIPS: pgtable-bits: Fix XPA damage to R6 definitions.) adds the MIPS R6 definitions in the same way as MIPS R2. But some R6 #ifdefs in the later commit are missing, so in this patch I fix that.
Patchwork: https://patchwork.linux-mips.org/patch/12164/
--- arch/mips/include/asm/pgtable.h | 4 ++-- arch/mips/mm/tlbex.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/include/asm/pgtable.h +2 -2
@@ -353,7 +353,7 @@ static inline pte_t pte_mkdirty(pte_t pte)static inline pte_t pte_mkyoung (pte_t pte) {pte_val (pte) |= _PAGE_ACCESSED; -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (!(pte_val (pte) & _PAGE_NO_READ))pte_val (pte) |= _PAGE_SILENT_READ;else
@@ -558,7 +558,7 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd) {pmd_val (pmd) |= _PAGE_ACCESSED; -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (!(pmd_val (pmd) & _PAGE_NO_READ))pmd_val (pmd) |= _PAGE_SILENT_READ;else
arch/mips/mm/tlbex.c +1 -1
@@ -242,7 +242,7 @@ static void output_pgtable_bits_defines(void)pr_define ("_PAGE_HUGE_SHIFT %d\n" , _PAGE_HUGE_SHIFT);pr_define ("_PAGE_SPLITTING_SHIFT %d\n" , _PAGE_SPLITTING_SHIFT);#endif -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (cpu_has_rixi) {#ifdef _PAGE_NO_EXEC_SHIFTpr_define ("_PAGE_NO_EXEC_SHIFT %d\n" , _PAGE_NO_EXEC_SHIFT);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/i915: Take all modeset locks for DP MST hotplug
In reply to Sasha LevinFrom: Daniel Vetter <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 8bb4da1df54a20d68c34427356e34315ba122c0f ]
While auditing various users of the connector/encoder lists I realized that the atomic code is a very prolific user of them. And it only ever grabs the mode_config->connection_mutex, but not the mode_config->mutex like all the other code walking encoder/connector lists.
The problem is that we can't grab the mode_config.mutex late in atomic code since that would lead to locking inversions. And we don't want to grab it unconditionally like the legacy set_config modeset path since that would render all the fine-grained locking moot.
Instead just grab more locks in the dp mst hotplug code. Note that drm_connector_init (which is the one adding the connector to these lists) already uses drm_modeset_lock_all.
The other reason for grabbing all locks is that the dpms off in the unplug function amounts to a modeset, so better to take all required locks for that.
--- drivers/gpu/drm/i915/intel_dp_mst.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp_mst.c +6 -6
@@ -439,9 +439,9 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolodrm_mode_connector_set_path_property (connector, pathprop);drm_reinit_primary_mode_group (dev); -mutex_lock (&dev->mode_config.mutex); +drm_modeset_lock_all (dev);intel_connector_add_to_fbdev (intel_connector); -mutex_unlock (&dev->mode_config.mutex); +drm_modeset_unlock_all (dev);drm_connector_register (&intel_connector->base);return connector; }
@@ -452,16 +452,16 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,struct intel_connector *intel_connector =to_intel_connector (connector);struct drm_device *dev = connector->dev;/* need to nuke the connector */ -mutex_lock (&dev->mode_config.mutex); +drm_modeset_lock_all (dev);intel_connector_dpms (connector,DRM_MODE_DPMS_OFF ); -mutex_unlock (&dev->mode_config.mutex); +drm_modeset_unlock_all (dev); intel_connector->unregister (intel_connector); -mutex_lock (&dev->mode_config.mutex); +drm_modeset_lock_all (dev);intel_connector_remove_from_fbdev (intel_connector);drm_connector_cleanup (connector); -mutex_unlock (&dev->mode_config.mutex); +drm_modeset_unlock_all (dev);drm_reinit_primary_mode_group (dev);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/dp/mst: fixup handling hotplug on port removal.
In reply to Sasha LevinFrom: Dave Airlie <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit df4839fdc9b3c922586b945f062f38cbbda022bb ]
output ports should always have a connector, unless in the rare case connector allocation fails in the driver.
In this case we only need to teardown the pdt,
and free the struct, and there is no need to
send a hotplug msg.
In the case were we add the port to the destroy
list we need to send a hotplug if we destroy
any connectors, so userspace knows to reprobe
stuff.
this patch also handles port->connector allocation failing which should be a rare event, but makes the code consistent.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 36 +++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +26 -10
@@ -861,29 +861,33 @@ static void drm_dp_destroy_port(struct kref *kref) { struct drm_dp_mst_port *port = container_of(kref, struct drm_dp_mst_port, kref);struct drm_dp_mst_topology_mgr *mgr = port->mgr; +if (!port->input) { port->vcpi.num_slots =0 ;kfree (port->cached_edid); -/* we can't destroy the connector here, as -we might be holding the mode_config.mutex -from an EDID retrieval */ +/* +* The only time we don't have a connector +* on an output port is if the connector init +* fails. +*/ if (port->connector) { +/* we can't destroy the connector here, as +* we might be holding the mode_config.mutex +* from an EDID retrieval */ +mutex_lock (&mgr->destroy_connector_lock);list_add (&port->next, &mgr->destroy_connector_list);mutex_unlock (&mgr->destroy_connector_lock);schedule_work (&mgr->destroy_connector_work);return ; } +/* no need to clean up vcpi +* as if we have no connector we never setup a vcpi */ drm_dp_port_teardown_pdt (port, port->pdt); - -if (!port->input && port->vcpi.vcpi >0 ) -drm_dp_mst_put_payload_id (mgr, port->vcpi.vcpi); }kfree (port); - - (*mgr->cbs->hotplug)(mgr); }static void drm_dp_put_port (struct drm_dp_mst_port *port)
@@ -1113,12 +1117,21 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,char proppath[255 ];build_mst_prop_path (port, mstb, proppath,sizeof (proppath)); port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath); - +if (!port->connector) { +/* remove it from the port list */ +mutex_lock (&mstb->mgr->lock); +list_del (&port->next); +mutex_unlock (&mstb->mgr->lock); +/* drop port list reference */ +drm_dp_put_port (port); + goto out; + }if (port->port_num >=8 ) { port->cached_edid =drm_get_edid (port->connector, &port->aux.ddc); } } +out:/* put reference to this port */ drm_dp_put_port (port); }
@@ -2740,7 +2753,7 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) { struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work);struct drm_dp_mst_port *port; - +bool send_hotplug = false;/* * Not a regular list traverse as we have to drop the destroy * connector lock before destroying the connector, to avoid AB->BA
@@ -2763,7 +2776,10 @@ static void drm_dp_destroy_connector_work(struct work_struct *work)if (!port->input && port->vcpi.vcpi >0 )drm_dp_mst_put_payload_id (mgr, port->vcpi.vcpi);kfree (port); + send_hotplug = true; } +if (send_hotplug) + (*mgr->cbs->hotplug)(mgr); }/**
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/radeon: Take all modeset locks for DP MST hotplug
In reply to Sasha LevinFrom: Daniel Vetter <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2ee6bcdcfa4d8b56b20bc6308cd5f9bced5b5324 ]
Similar with the i915 take all modeset locks for mst hotplug. This is needed to make sure radeon holds both mode_config.mutex and mode_config.connection_mutex when updating the connector_list, which is the new (interim) locking regime we want for that.
--- drivers/gpu/drm/radeon/radeon_dp_mst.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_dp_mst.c +4 -4
@@ -287,9 +287,9 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topoldrm_mode_connector_set_path_property (connector, pathprop);drm_reinit_primary_mode_group (dev); -mutex_lock (&dev->mode_config.mutex); +drm_modeset_lock_all (dev);radeon_fb_add_connector (rdev, connector); -mutex_unlock (&dev->mode_config.mutex); +drm_modeset_unlock_all (dev);drm_connector_register (connector);return connector;
@@ -304,12 +304,12 @@ static void radeon_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,drm_connector_unregister (connector);/* need to nuke the connector */ -mutex_lock (&dev->mode_config.mutex); +drm_modeset_lock_all (dev);/* dpms off */ radeon_fb_remove_connector (rdev, connector);drm_connector_cleanup (connector); -mutex_unlock (&dev->mode_config.mutex); +drm_modeset_unlock_all (dev);drm_reinit_primary_mode_group (dev);
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/dp/mst: Calculate MST PBN with 31.32 fixed point
In reply to Sasha LevinFrom: Harry Wentland <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit a9ebb3e46c7ef6112c0da466ef0954673ad36832 ]
Our PBN value overflows the 20 bits integer part of the 20.12 fixed point. We need to use 31.32 fixed point to avoid this.
This happens with display clocks larger than 293122 (at 24 bpp), which we see with the Sharp (and similar) 4k tiled displays.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 67 ++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 28 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +39 -28
@@ -2556,32 +2556,31 @@ EXPORT_SYMBOL(drm_dp_check_act_status);*/ int drm_dp_calc_pbn_mode (int clock,int bpp) { -fixed20_12 pix_bw; -fixed20_12 fbpp; -fixed20_12 result; -fixed20_12 margin, tmp; -u32 res; - - pix_bw.full =dfixed_const (clock); - fbpp.full =dfixed_const (bpp); - tmp.full =dfixed_const (8 ); - fbpp.full =dfixed_div (fbpp, tmp); - - result.full =dfixed_mul (pix_bw, fbpp); - margin.full =dfixed_const (54 ); - tmp.full =dfixed_const (64 ); - margin.full =dfixed_div (margin, tmp); - result.full =dfixed_div (result, margin); - - margin.full =dfixed_const (1006 ); - tmp.full =dfixed_const (1000 ); - margin.full =dfixed_div (margin, tmp); - result.full =dfixed_mul (result, margin); - - result.full =dfixed_div (result, tmp); - result.full =dfixed_ceil (result); - res =dfixed_trunc (result); -return res; +u64 kbps; +s64 peak_kbps; +u32 numerator; +u32 denominator; + + kbps = clock * bpp; + +/* +* margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 +* The unit of 54/64Mbytes/sec is an arbitrary unit chosen based on +* common multiplier to render an integer PBN for all link rate/lane +* counts combinations +* calculate +* peak_kbps *= (1006/1000) +* peak_kbps *= (64/54) +* peak_kbps *= 8 convert to bytes +*/ + + numerator =64 *1006 ; + denominator =54 *8 *1000 *1000 ; + + kbps *= numerator; + peak_kbps =drm_fixp_from_fraction (kbps, denominator); + +return drm_fixp2int_ceil (peak_kbps); }EXPORT_SYMBOL (drm_dp_calc_pbn_mode);
@@ -2589,11 +2588,23 @@ static int test_calc_pbn_mode(void) {int ret; ret =drm_dp_calc_pbn_mode (154000 ,30 ); -if (ret !=689 ) +if (ret !=689 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +154000 ,30 ,689 , ret);return -EINVAL ; + } ret =drm_dp_calc_pbn_mode (234000 ,30 ); -if (ret !=1047 ) +if (ret !=1047 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +234000 ,30 ,1047 , ret);return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (297000 ,24 ); +if (ret !=1063 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +297000 ,24 ,1063 , ret); +return -EINVAL ; + }return 0 ; }
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm/dp/mst: Remove port after removing connector.
In reply to Sasha LevinFrom: Maarten Lankhorst <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 4772ff03df8094fd99d28de5fcf5df3a3e9c68bb ]
The port is removed synchronously, but the connector delayed. This causes a use after free which can cause a kernel BUG with slug_debug=FPZU. This is fixed by freeing the port after the connector.
This fixes a regression introduced with 6b8eeca65b18ae77e175cc2b6571731f0ee413bf "drm/dp/mst: close deadlock in connector destruction."
--- drivers/gpu/drm/drm_dp_mst_topology.c | 19 +++++++++++++------ include/drm/drm_crtc.h | 2 -- 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +13 -6
@@ -871,9 +871,10 @@ static void drm_dp_destroy_port(struct kref *kref)from an EDID retrieval */ if (port->connector) {mutex_lock (&mgr->destroy_connector_lock); -list_add (&port->connector->destroy_list, &mgr->destroy_connector_list); +list_add (&port->next, &mgr->destroy_connector_list);mutex_unlock (&mgr->destroy_connector_lock);schedule_work (&mgr->destroy_connector_work); +return ; }drm_dp_port_teardown_pdt (port, port->pdt);
@@ -2738,7 +2739,7 @@ static void drm_dp_tx_work(struct work_struct *work)static void drm_dp_destroy_connector_work (struct work_struct *work) { struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work); -struct drm_connector *connector; +struct drm_dp_mst_port *port;/* * Not a regular list traverse as we have to drop the destroy
@@ -2747,15 +2748,21 @@ static void drm_dp_destroy_connector_work(struct work_struct *work)*/ for (;;) {mutex_lock (&mgr->destroy_connector_lock); - connector = list_first_entry_or_null(&mgr->destroy_connector_list, struct drm_connector, destroy_list); -if (!connector) { + port = list_first_entry_or_null(&mgr->destroy_connector_list, struct drm_dp_mst_port, next); +if (!port) {mutex_unlock (&mgr->destroy_connector_lock);break ; } -list_del (&connector->destroy_list); +list_del (&port->next);mutex_unlock (&mgr->destroy_connector_lock); - mgr->cbs->destroy_connector (mgr, connector); + mgr->cbs->destroy_connector (mgr, port->connector); + +drm_dp_port_teardown_pdt (port, port->pdt); + +if (!port->input && port->vcpi.vcpi >0 ) +drm_dp_mst_put_payload_id (mgr, port->vcpi.vcpi); +kfree (port); } }
include/drm/drm_crtc.h +0 -2
@@ -731,8 +731,6 @@ struct drm_connector {uint8_t num_h_tile, num_v_tile;uint8_t tile_h_loc, tile_v_loc;uint16_t tile_h_size, tile_v_size; - -struct list_head destroy_list; };/**
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] dump_stack: avoid potential deadlocks
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit d7ce36924344ace0dbdc855b1206cacc46b36d45 ]
Some servers experienced fatal deadlocks because of a combination of bugs, leading to multiple cpus calling dump_stack().
The checksumming bug was fixed in commit 34ae6a1aa054 ("ipv6: update skb->csum when CE mark is propagated").
The second problem is a faulty locking in dump_stack()
CPU1 runs in process context and calls dump_stack(), grabs dump_lock.
CPU2 receives a TCP packet under softirq, grabs socket spinlock, and call dump_stack() from netdev_rx_csum_fault().
dump_stack() spins on atomic_cmpxchg(&dump_lock, -1, 2), since dump_lock is owned by CPU1
While dumping its stack, CPU1 is interrupted by a softirq, and happens to process a packet for the TCP socket locked by CPU2.
CPU1 spins forever in spin_lock() : deadlock
Stack trace on CPU1 looked like :
NMI backtrace for cpu 1
RIP: _raw_spin_lock+0x25/0x30
...
Call Trace:
<IRQ>
tcp_v6_rcv+0x243/0x620
ip6_input_finish+0x11f/0x330
ip6_input+0x38/0x40
ip6_rcv_finish+0x3c/0x90
ipv6_rcv+0x2a9/0x500
process_backlog+0x461/0xaa0
net_rx_action+0x147/0x430
__do_softirq+0x167/0x2d0
call_softirq+0x1c/0x30
do_softirq+0x3f/0x80
irq_exit+0x6e/0xc0
smp_call_function_single_interrupt+0x35/0x40
call_function_single_interrupt+0x6a/0x70
<EOI>
printk+0x4d/0x4f
printk_address+0x31/0x33
print_trace_address+0x33/0x3c
print_context_stack+0x7f/0x119
dump_trace+0x26b/0x28e
show_trace_log_lvl+0x4f/0x5c
show_stack_log_lvl+0x104/0x113
show_stack+0x42/0x44
dump_stack+0x46/0x58
netdev_rx_csum_fault+0x38/0x3c
__skb_checksum_complete_head+0x6e/0x80
__skb_checksum_complete+0x11/0x20
tcp_rcv_established+0x2bd5/0x2fd0
tcp_v6_do_rcv+0x13c/0x620
sk_backlog_rcv+0x15/0x30
release_sock+0xd2/0x150
tcp_recvmsg+0x1c1/0xfc0
inet_recvmsg+0x7d/0x90
sock_recvmsg+0xaf/0xe0
___sys_recvmsg+0x111/0x3b0
SyS_recvmsg+0x5c/0xb0
system_call_fastpath+0x16/0x1b--- lib/dump_stack.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
lib/dump_stack.c +4 -3
@@ -25,6 +25,7 @@ static atomic_t dump_lock = ATOMIC_INIT(-1); asmlinkage __visible void dump_stack(void) { +unsigned long flags;int was_locked;int old;int cpu;
@@ -33,9 +34,8 @@ asmlinkage __visible void dump_stack(void)* Permit this cpu to perform nested stack dumps while serialising * against other CPUs */ -preempt_disable (); - retry: +local_irq_save (flags); cpu =smp_processor_id (); old =atomic_cmpxchg (&dump_lock,-1 , cpu);if (old ==-1 ) {
@@ -43,6 +43,7 @@ retry: }else if (old == cpu) { was_locked =1 ; }else { +local_irq_restore (flags);cpu_relax (); goto retry; }
@@ -52,7 +53,7 @@ retry:if (!was_locked)atomic_set (&dump_lock,-1 ); -preempt_enable (); +local_irq_restore (flags); }#else asmlinkage __visible void dump_stack(void)
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] radix-tree: fix oops after radix_tree_iter_retry
In reply to Sasha LevinFrom: Konstantin Khlebnikov <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 732042821cfa106b3c20b9780e4c60fee9d68900 ]
Helper radix_tree_iter_retry() resets next_index to the current index. In following radix_tree_next_slot current chunk size becomes zero. This isn't checked and it tries to dereference null pointer in slot.
Tagged iterator is fine because retry happens only at slot 0 where tag bitmask in iter->tags is filled with single bit.
--- include/linux/radix-tree.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/radix-tree.h +3 -3
@@ -391,7 +391,7 @@ void **radix_tree_iter_retry(struct radix_tree_iter *iter)* @iter: pointer to radix tree iterator * Returns: current chunk size */ -static __always_inline unsigned +static __always_inline long radix_tree_chunk_size (struct radix_tree_iter *iter) {return iter->next_index - iter->index;
@@ -425,9 +425,9 @@ radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags)return slot + offset +1 ; } }else { -unsigned size =radix_tree_chunk_size (iter) -1 ; +long size =radix_tree_chunk_size (iter); -while (size--) { +while (--size >0 ) { slot++; iter->index++;if (likely (*slot))
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] drm: Add drm_fixp_from_fraction and drm_fixp2int_ceil
In reply to Sasha LevinFrom: Harry Wentland <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 64566b5e767f9bc3161055ca1b443a51afb52aad ]
drm_fixp_from_fraction allows us to create a fixed point directly from a fraction, rather than creating fixed point values and dividing later. This avoids overflow of our 64 bit value for large numbers.
drm_fixp2int_ceil allows us to return the ceiling of our fixed point value.
[airlied: squash Jordan's fix] 32-bit-build-fix: Jordan Lazare <[email protected]>
--- include/drm/drm_fixed.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
include/drm/drm_fixed.h +51 -2
@@ -73,18 +73,28 @@ static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)#define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT)#define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1)#define DRM_FIXED_DIGITS_MASK (~DRM_FIXED_DECIMAL_MASK) +#define DRM_FIXED_EPSILON 1LL +#define DRM_FIXED_ALMOST_ONE (DRM_FIXED_ONE - DRM_FIXED_EPSILON)static inline s64 drm_int2fixp (int a) {return ((s64 )a) <<DRM_FIXED_POINT ; } -static inline int drm_fixp2int (int64_t a) +static inline int drm_fixp2int (s64 a) {return ((s64 )a) >>DRM_FIXED_POINT ; } -static inline unsigned drm_fixp_msbset (int64_t a) +static inline int drm_fixp2int_ceil (s64 a) +{ +if (a >0 ) +return drm_fixp2int (a +DRM_FIXED_ALMOST_ONE ); +else +return drm_fixp2int (a -DRM_FIXED_ALMOST_ONE ); +} + +static inline unsigned drm_fixp_msbset (s64 a) {unsigned shift, sign = (a >>63 ) &1 ;
@@ -136,6 +146,45 @@ static inline s64 drm_fixp_div(s64 a, s64 b)return result; } +static inline s64 drm_fixp_from_fraction (s64 a,s64 b) +{ +s64 res; +bool a_neg = a <0 ; +bool b_neg = b <0 ; +u64 a_abs = a_neg ? -a : a; +u64 b_abs = b_neg ? -b : b; +u64 rem; + +/* determine integer part */ +u64 res_abs =div64_u64_rem (a_abs, b_abs, &rem); + +/* determine fractional part */ + { +u32 i =DRM_FIXED_POINT ; + +do { + rem <<=1 ; + res_abs <<=1 ; +if (rem >= b_abs) { + res_abs |=1 ; + rem -= b_abs; + } + }while (--i !=0 ); + } + +/* round up LSB */ + { +u64 summand = (rem <<1 ) >= b_abs; + + res_abs += summand; + } + + res = (s64 ) res_abs; +if (a_neg ^ b_neg) + res = -res; +return res; +} +static inline s64 drm_fixp_exp (s64 x) {s64 tolerance =div64_s64 (DRM_FIXED_ONE ,1000000 );
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] mm: replace vma_lock_anon_vma with anon_vma_lock_read/write
In reply to Sasha LevinFrom: Konstantin Khlebnikov <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 12352d3cae2cebe18805a91fab34b534d7444231 ]
Sequence vma_lock_anon_vma() - vma_unlock_anon_vma() isn't safe if anon_vma appeared between lock and unlock. We have to check anon_vma first or call anon_vma_prepare() to be sure that it's here. There are only few users of these legacy helpers. Let's get rid of them.
This patch fixes anon_vma lock imbalance in validate_mm(). Write lock isn't required here, read lock is enough.
And reorders expand_downwards/expand_upwards: security_mmap_addr() and wrapping-around check don't have to be under anon vma lock.
--- include/linux/rmap.h | 14 ------------- mm/mmap.c | 55 ++++++++++++++++++++++++---------------------------- 2 files changed, 25 insertions(+), 44 deletions(-)
include/linux/rmap.h +0 -14
@@ -105,20 +105,6 @@ static inline void put_anon_vma(struct anon_vma *anon_vma)__put_anon_vma (anon_vma); } -static inline void vma_lock_anon_vma (struct vm_area_struct *vma) -{ -struct anon_vma *anon_vma = vma->anon_vma; -if (anon_vma) -down_write (&anon_vma->root->rwsem); -} - -static inline void vma_unlock_anon_vma (struct vm_area_struct *vma) -{ -struct anon_vma *anon_vma = vma->anon_vma; -if (anon_vma) -up_write (&anon_vma->root->rwsem); -} -static inline void anon_vma_lock_write (struct anon_vma *anon_vma) {down_write (&anon_vma->root->rwsem);
mm/mmap.c +25 -30
122 lines not on this page · raw message
Signature · 1 line
2.5.0
[added to the 4.1 stable tree] ocfs2/dlm: clear refmap bit of recovery lock while doing local recovery cleanup
In reply to Sasha LevinFrom: xuejiufei <[email protected]>
This patch has been added to the 4.1 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit c95a51807b730e4681e2ecbdfd669ca52601959e ]
When recovery master down, dlm_do_local_recovery_cleanup() only remove the $RECOVERY lock owned by dead node, but do not clear the refmap bit. Which will make umount thread falling in dead loop migrating $RECOVERY to the dead node.
--- fs/ocfs2/dlm/dlmrecovery.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ocfs2/dlm/dlmrecovery.c +2 -0
@@ -2360,6 +2360,8 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)break ; } } +dlm_lockres_clear_refmap_bit (dlm, res, + dead_node);spin_unlock (&res->spinlock);continue ; }
Signature · 1 line
2.5.0