The patch titled
Subject: mm/cma: fix alloc_contig_range ret code/potential leak
has been added to the -mm tree. Its filename is
mm-cma-fix-alloc_contig_range-ret-code-potential-leak.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-cma-fix-alloc_contig_range-ret-…
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-cma-fix-alloc_contig_range-ret-…
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Mike Kravetz <mike.kravetz(a)oracle.com>
Subject: mm/cma: fix alloc_contig_range ret code/potential leak
If the call __alloc_contig_migrate_range() in alloc_contig_range returns
-EBUSY, processing continues so that test_pages_isolated() is called where
there is a tracepoint to identify the busy pages. However, it is possible
for busy pages to become available between the calls to these two
routines. In this case, the range of pages may be allocated.
Unfortunately, the original return code (ret == -EBUSY) is still set and
returned to the caller. Therefore, the caller believes the pages were not
allocated and they are leaked.
Update the return code with the value from test_pages_isolated().
Link: http://lkml.kernel.org/r/20171120193930.23428-2-mike.kravetz@oracle.com
Fixes: 8ef5849fa8a2 ("mm/cma: always check which page caused allocation failure")
Signed-off-by: Mike Kravetz <mike.kravetz(a)oracle.com>
Cc: Joonsoo Kim <iamjoonsoo.kim(a)lge.com>
Cc: Laura Abbott <labbott(a)redhat.com>
Cc: Vlastimil Babka <vbabka(a)suse.cz>
Cc: Michal Nazarewicz <mina86(a)mina86.com>
Cc: Michal Hocko <mhocko(a)suse.com>
Cc: Mel Gorman <mgorman(a)techsingularity.net>
Cc: Johannes Weiner <hannes(a)cmpxchg.org>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
mm/page_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -puN mm/page_alloc.c~mm-cma-fix-alloc_contig_range-ret-code-potential-leak mm/page_alloc.c
--- a/mm/page_alloc.c~mm-cma-fix-alloc_contig_range-ret-code-potential-leak
+++ a/mm/page_alloc.c
@@ -7706,10 +7706,10 @@ int alloc_contig_range(unsigned long sta
}
/* Make sure the range is really isolated. */
- if (test_pages_isolated(outer_start, end, false)) {
+ ret = test_pages_isolated(outer_start, end, false);
+ if (ret) {
pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n",
__func__, outer_start, end);
- ret = -EBUSY;
goto done;
}
_
Patches currently in -mm which might be from mike.kravetz(a)oracle.com are
mm-cma-fix-alloc_contig_range-ret-code-potential-leak.patch
The patch titled
Subject: nilfs2: fix race condition that causes file system corruption
has been removed from the -mm tree. Its filename was
nilfs2-fix-race-condition-that-causes-file-system-corruption.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Andreas Rohner <andreas.rohner(a)gmx.net>
Subject: nilfs2: fix race condition that causes file system corruption
There is a race condition between nilfs_dirty_inode() and
nilfs_set_file_dirty().
When a file is opened, nilfs_dirty_inode() is called to update the access
timestamp in the inode. It calls __nilfs_mark_inode_dirty() in a separate
transaction. __nilfs_mark_inode_dirty() caches the ifile buffer_head in
the i_bh field of the inode info structure and marks it as dirty.
After some data was written to the file in another transaction, the
function nilfs_set_file_dirty() is called, which adds the inode to the
ns_dirty_files list.
Then the segment construction calls nilfs_segctor_collect_dirty_files(),
which goes through the ns_dirty_files list and checks the i_bh field. If
there is a cached buffer_head in i_bh it is not marked as dirty again.
Since nilfs_dirty_inode() and nilfs_set_file_dirty() use separate
transactions, it is possible that a segment construction that writes out
the ifile occurs in-between the two. If this happens the inode is not on
the ns_dirty_files list, but its ifile block is still marked as dirty and
written out.
In the next segment construction, the data for the file is written out and
nilfs_bmap_propagate() updates the b-tree. Eventually the bmap root is
written into the i_bh block, which is not dirty, because it was written
out in another segment construction.
As a result the bmap update can be lost, which leads to file system
corruption. Either the virtual block address points to an unallocated DAT
block, or the DAT entry will be reused for something different.
The error can remain undetected for a long time. A typical error message
would be one of the "bad btree" errors or a warning that a DAT entry could
not be found.
This bug can be reproduced reliably by a simple benchmark that creates and
overwrites millions of 4k files.
Link: http://lkml.kernel.org/r/1509367935-3086-2-git-send-email-konishi.ryusuke@l…
Signed-off-by: Andreas Rohner <andreas.rohner(a)gmx.net>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke(a)lab.ntt.co.jp>
Tested-by: Andreas Rohner <andreas.rohner(a)gmx.net>
Tested-by: Ryusuke Konishi <konishi.ryusuke(a)lab.ntt.co.jp>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
fs/nilfs2/segment.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff -puN fs/nilfs2/segment.c~nilfs2-fix-race-condition-that-causes-file-system-corruption fs/nilfs2/segment.c
--- a/fs/nilfs2/segment.c~nilfs2-fix-race-condition-that-causes-file-system-corruption
+++ a/fs/nilfs2/segment.c
@@ -1954,8 +1954,6 @@ static int nilfs_segctor_collect_dirty_f
err, ii->vfs_inode.i_ino);
return err;
}
- mark_buffer_dirty(ibh);
- nilfs_mdt_mark_dirty(ifile);
spin_lock(&nilfs->ns_inode_lock);
if (likely(!ii->i_bh))
ii->i_bh = ibh;
@@ -1964,6 +1962,10 @@ static int nilfs_segctor_collect_dirty_f
goto retry;
}
+ // Always redirty the buffer to avoid race condition
+ mark_buffer_dirty(ii->i_bh);
+ nilfs_mdt_mark_dirty(ifile);
+
clear_bit(NILFS_I_QUEUED, &ii->i_state);
set_bit(NILFS_I_BUSY, &ii->i_state);
list_move_tail(&ii->i_dirty, &sci->sc_dirty_files);
_
Patches currently in -mm which might be from andreas.rohner(a)gmx.net are
The patch titled
Subject: autofs: don't fail mount for transient error
has been removed from the -mm tree. Its filename was
autofs-dont-fail-mount-for-transient-error.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: NeilBrown <neilb(a)suse.com>
Subject: autofs: don't fail mount for transient error
Currently if the autofs kernel module gets an error when writing to the
pipe which links to the daemon, then it marks the whole moutpoint as
catatonic, and it will stop working.
It is possible that the error is transient. This can happen if the daemon
is slow and more than 16 requests queue up. If a subsequent process tries
to queue a request, and is then signalled, the write to the pipe will
return -ERESTARTSYS and autofs will take that as total failure.
So change the code to assess -ERESTARTSYS and -ENOMEM as transient
failures which only abort the current request, not the whole mountpoint.
It isn't a crash or a data corruption, but having autofs mountpoints
suddenly stop working is rather inconvenient.
Ian said:
: And given the problems with a half dozen (or so) user space applications
: consuming large amounts of CPU under heavy mount and umount activity this
: could happen more easily than we expect.
Link: http://lkml.kernel.org/r/87y3norvgp.fsf@notabene.neil.brown.name
Signed-off-by: NeilBrown <neilb(a)suse.com>
Acked-by: Ian Kent <raven(a)themaw.net>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
fs/autofs4/waitq.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff -puN fs/autofs4/waitq.c~autofs-dont-fail-mount-for-transient-error fs/autofs4/waitq.c
--- a/fs/autofs4/waitq.c~autofs-dont-fail-mount-for-transient-error
+++ a/fs/autofs4/waitq.c
@@ -81,7 +81,8 @@ static int autofs4_write(struct autofs_s
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
}
- return (bytes > 0);
+ /* if 'wr' returned 0 (impossible) we assume -EIO (safe) */
+ return bytes == 0 ? 0 : wr < 0 ? wr : -EIO;
}
static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
@@ -95,6 +96,7 @@ static void autofs4_notify_daemon(struct
} pkt;
struct file *pipe = NULL;
size_t pktsz;
+ int ret;
pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n",
(unsigned long) wq->wait_queue_token,
@@ -169,7 +171,18 @@ static void autofs4_notify_daemon(struct
mutex_unlock(&sbi->wq_mutex);
if (autofs4_write(sbi, pipe, &pkt, pktsz))
+ switch (ret = autofs4_write(sbi, pipe, &pkt, pktsz)) {
+ case 0:
+ break;
+ case -ENOMEM:
+ case -ERESTARTSYS:
+ /* Just fail this one */
+ autofs4_wait_release(sbi, wq->wait_queue_token, ret);
+ break;
+ default:
autofs4_catatonic_mode(sbi);
+ break;
+ }
fput(pipe);
}
_
Patches currently in -mm which might be from neilb(a)suse.com are
The patch titled
Subject: mm/z3fold.c: use kref to prevent page free/compact race
has been removed from the -mm tree. Its filename was
z3fold-use-kref-to-prevent-page-free-compact-race.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Vitaly Wool <vitalywool(a)gmail.com>
Subject: mm/z3fold.c: use kref to prevent page free/compact race
There is a race in the current z3fold implementation between do_compact()
called in a work queue context and the page release procedure when page's
kref goes to 0. do_compact() may be waiting for page lock, which is
released by release_z3fold_page_locked right before putting the page onto
the "stale" list, and then the page may be freed as do_compact() modifies
its contents.
The mechanism currently implemented to handle that (checking the
PAGE_STALE flag) is not reliable enough. Instead, we'll use page's kref
counter to guarantee that the page is not released if its compaction is
scheduled. It then becomes compaction function's responsibility to
decrease the counter and quit immediately if the page was actually freed.
Link: http://lkml.kernel.org/r/20171117092032.00ea56f42affbed19f4fcc6c@gmail.com
Signed-off-by: Vitaly Wool <vitaly.wool(a)sonymobile.com>
Cc: <Oleksiy.Avramchenko(a)sony.com>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
mm/z3fold.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff -puN mm/z3fold.c~z3fold-use-kref-to-prevent-page-free-compact-race mm/z3fold.c
--- a/mm/z3fold.c~z3fold-use-kref-to-prevent-page-free-compact-race
+++ a/mm/z3fold.c
@@ -404,8 +404,7 @@ static void do_compact_page(struct z3fol
WARN_ON(z3fold_page_trylock(zhdr));
else
z3fold_page_lock(zhdr);
- if (test_bit(PAGE_STALE, &page->private) ||
- !test_and_clear_bit(NEEDS_COMPACTING, &page->private)) {
+ if (WARN_ON(!test_and_clear_bit(NEEDS_COMPACTING, &page->private))) {
z3fold_page_unlock(zhdr);
return;
}
@@ -413,6 +412,11 @@ static void do_compact_page(struct z3fol
list_del_init(&zhdr->buddy);
spin_unlock(&pool->lock);
+ if (kref_put(&zhdr->refcount, release_z3fold_page_locked)) {
+ atomic64_dec(&pool->pages_nr);
+ return;
+ }
+
z3fold_compact_page(zhdr);
unbuddied = get_cpu_ptr(pool->unbuddied);
fchunks = num_free_chunks(zhdr);
@@ -753,9 +757,11 @@ static void z3fold_free(struct z3fold_po
list_del_init(&zhdr->buddy);
spin_unlock(&pool->lock);
zhdr->cpu = -1;
+ kref_get(&zhdr->refcount);
do_compact_page(zhdr, true);
return;
}
+ kref_get(&zhdr->refcount);
queue_work_on(zhdr->cpu, pool->compact_wq, &zhdr->work);
z3fold_page_unlock(zhdr);
}
_
Patches currently in -mm which might be from vitalywool(a)gmail.com are
This is the start of the stable review cycle for the 3.18.83 release.
There are 38 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 Tue Nov 21 14:29:00 UTC 2017.
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.x/stable-review/patch-3.18.83-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-3.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 3.18.83-rc1
Johan Hovold <johan(a)kernel.org>
USB: serial: garmin_gps: fix memory leak on probe errors
Johan Hovold <johan(a)kernel.org>
USB: serial: garmin_gps: fix I/O after failed probe and remove
Johan Hovold <johan(a)kernel.org>
USB: serial: garmin_gps: fix memory leak on failed URB submit
Douglas Fischer <douglas.fischer(a)outlook.com>
USB: serial: qcserial: add pid/vid for Sierra Wireless EM7355 fw update
Bernhard Rosenkraenzer <bernhard.rosenkranzer(a)linaro.org>
USB: Add delay-init quirk for Corsair K70 LUX keyboards
Alan Stern <stern(a)rowland.harvard.edu>
USB: usbfs: compute urb->actual_length for isochronous
Dmitry V. Levin <ldv(a)altlinux.org>
uapi: fix linux/rds.h userspace compilation errors
Dmitry V. Levin <ldv(a)altlinux.org>
uapi: fix linux/rds.h userspace compilation error
Sasha Levin <alexander.levin(a)verizon.com>
Revert "uapi: fix linux/rds.h userspace compilation errors"
Sasha Levin <alexander.levin(a)verizon.com>
Revert "crypto: xts - Add ECB dependency"
Paul Burton <paul.burton(a)imgtec.com>
MIPS: Netlogic: Exclude netlogic,xlp-pic code from XLR builds
Marcin Nowakowski <marcin.nowakowski(a)imgtec.com>
MIPS: init: Ensure reserved memory regions are not added to bootmem
Paul Burton <paul.burton(a)imgtec.com>
MIPS: End asm function prologue macros with .insn
Emil Tantilov <emil.s.tantilov(a)intel.com>
ixgbe: handle close/suspend race with netif_device_detach/present
Emil Tantilov <emil.s.tantilov(a)intel.com>
ixgbe: fix AER error handling
Arvind Yadav <arvind.yadav.cs(a)gmail.com>
gpu: drm: mgag200: mgag200_main:- Handle error from pci_iomap
Alexey Khoroshilov <khoroshilov(a)ispras.ru>
backlight: adp5520: Fix error handling in adp5520_bl_probe()
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
backlight: lcd: Fix race condition during register
Takashi Iwai <tiwai(a)suse.de>
ALSA: vx: Fix possible transfer overflow
Takashi Iwai <tiwai(a)suse.de>
ALSA: vx: Don't try to update capture stream before running
James Smart <james.smart(a)broadcom.com>
scsi: lpfc: Correct issue leading to oops during link reset
James Smart <james.smart(a)broadcom.com>
scsi: lpfc: Correct host name in symbolic_name field
James Smart <james.smart(a)broadcom.com>
scsi: lpfc: FCoE VPort enable-disable does not bring up the VPort
James Smart <james.smart(a)broadcom.com>
scsi: lpfc: Add missing memory barrier
Galo Navarro <anglorvaroa(a)gmail.com>
staging: rtl8188eu: fix incorrect ERROR tags from logs
Hannu Lounento <hannu.lounento(a)ge.com>
igb: Fix hw_dbg logging in igb_update_flash_i210
Todd Fujinaka <todd.fujinaka(a)intel.com>
igb: close/suspend race in netif_device_detach
Aaron Sierra <asierra(a)xes-inc.com>
igb: reset the PHY before reading the PHY ID
Arvind Yadav <arvind.yadav.cs(a)gmail.com>
drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache
Geert Uytterhoeven <geert(a)linux-m68k.org>
ata: SATA_MV should depend on HAS_DMA
Geert Uytterhoeven <geert(a)linux-m68k.org>
ata: SATA_HIGHBANK should depend on HAS_DMA
Geert Uytterhoeven <geert(a)linux-m68k.org>
ata: ATA_BMDMA should depend on HAS_DMA
Tony Lindgren <tony(a)atomide.com>
ARM: dts: Fix omap3 off mode pull defines
Tony Lindgren <tony(a)atomide.com>
ARM: OMAP2+: Fix init for multiple quirks for the same SoC
Roger Quadros <rogerq(a)ti.com>
extcon: palmas: Check the parent instance to prevent the NULL
Nicholas Bellinger <nab(a)linux-iscsi.org>
iscsi-target: Fix iscsi_np reset hung task during parallel delete
Andrey Konovalov <andreyknvl(a)google.com>
media: dib0700: fix invalid dvb_detach argument
Arvind Yadav <arvind.yadav.cs(a)gmail.com>
media: imon: Fix null-ptr-deref in imon_probe
-------------
Diffstat:
Makefile | 4 +-
arch/arm/mach-omap2/pdata-quirks.c | 1 -
arch/mips/include/asm/asm.h | 10 ++-
arch/mips/kernel/setup.c | 4 +
arch/mips/netlogic/common/irq.c | 4 +-
crypto/Kconfig | 1 -
drivers/ata/Kconfig | 3 +
drivers/extcon/extcon-palmas.c | 5 ++
drivers/gpu/drm/mgag200/mgag200_main.c | 2 +
drivers/gpu/drm/sti/sti_vtg.c | 4 +
drivers/media/rc/imon.c | 5 ++
drivers/media/usb/dvb-usb/dib0700_devices.c | 24 +++---
drivers/net/ethernet/intel/igb/e1000_82575.c | 11 +++
drivers/net/ethernet/intel/igb/e1000_i210.c | 4 +-
drivers/net/ethernet/intel/igb/igb_main.c | 21 +++---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 23 +++---
drivers/scsi/lpfc/lpfc_attr.c | 17 +++++
drivers/scsi/lpfc/lpfc_sli.c | 3 +
drivers/scsi/lpfc/lpfc_vport.c | 8 ++
drivers/staging/rtl8188eu/include/rtw_debug.h | 2 +-
drivers/target/iscsi/iscsi_target.c | 1 +
drivers/target/iscsi/iscsi_target_core.h | 1 +
drivers/target/iscsi/iscsi_target_login.c | 7 +-
drivers/usb/core/devio.c | 14 ++++
drivers/usb/core/quirks.c | 3 +
drivers/usb/serial/garmin_gps.c | 23 +++++-
drivers/usb/serial/qcserial.c | 1 +
drivers/video/backlight/adp5520_bl.c | 12 ++-
drivers/video/backlight/lcd.c | 4 +-
include/dt-bindings/pinctrl/omap.h | 4 +-
include/target/iscsi/iscsi_target_core.h | 1 +
include/uapi/linux/rds.h | 102 +++++++++++++-------------
sound/drivers/vx/vx_pcm.c | 8 +-
sound/pci/vx222/vx222_ops.c | 12 +--
sound/pcmcia/vx/vxp_ops.c | 12 +--
35 files changed, 239 insertions(+), 122 deletions(-)
This is a note to let you know that I've just added the patch titled
sparc64: Fix page table walk for PUD hugepages
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
0001-sparc64-Fix-page-table-walk-for-PUD-hugepages.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From fac33aa62841b69cd0e19a29b0e2ac96e4e8cf32 Mon Sep 17 00:00:00 2001
From: Nitin Gupta <nitin.m.gupta(a)oracle.com>
Date: Fri, 3 Nov 2017 12:26:06 -0700
Subject: sparc64: Fix page table walk for PUD hugepages
From: Nitin Gupta <nitin.m.gupta(a)oracle.com>
[ Upstream commit 70f3c8b7c2e7ebcdde8354da004872e7c9184e97 ]
For a PUD hugepage entry, we need to propagate bits [32:22]
from virtual address to resolve at 4M granularity. However,
the current code was incorrectly propagating bits [29:19].
This bug can cause incorrect data to be returned for pages
backed with 16G hugepages.
Signed-off-by: Nitin Gupta <nitin.m.gupta(a)oracle.com>
Reported-by: Al Viro <viro(a)ZenIV.linux.org.uk>
Cc: Al Viro <viro(a)ZenIV.linux.org.uk>
Signed-off-by: David S. Miller <davem(a)davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
arch/sparc/include/asm/tsb.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index 25b6abdb3908..522a677e050d 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -217,7 +217,7 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
sllx REG2, 32, REG2; \
andcc REG1, REG2, %g0; \
be,pt %xcc, 700f; \
- sethi %hi(0x1ffc0000), REG2; \
+ sethi %hi(0xffe00000), REG2; \
sllx REG2, 1, REG2; \
brgez,pn REG1, FAIL_LABEL; \
andn REG1, REG2, REG1; \
--
2.13.6
Patches currently in stable-queue which might be from nitin.m.gupta(a)oracle.com are
queue-4.14/0001-sparc64-Fix-page-table-walk-for-PUD-hugepages.patch