From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Dean Nelson <dnelson@redhat.com>,
Will Deacon <will.deacon@arm.com>,
Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.19.y-ckt 90/92] arm64: add missing PAGE_ALIGN() to __dma_free()
Date: Tue, 26 May 2015 08:41:34 -0700 [thread overview]
Message-ID: <1432654896-28478-91-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1432654896-28478-1-git-send-email-kamal@canonical.com>
3.19.8-ckt1 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dean Nelson <dnelson@redhat.com>
commit 2cff98b99c469880ce830cbcde015b53b67e0a7b upstream.
__dma_alloc() does a PAGE_ALIGN() on the passed in size argument before
doing anything else. __dma_free() does not. And because it doesn't, it is
possible to leak memory should size not be an integer multiple of PAGE_SIZE.
The solution is to add a PAGE_ALIGN() to __dma_free() like is done in
__dma_alloc().
Additionally, this patch removes a redundant PAGE_ALIGN() from
__dma_alloc_coherent(), since __dma_alloc_coherent() can only be called
from __dma_alloc(), which already does a PAGE_ALIGN() before the call.
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Dean Nelson <dnelson@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
[ Dean Nelson: backport to 3.19-stable ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
arch/arm64/mm/dma-mapping.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 6efbb52..7980c2a 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -133,7 +133,7 @@ static void __dma_free_coherent(struct device *dev, size_t size,
freed = dma_release_from_contiguous(dev,
phys_to_page(paddr),
- size >> PAGE_SHIFT);
+ PAGE_ALIGN(size) >> PAGE_SHIFT);
if (!freed)
swiotlb_free_coherent(dev, size, vaddr, dma_handle);
}
@@ -189,6 +189,8 @@ static void __dma_free_noncoherent(struct device *dev, size_t size,
{
void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle));
+ size = PAGE_ALIGN(size);
+
if (__free_from_pool(vaddr, size))
return;
vunmap(vaddr);
--
1.9.1
next prev parent reply other threads:[~2015-05-26 15:43 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 15:40 [3.19.y-ckt stable] Linux 3.19.8-ckt1 stable review Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 01/92] ext4: allocate entire range in zero range Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 02/92] x86/microcode/intel: Guard against stack overflow in the loader Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 03/92] ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe() Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 04/92] ASoC: samsung: s3c24xx-i2s: Fix return value check in s3c24xx_iis_dev_probe() Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 05/92] ASoC: dapm: Enable autodisable on SOC_DAPM_SINGLE_TLV_AUTODISABLE Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 06/92] ASoC: rt5677: add register patch for PLL Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 07/92] btrfs: unlock i_mutex after attempting to delete subvolume during send Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 08/92] ALSA: hda - Fix mute-LED fixed mode Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 09/92] ALSA: hda - Add mute-LED mode control to Thinkpad Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 10/92] arm64: dma-mapping: always clear allocated buffers Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 11/92] ALSA: emu10k1: Fix card shortname string buffer overflow Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 12/92] ALSA: emux: Fix mutex deadlock at unloading Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 13/92] drm/radeon: Use drm_calloc_ab for CS relocs Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 14/92] drm/radeon: adjust pll when audio is not enabled Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 15/92] drm/radeon: add SI DPM quirk for Sapphire R9 270 Dual-X 2G GDDR5 Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 16/92] drm/radeon: fix lockup when BOs aren't part of the VM on release Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 17/92] drm/radeon: reset BOs address after clearing it Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 18/92] drm/radeon: check new address before removing old one Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 19/92] SCSI: add 1024 max sectors black list flag Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 20/92] 3w-sas: fix command completion race Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 21/92] 3w-xxxx: " Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 22/92] 3w-9xxx: " Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 23/92] uas: Allow uas_use_uas_driver to return usb-storage flags Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 24/92] uas: Add US_FL_MAX_SECTORS_240 flag Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 25/92] uas: Set max_sectors_240 quirk for ASM1053 devices Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 26/92] usb: chipidea: otg: remove mutex unlock and lock while stop and start role Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 27/92] cdc-acm: prevent infinite loop when parsing CDC headers Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 28/92] serial: xilinx: Use platform_get_irq to get irq description structure Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 29/92] serial: of-serial: Remove device_type = "serial" registration Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 30/92] tty/serial: at91: maxburst was missing for dma transfers Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 31/92] ALSA: emux: Fix mutex deadlock in OSS emulation Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 32/92] ACPI / SBS: Enable battery manager when present Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 33/92] ALSA: emu10k1: Emu10k2 32 bit DMA mode Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 34/92] ASoC: rt5677: fixed wrong DMIC ref clock Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 35/92] rbd: end I/O the entire obj_request on error Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 36/92] ext4: fix data corruption caused by unwritten and delayed extents Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 37/92] ext4: move check under lock scope to close a race Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 38/92] powerpc/pseries: Correct cpu affinity for dlpar added cpus Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 39/92] powerpc/powernv: Restore non-volatile CRs after nap Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 40/92] efivarfs: Ensure VariableName is NUL-terminated Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 41/92] x86/efi: Store upper bits of command line buffer address in ext_cmd_line_ptr Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 42/92] blk-mq: fix race between timeout and CPU hotplug Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 43/92] blk-mq: fix CPU hotplug handling Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 44/92] writeback: use |1 instead of +1 to protect against div by zero Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 45/92] ARM: mvebu: armada-xp-openblocks-ax3-4: Disable internal RTC Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 46/92] ARM: dts: imx23-olinuxino: Fix polarity of LED GPIO Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 47/92] ARM: dts: imx23-olinuxino: Fix dr_mode of usb0 Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 48/92] ARM: dts: imx6: phyFLEX: USB VBUS control is active-high Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 49/92] ARM: dts: imx25: Add #pwm-cells to pwm4 Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 50/92] ARM: dts: imx28: Fix AUART4 TX-DMA interrupt name Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 51/92] [media] marvell-ccic: fix Y'CbCr ordering Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 52/92] gpio: sysfs: fix memory leaks and device hotplug Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 53/92] ACPI / SBS: Add 5 us delay to fix SBS hangs on MacBook Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 54/92] ACPI / PNP: add two IDs to list for PNPACPI device enumeration Kamal Mostafa
2015-05-26 15:40 ` [PATCH 3.19.y-ckt 55/92] ARM: OMAP2+: Fix omap off idle power consumption creeping up Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 56/92] ARM: dts: OMAP3-N900: Add microphone bias voltages Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 57/92] drm/radeon: disable semaphores for UVD V1 (v2) Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 58/92] x86/spinlocks: Fix regression in spinlock contention detection Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 59/92] RDMA/CMA: Canonize IPv4 on IPV6 sockets properly Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 60/92] drm/i915: Assume dual channel LVDS if pixel clock necessitates it Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 61/92] drm/i915: Add missing MacBook Pro models with dual channel LVDS Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 62/92] efi: Fix error handling in add_sysfs_runtime_map_entry() Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 63/92] Revert "dm crypt: fix deadlock when async crypto algorithm returns -EBUSY" Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 64/92] xen/events: Clear cpu_evtchn_mask before resuming Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 65/92] xen/xenbus: Update xenbus event channel on resume Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 66/92] xen/console: Update console " Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 67/92] xen/events: Set irq_info->evtchn before binding the channel to CPU in __startup_pirq() Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 68/92] mm/memory-failure: call shake_page() when error hits thp tail page Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 69/92] mm: soft-offline: fix num_poisoned_pages counting on concurrent events Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 70/92] nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 71/92] ocfs2: dlm: fix race between purge and get lock resource Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 72/92] drm/i915/dp: there is no audio on port A Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 73/92] drm/amdkfd: allow unregister process with queues Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 74/92] drm/radeon: fix userptr BO unpin bug v3 Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 75/92] drm/radeon: make VCE handle check more strict Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 76/92] drm/radeon: make UVD handle checking " Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 77/92] drm/radeon: more strictly validate the UVD codec Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 78/92] path_openat(): fix double fput() Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 79/92] mnt: Fix fs_fully_visible to verify the root directory is visible Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 80/92] drm: Zero out invalid vblank timestamp in drm_update_vblank_count Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 81/92] ARM: ux500: Move GPIO regulator for SD-card into board DTSs Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 82/92] ARM: ux500: Enable GPIO regulator for SD-card for HREF boards Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 83/92] ARM: ux500: Enable GPIO regulator for SD-card for snowball Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 84/92] xen-pciback: Add name prefix to global 'permissive' variable Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 85/92] mmc: core: add missing pm event in mmc_pm_notify to fix hib restore Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 86/92] ARM: dts: am57xx-beagle-x15: Fix IRQ type for mcp7941x Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 87/92] mmc: sh_mmcif: Fix timeout value for command request Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 88/92] mmc: card: Don't access RPMB partitions for normal read/write Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 89/92] pinctrl: Don't just pretend to protect pinctrl_maps, do it for real Kamal Mostafa
2015-05-26 15:41 ` Kamal Mostafa [this message]
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 91/92] vhost/scsi: potential memory corruption Kamal Mostafa
2015-05-26 15:41 ` [PATCH 3.19.y-ckt 92/92] md/raid0: fix restore to sector variable in raid0_make_request Kamal Mostafa
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=1432654896-28478-91-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=dnelson@redhat.com \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=will.deacon@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®