Skip to content

Commit c4b3847

Browse files
Alex Eldergregkh
Alex Elder
authored andcommitted
net: ipa: don't assume SMEM is page-aligned
[ Upstream commit b8d4380 ] In ipa_smem_init(), a Qualcomm SMEM region is allocated (if needed) and then its virtual address is fetched using qcom_smem_get(). The physical address associated with that region is also fetched. The physical address is adjusted so that it is page-aligned, and an attempt is made to update the size of the region to compensate for any non-zero adjustment. But that adjustment isn't done properly. The physical address is aligned twice, and as a result the size is never actually adjusted. Fix this by *not* aligning the "addr" local variable, and instead making the "phys" local variable be the adjusted "addr" value. Fixes: a0036bb ("net: ipa: define SMEM memory region for IPA") Signed-off-by: Alex Elder <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f7de12f commit c4b3847

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ipa/ipa_mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ static int ipa_smem_init(struct ipa *ipa, u32 item, size_t size)
570570
}
571571

572572
/* Align the address down and the size up to a page boundary */
573-
addr = qcom_smem_virt_to_phys(virt) & PAGE_MASK;
573+
addr = qcom_smem_virt_to_phys(virt);
574574
phys = addr & PAGE_MASK;
575575
size = PAGE_ALIGN(size + addr - phys);
576576
iova = phys; /* We just want a direct mapping */

0 commit comments

Comments
 (0)