3.14.39-stable review
Greg Kroah-Hartman
maintainercover 3.14.39-stable review
This is the start of the stable review cycle for the 3.14.39 release. There are 43 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Apr 19 13:25:21 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.39-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.14.39-rc1
Majd Dibbiny <[email protected]>
IB/mlx4: Saturate RoCE port PMA counters in case of overflow
Sasha Levin <[email protected]>
net: llc: use correct size for sysctl timeout entries
Sasha Levin <[email protected]>
net: rds: use correct size for max unacked packets and bytes
Marek Szyprowski <[email protected]>
media: s5p-mfc: fix mmap support for 64bit arch
Hans Verkuil <[email protected]>
sh_veu: v4l2_dev wasn't set
Mike Christie <[email protected]>
iscsi target: fix oops when adding reject pdu
Al Viro <[email protected]>
ioctx_alloc(): fix vma (and file) leak on failure
Al Viro <[email protected]>
ocfs2: _really_ sync the right range
John Soni Jose <[email protected]>
be2iscsi: Fix kernel panic when device initialization fails
David Disseldorp <[email protected]>
cifs: fix use-after-free bug in find_writable_file
Sachin Prabhu <[email protected]>
cifs: smb2_clone_range() - exit on unhandled error
Peter Hurley <[email protected]>
n_tty: Fix read buffer overwrite when no newline
Stefan Agner <[email protected]>
tty: serial: fsl_lpuart: clear receive flag on FIFO flush
Lu Baolu <[email protected]>
usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers
Lu Baolu <[email protected]>
usb: xhci: handle Config Error Change (CEC) in xhci driver
Thomas Schlichter <[email protected]>
cpuidle: ACPI: do not overwrite name and description of C0
Bartlomiej Zolnierkiewicz <[email protected]>
cpuidle: remove state_count field from struct cpuidle_device
Andreas Werner <[email protected]>
can: flexcan: Deferred on Regulator return EPROBE_DEFER
Stefan Lippers-Hollmann <[email protected]>
x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk
Peter Ujfalusi <[email protected]>
dmaengine: omap-dma: Fix memory leak when terminating running transfer
Darshana Padmadas <[email protected]>
iio: imu: Use iio_trigger_get for indio_dev->trig assignment
Viorel Suman <[email protected]>
iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo
Bart Van Assche <[email protected]>
Defer processing of REQ_PREEMPT requests for blocked devices
Doug Goldstein <[email protected]>
USB: ftdi_sio: Use jtag quirk for SNAP Connect E10
Doug Goldstein <[email protected]>
USB: ftdi_sio: Added custom PID for Synapse Wireless product
David Miller <[email protected]>
radeon: Do not directly dereference pointers to BIOS area.
Tejun Heo <[email protected]>
writeback: fix possible underflow in write bandwidth calculation
Tejun Heo <[email protected]>
writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth()
Brian Silverman <[email protected]>
sched: Fix RLIMIT_RTTIME when PI-boosting to RT
Gu Zheng <[email protected]>
mm/memory hotplug: postpone the reset of obsolete pgdat
Sudip Mukherjee <[email protected]>
nbd: fix possible memory leak
Emmanuel Grumbach <[email protected]>
iwlwifi: dvm: run INIT firmware again upon .start()
Shachar Raindel <[email protected]>
IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic
Eli Cohen <[email protected]>
IB/core: Avoid leakage from kernel to user space
David Sterba <[email protected]>
btrfs: simplify insert_orphan_item
Ben Hutchings <[email protected]>
tcp: Fix crash in TCP Fast Open
Joe Perches <[email protected]>
selinux: fix sel_write_enforce broken return value
Vineet Gupta <[email protected]>
ARC: SA_SIGINFO ucontext regs off-by-one
Rasmus Villemoes <[email protected]>
PCI/AER: Avoid info leak in __print_tlp_header()
Takashi Iwai <[email protected]>
ALSA: hda - Fix headphone pin config for Lifebook T731
Kailang Yang <[email protected]>
ALSA: hda/realtek - Make more stable to get pin sense for ALC283
Dmitry M. Fedin <[email protected]>
ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support
Hui Wang <[email protected]>
ALSA: hda - Add one more node in the EAPD supporting candidate list
-------------
Diffstat:
Makefile | 4 +- arch/arc/kernel/signal.c | 4 +- arch/x86/kernel/reboot.c | 10 +++ drivers/acpi/processor_idle.c | 2 +- drivers/block/nbd.c | 8 +- drivers/cpuidle/cpuidle.c | 3 - drivers/cpuidle/sysfs.c | 5 +- drivers/dma/omap-dma.c | 1 + drivers/gpu/drm/radeon/radeon_bios.c | 10 ++- drivers/iio/imu/adis_trigger.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 25 +++--- drivers/infiniband/core/umem.c | 8 ++ drivers/infiniband/core/uverbs_main.c | 1 + drivers/infiniband/hw/mlx4/mad.c | 20 ++++- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 +- drivers/media/platform/sh_veu.c | 1 + drivers/net/can/flexcan.c | 11 ++- drivers/net/wireless/iwlwifi/dvm/dev.h | 1 - drivers/net/wireless/iwlwifi/dvm/ucode.c | 5 -- drivers/pci/pcie/aer/aerdrv_errprint.c | 12 +-- drivers/scsi/be2iscsi/be_main.c | 2 +- drivers/scsi/scsi_lib.c | 4 +- drivers/target/iscsi/iscsi_target.c | 2 +- drivers/tty/n_tty.c | 106 ++++++++++++++++++------ drivers/tty/serial/fsl_lpuart.c | 3 + drivers/usb/host/xhci-hub.c | 9 +- drivers/usb/host/xhci-pci.c | 2 +- drivers/usb/serial/ftdi_sio.c | 9 +- drivers/usb/serial/ftdi_sio_ids.h | 6 ++ fs/aio.c | 3 + fs/btrfs/tree-log.c | 16 +--- fs/cifs/file.c | 1 + fs/cifs/smb2ops.c | 3 +- fs/ocfs2/file.c | 14 +++- include/linux/blk_types.h | 4 +- include/linux/cpuidle.h | 1 - kernel/sched/core.c | 2 + mm/memory_hotplug.c | 13 +-- mm/page-writeback.c | 7 +- net/ipv4/tcp_output.c | 1 + net/llc/sysctl_net_llc.c | 8 +- net/rds/sysctl.c | 4 +- security/selinux/selinuxfs.c | 2 +- sound/pci/hda/patch_realtek.c | 13 ++- sound/usb/mixer_quirks.c | 1 + 45 files changed, 246 insertions(+), 125 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/43 ALSA: hda - Add one more node in the EAPD supporting candidate list
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Wang <[email protected]>
commit af95b41426e0b58279f8ff0ebe420df49a4e96b8 upstream.
We have a HP machine which use the codec node 0x17 connecting the internal speaker, and from the node capability, we saw the EAPD, if we don't set the EAPD on for this node, the internal speaker can't output any sound.
--- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +1 -1
@@ -271,7 +271,7 @@ static void alc_auto_setup_eapd(struct h {/* We currently only handle front, HP */ static hda_nid_t pins[] = { -0x0f ,0x10 ,0x14 ,0x15 ,0 +0x0f ,0x10 ,0x14 ,0x15 ,0x17 ,0 };hda_nid_t *p;for (p = pins; *p; p++)
Greg Kroah-Hartman
maintainerPATCH 2/43 ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Dmitry M. Fedin" <[email protected]>
commit 3dc8523fa7412e731441c01fb33f003eb3cfece1 upstream.
Adds an entry for Creative USB X-Fi to the rc_config array in mixer_quirks.c to allow use of volume knob on the device. Adds support for newer X-Fi Pro card, known as "Model No. SB1095" with USB ID "041e:3237"
--- sound/usb/mixer_quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/mixer_quirks.c +1 -0
@@ -178,6 +178,7 @@ static const struct rc_config { { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ + { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ };
Greg Kroah-Hartman
maintainerPATCH 3/43 ALSA: hda/realtek - Make more stable to get pin sense for ALC283
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit a59d7199f62b8336570972dcc288321d0ec999fe upstream.
Pin sense will active when power pin is wake up. Power pin will not wake up immediately during resume state. Add some delay to wait for power pin activated.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -2885,6 +2885,8 @@ static void alc283_init(struct hda_codecif (!hp_pin)return ; + +msleep (30 ); hp_pin_sense =snd_hda_jack_detect (codec, hp_pin);/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
Greg Kroah-Hartman
maintainerPATCH 4/43 ALSA: hda - Fix headphone pin config for Lifebook T731
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit cc7016ab1a22fb26f388c2fb2b692b89897cbc3e upstream.
Some BIOS version of Fujitsu Lifebook T731 seems to set up the headphone pin (0x21) without the assoc number 0x0f while it's set only to the output on the docking port (0x1a). With the recent commit [03ad6a8c93b6: ALSA: hda - Fix "PCM" name being used on one DAC when
there are two DACs], this resulted in the weird mixer element
mapping where the headphone on the laptop is assigned as a shared volume with the speaker and the docking port is assigned as an individual headphone.
This patch improves the situation by correcting the headphone pin config to the more appropriate value.
--- sound/pci/hda/patch_realtek.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/pci/hda/patch_realtek.c +9 -0
@@ -3953,6 +3953,7 @@ enum {ALC269_FIXUP_QUANTA_MUTE ,ALC269_FIXUP_LIFEBOOK ,ALC269_FIXUP_LIFEBOOK_EXTMIC , +ALC269_FIXUP_LIFEBOOK_HP_PIN ,ALC269_FIXUP_AMIC ,ALC269_FIXUP_DMIC , ALC269VB_FIXUP_AMIC,
@@ -4087,6 +4088,13 @@ static const struct hda_fixup alc269_fix { } }, }, + [ALC269_FIXUP_LIFEBOOK_HP_PIN] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { + { 0x21, 0x0221102f }, /* HP out */ + { } + }, + }, [ALC269_FIXUP_AMIC] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) {
@@ -4540,6 +4548,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x104d ,0x9084 ,"Sony VAIO" ,ALC275_FIXUP_SONY_HWEQ ),SND_PCI_QUIRK_VENDOR (0x104d ,"Sony VAIO" ,ALC269_FIXUP_SONY_VAIO ),SND_PCI_QUIRK (0x10cf ,0x1475 ,"Lifebook" ,ALC269_FIXUP_LIFEBOOK ), +SND_PCI_QUIRK (0x10cf ,0x15dc ,"Lifebook T731" ,ALC269_FIXUP_LIFEBOOK_HP_PIN ),SND_PCI_QUIRK (0x10cf ,0x1845 ,"Lifebook U904" ,ALC269_FIXUP_LIFEBOOK_EXTMIC ),SND_PCI_QUIRK (0x17aa ,0x20f2 ,"Thinkpad SL410/510" ,ALC269_FIXUP_SKU_IGNORE ), SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
Greg Kroah-Hartman
maintainerPATCH 5/43 PCI/AER: Avoid info leak in __print_tlp_header()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rasmus Villemoes <[email protected]>
commit a1b7f2f6367944d445c6853035830a35c6343939 upstream.
Commit fab4c256a58b ("PCI/AER: Add a TLP header print helper") introduced the helper function __print_tlp_header(), but contrary to the intention, the behaviour did change: Since we're taking the address of the parameter t, the first 4 or 8 bytes printed will be the value of the pointer t itself, and the remaining 12 or 8 bytes will be who-knows-what (something from the stack).
We want to show the values of the four members of the struct aer_header_log_regs; that can be done without ugly and error-prone casts. On little-endian this should produce the same output as originally intended, and since no-one has complained about getting garbage output so far, I think big-endian should be ok too.
--- drivers/pci/pcie/aer/aerdrv_errprint.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/pci/pcie/aer/aerdrv_errprint.c +2 -10
@@ -127,16 +127,8 @@ static const char *aer_agent_string[] =static void __print_tlp_header (struct pci_dev *dev,struct aer_header_log_regs *t) { -unsigned char *tlp = (unsigned char *)&t; - -dev_err (&dev->dev," TLP Header:" -" %02x%02x%02x%02x %02x%02x%02x%02x" -" %02x%02x%02x%02x %02x%02x%02x%02x\n" , - *(tlp +3 ), *(tlp +2 ), *(tlp +1 ), *tlp, - *(tlp +7 ), *(tlp +6 ), *(tlp +5 ), *(tlp +4 ), - *(tlp +11 ), *(tlp +10 ), *(tlp +9 ), - *(tlp +8 ), *(tlp +15 ), *(tlp +14 ), - *(tlp +13 ), *(tlp +12 )); +dev_err (&dev->dev," TLP Header: %08x %08x %08x %08x\n" , + t->dw0, t->dw1, t->dw2, t->dw3); } static void __aer_print_error(struct pci_dev *dev,
Greg Kroah-Hartman
maintainerPATCH 6/43 ARC: SA_SIGINFO ucontext regs off-by-one
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit 6914e1e3f63caa829431160f0f7093292daef2d5 upstream.
The regfile provided to SA_SIGINFO signal handler as ucontext was off by one due to pt_regs gutter cleanups in 2013.
Before handling signal, user pt_regs are copied onto user_regs_struct and copied back later. Both structs are binary compatible. This was all fine until commit 2fa919045b72 (ARC: pt_regs update #2) which removed the empty stack slot at top of pt_regs (corresponding to first pad) and made the corresponding fixup in struct user_regs_struct (the pad in there was moved out of @scratch - not removed altogether as it is part of ptrace ABI)
struct user_regs_struct {
+ long pad;
struct {
- long pad;
long bta, lp_start, lp_end,....
} scratch; ...
}
This meant that now user_regs_struct was off by 1 reg w.r.t pt_regs and signal code needs to user_regs_struct.scratch to reflect it as pt_regs, which is what this commit does.
This problem was hidden for 2 years, because both save/restore, despite using wrong location, were using the same location. Only an interim inspection (reproducer below) exposed the issue.
void handle_segv(int signo, siginfo_t *info, void *context) {
ucontext_t *uc = context;
struct user_regs_struct *regs = &(uc->uc_mcontext.regs);
printf("regs %x %x\n", <=== prints 7 8 (vs. 8 9)
regs->scratch.r8, regs->scratch.r9);
}
int main()
{
struct sigaction sa;
sa.sa_sigaction = handle_segv;
sa.sa_flags = SA_SIGINFO;
sigemptyset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, NULL);
asm volatile(
"mov r7, 7 \n"
"mov r8, 8 \n"
"mov r9, 9 \n"
"mov r10, 10 \n"
:::"r7","r8","r9","r10");
*((unsigned int*)0x10) = 0;
}--- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/kernel/signal.c +2 -2
@@ -67,7 +67,7 @@ stash_usr_regs(struct rt_sigframe __user sigset_t *set) {int err; - err =__copy_to_user (&(sf->uc.uc_mcontext.regs), regs, + err =__copy_to_user (&(sf->uc.uc_mcontext.regs.scratch), regs,sizeof (sf->uc.uc_mcontext.regs.scratch)); err |=__copy_to_user (&sf->uc.uc_sigmask, set,sizeof (sigset_t));
@@ -83,7 +83,7 @@ static int restore_usr_regs(struct pt_reif (!err)set_current_blocked (&set); - err |=__copy_from_user (regs, &(sf->uc.uc_mcontext.regs), + err |=__copy_from_user (regs, &(sf->uc.uc_mcontext.regs.scratch),sizeof (sf->uc.uc_mcontext.regs.scratch));return err;
Greg Kroah-Hartman
maintainerPATCH 7/43 selinux: fix sel_write_enforce broken return value
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
commit 6436a123a147db51a0b06024a8350f4c230e73ff upstream.
Return a negative error value like the rest of the entries in this function.
--- security/selinux/selinuxfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/selinuxfs.c +1 -1
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct goto out;/* No partial writes. */ - length =EINVAL ; + length = -EINVAL ;if (*ppos !=0 ) goto out;
Greg Kroah-Hartman
maintainerPATCH 8/43 tcp: Fix crash in TCP Fast Open
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit 355a901e6cf1 ("tcp: make connect() mem charging friendly") changed tcp_send_syn_data() to perform an open-coded copy of the 'syn' skb rather than using skb_copy_expand().
The open-coded copy does not cover the skb_shared_info::gso_segs field, so in the new skb it is left set to 0. When this commit was backported into stable branches between 3.10.y and 3.16.7-ckty inclusive, it triggered the BUG() in tcp_transmit_skb().
Since Linux 3.18 the GSO segment count is kept in the tcp_skb_cb::tcp_gso_segs field and tcp_send_syn_data() does copy the tcp_skb_cb structure to the new skb, so mainline and newer stable branches are not affected.
Set skb_shared_info::gso_segs to the correct value of 1.
--- net/ipv4/tcp_output.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp_output.c +1 -0
@@ -2933,6 +2933,7 @@ static int tcp_send_syn_data(struct sock goto fallback; syn_data->ip_summed =CHECKSUM_PARTIAL ;memcpy (syn_data->cb, syn->cb,sizeof (syn->cb)); +skb_shinfo (syn_data)->gso_segs =1 ;if (unlikely (memcpy_fromiovecend (skb_put (syn_data, space), fo->data->msg_iov,0 , space))) {kfree_skb (syn_data);
Greg Kroah-Hartman
maintainerPATCH 9/43 btrfs: simplify insert_orphan_item
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit 9c4f61f01d269815bb7c37be3ede59c5587747c6 upstream.
We can search and add the orphan item in one go, btrfs_insert_orphan_item will find out if the item already exists.
--- fs/btrfs/tree-log.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
fs/btrfs/tree-log.c +4 -12
@@ -1235,21 +1235,13 @@ out: }static int insert_orphan_item (struct btrfs_trans_handle *trans, -struct btrfs_root *root,u64 offset) +struct btrfs_root *root,u64 ino) {int ret; -struct btrfs_path *path; - path =btrfs_alloc_path (); -if (!path) -return -ENOMEM ; - - ret =btrfs_find_item (root, path,BTRFS_ORPHAN_OBJECTID , - offset,BTRFS_ORPHAN_ITEM_KEY ,NULL ); -if (ret >0 ) - ret =btrfs_insert_orphan_item (trans, root, offset); - -btrfs_free_path (path); + ret =btrfs_insert_orphan_item (trans, root, ino); +if (ret == -EEXIST ) + ret =0 ;return ret; }
Greg Kroah-Hartman
maintainerPATCH 10/43 IB/core: Avoid leakage from kernel to user space
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eli Cohen <[email protected]>
commit 377b513485fd885dea1083a9a5430df65b35e048 upstream.
Clear the reserved field of struct ib_uverbs_async_event_desc which is copied to user space.
--- drivers/infiniband/core/uverbs_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/uverbs_main.c +1 -0
@@ -476,6 +476,7 @@ static void ib_uverbs_async_handler(stru entry->desc.async.element = element; entry->desc.async.event_type = event; + entry->desc.async.reserved =0 ; entry->counter = counter;list_add_tail (&entry->list, &file->async_file->event_list);
Greg Kroah-Hartman
maintainerPATCH 11/43 IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shachar Raindel <[email protected]>
commit 8494057ab5e40df590ef6ef7d66324d3ae33356b upstream.
Properly verify that the resulting page aligned end address is larger than both the start address and the length of the memory area requested.
Both the start and length arguments for ib_umem_get are controlled by the user. A misbehaving user can provide values which will cause an integer overflow when calculating the page aligned end address.
This overflow can cause also miscalculation of the number of pages mapped, and additional logic issues.
Addresses: CVE-2014-8159
--- drivers/infiniband/core/umem.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/infiniband/core/umem.c +8 -0
@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_ucif (dmasync)dma_set_attr (DMA_ATTR_WRITE_BARRIER , &attrs); +/* +* If the combination of the addr and size requested for this memory +* region causes an integer overflow, return error. +*/ +if ((PAGE_ALIGN (addr + size) <= size) || + (PAGE_ALIGN (addr + size) <= addr)) +return ERR_PTR (-EINVAL ); +if (!can_do_mlock ())return ERR_PTR (-EPERM );
Greg Kroah-Hartman
maintainerPATCH 12/43 iwlwifi: dvm: run INIT firmware again upon .start()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 9c8928f5176766bec79f272bd47b7124e11cccbd upstream.
The assumption before this patch was that we don't need to run again the INIT firmware after the system booted. The INIT firmware runs calibrations which impact the physical layer's behavior.
Users reported that it may be helpful to run these calibrations again every time the interface is brought up. The penatly is minimal, since the calibrations run fast. This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=94341
--- drivers/net/wireless/iwlwifi/dvm/dev.h | 1 - drivers/net/wireless/iwlwifi/dvm/ucode.c | 5 ----- 2 files changed, 6 deletions(-)
drivers/net/wireless/iwlwifi/dvm/dev.h +0 -1
@@ -708,7 +708,6 @@ struct iwl_priv {unsigned long reload_jiffies;int reload_count;bool ucode_loaded; -bool init_ucode_run;/* Don't run init uCode again */ u8 plcp_delta_threshold;
drivers/net/wireless/iwlwifi/dvm/ucode.c +0 -5
@@ -418,9 +418,6 @@ int iwl_run_init_ucode(struct iwl_priv *if (!priv->fw->img[IWL_UCODE_INIT ].sec[0 ].len)return 0 ; -if (priv->init_ucode_run) -return 0 ; -iwl_init_notification_wait (&priv->notif_wait, &calib_wait, calib_complete,ARRAY_SIZE (calib_complete), iwlagn_wait_calib, priv);
@@ -440,8 +437,6 @@ int iwl_run_init_ucode(struct iwl_priv **/ ret =iwl_wait_notification (&priv->notif_wait, &calib_wait,UCODE_CALIB_TIMEOUT ); -if (!ret) - priv->init_ucode_run = true; goto out;
Greg Kroah-Hartman
maintainerPATCH 13/43 nbd: fix possible memory leak
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudip Mukherjee <[email protected]>
commit ff6b8090e26ef7649ef0cc6b42389141ef48b0cf upstream.
we have already allocated memory for nbd_dev, but we were not releasing that memory and just returning the error value.
--- drivers/block/nbd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/block/nbd.c +4 -4
@@ -814,10 +814,6 @@ static int __init nbd_init(void)return -EINVAL ; } - nbd_dev =kcalloc (nbds_max,sizeof (*nbd_dev),GFP_KERNEL ); -if (!nbd_dev) -return -ENOMEM ; - part_shift =0 ;if (max_part >0 ) { part_shift =fls (max_part);
@@ -839,6 +835,10 @@ static int __init nbd_init(void)if (nbds_max >1UL << (MINORBITS - part_shift))return -EINVAL ; + nbd_dev =kcalloc (nbds_max,sizeof (*nbd_dev),GFP_KERNEL ); +if (!nbd_dev) +return -ENOMEM ; +for (i =0 ; i < nbds_max; i++) {struct gendisk *disk =alloc_disk (1 << part_shift);if (!disk)
Greg Kroah-Hartman
maintainerPATCH 14/43 mm/memory hotplug: postpone the reset of obsolete pgdat
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gu Zheng <[email protected]>
commit b0dc3a342af36f95a68fe229b8f0f73552c5ca08 upstream.
Qiu Xishi reported the following BUG when testing hot-add/hot-remove node under stress condition:
BUG: unable to handle kernel paging request at 0000000000025f60
IP: next_online_pgdat+0x1/0x50
PGD 0
Oops: 0000 [#1] SMP
ACPI: Device does not support D3cold
Modules linked in: fuse nls_iso8859_1 nls_cp437 vfat fat loop dm_mod coretemp mperf crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper cryptd lrw gf128mul glue_helper aes_x86_64 pcspkr microcode igb dca i2c_algo_bit ipv6 megaraid_sas iTCO_wdt i2c_i801 i2c_core iTCO_vendor_support tg3 sg hwmon ptp lpc_ich pps_core mfd_core acpi_pad rtc_cmos button ext3 jbd mbcache sd_mod crc_t10dif scsi_dh_alua scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh ahci libahci libata scsi_mod [last unloaded: rasf]
CPU: 23 PID: 238 Comm: kworker/23:1 Tainted: G O 3.10.15-5885-euler0302 #1
Hardware name: HUAWEI TECHNOLOGIES CO.,LTD. Huawei N1/Huawei N1, BIOS V100R001 03/02/2015
Workqueue: events vmstat_update
task: ffffa800d32c0000 ti: ffffa800d32ae000 task.ti: ffffa800d32ae000
RIP: 0010: next_online_pgdat+0x1/0x50
RSP: 0018:ffffa800d32afce8 EFLAGS: 00010286
RAX: 0000000000001440 RBX: ffffffff81da53b8 RCX: 0000000000000082
RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000000
RBP: ffffa800d32afd28 R08: ffffffff81c93bfc R09: ffffffff81cbdc96
R10: 00000000000040ec R11: 00000000000000a0 R12: ffffa800fffb3440
R13: ffffa800d32afd38 R14: 0000000000000017 R15: ffffa800e6616800
FS: 0000000000000000(0000) GS:ffffa800e6600000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000025f60 CR3: 0000000001a0b000 CR4: 00000000001407e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
refresh_cpu_vm_stats+0xd0/0x140
vmstat_update+0x11/0x50
process_one_work+0x194/0x3d0
worker_thread+0x12b/0x410
kthread+0xc6/0xd0
ret_from_fork+0x7c/0xb0The cause is the "memset(pgdat, 0, sizeof(*pgdat))" at the end of try_offline_node, which will reset all the content of pgdat to 0, as the pgdat is accessed lock-free, so that the users still using the pgdat will panic, such as the vmstat_update routine.
process A: offline node XX:
vmstat_updat()
refresh_cpu_vm_stats()
for_each_populated_zone()
find online node XX
cond_resched()
offline cpu and memory, then try_offline_node() node_set_offline(nid), and memset(pgdat, 0, sizeof(*pgdat))
zone = next_zone(zone)
pg_data_t *pgdat = zone->zone_pgdat; // here pgdat is NULL now
next_online_pgdat(pgdat)
next_online_node(pgdat->node_id); // NULL pointer access
So the solution here is postponing the reset of obsolete pgdat from try_offline_node() to hotadd_new_pgdat(), and just resetting pgdat->nr_zones and pgdat->classzone_idx to be 0 rather than the memset 0 to avoid breaking pointer information in pgdat.
--- mm/memory_hotplug.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
mm/memory_hotplug.c +4 -9
@@ -1016,6 +1016,10 @@ static pg_data_t __ref *hotadd_new_pgdatreturn NULL ;arch_refresh_nodedata (nid, pgdat); + }else { +/* Reset the nr_zones and classzone_idx to 0 before reuse */ + pgdat->nr_zones =0 ; + pgdat->classzone_idx =0 ; }/* we can use NODE_DATA(nid) from here */
@@ -1863,15 +1867,6 @@ void try_offline_node(int nid)if (is_vmalloc_addr (zone->wait_table))vfree (zone->wait_table); } - -/* -* Since there is no way to guarentee the address of pgdat/zone is not -* on stack of any kernel threads or used by other kernel objects -* without reference counting or other symchronizing method, do not -* reset node_data and free pgdat here. Just reset it to 0 and reuse -* the memory when the node is online again. -*/ -memset (pgdat,0 ,sizeof (*pgdat)); }EXPORT_SYMBOL (try_offline_node);
Greg Kroah-Hartman
maintainerPATCH 15/43 sched: Fix RLIMIT_RTTIME when PI-boosting to RT
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Silverman <[email protected]>
commit 746db9443ea57fd9c059f62c4bfbf41cf224fe13 upstream.
When non-realtime tasks get priority-inheritance boosted to a realtime scheduling class, RLIMIT_RTTIME starts to apply to them. However, the counter used for checking this (the same one used for SCHED_RR timeslices) was not getting reset. This meant that tasks running with a non-realtime scheduling class which are repeatedly boosted to a realtime one, but never block while they are running realtime, eventually hit the timeout without ever running for a time over the limit. This patch resets the realtime timeslice counter when un-PI-boosting from an RT to a non-RT scheduling class.
I have some test code with two threads and a shared PTHREAD_PRIO_INHERIT mutex which induces priority boosting and spins while boosted that gets killed by a SIGXCPU on non-fixed kernels but doesn't with this patch applied. It happens much faster with a CONFIG_PREEMPT_RT kernel, and does happen eventually with PREEMPT_VOLUNTARY kernels.
--- kernel/sched/core.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sched/core.c +2 -0
@@ -2980,6 +2980,8 @@ void rt_mutex_setprio(struct task_struct }else {if (dl_prio (oldprio)) p->dl.dl_boosted =0 ; +if (rt_prio (oldprio)) + p->rt.timeout =0 ; p->sched_class = &fair_sched_class; }
Greg Kroah-Hartman
maintainerPATCH 16/43 writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 7d70e15480c0450d2bfafaad338a32e884fc215e upstream.
global_update_bandwidth() uses static variable update_time as the timestamp for the last update but forgets to initialize it to INITIALIZE_JIFFIES.
This means that global_dirty_limit will be 5 mins into the future on 32bit and some large amount jiffies into the past on 64bit. This isn't critical as the only effect is that global_dirty_limit won't be updated for the first 5 mins after booting on 32bit machines, especially given the auxiliary nature of global_dirty_limit's role - protecting against global dirty threshold's sudden dips; however, it does lead to unintended suboptimal behavior. Fix it.
--- mm/page-writeback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page-writeback.c +1 -1
@@ -943,7 +943,7 @@ static void global_update_bandwidth(unsi unsigned long now) {static DEFINE_SPINLOCK (dirty_lock); -static unsigned long update_time; +static unsigned long update_time =INITIAL_JIFFIES ;/* * check locklessly first to optimize away locking for the most time
Greg Kroah-Hartman
maintainerPATCH 17/43 writeback: fix possible underflow in write bandwidth calculation
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit c72efb658f7c8b27ca3d0efb5cfd5ded9fcac89e upstream.
Quoted 1 line
Quoted 1 line
From
1ebf33901ecc75d9496862dceb1ef0377980587cMon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Mon, 23 Mar 2015 00:08:19 -0400
2f800fbd777b ("writeback: fix dirtied pages accounting on redirty") introduced account_page_redirty() which reverts stat updates for a redirtied page, making BDI_DIRTIED no longer monotonically increasing.
bdi_update_write_bandwidth() uses the delta in BDI_DIRTIED as the basis for bandwidth calculation. While unlikely, since the above patch, the newer value may be lower than the recorded past value and underflow the bandwidth calculation leading to a wild result.
Fix it by subtracing min of the old and new values when calculating delta. AFAIK, there hasn't been any report of it happening but the resulting erratic behavior would be non-critical and temporary, so it's possible that the issue is happening without being reported. The risk of the fix is very low, so tagged for -stable.
--- mm/page-writeback.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/page-writeback.c +4 -1
@@ -878,8 +878,11 @@ static void bdi_update_write_bandwidth(s* bw * elapsed + write_bandwidth * (period - elapsed) * write_bandwidth = --------------------------------------------------- * period +* +* @written may have decreased due to account_page_redirty(). +* Avoid underflowing @bw calculation. */ - bw = written - bdi->written_stamp; + bw = written -min (written, bdi->written_stamp); bw *=HZ ;if (unlikely (elapsed > period)) {do_div (bw, elapsed);
Greg Kroah-Hartman
maintainerPATCH 19/43 USB: ftdi_sio: Added custom PID for Synapse Wireless product
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Goldstein <[email protected]>
commit 4899c054a90439477b24da8977db8d738376fe90 upstream.
Synapse Wireless uses the FTDI VID with a custom PID of 0x9090 for their SNAP Stick 200 product.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -617,6 +617,7 @@ static const struct usb_device_id id_tab .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, /* * ELV devices: */
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -561,6 +561,12 @@*/ #define FTDI_NT_ORIONLXM_PID 0x7c90/* OrionLXm Substation Automation Platform */ +/* +* Synapse Wireless product ids (FTDI_VID) +* http://www.synapse-wireless.com +*/ +#define FTDI_SYNAPSE_SS200_PID 0x9090/* SS200 - SNAP Stick 200 */ +/********************************/ /** third-party VID/PID combos **/
Greg Kroah-Hartman
maintainerPATCH 20/43 USB: ftdi_sio: Use jtag quirk for SNAP Connect E10
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Goldstein <[email protected]>
commit b229a0f840f774d29d8fedbf5deb344ca36b7f1a upstream.
This patch uses the existing CALAO Systems ftdi_8u2232c_probe in order to avoid attaching a TTY to the JTAG port as this board is based on the CALAO Systems reference design and needs the same fix up.
--- drivers/usb/serial/ftdi_sio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +6 -2
@@ -1902,8 +1902,12 @@ static int ftdi_8u2232c_probe(struct usb {struct usb_device *udev = serial->dev; -if ((udev->manufacturer && !strcmp (udev->manufacturer,"CALAO Systems" )) || - (udev->product && !strcmp (udev->product,"BeagleBone/XDS100V2" ))) +if (udev->manufacturer && !strcmp (udev->manufacturer,"CALAO Systems" )) +return ftdi_jtag_probe (serial); + +if (udev->product && + (!strcmp (udev->product,"BeagleBone/XDS100V2" ) || + !strcmp (udev->product,"SNAP Connect E10" )))return ftdi_jtag_probe (serial);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 21/43 Defer processing of REQ_PREEMPT requests for blocked devices
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit bba0bdd7ad4713d82338bcd9b72d57e9335a664b upstream.
SCSI transport drivers and SCSI LLDs block a SCSI device if the transport layer is not operational. This means that in this state no requests should be processed, even if the REQ_PREEMPT flag has been set. This patch avoids that a rescan shortly after a cable pull sporadically triggers the following kernel oops:
BUG: unable to handle kernel paging request at ffffc9001a6bc084 IP: [<ffffffffa04e08f2>] mlx4_ib_post_send+0xd2/0xb30 [mlx4_ib] Process rescan-scsi-bus (pid: 9241, threadinfo ffff88053484a000, task ffff880534aae100) Call Trace: [<ffffffffa0718135>] srp_post_send+0x65/0x70 [ib_srp] [<ffffffffa071b9df>] srp_queuecommand+0x1cf/0x3e0 [ib_srp] [<ffffffffa0001ff1>] scsi_dispatch_cmd+0x101/0x280 [scsi_mod] [<ffffffffa0009ad1>] scsi_request_fn+0x411/0x4d0 [scsi_mod] [<ffffffff81223b37>] __blk_run_queue+0x27/0x30 [<ffffffff8122a8d2>] blk_execute_rq_nowait+0x82/0x110 [<ffffffff8122a9c2>] blk_execute_rq+0x62/0xf0 [<ffffffffa000b0e8>] scsi_execute+0xe8/0x190 [scsi_mod] [<ffffffffa000b2f3>] scsi_execute_req+0xa3/0x130 [scsi_mod] [<ffffffffa000c1aa>] scsi_probe_lun+0x17a/0x450 [scsi_mod] [<ffffffffa000ce86>] scsi_probe_and_add_lun+0x156/0x480 [scsi_mod] [<ffffffffa000dc2f>] __scsi_scan_target+0xdf/0x1f0 [scsi_mod] [<ffffffffa000dfa3>] scsi_scan_host_selected+0x183/0x1c0 [scsi_mod] [<ffffffffa000edfb>] scsi_scan+0xdb/0xe0 [scsi_mod] [<ffffffffa000ee13>] store_scan+0x13/0x20 [scsi_mod] [<ffffffff811c8d9b>] sysfs_write_file+0xcb/0x160 [<ffffffff811589de>] vfs_write+0xce/0x140 [<ffffffff81158b53>] sys_write+0x53/0xa0 [<ffffffff81464592>] system_call_fastpath+0x16/0x1b [<00007f611c9d9300>] 0x7f611c9d92ff
--- drivers/scsi/scsi_lib.c | 4 +++- include/linux/blk_types.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/scsi_lib.c +3 -1
@@ -1258,9 +1258,11 @@ int scsi_prep_state_check(struct scsi_de "rejecting I/O to dead device\n"); ret =BLKPREP_KILL ;break ; -case SDEV_QUIESCE :case SDEV_BLOCK :case SDEV_CREATED_BLOCK : + ret =BLKPREP_DEFER ; +break ; +case SDEV_QUIESCE :/* * If the devices is blocked we defer normal commands. */
include/linux/blk_types.h +3 -1
@@ -180,7 +180,9 @@ enum rq_flag_bits { __REQ_ELVPRIV,/* elevator private data attached */ __REQ_FAILED,/* set if the request failed */ __REQ_QUIET,/* don't worry about errors */ - __REQ_PREEMPT,/* set for "ide_preempt" requests */ + __REQ_PREEMPT,/* set for "ide_preempt" requests and also +for requests for which the SCSI "quiesce" +state must be ignored. */ __REQ_ALLOCED,/* request came from our alloc pool */ __REQ_COPY_USER,/* contains copies of user pages */ __REQ_FLUSH_SEQ, /* request for flush sequence */
Greg Kroah-Hartman
maintainerPATCH 22/43 iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viorel Suman <[email protected]>
commit 4dac0a8eefd55bb1f157d1a5a084531334a2d74c upstream.
A hardware fifo reset always imply an invalidation of the existing timestamps, so we'll clear timestamps fifo on successfull hardware fifo reset.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +14 -11
@@ -25,6 +25,16 @@#include <linux/poll.h> #include "inv_mpu_iio.h" +static void inv_clear_kfifo (struct inv_mpu6050_state *st) +{ +unsigned long flags; + +/* take the spin lock sem to avoid interrupt kick in */ +spin_lock_irqsave (&st->time_stamp_lock, flags); +kfifo_reset (&st->timestamps); +spin_unlock_irqrestore (&st->time_stamp_lock, flags); +} +int inv_reset_fifo (struct iio_dev *indio_dev) {int result;
@@ -51,6 +61,10 @@ int inv_reset_fifo(struct iio_dev *indio INV_MPU6050_BIT_FIFO_RST);if (result) goto reset_fifo_fail; + +/* clear timestamps fifo */ +inv_clear_kfifo (st); +/* enable interrupt */ if (st->chip_config.accl_fifo_enable || st->chip_config.gyro_fifo_enable) {
@@ -84,16 +98,6 @@ reset_fifo_fail:return result; } -static void inv_clear_kfifo (struct inv_mpu6050_state *st) -{ -unsigned long flags; - -/* take the spin lock sem to avoid interrupt kick in */ -spin_lock_irqsave (&st->time_stamp_lock, flags); -kfifo_reset (&st->timestamps); -spin_unlock_irqrestore (&st->time_stamp_lock, flags); -} -/** * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt. */
@@ -185,7 +189,6 @@ end_session: flush_fifo:/* Flush HW and SW FIFOs. */ inv_reset_fifo (indio_dev); -inv_clear_kfifo (st);mutex_unlock (&indio_dev->mlock);iio_trigger_notify_done (indio_dev->trig);
Greg Kroah-Hartman
maintainerPATCH 23/43 iio: imu: Use iio_trigger_get for indio_dev->trig assignment
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darshana Padmadas <[email protected]>
commit 4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4 upstream.
This patch uses iio_trigger_get to increment the reference count of trigger device, to avoid incorrect assignment. Can result in a null pointer dereference during removal if the trigger has been changed before removal.
This patch refers to a similar situation encountered through the following discussion:
http://www.spinics.net/lists/linux-iio/msg13669.html
--- drivers/iio/imu/adis_trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/adis_trigger.c +1 -1
@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adisiio_trigger_set_drvdata (adis->trig, adis); ret =iio_trigger_register (adis->trig); - indio_dev->trig = adis->trig; + indio_dev->trig =iio_trigger_get (adis->trig);if (ret) goto error_free_irq;
Greg Kroah-Hartman
maintainerPATCH 24/43 dmaengine: omap-dma: Fix memory leak when terminating running transfer
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 02d88b735f5a60f04dbf6d051b76e1877a0d0844 upstream.
In omap_dma_start_desc the vdesc->node is removed from the virt-dma framework managed lists (to be precise from the desc_issued list). If a terminate_all comes before the transfer finishes the omap_desc will not be freed up because it is not in any of the lists and we stopped the DMA channel so the transfer will not going to complete.
There is no special sequence for leaking memory when using cyclic (audio)
transfer: with every start and stop of a cyclic transfer the driver leaks struct omap_desc worth of memory.
Free up the allocated memory directly in omap_dma_terminate_all() since the framework will not going to do that for us.
--- drivers/dma/omap-dma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/omap-dma.c +1 -0
@@ -487,6 +487,7 @@ static int omap_dma_terminate_all(struct* c->desc is NULL and exit.) */ if (c->desc) { +omap_dma_desc_free (&c->desc->vd); c->desc =NULL ;/* Avoid stopping the dma twice */ if (!c->paused)
Greg Kroah-Hartman
maintainerPATCH 25/43 x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Lippers-Hollmann <[email protected]>
commit 80313b3078fcd2ca51970880d90757f05879a193 upstream.
The ASRock Q1900DC-ITX mainboard (Baytrail-D) hangs randomly in both BIOS and UEFI mode while rebooting unless reboot=pci is used. Add a quirk to reboot via the pci method.
The problem is very intermittent and hard to debug, it might succeed rebooting just fine 40 times in a row - but fails half a dozen times the next day. It seems to be slightly less common in BIOS CSM mode than native UEFI (with the CSM disabled), but it does happen in either mode. Since I've started testing this patch in late january, rebooting has been 100% reliable.
Most of the time it already hangs during POST, but occasionally it might even make it through the bootloader and the kernel might even start booting, but then hangs before the mode switch. The same symptoms occur with grub-efi, gummiboot and grub-pc, just as well as (at least) kernel 3.16-3.19 and 4.0-rc6 (I haven't tried older kernels than 3.16). Upgrading to the most current mainboard firmware of the ASRock Q1900DC-ITX, version 1.20, does not improve the situation.
( Searching the web seems to suggest that other Bay Trail-D mainboards
might be affected as well. )
--
--- arch/x86/kernel/reboot.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/x86/kernel/reboot.c +10 -0
@@ -181,6 +181,16 @@ static struct dmi_system_id __initdata r }, }, +/* ASRock */ + {/* Handle problems with rebooting on ASRock Q1900DC-ITX */ + .callback = set_pci_reboot, + .ident = "ASRock Q1900DC-ITX", + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASRock" ), + DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"), + }, + }, + /* ASUS */ { /* Handle problems with rebooting on ASUS P4S800 */ .callback = set_bios_reboot,
Greg Kroah-Hartman
maintainerPATCH 26/43 can: flexcan: Deferred on Regulator return EPROBE_DEFER
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Werner <[email protected]>
commit 555828ef45f825d6ee06559f0304163550eed380 upstream.
Return EPROBE_DEFER if Regulator returns EPROBE_DEFER
If the Flexcan driver is built into kernel and a regulator is used to enable the CAN transceiver, the Flexcan driver may not use the regulator.
When initializing the Flexcan device with a regulator defined in the device tree, but not initialized, the regulator subsystem returns EPROBE_DEFER, hence the Flexcan init fails.
The solution for this is to return EPROBE_DEFER if regulator is not initialized and wait until the regulator is initialized.
--- drivers/net/can/flexcan.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/can/flexcan.c +8 -3
@@ -1095,12 +1095,19 @@ static int flexcan_probe(struct platformconst struct flexcan_devtype_data *devtype_data;struct net_device *dev;struct flexcan_priv *priv; +struct regulator *reg_xceiver;struct resource *mem;struct clk *clk_ipg =NULL , *clk_per =NULL ;void __iomem *base;int err, irq;u32 clock_freq =0 ; + reg_xceiver =devm_regulator_get (&pdev->dev,"xceiver" ); +if (PTR_ERR (reg_xceiver) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; +else if (IS_ERR (reg_xceiver)) + reg_xceiver =NULL ; +if (pdev->dev.of_node)of_property_read_u32 (pdev->dev.of_node,"clock-frequency" , &clock_freq);
@@ -1162,9 +1169,7 @@ static int flexcan_probe(struct platform priv->pdata =dev_get_platdata (&pdev->dev); priv->devtype_data = devtype_data; - priv->reg_xceiver =devm_regulator_get (&pdev->dev,"xceiver" ); -if (IS_ERR (priv->reg_xceiver)) - priv->reg_xceiver =NULL ; + priv->reg_xceiver = reg_xceiver;netif_napi_add (dev, &priv->napi, flexcan_poll,FLEXCAN_NAPI_WEIGHT );
Greg Kroah-Hartman
maintainerPATCH 27/43 cpuidle: remove state_count field from struct cpuidle_device
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartlomiej Zolnierkiewicz <[email protected]>
commit d75e4af14e228bbe3f86e29bcecb8e6be98d4e04 upstream.
Thomas Schlichter reports the following issue on his Samsung NC20:
"The C-states C1 and C2 to the OS when connected to AC, and additionally
provides the C3 C-state when disconnected from AC. However, the number of C-states shown in sysfs is fixed to the number of C-states present at boot.
If I boot with AC connected, I always only see the C-states up to C2 even if I disconnect AC.
The reason is commit 130a5f692425 (ACPI / cpuidle: remove dev->state_count setting). It removes the update of dev->state_count, but sysfs uses exactly this variable to show the C-states.
The fix is to use drv->state_count in sysfs. As this is currently the last user of dev->state_count, this variable can be completely removed."
Remove dev->state_count as per the above.
--- drivers/cpuidle/cpuidle.c | 3 --- drivers/cpuidle/sysfs.c | 5 +++-- include/linux/cpuidle.h | 1 - 3 files changed, 3 insertions(+), 6 deletions(-)
drivers/cpuidle/cpuidle.c +0 -3
@@ -252,9 +252,6 @@ int cpuidle_enable_device(struct cpuidleif (!dev->registered)return -EINVAL ; -if (!dev->state_count) - dev->state_count = drv->state_count; - ret =cpuidle_add_device_sysfs (dev);if (ret)return ret;
drivers/cpuidle/sysfs.c +3 -2
@@ -398,7 +398,7 @@ static int cpuidle_add_state_sysfs(strucstruct cpuidle_driver *drv =cpuidle_get_cpu_driver (device);/* state statistics */ -for (i =0 ; i < device->state_count; i++) { +for (i =0 ; i < drv->state_count; i++) { kobj =kzalloc (sizeof (struct cpuidle_state_kobj ),GFP_KERNEL );if (!kobj) goto error_state;
@@ -430,9 +430,10 @@ error_state:*/ static void cpuidle_remove_state_sysfs (struct cpuidle_device *device) { +struct cpuidle_driver *drv =cpuidle_get_cpu_driver (device);int i; -for (i =0 ; i < device->state_count; i++) +for (i =0 ; i < drv->state_count; i++)cpuidle_free_state_kobj (device, i); }
include/linux/cpuidle.h +0 -1
@@ -69,7 +69,6 @@ struct cpuidle_device {unsigned int cpu;int last_residency; -int state_count;struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX ];struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX ];struct cpuidle_driver_kobj *kobj_driver;
Greg Kroah-Hartman
maintainerPATCH 28/43 cpuidle: ACPI: do not overwrite name and description of C0
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Schlichter <[email protected]>
commit c7e8bdf5872c5a8f5a6494e16fe839c38a0d3d3d upstream.
Fix a bug that leads to showing the name and description of C-state C0 as "<null>" in sysfs after the ACPI C-states changed (e.g. after AC->DC or DC->AC
transition).
The function poll_idle_init() in drivers/cpuidle/driver.c initializes the state 0 during cpuidle_register_driver(), so we better do not overwrite it again with '\0' during acpi_processor_cst_has_changed().
--- drivers/acpi/processor_idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/processor_idle.c +1 -1
@@ -962,7 +962,7 @@ static int acpi_processor_setup_cpuidle_return -EINVAL ; drv->safe_state_index =-1 ; -for (i =0 ; i <CPUIDLE_STATE_MAX ; i++) { +for (i =CPUIDLE_DRIVER_STATE_START ; i <CPUIDLE_STATE_MAX ; i++) { drv->states[i].name[0 ] ='\0' ; drv->states[i].desc[0 ] ='\0' ; }
Greg Kroah-Hartman
maintainerPATCH 29/43 usb: xhci: handle Config Error Change (CEC) in xhci driver
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 9425183d177aa4a2f09d01a74925124f0778b595 upstream.
Linux xHCI driver doesn't report and handle port cofig error change. If Port Configure Error for root hub port occurs, CEC bit in PORTSC would be set by xHC and remains 1. This happends when the root port fails to configure its link partner, e.g. the port fails to exchange port capabilities information using Port Capability LMPs.
Then the Port Status Change Events will be blocked until all status change bits(CEC is one of the change bits) are cleared('0') (refer to xHCI spec 4.19.2). Otherwise, the port status change event for this root port will not be generated anymore, then root port would look like dead for user and can't be recovered until a Host Controller Reset(HCRST).
This patch is to check CEC bit in PORTSC in xhci_get_port_status() and set a Config Error in the return status if CEC is set. This will cause a ClearPortFeature request, where CEC bit is cleared in xhci_clear_port_change_bit().
[The commit log is based on initial Marvell patch posted at
http://marc.info/?l=linux-kernel&m=142323612321434&w=2]
--- drivers/usb/host/xhci-hub.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-hub.c +8 -1
@@ -383,6 +383,10 @@ static void xhci_clear_port_change_bit(s status =PORT_PLC ; port_change_bit ="link state" ;break ; +case USB_PORT_FEAT_C_PORT_CONFIG_ERROR : + status =PORT_CEC ; + port_change_bit ="config error" ; +break ;default :/* Should never happen */ return ;
@@ -584,6 +588,8 @@ static u32 xhci_get_port_status(struct u status |=USB_PORT_STAT_C_LINK_STATE <<16 ;if ((raw_port_status &PORT_WRC )) status |=USB_PORT_STAT_C_BH_RESET <<16 ; +if ((raw_port_status &PORT_CEC )) + status |=USB_PORT_STAT_C_CONFIG_ERROR <<16 ; }if (hcd->speed !=HCD_USB3 ) {
@@ -999,6 +1005,7 @@ int xhci_hub_control(struct usb_hcd *hcdcase USB_PORT_FEAT_C_OVER_CURRENT :case USB_PORT_FEAT_C_ENABLE :case USB_PORT_FEAT_C_PORT_LINK_STATE : +case USB_PORT_FEAT_C_PORT_CONFIG_ERROR :xhci_clear_port_change_bit (xhci, wValue, wIndex, port_array[wIndex], temp);break ;
@@ -1063,7 +1070,7 @@ int xhci_hub_status_data(struct usb_hcd*/ status = bus_state->resuming_ports; - mask =PORT_CSC |PORT_PEC |PORT_OCC |PORT_PLC |PORT_WRC ; + mask =PORT_CSC |PORT_PEC |PORT_OCC |PORT_PLC |PORT_WRC |PORT_CEC ;spin_lock_irqsave (&xhci->lock, flags);/* For each port, did anything change? If so, set that bit in buf. */
Greg Kroah-Hartman
maintainerPATCH 30/43 usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 227a4fd801c8a9fa2c4700ab98ec1aec06e3b44d upstream.
When a device with an isochronous endpoint is plugged into the Intel xHCI host controller, and the driver submits multiple frames per URB, the xHCI driver will set the Block Event Interrupt (BEI) flag on all but the last TD for the URB. This causes the host controller to place an event on the event ring, but not send an interrupt. When the last TD for the URB completes, BEI is cleared, and we get an interrupt for the whole URB.
However, under Intel xHCI host controllers, if the event ring is full of events from transfers with BEI set, an "Event Ring is Full" event will be posted to the last entry of the event ring, but no interrupt is generated. Host will cease all transfer and command executions and wait until software completes handling the pending events in the event ring. That means xHC stops, but event of "event ring is full" is not notified. As the result, the xHC looks like dead to user.
This patch is to apply XHCI_AVOID_BEI quirk to Intel xHC devices. And it should be backported to kernels as old as 3.0, that contains the commit 69e848c2090a ("Intel xhci: Support EHCI/xHCI port switching.").
--- drivers/usb/host/xhci-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +1 -1
@@ -108,6 +108,7 @@ static void xhci_pci_quirks(struct devicif (pdev->vendor ==PCI_VENDOR_ID_INTEL ) { xhci->quirks |=XHCI_LPM_SUPPORT ; xhci->quirks |=XHCI_INTEL_HOST ; + xhci->quirks |=XHCI_AVOID_BEI ; }if (pdev->vendor ==PCI_VENDOR_ID_INTEL && pdev->device ==PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI ) {
@@ -123,7 +124,6 @@ static void xhci_pci_quirks(struct devic* PPT chipsets. */ xhci->quirks |=XHCI_SPURIOUS_REBOOT ; - xhci->quirks |=XHCI_AVOID_BEI ; } if (pdev->vendor == PCI_VENDOR_ID_INTEL && (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI ||
Greg Kroah-Hartman
maintainerPATCH 31/43 tty: serial: fsl_lpuart: clear receive flag on FIFO flush
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Agner <[email protected]>
commit 8e4934c6d6c659e22b1b746af4196683e77ce6ca upstream.
When the receiver was enabled during startup, a character could have been in the FIFO when the UART get initially used. The driver configures the (receive) watermark level, and flushes the FIFO. However, the receive flag (RDRF) could still be set at that stage (as mentioned in the register description of UARTx_RWFIFO). This leads to an interrupt which won't be handled properly in interrupt mode: The receive interrupt function lpuart_rxint checks the FIFO count, which is 0 at that point (due to the flush during initialization). The problem does not manifest when using DMA to receive characters.
Fix this situation by explicitly read the status register, which leads to clearing of the RDRF flag. Due to the flush just after the status flag read, a explicit data read is not to required.
--- drivers/tty/serial/fsl_lpuart.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/fsl_lpuart.c +3 -0
@@ -362,6 +362,9 @@ static void lpuart_setup_watermark(strucwriteb (val |UARTPFIFO_TXFE |UARTPFIFO_RXFE , sport->port.membase +UARTPFIFO ); +/* explicitly clear RDRF */ +readb (sport->port.membase +UARTSR1 ); +/* flush Tx and Rx FIFO */ writeb (UARTCFIFO_TXFLUSH |UARTCFIFO_RXFLUSH , sport->port.membase +UARTCFIFO );
Greg Kroah-Hartman
maintainerPATCH 32/43 n_tty: Fix read buffer overwrite when no newline
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit fb5ef9e7da39968fec6d6f37f20a23d23740c75e upstream.
In canon mode, the read buffer head will advance over the buffer tail if the input > 4095 bytes without receiving a line termination char.
Discard additional input until a line termination is received. Before evaluating for overflow, the 'room' value is normalized for I_PARMRK and 1 byte is reserved for line termination (even in !icanon mode, in case the mode is switched). The following table shows the transform:
actual buffer | 'room' value before overflow calc
space avail | !I_PARMRK | I_PARMRK
--------------------------------------------------
0 | -1 | -1
1 | 0 | 0
2 | 1 | 0
3 | 2 | 0
4+ | 3 | 1When !icanon or when icanon and the read buffer contains newlines, normalized 'room' values of -1 and 0 are clamped to 0, and 'overflow' is 0, so read_head is not adjusted and the input i/o loop exits (setting no_room if called from flush_to_ldisc()). No input is discarded since the reader does have input available to read which ensures forward progress.
When icanon and the read buffer does not contain newlines and the normalized 'room' value is 0, then overflow and room are reset to 1, so that the i/o loop will process the next input char normally (except for parity errors which are ignored). Thus, erasures, signalling chars, 7-bit mode, etc. will continue to be handled properly.
If the input char processed was not a line termination char, then the canon_head index will not have advanced, so the normalized 'room' value will now be -1 and 'overflow' will be set, which indicates the read_head can safely be reset, effectively erasing the last char processed.
If the input char processed was a line termination, then the canon_head index will have advanced, so 'overflow' is cleared to 0, the read_head is not reset, and 'room' is cleared to 0, which exits the i/o loop (because the reader now have input available to read which ensures forward progress).
Note that it is possible for a line termination to be received, and for the reader to copy the line to the user buffer before the input i/o loop is ready to process the next input char. This is why the i/o loop recomputes the room/overflow state with every input char while handling overflow.
Finally, if the input data was processed without receiving a line termination (so that overflow is still set), the pty driver must receive a write wakeup. A pty writer may be waiting to write more data in n_tty_write() but without unthrottling here that wakeup will not arrive, and forward progress will halt. (Normally, the pty writer is woken when the reader reads data out of the buffer and more space become available).
--- drivers/tty/n_tty.c | 106 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 27 deletions(-)
drivers/tty/n_tty.c +79 -27
@@ -247,8 +247,6 @@ static void n_tty_write_wakeup(struct ttstatic void n_tty_check_throttle (struct tty_struct *tty) { -if (tty->driver->type ==TTY_DRIVER_TYPE_PTY ) -return ;/* * Check the remaining room for the input canonicalization * mode. We don't want to throttle the driver if we're in
@@ -1512,23 +1510,6 @@ n_tty_receive_char_lnext(struct tty_strun_tty_receive_char_flagged (tty, c, flag); } -/** -* n_tty_receive_buf - data receive -* @tty: terminal device -* @cp: buffer -* @fp: flag buffer -* @count: characters -* -* Called by the terminal driver when a block of characters has -* been received. This function must be called from soft contexts -* not from interrupt context. The driver is responsible for making -* calls one at a time and in order (or using flush_to_ldisc) -* -* n_tty_receive_buf()/producer path: -* claims non-exclusive termios_rwsem -* publishes read_head and canon_head -*/ -static void n_tty_receive_buf_real_raw (struct tty_struct *tty,const unsigned char *cp,char *fp,int count)
@@ -1684,24 +1665,85 @@ static void __receive_buf(struct tty_str } } +/** +* n_tty_receive_buf_common - process input +* @tty: device to receive input +* @cp: input chars +* @fp: flags for each char (if NULL, all chars are TTY_NORMAL) +* @count: number of input chars in @cp +* +* Called by the terminal driver when a block of characters has +* been received. This function must be called from soft contexts +* not from interrupt context. The driver is responsible for making +* calls one at a time and in order (or using flush_to_ldisc) +* +* Returns the # of input chars from @cp which were processed. +* +* In canonical mode, the maximum line length is 4096 chars (including +* the line termination char); lines longer than 4096 chars are +* truncated. After 4095 chars, input data is still processed but +* not stored. Overflow processing ensures the tty can always +* receive more input until at least one line can be read. +* +* In non-canonical mode, the read buffer will only accept 4095 chars; +* this provides the necessary space for a newline char if the input +* mode is switched to canonical. +* +* Note it is possible for the read buffer to _contain_ 4096 chars +* in non-canonical mode: the read buffer could already contain the +* maximum canon line of 4096 chars when the mode is switched to +* non-canonical. +* +* n_tty_receive_buf()/producer path: +* claims non-exclusive termios_rwsem +* publishes commit_head or canon_head +*/ static int n_tty_receive_buf_common (struct tty_struct *tty,const unsigned char *cp,char *fp,int count,int flow) {struct n_tty_data *ldata = tty->disc_data; -int room, n, rcvd =0 ; +int room, n, rcvd =0 , overflow;down_read (&tty->termios_rwsem);while (1 ) { - room =receive_room (tty); +/* +* When PARMRK is set, each input char may take up to 3 chars +* in the read buf; reduce the buffer space avail by 3x +* +* If we are doing input canonicalization, and there are no +* pending newlines, let characters through without limit, so +* that erase characters will be handled. Other excess +* characters will be beeped. +* +* paired with store in *_copy_from_read_buf() -- guarantees +* the consumer has loaded the data in read_buf up to the new +* read_tail (so this producer will not overwrite unread data) +*/ +size_t tail = ldata->read_tail; + + room =N_TTY_BUF_SIZE - (ldata->read_head - tail); +if (I_PARMRK (tty)) + room = (room +2 ) /3 ; + room--; +if (room <=0 ) { + overflow = ldata->icanon && ldata->canon_head == tail; +if (overflow && room <0 ) + ldata->read_head--; + room = overflow; + ldata->no_room = flow && !room; + }else + overflow =0 ; + n =min (count, room); -if (!n) { -if (flow && !room) - ldata->no_room =1 ; +if (!n)break ; - } -__receive_buf (tty, cp, fp, n); + +/* ignore parity errors if handling overflow */ +if (!overflow || !fp || *fp !=TTY_PARITY ) +__receive_buf (tty, cp, fp, n); + cp += n;if (fp) fp += n;
@@ -1710,7 +1752,17 @@ n_tty_receive_buf_common(struct tty_stru } tty->receive_room = room; -n_tty_check_throttle (tty); + +/* Unthrottle if handling overflow on pty */ +if (tty->driver->type ==TTY_DRIVER_TYPE_PTY ) { +if (overflow) { +tty_set_flow_change (tty,TTY_UNTHROTTLE_SAFE ); +tty_unthrottle_safe (tty); +__tty_set_flow_change (tty,0 ); + } + }else +n_tty_check_throttle (tty); +up_read (&tty->termios_rwsem);return rcvd;
Greg Kroah-Hartman
maintainerPATCH 33/43 cifs: smb2_clone_range() - exit on unhandled error
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Prabhu <[email protected]>
commit 2477bc58d49edb1c0baf59df7dc093dce682af2b upstream.
While attempting to clone a file on a samba server, we receive a STATUS_INVALID_DEVICE_REQUEST. This is mapped to -EOPNOTSUPP which isn't handled in smb2_clone_range(). We end up looping in the while loop making same call to the samba server over and over again.
The proposed fix is to exit and return the error value when encountered with an unhandled error.
--- fs/cifs/smb2ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/smb2ops.c +2 -1
@@ -630,7 +630,8 @@ smb2_clone_range(const unsigned int xid,/* No need to change MaxChunks since already set to 1 */ chunk_sizes_updated = true; - } + }else + goto cchunk_out; } cchunk_out:
Greg Kroah-Hartman
maintainerPATCH 34/43 cifs: fix use-after-free bug in find_writable_file
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Disseldorp <[email protected]>
commit e1e9bda22d7ddf88515e8fe401887e313922823e upstream.
Under intermittent network outages, find_writable_file() is susceptible to the following race condition, which results in a user-after-free in the cifs_writepages code-path:
Thread 1 Thread 2
======== ========
inv_file = NULL
refind = 0spin_lock(&cifs_file_list_lock)
// invalidHandle found on openFileList
inv_file = open_file
// inv_file->count currently 1
cifsFileInfo_get(inv_file)
// inv_file->count = 2
spin_unlock(&cifs_file_list_lock);
cifs_reopen_file() cifs_close()
// fails (rc != 0) ->cifsFileInfo_put()
spin_lock(&cifs_file_list_lock)
// inv_file->count = 1
spin_unlock(&cifs_file_list_lock)spin_lock(&cifs_file_list_lock);
list_move_tail(&inv_file->flist,
&cifs_inode->openFileList);
spin_unlock(&cifs_file_list_lock);
cifsFileInfo_put(inv_file);
->spin_lock(&cifs_file_list_lock)
// inv_file->count = 0 list_del(&cifs_file->flist); // cleanup!! kfree(cifs_file); spin_unlock(&cifs_file_list_lock);
spin_lock(&cifs_file_list_lock);
++refind;
// refind = 1
goto refind_writable;
At this point we loop back through with an invalid inv_file pointer and a refind value of 1. On second pass, inv_file is not overwritten on openFileList traversal, and is subsequently dereferenced.
--- fs/cifs/file.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/file.c +1 -0
@@ -1821,6 +1821,7 @@ refind_writable:cifsFileInfo_put (inv_file);spin_lock (&cifs_file_list_lock); ++refind; + inv_file =NULL ; goto refind_writable; } }
Greg Kroah-Hartman
maintainerPATCH 35/43 be2iscsi: Fix kernel panic when device initialization fails
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Soni Jose <[email protected]>
commit 2e7cee027b26cbe7e6685a7a14bd2850bfe55d33 upstream.
Kernel panic was happening as iscsi_host_remove() was called on
a host which was not yet added.
--- drivers/scsi/be2iscsi/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -5684,9 +5684,9 @@ free_port: hba_free:if (phba->msix_enabled)pci_disable_msix (phba->pcidev); -iscsi_host_remove (phba->shost);pci_dev_put (phba->pcidev);iscsi_host_free (phba->shost); +pci_set_drvdata (pcidev,NULL ); disable_pci:pci_disable_device (pcidev);return ret;
Greg Kroah-Hartman
maintainerPATCH 36/43 ocfs2: _really_ sync the right range
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 64b4e2526d1cf6e6a4db6213d6e2b6e6ab59479a upstream.
"ocfs2 syncs the wrong range" had been broken; prior to it the code was doing the wrong thing in case of O_APPEND, all right, but _after_ it we were syncing the wrong range in 100% cases. *ppos, aka iocb->ki_pos is incremented prior to that point, so we are always doing sync on the area _after_ the one we'd written to.
Spotted by Joseph Qi <[email protected]> back in January; unfortunately, I'd missed his mail back then ;-/
--- fs/ocfs2/file.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
fs/ocfs2/file.c +10 -4
@@ -2391,10 +2391,14 @@ out_dio:/* buffered aio wouldn't have proper lock coverage today */ BUG_ON (ret == -EIOCBQUEUED && !(file->f_flags &O_DIRECT )); +if (unlikely (written <=0 )) + goto no_sync; +if (((file->f_flags &O_DSYNC ) && !direct_io) ||IS_SYNC (inode) || ((file->f_flags &O_DIRECT ) && !direct_io)) { - ret =filemap_fdatawrite_range (file->f_mapping, *ppos, - *ppos + count -1 ); + ret =filemap_fdatawrite_range (file->f_mapping, + iocb->ki_pos - written, + iocb->ki_pos -1 );if (ret <0 ) written = ret;
@@ -2407,10 +2411,12 @@ out_dio: }if (!ret) - ret =filemap_fdatawait_range (file->f_mapping, *ppos, - *ppos + count -1 ); + ret =filemap_fdatawait_range (file->f_mapping, + iocb->ki_pos - written, + iocb->ki_pos -1 ); } +no_sync:/* * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io * function pointer which is called when o_direct io completes so that
Greg Kroah-Hartman
maintainerPATCH 37/43 ioctx_alloc(): fix vma (and file) leak on failure
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit deeb8525f9bcea60f5e86521880c1161de7a5829 upstream.
If we fail past the aio_setup_ring(), we need to destroy the mapping. We don't need to care about anybody having found ctx, or added requests to it, since the last failure exit is exactly the failure to make ctx visible to lookups.
Reproducer (based on one by Joe Mario <[email protected]>):
void count(char *p)
{
char s[80];
printf("%s: ", p);
fflush(stdout);
sprintf(s, "/bin/cat /proc/%d/maps|/bin/fgrep -c '/[aio] (deleted)'", getpid());
system(s);
}int main()
{
io_context_t *ctx;
int created, limit, i, destroyed;
FILE *f;
count("before");
if ((f = fopen("/proc/sys/fs/aio-max-nr", "r")) == NULL)
perror("opening aio-max-nr");
else if (fscanf(f, "%d", &limit) != 1)
fprintf(stderr, "can't parse aio-max-nr\n");
else if ((ctx = calloc(limit, sizeof(io_context_t))) == NULL)
perror("allocating aio_context_t array");
else {
for (i = 0, created = 0; i < limit; i++) {
if (io_setup(1000, ctx + created) == 0)
created++;
}
for (i = 0, destroyed = 0; i < created; i++)
if (io_destroy(ctx[i]) == 0)
destroyed++;
printf("created %d, failed %d, destroyed %d\n",
created, limit - created, destroyed);
count("after");
}
}--- fs/aio.c | 3 +++ 1 file changed, 3 insertions(+)
fs/aio.c +3 -0
@@ -719,6 +719,9 @@ static struct kioctx *ioctx_alloc(unsign err_cleanup:aio_nr_sub (ctx->max_reqs); err_ctx: +atomic_set (&ctx->dead,1 ); +if (ctx->mmap_size) +vm_munmap (ctx->mmap_base, ctx->mmap_size);aio_free_ring (ctx); err:mutex_unlock (&ctx->ring_lock);
Greg Kroah-Hartman
maintainerPATCH 38/43 iscsi target: fix oops when adding reject pdu
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <[email protected]>
commit b815fc12d4dd2b5586184fb4f867caff05a810d4 upstream.
This fixes a oops due to a double list add when adding a reject PDU for iscsit_allocate_iovecs allocation failures. The cmd has already been added to the conn_cmd_list in iscsit_setup_scsi_cmd, so this has us call iscsit_reject_cmd.
Note that for ERL0 the reject PDU is not actually sent, so this patch is not completely tested. Just verified we do not oops. The problem is the add reject functions return -1 which is returned all the way up to iscsi_target_rx_thread which for ERL0 will drop the connection.
--- drivers/target/iscsi/iscsi_target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target.c +1 -1
@@ -1165,7 +1165,7 @@ iscsit_handle_scsi_cmd(struct iscsi_conn* traditional iSCSI block I/O. */ if (iscsit_allocate_iovecs (cmd) <0 ) { -return iscsit_add_reject_cmd (cmd, +return iscsit_reject_cmd (cmd,ISCSI_REASON_BOOKMARK_NO_RESOURCES , buf); } immed_data = cmd->immediate_data;
Greg Kroah-Hartman
maintainerPATCH 39/43 sh_veu: v4l2_dev wasnt set
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit ab3120300be067a2d41a027c41db0b2c662ab200 upstream.
The v4l2_dev field of struct video_device must be set correctly. This was never done for this driver, so no video nodes were created anymore.
--- drivers/media/platform/sh_veu.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/sh_veu.c +1 -0
@@ -1183,6 +1183,7 @@ static int sh_veu_probe(struct platform_ } *vdev = sh_veu_videodev; + vdev->v4l2_dev = &veu->v4l2_dev;spin_lock_init (&veu->lock);mutex_init (&veu->fop_lock); vdev->lock = &veu->fop_lock;
Greg Kroah-Hartman
maintainerPATCH 40/43 media: s5p-mfc: fix mmap support for 64bit arch
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 05b676ab42f624425d5f6519276e506b812fa058 upstream.
TASK_SIZE is depends on the systems architecture (32 or 64 bits) and it should not be used for defining offset boundary for mmaping buffers for CAPTURE and OUTPUT queues. This patch fixes support for MMAP calls on the CAPTURE queue on 64bit architectures (like ARM64).
--- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/s5p-mfc/s5p_mfc_common.h +1 -1
@@ -30,7 +30,7 @@/* Offset base used to differentiate between CAPTURE and OUTPUT * while mmaping */ -#define DST_QUEUE_OFF_BASE (TASK_SIZE / 2) +#define DST_QUEUE_OFF_BASE (1 << 30)#define MFC_BANK1_ALLOC_CTX 0#define MFC_BANK2_ALLOC_CTX 1
Greg Kroah-Hartman
maintainerPATCH 41/43 net: rds: use correct size for max unacked packets and bytes
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit db27ebb111e9f69efece08e4cb6a34ff980f8896 upstream.
Max unacked packets/bytes is an int while sizeof(long) was used in the sysctl table.
This means that when they were getting read we'd also leak kernel memory to userspace along with the timeout values.
--- net/rds/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/rds/sysctl.c +2 -2
@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_t { .procname = "max_unacked_packets", .data = &rds_sysctl_max_unacked_packets, - .maxlen = sizeof(unsigned long), + .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "max_unacked_bytes", .data = &rds_sysctl_max_unacked_bytes, - .maxlen = sizeof(unsigned long), + .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, },
Greg Kroah-Hartman
maintainerPATCH 42/43 net: llc: use correct size for sysctl timeout entries
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit 6b8d9117ccb4f81b1244aafa7bc70ef8fa45fc49 upstream.
The timeout entries are sizeof(int) rather than sizeof(long), which means that when they were getting read we'd also leak kernel memory to userspace along with the timeout values.
--- net/llc/sysctl_net_llc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/llc/sysctl_net_llc.c +4 -4
@@ -18,28 +18,28 @@ static struct ctl_table llc2_timeout_tab { .procname = "ack", .data = &sysctl_llc2_ack_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_ack_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, { .procname = "busy", .data = &sysctl_llc2_busy_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_busy_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, { .procname = "p", .data = &sysctl_llc2_p_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_p_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, { .procname = "rej", .data = &sysctl_llc2_rej_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_rej_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, },
Greg Kroah-Hartman
maintainerPATCH 43/43 IB/mlx4: Saturate RoCE port PMA counters in case of overflow
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Majd Dibbiny <[email protected]>
commit 61a3855bb726cbb062ef02a31a832dea455456e0 upstream.
For RoCE ports, we set the u32 PMA values based on u64 HCA counters. In case of overflow, according to the IB spec, we have to saturate a counter to its max value, do that.
--- drivers/infiniband/hw/mlx4/mad.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx4/mad.c +16 -4
@@ -64,6 +64,14 @@ enum {#define GUID_TBL_BLK_NUM_ENTRIES 8#define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) +/* Counters should be saturate once they reach their maximum value */ +#define ASSIGN_32BIT_COUNTER (counter, value) do {\ + if ((value) > U32_MAX) \ + counter = cpu_to_be32(U32_MAX); \ + else \ + counter = cpu_to_be32(value); \ +} while (0) +struct mlx4_mad_rcv_buf {struct ib_grh grh;u8 payload[256 ];
@@ -730,10 +738,14 @@ static int ib_process_mad(struct ib_devistatic void edit_counter (struct mlx4_counter *cnt,struct ib_pma_portcounters *pma_cnt) { - pma_cnt->port_xmit_data =cpu_to_be32 ((be64_to_cpu (cnt->tx_bytes)>>2 )); - pma_cnt->port_rcv_data =cpu_to_be32 ((be64_to_cpu (cnt->rx_bytes)>>2 )); - pma_cnt->port_xmit_packets =cpu_to_be32 (be64_to_cpu (cnt->tx_frames)); - pma_cnt->port_rcv_packets =cpu_to_be32 (be64_to_cpu (cnt->rx_frames)); +ASSIGN_32BIT_COUNTER (pma_cnt->port_xmit_data, + (be64_to_cpu (cnt->tx_bytes) >>2 )); +ASSIGN_32BIT_COUNTER (pma_cnt->port_rcv_data, + (be64_to_cpu (cnt->rx_bytes) >>2 )); +ASSIGN_32BIT_COUNTER (pma_cnt->port_xmit_packets, +be64_to_cpu (cnt->tx_frames)); +ASSIGN_32BIT_COUNTER (pma_cnt->port_rcv_packets, +be64_to_cpu (cnt->rx_frames)); } static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.39 release. There are 43 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Apr 19 13:25:21 UTC 2015. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.39-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Complied and booted on my test system. No dmesg regressions.
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.39 release. There are 43 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Apr 19 13:25:21 UTC 2015. Anything received after that time might be too late.
Build results:
total: 125 pass: 123 fail: 2
Failed builds:
arm:allmodconfig
arm64:allmodconfig
Qemu test results:
total: 30 pass: 30 fail: 0
Build results are as expected. arm:allmodconfig and arm64:allmodconfig are new additions to the list of build tests; the failures are not new.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter