All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Richard Fitzgerald <rf@opensource.cirrus.com>,
	Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 4.14 011/110] ALSA: control: Fix memory corruption risk in snd_ctl_elem_read
Date: Wed,  7 Mar 2018 11:37:54 -0800	[thread overview]
Message-ID: <20180307191041.187154835@linuxfoundation.org> (raw)
In-Reply-To: <20180307191039.748351103@linuxfoundation.org>

4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Fitzgerald <rf@opensource.cirrus.com>

commit 5a23699a39abc5328921a81b89383d088f6ba9cc upstream.

The patch "ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE
operations" introduced a potential for kernel memory corruption due
to an incorrect if statement allowing non-readable controls to fall
through and call the get function. For TLV controls a driver can omit
SNDRV_CTL_ELEM_ACCESS_READ to ensure that only the TLV get function
can be called. Instead the normal get() can be invoked unexpectedly
and as the driver expects that this will only be called for controls
<= 512 bytes, potentially try to copy >512 bytes into the 512 byte
return array, so corrupting kernel memory.

The problem is an attempt to refactor the snd_ctl_elem_read function
to invert the logic so that it conditionally aborted if the control
is unreadable instead of conditionally executing. But the if statement
wasn't inverted correctly.

The correct inversion of

    if (a && !b)

is
    if (!a || b)

Fixes: becf9e5d553c2 ("ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/core/control.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -888,7 +888,7 @@ static int snd_ctl_elem_read(struct snd_
 
 	index_offset = snd_ctl_get_ioff(kctl, &control->id);
 	vd = &kctl->vd[index_offset];
-	if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_READ) && kctl->get == NULL)
+	if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_READ) || kctl->get == NULL)
 		return -EPERM;
 
 	snd_ctl_build_ioff(&control->id, kctl, index_offset);

  parent reply	other threads:[~2018-03-07 19:46 UTC|newest]

Thread overview: 131+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 19:37 [PATCH 4.14 000/110] 4.14.25-stable review Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 001/110] Bluetooth: btusb: Use DMI matching for QCA reset_resume quirking Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 002/110] ixgbe: fix crash in build_skb Rx code path Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 003/110] tpm: st33zp24: fix potential buffer overruns caused by bit glitches on the bus Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 004/110] tpm: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 005/110] tpm_i2c_infineon: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 006/110] tpm_i2c_nuvoton: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 007/110] tpm_tis: " Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 008/110] tpm: constify transmit data pointers Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 009/110] tpm_tis_spi: Use DMA-safe memory for SPI transfers Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 010/110] ALSA: usb-audio: Add a quirck for B&W PX headphones Greg Kroah-Hartman
2018-03-07 19:37 ` Greg Kroah-Hartman [this message]
2018-03-07 19:37 ` [PATCH 4.14 012/110] ALSA: x86: Fix missing spinlock and mutex initializations Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 013/110] ALSA: hda: Add a power_save blacklist Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 014/110] ALSA: hda - Fix pincfg at resume on Lenovo T470 dock Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 015/110] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers Greg Kroah-Hartman
2018-03-07 19:37 ` [PATCH 4.14 016/110] mmc: dw_mmc-k3: Fix out-of-bounds access through DT alias Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 017/110] mmc: dw_mmc: Avoid accessing registers in runtime suspended state Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 018/110] mmc: dw_mmc: Factor out dw_mci_init_slot_caps Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 019/110] mmc: dw_mmc: Fix out-of-bounds access for slots caps Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 020/110] timers: Forward timer base before migrating timers Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 021/110] parisc: Use cr16 interval timers unconditionally on qemu Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 022/110] parisc: Reduce irq overhead when run in qemu Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 023/110] parisc: Fix ordering of cache and TLB flushes Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 024/110] btrfs: use proper endianness accessors for super_copy Greg Kroah-Hartman
2018-03-15 18:55   ` Christoph Biedl
2018-03-16 12:30     ` Greg Kroah-Hartman
2018-03-16 13:22       ` David Sterba
2018-03-16 14:02         ` Greg Kroah-Hartman
2018-03-16 16:21           ` Anand Jain
2018-03-17 17:27       ` Christoph Biedl
2018-03-19 19:32         ` David Sterba
2018-03-20  9:32           ` Anand Jain
2018-03-16 16:21     ` Anand Jain
2018-03-07 19:38 ` [PATCH 4.14 025/110] block: fix the count of PGPGOUT for WRITE_SAME Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 026/110] block: kyber: fix domain token leak during requeue Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 027/110] vfio: disable filesystem-dax page pinning Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 028/110] cpufreq: s3c24xx: Fix broken s3c_cpufreq_init() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 029/110] dax: fix vma_is_fsdax() helper Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 030/110] direct-io: Fix sleep in atomic due to sync AIO Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 031/110] x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend Greg Kroah-Hartman
2018-03-07 19:38   ` Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 032/110] x86/platform/intel-mid: Handle Intel Edison reboot correctly Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 033/110] x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 034/110] bridge: check brport attr show in brport_show Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 035/110] fib_semantics: Dont match route with mismatching tclassid Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 036/110] hdlc_ppp: carrier detect ok, dont turn off negotiation Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 037/110] ipv6 sit: work around bogus gcc-8 -Wrestrict warning Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 038/110] net: amd-xgbe: fix comparison to bitshift when dealing with a mask Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 039/110] net: ethernet: ti: cpsw: fix net watchdog timeout Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 040/110] net: fix race on decreasing number of TX queues Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 041/110] net: ipv4: dont allow setting net.ipv4.route.min_pmtu below 68 Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 042/110] netlink: ensure to loop over all netns in genlmsg_multicast_allns() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 043/110] net: sched: report if filter is too large to dump Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 044/110] ppp: prevent unregistered channels from connecting to PPP units Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 045/110] sctp: verify size of a new chunk in _sctp_make_chunk() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 046/110] udplite: fix partial checksum initialization Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 047/110] net/mlx5e: Fix TCP checksum in LRO buffers Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 048/110] sctp: fix dst refcnt leak in sctp_v4_get_dst Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 049/110] mlxsw: spectrum_switchdev: Check success of FDB add operation Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 050/110] net/mlx5e: Specify numa node when allocating drop rq Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 051/110] net: phy: fix phy_start to consider PHY_IGNORE_INTERRUPT Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 052/110] tcp: Honor the eor bit in tcp_mtu_probe Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 053/110] rxrpc: Fix send in rxrpc_send_data_packet() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 054/110] tcp_bbr: better deal with suboptimal GSO Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 055/110] doc: Change the min default value of tcp_wmem/tcp_rmem Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 056/110] net/mlx5e: Fix loopback self test when GRO is off Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 057/110] net_sched: gen_estimator: fix broken estimators based on percpu stats Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 058/110] net/sched: cls_u32: fix cls_u32 on filter replace Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 059/110] sctp: do not pr_err for the duplicated node in transport rhlist Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 060/110] tcp: revert F-RTO middle-box workaround Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 061/110] tcp: revert F-RTO extension to detect more spurious timeouts Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 062/110] mlxsw: spectrum_router: Fix error path in mlxsw_sp_vr_create Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 063/110] net: ipv4: Set addr_type in hash_keys for forwarded case Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 064/110] sctp: fix dst refcnt leak in sctp_v6_get_dst() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 065/110] bridge: Fix VLAN reference count problem Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 066/110] net/mlx5e: Verify inline header size do not exceed SKB linear size Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 067/110] amd-xgbe: Restore PCI interrupt enablement setting on resume Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 068/110] cls_u32: fix use after free in u32_destroy_key() Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 069/110] mlxsw: spectrum_router: Do not unconditionally clear route offload indication Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 070/110] netlink: put module reference if dump start fails Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 071/110] tcp: purge write queue upon RST Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 072/110] tuntap: correctly add the missing XDP flush Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 073/110] tuntap: disable preemption during XDP processing Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 074/110] virtio-net: disable NAPI only when enabled during XDP set Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 075/110] s390/qeth: fix underestimated count of buffer elements Greg Kroah-Hartman
2018-03-07 19:38 ` [PATCH 4.14 076/110] s390/qeth: fix SETIP command handling Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 077/110] s390/qeth: fix overestimated count of buffer elements Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 078/110] s390/qeth: fix IP removal on offline cards Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 079/110] s390/qeth: fix double-free on IP add/remove race Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 080/110] Revert "s390/qeth: fix using of ref counter for rxip addresses" Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 081/110] s390/qeth: fix IP address lookup for L3 devices Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 082/110] s390/qeth: fix IPA command submission race Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 083/110] blk-mq: dont call io scheds .requeue_request when requeueing rq to ->dispatch Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 084/110] media: m88ds3103: dont call a non-initalized function Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 085/110] EDAC, sb_edac: Fix out of bound writes during DIMM configuration on KNL Greg Kroah-Hartman
2018-03-07 19:39   ` [4.14,085/110] " Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 086/110] KVM: s390: take care of clock-comparator sign control Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 087/110] KVM: s390: provide only a single function for setting the tod (fix SCK) Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 088/110] KVM: s390: consider epoch index on hotplugged CPUs Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 089/110] KVM: s390: consider epoch index on TOD clock syncs Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 090/110] nospec: Allow index argument to have const-qualified type Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 091/110] x86/mm: Fix {pmd,pud}_{set,clear}_flags() Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 092/110] ARM: orion: fix orion_ge00_switch_board_info initialization Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 093/110] ARM: dts: rockchip: Remove 1.8 GHz operation point from phycore som Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 094/110] ARM: mvebu: Fix broken PL310_ERRATA_753970 selects Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 095/110] ARM: kvm: fix building with gcc-8 Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 096/110] KVM: x86: extend usage of RET_MMIO_PF_* constants Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 097/110] KVM: X86: Fix SMRAM accessing even if VM is shutdown Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 098/110] KVM: mmu: Fix overlap between public and private memslots Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 099/110] KVM/x86: Remove indirect MSR op calls from SPEC_CTRL Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 100/110] KVM: x86: move LAPIC initialization after VMCS creation Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 101/110] KVM/VMX: Optimize vmx_vcpu_run() and svm_vcpu_run() by marking the RDMSR path as unlikely() Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 102/110] KVM: x86: fix vcpu initialization with userspace lapic Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 103/110] PCI/ASPM: Deal with missing root ports in link state handling Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 104/110] KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs() Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 105/110] KVM/x86: remove WARN_ON() for when vm_munmap() fails Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 106/110] ACPI / bus: Parse tables as term_list for Dell XPS 9570 and Precision M5530 Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 107/110] ARM: dts: LogicPD SOM-LV: Fix I2C1 pinmux Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 108/110] ARM: dts: LogicPD Torpedo: " Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 109/110] md: only allow remove_and_add_spares when no sync_thread running Greg Kroah-Hartman
2018-03-07 19:39 ` [PATCH 4.14 110/110] nvme-rdma: dont suppress send completions Greg Kroah-Hartman
2018-03-07 23:57 ` [PATCH 4.14 000/110] 4.14.25-stable review Shuah Khan
2018-03-08  4:19 ` kernelci.org bot
2018-03-09  0:05   ` Kevin Hilman
2018-03-09  1:09     ` Greg Kroah-Hartman
2018-03-09  8:02     ` Quentin Schulz
2018-03-09 17:49       ` Kevin Hilman
2018-03-08  8:36 ` Naresh Kamboju
2018-03-08 12:00   ` Naresh Kamboju
2018-03-08 14:22 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180307191041.187154835@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rf@opensource.cirrus.com \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.