Skip to content

Commit 1327d7d

Browse files
authored
Merge pull request torvalds#114 from bgilbert/v4.13.16-coreos
Fix CVE-2017-1000405 and mptsas hotplug in 4.13
2 parents cb161c5 + f75d356 commit 1327d7d

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

drivers/message/fusion/mptsas.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4352,11 +4352,10 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
43524352
return;
43534353

43544354
phy_info = mptsas_refreshing_device_handles(ioc, &sas_device);
4355-
/* Only For SATA Device ADD */
4356-
if (!phy_info && (sas_device.device_info &
4357-
MPI_SAS_DEVICE_INFO_SATA_DEVICE)) {
4355+
/* Device hot plug */
4356+
if (!phy_info) {
43584357
devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4359-
"%s %d SATA HOT PLUG: "
4358+
"%s %d HOT PLUG: "
43604359
"parent handle of device %x\n", ioc->name,
43614360
__func__, __LINE__, sas_device.handle_parent));
43624361
port_info = mptsas_find_portinfo_by_handle(ioc,

mm/huge_memory.c

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -842,20 +842,15 @@ EXPORT_SYMBOL_GPL(vmf_insert_pfn_pud);
842842
#endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
843843

844844
static void touch_pmd(struct vm_area_struct *vma, unsigned long addr,
845-
pmd_t *pmd)
845+
pmd_t *pmd, int flags)
846846
{
847847
pmd_t _pmd;
848848

849-
/*
850-
* We should set the dirty bit only for FOLL_WRITE but for now
851-
* the dirty bit in the pmd is meaningless. And if the dirty
852-
* bit will become meaningful and we'll only set it with
853-
* FOLL_WRITE, an atomic set_bit will be required on the pmd to
854-
* set the young bit, instead of the current set_pmd_at.
855-
*/
856-
_pmd = pmd_mkyoung(pmd_mkdirty(*pmd));
849+
_pmd = pmd_mkyoung(*pmd);
850+
if (flags & FOLL_WRITE)
851+
_pmd = pmd_mkdirty(_pmd);
857852
if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK,
858-
pmd, _pmd, 1))
853+
pmd, _pmd, flags & FOLL_WRITE))
859854
update_mmu_cache_pmd(vma, addr, pmd);
860855
}
861856

@@ -884,7 +879,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
884879
return NULL;
885880

886881
if (flags & FOLL_TOUCH)
887-
touch_pmd(vma, addr, pmd);
882+
touch_pmd(vma, addr, pmd, flags);
888883

889884
/*
890885
* device mapped pages can only be returned if the
@@ -973,20 +968,15 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
973968

974969
#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
975970
static void touch_pud(struct vm_area_struct *vma, unsigned long addr,
976-
pud_t *pud)
971+
pud_t *pud, int flags)
977972
{
978973
pud_t _pud;
979974

980-
/*
981-
* We should set the dirty bit only for FOLL_WRITE but for now
982-
* the dirty bit in the pud is meaningless. And if the dirty
983-
* bit will become meaningful and we'll only set it with
984-
* FOLL_WRITE, an atomic set_bit will be required on the pud to
985-
* set the young bit, instead of the current set_pud_at.
986-
*/
987-
_pud = pud_mkyoung(pud_mkdirty(*pud));
975+
_pud = pud_mkyoung(*pud);
976+
if (flags & FOLL_WRITE)
977+
_pud = pud_mkdirty(_pud);
988978
if (pudp_set_access_flags(vma, addr & HPAGE_PUD_MASK,
989-
pud, _pud, 1))
979+
pud, _pud, flags & FOLL_WRITE))
990980
update_mmu_cache_pud(vma, addr, pud);
991981
}
992982

@@ -1009,7 +999,7 @@ struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
1009999
return NULL;
10101000

10111001
if (flags & FOLL_TOUCH)
1012-
touch_pud(vma, addr, pud);
1002+
touch_pud(vma, addr, pud, flags);
10131003

10141004
/*
10151005
* device mapped pages can only be returned if the
@@ -1371,7 +1361,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
13711361
page = pmd_page(*pmd);
13721362
VM_BUG_ON_PAGE(!PageHead(page) && !is_zone_device_page(page), page);
13731363
if (flags & FOLL_TOUCH)
1374-
touch_pmd(vma, addr, pmd);
1364+
touch_pmd(vma, addr, pmd, flags);
13751365
if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {
13761366
/*
13771367
* We don't mlock() pte-mapped THPs. This way we can avoid

0 commit comments

Comments
 (0)