All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.4 000/115] 4.4.107-stable review
@ 2017-12-18 15:47 Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 001/115] crypto: hmac - require that the underlying hash algorithm is unkeyed Greg Kroah-Hartman
                   ` (112 more replies)
  0 siblings, 113 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuahkh, patches,
	ben.hutchings, lkft-triage, stable

This is the start of the stable review cycle for the 4.4.107 release.
There are 115 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 Wed Dec 20 15:28:15 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/v4.x/stable-review/patch-4.4.107-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-4.4.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.4.107-rc1

Miaoqing Pan <miaoqing@codeaurora.org>
    ath9k: fix tx99 potential info leak

Alex Vesker <valex@mellanox.com>
    IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop

Bart Van Assche <bart.vanassche@wdc.com>
    RDMA/cma: Avoid triggering undefined behavior

Alexander Duyck <alexander.h.duyck@intel.com>
    macvlan: Only deliver one copy of the frame to the macvlan interface

Jan Kara <jack@suse.cz>
    udf: Avoid overflow when session starts at large offset

Dan Carpenter <dan.carpenter@oracle.com>
    scsi: bfa: integer overflow in debugfs

weiping zhang <zhangweiping@didichuxing.com>
    scsi: sd: change allow_restart to bool in sysfs interface

weiping zhang <zhangweiping@didichuxing.com>
    scsi: sd: change manage_start_stop to bool in sysfs interface

Jia-Ju Bai <baijiaju1990@163.com>
    vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend

Kurt Garloff <garloff@suse.de>
    scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry

NeilBrown <neilb@suse.com>
    raid5: Set R5_Expanded on parity devices as well as data.

Linus Walleij <linus.walleij@linaro.org>
    pinctrl: adi2: Fix Kconfig build problem

Bin Liu <b-liu@ti.com>
    usb: musb: da8xx: fix babble condition handling

nixiaoming <nixiaoming@huawei.com>
    tty fix oops when rmmod 8250

Michael Ellerman <mpe@ellerman.id.au>
    powerpc/perf/hv-24x7: Fix incorrect comparison in memord

Martin Wilck <mwilck@suse.de>
    scsi: hpsa: destroy sas transport properties before scsi_host

Martin Wilck <mwilck@suse.de>
    scsi: hpsa: cleanup sas_phy structures in sysfs when unloading

Alex Williamson <alex.williamson@redhat.com>
    PCI: Detach driver before procfs & sysfs teardown on device remove

Christoph Hellwig <hch@lst.de>
    xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real

Brian Foster <bfoster@redhat.com>
    xfs: fix log block underflow during recovery cycle verification

Jiri Slaby <jslaby@suse.cz>
    l2tp: cleanup l2tp_tunnel_delete calls

tang.junhui <tang.junhui@zte.com.cn>
    bcache: fix wrong cache_misses statistics

Liang Chen <liangchen.linux@gmail.com>
    bcache: explicitly destroy mutex while exiting

Bob Peterson <rpeterso@redhat.com>
    GFS2: Take inode off order_write list when setting jdata flag

Daniel Lezcano <daniel.lezcano@linaro.org>
    thermal/drivers/step_wise: Fix temperature regulation misbehavior

Gao Feng <gfree.wind@vip.163.com>
    ppp: Destroy the mutex when cleanup

Michał Mirosław <mirq-linux@rere.qmqm.pl>
    clk: tegra: Fix cclk_lp divisor register

Sébastien Szymanski <sebastien.szymanski@armadeus.com>
    clk: imx6: refine hdmi_isfr's parent to make HDMI work on i.MX6 SoCs w/o VPU

Chen Zhong <chen.zhong@mediatek.com>
    clk: mediatek: add the option for determining PLL source clock

Jan Kara <jack@suse.cz>
    mm: Handle 0 flags in _calc_vm_trans() macro

Robert Baronescu <robert.baronescu@nxp.com>
    crypto: tcrypt - fix buffer lengths in test_aead_speed()

Suzuki K Poulose <suzuki.poulose@arm.com>
    arm-ccn: perf: Prevent module unload while PMU is in use

Jiang Yi <jiangyilism@gmail.com>
    target/file: Do not return error for UNMAP if length is zero

tangwenji <tang.wenji@zte.com.cn>
    target:fix condition return in core_pr_dump_initiator_port()

tangwenji <tang.wenji@zte.com.cn>
    iscsi-target: fix memory leak in lio_target_tiqn_addtpg()

Bart Van Assche <bart.vanassche@wdc.com>
    target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd()

Markus Elfring <elfring@users.sourceforge.net>
    platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill()

Christophe Leroy <christophe.leroy@c-s.fr>
    powerpc/ipic: Fix status get and status clear

William A. Kennington III <wak@google.com>
    powerpc/opal: Fix EBUSY bug in acquiring tokens

KUWAZAWA Takuya <albatross0@gmail.com>
    netfilter: ipvs: Fix inappropriate output of procfs

Shriya <shriyak@linux.vnet.ibm.com>
    powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo

Qiang <zhengqiang10@huawei.com>
    PCI/PME: Handle invalid data when reading Root Status

Peter Ujfalusi <peter.ujfalusi@ti.com>
    dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type

Philipp Zabel <p.zabel@pengutronix.de>
    rtc: pcf8563: fix output clock rate

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    video: fbdev: au1200fb: Return an error code if a memory allocation fails

Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    video: fbdev: au1200fb: Release some resources if a memory allocation fails

Ladislav Michl <ladis@linux-mips.org>
    video: udlfb: Fix read EDID timeout

Geert Uytterhoeven <geert@linux-m68k.org>
    fbdev: controlfb: Add missing modes to fix out of bounds access

Robert Stonehouse <rstonehouse@solarflare.com>
    sfc: don't warn on successful change of MAC

Mike Christie <mchristi@redhat.com>
    target: fix race during implicit transition work flushes

Mike Christie <mchristi@redhat.com>
    target: fix ALUA transition timeout handling

Mike Christie <mchristi@redhat.com>
    target: Use system workqueue for ALUA transitions

Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
    btrfs: add missing memset while reading compressed inline extents

Olga Kornievskaia <kolga@netapp.com>
    NFSv4.1 respect server's max size in CREATE_SESSION

Daniel Drake <drake@endlessm.com>
    efi/esrt: Cleanup bad memory map log messages

Daniel Borkmann <daniel@iogearbox.net>
    perf symbols: Fix symbols__fixup_end heuristic for corner cases

Jack Morgenstein <jackm@dev.mellanox.co.il>
    net/mlx4_core: Avoid delays during VF driver device shutdown

David Howells <dhowells@redhat.com>
    afs: Fix afs_kill_pages()

David Howells <dhowells@redhat.com>
    afs: Fix page leak in afs_write_begin()

Marc Dionne <marc.dionne@auristor.com>
    afs: Populate and use client modification time

David Howells <dhowells@redhat.com>
    afs: Fix the maths in afs_fs_store_data()

Tina Ruchandani <ruchandani.tina@gmail.com>
    afs: Prevent callback expiry timer overflow

Tina Ruchandani <ruchandani.tina@gmail.com>
    afs: Migrate vlocation fields to 64-bit

David Howells <dhowells@redhat.com>
    afs: Flush outstanding writes when an fd is closed

Marc Dionne <marc.dionne@auristor.com>
    afs: Adjust mode bits processing

Marc Dionne <marc.dionne@auristor.com>
    afs: Populate group ID from vnode status

David Howells <dhowells@redhat.com>
    afs: Fix missing put_page()

Alex Deucher <alexander.deucher@amd.com>
    drm/radeon: reinstate oland workaround for sclk

yong mao <yong.mao@mediatek.com>
    mmc: mediatek: Fixed bug where clock frequency could be set wrong

Steven Rostedt (VMware) <rostedt@goodmis.org>
    sched/deadline: Use deadline instead of period when calculating overflow

Daniel Bristot de Oliveira <bristot@redhat.com>
    sched/deadline: Throttle a constrained deadline task activated after the deadline

Daniel Bristot de Oliveira <bristot@redhat.com>
    sched/deadline: Make sure the replenishment timer fires in the next period

Alex Deucher <alexander.deucher@amd.com>
    drm/radeon/si: add dpm quirk for Oland

Taku Izumi <izumi.taku@jp.fujitsu.com>
    fjes: Fix wrong netdevice feature flags

Don Brace <don.brace@microsemi.com>
    scsi: hpsa: limit outstanding rescans

Don Brace <don.brace@microsemi.com>
    scsi: hpsa: update check for logical volume status

Stafford Horne <shorne@gmail.com>
    openrisc: fix issue handling 8 byte get_user calls

Alexander Shishkin <alexander.shishkin@linux.intel.com>
    intel_th: pci: Add Gemini Lake support

Jiri Pirko <jiri@mellanox.com>
    mlxsw: reg: Fix SPVMLR max record count

Jiri Pirko <jiri@mellanox.com>
    mlxsw: reg: Fix SPVM max record count

Vlad Yasevich <vyasevich@gmail.com>
    net: Resend IGMP memberships upon peer notification.

Matthias Kaehlcke <mka@chromium.org>
    dmaengine: Fix array index out of bounds warning in __get_unmap_pool()

Johan Hovold <johan@kernel.org>
    net: wimax/i2400m: fix NULL-deref at probe

Tahsin Erdogan <tahsin@google.com>
    writeback: fix memory leak in wb_queue_work()

Florian Westphal <fw@strlen.de>
    netfilter: bridge: honor frag_max_size when refragmenting

Tomi Valkeinen <tomi.valkeinen@ti.com>
    drm/omap: fix dmabuf mmap for dma_alloc'ed buffers

Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list

NeilBrown <neilb@suse.com>
    NFSD: fix nfsd_reset_versions for NFSv4.

NeilBrown <neilb@suse.com>
    NFSD: fix nfsd_minorversion(.., NFSD_AVAIL)

Doug Berger <opendmb@gmail.com>
    net: bcmgenet: Power up the internal PHY before probing the MII

Doug Berger <opendmb@gmail.com>
    net: bcmgenet: power down internal phy if open or resume fails

Doug Berger <opendmb@gmail.com>
    net: bcmgenet: reserved phy revisions must be checked first

Doug Berger <opendmb@gmail.com>
    net: bcmgenet: correct MIB access of UniMAC RUNT counters

Doug Berger <opendmb@gmail.com>
    net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values

Alexander Potapenko <glider@google.com>
    net: initialize msg.msg_flags in recvfrom

Andrea Arcangeli <aarcange@redhat.com>
    userfaultfd: selftest: vm: allow to build in vm/ directory

Andrea Arcangeli <aarcange@redhat.com>
    userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE

Guoqing Jiang <gqjiang@suse.com>
    md-cluster: free md_cluster_info if node leave cluster

Javier Martinez Canillas <javier@osg.samsung.com>
    usb: phy: isp1301: Add OF device ID table

Ilan peer <ilan.peer@intel.com>
    mac80211: Fix addition of mesh configuration element

Eric Biggers <ebiggers@google.com>
    KEYS: add missing permission check for request_key() destination

Chandan Rajendra <chandan@linux.vnet.ibm.com>
    ext4: fix crash when a directory's i_size is too small

Eryu Guan <eguan@redhat.com>
    ext4: fix fdatasync(2) after fallocate(2) operation

Adam Wallis <awallis@codeaurora.org>
    dmaengine: dmatest: move callback wait queue to thread context

Steven Rostedt <rostedt@goodmis.org>
    sched/rt: Do not pull from current CPU if only one CPU to pull

Mathias Nyman <mathias.nyman@linux.intel.com>
    xhci: Don't add a virt_dev to the devs array before it's fully allocated

Sukumar Ghorai <sukumar.ghorai@intel.com>
    Bluetooth: btusb: driver to enable the usb-wakeup feature

Yan, Zheng <zyan@redhat.com>
    ceph: drop negative child dentries before try pruning inode's alias

Shuah Khan <shuahkh@osg.samsung.com>
    usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer

Alan Stern <stern@rowland.harvard.edu>
    USB: core: prevent malicious bNumInterfaces overflow

David Kozub <zub@linux.fjfi.cvut.cz>
    USB: uas and storage: Add US_FL_BROKEN_FUA for another JMicron JMS567 ID

Changbin Du <changbin.du@intel.com>
    tracing: Allocate mask_str buffer dynamically

NeilBrown <neilb@suse.com>
    autofs: fix careless error in recent commit

Eric Biggers <ebiggers@google.com>
    crypto: salsa20 - fix blkcipher_walk API usage

Eric Biggers <ebiggers@google.com>
    crypto: hmac - require that the underlying hash algorithm is unkeyed


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

Diffstat:

 Makefile                                       |  4 +-
 arch/blackfin/Kconfig                          |  7 +-
 arch/blackfin/Kconfig.debug                    |  1 +
 arch/openrisc/include/asm/uaccess.h            |  2 +-
 arch/powerpc/perf/hv-24x7.c                    |  2 +-
 arch/powerpc/platforms/powernv/opal-async.c    |  6 +-
 arch/powerpc/platforms/powernv/setup.c         |  2 +-
 arch/powerpc/sysdev/ipic.c                     |  4 +-
 arch/x86/crypto/salsa20_glue.c                 |  7 --
 crypto/hmac.c                                  |  6 +-
 crypto/salsa20_generic.c                       |  7 --
 crypto/shash.c                                 |  5 +-
 crypto/tcrypt.c                                |  6 +-
 drivers/bluetooth/btusb.c                      |  5 ++
 drivers/bus/arm-ccn.c                          |  1 +
 drivers/clk/imx/clk-imx6q.c                    |  2 +-
 drivers/clk/mediatek/clk-mtk.h                 |  1 +
 drivers/clk/mediatek/clk-pll.c                 |  5 +-
 drivers/clk/tegra/clk-tegra30.c                |  2 +-
 drivers/dma/dmaengine.c                        |  2 +
 drivers/dma/dmatest.c                          | 55 ++++++++-------
 drivers/dma/ti-dma-crossbar.c                  |  8 +--
 drivers/firmware/efi/efi.c                     |  1 -
 drivers/firmware/efi/esrt.c                    |  2 +-
 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c      |  3 -
 drivers/gpu/drm/radeon/si_dpm.c                | 10 +++
 drivers/hwtracing/intel_th/pci.c               |  5 ++
 drivers/infiniband/core/cma.c                  | 11 +--
 drivers/infiniband/ulp/ipoib/ipoib_ib.c        |  7 +-
 drivers/input/serio/i8042-x86ia64io.h          |  7 ++
 drivers/md/bcache/request.c                    |  6 +-
 drivers/md/bcache/super.c                      |  6 +-
 drivers/md/md-cluster.c                        |  1 +
 drivers/md/raid5.c                             |  5 +-
 drivers/mmc/host/mtk-sd.c                      |  4 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 95 +++++++++++++++++++++-----
 drivers/net/ethernet/broadcom/genet/bcmgenet.h | 10 ++-
 drivers/net/ethernet/mellanox/mlx4/cmd.c       | 11 +++
 drivers/net/ethernet/mellanox/mlx4/main.c      | 11 +++
 drivers/net/ethernet/mellanox/mlxsw/reg.h      |  4 +-
 drivers/net/ethernet/sfc/ef10.c                |  2 +-
 drivers/net/fjes/fjes_main.c                   |  2 +-
 drivers/net/macvlan.c                          |  2 +-
 drivers/net/ppp/ppp_generic.c                  |  1 +
 drivers/net/wimax/i2400m/usb.c                 |  3 +
 drivers/net/wireless/ath/ath9k/tx99.c          |  5 ++
 drivers/pci/pcie/pme.c                         |  5 +-
 drivers/pci/remove.c                           |  2 +-
 drivers/pinctrl/Kconfig                        |  3 +-
 drivers/platform/x86/sony-laptop.c             | 14 ++--
 drivers/rtc/rtc-pcf8563.c                      |  2 +-
 drivers/scsi/bfa/bfad_debugfs.c                |  5 +-
 drivers/scsi/hpsa.c                            | 57 +++++++++-------
 drivers/scsi/hpsa.h                            |  1 +
 drivers/scsi/hpsa_cmd.h                        |  2 +
 drivers/scsi/scsi_devinfo.c                    |  2 +-
 drivers/scsi/sd.c                              | 12 +++-
 drivers/staging/vt6655/device_main.c           |  3 +-
 drivers/target/iscsi/iscsi_target.c            |  3 +-
 drivers/target/iscsi/iscsi_target_configfs.c   |  3 +-
 drivers/target/target_core_alua.c              | 33 +++------
 drivers/target/target_core_file.c              |  4 ++
 drivers/target/target_core_pr.c                |  4 +-
 drivers/thermal/step_wise.c                    | 11 +--
 drivers/usb/core/config.c                      |  4 +-
 drivers/usb/host/xhci-mem.c                    | 15 ++--
 drivers/usb/musb/da8xx.c                       | 10 ++-
 drivers/usb/phy/phy-isp1301.c                  |  7 ++
 drivers/usb/storage/unusual_devs.h             |  7 ++
 drivers/usb/storage/unusual_uas.h              |  7 ++
 drivers/usb/usbip/stub_tx.c                    |  7 ++
 drivers/video/fbdev/au1200fb.c                 |  7 +-
 drivers/video/fbdev/controlfb.h                |  2 +
 drivers/video/fbdev/udlfb.c                    | 10 +--
 fs/afs/callback.c                              |  7 +-
 fs/afs/file.c                                  |  1 +
 fs/afs/fsclient.c                              | 22 +++---
 fs/afs/inode.c                                 | 11 +--
 fs/afs/internal.h                              | 12 ++--
 fs/afs/security.c                              |  7 +-
 fs/afs/server.c                                |  6 +-
 fs/afs/vlocation.c                             | 16 +++--
 fs/afs/write.c                                 | 32 +++++++--
 fs/autofs4/waitq.c                             |  1 -
 fs/btrfs/inode.c                               | 14 ++++
 fs/ceph/mds_client.c                           | 42 ++++++++++--
 fs/ext4/extents.c                              |  1 +
 fs/ext4/namei.c                                |  4 ++
 fs/fs-writeback.c                              | 35 ++++++----
 fs/gfs2/file.c                                 |  4 +-
 fs/nfs/nfs4client.c                            |  4 +-
 fs/nfsd/nfssvc.c                               | 30 ++++----
 fs/proc/proc_tty.c                             |  3 +-
 fs/udf/super.c                                 |  2 +-
 fs/userfaultfd.c                               |  2 +-
 fs/xfs/libxfs/xfs_bmap.c                       |  2 +-
 fs/xfs/xfs_log_recover.c                       |  2 +-
 include/crypto/internal/hash.h                 |  8 +++
 include/linux/mlx4/device.h                    |  1 +
 include/linux/mman.h                           |  3 +-
 include/target/target_core_base.h              |  2 +-
 kernel/sched/deadline.c                        | 62 +++++++++++++++--
 kernel/sched/rt.c                              |  8 ++-
 kernel/trace/trace.c                           | 29 +++-----
 net/bridge/br_netfilter_hooks.c                | 12 ++--
 net/core/dev.c                                 |  1 +
 net/l2tp/l2tp_core.c                           |  2 +-
 net/l2tp/l2tp_netlink.c                        |  2 +-
 net/mac80211/mesh.c                            |  2 -
 net/netfilter/ipvs/ip_vs_ctl.c                 |  4 ++
 net/socket.c                                   |  1 +
 security/keys/request_key.c                    | 48 ++++++++++---
 tools/perf/util/symbol.c                       |  2 +-
 tools/testing/selftests/vm/Makefile            |  4 ++
 114 files changed, 727 insertions(+), 320 deletions(-)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 001/115] crypto: hmac - require that the underlying hash algorithm is unkeyed
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 002/115] crypto: salsa20 - fix blkcipher_walk API usage Greg Kroah-Hartman
                   ` (111 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, syzbot, Eric Biggers, Herbert Xu

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

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

From: Eric Biggers <ebiggers@google.com>

commit af3ff8045bbf3e32f1a448542e73abb4c8ceb6f1 upstream.

Because the HMAC template didn't check that its underlying hash
algorithm is unkeyed, trying to use "hmac(hmac(sha3-512-generic))"
through AF_ALG or through KEYCTL_DH_COMPUTE resulted in the inner HMAC
being used without having been keyed, resulting in sha3_update() being
called without sha3_init(), causing a stack buffer overflow.

This is a very old bug, but it seems to have only started causing real
problems when SHA-3 support was added (requires CONFIG_CRYPTO_SHA3)
because the innermost hash's state is ->import()ed from a zeroed buffer,
and it just so happens that other hash algorithms are fine with that,
but SHA-3 is not.  However, there could be arch or hardware-dependent
hash algorithms also affected; I couldn't test everything.

Fix the bug by introducing a function crypto_shash_alg_has_setkey()
which tests whether a shash algorithm is keyed.  Then update the HMAC
template to require that its underlying hash algorithm is unkeyed.

Here is a reproducer:

    #include <linux/if_alg.h>
    #include <sys/socket.h>

    int main()
    {
        int algfd;
        struct sockaddr_alg addr = {
            .salg_type = "hash",
            .salg_name = "hmac(hmac(sha3-512-generic))",
        };
        char key[4096] = { 0 };

        algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
        bind(algfd, (const struct sockaddr *)&addr, sizeof(addr));
        setsockopt(algfd, SOL_ALG, ALG_SET_KEY, key, sizeof(key));
    }

Here was the KASAN report from syzbot:

    BUG: KASAN: stack-out-of-bounds in memcpy include/linux/string.h:341  [inline]
    BUG: KASAN: stack-out-of-bounds in sha3_update+0xdf/0x2e0  crypto/sha3_generic.c:161
    Write of size 4096 at addr ffff8801cca07c40 by task syzkaller076574/3044

    CPU: 1 PID: 3044 Comm: syzkaller076574 Not tainted 4.14.0-mm1+ #25
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  Google 01/01/2011
    Call Trace:
      __dump_stack lib/dump_stack.c:17 [inline]
      dump_stack+0x194/0x257 lib/dump_stack.c:53
      print_address_description+0x73/0x250 mm/kasan/report.c:252
      kasan_report_error mm/kasan/report.c:351 [inline]
      kasan_report+0x25b/0x340 mm/kasan/report.c:409
      check_memory_region_inline mm/kasan/kasan.c:260 [inline]
      check_memory_region+0x137/0x190 mm/kasan/kasan.c:267
      memcpy+0x37/0x50 mm/kasan/kasan.c:303
      memcpy include/linux/string.h:341 [inline]
      sha3_update+0xdf/0x2e0 crypto/sha3_generic.c:161
      crypto_shash_update+0xcb/0x220 crypto/shash.c:109
      shash_finup_unaligned+0x2a/0x60 crypto/shash.c:151
      crypto_shash_finup+0xc4/0x120 crypto/shash.c:165
      hmac_finup+0x182/0x330 crypto/hmac.c:152
      crypto_shash_finup+0xc4/0x120 crypto/shash.c:165
      shash_digest_unaligned+0x9e/0xd0 crypto/shash.c:172
      crypto_shash_digest+0xc4/0x120 crypto/shash.c:186
      hmac_setkey+0x36a/0x690 crypto/hmac.c:66
      crypto_shash_setkey+0xad/0x190 crypto/shash.c:64
      shash_async_setkey+0x47/0x60 crypto/shash.c:207
      crypto_ahash_setkey+0xaf/0x180 crypto/ahash.c:200
      hash_setkey+0x40/0x90 crypto/algif_hash.c:446
      alg_setkey crypto/af_alg.c:221 [inline]
      alg_setsockopt+0x2a1/0x350 crypto/af_alg.c:254
      SYSC_setsockopt net/socket.c:1851 [inline]
      SyS_setsockopt+0x189/0x360 net/socket.c:1830
      entry_SYSCALL_64_fastpath+0x1f/0x96

Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 crypto/hmac.c                  |    6 +++++-
 crypto/shash.c                 |    5 +++--
 include/crypto/internal/hash.h |    8 ++++++++
 3 files changed, 16 insertions(+), 3 deletions(-)

--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -194,11 +194,15 @@ static int hmac_create(struct crypto_tem
 	salg = shash_attr_alg(tb[1], 0, 0);
 	if (IS_ERR(salg))
 		return PTR_ERR(salg);
+	alg = &salg->base;
 
+	/* The underlying hash algorithm must be unkeyed */
 	err = -EINVAL;
+	if (crypto_shash_alg_has_setkey(salg))
+		goto out_put_alg;
+
 	ds = salg->digestsize;
 	ss = salg->statesize;
-	alg = &salg->base;
 	if (ds > alg->cra_blocksize ||
 	    ss < alg->cra_blocksize)
 		goto out_put_alg;
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -24,11 +24,12 @@
 
 static const struct crypto_type crypto_shash_type;
 
-static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
-			   unsigned int keylen)
+int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
+		    unsigned int keylen)
 {
 	return -ENOSYS;
 }
+EXPORT_SYMBOL_GPL(shash_no_setkey);
 
 static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key,
 				  unsigned int keylen)
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -83,6 +83,14 @@ int ahash_register_instance(struct crypt
 			    struct ahash_instance *inst);
 void ahash_free_instance(struct crypto_instance *inst);
 
+int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
+		    unsigned int keylen);
+
+static inline bool crypto_shash_alg_has_setkey(struct shash_alg *alg)
+{
+	return alg->setkey != shash_no_setkey;
+}
+
 int crypto_init_ahash_spawn(struct crypto_ahash_spawn *spawn,
 			    struct hash_alg_common *alg,
 			    struct crypto_instance *inst);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 002/115] crypto: salsa20 - fix blkcipher_walk API usage
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 001/115] crypto: hmac - require that the underlying hash algorithm is unkeyed Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 003/115] autofs: fix careless error in recent commit Greg Kroah-Hartman
                   ` (110 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, syzbot, Eric Biggers, Herbert Xu

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

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

From: Eric Biggers <ebiggers@google.com>

commit ecaaab5649781c5a0effdaf298a925063020500e upstream.

When asked to encrypt or decrypt 0 bytes, both the generic and x86
implementations of Salsa20 crash in blkcipher_walk_done(), either when
doing 'kfree(walk->buffer)' or 'free_page((unsigned long)walk->page)',
because walk->buffer and walk->page have not been initialized.

The bug is that Salsa20 is calling blkcipher_walk_done() even when
nothing is in 'walk.nbytes'.  But blkcipher_walk_done() is only meant to
be called when a nonzero number of bytes have been provided.

The broken code is part of an optimization that tries to make only one
call to salsa20_encrypt_bytes() to process inputs that are not evenly
divisible by 64 bytes.  To fix the bug, just remove this "optimization"
and use the blkcipher_walk API the same way all the other users do.

Reproducer:

    #include <linux/if_alg.h>
    #include <sys/socket.h>
    #include <unistd.h>

    int main()
    {
            int algfd, reqfd;
            struct sockaddr_alg addr = {
                    .salg_type = "skcipher",
                    .salg_name = "salsa20",
            };
            char key[16] = { 0 };

            algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
            bind(algfd, (void *)&addr, sizeof(addr));
            reqfd = accept(algfd, 0, 0);
            setsockopt(algfd, SOL_ALG, ALG_SET_KEY, key, sizeof(key));
            read(reqfd, key, sizeof(key));
    }

Reported-by: syzbot <syzkaller@googlegroups.com>
Fixes: eb6f13eb9f81 ("[CRYPTO] salsa20_generic: Fix multi-page processing")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/crypto/salsa20_glue.c |    7 -------
 crypto/salsa20_generic.c       |    7 -------
 2 files changed, 14 deletions(-)

--- a/arch/x86/crypto/salsa20_glue.c
+++ b/arch/x86/crypto/salsa20_glue.c
@@ -59,13 +59,6 @@ static int encrypt(struct blkcipher_desc
 
 	salsa20_ivsetup(ctx, walk.iv);
 
-	if (likely(walk.nbytes == nbytes))
-	{
-		salsa20_encrypt_bytes(ctx, walk.src.virt.addr,
-				      walk.dst.virt.addr, nbytes);
-		return blkcipher_walk_done(desc, &walk, 0);
-	}
-
 	while (walk.nbytes >= 64) {
 		salsa20_encrypt_bytes(ctx, walk.src.virt.addr,
 				      walk.dst.virt.addr,
--- a/crypto/salsa20_generic.c
+++ b/crypto/salsa20_generic.c
@@ -188,13 +188,6 @@ static int encrypt(struct blkcipher_desc
 
 	salsa20_ivsetup(ctx, walk.iv);
 
-	if (likely(walk.nbytes == nbytes))
-	{
-		salsa20_encrypt_bytes(ctx, walk.dst.virt.addr,
-				      walk.src.virt.addr, nbytes);
-		return blkcipher_walk_done(desc, &walk, 0);
-	}
-
 	while (walk.nbytes >= 64) {
 		salsa20_encrypt_bytes(ctx, walk.dst.virt.addr,
 				      walk.src.virt.addr,

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 003/115] autofs: fix careless error in recent commit
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 001/115] crypto: hmac - require that the underlying hash algorithm is unkeyed Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 002/115] crypto: salsa20 - fix blkcipher_walk API usage Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 004/115] tracing: Allocate mask_str buffer dynamically Greg Kroah-Hartman
                   ` (109 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ben Hutchings, NeilBrown, Ian Kent,
	Andrew Morton, Linus Torvalds

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

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

From: NeilBrown <neilb@suse.com>

commit 302ec300ef8a545a7fc7f667e5fd743b091c2eeb upstream.

Commit ecc0c469f277 ("autofs: don't fail mount for transient error") was
meant to replace an 'if' with a 'switch', but instead added the 'switch'
leaving the case in place.

Link: http://lkml.kernel.org/r/87zi6wstmw.fsf@notabene.neil.brown.name
Fixes: ecc0c469f277 ("autofs: don't fail mount for transient error")
Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: NeilBrown <neilb@suse.com>
Cc: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/autofs4/waitq.c |    1 -
 1 file changed, 1 deletion(-)

--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -174,7 +174,6 @@ 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;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 004/115] tracing: Allocate mask_str buffer dynamically
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 003/115] autofs: fix careless error in recent commit Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 005/115] USB: uas and storage: Add US_FL_BROKEN_FUA for another JMicron JMS567 ID Greg Kroah-Hartman
                   ` (108 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Changbin Du, Steven Rostedt (VMware)

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

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

From: Changbin Du <changbin.du@intel.com>

commit 90e406f96f630c07d631a021fd4af10aac913e77 upstream.

The default NR_CPUS can be very large, but actual possible nr_cpu_ids
usually is very small. For my x86 distribution, the NR_CPUS is 8192 and
nr_cpu_ids is 4. About 2 pages are wasted.

Most machines don't have so many CPUs, so define a array with NR_CPUS
just wastes memory. So let's allocate the buffer dynamically when need.

With this change, the mutext tracing_cpumask_update_lock also can be
removed now, which was used to protect mask_str.

Link: http://lkml.kernel.org/r/1512013183-19107-1-git-send-email-changbin.du@intel.com

Fixes: 36dfe9252bd4c ("ftrace: make use of tracing_cpumask")
Signed-off-by: Changbin Du <changbin.du@intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/trace/trace.c |   29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3384,37 +3384,30 @@ static const struct file_operations show
 	.llseek		= seq_lseek,
 };
 
-/*
- * The tracer itself will not take this lock, but still we want
- * to provide a consistent cpumask to user-space:
- */
-static DEFINE_MUTEX(tracing_cpumask_update_lock);
-
-/*
- * Temporary storage for the character representation of the
- * CPU bitmask (and one more byte for the newline):
- */
-static char mask_str[NR_CPUS + 1];
-
 static ssize_t
 tracing_cpumask_read(struct file *filp, char __user *ubuf,
 		     size_t count, loff_t *ppos)
 {
 	struct trace_array *tr = file_inode(filp)->i_private;
+	char *mask_str;
 	int len;
 
-	mutex_lock(&tracing_cpumask_update_lock);
+	len = snprintf(NULL, 0, "%*pb\n",
+		       cpumask_pr_args(tr->tracing_cpumask)) + 1;
+	mask_str = kmalloc(len, GFP_KERNEL);
+	if (!mask_str)
+		return -ENOMEM;
 
-	len = snprintf(mask_str, count, "%*pb\n",
+	len = snprintf(mask_str, len, "%*pb\n",
 		       cpumask_pr_args(tr->tracing_cpumask));
 	if (len >= count) {
 		count = -EINVAL;
 		goto out_err;
 	}
-	count = simple_read_from_buffer(ubuf, count, ppos, mask_str, NR_CPUS+1);
+	count = simple_read_from_buffer(ubuf, count, ppos, mask_str, len);
 
 out_err:
-	mutex_unlock(&tracing_cpumask_update_lock);
+	kfree(mask_str);
 
 	return count;
 }
@@ -3434,8 +3427,6 @@ tracing_cpumask_write(struct file *filp,
 	if (err)
 		goto err_unlock;
 
-	mutex_lock(&tracing_cpumask_update_lock);
-
 	local_irq_disable();
 	arch_spin_lock(&tr->max_lock);
 	for_each_tracing_cpu(cpu) {
@@ -3458,8 +3449,6 @@ tracing_cpumask_write(struct file *filp,
 	local_irq_enable();
 
 	cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new);
-
-	mutex_unlock(&tracing_cpumask_update_lock);
 	free_cpumask_var(tracing_cpumask_new);
 
 	return count;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 005/115] USB: uas and storage: Add US_FL_BROKEN_FUA for another JMicron JMS567 ID
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 004/115] tracing: Allocate mask_str buffer dynamically Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 006/115] USB: core: prevent malicious bNumInterfaces overflow Greg Kroah-Hartman
                   ` (107 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David Kozub, Alan Stern

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

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

From: David Kozub <zub@linux.fjfi.cvut.cz>

commit 62354454625741f0569c2cbe45b2d192f8fd258e upstream.

There is another JMS567-based USB3 UAS enclosure (152d:0578) that fails
with the following error:

[sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[sda] tag#0 Sense Key : Illegal Request [current]
[sda] tag#0 Add. Sense: Invalid field in cdb

The issue occurs both with UAS (occasionally) and mass storage
(immediately after mounting a FS on a disk in the enclosure).

Enabling US_FL_BROKEN_FUA quirk solves this issue.

This patch adds an UNUSUAL_DEV with US_FL_BROKEN_FUA for the enclosure
for both UAS and mass storage.

Signed-off-by: David Kozub <zub@linux.fjfi.cvut.cz>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/storage/unusual_devs.h |    7 +++++++
 drivers/usb/storage/unusual_uas.h  |    7 +++++++
 2 files changed, 14 insertions(+)

--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2149,6 +2149,13 @@ UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x99
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_NO_REPORT_OPCODES),
 
+/* Reported by David Kozub <zub@linux.fjfi.cvut.cz> */
+UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
+		"JMicron",
+		"JMS567",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_BROKEN_FUA),
+
 /*
  * Patch by Constantin Baranov <const@tltsu.ru>
  * Report by Andreas Koenecke.
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -141,6 +141,13 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x99
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES),
 
+/* Reported-by: David Kozub <zub@linux.fjfi.cvut.cz> */
+UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
+		"JMicron",
+		"JMS567",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_BROKEN_FUA),
+
 /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
 UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
 		"VIA",

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 006/115] USB: core: prevent malicious bNumInterfaces overflow
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 005/115] USB: uas and storage: Add US_FL_BROKEN_FUA for another JMicron JMS567 ID Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 007/115] usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer Greg Kroah-Hartman
                   ` (106 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alan Stern, Andrey Konovalov

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

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

From: Alan Stern <stern@rowland.harvard.edu>

commit 48a4ff1c7bb5a32d2e396b03132d20d552c0eca7 upstream.

A malicious USB device with crafted descriptors can cause the kernel
to access unallocated memory by setting the bNumInterfaces value too
high in a configuration descriptor.  Although the value is adjusted
during parsing, this adjustment is skipped in one of the error return
paths.

This patch prevents the problem by setting bNumInterfaces to 0
initially.  The existing code already sets it to the proper value
after parsing is complete.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/core/config.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -521,6 +521,9 @@ static int usb_parse_configuration(struc
 	unsigned iad_num = 0;
 
 	memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE);
+	nintf = nintf_orig = config->desc.bNumInterfaces;
+	config->desc.bNumInterfaces = 0;	// Adjusted later
+
 	if (config->desc.bDescriptorType != USB_DT_CONFIG ||
 	    config->desc.bLength < USB_DT_CONFIG_SIZE ||
 	    config->desc.bLength > size) {
@@ -534,7 +537,6 @@ static int usb_parse_configuration(struc
 	buffer += config->desc.bLength;
 	size -= config->desc.bLength;
 
-	nintf = nintf_orig = config->desc.bNumInterfaces;
 	if (nintf > USB_MAXINTERFACES) {
 		dev_warn(ddev, "config %d has too many interfaces: %d, "
 		    "using maximum allowed: %d\n",

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 007/115] usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 006/115] USB: core: prevent malicious bNumInterfaces overflow Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 008/115] ceph: drop negative child dentries before try pruning inodes alias Greg Kroah-Hartman
                   ` (105 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Secunia Research, Shuah Khan

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

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

From: Shuah Khan <shuahkh@osg.samsung.com>

commit be6123df1ea8f01ee2f896a16c2b7be3e4557a5a upstream.

stub_send_ret_submit() handles urb with a potential null transfer_buffer,
when it replays a packet with potential malicious data that could contain
a null buffer. Add a check for the condition when actual_length > 0 and
transfer_buffer is null.

Reported-by: Secunia Research <vuln@secunia.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/usbip/stub_tx.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/usb/usbip/stub_tx.c
+++ b/drivers/usb/usbip/stub_tx.c
@@ -178,6 +178,13 @@ static int stub_send_ret_submit(struct s
 		memset(&pdu_header, 0, sizeof(pdu_header));
 		memset(&msg, 0, sizeof(msg));
 
+		if (urb->actual_length > 0 && !urb->transfer_buffer) {
+			dev_err(&sdev->udev->dev,
+				"urb: actual_length %d transfer_buffer null\n",
+				urb->actual_length);
+			return -1;
+		}
+
 		if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS)
 			iovnum = 2 + urb->number_of_packets;
 		else

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 008/115] ceph: drop negative child dentries before try pruning inodes alias
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 007/115] usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:47 ` [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature Greg Kroah-Hartman
                   ` (104 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yan, Zheng, Jeff Layton, Ilya Dryomov

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

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

From: Yan, Zheng <zyan@redhat.com>

commit 040d786032bf59002d374b86d75b04d97624005c upstream.

Negative child dentry holds reference on inode's alias, it makes
d_prune_aliases() do nothing.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/mds_client.c |   42 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 4 deletions(-)

--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1400,6 +1400,29 @@ static int __close_session(struct ceph_m
 	return request_close_session(mdsc, session);
 }
 
+static bool drop_negative_children(struct dentry *dentry)
+{
+	struct dentry *child;
+	bool all_negative = true;
+
+	if (!d_is_dir(dentry))
+		goto out;
+
+	spin_lock(&dentry->d_lock);
+	list_for_each_entry(child, &dentry->d_subdirs, d_child) {
+		if (d_really_is_positive(child)) {
+			all_negative = false;
+			break;
+		}
+	}
+	spin_unlock(&dentry->d_lock);
+
+	if (all_negative)
+		shrink_dcache_parent(dentry);
+out:
+	return all_negative;
+}
+
 /*
  * Trim old(er) caps.
  *
@@ -1445,16 +1468,27 @@ static int trim_caps_cb(struct inode *in
 	if ((used | wanted) & ~oissued & mine)
 		goto out;   /* we need these caps */
 
-	session->s_trim_caps--;
 	if (oissued) {
 		/* we aren't the only cap.. just remove us */
 		__ceph_remove_cap(cap, true);
+		session->s_trim_caps--;
 	} else {
+		struct dentry *dentry;
 		/* try dropping referring dentries */
 		spin_unlock(&ci->i_ceph_lock);
-		d_prune_aliases(inode);
-		dout("trim_caps_cb %p cap %p  pruned, count now %d\n",
-		     inode, cap, atomic_read(&inode->i_count));
+		dentry = d_find_any_alias(inode);
+		if (dentry && drop_negative_children(dentry)) {
+			int count;
+			dput(dentry);
+			d_prune_aliases(inode);
+			count = atomic_read(&inode->i_count);
+			if (count == 1)
+				session->s_trim_caps--;
+			dout("trim_caps_cb %p cap %p pruned, count now %d\n",
+			     inode, cap, count);
+		} else {
+			dput(dentry);
+		}
 		return 0;
 	}
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 008/115] ceph: drop negative child dentries before try pruning inodes alias Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-20 19:51   ` Brian Norris
  2017-12-18 15:47 ` [PATCH 4.4 010/115] xhci: Dont add a virt_dev to the devs array before its fully allocated Greg Kroah-Hartman
                   ` (103 subsequent siblings)
  112 siblings, 1 reply; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sukumar Ghorai, Amit K Bag,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke

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

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

From: Sukumar Ghorai <sukumar.ghorai@intel.com>

commit a0085f2510e8976614ad8f766b209448b385492f upstream.

BT-Controller connected as platform non-root-hub device and
usb-driver initialize such device with wakeup disabled,
Ref. usb_new_device().

At present wakeup-capability get enabled by hid-input device from usb
function driver(e.g. BT HID device) at runtime. Again some functional
driver does not set usb-wakeup capability(e.g LE HID device implement
as HID-over-GATT), and can't wakeup the host on USB.

Most of the device operation (such as mass storage) initiated from host
(except HID) and USB wakeup aligned with host resume procedure. For BT
device, usb-wakeup capability need to enable form btusc driver as a
generic solution for multiple profile use case and required for USB remote
wakeup (in-bus wakeup) while host is suspended. Also usb-wakeup feature
need to enable/disable with HCI interface up and down.

Signed-off-by: Sukumar Ghorai <sukumar.ghorai@intel.com>
Signed-off-by: Amit K Bag <amit.k.bag@intel.com>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/bluetooth/btusb.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1050,6 +1050,10 @@ static int btusb_open(struct hci_dev *hd
 		return err;
 
 	data->intf->needs_remote_wakeup = 1;
+	/* device specific wakeup source enabled and required for USB
+	 * remote wakeup while host is suspended
+	 */
+	device_wakeup_enable(&data->udev->dev);
 
 	if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
 		goto done;
@@ -1113,6 +1117,7 @@ static int btusb_close(struct hci_dev *h
 		goto failed;
 
 	data->intf->needs_remote_wakeup = 0;
+	device_wakeup_disable(&data->udev->dev);
 	usb_autopm_put_interface(data->intf);
 
 failed:

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 010/115] xhci: Dont add a virt_dev to the devs array before its fully allocated
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature Greg Kroah-Hartman
@ 2017-12-18 15:47 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 011/115] sched/rt: Do not pull from current CPU if only one CPU to pull Greg Kroah-Hartman
                   ` (102 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mathias Nyman

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

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

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit 5d9b70f7d52eb14bb37861c663bae44de9521c35 upstream.

Avoid null pointer dereference if some function is walking through the
devs array accessing members of a new virt_dev that is mid allocation.

Add the virt_dev to xhci->devs[i] _after_ the virt_device and all its
members are properly allocated.

issue found by KASAN: null-ptr-deref in xhci_find_slot_id_by_port

"Quick analysis suggests that xhci_alloc_virt_device() is not mutex
protected. If so, there is a time frame where xhci->devs[slot_id] is set
but not fully initialized. Specifically, xhci->devs[i]->udev can be NULL."

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-mem.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1017,10 +1017,9 @@ int xhci_alloc_virt_device(struct xhci_h
 		return 0;
 	}
 
-	xhci->devs[slot_id] = kzalloc(sizeof(*xhci->devs[slot_id]), flags);
-	if (!xhci->devs[slot_id])
+	dev = kzalloc(sizeof(*dev), flags);
+	if (!dev)
 		return 0;
-	dev = xhci->devs[slot_id];
 
 	/* Allocate the (output) device context that will be used in the HC. */
 	dev->out_ctx = xhci_alloc_container_ctx(xhci, XHCI_CTX_TYPE_DEVICE, flags);
@@ -1068,9 +1067,17 @@ int xhci_alloc_virt_device(struct xhci_h
 		 &xhci->dcbaa->dev_context_ptrs[slot_id],
 		 le64_to_cpu(xhci->dcbaa->dev_context_ptrs[slot_id]));
 
+	xhci->devs[slot_id] = dev;
+
 	return 1;
 fail:
-	xhci_free_virt_device(xhci, slot_id);
+
+	if (dev->in_ctx)
+		xhci_free_container_ctx(xhci, dev->in_ctx);
+	if (dev->out_ctx)
+		xhci_free_container_ctx(xhci, dev->out_ctx);
+	kfree(dev);
+
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 011/115] sched/rt: Do not pull from current CPU if only one CPU to pull
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2017-12-18 15:47 ` [PATCH 4.4 010/115] xhci: Dont add a virt_dev to the devs array before its fully allocated Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 012/115] dmaengine: dmatest: move callback wait queue to thread context Greg Kroah-Hartman
                   ` (101 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniel Wagner,
	Steven Rostedt (VMware),
	Peter Zijlstra, Linus Torvalds, Sebastian Andrzej Siewior,
	Thomas Gleixner, linux-rt-users, Ingo Molnar

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

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

From: Steven Rostedt <rostedt@goodmis.org>

commit f73c52a5bcd1710994e53fbccc378c42b97a06b6 upstream.

Daniel Wagner reported a crash on the BeagleBone Black SoC.

This is a single CPU architecture, and does not have a functional
arch_send_call_function_single_ipi() implementation which can crash
the kernel if that is called.

As it only has one CPU, it shouldn't be called, but if the kernel is
compiled for SMP, the push/pull RT scheduling logic now calls it for
irq_work if the one CPU is overloaded, it can use that function to call
itself and crash the kernel.

Ideally, we should disable the SCHED_FEAT(RT_PUSH_IPI) if the system
only has a single CPU. But SCHED_FEAT is a constant if sched debugging
is turned off. Another fix can also be used, and this should also help
with normal SMP machines. That is, do not initiate the pull code if
there's only one RT overloaded CPU, and that CPU happens to be the
current CPU that is scheduling in a lower priority task.

Even on a system with many CPUs, if there's many RT tasks waiting to
run on a single CPU, and that CPU schedules in another RT task of lower
priority, it will initiate the PULL logic in case there's a higher
priority RT task on another CPU that is waiting to run. But if there is
no other CPU with waiting RT tasks, it will initiate the RT pull logic
on itself (as it still has RT tasks waiting to run). This is a wasted
effort.

Not only does this help with SMP code where the current CPU is the only
one with RT overloaded tasks, it should also solve the issue that
Daniel encountered, because it will prevent the PULL logic from
executing, as there's only one CPU on the system, and the check added
here will cause it to exit the RT pull code.

Reported-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>
Fixes: 4bdced5c9 ("sched/rt: Simplify the IPI based RT balancing logic")
Link: http://lkml.kernel.org/r/20171202130454.4cbbfe8d@vmware.local.home
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/sched/rt.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1960,8 +1960,9 @@ static void pull_rt_task(struct rq *this
 	bool resched = false;
 	struct task_struct *p;
 	struct rq *src_rq;
+	int rt_overload_count = rt_overloaded(this_rq);
 
-	if (likely(!rt_overloaded(this_rq)))
+	if (likely(!rt_overload_count))
 		return;
 
 	/*
@@ -1970,6 +1971,11 @@ static void pull_rt_task(struct rq *this
 	 */
 	smp_rmb();
 
+	/* If we are the only overloaded CPU do nothing */
+	if (rt_overload_count == 1 &&
+	    cpumask_test_cpu(this_rq->cpu, this_rq->rd->rto_mask))
+		return;
+
 #ifdef HAVE_RT_PUSH_IPI
 	if (sched_feat(RT_PUSH_IPI)) {
 		tell_cpu_to_push(this_rq);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 012/115] dmaengine: dmatest: move callback wait queue to thread context
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 011/115] sched/rt: Do not pull from current CPU if only one CPU to pull Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 013/115] ext4: fix fdatasync(2) after fallocate(2) operation Greg Kroah-Hartman
                   ` (100 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sinan Kaya, Shunyong Yang,
	Adam Wallis, Vinod Koul

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

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

From: Adam Wallis <awallis@codeaurora.org>

commit 6f6a23a213be51728502b88741ba6a10cda2441d upstream.

Commit adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
introduced a bug (that is in fact documented by the patch commit text)
that leaves behind a dangling pointer. Since the done_wait structure is
allocated on the stack, future invocations to the DMATEST can produce
undesirable results (e.g., corrupted spinlocks).

Commit a9df21e34b42 ("dmaengine: dmatest: warn user when dma test times
out") attempted to WARN the user that the stack was likely corrupted but
did not fix the actual issue.

This patch fixes the issue by pushing the wait queue and callback
structs into the the thread structure. If a failure occurs due to time,
dmaengine_terminate_all will force the callback to safely call
wake_up_all() without possibility of using a freed pointer.

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=197605
Fixes: adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
Reviewed-by: Sinan Kaya <okaya@codeaurora.org>
Suggested-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
Signed-off-by: Adam Wallis <awallis@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/dma/dmatest.c |   55 ++++++++++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 24 deletions(-)

--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -148,6 +148,12 @@ MODULE_PARM_DESC(run, "Run the test (def
 #define PATTERN_OVERWRITE	0x20
 #define PATTERN_COUNT_MASK	0x1f
 
+/* poor man's completion - we want to use wait_event_freezable() on it */
+struct dmatest_done {
+	bool			done;
+	wait_queue_head_t	*wait;
+};
+
 struct dmatest_thread {
 	struct list_head	node;
 	struct dmatest_info	*info;
@@ -156,6 +162,8 @@ struct dmatest_thread {
 	u8			**srcs;
 	u8			**dsts;
 	enum dma_transaction_type type;
+	wait_queue_head_t done_wait;
+	struct dmatest_done test_done;
 	bool			done;
 };
 
@@ -316,18 +324,25 @@ static unsigned int dmatest_verify(u8 **
 	return error_count;
 }
 
-/* poor man's completion - we want to use wait_event_freezable() on it */
-struct dmatest_done {
-	bool			done;
-	wait_queue_head_t	*wait;
-};
 
 static void dmatest_callback(void *arg)
 {
 	struct dmatest_done *done = arg;
-
-	done->done = true;
-	wake_up_all(done->wait);
+	struct dmatest_thread *thread =
+		container_of(arg, struct dmatest_thread, done_wait);
+	if (!thread->done) {
+		done->done = true;
+		wake_up_all(done->wait);
+	} else {
+		/*
+		 * If thread->done, it means that this callback occurred
+		 * after the parent thread has cleaned up. This can
+		 * happen in the case that driver doesn't implement
+		 * the terminate_all() functionality and a dma operation
+		 * did not occur within the timeout period
+		 */
+		WARN(1, "dmatest: Kernel memory may be corrupted!!\n");
+	}
 }
 
 static unsigned int min_odd(unsigned int x, unsigned int y)
@@ -398,9 +413,8 @@ static unsigned long long dmatest_KBs(s6
  */
 static int dmatest_func(void *data)
 {
-	DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_wait);
 	struct dmatest_thread	*thread = data;
-	struct dmatest_done	done = { .wait = &done_wait };
+	struct dmatest_done	*done = &thread->test_done;
 	struct dmatest_info	*info;
 	struct dmatest_params	*params;
 	struct dma_chan		*chan;
@@ -605,9 +619,9 @@ static int dmatest_func(void *data)
 			continue;
 		}
 
-		done.done = false;
+		done->done = false;
 		tx->callback = dmatest_callback;
-		tx->callback_param = &done;
+		tx->callback_param = done;
 		cookie = tx->tx_submit(tx);
 
 		if (dma_submit_error(cookie)) {
@@ -620,21 +634,12 @@ static int dmatest_func(void *data)
 		}
 		dma_async_issue_pending(chan);
 
-		wait_event_freezable_timeout(done_wait, done.done,
+		wait_event_freezable_timeout(thread->done_wait, done->done,
 					     msecs_to_jiffies(params->timeout));
 
 		status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
 
-		if (!done.done) {
-			/*
-			 * We're leaving the timed out dma operation with
-			 * dangling pointer to done_wait.  To make this
-			 * correct, we'll need to allocate wait_done for
-			 * each test iteration and perform "who's gonna
-			 * free it this time?" dancing.  For now, just
-			 * leave it dangling.
-			 */
-			WARN(1, "dmatest: Kernel stack may be corrupted!!\n");
+		if (!done->done) {
 			dmaengine_unmap_put(um);
 			result("test timed out", total_tests, src_off, dst_off,
 			       len, 0);
@@ -708,7 +713,7 @@ err_thread_type:
 		dmatest_KBs(runtime, total_len), ret);
 
 	/* terminate all transfers on specified channels */
-	if (ret)
+	if (ret || failed_tests)
 		dmaengine_terminate_all(chan);
 
 	thread->done = true;
@@ -766,6 +771,8 @@ static int dmatest_add_threads(struct dm
 		thread->info = info;
 		thread->chan = dtc->chan;
 		thread->type = type;
+		thread->test_done.wait = &thread->done_wait;
+		init_waitqueue_head(&thread->done_wait);
 		smp_wmb();
 		thread->task = kthread_create(dmatest_func, thread, "%s-%s%u",
 				dma_chan_name(chan), op, i);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 013/115] ext4: fix fdatasync(2) after fallocate(2) operation
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 012/115] dmaengine: dmatest: move callback wait queue to thread context Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 014/115] ext4: fix crash when a directorys i_size is too small Greg Kroah-Hartman
                   ` (99 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Eryu Guan, Theodore Tso

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

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

From: Eryu Guan <eguan@redhat.com>

commit c894aa97577e47d3066b27b32499ecf899bfa8b0 upstream.

Currently, fallocate(2) with KEEP_SIZE followed by a fdatasync(2)
then crash, we'll see wrong allocated block number (stat -c %b), the
blocks allocated beyond EOF are all lost. fstests generic/468
exposes this bug.

Commit 67a7d5f561f4 ("ext4: fix fdatasync(2) after extent
manipulation operations") fixed all the other extent manipulation
operation paths such as hole punch, zero range, collapse range etc.,
but forgot the fallocate case.

So similarly, fix it by recording the correct journal tid in ext4
inode in fallocate(2) path, so that ext4_sync_file() will wait for
the right tid to be committed on fdatasync(2).

This addresses the test failure in xfstests test generic/468.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/extents.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4746,6 +4746,7 @@ retry:
 						    EXT4_INODE_EOFBLOCKS);
 		}
 		ext4_mark_inode_dirty(handle, inode);
+		ext4_update_inode_fsync_trans(handle, inode, 1);
 		ret2 = ext4_journal_stop(handle);
 		if (ret2)
 			break;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 014/115] ext4: fix crash when a directorys i_size is too small
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 013/115] ext4: fix fdatasync(2) after fallocate(2) operation Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 015/115] KEYS: add missing permission check for request_key() destination Greg Kroah-Hartman
                   ` (98 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Abdul Haleem, Chandan Rajendra

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

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

From: Chandan Rajendra <chandan@linux.vnet.ibm.com>

commit 9d5afec6b8bd46d6ed821aa1579634437f58ef1f upstream.

On a ppc64 machine, when mounting a fuzzed ext2 image (generated by
fsfuzzer) the following call trace is seen,

VFS: brelse: Trying to free free buffer
WARNING: CPU: 1 PID: 6913 at /root/repos/linux/fs/buffer.c:1165 .__brelse.part.6+0x24/0x40
.__brelse.part.6+0x20/0x40 (unreliable)
.ext4_find_entry+0x384/0x4f0
.ext4_lookup+0x84/0x250
.lookup_slow+0xdc/0x230
.walk_component+0x268/0x400
.path_lookupat+0xec/0x2d0
.filename_lookup+0x9c/0x1d0
.vfs_statx+0x98/0x140
.SyS_newfstatat+0x48/0x80
system_call+0x58/0x6c

This happens because the directory that ext4_find_entry() looks up has
inode->i_size that is less than the block size of the filesystem. This
causes 'nblocks' to have a value of zero. ext4_bread_batch() ends up not
reading any of the directory file's blocks. This renders the entries in
bh_use[] array to continue to have garbage data. buffer_uptodate() on
bh_use[0] can then return a zero value upon which brelse() function is
invoked.

This commit fixes the bug by returning -ENOENT when the directory file
has no associated blocks.

Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/namei.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1403,6 +1403,10 @@ static struct buffer_head * ext4_find_en
 			       "falling back\n"));
 	}
 	nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
+	if (!nblocks) {
+		ret = NULL;
+		goto cleanup_and_exit;
+	}
 	start = EXT4_I(dir)->i_dir_start_lookup;
 	if (start >= nblocks)
 		start = 0;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 015/115] KEYS: add missing permission check for request_key() destination
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 014/115] ext4: fix crash when a directorys i_size is too small Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 017/115] usb: phy: isp1301: Add OF device ID table Greg Kroah-Hartman
                   ` (97 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Eric Biggers, David Howells

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

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

From: Eric Biggers <ebiggers@google.com>

commit 4dca6ea1d9432052afb06baf2e3ae78188a4410b upstream.

When the request_key() syscall is not passed a destination keyring, it
links the requested key (if constructed) into the "default" request-key
keyring.  This should require Write permission to the keyring.  However,
there is actually no permission check.

This can be abused to add keys to any keyring to which only Search
permission is granted.  This is because Search permission allows joining
the keyring.  keyctl_set_reqkey_keyring(KEY_REQKEY_DEFL_SESSION_KEYRING)
then will set the default request-key keyring to the session keyring.
Then, request_key() can be used to add keys to the keyring.

Both negatively and positively instantiated keys can be added using this
method.  Adding negative keys is trivial.  Adding a positive key is a
bit trickier.  It requires that either /sbin/request-key positively
instantiates the key, or that another thread adds the key to the process
keyring at just the right time, such that request_key() misses it
initially but then finds it in construct_alloc_key().

Fix this bug by checking for Write permission to the keyring in
construct_get_dest_keyring() when the default keyring is being used.

We don't do the permission check for non-default keyrings because that
was already done by the earlier call to lookup_user_key().  Also,
request_key_and_link() is currently passed a 'struct key *' rather than
a key_ref_t, so the "possessed" bit is unavailable.

We also don't do the permission check for the "requestor keyring", to
continue to support the use case described by commit 8bbf4976b59f
("KEYS: Alter use of key instantiation link-to-keyring argument") where
/sbin/request-key recursively calls request_key() to add keys to the
original requestor's destination keyring.  (I don't know of any users
who actually do that, though...)

Fixes: 3e30148c3d52 ("[PATCH] Keys: Make request-key create an authorisation key")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 security/keys/request_key.c |   48 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 10 deletions(-)

--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -250,11 +250,12 @@ static int construct_key(struct key *key
  * The keyring selected is returned with an extra reference upon it which the
  * caller must release.
  */
-static void construct_get_dest_keyring(struct key **_dest_keyring)
+static int construct_get_dest_keyring(struct key **_dest_keyring)
 {
 	struct request_key_auth *rka;
 	const struct cred *cred = current_cred();
 	struct key *dest_keyring = *_dest_keyring, *authkey;
+	int ret;
 
 	kenter("%p", dest_keyring);
 
@@ -263,6 +264,8 @@ static void construct_get_dest_keyring(s
 		/* the caller supplied one */
 		key_get(dest_keyring);
 	} else {
+		bool do_perm_check = true;
+
 		/* use a default keyring; falling through the cases until we
 		 * find one that we actually have */
 		switch (cred->jit_keyring) {
@@ -277,8 +280,10 @@ static void construct_get_dest_keyring(s
 					dest_keyring =
 						key_get(rka->dest_keyring);
 				up_read(&authkey->sem);
-				if (dest_keyring)
+				if (dest_keyring) {
+					do_perm_check = false;
 					break;
+				}
 			}
 
 		case KEY_REQKEY_DEFL_THREAD_KEYRING:
@@ -313,11 +318,29 @@ static void construct_get_dest_keyring(s
 		default:
 			BUG();
 		}
+
+		/*
+		 * Require Write permission on the keyring.  This is essential
+		 * because the default keyring may be the session keyring, and
+		 * joining a keyring only requires Search permission.
+		 *
+		 * However, this check is skipped for the "requestor keyring" so
+		 * that /sbin/request-key can itself use request_key() to add
+		 * keys to the original requestor's destination keyring.
+		 */
+		if (dest_keyring && do_perm_check) {
+			ret = key_permission(make_key_ref(dest_keyring, 1),
+					     KEY_NEED_WRITE);
+			if (ret) {
+				key_put(dest_keyring);
+				return ret;
+			}
+		}
 	}
 
 	*_dest_keyring = dest_keyring;
 	kleave(" [dk %d]", key_serial(dest_keyring));
-	return;
+	return 0;
 }
 
 /*
@@ -442,12 +465,16 @@ static struct key *construct_key_and_lin
 
 	if (ctx->index_key.type == &key_type_keyring)
 		return ERR_PTR(-EPERM);
-	
-	user = key_user_lookup(current_fsuid());
-	if (!user)
-		return ERR_PTR(-ENOMEM);
 
-	construct_get_dest_keyring(&dest_keyring);
+	ret = construct_get_dest_keyring(&dest_keyring);
+	if (ret)
+		goto error;
+
+	user = key_user_lookup(current_fsuid());
+	if (!user) {
+		ret = -ENOMEM;
+		goto error_put_dest_keyring;
+	}
 
 	ret = construct_alloc_key(ctx, dest_keyring, flags, user, &key);
 	key_user_put(user);
@@ -462,7 +489,7 @@ static struct key *construct_key_and_lin
 	} else if (ret == -EINPROGRESS) {
 		ret = 0;
 	} else {
-		goto couldnt_alloc_key;
+		goto error_put_dest_keyring;
 	}
 
 	key_put(dest_keyring);
@@ -472,8 +499,9 @@ static struct key *construct_key_and_lin
 construction_failed:
 	key_negate_and_link(key, key_negative_timeout, NULL, NULL);
 	key_put(key);
-couldnt_alloc_key:
+error_put_dest_keyring:
 	key_put(dest_keyring);
+error:
 	kleave(" = %d", ret);
 	return ERR_PTR(ret);
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 017/115] usb: phy: isp1301: Add OF device ID table
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 015/115] KEYS: add missing permission check for request_key() destination Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 018/115] md-cluster: free md_cluster_info if node leave cluster Greg Kroah-Hartman
                   ` (96 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Javier Martinez Canillas, Sasha Levin

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>


[ Upstream commit fd567653bdb908009b650f079bfd4b63169e2ac4 ]

The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/phy/phy-isp1301.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/usb/phy/phy-isp1301.c
+++ b/drivers/usb/phy/phy-isp1301.c
@@ -33,6 +33,12 @@ static const struct i2c_device_id isp130
 };
 MODULE_DEVICE_TABLE(i2c, isp1301_id);
 
+static const struct of_device_id isp1301_of_match[] = {
+	{.compatible = "nxp,isp1301" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, isp1301_of_match);
+
 static struct i2c_client *isp1301_i2c_client;
 
 static int __isp1301_write(struct isp1301 *isp, u8 reg, u8 value, u8 clear)
@@ -130,6 +136,7 @@ static int isp1301_remove(struct i2c_cli
 static struct i2c_driver isp1301_driver = {
 	.driver = {
 		.name = DRV_NAME,
+		.of_match_table = of_match_ptr(isp1301_of_match),
 	},
 	.probe = isp1301_probe,
 	.remove = isp1301_remove,

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 018/115] md-cluster: free md_cluster_info if node leave cluster
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 017/115] usb: phy: isp1301: Add OF device ID table Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 019/115] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE Greg Kroah-Hartman
                   ` (95 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, NeilBrown, Guoqing Jiang, Shaohua Li,
	Sasha Levin

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

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

From: Guoqing Jiang <gqjiang@suse.com>


[ Upstream commit 9c8043f337f14d1743006dfc59c03e80a42e3884 ]

To avoid memory leak, we need to free the cinfo which
is allocated when node join cluster.

Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/md-cluster.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -821,6 +821,7 @@ static int leave(struct mddev *mddev)
 	lockres_free(cinfo->no_new_dev_lockres);
 	lockres_free(cinfo->bitmap_lockres);
 	dlm_release_lockspace(cinfo->lockspace, 2);
+	kfree(cinfo);
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 019/115] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 018/115] md-cluster: free md_cluster_info if node leave cluster Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory Greg Kroah-Hartman
                   ` (94 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrea Arcangeli, Dmitry Vyukov,
	Kirill A. Shutemov, Andrew Morton, Linus Torvalds, Sasha Levin

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

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

From: Andrea Arcangeli <aarcange@redhat.com>


[ Upstream commit 6bbc4a4144b1a69743022ac68dfaf6e7d993abb9 ]

__do_fault assumes vmf->page has been initialized and is valid if
VM_FAULT_NOPAGE is not returned by vma->vm_ops->fault(vma, vmf).

handle_userfault() in turn should return VM_FAULT_NOPAGE if it doesn't
return VM_FAULT_SIGBUS or VM_FAULT_RETRY (the other two possibilities).

This VM_FAULT_NOPAGE case is only invoked when signal are pending and it
didn't matter for anonymous memory before.  It only started to matter
since shmem was introduced.  hugetlbfs also takes a different path and
doesn't exercise __do_fault.

Link: http://lkml.kernel.org/r/20170228154201.GH5816@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/userfaultfd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -386,7 +386,7 @@ int handle_userfault(struct vm_area_stru
 			 * in such case.
 			 */
 			down_read(&mm->mmap_sem);
-			ret = 0;
+			ret = VM_FAULT_NOPAGE;
 		}
 	}
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 019/115] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2018-01-11 19:42   ` Ben Hutchings
  2017-12-18 15:48 ` [PATCH 4.4 021/115] net: initialize msg.msg_flags in recvfrom Greg Kroah-Hartman
                   ` (93 subsequent siblings)
  112 siblings, 1 reply; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrea Arcangeli, Mike Rapoport,
	Dr. David Alan Gilbert, Mike Kravetz, Pavel Emelyanov,
	Hillf Danton, Andrew Morton, Linus Torvalds, Sasha Levin

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

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

From: Andrea Arcangeli <aarcange@redhat.com>


[ Upstream commit 46aa6a302b53f543f8e8b8e1714dc5e449ad36a6 ]

linux/tools/testing/selftests/vm $ make

  gcc -Wall -I ../../../../usr/include     compaction_test.c -lrt -o /compaction_test
  /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open output file /compaction_test: Permission denied
  collect2: error: ld returned 1 exit status
  make: *** [../lib.mk:54: /compaction_test] Error 1

Since commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT")
selftests/vm build fails if run from the "selftests/vm" directory, but
it works in the selftests/ directory.  It's quicker to be able to do a
local vm-only build after a tree wipe and this patch allows for it
again.

Link: http://lkml.kernel.org/r/20170302173738.18994-4-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/testing/selftests/vm/Makefile |    4 ++++
 1 file changed, 4 insertions(+)

--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,5 +1,9 @@
 # Makefile for vm selftests
 
+ifndef OUTPUT
+  OUTPUT := $(shell pwd)
+endif
+
 CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
 BINARIES = compaction_test
 BINARIES += hugepage-mmap

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 021/115] net: initialize msg.msg_flags in recvfrom
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 022/115] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values Greg Kroah-Hartman
                   ` (92 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexander Potapenko, David S. Miller,
	Sasha Levin

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

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

From: Alexander Potapenko <glider@google.com>


[ Upstream commit 9f138fa609c47403374a862a08a41394be53d461 ]

KMSAN reports a use of uninitialized memory in put_cmsg() because
msg.msg_flags in recvfrom haven't been initialized properly.
The flag values don't affect the result on this path, but it's still a
good idea to initialize them explicitly.

Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/socket.c |    1 +
 1 file changed, 1 insertion(+)

--- a/net/socket.c
+++ b/net/socket.c
@@ -1697,6 +1697,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void
 	/* We assume all kernel code knows the size of sockaddr_storage */
 	msg.msg_namelen = 0;
 	msg.msg_iocb = NULL;
+	msg.msg_flags = 0;
 	if (sock->file->f_flags & O_NONBLOCK)
 		flags |= MSG_DONTWAIT;
 	err = sock_recvmsg(sock, &msg, iov_iter_count(&msg.msg_iter), flags);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 022/115] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 021/115] net: initialize msg.msg_flags in recvfrom Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 023/115] net: bcmgenet: correct MIB access of UniMAC RUNT counters Greg Kroah-Hartman
                   ` (91 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Doug Berger, Florian Fainelli,
	David S. Miller, Sasha Levin

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

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

From: Doug Berger <opendmb@gmail.com>


[ Upstream commit ffff71328a3c321f7c14cc1edd33577717037744 ]

The location of the RBUF overflow and error counters has moved between
different version of the GENET MAC.  This commit corrects the driver to
read from the correct locations depending on the version of the GENET
MAC.

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |   60 ++++++++++++++++++++++---
 drivers/net/ethernet/broadcom/genet/bcmgenet.h |   10 ++--
 2 files changed, 60 insertions(+), 10 deletions(-)

--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1,7 +1,7 @@
 /*
  * Broadcom GENET (Gigabit Ethernet) controller driver
  *
- * Copyright (c) 2014 Broadcom Corporation
+ * Copyright (c) 2014-2017 Broadcom
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -778,8 +778,9 @@ static const struct bcmgenet_stats bcmge
 	STAT_GENET_RUNT("rx_runt_bytes", mib.rx_runt_bytes),
 	/* Misc UniMAC counters */
 	STAT_GENET_MISC("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt,
-			UMAC_RBUF_OVFL_CNT),
-	STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt, UMAC_RBUF_ERR_CNT),
+			UMAC_RBUF_OVFL_CNT_V1),
+	STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt,
+			UMAC_RBUF_ERR_CNT_V1),
 	STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT),
 	STAT_GENET_SOFT_MIB("alloc_rx_buff_failed", mib.alloc_rx_buff_failed),
 	STAT_GENET_SOFT_MIB("rx_dma_failed", mib.rx_dma_failed),
@@ -821,6 +822,45 @@ static void bcmgenet_get_strings(struct
 	}
 }
 
+static u32 bcmgenet_update_stat_misc(struct bcmgenet_priv *priv, u16 offset)
+{
+	u16 new_offset;
+	u32 val;
+
+	switch (offset) {
+	case UMAC_RBUF_OVFL_CNT_V1:
+		if (GENET_IS_V2(priv))
+			new_offset = RBUF_OVFL_CNT_V2;
+		else
+			new_offset = RBUF_OVFL_CNT_V3PLUS;
+
+		val = bcmgenet_rbuf_readl(priv,	new_offset);
+		/* clear if overflowed */
+		if (val == ~0)
+			bcmgenet_rbuf_writel(priv, 0, new_offset);
+		break;
+	case UMAC_RBUF_ERR_CNT_V1:
+		if (GENET_IS_V2(priv))
+			new_offset = RBUF_ERR_CNT_V2;
+		else
+			new_offset = RBUF_ERR_CNT_V3PLUS;
+
+		val = bcmgenet_rbuf_readl(priv,	new_offset);
+		/* clear if overflowed */
+		if (val == ~0)
+			bcmgenet_rbuf_writel(priv, 0, new_offset);
+		break;
+	default:
+		val = bcmgenet_umac_readl(priv, offset);
+		/* clear if overflowed */
+		if (val == ~0)
+			bcmgenet_umac_writel(priv, 0, offset);
+		break;
+	}
+
+	return val;
+}
+
 static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv)
 {
 	int i, j = 0;
@@ -845,10 +885,16 @@ static void bcmgenet_update_mib_counters
 						  UMAC_MIB_START + j + offset);
 			break;
 		case BCMGENET_STAT_MISC:
-			val = bcmgenet_umac_readl(priv, s->reg_offset);
-			/* clear if overflowed */
-			if (val == ~0)
-				bcmgenet_umac_writel(priv, 0, s->reg_offset);
+			if (GENET_IS_V1(priv)) {
+				val = bcmgenet_umac_readl(priv, s->reg_offset);
+				/* clear if overflowed */
+				if (val == ~0)
+					bcmgenet_umac_writel(priv, 0,
+							     s->reg_offset);
+			} else {
+				val = bcmgenet_update_stat_misc(priv,
+								s->reg_offset);
+			}
 			break;
 		}
 
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Broadcom Corporation
+ * Copyright (c) 2014-2017 Broadcom
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -214,7 +214,9 @@ struct bcmgenet_mib_counters {
 #define  MDIO_REG_SHIFT			16
 #define  MDIO_REG_MASK			0x1F
 
-#define UMAC_RBUF_OVFL_CNT		0x61C
+#define UMAC_RBUF_OVFL_CNT_V1		0x61C
+#define RBUF_OVFL_CNT_V2		0x80
+#define RBUF_OVFL_CNT_V3PLUS		0x94
 
 #define UMAC_MPD_CTRL			0x620
 #define  MPD_EN				(1 << 0)
@@ -224,7 +226,9 @@ struct bcmgenet_mib_counters {
 
 #define UMAC_MPD_PW_MS			0x624
 #define UMAC_MPD_PW_LS			0x628
-#define UMAC_RBUF_ERR_CNT		0x634
+#define UMAC_RBUF_ERR_CNT_V1		0x634
+#define RBUF_ERR_CNT_V2			0x84
+#define RBUF_ERR_CNT_V3PLUS		0x98
 #define UMAC_MDF_ERR_CNT		0x638
 #define UMAC_MDF_CTRL			0x650
 #define UMAC_MDF_ADDR			0x654

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 023/115] net: bcmgenet: correct MIB access of UniMAC RUNT counters
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 022/115] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 024/115] net: bcmgenet: reserved phy revisions must be checked first Greg Kroah-Hartman
                   ` (90 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Doug Berger, Florian Fainelli,
	David S. Miller, Sasha Levin

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

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

From: Doug Berger <opendmb@gmail.com>


[ Upstream commit 1ad3d225e5a40ca6c586989b4baaca710544c15a ]

The gap between the Tx status counters and the Rx RUNT counters is now
being added to allow correct reporting of the registers.

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -876,13 +876,16 @@ static void bcmgenet_update_mib_counters
 		case BCMGENET_STAT_NETDEV:
 		case BCMGENET_STAT_SOFT:
 			continue;
-		case BCMGENET_STAT_MIB_RX:
-		case BCMGENET_STAT_MIB_TX:
 		case BCMGENET_STAT_RUNT:
-			if (s->type != BCMGENET_STAT_MIB_RX)
-				offset = BCMGENET_STAT_OFFSET;
+			offset += BCMGENET_STAT_OFFSET;
+			/* fall through */
+		case BCMGENET_STAT_MIB_TX:
+			offset += BCMGENET_STAT_OFFSET;
+			/* fall through */
+		case BCMGENET_STAT_MIB_RX:
 			val = bcmgenet_umac_readl(priv,
 						  UMAC_MIB_START + j + offset);
+			offset = 0;	/* Reset Offset */
 			break;
 		case BCMGENET_STAT_MISC:
 			if (GENET_IS_V1(priv)) {

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 024/115] net: bcmgenet: reserved phy revisions must be checked first
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 023/115] net: bcmgenet: correct MIB access of UniMAC RUNT counters Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 025/115] net: bcmgenet: power down internal phy if open or resume fails Greg Kroah-Hartman
                   ` (89 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Doug Berger, Florian Fainelli,
	David S. Miller, Sasha Levin

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

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

From: Doug Berger <opendmb@gmail.com>


[ Upstream commit eca4bad73409aedc6ff22f823c18b67a4f08c851 ]

The reserved gphy_rev value of 0x01ff must be tested before the old
or new scheme for GPHY major versioning are tested, otherwise it will
be treated as 0xff00 according to the old scheme.

Fixes: b04a2f5b9ff5 ("net: bcmgenet: add support for new GENET PHY revision scheme")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3326,6 +3326,12 @@ static void bcmgenet_set_hw_params(struc
 	 */
 	gphy_rev = reg & 0xffff;
 
+	/* This is reserved so should require special treatment */
+	if (gphy_rev == 0 || gphy_rev == 0x01ff) {
+		pr_warn("Invalid GPHY revision detected: 0x%04x\n", gphy_rev);
+		return;
+	}
+
 	/* This is the good old scheme, just GPHY major, no minor nor patch */
 	if ((gphy_rev & 0xf0) != 0)
 		priv->gphy_rev = gphy_rev << 8;
@@ -3334,12 +3340,6 @@ static void bcmgenet_set_hw_params(struc
 	else if ((gphy_rev & 0xff00) != 0)
 		priv->gphy_rev = gphy_rev;
 
-	/* This is reserved so should require special treatment */
-	else if (gphy_rev == 0 || gphy_rev == 0x01ff) {
-		pr_warn("Invalid GPHY revision detected: 0x%04x\n", gphy_rev);
-		return;
-	}
-
 #ifdef CONFIG_PHYS_ADDR_T_64BIT
 	if (!(params->flags & GENET_HAS_40BITS))
 		pr_warn("GENET does not support 40-bits PA\n");

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 025/115] net: bcmgenet: power down internal phy if open or resume fails
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 024/115] net: bcmgenet: reserved phy revisions must be checked first Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 026/115] net: bcmgenet: Power up the internal PHY before probing the MII Greg Kroah-Hartman
                   ` (88 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Doug Berger, Florian Fainelli,
	David S. Miller, Sasha Levin

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

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

From: Doug Berger <opendmb@gmail.com>


[ Upstream commit 7627409cc4970e8c8b9de6945ad86a575290a94e ]

Since the internal PHY is powered up during the open and resume
functions it should be powered back down if the functions fail.

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2950,6 +2950,8 @@ err_irq0:
 err_fini_dma:
 	bcmgenet_fini_dma(priv);
 err_clk_disable:
+	if (priv->internal_phy)
+		bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
 	clk_disable_unprepare(priv->clk);
 	return ret;
 }
@@ -3653,6 +3655,8 @@ static int bcmgenet_resume(struct device
 	return 0;
 
 out_clk_disable:
+	if (priv->internal_phy)
+		bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
 	clk_disable_unprepare(priv->clk);
 	return ret;
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 026/115] net: bcmgenet: Power up the internal PHY before probing the MII
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 025/115] net: bcmgenet: power down internal phy if open or resume fails Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 027/115] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) Greg Kroah-Hartman
                   ` (87 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Doug Berger, Florian Fainelli,
	David S. Miller, Sasha Levin

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

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

From: Doug Berger <opendmb@gmail.com>


[ Upstream commit 6be371b053dc86f11465cc1abce2e99bda0a0574 ]

When using the internal PHY it must be powered up when the MII is probed
or the PHY will not be detected.  Since the PHY is powered up at reset
this has not been a problem.  However, when the kernel is restarted with
kexec the PHY will likely be powered down when the kernel starts so it
will not be detected and the Ethernet link will not be established.

This commit explicitly powers up the internal PHY when the GENET driver
is probed to correct this behavior.

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3384,6 +3384,7 @@ static int bcmgenet_probe(struct platfor
 	const void *macaddr;
 	struct resource *r;
 	int err = -EIO;
+	const char *phy_mode_str;
 
 	/* Up to GENET_MAX_MQ_CNT + 1 TX queues and RX queues */
 	dev = alloc_etherdev_mqs(sizeof(*priv), GENET_MAX_MQ_CNT + 1,
@@ -3489,6 +3490,13 @@ static int bcmgenet_probe(struct platfor
 		priv->clk_eee = NULL;
 	}
 
+	/* If this is an internal GPHY, power it on now, before UniMAC is
+	 * brought out of reset as absolutely no UniMAC activity is allowed
+	 */
+	if (dn && !of_property_read_string(dn, "phy-mode", &phy_mode_str) &&
+	    !strcasecmp(phy_mode_str, "internal"))
+		bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
+
 	err = reset_umac(priv);
 	if (err)
 		goto err_clk_disable;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 027/115] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL)
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 026/115] net: bcmgenet: Power up the internal PHY before probing the MII Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 028/115] NFSD: fix nfsd_reset_versions for NFSv4 Greg Kroah-Hartman
                   ` (86 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, NeilBrown, J. Bruce Fields, Sasha Levin

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

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

From: NeilBrown <neilb@suse.com>


[ Upstream commit 928c6fb3a9bfd6c5b287aa3465226add551c13c0 ]

Current code will return 1 if the version is supported,
and -1 if it isn't.
This is confusing and inconsistent with the one place where this
is used.
So change to return 1 if it is supported, and zero if not.
i.e. an error is never returned.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfsd/nfssvc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -151,7 +151,8 @@ int nfsd_vers(int vers, enum vers_op cha
 
 int nfsd_minorversion(u32 minorversion, enum vers_op change)
 {
-	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION)
+	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION &&
+	    change != NFSD_AVAIL)
 		return -1;
 	switch(change) {
 	case NFSD_SET:

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 028/115] NFSD: fix nfsd_reset_versions for NFSv4.
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 027/115] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 029/115] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list Greg Kroah-Hartman
                   ` (85 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, NeilBrown, J. Bruce Fields, Sasha Levin

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

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

From: NeilBrown <neilb@suse.com>


[ Upstream commit 800a938f0bf9130c8256116649c0cc5806bfb2fd ]

If you write "-2 -3 -4" to the "versions" file, it will
notice that no versions are enabled, and nfsd_reset_versions()
is called.
This enables all major versions, not no minor versions.
So we lose the invariant that NFSv4 is only advertised when
at least one minor is enabled.

Fix the code to explicitly enable minor versions for v4,
change it to use nfsd_vers() to test and set, and simplify
the code.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfsd/nfssvc.c |   25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -330,23 +330,20 @@ static void nfsd_last_thread(struct svc_
 
 void nfsd_reset_versions(void)
 {
-	int found_one = 0;
 	int i;
 
-	for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) {
-		if (nfsd_program.pg_vers[i])
-			found_one = 1;
-	}
+	for (i = 0; i < NFSD_NRVERS; i++)
+		if (nfsd_vers(i, NFSD_TEST))
+			return;
 
-	if (!found_one) {
-		for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++)
-			nfsd_program.pg_vers[i] = nfsd_version[i];
-#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
-		for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++)
-			nfsd_acl_program.pg_vers[i] =
-				nfsd_acl_version[i];
-#endif
-	}
+	for (i = 0; i < NFSD_NRVERS; i++)
+		if (i != 4)
+			nfsd_vers(i, NFSD_SET);
+		else {
+			int minor = 0;
+			while (nfsd_minorversion(minor, NFSD_SET) >= 0)
+				minor++;
+		}
 }
 
 /*

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 029/115] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 028/115] NFSD: fix nfsd_reset_versions for NFSv4 Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 030/115] drm/omap: fix dmabuf mmap for dma_alloced buffers Greg Kroah-Hartman
                   ` (84 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Menzel, Vojtech Pavlik,
	Marcos Paulo de Souza, Dmitry Torokhov, Sasha Levin

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

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

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>


[ Upstream commit a4c2a13129f7c5bcf81704c06851601593303fd5 ]

TUXEDO BU1406 does not implement active multiplexing mode properly,
and takes around 550 ms in i8042_set_mux_mode(). Given that the
device does not have external AUX port, there is no downside in
disabling the MUX mode.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Suggested-by: Vojtech Pavlik <vojtech@suse.cz>
Reviewed-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/input/serio/i8042-x86ia64io.h |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -520,6 +520,13 @@ static const struct dmi_system_id __init
 			DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
 		},
 	},
+	{
+		/* TUXEDO BU1406 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
+		},
+	},
 	{ }
 };
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 030/115] drm/omap: fix dmabuf mmap for dma_alloced buffers
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 029/115] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 031/115] netfilter: bridge: honor frag_max_size when refragmenting Greg Kroah-Hartman
                   ` (83 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tomi Valkeinen, Sasha Levin

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

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

From: Tomi Valkeinen <tomi.valkeinen@ti.com>


[ Upstream commit 9fa1d7537242bd580ffa99c4725a0407096aad26 ]

omap_gem_dmabuf_mmap() returns an error (with a WARN) when called for a
buffer which is allocated with dma_alloc_*(). This prevents dmabuf mmap
from working on SoCs without DMM, e.g. AM4 and OMAP3.

I could not find any reason for omap_gem_dmabuf_mmap() rejecting such
buffers, and just removing the if() fixes the limitation.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c |    3 ---
 1 file changed, 3 deletions(-)

--- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
@@ -142,9 +142,6 @@ static int omap_gem_dmabuf_mmap(struct d
 	struct drm_gem_object *obj = buffer->priv;
 	int ret = 0;
 
-	if (WARN_ON(!obj->filp))
-		return -EINVAL;
-
 	ret = drm_gem_mmap_obj(obj, omap_gem_mmap_size(obj), vma);
 	if (ret < 0)
 		return ret;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 031/115] netfilter: bridge: honor frag_max_size when refragmenting
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 030/115] drm/omap: fix dmabuf mmap for dma_alloced buffers Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 032/115] writeback: fix memory leak in wb_queue_work() Greg Kroah-Hartman
                   ` (82 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Florian Westphal, Pablo Neira Ayuso,
	Sasha Levin

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

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

From: Florian Westphal <fw@strlen.de>


[ Upstream commit 4ca60d08cbe65f501baad64af50fceba79c19fbb ]

consider a bridge with mtu 9000, but end host sending smaller
packets to another host with mtu < 9000.

In this case, after reassembly, bridge+defrag would refragment,
and then attempt to send the reassembled packet as long as it
was below 9k.

Instead we have to cap by the largest fragment size seen.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/bridge/br_netfilter_hooks.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- a/net/bridge/br_netfilter_hooks.c
+++ b/net/bridge/br_netfilter_hooks.c
@@ -701,18 +701,20 @@ static unsigned int nf_bridge_mtu_reduct
 
 static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
-	struct nf_bridge_info *nf_bridge;
-	unsigned int mtu_reserved;
+	struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
+	unsigned int mtu, mtu_reserved;
 
 	mtu_reserved = nf_bridge_mtu_reduction(skb);
+	mtu = skb->dev->mtu;
 
-	if (skb_is_gso(skb) || skb->len + mtu_reserved <= skb->dev->mtu) {
+	if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu)
+		mtu = nf_bridge->frag_max_size;
+
+	if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) {
 		nf_bridge_info_free(skb);
 		return br_dev_queue_push_xmit(net, sk, skb);
 	}
 
-	nf_bridge = nf_bridge_info_get(skb);
-
 	/* This is wrong! We should preserve the original fragment
 	 * boundaries by preserving frag_list rather than refragmenting.
 	 */

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 032/115] writeback: fix memory leak in wb_queue_work()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 031/115] netfilter: bridge: honor frag_max_size when refragmenting Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 033/115] net: wimax/i2400m: fix NULL-deref at probe Greg Kroah-Hartman
                   ` (81 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, John Sperbeck, Tahsin Erdogan,
	Jan Kara, Jens Axboe, Sasha Levin

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

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

From: Tahsin Erdogan <tahsin@google.com>


[ Upstream commit 4a3a485b1ed0e109718cc8c9d094fa0f552de9b2 ]

When WB_registered flag is not set, wb_queue_work() skips queuing the
work, but does not perform the necessary clean up. In particular, if
work->auto_free is true, it should free the memory.

The leak condition can be reprouced by following these steps:

   mount /dev/sdb /mnt/sdb
   /* In qemu console: device_del sdb */
   umount /dev/sdb

Above will result in a wb_queue_work() call on an unregistered wb and
thus leak memory.

Reported-by: John Sperbeck <jsperbeck@google.com>
Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/fs-writeback.c |   35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -173,19 +173,33 @@ static void wb_wakeup(struct bdi_writeba
 	spin_unlock_bh(&wb->work_lock);
 }
 
+static void finish_writeback_work(struct bdi_writeback *wb,
+				  struct wb_writeback_work *work)
+{
+	struct wb_completion *done = work->done;
+
+	if (work->auto_free)
+		kfree(work);
+	if (done && atomic_dec_and_test(&done->cnt))
+		wake_up_all(&wb->bdi->wb_waitq);
+}
+
 static void wb_queue_work(struct bdi_writeback *wb,
 			  struct wb_writeback_work *work)
 {
 	trace_writeback_queue(wb, work);
 
-	spin_lock_bh(&wb->work_lock);
-	if (!test_bit(WB_registered, &wb->state))
-		goto out_unlock;
 	if (work->done)
 		atomic_inc(&work->done->cnt);
-	list_add_tail(&work->list, &wb->work_list);
-	mod_delayed_work(bdi_wq, &wb->dwork, 0);
-out_unlock:
+
+	spin_lock_bh(&wb->work_lock);
+
+	if (test_bit(WB_registered, &wb->state)) {
+		list_add_tail(&work->list, &wb->work_list);
+		mod_delayed_work(bdi_wq, &wb->dwork, 0);
+	} else
+		finish_writeback_work(wb, work);
+
 	spin_unlock_bh(&wb->work_lock);
 }
 
@@ -1839,16 +1853,9 @@ static long wb_do_writeback(struct bdi_w
 
 	set_bit(WB_writeback_running, &wb->state);
 	while ((work = get_next_work_item(wb)) != NULL) {
-		struct wb_completion *done = work->done;
-
 		trace_writeback_exec(wb, work);
-
 		wrote += wb_writeback(wb, work);
-
-		if (work->auto_free)
-			kfree(work);
-		if (done && atomic_dec_and_test(&done->cnt))
-			wake_up_all(&wb->bdi->wb_waitq);
+		finish_writeback_work(wb, work);
 	}
 
 	/*

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 033/115] net: wimax/i2400m: fix NULL-deref at probe
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 032/115] writeback: fix memory leak in wb_queue_work() Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 034/115] dmaengine: Fix array index out of bounds warning in __get_unmap_pool() Greg Kroah-Hartman
                   ` (80 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Inaky Perez-Gonzalez, Johan Hovold,
	David S. Miller, Sasha Levin

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

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

From: Johan Hovold <johan@kernel.org>


[ Upstream commit 6e526fdff7be4f13b24f929a04c0e9ae6761291e ]

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory beyond the endpoint array should a
malicious device lack the expected endpoints.

The endpoints are specifically dereferenced in the i2400m_bootrom_init
path during probe (e.g. in i2400mu_tx_bulk_out).

Fixes: f398e4240fce ("i2400m/USB: probe/disconnect, dev init/shutdown
and reset backends")
Cc: Inaky Perez-Gonzalez <inaky@linux.intel.com>

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/wimax/i2400m/usb.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/wimax/i2400m/usb.c
+++ b/drivers/net/wimax/i2400m/usb.c
@@ -467,6 +467,9 @@ int i2400mu_probe(struct usb_interface *
 	struct i2400mu *i2400mu;
 	struct usb_device *usb_dev = interface_to_usbdev(iface);
 
+	if (iface->cur_altsetting->desc.bNumEndpoints < 4)
+		return -ENODEV;
+
 	if (usb_dev->speed != USB_SPEED_HIGH)
 		dev_err(dev, "device not connected as high speed\n");
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 034/115] dmaengine: Fix array index out of bounds warning in __get_unmap_pool()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 033/115] net: wimax/i2400m: fix NULL-deref at probe Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 035/115] net: Resend IGMP memberships upon peer notification Greg Kroah-Hartman
                   ` (79 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Matthias Kaehlcke, Dan Williams,
	Vinod Koul, Sasha Levin

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

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

From: Matthias Kaehlcke <mka@chromium.org>


[ Upstream commit 23f963e91fd81f44f6b316b1c24db563354c6be8 ]

This fixes the following warning when building with clang and
CONFIG_DMA_ENGINE_RAID=n :

drivers/dma/dmaengine.c:1102:11: error: array index 2 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]
                return &unmap_pool[2];
                        ^          ~
drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here
static struct dmaengine_unmap_pool unmap_pool[] = {
^
drivers/dma/dmaengine.c:1104:11: error: array index 3 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]
                return &unmap_pool[3];
                        ^          ~
drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here
static struct dmaengine_unmap_pool unmap_pool[] = {

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/dmaengine.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -1023,12 +1023,14 @@ static struct dmaengine_unmap_pool *__ge
 	switch (order) {
 	case 0 ... 1:
 		return &unmap_pool[0];
+#if IS_ENABLED(CONFIG_DMA_ENGINE_RAID)
 	case 2 ... 4:
 		return &unmap_pool[1];
 	case 5 ... 7:
 		return &unmap_pool[2];
 	case 8:
 		return &unmap_pool[3];
+#endif
 	default:
 		BUG();
 		return NULL;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 035/115] net: Resend IGMP memberships upon peer notification.
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 034/115] dmaengine: Fix array index out of bounds warning in __get_unmap_pool() Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 036/115] mlxsw: reg: Fix SPVM max record count Greg Kroah-Hartman
                   ` (78 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vladislav Yasevich,
	Michael S. Tsirkin, David S. Miller, Sasha Levin

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

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

From: Vlad Yasevich <vyasevich@gmail.com>


[ Upstream commit 37c343b4f4e70e9dc328ab04903c0ec8d154c1a4 ]

When we notify peers of potential changes,  it's also good to update
IGMP memberships.  For example, during VM migration, updating IGMP
memberships will redirect existing multicast streams to the VM at the
new location.

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/dev.c |    1 +
 1 file changed, 1 insertion(+)

--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1300,6 +1300,7 @@ void netdev_notify_peers(struct net_devi
 {
 	rtnl_lock();
 	call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
+	call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev);
 	rtnl_unlock();
 }
 EXPORT_SYMBOL(netdev_notify_peers);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 036/115] mlxsw: reg: Fix SPVM max record count
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 035/115] net: Resend IGMP memberships upon peer notification Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 037/115] mlxsw: reg: Fix SPVMLR " Greg Kroah-Hartman
                   ` (77 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Pirko, Ido Schimmel,
	David S. Miller, Sasha Levin

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

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

From: Jiri Pirko <jiri@mellanox.com>


[ Upstream commit f004ec065b4879d6bc9ba0211af2169b3ce3097f ]

The num_rec field is 8 bit, so the maximal count number is 255. This
fixes vlans not being enabled for wider ranges than 255.

Fixes: b2e345f9a454 ("mlxsw: reg: Add Switch Port VID and Switch Port VLAN Membership registers definitions")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/mellanox/mlxsw/reg.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
@@ -599,7 +599,7 @@ static inline void mlxsw_reg_spvid_pack(
 #define MLXSW_REG_SPVM_ID 0x200F
 #define MLXSW_REG_SPVM_BASE_LEN 0x04 /* base length, without records */
 #define MLXSW_REG_SPVM_REC_LEN 0x04 /* record length */
-#define MLXSW_REG_SPVM_REC_MAX_COUNT 256
+#define MLXSW_REG_SPVM_REC_MAX_COUNT 255
 #define MLXSW_REG_SPVM_LEN (MLXSW_REG_SPVM_BASE_LEN +	\
 		    MLXSW_REG_SPVM_REC_LEN * MLXSW_REG_SPVM_REC_MAX_COUNT)
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 037/115] mlxsw: reg: Fix SPVMLR max record count
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 036/115] mlxsw: reg: Fix SPVM max record count Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 038/115] intel_th: pci: Add Gemini Lake support Greg Kroah-Hartman
                   ` (76 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Pirko, Ido Schimmel,
	David S. Miller, Sasha Levin

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

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

From: Jiri Pirko <jiri@mellanox.com>


[ Upstream commit e9093b1183bbac462d2caef3eac165778c0b1bf1 ]

The num_rec field is 8 bit, so the maximal count number is 255.
This fixes vlans learning not being enabled for wider ranges than 255.

Fixes: a4feea74cd7a ("mlxsw: reg: Add Switch Port VLAN MAC Learning register definition")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/mellanox/mlxsw/reg.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
@@ -1139,7 +1139,7 @@ static inline void mlxsw_reg_sfmr_pack(c
 #define MLXSW_REG_SPVMLR_ID 0x2020
 #define MLXSW_REG_SPVMLR_BASE_LEN 0x04 /* base length, without records */
 #define MLXSW_REG_SPVMLR_REC_LEN 0x04 /* record length */
-#define MLXSW_REG_SPVMLR_REC_MAX_COUNT 256
+#define MLXSW_REG_SPVMLR_REC_MAX_COUNT 255
 #define MLXSW_REG_SPVMLR_LEN (MLXSW_REG_SPVMLR_BASE_LEN + \
 			      MLXSW_REG_SPVMLR_REC_LEN * \
 			      MLXSW_REG_SPVMLR_REC_MAX_COUNT)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 038/115] intel_th: pci: Add Gemini Lake support
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 037/115] mlxsw: reg: Fix SPVMLR " Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 039/115] openrisc: fix issue handling 8 byte get_user calls Greg Kroah-Hartman
                   ` (75 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alexander Shishkin, Sasha Levin

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

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

From: Alexander Shishkin <alexander.shishkin@linux.intel.com>


[ Upstream commit 340837f985c2cb87ca0868d4aa9ce42b0fab3a21 ]

This adds Intel(R) Trace Hub PCI ID for Gemini Lake SOC.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hwtracing/intel_th/pci.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/hwtracing/intel_th/pci.c
+++ b/drivers/hwtracing/intel_th/pci.c
@@ -82,6 +82,11 @@ static const struct pci_device_id intel_
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x9da6),
 		.driver_data = (kernel_ulong_t)0,
 	},
+	{
+		/* Gemini Lake */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
+		.driver_data = (kernel_ulong_t)0,
+	},
 	{ 0 },
 };
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 039/115] openrisc: fix issue handling 8 byte get_user calls
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 038/115] intel_th: pci: Add Gemini Lake support Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status Greg Kroah-Hartman
                   ` (74 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Stafford Horne, Sasha Levin

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

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

From: Stafford Horne <shorne@gmail.com>


[ Upstream commit 154e67cd8e8f964809d0e75e44bb121b169c75b3 ]

Was getting the following error with allmodconfig:

  ERROR: "__get_user_bad" [lib/test_user_copy.ko] undefined!

This was simply a missing break statement, causing an unwanted fall
through.

Signed-off-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/openrisc/include/asm/uaccess.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
@@ -215,7 +215,7 @@ do {									\
 	case 1: __get_user_asm(x, ptr, retval, "l.lbz"); break;		\
 	case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break;		\
 	case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break;		\
-	case 8: __get_user_asm2(x, ptr, retval);			\
+	case 8: __get_user_asm2(x, ptr, retval); break;			\
 	default: (x) = __get_user_bad();				\
 	}								\
 } while (0)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 039/115] openrisc: fix issue handling 8 byte get_user calls Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2018-01-19  0:29   ` Ben Hutchings
  2017-12-18 15:48 ` [PATCH 4.4 041/115] scsi: hpsa: limit outstanding rescans Greg Kroah-Hartman
                   ` (73 subsequent siblings)
  112 siblings, 1 reply; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Scott Benesh, Scott Teel, Don Brace,
	Martin K. Petersen, Sasha Levin

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

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

From: Don Brace <don.brace@microsemi.com>


[ Upstream commit 85b29008d8af6d94a0723aaa8d93cfb6e041158b ]

 - Add in a new case for volume offline. Resolves internal testing bug
   for multilun array management.
 - Return correct status for failed TURs.

Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/hpsa.c     |   35 ++++++++++++++++-------------------
 drivers/scsi/hpsa_cmd.h |    2 ++
 2 files changed, 18 insertions(+), 19 deletions(-)

--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3466,7 +3466,7 @@ exit_failed:
  *  # (integer code indicating one of several NOT READY states
  *     describing why a volume is to be kept offline)
  */
-static int hpsa_volume_offline(struct ctlr_info *h,
+static unsigned char hpsa_volume_offline(struct ctlr_info *h,
 					unsigned char scsi3addr[])
 {
 	struct CommandList *c;
@@ -3486,7 +3486,7 @@ static int hpsa_volume_offline(struct ct
 	rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT);
 	if (rc) {
 		cmd_free(h, c);
-		return 0;
+		return HPSA_VPD_LV_STATUS_UNSUPPORTED;
 	}
 	sense = c->err_info->SenseInfo;
 	if (c->err_info->SenseLen > sizeof(c->err_info->SenseInfo))
@@ -3497,19 +3497,13 @@ static int hpsa_volume_offline(struct ct
 	cmd_status = c->err_info->CommandStatus;
 	scsi_status = c->err_info->ScsiStatus;
 	cmd_free(h, c);
-	/* Is the volume 'not ready'? */
-	if (cmd_status != CMD_TARGET_STATUS ||
-		scsi_status != SAM_STAT_CHECK_CONDITION ||
-		sense_key != NOT_READY ||
-		asc != ASC_LUN_NOT_READY)  {
-		return 0;
-	}
 
 	/* Determine the reason for not ready state */
 	ldstat = hpsa_get_volume_status(h, scsi3addr);
 
 	/* Keep volume offline in certain cases: */
 	switch (ldstat) {
+	case HPSA_LV_FAILED:
 	case HPSA_LV_UNDERGOING_ERASE:
 	case HPSA_LV_NOT_AVAILABLE:
 	case HPSA_LV_UNDERGOING_RPI:
@@ -3531,7 +3525,7 @@ static int hpsa_volume_offline(struct ct
 	default:
 		break;
 	}
-	return 0;
+	return HPSA_LV_OK;
 }
 
 /*
@@ -3615,10 +3609,10 @@ static int hpsa_update_device_info(struc
 	/* Do an inquiry to the device to see what it is. */
 	if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
 		(unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
-		/* Inquiry failed (msg printed already) */
 		dev_err(&h->pdev->dev,
-			"hpsa_update_device_info: inquiry failed\n");
-		rc = -EIO;
+			"%s: inquiry failed, device will be skipped.\n",
+			__func__);
+		rc = HPSA_INQUIRY_FAILED;
 		goto bail_out;
 	}
 
@@ -3638,15 +3632,19 @@ static int hpsa_update_device_info(struc
 
 	if (this_device->devtype == TYPE_DISK &&
 		is_logical_dev_addr_mode(scsi3addr)) {
-		int volume_offline;
+		unsigned char volume_offline;
 
 		hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
 		if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
 			hpsa_get_ioaccel_status(h, scsi3addr, this_device);
 		volume_offline = hpsa_volume_offline(h, scsi3addr);
-		if (volume_offline < 0 || volume_offline > 0xff)
-			volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED;
-		this_device->volume_offline = volume_offline & 0xff;
+		if (volume_offline == HPSA_LV_FAILED) {
+			rc = HPSA_LV_FAILED;
+			dev_err(&h->pdev->dev,
+				"%s: LV failed, device will be skipped.\n",
+				__func__);
+			goto bail_out;
+		}
 	} else {
 		this_device->raid_level = RAID_UNKNOWN;
 		this_device->offload_config = 0;
@@ -4115,8 +4113,7 @@ static void hpsa_update_scsi_devices(str
 			goto out;
 		}
 		if (rc) {
-			dev_warn(&h->pdev->dev,
-				"Inquiry failed, skipping device.\n");
+			h->drv_req_rescan = 1;
 			continue;
 		}
 
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -155,6 +155,7 @@
 #define CFGTBL_BusType_Fibre2G  0x00000200l
 
 /* VPD Inquiry types */
+#define HPSA_INQUIRY_FAILED		0x02
 #define HPSA_VPD_SUPPORTED_PAGES        0x00
 #define HPSA_VPD_LV_DEVICE_GEOMETRY     0xC1
 #define HPSA_VPD_LV_IOACCEL_STATUS      0xC2
@@ -164,6 +165,7 @@
 /* Logical volume states */
 #define HPSA_VPD_LV_STATUS_UNSUPPORTED			0xff
 #define HPSA_LV_OK                                      0x0
+#define HPSA_LV_FAILED					0x01
 #define HPSA_LV_NOT_AVAILABLE				0x0b
 #define HPSA_LV_UNDERGOING_ERASE			0x0F
 #define HPSA_LV_UNDERGOING_RPI				0x12

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 041/115] scsi: hpsa: limit outstanding rescans
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 042/115] fjes: Fix wrong netdevice feature flags Greg Kroah-Hartman
                   ` (72 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Scott Benesh, Scott Teel,
	Tomas Henzl, Don Brace, Martin K. Petersen, Sasha Levin

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

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

From: Don Brace <don.brace@microsemi.com>


[ Upstream commit 87b9e6aa87d9411f1059aa245c0c79976bc557ac ]

Avoid rescan storms. No need to queue another if one is pending.

Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/hpsa.c |   16 +++++++++++++++-
 drivers/scsi/hpsa.h |    1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5254,7 +5254,7 @@ static void hpsa_scan_complete(struct ct
 
 	spin_lock_irqsave(&h->scan_lock, flags);
 	h->scan_finished = 1;
-	wake_up_all(&h->scan_wait_queue);
+	wake_up(&h->scan_wait_queue);
 	spin_unlock_irqrestore(&h->scan_lock, flags);
 }
 
@@ -5272,11 +5272,23 @@ static void hpsa_scan_start(struct Scsi_
 	if (unlikely(lockup_detected(h)))
 		return hpsa_scan_complete(h);
 
+	/*
+	 * If a scan is already waiting to run, no need to add another
+	 */
+	spin_lock_irqsave(&h->scan_lock, flags);
+	if (h->scan_waiting) {
+		spin_unlock_irqrestore(&h->scan_lock, flags);
+		return;
+	}
+
+	spin_unlock_irqrestore(&h->scan_lock, flags);
+
 	/* wait until any scan already in progress is finished. */
 	while (1) {
 		spin_lock_irqsave(&h->scan_lock, flags);
 		if (h->scan_finished)
 			break;
+		h->scan_waiting = 1;
 		spin_unlock_irqrestore(&h->scan_lock, flags);
 		wait_event(h->scan_wait_queue, h->scan_finished);
 		/* Note: We don't need to worry about a race between this
@@ -5286,6 +5298,7 @@ static void hpsa_scan_start(struct Scsi_
 		 */
 	}
 	h->scan_finished = 0; /* mark scan as in progress */
+	h->scan_waiting = 0;
 	spin_unlock_irqrestore(&h->scan_lock, flags);
 
 	if (unlikely(lockup_detected(h)))
@@ -8502,6 +8515,7 @@ reinit_after_soft_reset:
 	init_waitqueue_head(&h->event_sync_wait_queue);
 	mutex_init(&h->reset_mutex);
 	h->scan_finished = 1; /* no scan currently in progress */
+	h->scan_waiting = 0;
 
 	pci_set_drvdata(pdev, h);
 	h->ndevices = 0;
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -200,6 +200,7 @@ struct ctlr_info {
 	dma_addr_t		errinfo_pool_dhandle;
 	unsigned long  		*cmd_pool_bits;
 	int			scan_finished;
+	u8			scan_waiting : 1;
 	spinlock_t		scan_lock;
 	wait_queue_head_t	scan_wait_queue;
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 042/115] fjes: Fix wrong netdevice feature flags
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 041/115] scsi: hpsa: limit outstanding rescans Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 044/115] sched/deadline: Make sure the replenishment timer fires in the next period Greg Kroah-Hartman
                   ` (71 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Taku Izumi, David S. Miller, Sasha Levin

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

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

From: Taku Izumi <izumi.taku@jp.fujitsu.com>


[ Upstream commit fe8daf5fa715f7214952f06a387e4b7de818c5be ]

This patch fixes netdev->features for Extended Socket network device.

Currently Extended Socket network device's netdev->feature claims
NETIF_F_HW_CSUM, however this is completely wrong. There's no feature
of checksum offloading.
That causes invalid TCP/UDP checksum and packet rejection when IP
forwarding from Extended Socket network device to other network device.

NETIF_F_HW_CSUM should be omitted.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/fjes/fjes_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/fjes/fjes_main.c
+++ b/drivers/net/fjes/fjes_main.c
@@ -1205,7 +1205,7 @@ static void fjes_netdev_setup(struct net
 	fjes_set_ethtool_ops(netdev);
 	netdev->mtu = fjes_support_mtu[0];
 	netdev->flags |= IFF_BROADCAST;
-	netdev->features |= NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_FILTER;
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 }
 
 static void fjes_irq_watch_task(struct work_struct *work)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 044/115] sched/deadline: Make sure the replenishment timer fires in the next period
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 042/115] fjes: Fix wrong netdevice feature flags Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline Greg Kroah-Hartman
                   ` (70 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniel Bristot de Oliveira,
	Peter Zijlstra (Intel), Luca Abeni, Steven Rostedt (VMware),
	Juri Lelli, Linus Torvalds, Mike Galbraith,
	Romulo Silva de Oliveira, Thomas Gleixner, Tommaso Cucinotta,
	Ingo Molnar, Sasha Levin

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

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

From: Daniel Bristot de Oliveira <bristot@redhat.com>


[ Upstream commit 5ac69d37784b237707a7b15d199cdb6c6fdb6780 ]

Currently, the replenishment timer is set to fire at the deadline
of a task. Although that works for implicit deadline tasks because the
deadline is equals to the begin of the next period, that is not correct
for constrained deadline tasks (deadline < period).

For instance:

f.c:
 --------------- %< ---------------
int main (void)
{
	for(;;);
}
 --------------- >% ---------------

  # gcc -o f f.c

  # trace-cmd record -e sched:sched_switch                              \
				   -e syscalls:sys_exit_sched_setattr   \
   chrt -d --sched-runtime  490000000					\
           --sched-deadline 500000000					\
	   --sched-period  1000000000 0 ./f

  # trace-cmd report | grep "{pid of ./f}"

After setting parameters, the task is replenished and continue running
until being throttled:

         f-11295 [003] 13322.113776: sys_exit_sched_setattr: 0x0

The task is throttled after running 492318 ms, as expected:

         f-11295 [003] 13322.606094: sched_switch:   f:11295 [-1] R ==> watchdog/3:32 [0]

But then, the task is replenished 500719 ms after the first
replenishment:

    <idle>-0     [003] 13322.614495: sched_switch:   swapper/3:0 [120] R ==> f:11295 [-1]

Running for 490277 ms:

         f-11295 [003] 13323.104772: sched_switch:   f:11295 [-1] R ==>  swapper/3:0 [120]

Hence, in the first period, the task runs 2 * runtime, and that is a bug.

During the first replenishment, the next deadline is set one period away.
So the runtime / period starts to be respected. However, as the second
replenishment took place in the wrong instant, the next replenishment
will also be held in a wrong instant of time. Rather than occurring in
the nth period away from the first activation, it is taking place
in the (nth period - relative deadline).

Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Luca Abeni <luca.abeni@santannapisa.it>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Romulo Silva de Oliveira <romulo.deoliveira@ufsc.br>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
Link: http://lkml.kernel.org/r/ac50d89887c25285b47465638354b63362f8adff.1488392936.git.bristot@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/sched/deadline.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -510,10 +510,15 @@ static void update_dl_entity(struct sche
 	}
 }
 
+static inline u64 dl_next_period(struct sched_dl_entity *dl_se)
+{
+	return dl_se->deadline - dl_se->dl_deadline + dl_se->dl_period;
+}
+
 /*
  * If the entity depleted all its runtime, and if we want it to sleep
  * while waiting for some new execution time to become available, we
- * set the bandwidth enforcement timer to the replenishment instant
+ * set the bandwidth replenishment timer to the replenishment instant
  * and try to activate it.
  *
  * Notice that it is important for the caller to know if the timer
@@ -535,7 +540,7 @@ static int start_dl_timer(struct task_st
 	 * that it is actually coming from rq->clock and not from
 	 * hrtimer's time base reading.
 	 */
-	act = ns_to_ktime(dl_se->deadline);
+	act = ns_to_ktime(dl_next_period(dl_se));
 	now = hrtimer_cb_get_time(timer);
 	delta = ktime_to_ns(now) - rq_clock(rq);
 	act = ktime_add_ns(act, delta);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 044/115] sched/deadline: Make sure the replenishment timer fires in the next period Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2018-01-19  1:00   ` Ben Hutchings
  2017-12-18 15:48 ` [PATCH 4.4 046/115] sched/deadline: Use deadline instead of period when calculating overflow Greg Kroah-Hartman
                   ` (69 subsequent siblings)
  112 siblings, 1 reply; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniel Bristot de Oliveira,
	Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

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

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

From: Daniel Bristot de Oliveira <bristot@redhat.com>


[ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]

During the activation, CBS checks if it can reuse the current task's
runtime and period. If the deadline of the task is in the past, CBS
cannot use the runtime, and so it replenishes the task. This rule
works fine for implicit deadline tasks (deadline == period), and the
CBS was designed for implicit deadline tasks. However, a task with
constrained deadline (deadine < period) might be awakened after the
deadline, but before the next period. In this case, replenishing the
task would allow it to run for runtime / deadline. As in this case
deadline < period, CBS enables a task to run for more than the
runtime / period. In a very loaded system, this can cause a domino
effect, making other tasks miss their deadlines.

To avoid this problem, in the activation of a constrained deadline
task after the deadline but before the next period, throttle the
task and set the replenishing timer to the begin of the next period,
unless it is boosted.

Reproducer:

 --------------- %< ---------------
  int main (int argc, char **argv)
  {
	int ret;
	int flags = 0;
	unsigned long l = 0;
	struct timespec ts;
	struct sched_attr attr;

	memset(&attr, 0, sizeof(attr));
	attr.size = sizeof(attr);

	attr.sched_policy   = SCHED_DEADLINE;
	attr.sched_runtime  = 2 * 1000 * 1000;		/* 2 ms */
	attr.sched_deadline = 2 * 1000 * 1000;		/* 2 ms */
	attr.sched_period   = 2 * 1000 * 1000 * 1000;	/* 2 s */

	ts.tv_sec = 0;
	ts.tv_nsec = 2000 * 1000;			/* 2 ms */

	ret = sched_setattr(0, &attr, flags);

	if (ret < 0) {
		perror("sched_setattr");
		exit(-1);
	}

	for(;;) {
		/* XXX: you may need to adjust the loop */
		for (l = 0; l < 150000; l++);
		/*
		 * The ideia is to go to sleep right before the deadline
		 * and then wake up before the next period to receive
		 * a new replenishment.
		 */
		nanosleep(&ts, NULL);
	}

	exit(0);
  }
  --------------- >% ---------------

On my box, this reproducer uses almost 50% of the CPU time, which is
obviously wrong for a task with 2/2000 reservation.

Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luca Abeni <luca.abeni@santannapisa.it>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Romulo Silva de Oliveira <romulo.deoliveira@ufsc.br>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
Link: http://lkml.kernel.org/r/edf58354e01db46bf42df8d2dd32418833f68c89.1488392936.git.bristot@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/sched/deadline.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -704,6 +704,37 @@ void init_dl_task_timer(struct sched_dl_
 	timer->function = dl_task_timer;
 }
 
+/*
+ * During the activation, CBS checks if it can reuse the current task's
+ * runtime and period. If the deadline of the task is in the past, CBS
+ * cannot use the runtime, and so it replenishes the task. This rule
+ * works fine for implicit deadline tasks (deadline == period), and the
+ * CBS was designed for implicit deadline tasks. However, a task with
+ * constrained deadline (deadine < period) might be awakened after the
+ * deadline, but before the next period. In this case, replenishing the
+ * task would allow it to run for runtime / deadline. As in this case
+ * deadline < period, CBS enables a task to run for more than the
+ * runtime / period. In a very loaded system, this can cause a domino
+ * effect, making other tasks miss their deadlines.
+ *
+ * To avoid this problem, in the activation of a constrained deadline
+ * task after the deadline but before the next period, throttle the
+ * task and set the replenishing timer to the begin of the next period,
+ * unless it is boosted.
+ */
+static inline void dl_check_constrained_dl(struct sched_dl_entity *dl_se)
+{
+	struct task_struct *p = dl_task_of(dl_se);
+	struct rq *rq = rq_of_dl_rq(dl_rq_of_se(dl_se));
+
+	if (dl_time_before(dl_se->deadline, rq_clock(rq)) &&
+	    dl_time_before(rq_clock(rq), dl_next_period(dl_se))) {
+		if (unlikely(dl_se->dl_boosted || !start_dl_timer(p)))
+			return;
+		dl_se->dl_throttled = 1;
+	}
+}
+
 static
 int dl_runtime_exceeded(struct sched_dl_entity *dl_se)
 {
@@ -958,6 +989,11 @@ static void dequeue_dl_entity(struct sch
 	__dequeue_dl_entity(dl_se);
 }
 
+static inline bool dl_is_constrained(struct sched_dl_entity *dl_se)
+{
+	return dl_se->dl_deadline < dl_se->dl_period;
+}
+
 static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct task_struct *pi_task = rt_mutex_get_top_task(p);
@@ -984,6 +1020,15 @@ static void enqueue_task_dl(struct rq *r
 	}
 
 	/*
+	 * Check if a constrained deadline task was activated
+	 * after the deadline but before the next period.
+	 * If that is the case, the task will be throttled and
+	 * the replenishment timer will be set to the next period.
+	 */
+	if (!p->dl.dl_throttled && dl_is_constrained(&p->dl))
+		dl_check_constrained_dl(&p->dl);
+
+	/*
 	 * If p is throttled, we do nothing. In fact, if it exhausted
 	 * its budget it needs a replenishment and, since it now is on
 	 * its rq, the bandwidth timer callback (which clearly has not

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 046/115] sched/deadline: Use deadline instead of period when calculating overflow
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 047/115] mmc: mediatek: Fixed bug where clock frequency could be set wrong Greg Kroah-Hartman
                   ` (68 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Steven Rostedt (VMware),
	Peter Zijlstra (Intel),
	Daniel Bristot de Oliveira, Juri Lelli, Linus Torvalds,
	Luca Abeni, Mike Galbraith, Romulo Silva de Oliveira,
	Thomas Gleixner, Tommaso Cucinotta, Ingo Molnar, Sasha Levin

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

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

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>


[ Upstream commit 2317d5f1c34913bac5971d93d69fb6c31bb74670 ]

I was testing Daniel's changes with his test case, and tweaked it a
little. Instead of having the runtime equal to the deadline, I
increased the deadline ten fold.

Daniel's test case had:

	attr.sched_runtime  = 2 * 1000 * 1000;		/* 2 ms */
	attr.sched_deadline = 2 * 1000 * 1000;		/* 2 ms */
	attr.sched_period   = 2 * 1000 * 1000 * 1000;	/* 2 s */

To make it more interesting, I changed it to:

	attr.sched_runtime  =  2 * 1000 * 1000;		/* 2 ms */
	attr.sched_deadline = 20 * 1000 * 1000;		/* 20 ms */
	attr.sched_period   =  2 * 1000 * 1000 * 1000;	/* 2 s */

The results were rather surprising. The behavior that Daniel's patch
was fixing came back. The task started using much more than .1% of the
CPU. More like 20%.

Looking into this I found that it was due to the dl_entity_overflow()
constantly returning true. That's because it uses the relative period
against relative runtime vs the absolute deadline against absolute
runtime.

  runtime / (deadline - t) > dl_runtime / dl_period

There's even a comment mentioning this, and saying that when relative
deadline equals relative period, that the equation is the same as using
deadline instead of period. That comment is backwards! What we really
want is:

  runtime / (deadline - t) > dl_runtime / dl_deadline

We care about if the runtime can make its deadline, not its period. And
then we can say "when the deadline equals the period, the equation is
the same as using dl_period instead of dl_deadline".

After correcting this, now when the task gets enqueued, it can throttle
correctly, and Daniel's fix to the throttling of sleeping deadline
tasks works even when the runtime and deadline are not the same.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luca Abeni <luca.abeni@santannapisa.it>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Romulo Silva de Oliveira <romulo.deoliveira@ufsc.br>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
Link: http://lkml.kernel.org/r/02135a27f1ae3fe5fd032568a5a2f370e190e8d7.1488392936.git.bristot@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/sched/deadline.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -441,13 +441,13 @@ static void replenish_dl_entity(struct s
  *
  * This function returns true if:
  *
- *   runtime / (deadline - t) > dl_runtime / dl_period ,
+ *   runtime / (deadline - t) > dl_runtime / dl_deadline ,
  *
  * IOW we can't recycle current parameters.
  *
- * Notice that the bandwidth check is done against the period. For
+ * Notice that the bandwidth check is done against the deadline. For
  * task with deadline equal to period this is the same of using
- * dl_deadline instead of dl_period in the equation above.
+ * dl_period instead of dl_deadline in the equation above.
  */
 static bool dl_entity_overflow(struct sched_dl_entity *dl_se,
 			       struct sched_dl_entity *pi_se, u64 t)
@@ -472,7 +472,7 @@ static bool dl_entity_overflow(struct sc
 	 * of anything below microseconds resolution is actually fiction
 	 * (but still we want to give the user that illusion >;).
 	 */
-	left = (pi_se->dl_period >> DL_SCALE) * (dl_se->runtime >> DL_SCALE);
+	left = (pi_se->dl_deadline >> DL_SCALE) * (dl_se->runtime >> DL_SCALE);
 	right = ((dl_se->deadline - t) >> DL_SCALE) *
 		(pi_se->dl_runtime >> DL_SCALE);
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 047/115] mmc: mediatek: Fixed bug where clock frequency could be set wrong
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 046/115] sched/deadline: Use deadline instead of period when calculating overflow Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 048/115] drm/radeon: reinstate oland workaround for sclk Greg Kroah-Hartman
                   ` (67 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yong Mao, Chaotian Jing,
	Daniel Kurtz, Ulf Hansson, Sasha Levin

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

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

From: yong mao <yong.mao@mediatek.com>


[ Upstream commit 40ceda09c8c84694c2ca6b00bcc6dc71e8e62d96 ]

This patch can fix two issues:

Issue 1:
In previous code, div may be overflow when setting clock frequency
as f_min. We can use DIV_ROUND_UP to fix this boundary related
issue.

Issue 2:
In previous code, we can not set the correct clock frequency when
div equals 0xff.

Signed-off-by: Yong Mao <yong.mao@mediatek.com>
Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mmc/host/mtk-sd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -570,7 +570,7 @@ static void msdc_set_mclk(struct msdc_ho
 		}
 	}
 	sdr_set_field(host->base + MSDC_CFG, MSDC_CFG_CKMOD | MSDC_CFG_CKDIV,
-			(mode << 8) | (div % 0xff));
+		      (mode << 8) | div);
 	sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN);
 	while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB))
 		cpu_relax();
@@ -1540,7 +1540,7 @@ static int msdc_drv_probe(struct platfor
 	host->src_clk_freq = clk_get_rate(host->src_clk);
 	/* Set host parameters to mmc */
 	mmc->ops = &mt_msdc_ops;
-	mmc->f_min = host->src_clk_freq / (4 * 255);
+	mmc->f_min = DIV_ROUND_UP(host->src_clk_freq, 4 * 255);
 
 	mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;
 	mmc->caps |= MMC_CAP_RUNTIME_RESUME;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 048/115] drm/radeon: reinstate oland workaround for sclk
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 047/115] mmc: mediatek: Fixed bug where clock frequency could be set wrong Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 049/115] afs: Fix missing put_page() Greg Kroah-Hartman
                   ` (66 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alex Deucher, Sasha Levin

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

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

From: Alex Deucher <alexander.deucher@amd.com>


[ Upstream commit 66822d815ae61ecb2d9dba9031517e8a8476969d ]

Higher sclks seem to be unstable on some boards.

bug: https://bugs.freedesktop.org/show_bug.cgi?id=100222

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/radeon/si_dpm.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -3030,9 +3030,13 @@ static void si_apply_state_adjust_rules(
 			max_mclk = 80000;
 		}
 	} else if (rdev->family == CHIP_OLAND) {
-		if ((rdev->pdev->device == 0x6604) &&
-		    (rdev->pdev->subsystem_vendor == 0x1028) &&
-		    (rdev->pdev->subsystem_device == 0x066F)) {
+		if ((rdev->pdev->revision == 0xC7) ||
+		    (rdev->pdev->revision == 0x80) ||
+		    (rdev->pdev->revision == 0x81) ||
+		    (rdev->pdev->revision == 0x83) ||
+		    (rdev->pdev->revision == 0x87) ||
+		    (rdev->pdev->device == 0x6604) ||
+		    (rdev->pdev->device == 0x6605)) {
 			max_sclk = 75000;
 		}
 	}

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 049/115] afs: Fix missing put_page()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 048/115] drm/radeon: reinstate oland workaround for sclk Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 050/115] afs: Populate group ID from vnode status Greg Kroah-Hartman
                   ` (65 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David Howells, Sasha Levin

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

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

From: David Howells <dhowells@redhat.com>


[ Upstream commit 29c8bbbd6e21daa0997d1c3ee886b897ee7ad652 ]

In afs_writepages_region(), inside the loop where we find dirty pages to
deal with, one of the if-statements is missing a put_page().

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/write.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -503,6 +503,7 @@ static int afs_writepages_region(struct
 
 		if (PageWriteback(page) || !PageDirty(page)) {
 			unlock_page(page);
+			put_page(page);
 			continue;
 		}
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 050/115] afs: Populate group ID from vnode status
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 049/115] afs: Fix missing put_page() Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 051/115] afs: Adjust mode bits processing Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Dionne, David Howells, Sasha Levin

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

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

From: Marc Dionne <marc.dionne@auristor.com>


[ Upstream commit 6186f0788b31f44affceeedc7b48eb10faea120d ]

The group was hard coded to GLOBAL_ROOT_GID; use the group
ID that was received from the server.

Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -69,7 +69,7 @@ static int afs_inode_map_status(struct a
 
 	set_nlink(inode, vnode->status.nlink);
 	inode->i_uid		= vnode->status.owner;
-	inode->i_gid		= GLOBAL_ROOT_GID;
+	inode->i_gid            = vnode->status.group;
 	inode->i_size		= vnode->status.size;
 	inode->i_ctime.tv_sec	= vnode->status.mtime_server;
 	inode->i_ctime.tv_nsec	= 0;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 051/115] afs: Adjust mode bits processing
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 050/115] afs: Populate group ID from vnode status Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 052/115] afs: Flush outstanding writes when an fd is closed Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Dionne, David Howells, Sasha Levin

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

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

From: Marc Dionne <marc.dionne@auristor.com>


[ Upstream commit 627f46943ff90bcc32ddeb675d881c043c6fa2ae ]

Mode bits for an afs file should not be enforced in the usual
way.

For files, the absence of user bits can restrict file access
with respect to what is granted by the server.

These bits apply regardless of the owner or the current uid; the
rest of the mode bits (group, other) are ignored.

Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/security.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/fs/afs/security.c
+++ b/fs/afs/security.c
@@ -340,17 +340,22 @@ int afs_permission(struct inode *inode,
 	} else {
 		if (!(access & AFS_ACE_LOOKUP))
 			goto permission_denied;
+		if ((mask & MAY_EXEC) && !(inode->i_mode & S_IXUSR))
+			goto permission_denied;
 		if (mask & (MAY_EXEC | MAY_READ)) {
 			if (!(access & AFS_ACE_READ))
 				goto permission_denied;
+			if (!(inode->i_mode & S_IRUSR))
+				goto permission_denied;
 		} else if (mask & MAY_WRITE) {
 			if (!(access & AFS_ACE_WRITE))
 				goto permission_denied;
+			if (!(inode->i_mode & S_IWUSR))
+				goto permission_denied;
 		}
 	}
 
 	key_put(key);
-	ret = generic_permission(inode, mask);
 	_leave(" = %d", ret);
 	return ret;
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 052/115] afs: Flush outstanding writes when an fd is closed
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 051/115] afs: Adjust mode bits processing Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 053/115] afs: Migrate vlocation fields to 64-bit Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Dionne, David Howells, Sasha Levin

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

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

From: David Howells <dhowells@redhat.com>


[ Upstream commit 58fed94dfb17e89556b5705f20f90e5b2971b6a1 ]

Flush outstanding writes in afs when an fd is closed.  This is what NFS and
CIFS do.

Reported-by: Marc Dionne <marc.c.dionne@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/file.c     |    1 +
 fs/afs/internal.h |    1 +
 fs/afs/write.c    |   14 ++++++++++++++
 3 files changed, 16 insertions(+)

--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -29,6 +29,7 @@ static int afs_readpages(struct file *fi
 
 const struct file_operations afs_file_operations = {
 	.open		= afs_open,
+	.flush		= afs_flush,
 	.release	= afs_release,
 	.llseek		= generic_file_llseek,
 	.read_iter	= generic_file_read_iter,
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -749,6 +749,7 @@ extern int afs_writepages(struct address
 extern void afs_pages_written_back(struct afs_vnode *, struct afs_call *);
 extern ssize_t afs_file_write(struct kiocb *, struct iov_iter *);
 extern int afs_writeback_all(struct afs_vnode *);
+extern int afs_flush(struct file *, fl_owner_t);
 extern int afs_fsync(struct file *, loff_t, loff_t, int);
 
 
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -741,6 +741,20 @@ out:
 }
 
 /*
+ * Flush out all outstanding writes on a file opened for writing when it is
+ * closed.
+ */
+int afs_flush(struct file *file, fl_owner_t id)
+{
+	_enter("");
+
+	if ((file->f_mode & FMODE_WRITE) == 0)
+		return 0;
+
+	return vfs_fsync(file, 0);
+}
+
+/*
  * notification that a previously read-only page is about to become writable
  * - if it returns an error, the caller will deliver a bus error signal
  */

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 053/115] afs: Migrate vlocation fields to 64-bit
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 052/115] afs: Flush outstanding writes when an fd is closed Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 054/115] afs: Prevent callback expiry timer overflow Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tina Ruchandani, David Howells, Sasha Levin

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

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

From: Tina Ruchandani <ruchandani.tina@gmail.com>


[ Upstream commit 8a79790bf0b7da216627ffb85f52cfb4adbf1e4e ]

get_seconds() returns real wall-clock seconds. On 32-bit systems
this value will overflow in year 2038 and beyond. This patch changes
afs's vlocation record to use ktime_get_real_seconds() instead, for the
fields time_of_death and update_at.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/callback.c  |    7 ++++---
 fs/afs/internal.h  |    7 ++++---
 fs/afs/server.c    |    6 +++---
 fs/afs/vlocation.c |   16 +++++++++-------
 4 files changed, 20 insertions(+), 16 deletions(-)

--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -362,7 +362,7 @@ static void afs_callback_updater(struct
 {
 	struct afs_server *server;
 	struct afs_vnode *vnode, *xvnode;
-	time_t now;
+	time64_t now;
 	long timeout;
 	int ret;
 
@@ -370,7 +370,7 @@ static void afs_callback_updater(struct
 
 	_enter("");
 
-	now = get_seconds();
+	now = ktime_get_real_seconds();
 
 	/* find the first vnode to update */
 	spin_lock(&server->cb_lock);
@@ -424,7 +424,8 @@ static void afs_callback_updater(struct
 
 	/* and then reschedule */
 	_debug("reschedule");
-	vnode->update_at = get_seconds() + afs_vnode_update_timeout;
+	vnode->update_at = ktime_get_real_seconds() +
+			afs_vnode_update_timeout;
 
 	spin_lock(&server->cb_lock);
 
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -11,6 +11,7 @@
 
 #include <linux/compiler.h>
 #include <linux/kernel.h>
+#include <linux/ktime.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/skbuff.h>
@@ -247,7 +248,7 @@ struct afs_cache_vhash {
  */
 struct afs_vlocation {
 	atomic_t		usage;
-	time_t			time_of_death;	/* time at which put reduced usage to 0 */
+	time64_t		time_of_death;	/* time at which put reduced usage to 0 */
 	struct list_head	link;		/* link in cell volume location list */
 	struct list_head	grave;		/* link in master graveyard list */
 	struct list_head	update;		/* link in master update list */
@@ -258,7 +259,7 @@ struct afs_vlocation {
 	struct afs_cache_vlocation vldb;	/* volume information DB record */
 	struct afs_volume	*vols[3];	/* volume access record pointer (index by type) */
 	wait_queue_head_t	waitq;		/* status change waitqueue */
-	time_t			update_at;	/* time at which record should be updated */
+	time64_t		update_at;	/* time at which record should be updated */
 	spinlock_t		lock;		/* access lock */
 	afs_vlocation_state_t	state;		/* volume location state */
 	unsigned short		upd_rej_cnt;	/* ENOMEDIUM count during update */
@@ -271,7 +272,7 @@ struct afs_vlocation {
  */
 struct afs_server {
 	atomic_t		usage;
-	time_t			time_of_death;	/* time at which put reduced usage to 0 */
+	time64_t		time_of_death;	/* time at which put reduced usage to 0 */
 	struct in_addr		addr;		/* server address */
 	struct afs_cell		*cell;		/* cell in which server resides */
 	struct list_head	link;		/* link in cell's server list */
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -237,7 +237,7 @@ void afs_put_server(struct afs_server *s
 	spin_lock(&afs_server_graveyard_lock);
 	if (atomic_read(&server->usage) == 0) {
 		list_move_tail(&server->grave, &afs_server_graveyard);
-		server->time_of_death = get_seconds();
+		server->time_of_death = ktime_get_real_seconds();
 		queue_delayed_work(afs_wq, &afs_server_reaper,
 				   afs_server_timeout * HZ);
 	}
@@ -272,9 +272,9 @@ static void afs_reap_server(struct work_
 	LIST_HEAD(corpses);
 	struct afs_server *server;
 	unsigned long delay, expiry;
-	time_t now;
+	time64_t now;
 
-	now = get_seconds();
+	now = ktime_get_real_seconds();
 	spin_lock(&afs_server_graveyard_lock);
 
 	while (!list_empty(&afs_server_graveyard)) {
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -340,7 +340,8 @@ static void afs_vlocation_queue_for_upda
 	struct afs_vlocation *xvl;
 
 	/* wait at least 10 minutes before updating... */
-	vl->update_at = get_seconds() + afs_vlocation_update_timeout;
+	vl->update_at = ktime_get_real_seconds() +
+			afs_vlocation_update_timeout;
 
 	spin_lock(&afs_vlocation_updates_lock);
 
@@ -506,7 +507,7 @@ void afs_put_vlocation(struct afs_vlocat
 	if (atomic_read(&vl->usage) == 0) {
 		_debug("buried");
 		list_move_tail(&vl->grave, &afs_vlocation_graveyard);
-		vl->time_of_death = get_seconds();
+		vl->time_of_death = ktime_get_real_seconds();
 		queue_delayed_work(afs_wq, &afs_vlocation_reap,
 				   afs_vlocation_timeout * HZ);
 
@@ -543,11 +544,11 @@ static void afs_vlocation_reaper(struct
 	LIST_HEAD(corpses);
 	struct afs_vlocation *vl;
 	unsigned long delay, expiry;
-	time_t now;
+	time64_t now;
 
 	_enter("");
 
-	now = get_seconds();
+	now = ktime_get_real_seconds();
 	spin_lock(&afs_vlocation_graveyard_lock);
 
 	while (!list_empty(&afs_vlocation_graveyard)) {
@@ -622,13 +623,13 @@ static void afs_vlocation_updater(struct
 {
 	struct afs_cache_vlocation vldb;
 	struct afs_vlocation *vl, *xvl;
-	time_t now;
+	time64_t now;
 	long timeout;
 	int ret;
 
 	_enter("");
 
-	now = get_seconds();
+	now = ktime_get_real_seconds();
 
 	/* find a record to update */
 	spin_lock(&afs_vlocation_updates_lock);
@@ -684,7 +685,8 @@ static void afs_vlocation_updater(struct
 
 	/* and then reschedule */
 	_debug("reschedule");
-	vl->update_at = get_seconds() + afs_vlocation_update_timeout;
+	vl->update_at = ktime_get_real_seconds() +
+			afs_vlocation_update_timeout;
 
 	spin_lock(&afs_vlocation_updates_lock);
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 054/115] afs: Prevent callback expiry timer overflow
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 053/115] afs: Migrate vlocation fields to 64-bit Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 055/115] afs: Fix the maths in afs_fs_store_data() Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tina Ruchandani, David Howells, Sasha Levin

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

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

From: Tina Ruchandani <ruchandani.tina@gmail.com>


[ Upstream commit 56e714312e7dbd6bb83b2f78d3ec19a404c7649f ]

get_seconds() returns real wall-clock seconds. On 32-bit systems
this value will overflow in year 2038 and beyond. This patch changes
afs_vnode record to use ktime_get_real_seconds() instead, for the
fields cb_expires and cb_expires_at.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/fsclient.c |    2 +-
 fs/afs/inode.c    |    7 ++++---
 fs/afs/internal.h |    4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -139,7 +139,7 @@ static void xdr_decode_AFSCallBack(const
 	vnode->cb_version	= ntohl(*bp++);
 	vnode->cb_expiry	= ntohl(*bp++);
 	vnode->cb_type		= ntohl(*bp++);
-	vnode->cb_expires	= vnode->cb_expiry + get_seconds();
+	vnode->cb_expires	= vnode->cb_expiry + ktime_get_real_seconds();
 	*_bp = bp;
 }
 
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -244,12 +244,13 @@ struct inode *afs_iget(struct super_bloc
 			vnode->cb_version = 0;
 			vnode->cb_expiry = 0;
 			vnode->cb_type = 0;
-			vnode->cb_expires = get_seconds();
+			vnode->cb_expires = ktime_get_real_seconds();
 		} else {
 			vnode->cb_version = cb->version;
 			vnode->cb_expiry = cb->expiry;
 			vnode->cb_type = cb->type;
-			vnode->cb_expires = vnode->cb_expiry + get_seconds();
+			vnode->cb_expires = vnode->cb_expiry +
+				ktime_get_real_seconds();
 		}
 	}
 
@@ -322,7 +323,7 @@ int afs_validate(struct afs_vnode *vnode
 	    !test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags) &&
 	    !test_bit(AFS_VNODE_MODIFIED, &vnode->flags) &&
 	    !test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) {
-		if (vnode->cb_expires < get_seconds() + 10) {
+		if (vnode->cb_expires < ktime_get_real_seconds() + 10) {
 			_debug("callback expired");
 			set_bit(AFS_VNODE_CB_BROKEN, &vnode->flags);
 		} else {
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -375,8 +375,8 @@ struct afs_vnode {
 	struct rb_node		server_rb;	/* link in server->fs_vnodes */
 	struct rb_node		cb_promise;	/* link in server->cb_promises */
 	struct work_struct	cb_broken_work;	/* work to be done on callback break */
-	time_t			cb_expires;	/* time at which callback expires */
-	time_t			cb_expires_at;	/* time used to order cb_promise */
+	time64_t		cb_expires;	/* time at which callback expires */
+	time64_t		cb_expires_at;	/* time used to order cb_promise */
 	unsigned		cb_version;	/* callback version */
 	unsigned		cb_expiry;	/* callback expiry time */
 	afs_callback_type_t	cb_type;	/* type of callback */

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 055/115] afs: Fix the maths in afs_fs_store_data()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 054/115] afs: Prevent callback expiry timer overflow Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 056/115] afs: Populate and use client modification time Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David Howells, Sasha Levin

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

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

From: David Howells <dhowells@redhat.com>


[ Upstream commit 146a1192783697810b63a1e41c4d59fc93387340 ]

afs_fs_store_data() works out of the size of the write it's going to make,
but it uses 32-bit unsigned subtraction in one place that gets
automatically cast to loff_t.

However, if to < offset, then the number goes negative, but as the result
isn't signed, this doesn't get sign-extended to 64-bits when placed in a
loff_t.

Fix by casting the operands to loff_t.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/fsclient.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -1225,7 +1225,7 @@ int afs_fs_store_data(struct afs_server
 	_enter(",%x,{%x:%u},,",
 	       key_serial(wb->key), vnode->fid.vid, vnode->fid.vnode);
 
-	size = to - offset;
+	size = (loff_t)to - (loff_t)offset;
 	if (first != last)
 		size += (loff_t)(last - first) << PAGE_SHIFT;
 	pos = (loff_t)first << PAGE_SHIFT;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 056/115] afs: Populate and use client modification time
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 055/115] afs: Fix the maths in afs_fs_store_data() Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 057/115] afs: Fix page leak in afs_write_begin() Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Dionne, David Howells, Sasha Levin

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

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

From: Marc Dionne <marc.dionne@auristor.com>


[ Upstream commit ab94f5d0dd6fd82e7eeca5e7c8096eaea0a0261f ]

The inode timestamps should be set from the client time
in the status received from the server, rather than the
server time which is meant for internal server use.

Set AFS_SET_MTIME and populate the mtime for operations
that take an input status, such as file/dir creation
and StoreData.  If an input time is not provided the
server will set the vnode times based on the current server
time.

In a situation where the server has some skew with the
client, this could lead to the client seeing a timestamp
in the future for a file that it just created or wrote.

Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/fsclient.c |   18 +++++++++---------
 fs/afs/inode.c    |    2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -105,7 +105,7 @@ static void xdr_decode_AFSFetchStatus(co
 			vnode->vfs_inode.i_mode = mode;
 		}
 
-		vnode->vfs_inode.i_ctime.tv_sec	= status->mtime_server;
+		vnode->vfs_inode.i_ctime.tv_sec	= status->mtime_client;
 		vnode->vfs_inode.i_mtime	= vnode->vfs_inode.i_ctime;
 		vnode->vfs_inode.i_atime	= vnode->vfs_inode.i_ctime;
 		vnode->vfs_inode.i_version	= data_version;
@@ -703,8 +703,8 @@ int afs_fs_create(struct afs_server *ser
 		memset(bp, 0, padsz);
 		bp = (void *) bp + padsz;
 	}
-	*bp++ = htonl(AFS_SET_MODE);
-	*bp++ = 0; /* mtime */
+	*bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME);
+	*bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
 	*bp++ = 0; /* owner */
 	*bp++ = 0; /* group */
 	*bp++ = htonl(mode & S_IALLUGO); /* unix mode */
@@ -981,8 +981,8 @@ int afs_fs_symlink(struct afs_server *se
 		memset(bp, 0, c_padsz);
 		bp = (void *) bp + c_padsz;
 	}
-	*bp++ = htonl(AFS_SET_MODE);
-	*bp++ = 0; /* mtime */
+	*bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME);
+	*bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
 	*bp++ = 0; /* owner */
 	*bp++ = 0; /* group */
 	*bp++ = htonl(S_IRWXUGO); /* unix mode */
@@ -1192,8 +1192,8 @@ static int afs_fs_store_data64(struct af
 	*bp++ = htonl(vnode->fid.vnode);
 	*bp++ = htonl(vnode->fid.unique);
 
-	*bp++ = 0; /* mask */
-	*bp++ = 0; /* mtime */
+	*bp++ = htonl(AFS_SET_MTIME); /* mask */
+	*bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
 	*bp++ = 0; /* owner */
 	*bp++ = 0; /* group */
 	*bp++ = 0; /* unix mode */
@@ -1269,8 +1269,8 @@ int afs_fs_store_data(struct afs_server
 	*bp++ = htonl(vnode->fid.vnode);
 	*bp++ = htonl(vnode->fid.unique);
 
-	*bp++ = 0; /* mask */
-	*bp++ = 0; /* mtime */
+	*bp++ = htonl(AFS_SET_MTIME); /* mask */
+	*bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
 	*bp++ = 0; /* owner */
 	*bp++ = 0; /* group */
 	*bp++ = 0; /* unix mode */
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -71,7 +71,7 @@ static int afs_inode_map_status(struct a
 	inode->i_uid		= vnode->status.owner;
 	inode->i_gid            = vnode->status.group;
 	inode->i_size		= vnode->status.size;
-	inode->i_ctime.tv_sec	= vnode->status.mtime_server;
+	inode->i_ctime.tv_sec	= vnode->status.mtime_client;
 	inode->i_ctime.tv_nsec	= 0;
 	inode->i_atime		= inode->i_mtime = inode->i_ctime;
 	inode->i_blocks		= 0;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 057/115] afs: Fix page leak in afs_write_begin()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 056/115] afs: Populate and use client modification time Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 058/115] afs: Fix afs_kill_pages() Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David Howells, Sasha Levin

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

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

From: David Howells <dhowells@redhat.com>


[ Upstream commit 6d06b0d25209c80e99c1e89700f1e09694a3766b ]

afs_write_begin() leaks a ref and a lock on a page if afs_fill_page()
fails.  Fix the leak by unlocking and releasing the page in the error path.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/write.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -148,12 +148,12 @@ int afs_write_begin(struct file *file, s
 		kfree(candidate);
 		return -ENOMEM;
 	}
-	*pagep = page;
-	/* page won't leak in error case: it eventually gets cleaned off LRU */
 
 	if (!PageUptodate(page) && len != PAGE_CACHE_SIZE) {
 		ret = afs_fill_page(vnode, key, index << PAGE_CACHE_SHIFT, page);
 		if (ret < 0) {
+			unlock_page(page);
+			put_page(page);
 			kfree(candidate);
 			_leave(" = %d [prep]", ret);
 			return ret;
@@ -161,6 +161,9 @@ int afs_write_begin(struct file *file, s
 		SetPageUptodate(page);
 	}
 
+	/* page won't leak in error case: it eventually gets cleaned off LRU */
+	*pagep = page;
+
 try_again:
 	spin_lock(&vnode->writeback_lock);
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 058/115] afs: Fix afs_kill_pages()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 057/115] afs: Fix page leak in afs_write_begin() Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 059/115] net/mlx4_core: Avoid delays during VF driver device shutdown Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David Howells, Sasha Levin

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

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

From: David Howells <dhowells@redhat.com>


[ Upstream commit 7286a35e893176169b09715096a4aca557e2ccd2 ]

Fix afs_kill_pages() in two ways:

 (1) If a writeback has been partially flushed, then if we try and kill the
     pages it contains, some of them may no longer be undergoing writeback
     and end_page_writeback() will assert.

     Fix this by checking to see whether the page in question is actually
     undergoing writeback before ending that writeback.

 (2) The loop that scans for pages to kill doesn't increase the first page
     index, and so the loop may not terminate, but it will try to process
     the same pages over and over again.

     Fix this by increasing the first page index to one after the last page
     we processed.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/write.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -299,10 +299,14 @@ static void afs_kill_pages(struct afs_vn
 		ASSERTCMP(pv.nr, ==, count);
 
 		for (loop = 0; loop < count; loop++) {
-			ClearPageUptodate(pv.pages[loop]);
+			struct page *page = pv.pages[loop];
+			ClearPageUptodate(page);
 			if (error)
-				SetPageError(pv.pages[loop]);
-			end_page_writeback(pv.pages[loop]);
+				SetPageError(page);
+			if (PageWriteback(page))
+				end_page_writeback(page);
+			if (page->index >= first)
+				first = page->index + 1;
 		}
 
 		__pagevec_release(&pv);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 059/115] net/mlx4_core: Avoid delays during VF driver device shutdown
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 058/115] afs: Fix afs_kill_pages() Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 060/115] perf symbols: Fix symbols__fixup_end heuristic for corner cases Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jack Morgenstein, Simon Xiao,
	Tariq Toukan, David S. Miller, Sasha Levin

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

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

From: Jack Morgenstein <jackm@dev.mellanox.co.il>


[ Upstream commit 4cbe4dac82e423ecc9a0ba46af24a860853259f4 ]

Some Hypervisors detach VFs from VMs by instantly causing an FLR event
to be generated for a VF.

In the mlx4 case, this will cause that VF's comm channel to be disabled
before the VM has an opportunity to invoke the VF device's "shutdown"
method.

For such Hypervisors, there is a race condition between the VF's
shutdown method and its internal-error detection/reset thread.

The internal-error detection/reset thread (which runs every 5 seconds) also
detects a disabled comm channel. If the internal-error detection/reset
flow wins the race, we still get delays (while that flow tries repeatedly
to detect comm-channel recovery).

The cited commit fixed the command timeout problem when the
internal-error detection/reset flow loses the race.

This commit avoids the unneeded delays when the internal-error
detection/reset flow wins.

Fixes: d585df1c5ccf ("net/mlx4_core: Avoid command timeouts during VF driver device shutdown")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reported-by: Simon Xiao <sixiao@microsoft.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/mellanox/mlx4/cmd.c  |   11 +++++++++++
 drivers/net/ethernet/mellanox/mlx4/main.c |   11 +++++++++++
 include/linux/mlx4/device.h               |    1 +
 3 files changed, 23 insertions(+)

--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2278,6 +2278,17 @@ static int sync_toggles(struct mlx4_dev
 		rd_toggle = swab32(readl(&priv->mfunc.comm->slave_read));
 		if (wr_toggle == 0xffffffff || rd_toggle == 0xffffffff) {
 			/* PCI might be offline */
+
+			/* If device removal has been requested,
+			 * do not continue retrying.
+			 */
+			if (dev->persist->interface_state &
+			    MLX4_INTERFACE_STATE_NOWAIT) {
+				mlx4_warn(dev,
+					  "communication channel is offline\n");
+				return -EIO;
+			}
+
 			msleep(100);
 			wr_toggle = swab32(readl(&priv->mfunc.comm->
 					   slave_write));
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1763,6 +1763,14 @@ static int mlx4_comm_check_offline(struc
 			       (u32)(1 << COMM_CHAN_OFFLINE_OFFSET));
 		if (!offline_bit)
 			return 0;
+
+		/* If device removal has been requested,
+		 * do not continue retrying.
+		 */
+		if (dev->persist->interface_state &
+		    MLX4_INTERFACE_STATE_NOWAIT)
+			break;
+
 		/* There are cases as part of AER/Reset flow that PF needs
 		 * around 100 msec to load. We therefore sleep for 100 msec
 		 * to allow other tasks to make use of that CPU during this
@@ -3690,6 +3698,9 @@ static void mlx4_remove_one(struct pci_d
 	struct mlx4_priv *priv = mlx4_priv(dev);
 	int active_vfs = 0;
 
+	if (mlx4_is_slave(dev))
+		persist->interface_state |= MLX4_INTERFACE_STATE_NOWAIT;
+
 	mutex_lock(&persist->interface_state_mutex);
 	persist->interface_state |= MLX4_INTERFACE_STATE_DELETION;
 	mutex_unlock(&persist->interface_state_mutex);
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -460,6 +460,7 @@ enum {
 enum {
 	MLX4_INTERFACE_STATE_UP		= 1 << 0,
 	MLX4_INTERFACE_STATE_DELETION	= 1 << 1,
+	MLX4_INTERFACE_STATE_NOWAIT	= 1 << 2,
 };
 
 #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 060/115] perf symbols: Fix symbols__fixup_end heuristic for corner cases
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 059/115] net/mlx4_core: Avoid delays during VF driver device shutdown Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 061/115] efi/esrt: Cleanup bad memory map log messages Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniel Borkmann,
	Arnaldo Carvalho de Melo, Sasha Levin

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

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

From: Daniel Borkmann <daniel@iogearbox.net>


[ Upstream commit e7ede72a6d40cb3a30c087142d79381ca8a31dab ]

The current symbols__fixup_end() heuristic for the last entry in the rb
tree is suboptimal as it leads to not being able to recognize the symbol
in the call graph in a couple of corner cases, for example:

 i) If the symbol has a start address (f.e. exposed via kallsyms)
    that is at a page boundary, then the roundup(curr->start, 4096)
    for the last entry will result in curr->start == curr->end with
    a symbol length of zero.

ii) If the symbol has a start address that is shortly before a page
    boundary, then also here, curr->end - curr->start will just be
    very few bytes, where it's unrealistic that we could perform a
    match against.

Instead, change the heuristic to roundup(curr->start, 4096) + 4096, so
that we can catch such corner cases and have a better chance to find
that specific symbol. It's still just best effort as the real end of the
symbol is unknown to us (and could even be at a larger offset than the
current range), but better than the current situation.

Alexei reported that he recently run into case i) with a JITed eBPF
program (these are all page aligned) as the last symbol which wasn't
properly shown in the call graph (while other eBPF program symbols in
the rb tree were displayed correctly). Since this is a generic issue,
lets try to improve the heuristic a bit.

Reported-and-Tested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Fixes: 2e538c4a1847 ("perf tools: Improve kernel/modules symbol lookup")
Link: http://lkml.kernel.org/r/bb5c80d27743be6f12afc68405f1956a330e1bc9.1489614365.git.daniel@iogearbox.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/perf/util/symbol.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -200,7 +200,7 @@ void symbols__fixup_end(struct rb_root *
 
 	/* Last entry */
 	if (curr->end == curr->start)
-		curr->end = roundup(curr->start, 4096);
+		curr->end = roundup(curr->start, 4096) + 4096;
 }
 
 void __map_groups__fixup_end(struct map_groups *mg, enum map_type type)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 061/115] efi/esrt: Cleanup bad memory map log messages
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 060/115] perf symbols: Fix symbols__fixup_end heuristic for corner cases Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 062/115] NFSv4.1 respect servers max size in CREATE_SESSION Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniel Drake, Matt Fleming,
	Peter Jones, Ard Biesheuvel, Sasha Levin

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

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

From: Daniel Drake <drake@endlessm.com>


[ Upstream commit 822f5845f710e57d7e2df1fd1ee00d6e19d334fe ]

The Intel Compute Stick STCK1A8LFC and Weibu F3C platforms both
log 2 error messages during boot:

   efi: requested map not found.
   esrt: ESRT header is not in the memory map.

Searching the web, this seems to affect many other platforms too.
Since these messages are logged as errors, they appear on-screen during
the boot process even when using the "quiet" boot parameter used by
distros.

Demote the ESRT error to a warning so that it does not appear on-screen,
and delete the error logging from efi_mem_desc_lookup; both callsites
of that function log more specific messages upon failure.

Out of curiosity I looked closer at the Weibu F3C. There is no entry in
the UEFI-provided memory map which corresponds to the ESRT pointer, but
hacking the code to map it anyway, the ESRT does appear to be valid with
2 entries.

Signed-off-by: Daniel Drake <drake@endlessm.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Acked-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/firmware/efi/efi.c  |    1 -
 drivers/firmware/efi/esrt.c |    2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -310,7 +310,6 @@ int __init efi_mem_desc_lookup(u64 phys_
 
 		early_memunmap(md, sizeof (*md));
 	}
-	pr_err_once("requested map not found.\n");
 	return -ENOENT;
 }
 
--- a/drivers/firmware/efi/esrt.c
+++ b/drivers/firmware/efi/esrt.c
@@ -253,7 +253,7 @@ void __init efi_esrt_init(void)
 
 	rc = efi_mem_desc_lookup(efi.esrt, &md);
 	if (rc < 0) {
-		pr_err("ESRT header is not in the memory map.\n");
+		pr_warn("ESRT header is not in the memory map.\n");
 		return;
 	}
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 062/115] NFSv4.1 respect servers max size in CREATE_SESSION
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 061/115] efi/esrt: Cleanup bad memory map log messages Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 063/115] btrfs: add missing memset while reading compressed inline extents Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Olga Kornievskaia, Anna Schumaker,
	Sasha Levin

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

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

From: Olga Kornievskaia <kolga@netapp.com>


[ Upstream commit 033853325fe3bdc70819a8b97915bd3bca41d3af ]

Currently client doesn't respect max sizes server returns in CREATE_SESSION.
nfs4_session_set_rwsize() gets called and server->rsize, server->wsize are 0
so they never get set to the sizes returned by the server.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfs/nfs4client.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -895,9 +895,9 @@ static void nfs4_session_set_rwsize(stru
 	server_resp_sz = sess->fc_attrs.max_resp_sz - nfs41_maxread_overhead;
 	server_rqst_sz = sess->fc_attrs.max_rqst_sz - nfs41_maxwrite_overhead;
 
-	if (server->rsize > server_resp_sz)
+	if (!server->rsize || server->rsize > server_resp_sz)
 		server->rsize = server_resp_sz;
-	if (server->wsize > server_rqst_sz)
+	if (!server->wsize || server->wsize > server_rqst_sz)
 		server->wsize = server_rqst_sz;
 #endif /* CONFIG_NFS_V4_1 */
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 063/115] btrfs: add missing memset while reading compressed inline extents
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 062/115] NFSv4.1 respect servers max size in CREATE_SESSION Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 064/115] target: Use system workqueue for ALUA transitions Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Zygo Blaxell, Liu Bo, Chris Mason,
	Sasha Levin

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

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

From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>


[ Upstream commit e1699d2d7bf6e6cce3e1baff19f9dd4595a58664 ]

This is a story about 4 distinct (and very old) btrfs bugs.

Commit c8b978188c ("Btrfs: Add zlib compression support") added
three data corruption bugs for inline extents (bugs #1-3).

Commit 93c82d5750 ("Btrfs: zero page past end of inline file items")
fixed bug #1:  uncompressed inline extents followed by a hole and more
extents could get non-zero data in the hole as they were read.  The fix
was to add a memset in btrfs_get_extent to zero out the hole.

Commit 166ae5a418 ("btrfs: fix inline compressed read err corruption")
fixed bug #2:  compressed inline extents which contained non-zero bytes
might be replaced with zero bytes in some cases.  This patch removed an
unhelpful memset from uncompress_inline, but the case where memset is
required was missed.

There is also a memset in the decompression code, but this only covers
decompressed data that is shorter than the ram_bytes from the extent
ref record.  This memset doesn't cover the region between the end of the
decompressed data and the end of the page.  It has also moved around a
few times over the years, so there's no single patch to refer to.

This patch fixes bug #3:  compressed inline extents followed by a hole
and more extents could get non-zero data in the hole as they were read
(i.e. bug #3 is the same as bug #1, but s/uncompressed/compressed/).
The fix is the same:  zero out the hole in the compressed case too,
by putting a memset back in uncompress_inline, but this time with
correct parameters.

The last and oldest bug, bug #0, is the cause of the offending inline
extent/hole/extent pattern.  Bug #0 is a subtle and mostly-harmless quirk
of behavior somewhere in the btrfs write code.  In a few special cases,
an inline extent and hole are allowed to persist where they normally
would be combined with later extents in the file.

A fast reproducer for bug #0 is presented below.  A few offending extents
are also created in the wild during large rsync transfers with the -S
flag.  A Linux kernel build (git checkout; make allyesconfig; make -j8)
will produce a handful of offending files as well.  Once an offending
file is created, it can present different content to userspace each
time it is read.

Bug #0 is at least 4 and possibly 8 years old.  I verified every vX.Y
kernel back to v3.5 has this behavior.  There are fossil records of this
bug's effects in commits all the way back to v2.6.32.  I have no reason
to believe bug #0 wasn't present at the beginning of btrfs compression
support in v2.6.29, but I can't easily test kernels that old to be sure.

It is not clear whether bug #0 is worth fixing.  A fix would likely
require injecting extra reads into currently write-only paths, and most
of the exceptional cases caused by bug #0 are already handled now.

Whether we like them or not, bug #0's inline extents followed by holes
are part of the btrfs de-facto disk format now, and we need to be able
to read them without data corruption or an infoleak.  So enough about
bug #0, let's get back to bug #3 (this patch).

An example of on-disk structure leading to data corruption found in
the wild:

        item 61 key (606890 INODE_ITEM 0) itemoff 9662 itemsize 160
                inode generation 50 transid 50 size 47424 nbytes 49141
                block group 0 mode 100644 links 1 uid 0 gid 0
                rdev 0 flags 0x0(none)
        item 62 key (606890 INODE_REF 603050) itemoff 9642 itemsize 20
                inode ref index 3 namelen 10 name: DB_File.so
        item 63 key (606890 EXTENT_DATA 0) itemoff 8280 itemsize 1362
                inline extent data size 1341 ram 4085 compress(zlib)
        item 64 key (606890 EXTENT_DATA 4096) itemoff 8227 itemsize 53
                extent data disk byte 5367308288 nr 20480
                extent data offset 0 nr 45056 ram 45056
                extent compression(zlib)

Different data appears in userspace during each read of the 11 bytes
between 4085 and 4096.  The extent in item 63 is not long enough to
fill the first page of the file, so a memset is required to fill the
space between item 63 (ending at 4085) and item 64 (beginning at 4096)
with zero.

Here is a reproducer from Liu Bo, which demonstrates another method
of creating the same inline extent and hole pattern:

Using 'page_poison=on' kernel command line (or enable
CONFIG_PAGE_POISONING) run the following:

	# touch foo
	# chattr +c foo
	# xfs_io -f -c "pwrite -W 0 1000" foo
	# xfs_io -f -c "falloc 4 8188" foo
	# od -x foo
	# echo 3 >/proc/sys/vm/drop_caches
	# od -x foo

This produce the following on my box:

Correct output:  file contains 1000 data bytes followed
by zeros:

	0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
	*
	0001740 cdcd cdcd cdcd cdcd 0000 0000 0000 0000
	0001760 0000 0000 0000 0000 0000 0000 0000 0000
	*
	0020000

Actual output:  the data after the first 1000 bytes
will be different each run:

	0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
	*
	0001740 cdcd cdcd cdcd cdcd 6c63 7400 635f 006d
	0001760 5f74 6f43 7400 435f 0053 5f74 7363 7400
	0002000 435f 0056 5f74 6164 7400 645f 0062 5f74
	(...)

Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Chris Mason <clm@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/inode.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6735,6 +6735,20 @@ static noinline int uncompress_inline(st
 	max_size = min_t(unsigned long, PAGE_CACHE_SIZE, max_size);
 	ret = btrfs_decompress(compress_type, tmp, page,
 			       extent_offset, inline_size, max_size);
+
+	/*
+	 * decompression code contains a memset to fill in any space between the end
+	 * of the uncompressed data and the end of max_size in case the decompressed
+	 * data ends up shorter than ram_bytes.  That doesn't cover the hole between
+	 * the end of an inline extent and the beginning of the next block, so we
+	 * cover that region here.
+	 */
+
+	if (max_size + pg_offset < PAGE_SIZE) {
+		char *map = kmap(page);
+		memset(map + pg_offset + max_size, 0, PAGE_SIZE - max_size - pg_offset);
+		kunmap(page);
+	}
 	kfree(tmp);
 	return ret;
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 064/115] target: Use system workqueue for ALUA transitions
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 063/115] btrfs: add missing memset while reading compressed inline extents Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 065/115] target: fix ALUA transition timeout handling Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mike Christie, Nicholas Bellinger,
	Sasha Levin

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

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

From: Mike Christie <mchristi@redhat.com>


[ Upstream commit 207ee84133c00a8a2a5bdec94df4a5b37d78881c ]

If tcmu-runner is processing a STPG and needs to change the kernel's
ALUA state then we cannot use the same work queue for task management
requests and ALUA transitions, because we could deadlock. The problem
occurs when a STPG times out before tcmu-runner is able to
call into target_tg_pt_gp_alua_access_state_store->
core_alua_do_port_transition -> core_alua_do_transition_tg_pt ->
queue_work. In this case, the tmr is on the work queue waiting for
the STPG to complete, but the STPG transition is now queued behind
the waiting tmr.

Note:
This bug will also be fixed by this patch:
http://www.spinics.net/lists/target-devel/msg14560.html
which switches the tmr code to use the system workqueues.

For both, I am not sure if we need a dedicated workqueue since
it is not a performance path and I do not think we need WQ_MEM_RECLAIM
to make forward progress to free up memory like the block layer does.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/target_core_alua.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -1118,13 +1118,11 @@ static int core_alua_do_transition_tg_pt
 		unsigned long transition_tmo;
 
 		transition_tmo = tg_pt_gp->tg_pt_gp_implicit_trans_secs * HZ;
-		queue_delayed_work(tg_pt_gp->tg_pt_gp_dev->tmr_wq,
-				   &tg_pt_gp->tg_pt_gp_transition_work,
-				   transition_tmo);
+		schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work,
+				      transition_tmo);
 	} else {
 		tg_pt_gp->tg_pt_gp_transition_complete = &wait;
-		queue_delayed_work(tg_pt_gp->tg_pt_gp_dev->tmr_wq,
-				   &tg_pt_gp->tg_pt_gp_transition_work, 0);
+		schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work, 0);
 		wait_for_completion(&wait);
 		tg_pt_gp->tg_pt_gp_transition_complete = NULL;
 	}

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 065/115] target: fix ALUA transition timeout handling
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 064/115] target: Use system workqueue for ALUA transitions Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 066/115] target: fix race during implicit transition work flushes Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mike Christie, Nicholas Bellinger,
	Sasha Levin

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

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

From: Mike Christie <mchristi@redhat.com>


[ Upstream commit d7175373f2745ed4abe5b388d5aabd06304f801e ]

The implicit transition time tells initiators the min time
to wait before timing out a transition. We currently schedule
the transition to occur in tg_pt_gp_implicit_trans_secs
seconds so there is no room for delays. If
core_alua_do_transition_tg_pt_work->core_alua_update_tpg_primary_metadata
needs to write out info to a remote file, then the initiator can
easily time out the operation.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/target_core_alua.c |   23 ++++++++---------------
 include/target/target_core_base.h |    2 +-
 2 files changed, 9 insertions(+), 16 deletions(-)

--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -1010,7 +1010,7 @@ static void core_alua_queue_state_change
 static void core_alua_do_transition_tg_pt_work(struct work_struct *work)
 {
 	struct t10_alua_tg_pt_gp *tg_pt_gp = container_of(work,
-		struct t10_alua_tg_pt_gp, tg_pt_gp_transition_work.work);
+		struct t10_alua_tg_pt_gp, tg_pt_gp_transition_work);
 	struct se_device *dev = tg_pt_gp->tg_pt_gp_dev;
 	bool explicit = (tg_pt_gp->tg_pt_gp_alua_access_status ==
 			 ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG);
@@ -1073,13 +1073,12 @@ static int core_alua_do_transition_tg_pt
 	/*
 	 * Flush any pending transitions
 	 */
-	if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs &&
-	    atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
+	if (!explicit && atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
 	    ALUA_ACCESS_STATE_TRANSITION) {
 		/* Just in case */
 		tg_pt_gp->tg_pt_gp_alua_pending_state = new_state;
 		tg_pt_gp->tg_pt_gp_transition_complete = &wait;
-		flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work);
+		flush_work(&tg_pt_gp->tg_pt_gp_transition_work);
 		wait_for_completion(&wait);
 		tg_pt_gp->tg_pt_gp_transition_complete = NULL;
 		return 0;
@@ -1114,15 +1113,9 @@ static int core_alua_do_transition_tg_pt
 	atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt);
 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
 
-	if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) {
-		unsigned long transition_tmo;
-
-		transition_tmo = tg_pt_gp->tg_pt_gp_implicit_trans_secs * HZ;
-		schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work,
-				      transition_tmo);
-	} else {
+	schedule_work(&tg_pt_gp->tg_pt_gp_transition_work);
+	if (explicit) {
 		tg_pt_gp->tg_pt_gp_transition_complete = &wait;
-		schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work, 0);
 		wait_for_completion(&wait);
 		tg_pt_gp->tg_pt_gp_transition_complete = NULL;
 	}
@@ -1690,8 +1683,8 @@ struct t10_alua_tg_pt_gp *core_alua_allo
 	mutex_init(&tg_pt_gp->tg_pt_gp_md_mutex);
 	spin_lock_init(&tg_pt_gp->tg_pt_gp_lock);
 	atomic_set(&tg_pt_gp->tg_pt_gp_ref_cnt, 0);
-	INIT_DELAYED_WORK(&tg_pt_gp->tg_pt_gp_transition_work,
-			  core_alua_do_transition_tg_pt_work);
+	INIT_WORK(&tg_pt_gp->tg_pt_gp_transition_work,
+		  core_alua_do_transition_tg_pt_work);
 	tg_pt_gp->tg_pt_gp_dev = dev;
 	atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
 		ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED);
@@ -1799,7 +1792,7 @@ void core_alua_free_tg_pt_gp(
 	dev->t10_alua.alua_tg_pt_gps_counter--;
 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
 
-	flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work);
+	flush_work(&tg_pt_gp->tg_pt_gp_transition_work);
 
 	/*
 	 * Allow a struct t10_alua_tg_pt_gp_member * referenced by
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -299,7 +299,7 @@ struct t10_alua_tg_pt_gp {
 	struct list_head tg_pt_gp_lun_list;
 	struct se_lun *tg_pt_gp_alua_lun;
 	struct se_node_acl *tg_pt_gp_alua_nacl;
-	struct delayed_work tg_pt_gp_transition_work;
+	struct work_struct tg_pt_gp_transition_work;
 	struct completion *tg_pt_gp_transition_complete;
 };
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 066/115] target: fix race during implicit transition work flushes
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 065/115] target: fix ALUA transition timeout handling Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 067/115] sfc: dont warn on successful change of MAC Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mike Christie, Nicholas Bellinger,
	Sasha Levin

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

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

From: Mike Christie <mchristi@redhat.com>


[ Upstream commit 760bf578edf8122f2503a3a6a3f4b0de3b6ce0bb ]

This fixes the following races:

1. core_alua_do_transition_tg_pt could have read
tg_pt_gp_alua_access_state and gone into this if chunk:

if (!explicit &&
        atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
           ALUA_ACCESS_STATE_TRANSITION) {

and then core_alua_do_transition_tg_pt_work could update the
state. core_alua_do_transition_tg_pt would then only set
tg_pt_gp_alua_pending_state and the tg_pt_gp_alua_access_state would
not get updated with the second calls state.

2. core_alua_do_transition_tg_pt could be setting
tg_pt_gp_transition_complete while the tg_pt_gp_transition_work
is already completing. core_alua_do_transition_tg_pt then waits on the
completion that will never be called.

To handle these issues, we just call flush_work which will return when
core_alua_do_transition_tg_pt_work has completed so there is no need
to do the complete/wait. And, if core_alua_do_transition_tg_pt_work
was running, instead of trying to sneak in the state change, we just
schedule up another core_alua_do_transition_tg_pt_work call.

Note that this does not handle a possible race where there are multiple
threads call core_alua_do_transition_tg_pt at the same time. I think
we need a mutex in target_tg_pt_gp_alua_access_state_store.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/target_core_alua.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -1073,16 +1073,8 @@ static int core_alua_do_transition_tg_pt
 	/*
 	 * Flush any pending transitions
 	 */
-	if (!explicit && atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
-	    ALUA_ACCESS_STATE_TRANSITION) {
-		/* Just in case */
-		tg_pt_gp->tg_pt_gp_alua_pending_state = new_state;
-		tg_pt_gp->tg_pt_gp_transition_complete = &wait;
+	if (!explicit)
 		flush_work(&tg_pt_gp->tg_pt_gp_transition_work);
-		wait_for_completion(&wait);
-		tg_pt_gp->tg_pt_gp_transition_complete = NULL;
-		return 0;
-	}
 
 	/*
 	 * Save the old primary ALUA access state, and set the current state

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 067/115] sfc: dont warn on successful change of MAC
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 066/115] target: fix race during implicit transition work flushes Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 068/115] fbdev: controlfb: Add missing modes to fix out of bounds access Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bert Kenward, David S. Miller, Sasha Levin

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

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

From: Robert Stonehouse <rstonehouse@solarflare.com>


[ Upstream commit cbad52e92ad7f01f0be4ca58bde59462dc1afe3a ]

Fixes: 535a61777f44e ("sfc: suppress handled MCDI failures when changing the MAC address")
Signed-off-by: Bert Kenward <bkenward@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/sfc/ef10.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -4307,7 +4307,7 @@ static int efx_ef10_set_mac_address(stru
 		 * MCFW do not support VFs.
 		 */
 		rc = efx_ef10_vport_set_mac_address(efx);
-	} else {
+	} else if (rc) {
 		efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC,
 				       sizeof(inbuf), NULL, 0, rc);
 	}

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 068/115] fbdev: controlfb: Add missing modes to fix out of bounds access
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 067/115] sfc: dont warn on successful change of MAC Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 069/115] video: udlfb: Fix read EDID timeout Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Geert Uytterhoeven,
	Benjamin Herrenschmidt, Bartlomiej Zolnierkiewicz, Sasha Levin

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

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

From: Geert Uytterhoeven <geert@linux-m68k.org>


[ Upstream commit ac831a379d34109451b3c41a44a20ee10ecb615f ]

Dan's static analysis says:

    drivers/video/fbdev/controlfb.c:560 control_setup()
    error: buffer overflow 'control_mac_modes' 20 <= 21

Indeed, control_mac_modes[] has only 20 elements, while VMODE_MAX is 22,
which may lead to an out of bounds read when parsing vmode commandline
options.

The bug was introduced in v2.4.5.6, when 2 new modes were added to
macmodes.h, but control_mac_modes[] wasn't updated:

https://kernel.opensuse.org/cgit/kernel/diff/include/video/macmodes.h?h=v2.5.2&id=29f279c764808560eaceb88fef36cbc35c529aad

Augment control_mac_modes[] with the two new video modes to fix this.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/video/fbdev/controlfb.h |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/video/fbdev/controlfb.h
+++ b/drivers/video/fbdev/controlfb.h
@@ -141,5 +141,7 @@ static struct max_cmodes control_mac_mod
 	{{ 1, 2}},	/* 1152x870, 75Hz */
 	{{ 0, 1}},	/* 1280x960, 75Hz */
 	{{ 0, 1}},	/* 1280x1024, 75Hz */
+	{{ 1, 2}},	/* 1152x768, 60Hz */
+	{{ 0, 1}},	/* 1600x1024, 60Hz */
 };
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 069/115] video: udlfb: Fix read EDID timeout
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (65 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 068/115] fbdev: controlfb: Add missing modes to fix out of bounds access Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:48 ` [PATCH 4.4 070/115] video: fbdev: au1200fb: Release some resources if a memory allocation fails Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ladislav Michl, Bernie Thompson,
	Bartlomiej Zolnierkiewicz, Sasha Levin

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

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

From: Ladislav Michl <ladis@linux-mips.org>


[ Upstream commit c98769475575c8a585f5b3952f4b5f90266f699b ]

While usb_control_msg function expects timeout in miliseconds, a value
of HZ is used. Replace it with USB_CTRL_GET_TIMEOUT and also fix error
message which looks like:
udlfb: Read EDID byte 78 failed err ffffff92
as error is either negative errno or number of bytes transferred use %d
format specifier.

Returned EDID is in second byte, so return error when less than two bytes
are received.

Fixes: 18dffdf8913a ("staging: udlfb: enhance EDID and mode handling support")
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Cc: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/video/fbdev/udlfb.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -769,11 +769,11 @@ static int dlfb_get_edid(struct dlfb_dat
 
 	for (i = 0; i < len; i++) {
 		ret = usb_control_msg(dev->udev,
-				    usb_rcvctrlpipe(dev->udev, 0), (0x02),
-				    (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2,
-				    HZ);
-		if (ret < 1) {
-			pr_err("Read EDID byte %d failed err %x\n", i, ret);
+				      usb_rcvctrlpipe(dev->udev, 0), 0x02,
+				      (0x80 | (0x02 << 5)), i << 8, 0xA1,
+				      rbuf, 2, USB_CTRL_GET_TIMEOUT);
+		if (ret < 2) {
+			pr_err("Read EDID byte %d failed: %d\n", i, ret);
 			i--;
 			break;
 		}

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 070/115] video: fbdev: au1200fb: Release some resources if a memory allocation fails
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (66 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 069/115] video: udlfb: Fix read EDID timeout Greg Kroah-Hartman
@ 2017-12-18 15:48 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 071/115] video: fbdev: au1200fb: Return an error code " Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Tejun Heo,
	Bartlomiej Zolnierkiewicz, Sasha Levin

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

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

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>


[ Upstream commit 451f130602619a17c8883dd0b71b11624faffd51 ]

We should go through the error handling code instead of returning -ENOMEM
directly.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/video/fbdev/au1200fb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/video/fbdev/au1200fb.c
+++ b/drivers/video/fbdev/au1200fb.c
@@ -1699,7 +1699,8 @@ static int au1200fb_drv_probe(struct pla
 		if (!fbdev->fb_mem) {
 			print_err("fail to allocate frambuffer (size: %dK))",
 				  fbdev->fb_len / 1024);
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto failed;
 		}
 
 		/*

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 071/115] video: fbdev: au1200fb: Return an error code if a memory allocation fails
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (67 preceding siblings ...)
  2017-12-18 15:48 ` [PATCH 4.4 070/115] video: fbdev: au1200fb: Release some resources if a memory allocation fails Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 072/115] rtc: pcf8563: fix output clock rate Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe JAILLET, Tejun Heo,
	Bartlomiej Zolnierkiewicz, Sasha Levin

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

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

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>


[ Upstream commit 8cae353e6b01ac3f18097f631cdbceb5ff28c7f3 ]

'ret' is known to be 0 at this point.
In case of memory allocation error in 'framebuffer_alloc()', return
-ENOMEM instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/video/fbdev/au1200fb.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/video/fbdev/au1200fb.c
+++ b/drivers/video/fbdev/au1200fb.c
@@ -1680,8 +1680,10 @@ static int au1200fb_drv_probe(struct pla
 
 		fbi = framebuffer_alloc(sizeof(struct au1200fb_device),
 					&dev->dev);
-		if (!fbi)
+		if (!fbi) {
+			ret = -ENOMEM;
 			goto failed;
+		}
 
 		_au1200fb_infos[plane] = fbi;
 		fbdev = fbi->par;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 072/115] rtc: pcf8563: fix output clock rate
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (68 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 071/115] video: fbdev: au1200fb: Return an error code " Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 073/115] dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Philipp Zabel, Alexandre Belloni,
	Sasha Levin

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

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

From: Philipp Zabel <p.zabel@pengutronix.de>


[ Upstream commit a3350f9c57ffad569c40f7320b89da1f3061c5bb ]

The pcf8563_clkout_recalc_rate function erroneously ignores the
frequency index read from the CLKO register and always returns
32768 Hz.

Fixes: a39a6405d5f9 ("rtc: pcf8563: add CLKOUT to common clock framework")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/rtc/rtc-pcf8563.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -427,7 +427,7 @@ static unsigned long pcf8563_clkout_reca
 		return 0;
 
 	buf &= PCF8563_REG_CLKO_F_MASK;
-	return clkout_rates[ret];
+	return clkout_rates[buf];
 }
 
 static long pcf8563_clkout_round_rate(struct clk_hw *hw, unsigned long rate,

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 073/115] dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (69 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 072/115] rtc: pcf8563: fix output clock rate Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 074/115] PCI/PME: Handle invalid data when reading Root Status Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Ujfalusi, Vinod Koul, Sasha Levin

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

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

From: Peter Ujfalusi <peter.ujfalusi@ti.com>


[ Upstream commit 288e7560e4d3e259aa28f8f58a8dfe63627a1bf6 ]

The used 0x1f mask is only valid for am335x family of SoC, different family
using this type of crossbar might have different number of electable
events. In case of am43xx family 0x3f mask should have been used for
example.
Instead of trying to handle each family's mask, just use u8 type to store
the mux value since the event offsets are aligned to byte offset.

Fixes: 42dbdcc6bf965 ("dmaengine: ti-dma-crossbar: Add support for crossbar on AM33xx/AM43xx")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/ti-dma-crossbar.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -46,12 +46,12 @@ struct ti_am335x_xbar_data {
 
 struct ti_am335x_xbar_map {
 	u16 dma_line;
-	u16 mux_val;
+	u8 mux_val;
 };
 
-static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u16 val)
+static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u8 val)
 {
-	writeb_relaxed(val & 0x1f, iomem + event);
+	writeb_relaxed(val, iomem + event);
 }
 
 static void ti_am335x_xbar_free(struct device *dev, void *route_data)
@@ -102,7 +102,7 @@ static void *ti_am335x_xbar_route_alloca
 	}
 
 	map->dma_line = (u16)dma_spec->args[0];
-	map->mux_val = (u16)dma_spec->args[2];
+	map->mux_val = (u8)dma_spec->args[2];
 
 	dma_spec->args[2] = 0;
 	dma_spec->args_count = 2;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 074/115] PCI/PME: Handle invalid data when reading Root Status
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (70 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 073/115] dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 075/115] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Qiang Zheng, Bjorn Helgaas, Sasha Levin

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

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

From: Qiang <zhengqiang10@huawei.com>


[ Upstream commit 3ad3f8ce50914288731a3018b27ee44ab803e170 ]

PCIe PME and native hotplug share the same interrupt number, so hotplug
interrupts are also processed by PME.  In some cases, e.g., a Link Down
interrupt, a device may be present but unreachable, so when we try to
read its Root Status register, the read fails and we get all ones data
(0xffffffff).

Previously, we interpreted that data as PCI_EXP_RTSTA_PME being set, i.e.,
"some device has asserted PME," so we scheduled pcie_pme_work_fn().  This
caused an infinite loop because pcie_pme_work_fn() tried to handle PME
requests until PCI_EXP_RTSTA_PME is cleared, but with the link down,
PCI_EXP_RTSTA_PME can't be cleared.

Check for the invalid 0xffffffff data everywhere we read the Root Status
register.

1469d17dd341 ("PCI: pciehp: Handle invalid data when reading from
non-existent devices") added similar checks in the hotplug driver.

Signed-off-by: Qiang Zheng <zhengqiang10@huawei.com>
[bhelgaas: changelog, also check in pcie_pme_work_fn(), use "~0" to follow
other similar checks]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/pcie/pme.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/pci/pcie/pme.c
+++ b/drivers/pci/pcie/pme.c
@@ -233,6 +233,9 @@ static void pcie_pme_work_fn(struct work
 			break;
 
 		pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
+		if (rtsta == (u32) ~0)
+			break;
+
 		if (rtsta & PCI_EXP_RTSTA_PME) {
 			/*
 			 * Clear PME status of the port.  If there are other
@@ -280,7 +283,7 @@ static irqreturn_t pcie_pme_irq(int irq,
 	spin_lock_irqsave(&data->lock, flags);
 	pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
 
-	if (!(rtsta & PCI_EXP_RTSTA_PME)) {
+	if (rtsta == (u32) ~0 || !(rtsta & PCI_EXP_RTSTA_PME)) {
 		spin_unlock_irqrestore(&data->lock, flags);
 		return IRQ_NONE;
 	}

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 075/115] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (71 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 074/115] PCI/PME: Handle invalid data when reading Root Status Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 076/115] netfilter: ipvs: Fix inappropriate output of procfs Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shriya, Michael Ellerman, Sasha Levin

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

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

From: Shriya <shriyak@linux.vnet.ibm.com>


[ Upstream commit cd77b5ce208c153260ed7882d8910f2395bfaabd ]

The call to /proc/cpuinfo in turn calls cpufreq_quick_get() which
returns the last frequency requested by the kernel, but may not
reflect the actual frequency the processor is running at. This patch
makes a call to cpufreq_get() instead which returns the current
frequency reported by the hardware.

Fixes: fb5153d05a7d ("powerpc: powernv: Implement ppc_md.get_proc_freq()")
Signed-off-by: Shriya <shriyak@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/powernv/setup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -295,7 +295,7 @@ static unsigned long pnv_get_proc_freq(u
 {
 	unsigned long ret_freq;
 
-	ret_freq = cpufreq_quick_get(cpu) * 1000ul;
+	ret_freq = cpufreq_get(cpu) * 1000ul;
 
 	/*
 	 * If the backend cpufreq driver does not exist,

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 076/115] netfilter: ipvs: Fix inappropriate output of procfs
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (72 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 075/115] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 077/115] powerpc/opal: Fix EBUSY bug in acquiring tokens Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, KUWAZAWA Takuya, Julian Anastasov,
	Pablo Neira Ayuso, Sasha Levin

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

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

From: KUWAZAWA Takuya <albatross0@gmail.com>


[ Upstream commit c5504f724c86ee925e7ffb80aa342cfd57959b13 ]

Information about ipvs in different network namespace can be seen via procfs.

How to reproduce:

  # ip netns add ns01
  # ip netns add ns02
  # ip netns exec ns01 ip a add dev lo 127.0.0.1/8
  # ip netns exec ns02 ip a add dev lo 127.0.0.1/8
  # ip netns exec ns01 ipvsadm -A -t 10.1.1.1:80
  # ip netns exec ns02 ipvsadm -A -t 10.1.1.2:80

The ipvsadm displays information about its own network namespace only.

  # ip netns exec ns01 ipvsadm -Ln
  IP Virtual Server version 1.2.1 (size=4096)
  Prot LocalAddress:Port Scheduler Flags
    -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
  TCP  10.1.1.1:80 wlc

  # ip netns exec ns02 ipvsadm -Ln
  IP Virtual Server version 1.2.1 (size=4096)
  Prot LocalAddress:Port Scheduler Flags
    -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
  TCP  10.1.1.2:80 wlc

But I can see information about other network namespace via procfs.

  # ip netns exec ns01 cat /proc/net/ip_vs
  IP Virtual Server version 1.2.1 (size=4096)
  Prot LocalAddress:Port Scheduler Flags
    -> RemoteAddress:Port Forward Weight ActiveConn InActConn
  TCP  0A010101:0050 wlc
  TCP  0A010102:0050 wlc

  # ip netns exec ns02 cat /proc/net/ip_vs
  IP Virtual Server version 1.2.1 (size=4096)
  Prot LocalAddress:Port Scheduler Flags
    -> RemoteAddress:Port Forward Weight ActiveConn InActConn
  TCP  0A010102:0050 wlc

Signed-off-by: KUWAZAWA Takuya <albatross0@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/netfilter/ipvs/ip_vs_ctl.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1999,12 +1999,16 @@ static int ip_vs_info_seq_show(struct se
 		seq_puts(seq,
 			 "  -> RemoteAddress:Port Forward Weight ActiveConn InActConn\n");
 	} else {
+		struct net *net = seq_file_net(seq);
+		struct netns_ipvs *ipvs = net_ipvs(net);
 		const struct ip_vs_service *svc = v;
 		const struct ip_vs_iter *iter = seq->private;
 		const struct ip_vs_dest *dest;
 		struct ip_vs_scheduler *sched = rcu_dereference(svc->scheduler);
 		char *sched_name = sched ? sched->name : "none";
 
+		if (svc->ipvs != ipvs)
+			return 0;
 		if (iter->table == ip_vs_svc_table) {
 #ifdef CONFIG_IP_VS_IPV6
 			if (svc->af == AF_INET6)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 077/115] powerpc/opal: Fix EBUSY bug in acquiring tokens
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (73 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 076/115] netfilter: ipvs: Fix inappropriate output of procfs Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 078/115] powerpc/ipic: Fix status get and status clear Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, William A. Kennington III,
	Michael Ellerman, Sasha Levin

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

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

From: "William A. Kennington III" <wak@google.com>


[ Upstream commit 71e24d7731a2903b1ae2bba2b2971c654d9c2aa6 ]

The current code checks the completion map to look for the first token
that is complete. In some cases, a completion can come in but the
token can still be on lease to the caller processing the completion.
If this completed but unreleased token is the first token found in the
bitmap by another tasks trying to acquire a token, then the
__test_and_set_bit call will fail since the token will still be on
lease. The acquisition will then fail with an EBUSY.

This patch reorganizes the acquisition code to look at the
opal_async_token_map for an unleased token. If the token has no lease
it must have no outstanding completions so we should never see an
EBUSY, unless we have leased out too many tokens. Since
opal_async_get_token_inrerruptible is protected by a semaphore, we
will practically never see EBUSY anymore.

Fixes: 8d7248232208 ("powerpc/powernv: Infrastructure to support OPAL async completion")
Signed-off-by: William A. Kennington III <wak@google.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/powernv/opal-async.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/powerpc/platforms/powernv/opal-async.c
+++ b/arch/powerpc/platforms/powernv/opal-async.c
@@ -39,18 +39,18 @@ int __opal_async_get_token(void)
 	int token;
 
 	spin_lock_irqsave(&opal_async_comp_lock, flags);
-	token = find_first_bit(opal_async_complete_map, opal_max_async_tokens);
+	token = find_first_zero_bit(opal_async_token_map, opal_max_async_tokens);
 	if (token >= opal_max_async_tokens) {
 		token = -EBUSY;
 		goto out;
 	}
 
-	if (__test_and_set_bit(token, opal_async_token_map)) {
+	if (!__test_and_clear_bit(token, opal_async_complete_map)) {
 		token = -EBUSY;
 		goto out;
 	}
 
-	__clear_bit(token, opal_async_complete_map);
+	__set_bit(token, opal_async_token_map);
 
 out:
 	spin_unlock_irqrestore(&opal_async_comp_lock, flags);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 078/115] powerpc/ipic: Fix status get and status clear
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (74 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 077/115] powerpc/opal: Fix EBUSY bug in acquiring tokens Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 079/115] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe Leroy, Michael Ellerman,
	Sasha Levin

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

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

From: Christophe Leroy <christophe.leroy@c-s.fr>


[ Upstream commit 6b148a7ce72a7f87c81cbcde48af014abc0516a9 ]

IPIC Status is provided by register IPIC_SERSR and not by IPIC_SERMR
which is the mask register.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/sysdev/ipic.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -845,12 +845,12 @@ void ipic_disable_mcp(enum ipic_mcp_irq
 
 u32 ipic_get_mcp_status(void)
 {
-	return ipic_read(primary_ipic->regs, IPIC_SERMR);
+	return ipic_read(primary_ipic->regs, IPIC_SERSR);
 }
 
 void ipic_clear_mcp_status(u32 mask)
 {
-	ipic_write(primary_ipic->regs, IPIC_SERMR, mask);
+	ipic_write(primary_ipic->regs, IPIC_SERSR, mask);
 }
 
 /* Return an interrupt vector or NO_IRQ if no interrupt is pending. */

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 079/115] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (75 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 078/115] powerpc/ipic: Fix status get and status clear Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 080/115] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andy Shevchenko, Markus Elfring,
	Andy Shevchenko, Sasha Levin

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

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

From: Markus Elfring <elfring@users.sourceforge.net>


[ Upstream commit f6c8a317ab208aee223776327c06f23342492d54 ]

Source code review for a specific software refactoring showed the need
for another correction because the error code "-1" was returned so far
if a call of the function "sony_call_snc_handle" failed here.
Thus assign the return value from these two function calls also to
the variable "err" and provide it in case of a failure.

Fixes: d6f15ed876b83a1a0eba1d0473eef58acc95444a ("sony-laptop: use soft rfkill status stored in hw")
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lkml.org/lkml/2017/10/31/463
Link: https://lkml.kernel.org/r/<CAHp75VcMkXCioCzmLE0+BTmkqc5RSOx9yPO0ectVHMrMvewgwg@mail.gmail.com>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/platform/x86/sony-laptop.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1655,17 +1655,19 @@ static int sony_nc_setup_rfkill(struct a
 	if (!rfk)
 		return -ENOMEM;
 
-	if (sony_call_snc_handle(sony_rfkill_handle, 0x200, &result) < 0) {
+	err = sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
+	if (err < 0) {
 		rfkill_destroy(rfk);
-		return -1;
+		return err;
 	}
 	hwblock = !(result & 0x1);
 
-	if (sony_call_snc_handle(sony_rfkill_handle,
-				sony_rfkill_address[nc_type],
-				&result) < 0) {
+	err = sony_call_snc_handle(sony_rfkill_handle,
+				   sony_rfkill_address[nc_type],
+				   &result);
+	if (err < 0) {
 		rfkill_destroy(rfk);
-		return -1;
+		return err;
 	}
 	swblock = !(result & 0x2);
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 080/115] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (76 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 079/115] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 081/115] iscsi-target: fix memory leak in lio_target_tiqn_addtpg() Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bart Van Assche, Christoph Hellwig,
	Mike Christie, Hannes Reinecke, Nicholas Bellinger, Sasha Levin

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

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

From: Bart Van Assche <bart.vanassche@wdc.com>


[ Upstream commit cfe2b621bb18d86e93271febf8c6e37622da2d14 ]

Avoid that cmd->se_cmd.se_tfo is read after a command has already been
freed.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Christie <mchristi@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/iscsi/iscsi_target.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -674,6 +674,7 @@ static int iscsit_add_reject_from_cmd(
 	unsigned char *buf)
 {
 	struct iscsi_conn *conn;
+	const bool do_put = cmd->se_cmd.se_tfo != NULL;
 
 	if (!cmd->conn) {
 		pr_err("cmd->conn is NULL for ITT: 0x%08x\n",
@@ -704,7 +705,7 @@ static int iscsit_add_reject_from_cmd(
 	 * Perform the kref_put now if se_cmd has already been setup by
 	 * scsit_setup_scsi_cmd()
 	 */
-	if (cmd->se_cmd.se_tfo != NULL) {
+	if (do_put) {
 		pr_debug("iscsi reject: calling target_put_sess_cmd >>>>>>\n");
 		target_put_sess_cmd(&cmd->se_cmd);
 	}

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 081/115] iscsi-target: fix memory leak in lio_target_tiqn_addtpg()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (77 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 080/115] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 082/115] target:fix condition return in core_pr_dump_initiator_port() Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, tangwenji, Nicholas Bellinger, Sasha Levin

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

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

From: tangwenji <tang.wenji@zte.com.cn>


[ Upstream commit 12d5a43b2dffb6cd28062b4e19024f7982393288 ]

tpg must free when call core_tpg_register() return fail

Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/iscsi/iscsi_target_configfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1210,7 +1210,7 @@ static struct se_portal_group *lio_targe
 
 	ret = core_tpg_register(wwn, &tpg->tpg_se_tpg, SCSI_PROTOCOL_ISCSI);
 	if (ret < 0)
-		return NULL;
+		goto free_out;
 
 	ret = iscsit_tpg_add_portal_group(tiqn, tpg);
 	if (ret != 0)
@@ -1222,6 +1222,7 @@ static struct se_portal_group *lio_targe
 	return &tpg->tpg_se_tpg;
 out:
 	core_tpg_deregister(&tpg->tpg_se_tpg);
+free_out:
 	kfree(tpg);
 	return NULL;
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 082/115] target:fix condition return in core_pr_dump_initiator_port()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (78 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 081/115] iscsi-target: fix memory leak in lio_target_tiqn_addtpg() Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 083/115] target/file: Do not return error for UNMAP if length is zero Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, tangwenji, Nicholas Bellinger, Sasha Levin

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

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

From: tangwenji <tang.wenji@zte.com.cn>


[ Upstream commit 24528f089d0a444070aa4f715ace537e8d6bf168 ]

When is pr_reg->isid_present_at_reg is false,this function should return.

This fixes a regression originally introduced by:

  commit d2843c173ee53cf4c12e7dfedc069a5bc76f0ac5
  Author: Andy Grover <agrover@redhat.com>
  Date:   Thu May 16 10:40:55 2013 -0700

      target: Alter core_pr_dump_initiator_port for ease of use

Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/target_core_pr.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -56,8 +56,10 @@ void core_pr_dump_initiator_port(
 	char *buf,
 	u32 size)
 {
-	if (!pr_reg->isid_present_at_reg)
+	if (!pr_reg->isid_present_at_reg) {
 		buf[0] = '\0';
+		return;
+	}
 
 	snprintf(buf, size, ",i,0x%s", pr_reg->pr_reg_isid);
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 083/115] target/file: Do not return error for UNMAP if length is zero
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (79 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 082/115] target:fix condition return in core_pr_dump_initiator_port() Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 084/115] arm-ccn: perf: Prevent module unload while PMU is in use Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiang Yi, Nicholas Bellinger, Sasha Levin

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

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

From: Jiang Yi <jiangyilism@gmail.com>


[ Upstream commit 594e25e73440863981032d76c9b1e33409ceff6e ]

The function fd_execute_unmap() in target_core_file.c calles

ret = file->f_op->fallocate(file, mode, pos, len);

Some filesystems implement fallocate() to return error if
length is zero (e.g. btrfs) but according to SCSI Block
Commands spec UNMAP should return success for zero length.

Signed-off-by: Jiang Yi <jiangyilism@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/target_core_file.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -466,6 +466,10 @@ fd_execute_unmap(struct se_cmd *cmd, sec
 	struct inode *inode = file->f_mapping->host;
 	int ret;
 
+	if (!nolb) {
+		return 0;
+	}
+
 	if (cmd->se_dev->dev_attrib.pi_prot_type) {
 		ret = fd_do_prot_unmap(cmd, lba, nolb);
 		if (ret)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 084/115] arm-ccn: perf: Prevent module unload while PMU is in use
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (80 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 083/115] target/file: Do not return error for UNMAP if length is zero Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 085/115] crypto: tcrypt - fix buffer lengths in test_aead_speed() Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pawel Moll, Will Deacon,
	Mark Rutland, Suzuki K Poulose, Sasha Levin

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

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

From: Suzuki K Poulose <suzuki.poulose@arm.com>


[ Upstream commit c7f5828bf77dcbd61d51f4736c1d5aa35663fbb4 ]

When the PMU driver is built as a module, the perf expects the
pmu->module to be valid, so that the driver is prevented from
being unloaded while it is in use. Fix the CCN pmu driver to
fill in this field.

Fixes: a33b0daab73a0 ("bus: ARM CCN PMU driver")
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/bus/arm-ccn.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/bus/arm-ccn.c
+++ b/drivers/bus/arm-ccn.c
@@ -1260,6 +1260,7 @@ static int arm_ccn_pmu_init(struct arm_c
 
 	/* Perf driver registration */
 	ccn->dt.pmu = (struct pmu) {
+		.module = THIS_MODULE,
 		.attr_groups = arm_ccn_pmu_attr_groups,
 		.task_ctx_nr = perf_invalid_context,
 		.event_init = arm_ccn_pmu_event_init,

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 085/115] crypto: tcrypt - fix buffer lengths in test_aead_speed()
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (81 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 084/115] arm-ccn: perf: Prevent module unload while PMU is in use Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 086/115] mm: Handle 0 flags in _calc_vm_trans() macro Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Robert Baronescu, Herbert Xu, Sasha Levin

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

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

From: Robert Baronescu <robert.baronescu@nxp.com>


[ Upstream commit 7aacbfcb331ceff3ac43096d563a1f93ed46e35e ]

Fix the way the length of the buffers used for
encryption / decryption are computed.
For e.g. in case of encryption, input buffer does not contain
an authentication tag.

Signed-off-by: Robert Baronescu <robert.baronescu@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 crypto/tcrypt.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -410,7 +410,7 @@ static void test_aead_speed(const char *
 			}
 
 			sg_init_aead(sg, xbuf,
-				    *b_size + (enc ? authsize : 0));
+				    *b_size + (enc ? 0 : authsize));
 
 			sg_init_aead(sgout, xoutbuf,
 				    *b_size + (enc ? authsize : 0));
@@ -418,7 +418,9 @@ static void test_aead_speed(const char *
 			sg_set_buf(&sg[0], assoc, aad_size);
 			sg_set_buf(&sgout[0], assoc, aad_size);
 
-			aead_request_set_crypt(req, sg, sgout, *b_size, iv);
+			aead_request_set_crypt(req, sg, sgout,
+					       *b_size + (enc ? 0 : authsize),
+					       iv);
 			aead_request_set_ad(req, aad_size);
 
 			if (secs)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 086/115] mm: Handle 0 flags in _calc_vm_trans() macro
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (82 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 085/115] crypto: tcrypt - fix buffer lengths in test_aead_speed() Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 087/115] clk: mediatek: add the option for determining PLL source clock Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jan Kara, Dan Williams, Sasha Levin

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

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

From: Jan Kara <jack@suse.cz>


[ Upstream commit 592e254502041f953e84d091eae2c68cba04c10b ]

_calc_vm_trans() does not handle the situation when some of the passed
flags are 0 (which can happen if these VM flags do not make sense for
the architecture). Improve the _calc_vm_trans() macro to return 0 in
such situation. Since all passed flags are constant, this does not add
any runtime overhead.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/mman.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -63,8 +63,9 @@ static inline int arch_validate_prot(uns
  * ("bit1" and "bit2" must be single bits)
  */
 #define _calc_vm_trans(x, bit1, bit2) \
+  ((!(bit1) || !(bit2)) ? 0 : \
   ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \
-   : ((x) & (bit1)) / ((bit1) / (bit2)))
+   : ((x) & (bit1)) / ((bit1) / (bit2))))
 
 /*
  * Combine the mmap "prot" argument into "vm_flags" used internally.

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 087/115] clk: mediatek: add the option for determining PLL source clock
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (83 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 086/115] mm: Handle 0 flags in _calc_vm_trans() macro Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 090/115] ppp: Destroy the mutex when cleanup Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Chen Zhong, Sean Wang, Stephen Boyd,
	Sasha Levin

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

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

From: Chen Zhong <chen.zhong@mediatek.com>


[ Upstream commit c955bf3998efa3355790a4d8c82874582f1bc727 ]

Since the previous setup always sets the PLL using crystal 26MHz, this
doesn't always happen in every MediaTek platform. So the patch added
flexibility for assigning extra member for determining the PLL source
clock.

Signed-off-by: Chen Zhong <chen.zhong@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/clk/mediatek/clk-mtk.h |    1 +
 drivers/clk/mediatek/clk-pll.c |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -174,6 +174,7 @@ struct mtk_pll_data {
 	uint32_t pcw_reg;
 	int pcw_shift;
 	const struct mtk_pll_div_table *div_table;
+	const char *parent_name;
 };
 
 void mtk_clk_register_plls(struct device_node *node,
--- a/drivers/clk/mediatek/clk-pll.c
+++ b/drivers/clk/mediatek/clk-pll.c
@@ -302,7 +302,10 @@ static struct clk *mtk_clk_register_pll(
 
 	init.name = data->name;
 	init.ops = &mtk_pll_ops;
-	init.parent_names = &parent_name;
+	if (data->parent_name)
+		init.parent_names = &data->parent_name;
+	else
+		init.parent_names = &parent_name;
 	init.num_parents = 1;
 
 	clk = clk_register(NULL, &pll->hw);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 090/115] ppp: Destroy the mutex when cleanup
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (84 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 087/115] clk: mediatek: add the option for determining PLL source clock Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 092/115] GFS2: Take inode off order_write list when setting jdata flag Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Gao Feng, Guillaume Nault,
	David S. Miller, Sasha Levin

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

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

From: Gao Feng <gfree.wind@vip.163.com>


[ Upstream commit f02b2320b27c16b644691267ee3b5c110846f49e ]

The mutex_destroy only makes sense when enable DEBUG_MUTEX. For the
good readbility, it's better to invoke it in exit func when the init
func invokes mutex_init.

Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
Acked-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ppp/ppp_generic.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -942,6 +942,7 @@ static __net_exit void ppp_exit_net(stru
 	unregister_netdevice_many(&list);
 	rtnl_unlock();
 
+	mutex_destroy(&pn->all_ppp_mutex);
 	idr_destroy(&pn->units_idr);
 }
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 092/115] GFS2: Take inode off order_write list when setting jdata flag
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (85 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 090/115] ppp: Destroy the mutex when cleanup Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 093/115] bcache: explicitly destroy mutex while exiting Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bob Peterson, Andreas Gruenbacher,
	Abhijith Das, Sasha Levin

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

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

From: Bob Peterson <rpeterso@redhat.com>


[ Upstream commit cc555b09d8c3817aeebda43a14ab67049a5653f7 ]

This patch fixes a deadlock caused when the jdata flag is set for
inodes that are already on the ordered write list. Since it is
on the ordered write list, log_flush calls gfs2_ordered_write which
calls filemap_fdatawrite. But since the inode had the jdata flag
set, that calls gfs2_jdata_writepages, which tries to start a new
transaction. A new transaction cannot be started because it tries
to acquire the log_flush rwsem which is already locked by the log
flush operation.

The bottom line is: We cannot switch an inode from ordered to jdata
until we eliminate any ordered data pages (via log flush) or any
log_flush operation afterward will create the circular dependency
above. So we need to flush the log before setting the diskflags to
switch the file mode, then we need to remove the inode from the
ordered writes list.

Before this patch, the log flush was done for jdata->ordered, but
that's wrong. If we're going from jdata to ordered, we don't need
to call gfs2_log_flush because the call to filemap_fdatawrite will
do it for us:

   filemap_fdatawrite() -> __filemap_fdatawrite_range()
      __filemap_fdatawrite_range() -> do_writepages()
         do_writepages() -> gfs2_jdata_writepages()
            gfs2_jdata_writepages() -> gfs2_log_flush()

This patch modifies function do_gfs2_set_flags so that if a file
has its jdata flag set, and it's already on the ordered write list,
the log will be flushed and it will be removed from the list
before setting the flag.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Acked-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/gfs2/file.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -255,7 +255,7 @@ static int do_gfs2_set_flags(struct file
 			goto out;
 	}
 	if ((flags ^ new_flags) & GFS2_DIF_JDATA) {
-		if (flags & GFS2_DIF_JDATA)
+		if (new_flags & GFS2_DIF_JDATA)
 			gfs2_log_flush(sdp, ip->i_gl, NORMAL_FLUSH);
 		error = filemap_fdatawrite(inode->i_mapping);
 		if (error)
@@ -263,6 +263,8 @@ static int do_gfs2_set_flags(struct file
 		error = filemap_fdatawait(inode->i_mapping);
 		if (error)
 			goto out;
+		if (new_flags & GFS2_DIF_JDATA)
+			gfs2_ordered_del_inode(ip);
 	}
 	error = gfs2_trans_begin(sdp, RES_DINODE, 0);
 	if (error)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 093/115] bcache: explicitly destroy mutex while exiting
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (86 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 092/115] GFS2: Take inode off order_write list when setting jdata flag Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 094/115] bcache: fix wrong cache_misses statistics Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Liang Chen, Michael Lyle, Coly Li,
	Eric Wheeler, Jens Axboe, Sasha Levin

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

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

From: Liang Chen <liangchen.linux@gmail.com>


[ Upstream commit 330a4db89d39a6b43f36da16824eaa7a7509d34d ]

mutex_destroy does nothing most of time, but it's better to call
it to make the code future proof and it also has some meaning
for like mutex debug.

As Coly pointed out in a previous review, bcache_exit() may not be
able to handle all the references properly if userspace registers
cache and backing devices right before bch_debug_init runs and
bch_debug_init failes later. So not exposing userspace interface
until everything is ready to avoid that issue.

Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
Reviewed-by: Michael Lyle <mlyle@lyle.org>
Reviewed-by: Coly Li <colyli@suse.de>
Reviewed-by: Eric Wheeler <bcache@linux.ewheeler.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/bcache/super.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2083,6 +2083,7 @@ static void bcache_exit(void)
 	if (bcache_major)
 		unregister_blkdev(bcache_major, "bcache");
 	unregister_reboot_notifier(&reboot);
+	mutex_destroy(&bch_register_lock);
 }
 
 static int __init bcache_init(void)
@@ -2101,14 +2102,15 @@ static int __init bcache_init(void)
 	bcache_major = register_blkdev(0, "bcache");
 	if (bcache_major < 0) {
 		unregister_reboot_notifier(&reboot);
+		mutex_destroy(&bch_register_lock);
 		return bcache_major;
 	}
 
 	if (!(bcache_wq = create_workqueue("bcache")) ||
 	    !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
-	    sysfs_create_files(bcache_kobj, files) ||
 	    bch_request_init() ||
-	    bch_debug_init(bcache_kobj))
+	    bch_debug_init(bcache_kobj) ||
+	    sysfs_create_files(bcache_kobj, files))
 		goto err;
 
 	return 0;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 094/115] bcache: fix wrong cache_misses statistics
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (87 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 093/115] bcache: explicitly destroy mutex while exiting Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 095/115] l2tp: cleanup l2tp_tunnel_delete calls Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, tang.junhui, Michael Lyle, Coly Li,
	Jens Axboe, Sasha Levin

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

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

From: "tang.junhui" <tang.junhui@zte.com.cn>


[ Upstream commit c157313791a999646901b3e3c6888514ebc36d62 ]

Currently, Cache missed IOs are identified by s->cache_miss, but actually,
there are many situations that missed IOs are not assigned a value for
s->cache_miss in cached_dev_cache_miss(), for example, a bypassed IO
(s->iop.bypass = 1), or the cache_bio allocate failed. In these situations,
it will go to out_put or out_submit, and s->cache_miss is null, which leads
bch_mark_cache_accounting() to treat this IO as a hit IO.

[ML: applied by 3-way merge]

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
Reviewed-by: Michael Lyle <mlyle@lyle.org>
Reviewed-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/bcache/request.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -468,6 +468,7 @@ struct search {
 	unsigned		recoverable:1;
 	unsigned		write:1;
 	unsigned		read_dirty_data:1;
+	unsigned		cache_missed:1;
 
 	unsigned long		start_time;
 
@@ -653,6 +654,7 @@ static inline struct search *search_allo
 
 	s->orig_bio		= bio;
 	s->cache_miss		= NULL;
+	s->cache_missed		= 0;
 	s->d			= d;
 	s->recoverable		= 1;
 	s->write		= (bio->bi_rw & REQ_WRITE) != 0;
@@ -776,7 +778,7 @@ static void cached_dev_read_done_bh(stru
 	struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
 
 	bch_mark_cache_accounting(s->iop.c, s->d,
-				  !s->cache_miss, s->iop.bypass);
+				  !s->cache_missed, s->iop.bypass);
 	trace_bcache_read(s->orig_bio, !s->cache_miss, s->iop.bypass);
 
 	if (s->iop.error)
@@ -795,6 +797,8 @@ static int cached_dev_cache_miss(struct
 	struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
 	struct bio *miss, *cache_bio;
 
+	s->cache_missed = 1;
+
 	if (s->cache_miss || s->iop.bypass) {
 		miss = bio_next_split(bio, sectors, GFP_NOIO, s->d->bio_split);
 		ret = miss == bio ? MAP_DONE : MAP_CONTINUE;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 095/115] l2tp: cleanup l2tp_tunnel_delete calls
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (88 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 094/115] bcache: fix wrong cache_misses statistics Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 096/115] xfs: fix log block underflow during recovery cycle verification Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Slaby, Sabrina Dubroca,
	Guillaume Nault, David S. Miller, netdev, Sasha Levin

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

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

From: Jiri Slaby <jslaby@suse.cz>


[ Upstream commit 4dc12ffeaeac939097a3f55c881d3dc3523dff0c ]

l2tp_tunnel_delete does not return anything since commit 62b982eeb458
("l2tp: fix race condition in l2tp_tunnel_delete").  But call sites of
l2tp_tunnel_delete still do casts to void to avoid unused return value
warnings.

Kill these now useless casts.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Sabrina Dubroca <sd@queasysnail.net>
Cc: Guillaume Nault <g.nault@alphalink.fr>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Acked-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/l2tp/l2tp_core.c    |    2 +-
 net/l2tp/l2tp_netlink.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1856,7 +1856,7 @@ static __net_exit void l2tp_exit_net(str
 
 	rcu_read_lock_bh();
 	list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
-		(void)l2tp_tunnel_delete(tunnel);
+		l2tp_tunnel_delete(tunnel);
 	}
 	rcu_read_unlock_bh();
 }
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -285,7 +285,7 @@ static int l2tp_nl_cmd_tunnel_delete(str
 	l2tp_tunnel_notify(&l2tp_nl_family, info,
 			   tunnel, L2TP_CMD_TUNNEL_DELETE);
 
-	(void) l2tp_tunnel_delete(tunnel);
+	l2tp_tunnel_delete(tunnel);
 
 out:
 	return ret;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 096/115] xfs: fix log block underflow during recovery cycle verification
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (89 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 095/115] l2tp: cleanup l2tp_tunnel_delete calls Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 097/115] xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Zorro Lang, Brian Foster,
	Darrick J. Wong, Sasha Levin

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

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

From: Brian Foster <bfoster@redhat.com>


[ Upstream commit 9f2a4505800607e537e9dd9dea4f55c4b0c30c7a ]

It is possible for mkfs to format very small filesystems with too
small of an internal log with respect to the various minimum size
and block count requirements. If this occurs when the log happens to
be smaller than the scan window used for cycle verification and the
scan wraps the end of the log, the start_blk calculation in
xlog_find_head() underflows and leads to an attempt to scan an
invalid range of log blocks. This results in log recovery failure
and a failed mount.

Since there may be filesystems out in the wild with this kind of
geometry, we cannot simply refuse to mount. Instead, cap the scan
window for cycle verification to the size of the physical log. This
ensures that the cycle verification proceeds as expected when the
scan wraps the end of the log.

Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/xfs/xfs_log_recover.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -738,7 +738,7 @@ xlog_find_head(
 	 * in the in-core log.  The following number can be made tighter if
 	 * we actually look at the block size of the filesystem.
 	 */
-	num_scan_bblks = XLOG_TOTAL_REC_SHIFT(log);
+	num_scan_bblks = min_t(int, log_bbnum, XLOG_TOTAL_REC_SHIFT(log));
 	if (head_blk >= num_scan_bblks) {
 		/*
 		 * We are guaranteed that the entire check can be performed

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 097/115] xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (90 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 096/115] xfs: fix log block underflow during recovery cycle verification Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 098/115] PCI: Detach driver before procfs & sysfs teardown on device remove Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Hellwig, Brian Foster,
	Darrick J. Wong, Sasha Levin

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

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

From: Christoph Hellwig <hch@lst.de>


[ Upstream commit 5e422f5e4fd71d18bc6b851eeb3864477b3d842e ]

There was one spot in xfs_bmap_add_extent_unwritten_real that didn't use the
passed in new extent state but always converted to normal, leading to wrong
behavior when converting from normal to unwritten.

Only found by code inspection, it seems like this code path to move partial
extent from written to unwritten while merging it with the next extent is
rarely exercised.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/xfs/libxfs/xfs_bmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -2670,7 +2670,7 @@ xfs_bmap_add_extent_unwritten_real(
 					&i)))
 				goto done;
 			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
-			cur->bc_rec.b.br_state = XFS_EXT_NORM;
+			cur->bc_rec.b.br_state = new->br_state;
 			if ((error = xfs_btree_insert(cur, &i)))
 				goto done;
 			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 098/115] PCI: Detach driver before procfs & sysfs teardown on device remove
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (91 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 097/115] xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 099/115] scsi: hpsa: cleanup sas_phy structures in sysfs when unloading Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alex Williamson, Bjorn Helgaas, Sasha Levin

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

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

From: Alex Williamson <alex.williamson@redhat.com>


[ Upstream commit 16b6c8bb687cc3bec914de09061fcb8411951fda ]

When removing a device, for example a VF being removed due to SR-IOV
teardown, a "soft" hot-unplug via 'echo 1 > remove' in sysfs, or an actual
hot-unplug, we first remove the procfs and sysfs attributes for the device
before attempting to release the device from any driver bound to it.
Unbinding the driver from the device can take time.  The device might need
to write out data or it might be actively in use.  If it's in use by
userspace through a vfio driver, the unbind might block until the user
releases the device.  This leads to a potentially non-trivial amount of
time where the device exists, but we've torn down the interfaces that
userspace uses to examine devices, for instance lspci might generate this
sort of error:

  pcilib: Cannot open /sys/bus/pci/devices/0000:01:0a.3/config
  lspci: Unable to read the standard configuration space header of device 0000:01:0a.3

We don't seem to have any dependence on this teardown ordering in the
kernel, so let's unbind the driver first, which is also more symmetric with
the instantiation of the device in pci_bus_add_device().

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/remove.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -20,9 +20,9 @@ static void pci_stop_dev(struct pci_dev
 	pci_pme_active(dev, false);
 
 	if (dev->is_added) {
+		device_release_driver(&dev->dev);
 		pci_proc_detach_device(dev);
 		pci_remove_sysfs_dev_files(dev);
-		device_release_driver(&dev->dev);
 		dev->is_added = 0;
 	}
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 099/115] scsi: hpsa: cleanup sas_phy structures in sysfs when unloading
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (92 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 098/115] PCI: Detach driver before procfs & sysfs teardown on device remove Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Don Brace, Martin Wilck,
	Martin K. Petersen, Sasha Levin

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

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

From: Martin Wilck <mwilck@suse.de>


[ Upstream commit 55ca38b4255bb336c2d35990bdb2b368e19b435a ]

I am resubmitting this patch on behalf of Martin Wilck with his
permission.

The original patch can be found here:
https://www.spinics.net/lists/linux-scsi/msg102083.html

This patch did not help until Hannes's
commit 9441284fbc39 ("scsi-fixup-kernel-warning-during-rmmod")
was applied to the kernel.

--------------------------------------
Original patch description from Martin:
--------------------------------------

When the hpsa module is unloaded using rmmod, dangling
symlinks remain under /sys/class/sas_phy. Fix this by
calling sas_phy_delete() rather than sas_phy_free (which,
according to comments, should not be called for PHYs that
have been set up successfully, anyway).

Tested-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/hpsa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -9335,9 +9335,9 @@ static void hpsa_free_sas_phy(struct hps
 	struct sas_phy *phy = hpsa_sas_phy->phy;
 
 	sas_port_delete_phy(hpsa_sas_phy->parent_port->port, phy);
-	sas_phy_free(phy);
 	if (hpsa_sas_phy->added_to_port)
 		list_del(&hpsa_sas_phy->phy_list_entry);
+	sas_phy_delete(phy);
 	kfree(hpsa_sas_phy);
 }
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (93 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 099/115] scsi: hpsa: cleanup sas_phy structures in sysfs when unloading Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2018-01-21 23:05   ` Ben Hutchings
  2017-12-18 15:49 ` [PATCH 4.4 101/115] powerpc/perf/hv-24x7: Fix incorrect comparison in memord Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  112 siblings, 1 reply; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Don Brace, Martin Wilck,
	Martin K. Petersen, Sasha Levin

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

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

From: Martin Wilck <mwilck@suse.de>


[ Upstream commit dfb2e6f46b3074eb85203d8f0888b71ec1c2e37a ]

This patch cleans up a lot of warnings when unloading the driver.

A current example of the stack trace starts with:
    [  142.570715] sysfs group 'power' not found for kobject 'port-5:0'
There can be hundreds of these messages during a driver unload.

I am resubmitting this patch on behalf of Martin Wilck with his
permission.

His original patch can be found here:
https://www.spinics.net/lists/linux-scsi/msg102085.html

This patch did not help until Hannes's
commit 9441284fbc39 ("scsi-fixup-kernel-warning-during-rmmod")
was applied to the kernel.

---------------------------
Original patch description:
---------------------------

Unloading the hpsa driver causes warnings

[ 1063.793652] WARNING: CPU: 1 PID: 4850 at ../fs/sysfs/group.c:237 device_del+0x54/0x240()
[ 1063.793659] sysfs group ffffffff81cf21a0 not found for kobject 'port-2:0'

with two different stacks:
1)
[ 1063.793774]  [<ffffffff81448af4>] device_del+0x54/0x240
[ 1063.793780]  [<ffffffff8145178a>] transport_remove_classdev+0x4a/0x60
[ 1063.793784]  [<ffffffff81451216>] attribute_container_device_trigger+0xa6/0xb0
[ 1063.793802]  [<ffffffffa0105d46>] sas_port_delete+0x126/0x160 [scsi_transport_sas]
[ 1063.793819]  [<ffffffffa036ebcc>] hpsa_free_sas_port+0x3c/0x70 [hpsa]

2)
[ 1063.797103]  [<ffffffff81448af4>] device_del+0x54/0x240
[ 1063.797118]  [<ffffffffa0105d4e>] sas_port_delete+0x12e/0x160 [scsi_transport_sas]
[ 1063.797134]  [<ffffffffa036ebcc>] hpsa_free_sas_port+0x3c/0x70 [hpsa]

This is caused by the fact that host device hostX is deleted before the
SAS transport devices hostX/port-a:b.

This patch fixes this by reverting the order of device deletions.

Tested-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin Wilck <mwilck@suse.de>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/hpsa.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -8808,6 +8808,8 @@ static void hpsa_remove_one(struct pci_d
 	destroy_workqueue(h->rescan_ctlr_wq);
 	destroy_workqueue(h->resubmit_wq);
 
+	hpsa_delete_sas_host(h);
+
 	/*
 	 * Call before disabling interrupts.
 	 * scsi_remove_host can trigger I/O operations especially
@@ -8842,8 +8844,6 @@ static void hpsa_remove_one(struct pci_d
 	h->lockup_detected = NULL;			/* init_one 2 */
 	/* (void) pci_disable_pcie_error_reporting(pdev); */	/* init_one 1 */
 
-	hpsa_delete_sas_host(h);
-
 	kfree(h);					/* init_one 1 */
 }
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 101/115] powerpc/perf/hv-24x7: Fix incorrect comparison in memord
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (94 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 102/115] tty fix oops when rmmod 8250 Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, David Binderman, Michael Ellerman,
	Sasha Levin

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

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

From: Michael Ellerman <mpe@ellerman.id.au>


[ Upstream commit 05c14c03138532a3cb2aa29c2960445c8753343b ]

In the hv-24x7 code there is a function memord() which tries to
implement a sort function return -1, 0, 1. However one of the
conditions is incorrect, such that it can never be true, because we
will have already returned.

I don't believe there is a bug in practice though, because the
comparisons are an optimisation prior to calling memcmp().

Fix it by swapping the second comparision, so it can be true.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/perf/hv-24x7.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -514,7 +514,7 @@ static int memord(const void *d1, size_t
 {
 	if (s1 < s2)
 		return 1;
-	if (s2 > s1)
+	if (s1 > s2)
 		return -1;
 
 	return memcmp(d1, d2, s1);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 102/115] tty fix oops when rmmod 8250
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (95 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 101/115] powerpc/perf/hv-24x7: Fix incorrect comparison in memord Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 103/115] usb: musb: da8xx: fix babble condition handling Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, nixiaoming, Sasha Levin

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

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

From: nixiaoming <nixiaoming@huawei.com>


[ Upstream commit c79dde629d2027ca80329c62854a7635e623d527 ]

After rmmod 8250.ko
tty_kref_put starts kwork (release_one_tty) to release proc interface
oops when accessing driver->driver_name in proc_tty_unregister_driver

Use jprobe, found driver->driver_name point to 8250.ko
static static struct uart_driver serial8250_reg
.driver_name= serial,

Use name in proc_dir_entry instead of driver->driver_name to fix oops

test on linux 4.1.12:

BUG: unable to handle kernel paging request at ffffffffa01979de
IP: [<ffffffff81310f40>] strchr+0x0/0x30
PGD 1a0d067 PUD 1a0e063 PMD 851c1f067 PTE 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: ... ...  [last unloaded: 8250]
CPU: 7 PID: 116 Comm: kworker/7:1 Tainted: G           O    4.1.12 #1
Hardware name: Insyde RiverForest/Type2 - Board Product Name1, BIOS NE5KV904 12/21/2015
Workqueue: events release_one_tty
task: ffff88085b684960 ti: ffff880852884000 task.ti: ffff880852884000
RIP: 0010:[<ffffffff81310f40>]  [<ffffffff81310f40>] strchr+0x0/0x30
RSP: 0018:ffff880852887c90  EFLAGS: 00010282
RAX: ffffffff81a5eca0 RBX: ffffffffa01979de RCX: 0000000000000004
RDX: ffff880852887d10 RSI: 000000000000002f RDI: ffffffffa01979de
RBP: ffff880852887cd8 R08: 0000000000000000 R09: ffff88085f5d94d0
R10: 0000000000000195 R11: 0000000000000000 R12: ffffffffa01979de
R13: ffff880852887d00 R14: ffffffffa01979de R15: ffff88085f02e840
FS:  0000000000000000(0000) GS:ffff88085f5c0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffa01979de CR3: 0000000001a0c000 CR4: 00000000001406e0
Stack:
 ffffffff812349b1 ffff880852887cb8 ffff880852887d10 ffff88085f5cd6c2
 ffff880852800a80 ffffffffa01979de ffff880852800a84 0000000000000010
 ffff88085bb28bd8 ffff880852887d38 ffffffff812354f0 ffff880852887d08
Call Trace:
 [<ffffffff812349b1>] ? __xlate_proc_name+0x71/0xd0
 [<ffffffff812354f0>] remove_proc_entry+0x40/0x180
 [<ffffffff815f6811>] ? _raw_spin_lock_irqsave+0x41/0x60
 [<ffffffff813be520>] ? destruct_tty_driver+0x60/0xe0
 [<ffffffff81237c68>] proc_tty_unregister_driver+0x28/0x40
 [<ffffffff813be548>] destruct_tty_driver+0x88/0xe0
 [<ffffffff813be5bd>] tty_driver_kref_put+0x1d/0x20
 [<ffffffff813becca>] release_one_tty+0x5a/0xd0
 [<ffffffff81074159>] process_one_work+0x139/0x420
 [<ffffffff810745a1>] worker_thread+0x121/0x450
 [<ffffffff81074480>] ? process_scheduled_works+0x40/0x40
 [<ffffffff8107a16c>] kthread+0xec/0x110
 [<ffffffff81080000>] ? tg_rt_schedulable+0x210/0x220
 [<ffffffff8107a080>] ? kthread_freezable_should_stop+0x80/0x80
 [<ffffffff815f7292>] ret_from_fork+0x42/0x70
 [<ffffffff8107a080>] ? kthread_freezable_should_stop+0x80/0x80

Signed-off-by: nixiaoming <nixiaoming@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/proc/proc_tty.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -14,6 +14,7 @@
 #include <linux/tty.h>
 #include <linux/seq_file.h>
 #include <linux/bitops.h>
+#include "internal.h"
 
 /*
  * The /proc/tty directory inodes...
@@ -164,7 +165,7 @@ void proc_tty_unregister_driver(struct t
 	if (!ent)
 		return;
 		
-	remove_proc_entry(driver->driver_name, proc_tty_driver);
+	remove_proc_entry(ent->name, proc_tty_driver);
 	
 	driver->proc_entry = NULL;
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 103/115] usb: musb: da8xx: fix babble condition handling
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (96 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 102/115] tty fix oops when rmmod 8250 Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 104/115] pinctrl: adi2: Fix Kconfig build problem Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Bin Liu

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

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

From: Bin Liu <b-liu@ti.com>

commit bd3486ded7a0c313a6575343e6c2b21d14476645 upstream.

When babble condition happens, the musb controller might automatically
turns off VBUS. On DA8xx platform, the controller generates drvvbus
interrupt for turning off VBUS along with the babble interrupt.

In this case, we should handle the babble interrupt first and recover
from the babble condition.

This change ignores the drvvbus interrupt if babble interrupt is also
generated at the same time, so the babble recovery routine works
properly.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/musb/da8xx.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -350,7 +350,15 @@ static irqreturn_t da8xx_musb_interrupt(
 			musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
 			portstate(musb->port1_status |= USB_PORT_STAT_POWER);
 			del_timer(&otg_workaround);
-		} else {
+		} else if (!(musb->int_usb & MUSB_INTR_BABBLE)){
+			/*
+			 * When babble condition happens, drvvbus interrupt
+			 * is also generated. Ignore this drvvbus interrupt
+			 * and let babble interrupt handler recovers the
+			 * controller; otherwise, the host-mode flag is lost
+			 * due to the MUSB_DEV_MODE() call below and babble
+			 * recovery logic will not called.
+			 */
 			musb->is_active = 0;
 			MUSB_DEV_MODE(musb);
 			otg->default_a = 0;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 104/115] pinctrl: adi2: Fix Kconfig build problem
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (97 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 103/115] usb: musb: da8xx: fix babble condition handling Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 105/115] raid5: Set R5_Expanded on parity devices as well as data Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Steven Miao, Huanhuan Feng,
	Linus Walleij, Sasha Levin

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

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

From: Linus Walleij <linus.walleij@linaro.org>


[ Upstream commit 1c363531dd814dc4fe10865722bf6b0f72ce4673 ]

The build robot is complaining on Blackfin:

drivers/pinctrl/pinctrl-adi2.c: In function 'port_setup':
>> drivers/pinctrl/pinctrl-adi2.c:221:21: error: dereferencing
   pointer to incomplete type 'struct gpio_port_t'
      writew(readw(&regs->port_fer) & ~BIT(offset),
                        ^~
drivers/pinctrl/pinctrl-adi2.c: In function 'adi_gpio_ack_irq':
>> drivers/pinctrl/pinctrl-adi2.c:266:18: error: dereferencing
pointer to incomplete type 'struct bfin_pint_regs'
      if (readl(&regs->invert_set) & pintbit)
                     ^~
It seems the driver need to include <asm/gpio.h> and <asm/irq.h>
to compile.

The Blackfin architecture was re-defining the Kconfig
PINCTRL symbol which is not OK, so replaced this with
PINCTRL_BLACKFIN_ADI2 which selects PINCTRL and PINCTRL_ADI2
just like most arches do.

Further, the old GPIO driver symbol GPIO_ADI was possible to
select at the same time as selecting PINCTRL. This was not
working because the arch-local <asm/gpio.h> header contains
an explicit #ifndef PINCTRL clause making compilation break
if you combine them. The same is true for DEBUG_MMRS.

Make sure the ADI2 pinctrl driver is not selected at the same
time as the old GPIO implementation. (This should be converted
to use gpiolib or pincontrol and move to drivers/...) Also make
sure the old GPIO_ADI driver or DEBUG_MMRS is not selected at
the same time as the new PINCTRL implementation, and only make
PINCTRL_ADI2 selectable for the Blackfin families that actually
have it.

This way it is still possible to add e.g. I2C-based pin
control expanders on the Blackfin.

Cc: Steven Miao <realmz6@gmail.com>
Cc: Huanhuan Feng <huanhuan.feng@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/blackfin/Kconfig       |    7 +++++--
 arch/blackfin/Kconfig.debug |    1 +
 drivers/pinctrl/Kconfig     |    3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)

--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -318,11 +318,14 @@ config BF53x
 
 config GPIO_ADI
 	def_bool y
+	depends on !PINCTRL
 	depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561)
 
-config PINCTRL
+config PINCTRL_BLACKFIN_ADI2
 	def_bool y
-	depends on BF54x || BF60x
+	depends on (BF54x || BF60x)
+	select PINCTRL
+	select PINCTRL_ADI2
 
 config MEM_MT48LC64M4A2FB_7E
 	bool
--- a/arch/blackfin/Kconfig.debug
+++ b/arch/blackfin/Kconfig.debug
@@ -17,6 +17,7 @@ config DEBUG_VERBOSE
 
 config DEBUG_MMRS
 	tristate "Generate Blackfin MMR tree"
+	depends on !PINCTRL
 	select DEBUG_FS
 	help
 	  Create a tree of Blackfin MMRs via the debugfs tree.  If
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -26,7 +26,8 @@ config DEBUG_PINCTRL
 
 config PINCTRL_ADI2
 	bool "ADI pin controller driver"
-	depends on BLACKFIN
+	depends on (BF54x || BF60x)
+	depends on !GPIO_ADI
 	select PINMUX
 	select IRQ_DOMAIN
 	help

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 105/115] raid5: Set R5_Expanded on parity devices as well as data.
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (98 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 104/115] pinctrl: adi2: Fix Kconfig build problem Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 106/115] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Curt, NeilBrown, Shaohua Li, Sasha Levin

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

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

From: NeilBrown <neilb@suse.com>


[ Upstream commit 235b6003fb28f0dd8e7ed8fbdb088bb548291766 ]

When reshaping a fully degraded raid5/raid6 to a larger
nubmer of devices, the new device(s) are not in-sync
and so that can make the newly grown stripe appear to be
"failed".
To avoid this, we set the R5_Expanded flag to say "Even though
this device is not fully in-sync, this block is safe so
don't treat the device as failed for this stripe".
This flag is set for data devices, not not for parity devices.

Consequently, if you have a RAID6 with two devices that are partly
recovered and a spare, and start a reshape to include the spare,
then when the reshape gets past the point where the recovery was
up to, it will think the stripes are failed and will get into
an infinite loop, failing to make progress.

So when contructing parity on an EXPAND_READY stripe,
set R5_Expanded.

Reported-by: Curt <lightspd@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/raid5.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1681,8 +1681,11 @@ static void ops_complete_reconstruct(voi
 		struct r5dev *dev = &sh->dev[i];
 
 		if (dev->written || i == pd_idx || i == qd_idx) {
-			if (!discard && !test_bit(R5_SkipCopy, &dev->flags))
+			if (!discard && !test_bit(R5_SkipCopy, &dev->flags)) {
 				set_bit(R5_UPTODATE, &dev->flags);
+				if (test_bit(STRIPE_EXPAND_READY, &sh->state))
+					set_bit(R5_Expanded, &dev->flags);
+			}
 			if (fua)
 				set_bit(R5_WantFUA, &dev->flags);
 			if (sync)

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 106/115] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (99 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 105/115] raid5: Set R5_Expanded on parity devices as well as data Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 107/115] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kurt Garloff, Hannes Reinecke,
	Martin K. Petersen, Sasha Levin

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

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

From: Kurt Garloff <garloff@suse.de>


[ Upstream commit 909cf3e16a5274fe2127cf3cea5c8dba77b2c412 ]

All EMC SYMMETRIX support REPORT_LUNS, even if configured to report
SCSI-2 for whatever reason.

Signed-off-by: Kurt Garloff <garloff@suse.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/scsi_devinfo.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -160,7 +160,7 @@ static struct {
 	{"DGC", "RAID", NULL, BLIST_SPARSELUN},	/* Dell PV 650F, storage on LUN 0 */
 	{"DGC", "DISK", NULL, BLIST_SPARSELUN},	/* Dell PV 650F, no storage on LUN 0 */
 	{"EMC",  "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
-	{"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_FORCELUN},
+	{"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_REPORTLUN2},
 	{"EMULEX", "MD21/S2     ESDI", NULL, BLIST_SINGLELUN},
 	{"easyRAID", "16P", NULL, BLIST_NOREPORTLUN},
 	{"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN},

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 107/115] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (100 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 106/115] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 108/115] scsi: sd: change manage_start_stop to bool in sysfs interface Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jia-Ju Bai, Sasha Levin

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

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

From: Jia-Ju Bai <baijiaju1990@163.com>


[ Upstream commit 42c8eb3f6e15367981b274cb79ee4657e2c6949d ]

The driver may sleep under a spinlock, and the function call path is:
vt6655_suspend (acquire the spinlock)
  pci_set_power_state
    __pci_start_power_transition (drivers/pci/pci.c)
      msleep --> may sleep

To fix it, pci_set_power_state is called without having a spinlock.

This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/vt6655/device_main.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1693,10 +1693,11 @@ static int vt6655_suspend(struct pci_dev
 	MACbShutdown(priv->PortOffset);
 
 	pci_disable_device(pcid);
-	pci_set_power_state(pcid, pci_choose_state(pcid, state));
 
 	spin_unlock_irqrestore(&priv->lock, flags);
 
+	pci_set_power_state(pcid, pci_choose_state(pcid, state));
+
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 108/115] scsi: sd: change manage_start_stop to bool in sysfs interface
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (101 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 107/115] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 109/115] scsi: sd: change allow_restart " Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, weiping zhang, Martin K. Petersen,
	Sasha Levin

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

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

From: weiping zhang <zhangweiping@didichuxing.com>


[ Upstream commit 623401ee33e42cee64d333877892be8db02951eb ]

/sys/class/scsi_disk/0:2:0:0/manage_start_stop can be changed to 0
unexpectly by writing an invalid string.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/sd.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -233,11 +233,15 @@ manage_start_stop_store(struct device *d
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct scsi_device *sdp = sdkp->device;
+	bool v;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
-	sdp->manage_start_stop = simple_strtoul(buf, NULL, 10);
+	if (kstrtobool(buf, &v))
+		return -EINVAL;
+
+	sdp->manage_start_stop = v;
 
 	return count;
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 109/115] scsi: sd: change allow_restart to bool in sysfs interface
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (102 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 108/115] scsi: sd: change manage_start_stop to bool in sysfs interface Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 110/115] scsi: bfa: integer overflow in debugfs Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, weiping zhang, Martin K. Petersen,
	Sasha Levin

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

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

From: weiping zhang <zhangweiping@didichuxing.com>


[ Upstream commit 658e9a6dc1126f21fa417cd213e1cdbff8be0ba2 ]

/sys/class/scsi_disk/0:2:0:0/allow_restart can be changed to 0
unexpectedly by writing an invalid string such as the following:

echo asdf > /sys/class/scsi_disk/0:2:0:0/allow_restart

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/sd.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -259,6 +259,7 @@ static ssize_t
 allow_restart_store(struct device *dev, struct device_attribute *attr,
 		    const char *buf, size_t count)
 {
+	bool v;
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct scsi_device *sdp = sdkp->device;
 
@@ -268,7 +269,10 @@ allow_restart_store(struct device *dev,
 	if (sdp->type != TYPE_DISK)
 		return -EINVAL;
 
-	sdp->allow_restart = simple_strtoul(buf, NULL, 10);
+	if (kstrtobool(buf, &v))
+		return -EINVAL;
+
+	sdp->allow_restart = v;
 
 	return count;
 }

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 110/115] scsi: bfa: integer overflow in debugfs
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (103 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 109/115] scsi: sd: change allow_restart " Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 111/115] udf: Avoid overflow when session starts at large offset Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Martin K. Petersen,
	Sasha Levin

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>


[ Upstream commit 3e351275655d3c84dc28abf170def9786db5176d ]

We could allocate less memory than intended because we do:

	bfad->regdata = kzalloc(len << 2, GFP_KERNEL);

The shift can overflow leading to a crash.  This is debugfs code so the
impact is very small.  I fixed the network version of this in March with
commit 13e2d5187f6b ("bna: integer overflow bug in debugfs").

Fixes: ab2a9ba189e8 ("[SCSI] bfa: add debugfs support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/bfa/bfad_debugfs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/scsi/bfa/bfad_debugfs.c
+++ b/drivers/scsi/bfa/bfad_debugfs.c
@@ -254,7 +254,8 @@ bfad_debugfs_write_regrd(struct file *fi
 	struct bfad_s *bfad = port->bfad;
 	struct bfa_s *bfa = &bfad->bfa;
 	struct bfa_ioc_s *ioc = &bfa->ioc;
-	int addr, len, rc, i;
+	int addr, rc, i;
+	u32 len;
 	u32 *regbuf;
 	void __iomem *rb, *reg_addr;
 	unsigned long flags;
@@ -265,7 +266,7 @@ bfad_debugfs_write_regrd(struct file *fi
 		return PTR_ERR(kern_buf);
 
 	rc = sscanf(kern_buf, "%x:%x", &addr, &len);
-	if (rc < 2) {
+	if (rc < 2 || len > (UINT_MAX >> 2)) {
 		printk(KERN_INFO
 			"bfad[%d]: %s failed to read user buf\n",
 			bfad->inst_no, __func__);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 111/115] udf: Avoid overflow when session starts at large offset
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (104 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 110/115] scsi: bfa: integer overflow in debugfs Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 112/115] macvlan: Only deliver one copy of the frame to the macvlan interface Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Cezary Sliwa, Jan Kara, Sasha Levin

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

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

From: Jan Kara <jack@suse.cz>


[ Upstream commit abdc0eb06964fe1d2fea6dd1391b734d0590365d ]

When session starts beyond offset 2^31 the arithmetics in
udf_check_vsd() would overflow. Make sure the computation is done in
large enough type.

Reported-by: Cezary Sliwa <sliwa@ifpan.edu.pl>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/udf/super.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -705,7 +705,7 @@ static loff_t udf_check_vsd(struct super
 	else
 		sectorsize = sb->s_blocksize;
 
-	sector += (sbi->s_session << sb->s_blocksize_bits);
+	sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits);
 
 	udf_debug("Starting at sector %u (%ld byte sectors)\n",
 		  (unsigned int)(sector >> sb->s_blocksize_bits),

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 112/115] macvlan: Only deliver one copy of the frame to the macvlan interface
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (105 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 111/115] udf: Avoid overflow when session starts at large offset Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 113/115] RDMA/cma: Avoid triggering undefined behavior Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexander Duyck, David S. Miller,
	Sasha Levin

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

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

From: Alexander Duyck <alexander.h.duyck@intel.com>


[ Upstream commit dd6b9c2c332b40f142740d1b11fb77c653ff98ea ]

This patch intoduces a slight adjustment for macvlan to address the fact
that in source mode I was seeing two copies of any packet addressed to the
macvlan interface being delivered where there should have been only one.

The issue appears to be that one copy was delivered based on the source MAC
address and then the second copy was being delivered based on the
destination MAC address. To fix it I am just treating a unicast address
match as though it is not a match since source based macvlan isn't supposed
to be matching based on the destination MAC anyway.

Fixes: 79cf79abce71 ("macvlan: add source mode")
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/macvlan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -441,7 +441,7 @@ static rx_handler_result_t macvlan_handl
 					      struct macvlan_dev, list);
 	else
 		vlan = macvlan_hash_lookup(port, eth->h_dest);
-	if (vlan == NULL)
+	if (!vlan || vlan->mode == MACVLAN_MODE_SOURCE)
 		return RX_HANDLER_PASS;
 
 	dev = vlan->dev;

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 113/115] RDMA/cma: Avoid triggering undefined behavior
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (106 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 112/115] macvlan: Only deliver one copy of the frame to the macvlan interface Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 15:49 ` [PATCH 4.4 114/115] IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bart Van Assche, Sean Hefty,
	Doug Ledford, Sasha Levin

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

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

From: Bart Van Assche <bart.vanassche@wdc.com>


[ Upstream commit c0b64f58e8d49570aa9ee55d880f92c20ff0166b ]

According to the C standard the behavior of computations with
integer operands is as follows:
* A computation involving unsigned operands can never overflow,
  because a result that cannot be represented by the resulting
  unsigned integer type is reduced modulo the number that is one
  greater than the largest value that can be represented by the
  resulting type.
* The behavior for signed integer underflow and overflow is
  undefined.

Hence only use unsigned integers when checking for integer
overflow.

This patch is what I came up with after having analyzed the
following smatch warnings:

drivers/infiniband/core/cma.c:3448: cma_resolve_ib_udp() warn: signed overflow undefined. 'offset + conn_param->private_data_len < conn_param->private_data_len'
drivers/infiniband/core/cma.c:3505: cma_connect_ib() warn: signed overflow undefined. 'offset + conn_param->private_data_len < conn_param->private_data_len'

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/infiniband/core/cma.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1353,7 +1353,7 @@ static struct rdma_id_private *cma_id_fr
 	return id_priv;
 }
 
-static inline int cma_user_data_offset(struct rdma_id_private *id_priv)
+static inline u8 cma_user_data_offset(struct rdma_id_private *id_priv)
 {
 	return cma_family(id_priv) == AF_IB ? 0 : sizeof(struct cma_hdr);
 }
@@ -1731,7 +1731,8 @@ static int cma_req_handler(struct ib_cm_
 	struct rdma_id_private *listen_id, *conn_id;
 	struct rdma_cm_event event;
 	struct net_device *net_dev;
-	int offset, ret;
+	u8 offset;
+	int ret;
 
 	listen_id = cma_id_from_event(cm_id, ib_event, &net_dev);
 	if (IS_ERR(listen_id))
@@ -3118,7 +3119,8 @@ static int cma_resolve_ib_udp(struct rdm
 	struct ib_cm_sidr_req_param req;
 	struct ib_cm_id	*id;
 	void *private_data;
-	int offset, ret;
+	u8 offset;
+	int ret;
 
 	memset(&req, 0, sizeof req);
 	offset = cma_user_data_offset(id_priv);
@@ -3175,7 +3177,8 @@ static int cma_connect_ib(struct rdma_id
 	struct rdma_route *route;
 	void *private_data;
 	struct ib_cm_id	*id;
-	int offset, ret;
+	u8 offset;
+	int ret;
 
 	memset(&req, 0, sizeof req);
 	offset = cma_user_data_offset(id_priv);

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4 114/115] IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (107 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 113/115] RDMA/cma: Avoid triggering undefined behavior Greg Kroah-Hartman
@ 2017-12-18 15:49 ` Greg Kroah-Hartman
  2017-12-18 18:17 ` [PATCH 4.4 000/115] 4.4.107-stable review Nathan Chancellor
                   ` (3 subsequent siblings)
  112 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-18 15:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alex Vesker, Sasha Levin

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

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

From: Alex Vesker <valex@mellanox.com>


[ Upstream commit b4b678b06f6eef18bff44a338c01870234db0bc9 ]

When ndo_open and ndo_stop are called RTNL lock should be held.
In this specific case ipoib_ib_dev_open calls the offloaded ndo_open
which re-sets the number of TX queue assuming RTNL lock is held.
Since RTNL lock is not held, RTNL assert will fail.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/infiniband/ulp/ipoib/ipoib_ib.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -1044,10 +1044,15 @@ static void __ipoib_ib_dev_flush(struct
 		ipoib_ib_dev_down(dev);
 
 	if (level == IPOIB_FLUSH_HEAVY) {
+		rtnl_lock();
 		if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
 			ipoib_ib_dev_stop(dev);
-		if (ipoib_ib_dev_open(dev) != 0)
+
+		result = ipoib_ib_dev_open(dev);
+		rtnl_unlock();
+		if (result)
 			return;
+
 		if (netif_queue_stopped(dev))
 			netif_start_queue(dev);
 	}

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 000/115] 4.4.107-stable review
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (108 preceding siblings ...)
  2017-12-18 15:49 ` [PATCH 4.4 114/115] IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop Greg Kroah-Hartman
@ 2017-12-18 18:17 ` Nathan Chancellor
  2017-12-19  7:34   ` Greg Kroah-Hartman
  2017-12-18 20:26 ` Shuah Khan
                   ` (2 subsequent siblings)
  112 siblings, 1 reply; 156+ messages in thread
From: Nathan Chancellor @ 2017-12-18 18:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuahkh, patches,
	ben.hutchings, lkft-triage, stable

On Mon, Dec 18, 2017 at 04:47:49PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.107 release.
> There are 115 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 Wed Dec 20 15:28:15 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/v4.x/stable-review/patch-4.4.107-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-4.4.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 
> -------------
> Pseudo-Shortlog of commits:
> 
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>     Linux 4.4.107-rc1
> 
> Miaoqing Pan <miaoqing@codeaurora.org>
>     ath9k: fix tx99 potential info leak
> 
> Alex Vesker <valex@mellanox.com>
>     IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop
> 
> Bart Van Assche <bart.vanassche@wdc.com>
>     RDMA/cma: Avoid triggering undefined behavior
> 
> Alexander Duyck <alexander.h.duyck@intel.com>
>     macvlan: Only deliver one copy of the frame to the macvlan interface
> 
> Jan Kara <jack@suse.cz>
>     udf: Avoid overflow when session starts at large offset
> 
> Dan Carpenter <dan.carpenter@oracle.com>
>     scsi: bfa: integer overflow in debugfs
> 
> weiping zhang <zhangweiping@didichuxing.com>
>     scsi: sd: change allow_restart to bool in sysfs interface
> 
> weiping zhang <zhangweiping@didichuxing.com>
>     scsi: sd: change manage_start_stop to bool in sysfs interface
> 
> Jia-Ju Bai <baijiaju1990@163.com>
>     vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend
> 
> Kurt Garloff <garloff@suse.de>
>     scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry
> 
> NeilBrown <neilb@suse.com>
>     raid5: Set R5_Expanded on parity devices as well as data.
> 
> Linus Walleij <linus.walleij@linaro.org>
>     pinctrl: adi2: Fix Kconfig build problem
> 
> Bin Liu <b-liu@ti.com>
>     usb: musb: da8xx: fix babble condition handling
> 
> nixiaoming <nixiaoming@huawei.com>
>     tty fix oops when rmmod 8250
> 
> Michael Ellerman <mpe@ellerman.id.au>
>     powerpc/perf/hv-24x7: Fix incorrect comparison in memord
> 
> Martin Wilck <mwilck@suse.de>
>     scsi: hpsa: destroy sas transport properties before scsi_host
> 
> Martin Wilck <mwilck@suse.de>
>     scsi: hpsa: cleanup sas_phy structures in sysfs when unloading
> 
> Alex Williamson <alex.williamson@redhat.com>
>     PCI: Detach driver before procfs & sysfs teardown on device remove
> 
> Christoph Hellwig <hch@lst.de>
>     xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real
> 
> Brian Foster <bfoster@redhat.com>
>     xfs: fix log block underflow during recovery cycle verification
> 
> Jiri Slaby <jslaby@suse.cz>
>     l2tp: cleanup l2tp_tunnel_delete calls
> 
> tang.junhui <tang.junhui@zte.com.cn>
>     bcache: fix wrong cache_misses statistics
> 
> Liang Chen <liangchen.linux@gmail.com>
>     bcache: explicitly destroy mutex while exiting
> 
> Bob Peterson <rpeterso@redhat.com>
>     GFS2: Take inode off order_write list when setting jdata flag
> 
> Daniel Lezcano <daniel.lezcano@linaro.org>
>     thermal/drivers/step_wise: Fix temperature regulation misbehavior
> 
> Gao Feng <gfree.wind@vip.163.com>
>     ppp: Destroy the mutex when cleanup
> 
> Michał Mirosław <mirq-linux@rere.qmqm.pl>
>     clk: tegra: Fix cclk_lp divisor register
> 
> Sébastien Szymanski <sebastien.szymanski@armadeus.com>
>     clk: imx6: refine hdmi_isfr's parent to make HDMI work on i.MX6 SoCs w/o VPU
> 
> Chen Zhong <chen.zhong@mediatek.com>
>     clk: mediatek: add the option for determining PLL source clock
> 
> Jan Kara <jack@suse.cz>
>     mm: Handle 0 flags in _calc_vm_trans() macro
> 
> Robert Baronescu <robert.baronescu@nxp.com>
>     crypto: tcrypt - fix buffer lengths in test_aead_speed()
> 
> Suzuki K Poulose <suzuki.poulose@arm.com>
>     arm-ccn: perf: Prevent module unload while PMU is in use
> 
> Jiang Yi <jiangyilism@gmail.com>
>     target/file: Do not return error for UNMAP if length is zero
> 
> tangwenji <tang.wenji@zte.com.cn>
>     target:fix condition return in core_pr_dump_initiator_port()
> 
> tangwenji <tang.wenji@zte.com.cn>
>     iscsi-target: fix memory leak in lio_target_tiqn_addtpg()
> 
> Bart Van Assche <bart.vanassche@wdc.com>
>     target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd()
> 
> Markus Elfring <elfring@users.sourceforge.net>
>     platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill()
> 
> Christophe Leroy <christophe.leroy@c-s.fr>
>     powerpc/ipic: Fix status get and status clear
> 
> William A. Kennington III <wak@google.com>
>     powerpc/opal: Fix EBUSY bug in acquiring tokens
> 
> KUWAZAWA Takuya <albatross0@gmail.com>
>     netfilter: ipvs: Fix inappropriate output of procfs
> 
> Shriya <shriyak@linux.vnet.ibm.com>
>     powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo
> 
> Qiang <zhengqiang10@huawei.com>
>     PCI/PME: Handle invalid data when reading Root Status
> 
> Peter Ujfalusi <peter.ujfalusi@ti.com>
>     dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type
> 
> Philipp Zabel <p.zabel@pengutronix.de>
>     rtc: pcf8563: fix output clock rate
> 
> Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>     video: fbdev: au1200fb: Return an error code if a memory allocation fails
> 
> Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>     video: fbdev: au1200fb: Release some resources if a memory allocation fails
> 
> Ladislav Michl <ladis@linux-mips.org>
>     video: udlfb: Fix read EDID timeout
> 
> Geert Uytterhoeven <geert@linux-m68k.org>
>     fbdev: controlfb: Add missing modes to fix out of bounds access
> 
> Robert Stonehouse <rstonehouse@solarflare.com>
>     sfc: don't warn on successful change of MAC
> 
> Mike Christie <mchristi@redhat.com>
>     target: fix race during implicit transition work flushes
> 
> Mike Christie <mchristi@redhat.com>
>     target: fix ALUA transition timeout handling
> 
> Mike Christie <mchristi@redhat.com>
>     target: Use system workqueue for ALUA transitions
> 
> Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
>     btrfs: add missing memset while reading compressed inline extents
> 
> Olga Kornievskaia <kolga@netapp.com>
>     NFSv4.1 respect server's max size in CREATE_SESSION
> 
> Daniel Drake <drake@endlessm.com>
>     efi/esrt: Cleanup bad memory map log messages
> 
> Daniel Borkmann <daniel@iogearbox.net>
>     perf symbols: Fix symbols__fixup_end heuristic for corner cases
> 
> Jack Morgenstein <jackm@dev.mellanox.co.il>
>     net/mlx4_core: Avoid delays during VF driver device shutdown
> 
> David Howells <dhowells@redhat.com>
>     afs: Fix afs_kill_pages()
> 
> David Howells <dhowells@redhat.com>
>     afs: Fix page leak in afs_write_begin()
> 
> Marc Dionne <marc.dionne@auristor.com>
>     afs: Populate and use client modification time
> 
> David Howells <dhowells@redhat.com>
>     afs: Fix the maths in afs_fs_store_data()
> 
> Tina Ruchandani <ruchandani.tina@gmail.com>
>     afs: Prevent callback expiry timer overflow
> 
> Tina Ruchandani <ruchandani.tina@gmail.com>
>     afs: Migrate vlocation fields to 64-bit
> 
> David Howells <dhowells@redhat.com>
>     afs: Flush outstanding writes when an fd is closed
> 
> Marc Dionne <marc.dionne@auristor.com>
>     afs: Adjust mode bits processing
> 
> Marc Dionne <marc.dionne@auristor.com>
>     afs: Populate group ID from vnode status
> 
> David Howells <dhowells@redhat.com>
>     afs: Fix missing put_page()
> 
> Alex Deucher <alexander.deucher@amd.com>
>     drm/radeon: reinstate oland workaround for sclk
> 
> yong mao <yong.mao@mediatek.com>
>     mmc: mediatek: Fixed bug where clock frequency could be set wrong
> 
> Steven Rostedt (VMware) <rostedt@goodmis.org>
>     sched/deadline: Use deadline instead of period when calculating overflow
> 
> Daniel Bristot de Oliveira <bristot@redhat.com>
>     sched/deadline: Throttle a constrained deadline task activated after the deadline
> 
> Daniel Bristot de Oliveira <bristot@redhat.com>
>     sched/deadline: Make sure the replenishment timer fires in the next period
> 
> Alex Deucher <alexander.deucher@amd.com>
>     drm/radeon/si: add dpm quirk for Oland
> 
> Taku Izumi <izumi.taku@jp.fujitsu.com>
>     fjes: Fix wrong netdevice feature flags
> 
> Don Brace <don.brace@microsemi.com>
>     scsi: hpsa: limit outstanding rescans
> 
> Don Brace <don.brace@microsemi.com>
>     scsi: hpsa: update check for logical volume status
> 
> Stafford Horne <shorne@gmail.com>
>     openrisc: fix issue handling 8 byte get_user calls
> 
> Alexander Shishkin <alexander.shishkin@linux.intel.com>
>     intel_th: pci: Add Gemini Lake support
> 
> Jiri Pirko <jiri@mellanox.com>
>     mlxsw: reg: Fix SPVMLR max record count
> 
> Jiri Pirko <jiri@mellanox.com>
>     mlxsw: reg: Fix SPVM max record count
> 
> Vlad Yasevich <vyasevich@gmail.com>
>     net: Resend IGMP memberships upon peer notification.
> 
> Matthias Kaehlcke <mka@chromium.org>
>     dmaengine: Fix array index out of bounds warning in __get_unmap_pool()
> 
> Johan Hovold <johan@kernel.org>
>     net: wimax/i2400m: fix NULL-deref at probe
> 
> Tahsin Erdogan <tahsin@google.com>
>     writeback: fix memory leak in wb_queue_work()
> 
> Florian Westphal <fw@strlen.de>
>     netfilter: bridge: honor frag_max_size when refragmenting
> 
> Tomi Valkeinen <tomi.valkeinen@ti.com>
>     drm/omap: fix dmabuf mmap for dma_alloc'ed buffers
> 
> Dmitry Torokhov <dmitry.torokhov@gmail.com>
>     Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list
> 
> NeilBrown <neilb@suse.com>
>     NFSD: fix nfsd_reset_versions for NFSv4.
> 
> NeilBrown <neilb@suse.com>
>     NFSD: fix nfsd_minorversion(.., NFSD_AVAIL)
> 
> Doug Berger <opendmb@gmail.com>
>     net: bcmgenet: Power up the internal PHY before probing the MII
> 
> Doug Berger <opendmb@gmail.com>
>     net: bcmgenet: power down internal phy if open or resume fails
> 
> Doug Berger <opendmb@gmail.com>
>     net: bcmgenet: reserved phy revisions must be checked first
> 
> Doug Berger <opendmb@gmail.com>
>     net: bcmgenet: correct MIB access of UniMAC RUNT counters
> 
> Doug Berger <opendmb@gmail.com>
>     net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values
> 
> Alexander Potapenko <glider@google.com>
>     net: initialize msg.msg_flags in recvfrom
> 
> Andrea Arcangeli <aarcange@redhat.com>
>     userfaultfd: selftest: vm: allow to build in vm/ directory
> 
> Andrea Arcangeli <aarcange@redhat.com>
>     userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE
> 
> Guoqing Jiang <gqjiang@suse.com>
>     md-cluster: free md_cluster_info if node leave cluster
> 
> Javier Martinez Canillas <javier@osg.samsung.com>
>     usb: phy: isp1301: Add OF device ID table
> 
> Ilan peer <ilan.peer@intel.com>
>     mac80211: Fix addition of mesh configuration element
> 
> Eric Biggers <ebiggers@google.com>
>     KEYS: add missing permission check for request_key() destination
> 
> Chandan Rajendra <chandan@linux.vnet.ibm.com>
>     ext4: fix crash when a directory's i_size is too small
> 
> Eryu Guan <eguan@redhat.com>
>     ext4: fix fdatasync(2) after fallocate(2) operation
> 
> Adam Wallis <awallis@codeaurora.org>
>     dmaengine: dmatest: move callback wait queue to thread context
> 
> Steven Rostedt <rostedt@goodmis.org>
>     sched/rt: Do not pull from current CPU if only one CPU to pull
> 
> Mathias Nyman <mathias.nyman@linux.intel.com>
>     xhci: Don't add a virt_dev to the devs array before it's fully allocated
> 
> Sukumar Ghorai <sukumar.ghorai@intel.com>
>     Bluetooth: btusb: driver to enable the usb-wakeup feature
> 
> Yan, Zheng <zyan@redhat.com>
>     ceph: drop negative child dentries before try pruning inode's alias
> 
> Shuah Khan <shuahkh@osg.samsung.com>
>     usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer
> 
> Alan Stern <stern@rowland.harvard.edu>
>     USB: core: prevent malicious bNumInterfaces overflow
> 
> David Kozub <zub@linux.fjfi.cvut.cz>
>     USB: uas and storage: Add US_FL_BROKEN_FUA for another JMicron JMS567 ID
> 
> Changbin Du <changbin.du@intel.com>
>     tracing: Allocate mask_str buffer dynamically
> 
> NeilBrown <neilb@suse.com>
>     autofs: fix careless error in recent commit
> 
> Eric Biggers <ebiggers@google.com>
>     crypto: salsa20 - fix blkcipher_walk API usage
> 
> Eric Biggers <ebiggers@google.com>
>     crypto: hmac - require that the underlying hash algorithm is unkeyed
> 
> 
> -------------
> 
> Diffstat:
> 
>  Makefile                                       |  4 +-
>  arch/blackfin/Kconfig                          |  7 +-
>  arch/blackfin/Kconfig.debug                    |  1 +
>  arch/openrisc/include/asm/uaccess.h            |  2 +-
>  arch/powerpc/perf/hv-24x7.c                    |  2 +-
>  arch/powerpc/platforms/powernv/opal-async.c    |  6 +-
>  arch/powerpc/platforms/powernv/setup.c         |  2 +-
>  arch/powerpc/sysdev/ipic.c                     |  4 +-
>  arch/x86/crypto/salsa20_glue.c                 |  7 --
>  crypto/hmac.c                                  |  6 +-
>  crypto/salsa20_generic.c                       |  7 --
>  crypto/shash.c                                 |  5 +-
>  crypto/tcrypt.c                                |  6 +-
>  drivers/bluetooth/btusb.c                      |  5 ++
>  drivers/bus/arm-ccn.c                          |  1 +
>  drivers/clk/imx/clk-imx6q.c                    |  2 +-
>  drivers/clk/mediatek/clk-mtk.h                 |  1 +
>  drivers/clk/mediatek/clk-pll.c                 |  5 +-
>  drivers/clk/tegra/clk-tegra30.c                |  2 +-
>  drivers/dma/dmaengine.c                        |  2 +
>  drivers/dma/dmatest.c                          | 55 ++++++++-------
>  drivers/dma/ti-dma-crossbar.c                  |  8 +--
>  drivers/firmware/efi/efi.c                     |  1 -
>  drivers/firmware/efi/esrt.c                    |  2 +-
>  drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c      |  3 -
>  drivers/gpu/drm/radeon/si_dpm.c                | 10 +++
>  drivers/hwtracing/intel_th/pci.c               |  5 ++
>  drivers/infiniband/core/cma.c                  | 11 +--
>  drivers/infiniband/ulp/ipoib/ipoib_ib.c        |  7 +-
>  drivers/input/serio/i8042-x86ia64io.h          |  7 ++
>  drivers/md/bcache/request.c                    |  6 +-
>  drivers/md/bcache/super.c                      |  6 +-
>  drivers/md/md-cluster.c                        |  1 +
>  drivers/md/raid5.c                             |  5 +-
>  drivers/mmc/host/mtk-sd.c                      |  4 +-
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 95 +++++++++++++++++++++-----
>  drivers/net/ethernet/broadcom/genet/bcmgenet.h | 10 ++-
>  drivers/net/ethernet/mellanox/mlx4/cmd.c       | 11 +++
>  drivers/net/ethernet/mellanox/mlx4/main.c      | 11 +++
>  drivers/net/ethernet/mellanox/mlxsw/reg.h      |  4 +-
>  drivers/net/ethernet/sfc/ef10.c                |  2 +-
>  drivers/net/fjes/fjes_main.c                   |  2 +-
>  drivers/net/macvlan.c                          |  2 +-
>  drivers/net/ppp/ppp_generic.c                  |  1 +
>  drivers/net/wimax/i2400m/usb.c                 |  3 +
>  drivers/net/wireless/ath/ath9k/tx99.c          |  5 ++
>  drivers/pci/pcie/pme.c                         |  5 +-
>  drivers/pci/remove.c                           |  2 +-
>  drivers/pinctrl/Kconfig                        |  3 +-
>  drivers/platform/x86/sony-laptop.c             | 14 ++--
>  drivers/rtc/rtc-pcf8563.c                      |  2 +-
>  drivers/scsi/bfa/bfad_debugfs.c                |  5 +-
>  drivers/scsi/hpsa.c                            | 57 +++++++++-------
>  drivers/scsi/hpsa.h                            |  1 +
>  drivers/scsi/hpsa_cmd.h                        |  2 +
>  drivers/scsi/scsi_devinfo.c                    |  2 +-
>  drivers/scsi/sd.c                              | 12 +++-
>  drivers/staging/vt6655/device_main.c           |  3 +-
>  drivers/target/iscsi/iscsi_target.c            |  3 +-
>  drivers/target/iscsi/iscsi_target_configfs.c   |  3 +-
>  drivers/target/target_core_alua.c              | 33 +++------
>  drivers/target/target_core_file.c              |  4 ++
>  drivers/target/target_core_pr.c                |  4 +-
>  drivers/thermal/step_wise.c                    | 11 +--
>  drivers/usb/core/config.c                      |  4 +-
>  drivers/usb/host/xhci-mem.c                    | 15 ++--
>  drivers/usb/musb/da8xx.c                       | 10 ++-
>  drivers/usb/phy/phy-isp1301.c                  |  7 ++
>  drivers/usb/storage/unusual_devs.h             |  7 ++
>  drivers/usb/storage/unusual_uas.h              |  7 ++
>  drivers/usb/usbip/stub_tx.c                    |  7 ++
>  drivers/video/fbdev/au1200fb.c                 |  7 +-
>  drivers/video/fbdev/controlfb.h                |  2 +
>  drivers/video/fbdev/udlfb.c                    | 10 +--
>  fs/afs/callback.c                              |  7 +-
>  fs/afs/file.c                                  |  1 +
>  fs/afs/fsclient.c                              | 22 +++---
>  fs/afs/inode.c                                 | 11 +--
>  fs/afs/internal.h                              | 12 ++--
>  fs/afs/security.c                              |  7 +-
>  fs/afs/server.c                                |  6 +-
>  fs/afs/vlocation.c                             | 16 +++--
>  fs/afs/write.c                                 | 32 +++++++--
>  fs/autofs4/waitq.c                             |  1 -
>  fs/btrfs/inode.c                               | 14 ++++
>  fs/ceph/mds_client.c                           | 42 ++++++++++--
>  fs/ext4/extents.c                              |  1 +
>  fs/ext4/namei.c                                |  4 ++
>  fs/fs-writeback.c                              | 35 ++++++----
>  fs/gfs2/file.c                                 |  4 +-
>  fs/nfs/nfs4client.c                            |  4 +-
>  fs/nfsd/nfssvc.c                               | 30 ++++----
>  fs/proc/proc_tty.c                             |  3 +-
>  fs/udf/super.c                                 |  2 +-
>  fs/userfaultfd.c                               |  2 +-
>  fs/xfs/libxfs/xfs_bmap.c                       |  2 +-
>  fs/xfs/xfs_log_recover.c                       |  2 +-
>  include/crypto/internal/hash.h                 |  8 +++
>  include/linux/mlx4/device.h                    |  1 +
>  include/linux/mman.h                           |  3 +-
>  include/target/target_core_base.h              |  2 +-
>  kernel/sched/deadline.c                        | 62 +++++++++++++++--
>  kernel/sched/rt.c                              |  8 ++-
>  kernel/trace/trace.c                           | 29 +++-----
>  net/bridge/br_netfilter_hooks.c                | 12 ++--
>  net/core/dev.c                                 |  1 +
>  net/l2tp/l2tp_core.c                           |  2 +-
>  net/l2tp/l2tp_netlink.c                        |  2 +-
>  net/mac80211/mesh.c                            |  2 -
>  net/netfilter/ipvs/ip_vs_ctl.c                 |  4 ++
>  net/socket.c                                   |  1 +
>  security/keys/request_key.c                    | 48 ++++++++++---
>  tools/perf/util/symbol.c                       |  2 +-
>  tools/testing/selftests/vm/Makefile            |  4 ++
>  114 files changed, 727 insertions(+), 320 deletions(-)
> 
>

Merged, compiled, and flashed onto my Pixel 2 XL and OnePlus 5.

No initial issues noticed in general usage or dmesg.

Cheers!
Nathan

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 000/115] 4.4.107-stable review
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (109 preceding siblings ...)
  2017-12-18 18:17 ` [PATCH 4.4 000/115] 4.4.107-stable review Nathan Chancellor
@ 2017-12-18 20:26 ` Shuah Khan
  2017-12-19 14:35 ` Guenter Roeck
  2017-12-19 17:21 ` Naresh Kamboju
  112 siblings, 0 replies; 156+ messages in thread
From: Shuah Khan @ 2017-12-18 20:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, patches, ben.hutchings, lkft-triage,
	stable, Shuah Khan

On 12/18/2017 08:47 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.107 release.
> There are 115 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 Wed Dec 20 15:28:15 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/v4.x/stable-review/patch-4.4.107-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-4.4.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 000/115] 4.4.107-stable review
  2017-12-18 18:17 ` [PATCH 4.4 000/115] 4.4.107-stable review Nathan Chancellor
@ 2017-12-19  7:34   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-19  7:34 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: linux-kernel, torvalds, akpm, linux, shuahkh, patches,
	ben.hutchings, lkft-triage, stable

On Mon, Dec 18, 2017 at 11:17:30AM -0700, Nathan Chancellor wrote:
> Merged, compiled, and flashed onto my Pixel 2 XL and OnePlus 5.
> 
> No initial issues noticed in general usage or dmesg.

Great, thanks for testing and letting me know.

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 000/115] 4.4.107-stable review
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (110 preceding siblings ...)
  2017-12-18 20:26 ` Shuah Khan
@ 2017-12-19 14:35 ` Guenter Roeck
  2017-12-19 17:21 ` Naresh Kamboju
  112 siblings, 0 replies; 156+ messages in thread
From: Guenter Roeck @ 2017-12-19 14:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, shuahkh, patches, ben.hutchings, lkft-triage, stable

On 12/18/2017 07:47 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.107 release.
> There are 115 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 Wed Dec 20 15:28:15 UTC 2017.
> Anything received after that time might be too late.
> 

Build results:
	total: 145 pass: 145 fail: 0
Qemu test results:
	total: 118 pass: 118 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 000/115] 4.4.107-stable review
  2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
                   ` (111 preceding siblings ...)
  2017-12-19 14:35 ` Guenter Roeck
@ 2017-12-19 17:21 ` Naresh Kamboju
  112 siblings, 0 replies; 156+ messages in thread
From: Naresh Kamboju @ 2017-12-19 17:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Ben Hutchings, Shuah Khan, lkft-triage, patches,
	linux- stable, akpm, torvalds, Guenter Roeck

On 18 December 2017 at 21:17, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> This is the start of the stable review cycle for the 4.4.107 release.
> There are 115 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 Wed Dec 20 15:28:15 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/v4.x/stable-review/patch-4.4.107-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-4.4.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

Summary
------------------------------------------------------------------------
kernel: 4.4.107-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 17e243e4b245119c769252556341c7df1ebf2f27
git describe: v4.4.106-116-g17e243e4b245
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.106-116-g17e243e4b245

No regressions (compared to build v4.4.106)

Boards, architectures and test suites:
-------------------------------------

juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 32, skip: 29
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 982, skip: 124
* ltp-timers-tests - pass: 12,

x15 - arm
* boot - pass: 20,
* kselftest - pass: 31, skip: 29
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1035, skip: 67
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 44, skip: 32
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 956, skip: 164
* ltp-timers-tests - pass: 12,

And the arm64 hikey results.

Summary
------------------------------------------------------------------------
kernel: 4.4.107-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git tag: 4.4.107-rc1-hikey-20171218-80
git commit: 4310b26a5b134b82cc16a1dce9b8dd92def76622
git describe: 4.4.107-rc1-hikey-20171218-80
Test details: https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.107-rc1-hikey-20171218-80

No regressions (compared to build 4.4.106-rc1-hikey-20171214-76)

Boards, architectures and test suites:
-------------------------------------

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 30, skip: 31
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 980, skip: 124
* ltp-timers-tests - pass: 12,

Documentation - https://collaborate.linaro.org/display/LKFT/Email+Reports
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-18 15:47 ` [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature Greg Kroah-Hartman
@ 2017-12-20 19:51   ` Brian Norris
  2017-12-20 19:56     ` Brian Norris
  2017-12-21  8:30     ` gregkh
  0 siblings, 2 replies; 156+ messages in thread
From: Brian Norris @ 2017-12-20 19:51 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, stable, Sukumar Ghorai, Amit K Bag, Oliver Neukum,
	Marcel Holtmann, Matthias Kaehlcke, Todd Broch, Rajat Jain,
	Miao Chou, sadashiva.rao.pv, Guenter Roeck

Hi Greg,

On Mon, Dec 18, 2017 at 04:47:58PM +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.

I'm sorry, but I already objected to this one during the discussion
here:

https://patchwork.kernel.org/patch/10065483/
[PATCH 4.13 03/28] Bluetooth: btusb: fix QCA Rome suspend/resume

in which we pointed out a regression. The $subject patch does NOT
actually resolve the previous regression, though it might help to mask
it. The proper approach to resolve the above regression was to revert
the patch, not to backport the $subject patch.

Regarding this patch, IIUC this is not a bugfix -- it's a feature
addition (e.g., for helping with BLE mouse wakeup), and it has already
been proven to break some user space (we have an internal bug tracking
this, but suffice it to say that we've already tried and reverted this
patch [1]). This patch massively increases the surface in which spurious
bluetooth activity can wake the system, and in some cases we never can
suspend the system at all.

Unfortunately, Matthias was on vacation when you sent the review
request, so our team wasn't alerted properly. Can you please back this
out of all -stable branches?

Or alternatively, if those I've added on CC disagree and are happy to
deal with the fallout of this patch...well, then that's fine. We can
revert this patch in our downstream kernels and reapply if/when we can
account for it properly :)

Thanks,
Brian

[1]
https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/750073

> ------------------
> 
> From: Sukumar Ghorai <sukumar.ghorai@intel.com>
> 
> commit a0085f2510e8976614ad8f766b209448b385492f upstream.
> 
> BT-Controller connected as platform non-root-hub device and
> usb-driver initialize such device with wakeup disabled,
> Ref. usb_new_device().
> 
> At present wakeup-capability get enabled by hid-input device from usb
> function driver(e.g. BT HID device) at runtime. Again some functional
> driver does not set usb-wakeup capability(e.g LE HID device implement
> as HID-over-GATT), and can't wakeup the host on USB.
> 
> Most of the device operation (such as mass storage) initiated from host
> (except HID) and USB wakeup aligned with host resume procedure. For BT
> device, usb-wakeup capability need to enable form btusc driver as a
> generic solution for multiple profile use case and required for USB remote
> wakeup (in-bus wakeup) while host is suspended. Also usb-wakeup feature
> need to enable/disable with HCI interface up and down.
> 
> Signed-off-by: Sukumar Ghorai <sukumar.ghorai@intel.com>
> Signed-off-by: Amit K Bag <amit.k.bag@intel.com>
> Acked-by: Oliver Neukum <oneukum@suse.com>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/bluetooth/btusb.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -1050,6 +1050,10 @@ static int btusb_open(struct hci_dev *hd
>  		return err;
>  
>  	data->intf->needs_remote_wakeup = 1;
> +	/* device specific wakeup source enabled and required for USB
> +	 * remote wakeup while host is suspended
> +	 */
> +	device_wakeup_enable(&data->udev->dev);
>  
>  	if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
>  		goto done;
> @@ -1113,6 +1117,7 @@ static int btusb_close(struct hci_dev *h
>  		goto failed;
>  
>  	data->intf->needs_remote_wakeup = 0;
> +	device_wakeup_disable(&data->udev->dev);
>  	usb_autopm_put_interface(data->intf);
>  
>  failed:

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-20 19:51   ` Brian Norris
@ 2017-12-20 19:56     ` Brian Norris
  2017-12-21  8:30     ` gregkh
  1 sibling, 0 replies; 156+ messages in thread
From: Brian Norris @ 2017-12-20 19:56 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, stable, Sukumar Ghorai, Amit K Bag, Oliver Neukum,
	Marcel Holtmann, Matthias Kaehlcke, Todd Broch, Rajat Jain,
	Miao Chou, sadashiva.rao.pv, Guenter Roeck

+ Kai

One more thing:

On Wed, Dec 20, 2017 at 11:51:14AM -0800, Brian Norris wrote:
> Hi Greg,
> 
> On Mon, Dec 18, 2017 at 04:47:58PM +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> I'm sorry, but I already objected to this one during the discussion
> here:
> 
> https://patchwork.kernel.org/patch/10065483/
> [PATCH 4.13 03/28] Bluetooth: btusb: fix QCA Rome suspend/resume
> 
> in which we pointed out a regression. The $subject patch does NOT
> actually resolve the previous regression, though it might help to mask
> it. The proper approach to resolve the above regression was to revert
> the patch, not to backport the $subject patch.

We're already working on reverting the above patch to fix the regression
properly:

https://patchwork.kernel.org/patch/10125489/
[PATCH 1/2] Revert "Bluetooth: btusb: fix QCA Rome suspend/resume"

Brian

> Regarding this patch, IIUC this is not a bugfix -- it's a feature
> addition (e.g., for helping with BLE mouse wakeup), and it has already
> been proven to break some user space (we have an internal bug tracking
> this, but suffice it to say that we've already tried and reverted this
> patch [1]). This patch massively increases the surface in which spurious
> bluetooth activity can wake the system, and in some cases we never can
> suspend the system at all.
> 
> Unfortunately, Matthias was on vacation when you sent the review
> request, so our team wasn't alerted properly. Can you please back this
> out of all -stable branches?
> 
> Or alternatively, if those I've added on CC disagree and are happy to
> deal with the fallout of this patch...well, then that's fine. We can
> revert this patch in our downstream kernels and reapply if/when we can
> account for it properly :)
> 
> Thanks,
> Brian
> 
> [1]
> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/750073
> 
> > ------------------
> > 
> > From: Sukumar Ghorai <sukumar.ghorai@intel.com>
> > 
> > commit a0085f2510e8976614ad8f766b209448b385492f upstream.
> > 
> > BT-Controller connected as platform non-root-hub device and
> > usb-driver initialize such device with wakeup disabled,
> > Ref. usb_new_device().
> > 
> > At present wakeup-capability get enabled by hid-input device from usb
> > function driver(e.g. BT HID device) at runtime. Again some functional
> > driver does not set usb-wakeup capability(e.g LE HID device implement
> > as HID-over-GATT), and can't wakeup the host on USB.
> > 
> > Most of the device operation (such as mass storage) initiated from host
> > (except HID) and USB wakeup aligned with host resume procedure. For BT
> > device, usb-wakeup capability need to enable form btusc driver as a
> > generic solution for multiple profile use case and required for USB remote
> > wakeup (in-bus wakeup) while host is suspended. Also usb-wakeup feature
> > need to enable/disable with HCI interface up and down.
> > 
> > Signed-off-by: Sukumar Ghorai <sukumar.ghorai@intel.com>
> > Signed-off-by: Amit K Bag <amit.k.bag@intel.com>
> > Acked-by: Oliver Neukum <oneukum@suse.com>
> > Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> > Cc: Matthias Kaehlcke <mka@chromium.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/bluetooth/btusb.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > --- a/drivers/bluetooth/btusb.c
> > +++ b/drivers/bluetooth/btusb.c
> > @@ -1050,6 +1050,10 @@ static int btusb_open(struct hci_dev *hd
> >  		return err;
> >  
> >  	data->intf->needs_remote_wakeup = 1;
> > +	/* device specific wakeup source enabled and required for USB
> > +	 * remote wakeup while host is suspended
> > +	 */
> > +	device_wakeup_enable(&data->udev->dev);
> >  
> >  	if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
> >  		goto done;
> > @@ -1113,6 +1117,7 @@ static int btusb_close(struct hci_dev *h
> >  		goto failed;
> >  
> >  	data->intf->needs_remote_wakeup = 0;
> > +	device_wakeup_disable(&data->udev->dev);
> >  	usb_autopm_put_interface(data->intf);
> >  
> >  failed:

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-20 19:51   ` Brian Norris
  2017-12-20 19:56     ` Brian Norris
@ 2017-12-21  8:30     ` gregkh
  2017-12-21 17:20       ` Brian Norris
  1 sibling, 1 reply; 156+ messages in thread
From: gregkh @ 2017-12-21  8:30 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-kernel, stable, Sukumar Ghorai, Amit K Bag, Oliver Neukum,
	Marcel Holtmann, Matthias Kaehlcke, Todd Broch, Rajat Jain,
	Miao Chou, sadashiva.rao.pv, Guenter Roeck

On Wed, Dec 20, 2017 at 11:51:15AM -0800, Brian Norris wrote:
> Hi Greg,
> 
> On Mon, Dec 18, 2017 at 04:47:58PM +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> I'm sorry, but I already objected to this one during the discussion
> here:
> 
> https://patchwork.kernel.org/patch/10065483/
> [PATCH 4.13 03/28] Bluetooth: btusb: fix QCA Rome suspend/resume
> 
> in which we pointed out a regression. The $subject patch does NOT
> actually resolve the previous regression, though it might help to mask
> it. The proper approach to resolve the above regression was to revert
> the patch, not to backport the $subject patch.
> 
> Regarding this patch, IIUC this is not a bugfix -- it's a feature
> addition (e.g., for helping with BLE mouse wakeup), and it has already
> been proven to break some user space (we have an internal bug tracking
> this, but suffice it to say that we've already tried and reverted this
> patch [1]). This patch massively increases the surface in which spurious
> bluetooth activity can wake the system, and in some cases we never can
> suspend the system at all.
> 
> Unfortunately, Matthias was on vacation when you sent the review
> request, so our team wasn't alerted properly. Can you please back this
> out of all -stable branches?
> 
> Or alternatively, if those I've added on CC disagree and are happy to
> deal with the fallout of this patch...well, then that's fine. We can
> revert this patch in our downstream kernels and reapply if/when we can
> account for it properly :)

As Linus's tree is also broken, being bug-compatible here is good,
right?  I can just apply the revert/fix patch when it lands in that
tree, and all will be ok.

Or is Linus's tree not broken now?  Sorry, this whole thread has been
really confusing...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21  8:30     ` gregkh
@ 2017-12-21 17:20       ` Brian Norris
  2017-12-21 18:26         ` Guenter Roeck
  0 siblings, 1 reply; 156+ messages in thread
From: Brian Norris @ 2017-12-21 17:20 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, stable, Sukumar Ghorai, Amit K Bag, Oliver Neukum,
	Marcel Holtmann, Matthias Kaehlcke, Todd Broch, Rajat Jain,
	Miao Chou, sadashiva.rao.pv, Guenter Roeck

On Thu, Dec 21, 2017 at 12:30 AM, gregkh@linuxfoundation.org
<gregkh@linuxfoundation.org> wrote:
> As Linus's tree is also broken, being bug-compatible here is good,
> right?  I can just apply the revert/fix patch when it lands in that
> tree, and all will be ok.
>
> Or is Linus's tree not broken now?  Sorry, this whole thread has been
> really confusing...

Linus' tree is broken in 2 ways:

1. It includes this patch:
"Bluetooth: btusb: fix QCA Rome suspend/resume"
which is wrong, and we're on our way to reverting it upstream and
backporting that to -stable.

2. It includes $subject patch. I'm not quite so sure, but I believe
it's not 100% "wrong"; it's just tougher for user space to deal with,
since now by default, all sorts of BT devices are set to be wakeup
sources. We can account for that in user space by being more careful
with initiating BT activity before suspend, but we don't currently do
that (at least not with the BlueZ in ChromeOS).
A related portion of this problem is that we briefly thought that this
patch resolved regressions with 1. In the end, it might mask some, but
it does not actually fix the problem. But then, you only included this
patch because somebody suggested it could resolve 1...

In the end, I'd say that #2 never belonged in -stable at all, and #1
was just "buggy" (so we're reverting it and letting the revert trickle
into -stable). I'm not sure I have a strong reason to revert #2
upstream, but I think I have an argument for not including it in
-stable.

I'm not sure what you mean by "bug-compatible"; if I wanted to use a
buggy kernel, I'd use Linus' tree :)

Or as I think I understand your point: the key point is that #2 might
not be actually a "bug", but a feature that user space has to be more
careful with. That may be a candidate for mainline, but not for
-stable, as I understand the current rules.

Brian

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 17:20       ` Brian Norris
@ 2017-12-21 18:26         ` Guenter Roeck
  2017-12-21 18:52           ` Ghorai, Sukumar
  0 siblings, 1 reply; 156+ messages in thread
From: Guenter Roeck @ 2017-12-21 18:26 UTC (permalink / raw)
  To: Brian Norris
  Cc: gregkh, linux-kernel, stable, Sukumar Ghorai, Amit K Bag,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, sadashiva.rao.pv

On Thu, Dec 21, 2017 at 09:20:51AM -0800, Brian Norris wrote:
> On Thu, Dec 21, 2017 at 12:30 AM, gregkh@linuxfoundation.org
> <gregkh@linuxfoundation.org> wrote:
> > As Linus's tree is also broken, being bug-compatible here is good,
> > right?  I can just apply the revert/fix patch when it lands in that
> > tree, and all will be ok.
> >
> > Or is Linus's tree not broken now?  Sorry, this whole thread has been
> > really confusing...
> 
> Linus' tree is broken in 2 ways:
> 
> 1. It includes this patch:
> "Bluetooth: btusb: fix QCA Rome suspend/resume"
> which is wrong, and we're on our way to reverting it upstream and
> backporting that to -stable.
> 
> 2. It includes $subject patch. I'm not quite so sure, but I believe
> it's not 100% "wrong"; it's just tougher for user space to deal with,
> since now by default, all sorts of BT devices are set to be wakeup
> sources. We can account for that in user space by being more careful
> with initiating BT activity before suspend, but we don't currently do
> that (at least not with the BlueZ in ChromeOS).
> A related portion of this problem is that we briefly thought that this
> patch resolved regressions with 1. In the end, it might mask some, but
> it does not actually fix the problem. But then, you only included this
> patch because somebody suggested it could resolve 1...
> 
> In the end, I'd say that #2 never belonged in -stable at all, and #1
> was just "buggy" (so we're reverting it and letting the revert trickle
> into -stable). I'm not sure I have a strong reason to revert #2
> upstream, but I think I have an argument for not including it in
> -stable.
> 
> I'm not sure what you mean by "bug-compatible"; if I wanted to use a
> buggy kernel, I'd use Linus' tree :)
> 
> Or as I think I understand your point: the key point is that #2 might
> not be actually a "bug", but a feature that user space has to be more
> careful with. That may be a candidate for mainline, but not for
> -stable, as I understand the current rules.
> 

I absolutely agree with Brian here. #2, or commit a0085f2510e8 ("Bluetooth:
btusb: driver to enable the usb-wakeup feature") does not fix a bug, was
not tagged for stable, and should not have been applied to stable releases
in the first place. That it has a potential to cause trouble is not even
relevant here.

I am personally not sure what to do with #2 in -stable at this point.
We reverted it from the merge of v4.4.107 into chromeos-4.4, so it does
not immediately affect us. I'll leave it up to Greg to decide what to do
with it in v4.4.y.

I am much more concerned how to avoid such problems going forward, as it
does negatively affect the value of stable releases. How can we prevent
patches like this from ending up in -stable in the first place ?

Regarding "being bug-compatible here is good" - maybe I am missing some
context but, no, not at all for stable releases. Quite he opposite,
actually. If stable wants to be bug-compatible with upstream, there
would be no reason to have stable releases in the first place.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 156+ messages in thread

* RE: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 18:26         ` Guenter Roeck
@ 2017-12-21 18:52           ` Ghorai, Sukumar
  2017-12-21 18:58             ` Brian Norris
  0 siblings, 1 reply; 156+ messages in thread
From: Ghorai, Sukumar @ 2017-12-21 18:52 UTC (permalink / raw)
  To: Guenter Roeck, Brian Norris
  Cc: gregkh, linux-kernel, stable, Bag, Amit K, Oliver Neukum,
	Marcel Holtmann, Matthias Kaehlcke, Todd Broch, Rajat Jain,
	Miao Chou, Rao Pv, Sadashiva

>> Linus' tree is broken in 2 ways:
>>
>> 1. It includes this patch:
>> "Bluetooth: btusb: fix QCA Rome suspend/resume"
>> which is wrong, and we're on our way to reverting it upstream and
>> backporting that to -stable.
>>
>> 2. It includes $subject patch. I'm not quite so sure, but I believe
>> it's not 100% "wrong"; it's just tougher for user space to deal with,
>> since now by default, all sorts of BT devices are set to be wakeup
>> sources. We can account for that in user space by being more careful
>> with initiating BT activity before suspend, but we don't currently do
>> that (at least not with the BlueZ in ChromeOS).
>> A related portion of this problem is that we briefly thought that this
>> patch resolved regressions with 1. In the end, it might mask some, but
>> it does not actually fix the problem. But then, you only included this
>> patch because somebody suggested it could resolve 1...
>>
>> In the end, I'd say that #2 never belonged in -stable at all, and #1
>> was just "buggy" (so we're reverting it and letting the revert trickle
>> into -stable). I'm not sure I have a strong reason to revert #2
>> upstream, but I think I have an argument for not including it in
>> -stable.
>>
>> I'm not sure what you mean by "bug-compatible"; if I wanted to use a
>> buggy kernel, I'd use Linus' tree :)
>>
>> Or as I think I understand your point: the key point is that #2 might
>> not be actually a "bug", but a feature that user space has to be more
>> careful with. That may be a candidate for mainline, but not for
>> -stable, as I understand the current rules.
>>
>
>I absolutely agree with Brian here. #2, or commit a0085f2510e8 ("Bluetooth:
>btusb: driver to enable the usb-wakeup feature") does not fix a bug, was not
>tagged for stable, and should not have been applied to stable releases in the first
>place. That it has a potential to cause trouble is not even relevant here.

Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O device
connected. 
I feel we need to fix the other issue like S3 test fail, if any.  And one of the other day
we need all of them - wakeup using LE mouse, ..

>
..snip...

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 18:52           ` Ghorai, Sukumar
@ 2017-12-21 18:58             ` Brian Norris
  2017-12-21 19:00               ` Ghorai, Sukumar
  2017-12-21 19:05               ` Ghorai, Sukumar
  0 siblings, 2 replies; 156+ messages in thread
From: Brian Norris @ 2017-12-21 18:58 UTC (permalink / raw)
  To: Ghorai, Sukumar
  Cc: Guenter Roeck, gregkh, linux-kernel, stable, Bag, Amit K,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O device
> connected. 

Could you ever? If not, that looks like a feature request to me...

Brian

^ permalink raw reply	[flat|nested] 156+ messages in thread

* RE: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 18:58             ` Brian Norris
@ 2017-12-21 19:00               ` Ghorai, Sukumar
  2017-12-21 19:05               ` Ghorai, Sukumar
  1 sibling, 0 replies; 156+ messages in thread
From: Ghorai, Sukumar @ 2017-12-21 19:00 UTC (permalink / raw)
  To: Brian Norris
  Cc: Guenter Roeck, gregkh, linux-kernel, stable, Bag, Amit K,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
>> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
>> device connected.
>
>Could you ever? If not, that looks like a feature request to me...
Agree, feature request...

>
>Brian

^ permalink raw reply	[flat|nested] 156+ messages in thread

* RE: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 18:58             ` Brian Norris
  2017-12-21 19:00               ` Ghorai, Sukumar
@ 2017-12-21 19:05               ` Ghorai, Sukumar
  2017-12-21 19:10                 ` Brian Norris
  1 sibling, 1 reply; 156+ messages in thread
From: Ghorai, Sukumar @ 2017-12-21 19:05 UTC (permalink / raw)
  To: Brian Norris
  Cc: Guenter Roeck, gregkh, linux-kernel, stable, Bag, Amit K,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

>>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
>> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
>> device connected.
>
>Could you ever? If not, that looks like a feature request to me...
Agree, feature request... however  we need this feature for rapid use of Bluetooth LE devices.

>
>Brian

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 19:05               ` Ghorai, Sukumar
@ 2017-12-21 19:10                 ` Brian Norris
  2017-12-21 19:23                   ` Ghorai, Sukumar
  2017-12-21 20:04                   ` Guenter Roeck
  0 siblings, 2 replies; 156+ messages in thread
From: Brian Norris @ 2017-12-21 19:10 UTC (permalink / raw)
  To: Ghorai, Sukumar
  Cc: Guenter Roeck, gregkh, linux-kernel, stable, Bag, Amit K,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 07:05:03PM +0000, Ghorai, Sukumar wrote:
> >>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
> >> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
> >> device connected.
> >
> >Could you ever? If not, that looks like a feature request to me...
> Agree, feature request... however  we need this feature for rapid use of Bluetooth LE devices.

Is that what -stable is for now? For getting your pet feature enabled
more quickly? I thought that's what Linaro was for, or something like
that.

Besides the poor reasoning of the above (IMO): isn't that something you
can also configure in user space? So, upgrade user space (e.g., BlueZ)
to resolve the regressions that have been reported, then write the
appropriate udev rules to turn this on? Or is that too "slow" for you?

Brian

^ permalink raw reply	[flat|nested] 156+ messages in thread

* RE: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 19:10                 ` Brian Norris
@ 2017-12-21 19:23                   ` Ghorai, Sukumar
  2017-12-21 20:10                     ` Guenter Roeck
  2017-12-21 20:04                   ` Guenter Roeck
  1 sibling, 1 reply; 156+ messages in thread
From: Ghorai, Sukumar @ 2017-12-21 19:23 UTC (permalink / raw)
  To: Brian Norris, linux-kernel, gregkh, Marcel Holtmann,
	Oliver Neukum, Guenter Roeck, stable
  Cc: Bag, Amit K, Matthias Kaehlcke, Todd Broch, Rajat Jain,
	Miao Chou, Rao Pv, Sadashiva

>> >Could you ever? If not, that looks like a feature request to me...
>> Agree, feature request... however  we need this feature for rapid use of
>Bluetooth LE devices.
>
>Is that what -stable is for now? For getting your pet feature enabled more
>quickly? I thought that's what Linaro was for, or something like that.
>
>Besides the poor reasoning of the above (IMO): isn't that something you can also
>configure in user space? So, upgrade user space (e.g., BlueZ) to resolve the
>regressions that have been reported, then write the appropriate udev rules to
>turn this on? Or is that too "slow" for you?
Free to take decision..

I understand this feature is creating instability in other area. However -
1. the  problem will remain same when enable the usb-wakeup feature form
kernel or user-space or udev rule, and as long LE device is connected.
2. Even the behavior is same in existing stable code, when connect the
Bluetooth BR/EDR mouse (io device), as It will enable the usb-wakeup feature/flag,

>
>Brian

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 19:10                 ` Brian Norris
  2017-12-21 19:23                   ` Ghorai, Sukumar
@ 2017-12-21 20:04                   ` Guenter Roeck
  2017-12-21 20:46                     ` gregkh
  1 sibling, 1 reply; 156+ messages in thread
From: Guenter Roeck @ 2017-12-21 20:04 UTC (permalink / raw)
  To: Brian Norris
  Cc: Ghorai, Sukumar, gregkh, linux-kernel, stable, Bag, Amit K,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 11:10:58AM -0800, Brian Norris wrote:
> On Thu, Dec 21, 2017 at 07:05:03PM +0000, Ghorai, Sukumar wrote:
> > >>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
> > >> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
> > >> device connected.
> > >
> > >Could you ever? If not, that looks like a feature request to me...
> > Agree, feature request... however  we need this feature for rapid use of Bluetooth LE devices.
> 
> Is that what -stable is for now? For getting your pet feature enabled

I sincerely hope not. If -stable now officially supports adding new
features, we'll have to revisit our strategy for merging stable releases.

Guenter

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 19:23                   ` Ghorai, Sukumar
@ 2017-12-21 20:10                     ` Guenter Roeck
  2017-12-21 20:15                       ` Ghorai, Sukumar
  0 siblings, 1 reply; 156+ messages in thread
From: Guenter Roeck @ 2017-12-21 20:10 UTC (permalink / raw)
  To: Ghorai, Sukumar
  Cc: Brian Norris, linux-kernel, gregkh, Marcel Holtmann,
	Oliver Neukum, stable, Bag, Amit K, Matthias Kaehlcke,
	Todd Broch, Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 07:23:27PM +0000, Ghorai, Sukumar wrote:
> >> >Could you ever? If not, that looks like a feature request to me...
> >> Agree, feature request... however  we need this feature for rapid use of
> >Bluetooth LE devices.
> >
> >Is that what -stable is for now? For getting your pet feature enabled more
> >quickly? I thought that's what Linaro was for, or something like that.
> >
> >Besides the poor reasoning of the above (IMO): isn't that something you can also
> >configure in user space? So, upgrade user space (e.g., BlueZ) to resolve the
> >regressions that have been reported, then write the appropriate udev rules to
> >turn this on? Or is that too "slow" for you?
> Free to take decision..
> 
> I understand this feature is creating instability in other area. However -
> 1. the  problem will remain same when enable the usb-wakeup feature form
> kernel or user-space or udev rule, and as long LE device is connected.

There is a slight difference of leaving the decision to the user (or to
userspace) or forcing it down the throat of everyone by adding it to the
kernel.

Your statement "I understand this feature is creating instability in other
area" should really be a wakeup call. It almost sounds like you are aware
that it is causing problems, but you don't care because it fits _your_
needs. I hope that is not the case, but if it is, please keep in mind
that you are not the only user of the Linux kernel.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 156+ messages in thread

* RE: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 20:10                     ` Guenter Roeck
@ 2017-12-21 20:15                       ` Ghorai, Sukumar
  0 siblings, 0 replies; 156+ messages in thread
From: Ghorai, Sukumar @ 2017-12-21 20:15 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Brian Norris, linux-kernel, gregkh, Marcel Holtmann,
	Oliver Neukum, stable, Bag, Amit K, Matthias Kaehlcke,
	Todd Broch, Rajat Jain, Miao Chou, Rao Pv, Sadashiva

>> I understand this feature is creating instability in other area.
>> However - 1. the  problem will remain same when enable the usb-wakeup
>> feature form kernel or user-space or udev rule, and as long LE device is
>connected.
>
>There is a slight difference of leaving the decision to the user (or to
>userspace) or forcing it down the throat of everyone by adding it to the kernel.
>
>Your statement "I understand this feature is creating instability in other area"
>should really be a wakeup call. It almost sounds like you are aware that it is
>causing problems, but you don't care because it fits _your_ needs. I hope that is
>not the case, but if it is, please keep in mind that you are not the only user of the
>Linux kernel.
No I don't know what is the problem here...
As mentioned, keeping wake up enable(default) is same as BR/EDR mouse connected.
Hence you will see the same platform behavior when BR/EDR mouse connected, and 
Without this patch.

>
>Thanks,
>Guenter

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 20:04                   ` Guenter Roeck
@ 2017-12-21 20:46                     ` gregkh
  2017-12-21 20:50                       ` gregkh
  0 siblings, 1 reply; 156+ messages in thread
From: gregkh @ 2017-12-21 20:46 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Brian Norris, Ghorai, Sukumar, linux-kernel, stable, Bag, Amit K,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 12:04:57PM -0800, Guenter Roeck wrote:
> On Thu, Dec 21, 2017 at 11:10:58AM -0800, Brian Norris wrote:
> > On Thu, Dec 21, 2017 at 07:05:03PM +0000, Ghorai, Sukumar wrote:
> > > >>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
> > > >> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
> > > >> device connected.
> > > >
> > > >Could you ever? If not, that looks like a feature request to me...
> > > Agree, feature request... however  we need this feature for rapid use of Bluetooth LE devices.
> > 
> > Is that what -stable is for now? For getting your pet feature enabled
> 
> I sincerely hope not. If -stable now officially supports adding new
> features, we'll have to revisit our strategy for merging stable releases.

I'm not trying to add any new features at all, this was added because I
was told it resolved an issue that people had with their hardware.

If that's not the case, and it causes more problems than it is worth,
then it needs to be dropped both from Linus's tree, and then from the
stable trees.

And what I mean by "bug compatible" is, if the bug is in Linus's tree
because of a commit that needs to be reverted, revert it there, and I
will also do the same thing in the stable tree.  No one wants to upgrade
from an older kernel to a newer one and hit a regression, so ideally it
gets fixed everywhere at the same time.

Now, it seems the bluetooth maintainers have disappeared lately, with no
patches being applied anymore, so I have no idea what is going on there
anymore, so I'll drop this from the stable tree and _hope_ someone gets
their act together and reverts it from Linus's tree too.

Guenter and Brian, is that ok?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 20:46                     ` gregkh
@ 2017-12-21 20:50                       ` gregkh
  2017-12-21 21:39                         ` Guenter Roeck
  0 siblings, 1 reply; 156+ messages in thread
From: gregkh @ 2017-12-21 20:50 UTC (permalink / raw)
  To: Matthias Kaehlcke, Guenter Roeck
  Cc: Brian Norris, Ghorai, Sukumar, linux-kernel, stable, Bag, Amit K,
	Oliver Neukum, Marcel Holtmann, Matthias Kaehlcke, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 09:46:18PM +0100, gregkh@linuxfoundation.org wrote:
> On Thu, Dec 21, 2017 at 12:04:57PM -0800, Guenter Roeck wrote:
> > On Thu, Dec 21, 2017 at 11:10:58AM -0800, Brian Norris wrote:
> > > On Thu, Dec 21, 2017 at 07:05:03PM +0000, Ghorai, Sukumar wrote:
> > > > >>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
> > > > >> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
> > > > >> device connected.
> > > > >
> > > > >Could you ever? If not, that looks like a feature request to me...
> > > > Agree, feature request... however  we need this feature for rapid use of Bluetooth LE devices.
> > > 
> > > Is that what -stable is for now? For getting your pet feature enabled
> > 
> > I sincerely hope not. If -stable now officially supports adding new
> > features, we'll have to revisit our strategy for merging stable releases.
> 
> I'm not trying to add any new features at all, this was added because I
> was told it resolved an issue that people had with their hardware.

Wait, I was told by a chromeos developer to do this!  Matthias asked for
this patch to be merged to resolve a regression you all found on your
systems.  For it to now cause problems seems really "odd" to me...

So you all need to get your story straight here :)

I want all 3 of you (Guenter, Brian, and Matthias) to figure out what is
going on here please before I do _anything_ in the stable trees with
this patch.

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 20:50                       ` gregkh
@ 2017-12-21 21:39                         ` Guenter Roeck
  2017-12-22  7:48                           ` gregkh
  0 siblings, 1 reply; 156+ messages in thread
From: Guenter Roeck @ 2017-12-21 21:39 UTC (permalink / raw)
  To: gregkh
  Cc: Matthias Kaehlcke, Brian Norris, Ghorai, Sukumar, linux-kernel,
	stable, Bag, Amit K, Oliver Neukum, Marcel Holtmann, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 09:50:57PM +0100, gregkh@linuxfoundation.org wrote:
> On Thu, Dec 21, 2017 at 09:46:18PM +0100, gregkh@linuxfoundation.org wrote:
> > On Thu, Dec 21, 2017 at 12:04:57PM -0800, Guenter Roeck wrote:
> > > On Thu, Dec 21, 2017 at 11:10:58AM -0800, Brian Norris wrote:
> > > > On Thu, Dec 21, 2017 at 07:05:03PM +0000, Ghorai, Sukumar wrote:
> > > > > >>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
> > > > > >> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
> > > > > >> device connected.
> > > > > >
> > > > > >Could you ever? If not, that looks like a feature request to me...
> > > > > Agree, feature request... however  we need this feature for rapid use of Bluetooth LE devices.
> > > > 
> > > > Is that what -stable is for now? For getting your pet feature enabled
> > > 
> > > I sincerely hope not. If -stable now officially supports adding new
> > > features, we'll have to revisit our strategy for merging stable releases.
> > 
> > I'm not trying to add any new features at all, this was added because I
> > was told it resolved an issue that people had with their hardware.
> 
> Wait, I was told by a chromeos developer to do this!  Matthias asked for
> this patch to be merged to resolve a regression you all found on your
> systems.  For it to now cause problems seems really "odd" to me...
> 
Matthias reacted on the impression that the patch would solve the problem
based on his testing (and based on me providing the sha as the one major
difference between upstream and chromeos-4.4). Unfortunately, that was
not really the case; it turned out that it just hides the bug depending
on the test methology used. Brian had tried to point that out earlier.

Since then, Brian spent a lot of time on the issue, confirming that
both patches are problematic. Here is the comment associated with
the revert of $subject in chromeos-4.4 (sha 629db59a0f14b):

"This reverts commit 74f911a25030 ("UPSTREAM: Bluetooth: btusb: driver to
enable the usb-wakeup feature"). The reason is that this causes any inband
communication from the btusb device to cause the system to wake up. We
know that the BT controller could be scanning when we decide to suspend
and will send in the results once the scan is complete, thus failing the
suspend entry. This is a temporary work around until the bug 67489211
is solved. We can put this back once the bluetoothd starts to listen to
powerd for suspend requests and do the right thing.
			        
(Reverting this commit has the side effect that BLE mouse clicks do not
wake up the system from suspend, but that is lesser price to pay than no
going to suspend)."

You can find a more details at the above mentioned bug in buganizer.

Again, Brian has confirmed that this problem is also seen upstream.
In other words, you get wakeup or (reliable) suspend, but not both.

> So you all need to get your story straight here :)
> 
> I want all 3 of you (Guenter, Brian, and Matthias) to figure out what is
> going on here please before I do _anything_ in the stable trees with
> this patch.
> 
Well, we do. I talked with Brian several times today. Matthias is on vacation,
so if you want to wait for his feedback you'll have to wait until January.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-21 21:39                         ` Guenter Roeck
@ 2017-12-22  7:48                           ` gregkh
  2017-12-22 17:37                             ` Brian Norris
  0 siblings, 1 reply; 156+ messages in thread
From: gregkh @ 2017-12-22  7:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Matthias Kaehlcke, Brian Norris, Ghorai, Sukumar, linux-kernel,
	stable, Bag, Amit K, Oliver Neukum, Marcel Holtmann, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Thu, Dec 21, 2017 at 01:39:41PM -0800, Guenter Roeck wrote:
> On Thu, Dec 21, 2017 at 09:50:57PM +0100, gregkh@linuxfoundation.org wrote:
> > On Thu, Dec 21, 2017 at 09:46:18PM +0100, gregkh@linuxfoundation.org wrote:
> > > On Thu, Dec 21, 2017 at 12:04:57PM -0800, Guenter Roeck wrote:
> > > > On Thu, Dec 21, 2017 at 11:10:58AM -0800, Brian Norris wrote:
> > > > > On Thu, Dec 21, 2017 at 07:05:03PM +0000, Ghorai, Sukumar wrote:
> > > > > > >>On Thu, Dec 21, 2017 at 06:52:31PM +0000, Ghorai, Sukumar wrote:
> > > > > > >> Bug: platform can't wake using LE mouse/ keyboatd or any other LE I/O
> > > > > > >> device connected.
> > > > > > >
> > > > > > >Could you ever? If not, that looks like a feature request to me...
> > > > > > Agree, feature request... however  we need this feature for rapid use of Bluetooth LE devices.
> > > > > 
> > > > > Is that what -stable is for now? For getting your pet feature enabled
> > > > 
> > > > I sincerely hope not. If -stable now officially supports adding new
> > > > features, we'll have to revisit our strategy for merging stable releases.
> > > 
> > > I'm not trying to add any new features at all, this was added because I
> > > was told it resolved an issue that people had with their hardware.
> > 
> > Wait, I was told by a chromeos developer to do this!  Matthias asked for
> > this patch to be merged to resolve a regression you all found on your
> > systems.  For it to now cause problems seems really "odd" to me...
> > 
> Matthias reacted on the impression that the patch would solve the problem
> based on his testing (and based on me providing the sha as the one major
> difference between upstream and chromeos-4.4). Unfortunately, that was
> not really the case; it turned out that it just hides the bug depending
> on the test methology used. Brian had tried to point that out earlier.
> 
> Since then, Brian spent a lot of time on the issue, confirming that
> both patches are problematic. Here is the comment associated with
> the revert of $subject in chromeos-4.4 (sha 629db59a0f14b):
> 
> "This reverts commit 74f911a25030 ("UPSTREAM: Bluetooth: btusb: driver to
> enable the usb-wakeup feature"). The reason is that this causes any inband
> communication from the btusb device to cause the system to wake up. We
> know that the BT controller could be scanning when we decide to suspend
> and will send in the results once the scan is complete, thus failing the
> suspend entry. This is a temporary work around until the bug 67489211
> is solved. We can put this back once the bluetoothd starts to listen to
> powerd for suspend requests and do the right thing.
> 			        
> (Reverting this commit has the side effect that BLE mouse clicks do not
> wake up the system from suspend, but that is lesser price to pay than no
> going to suspend)."
> 
> You can find a more details at the above mentioned bug in buganizer.
> 
> Again, Brian has confirmed that this problem is also seen upstream.
> In other words, you get wakeup or (reliable) suspend, but not both.

Ok, thanks for the explaination, it makes more sense now.

I've reverted this from 4.4 and 4.9-stable, but note that this was
included in 4.14-rc1, so something needs to be done in Linus's tree to
resolve this issue, otherwise people will hit this as a regression when
moving to 4.14 or newer.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-22  7:48                           ` gregkh
@ 2017-12-22 17:37                             ` Brian Norris
  2017-12-23  9:18                               ` gregkh
  0 siblings, 1 reply; 156+ messages in thread
From: Brian Norris @ 2017-12-22 17:37 UTC (permalink / raw)
  To: gregkh
  Cc: Guenter Roeck, Matthias Kaehlcke, Ghorai, Sukumar, linux-kernel,
	stable, Bag, Amit K, Oliver Neukum, Marcel Holtmann, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Fri, Dec 22, 2017 at 08:48:28AM +0100, Greg Kroah-Hartman wrote:
> I've reverted this from 4.4 and 4.9-stable, but note that this was

Thanks!

> included in 4.14-rc1, so something needs to be done in Linus's tree to
> resolve this issue, otherwise people will hit this as a regression when
> moving to 4.14 or newer.

Well, I wouldn't object to reverting it in Linus' tree too, since AFAIK,
this is something that can be configured by user-space policy, no? And
that way, no user space is surprised by the sudden additional
requirements on managing bluetooth wakeup.

I'm not intimately familiar with bluetooth though; I just (think I) know
a regression when I see one, as well as the difference between a feature
addition and a bugfix. But I'm not sure I'm the authority on what to do
with this feature. Many who are CC'd should know better.

Brian

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-22 17:37                             ` Brian Norris
@ 2017-12-23  9:18                               ` gregkh
  2017-12-23 15:53                                 ` Ghorai, Sukumar
  0 siblings, 1 reply; 156+ messages in thread
From: gregkh @ 2017-12-23  9:18 UTC (permalink / raw)
  To: Brian Norris
  Cc: Guenter Roeck, Matthias Kaehlcke, Ghorai, Sukumar, linux-kernel,
	stable, Bag, Amit K, Oliver Neukum, Marcel Holtmann, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Fri, Dec 22, 2017 at 09:37:48AM -0800, Brian Norris wrote:
> > included in 4.14-rc1, so something needs to be done in Linus's tree to
> > resolve this issue, otherwise people will hit this as a regression when
> > moving to 4.14 or newer.
> 
> Well, I wouldn't object to reverting it in Linus' tree too, since AFAIK,
> this is something that can be configured by user-space policy, no? And
> that way, no user space is surprised by the sudden additional
> requirements on managing bluetooth wakeup.

I agree, please work with the bluetooth developers to make this happen.
They seem to be ignoring patches right now, so you might have to kick
them a few times :(

thanks

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* RE: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-23  9:18                               ` gregkh
@ 2017-12-23 15:53                                 ` Ghorai, Sukumar
  2017-12-23 16:14                                   ` gregkh
  0 siblings, 1 reply; 156+ messages in thread
From: Ghorai, Sukumar @ 2017-12-23 15:53 UTC (permalink / raw)
  To: gregkh, Brian Norris
  Cc: Guenter Roeck, Matthias Kaehlcke, linux-kernel, stable, Bag,
	Amit K, Oliver Neukum, Marcel Holtmann, Todd Broch, Rajat Jain,
	Miao Chou, Rao Pv, Sadashiva

>> > included in 4.14-rc1, so something needs to be done in Linus's tree
>> > to resolve this issue, otherwise people will hit this as a
>> > regression when moving to 4.14 or newer.
>>
>> Well, I wouldn't object to reverting it in Linus' tree too, since
>> AFAIK, this is something that can be configured by user-space policy,
>> no? And that way, no user space is surprised by the sudden additional
>> requirements on managing bluetooth wakeup.
Wakeup from Bluetooth will be observed as long as USB wakeup is configured from 
user space or kernel space or connected to any Bluetooth HID devices. 
And we don't want to support the wakeup from BT HID devide.
The solution looks like disable Bluetooth in S3 entry?
Looks we are trying to hide the other problems in a system, and reverting this patch.

>
>I agree, please work with the bluetooth developers to make this happen.
>They seem to be ignoring patches right now, so you might have to kick them a few
>times :(
Do you suggest submitter to send the revert request to 4.12 and 4.14 kernel?

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature
  2017-12-23 15:53                                 ` Ghorai, Sukumar
@ 2017-12-23 16:14                                   ` gregkh
  0 siblings, 0 replies; 156+ messages in thread
From: gregkh @ 2017-12-23 16:14 UTC (permalink / raw)
  To: Ghorai, Sukumar
  Cc: Brian Norris, Guenter Roeck, Matthias Kaehlcke, linux-kernel,
	stable, Bag, Amit K, Oliver Neukum, Marcel Holtmann, Todd Broch,
	Rajat Jain, Miao Chou, Rao Pv, Sadashiva

On Sat, Dec 23, 2017 at 03:53:57PM +0000, Ghorai, Sukumar wrote:
> >> > included in 4.14-rc1, so something needs to be done in Linus's tree
> >> > to resolve this issue, otherwise people will hit this as a
> >> > regression when moving to 4.14 or newer.
> >>
> >> Well, I wouldn't object to reverting it in Linus' tree too, since
> >> AFAIK, this is something that can be configured by user-space policy,
> >> no? And that way, no user space is surprised by the sudden additional
> >> requirements on managing bluetooth wakeup.
> Wakeup from Bluetooth will be observed as long as USB wakeup is configured from 
> user space or kernel space or connected to any Bluetooth HID devices. 
> And we don't want to support the wakeup from BT HID devide.
> The solution looks like disable Bluetooth in S3 entry?
> Looks we are trying to hide the other problems in a system, and reverting this patch.
> 
> >
> >I agree, please work with the bluetooth developers to make this happen.
> >They seem to be ignoring patches right now, so you might have to kick them a few
> >times :(
> Do you suggest submitter to send the revert request to 4.12 and 4.14 kernel?

4.12 is long end-of-life, I don't know what you expect to happen there.

4.14 is already released, this needs to be done for 4.15 first, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory
  2017-12-18 15:48 ` [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory Greg Kroah-Hartman
@ 2018-01-11 19:42   ` Ben Hutchings
  2018-01-13 10:21       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 156+ messages in thread
From: Ben Hutchings @ 2018-01-11 19:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: stable, Andrea Arcangeli, Mike Rapoport, Dr. David Alan Gilbert,
	Mike Kravetz, Pavel Emelyanov, Hillf Danton, Andrew Morton,
	Linus Torvalds, Sasha Levin

On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Andrea Arcangeli <aarcange@redhat.com>
> 
> 
> [ Upstream commit 46aa6a302b53f543f8e8b8e1714dc5e449ad36a6 ]
> 
> linux/tools/testing/selftests/vm $ make
> 
>   gcc -Wall -I ../../../../usr/include     compaction_test.c -lrt -o /compaction_test
>   /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open output file /compaction_test: Permission denied
>   collect2: error: ld returned 1 exit status
>   make: *** [../lib.mk:54: /compaction_test] Error 1
> 
> Since commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT")
> selftests/vm build fails if run from the "selftests/vm" directory, but
> it works in the selftests/ directory.  It's quicker to be able to do a
> local vm-only build after a tree wipe and this patch allows for it
> again.

That commit is not included in 4.4 and nothing under
tools/testing/selftests uses the OUTPUT variable that this defines.

Ben.

[...]
> --- a/tools/testing/selftests/vm/Makefile
> +++ b/tools/testing/selftests/vm/Makefile
> @@ -1,5 +1,9 @@
>  # Makefile for vm selftests
>  
> +ifndef OUTPUT
> +  OUTPUT := $(shell pwd)
> +endif
> +
>  CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
>  BINARIES = compaction_test
>  BINARIES += hugepage-mmap
> 
> 
> 
-- 
Ben Hutchings
Software Developer, Codethink Ltd.

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory
  2018-01-11 19:42   ` Ben Hutchings
@ 2018-01-13 10:21       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-13 10:21 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, Andrea Arcangeli, Mike Rapoport,
	Dr. David Alan Gilbert, Mike Kravetz, Pavel Emelyanov,
	Hillf Danton, Andrew Morton, Linus Torvalds, Sasha Levin

On Thu, Jan 11, 2018 at 07:42:48PM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Andrea Arcangeli <aarcange@redhat.com>
> > 
> > 
> > [ Upstream commit 46aa6a302b53f543f8e8b8e1714dc5e449ad36a6 ]
> > 
> > linux/tools/testing/selftests/vm $ make
> > 
> >   gcc -Wall -I ../../../../usr/include     compaction_test.c -lrt -o /compaction_test
> >   /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open output file /compaction_test: Permission denied
> >   collect2: error: ld returned 1 exit status
> >   make: *** [../lib.mk:54: /compaction_test] Error 1
> > 
> > Since commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT")
> > selftests/vm build fails if run from the "selftests/vm" directory, but
> > it works in the selftests/ directory.  It's quicker to be able to do a
> > local vm-only build after a tree wipe and this patch allows for it
> > again.
> 
> That commit is not included in 4.4 and nothing under
> tools/testing/selftests uses the OUTPUT variable that this defines.

Ugh, good catch, I'll go revert this.

Sasha, I thought your scripts caught this type of thing?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory
@ 2018-01-13 10:21       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-13 10:21 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, Andrea Arcangeli, Mike Rapoport,
	Dr. David Alan Gilbert, Mike Kravetz, Pavel Emelyanov,
	Hillf Danton, Andrew Morton, Linus Torvalds, Sasha Levin

On Thu, Jan 11, 2018 at 07:42:48PM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.��If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Andrea Arcangeli <aarcange@redhat.com>
> > 
> > 
> > [ Upstream commit 46aa6a302b53f543f8e8b8e1714dc5e449ad36a6 ]
> > 
> > linux/tools/testing/selftests/vm $ make
> > 
> > � gcc -Wall -I ../../../../usr/include�����compaction_test.c -lrt -o /compaction_test
> > � /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open output file /compaction_test: Permission denied
> > � collect2: error: ld returned 1 exit status
> > � make: *** [../lib.mk:54: /compaction_test] Error 1
> > 
> > Since commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT")
> > selftests/vm build fails if run from the "selftests/vm" directory, but
> > it works in the selftests/ directory.��It's quicker to be able to do a
> > local vm-only build after a tree wipe and this patch allows for it
> > again.
> 
> That commit is not included in 4.4 and nothing under
> tools/testing/selftests uses the OUTPUT variable that this defines.

Ugh, good catch, I'll go revert this.

Sasha, I thought your scripts caught this type of thing?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status
  2017-12-18 15:48 ` [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status Greg Kroah-Hartman
@ 2018-01-19  0:29   ` Ben Hutchings
  2018-01-19  7:51       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 156+ messages in thread
From: Ben Hutchings @ 2018-01-19  0:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: stable, Scott Benesh, Scott Teel, Don Brace, Martin K. Petersen,
	Sasha Levin

On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Don Brace <don.brace@microsemi.com>
> 
> 
> [ Upstream commit 85b29008d8af6d94a0723aaa8d93cfb6e041158b ]
> 
>  - Add in a new case for volume offline. Resolves internal testing bug
>    for multilun array management.
>  - Return correct status for failed TURs.
[...]

This apparently caused a regression that is fixed by:

commit eb94588dabec82e012281608949a860f64752914
Author: Tomas Henzl <thenzl@redhat.com>
Date:   Mon Mar 20 16:42:48 2017 +0100

    scsi: hpsa: fix volume offline state

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
  2017-12-18 15:48 ` [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline Greg Kroah-Hartman
@ 2018-01-19  1:00   ` Ben Hutchings
  2018-01-19  7:53       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 156+ messages in thread
From: Ben Hutchings @ 2018-01-19  1:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: stable, Daniel Bristot de Oliveira, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me
> know.
> 
> ------------------
> 
> From: Daniel Bristot de Oliveira <bristot@redhat.com>
> 
> 
> [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
[...]

I think this needs another fix on top:

commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
Author: Xunlei Pang <xlpang@redhat.com>
Date:   Wed May 10 21:03:37 2017 +0800

    sched/deadline: Zero out positive runtime after throttling constrained tasks

There's another fix related to this, but it doesn't appear to fix a
regression and I don't know how critical it is:

commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
Author: Daniel Bristot de Oliveira <bristot@redhat.com>
Date:   Mon May 29 16:24:03 2017 +0200

    sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status
  2018-01-19  0:29   ` Ben Hutchings
@ 2018-01-19  7:51       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19  7:51 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, Scott Benesh, Scott Teel, Don Brace,
	Martin K. Petersen, Sasha Levin

On Fri, Jan 19, 2018 at 12:29:12AM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Don Brace <don.brace@microsemi.com>
> > 
> > 
> > [ Upstream commit 85b29008d8af6d94a0723aaa8d93cfb6e041158b ]
> > 
> >  - Add in a new case for volume offline. Resolves internal testing bug
> >    for multilun array management.
> >  - Return correct status for failed TURs.
> [...]
> 
> This apparently caused a regression that is fixed by:
> 
> commit eb94588dabec82e012281608949a860f64752914
> Author: Tomas Henzl <thenzl@redhat.com>
> Date:   Mon Mar 20 16:42:48 2017 +0100
> 
>     scsi: hpsa: fix volume offline state

Many thanks, also now queued up for 4.9 which needs this too.

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status
@ 2018-01-19  7:51       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19  7:51 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, Scott Benesh, Scott Teel, Don Brace,
	Martin K. Petersen, Sasha Levin

On Fri, Jan 19, 2018 at 12:29:12AM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.��If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Don Brace <don.brace@microsemi.com>
> > 
> > 
> > [ Upstream commit 85b29008d8af6d94a0723aaa8d93cfb6e041158b ]
> > 
> > �- Add in a new case for volume offline. Resolves internal testing bug
> > ���for multilun array management.
> > �- Return correct status for failed TURs.
> [...]
> 
> This apparently caused a regression that is fixed by:
> 
> commit eb94588dabec82e012281608949a860f64752914
> Author: Tomas Henzl <thenzl@redhat.com>
> Date:���Mon Mar 20 16:42:48 2017 +0100
> 
> ����scsi: hpsa: fix volume offline state

Many thanks, also now queued up for 4.9 which needs this too.

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
  2018-01-19  1:00   ` Ben Hutchings
@ 2018-01-19  7:53       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19  7:53 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, Daniel Bristot de Oliveira,
	Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Fri, Jan 19, 2018 at 01:00:45AM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me
> > know.
> > 
> > ------------------
> > 
> > From: Daniel Bristot de Oliveira <bristot@redhat.com>
> > 
> > 
> > [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
> [...]
> 
> I think this needs another fix on top:
> 
> commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
> Author: Xunlei Pang <xlpang@redhat.com>
> Date:   Wed May 10 21:03:37 2017 +0800
> 
>     sched/deadline: Zero out positive runtime after throttling constrained tasks

Now queued up, thanks.

> There's another fix related to this, but it doesn't appear to fix a
> regression and I don't know how critical it is:
> 
> commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
> Author: Daniel Bristot de Oliveira <bristot@redhat.com>
> Date:   Mon May 29 16:24:03 2017 +0200
> 
>     sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks

I'll hold off on this one until someone actually asks for it, as it's a
big change.

thanks again for the review,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
@ 2018-01-19  7:53       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19  7:53 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, Daniel Bristot de Oliveira,
	Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Fri, Jan 19, 2018 at 01:00:45AM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.��If anyone has any objections, please let me
> > know.
> > 
> > ------------------
> > 
> > From: Daniel Bristot de Oliveira <bristot@redhat.com>
> > 
> > 
> > [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
> [...]
> 
> I think this needs another fix on top:
> 
> commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
> Author: Xunlei Pang <xlpang@redhat.com>
> Date:���Wed May 10 21:03:37 2017 +0800
> 
> ����sched/deadline: Zero out positive runtime after throttling constrained tasks

Now queued up, thanks.

> There's another fix related to this, but it doesn't appear to�fix a
> regression and I don't know how critical it is:
> 
> commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
> Author: Daniel Bristot de Oliveira <bristot@redhat.com>
> Date:���Mon May 29 16:24:03 2017 +0200
> 
> ����sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks

I'll hold off on this one until someone actually asks for it, as it's a
big change.

thanks again for the review,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
  2018-01-19  7:53       ` Greg Kroah-Hartman
  (?)
@ 2018-01-19 12:16       ` Daniel Bristot de Oliveira
  2018-01-19 12:40           ` Greg Kroah-Hartman
  -1 siblings, 1 reply; 156+ messages in thread
From: Daniel Bristot de Oliveira @ 2018-01-19 12:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Ben Hutchings
  Cc: linux-kernel, stable, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On 01/19/2018 08:53 AM, Greg Kroah-Hartman wrote:
> On Fri, Jan 19, 2018 at 01:00:45AM +0000, Ben Hutchings wrote:
>> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
>>> 4.4-stable review patch.  If anyone has any objections, please let me
>>> know.
>>>
>>> ------------------
>>>
>>> From: Daniel Bristot de Oliveira <bristot@redhat.com>
>>>
>>>
>>> [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
>> [...]
>>
>> I think this needs another fix on top:
>>
>> commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
>> Author: Xunlei Pang <xlpang@redhat.com>
>> Date:   Wed May 10 21:03:37 2017 +0800
>>
>>     sched/deadline: Zero out positive runtime after throttling constrained tasks
> 
> Now queued up, thanks.
> 
>> There's another fix related to this, but it doesn't appear to fix a
>> regression and I don't know how critical it is:
>>
>> commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
>> Author: Daniel Bristot de Oliveira <bristot@redhat.com>
>> Date:   Mon May 29 16:24:03 2017 +0200
>>
>>     sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
> 
> I'll hold off on this one until someone actually asks for it, as it's a
> big change.
> 
> thanks again for the review,

Hi,

This fix is also needed. Do you guys need some help in the backport? if
so, please let me know! I will be glad to help.

-- Daniel

> 
> greg k-h
> 

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
  2018-01-19 12:16       ` Daniel Bristot de Oliveira
@ 2018-01-19 12:40           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19 12:40 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira
  Cc: Ben Hutchings, linux-kernel, stable, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Fri, Jan 19, 2018 at 01:16:01PM +0100, Daniel Bristot de Oliveira wrote:
> On 01/19/2018 08:53 AM, Greg Kroah-Hartman wrote:
> > On Fri, Jan 19, 2018 at 01:00:45AM +0000, Ben Hutchings wrote:
> >> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> >>> 4.4-stable review patch.  If anyone has any objections, please let me
> >>> know.
> >>>
> >>> ------------------
> >>>
> >>> From: Daniel Bristot de Oliveira <bristot@redhat.com>
> >>>
> >>>
> >>> [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
> >> [...]
> >>
> >> I think this needs another fix on top:
> >>
> >> commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
> >> Author: Xunlei Pang <xlpang@redhat.com>
> >> Date:   Wed May 10 21:03:37 2017 +0800
> >>
> >>     sched/deadline: Zero out positive runtime after throttling constrained tasks
> > 
> > Now queued up, thanks.
> > 
> >> There's another fix related to this, but it doesn't appear to fix a
> >> regression and I don't know how critical it is:
> >>
> >> commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
> >> Author: Daniel Bristot de Oliveira <bristot@redhat.com>
> >> Date:   Mon May 29 16:24:03 2017 +0200
> >>
> >>     sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
> > 
> > I'll hold off on this one until someone actually asks for it, as it's a
> > big change.
> > 
> > thanks again for the review,
> 
> Hi,
> 
> This fix is also needed. Do you guys need some help in the backport? if
> so, please let me know! I will be glad to help.

I've now backported it, was just some comment and formatting issues that
needed to be adjusted.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
@ 2018-01-19 12:40           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19 12:40 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira
  Cc: Ben Hutchings, linux-kernel, stable, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Fri, Jan 19, 2018 at 01:16:01PM +0100, Daniel Bristot de Oliveira wrote:
> On 01/19/2018 08:53 AM, Greg Kroah-Hartman wrote:
> > On Fri, Jan 19, 2018 at 01:00:45AM +0000, Ben Hutchings wrote:
> >> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> >>> 4.4-stable review patch.��If anyone has any objections, please let me
> >>> know.
> >>>
> >>> ------------------
> >>>
> >>> From: Daniel Bristot de Oliveira <bristot@redhat.com>
> >>>
> >>>
> >>> [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
> >> [...]
> >>
> >> I think this needs another fix on top:
> >>
> >> commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
> >> Author: Xunlei Pang <xlpang@redhat.com>
> >> Date:���Wed May 10 21:03:37 2017 +0800
> >>
> >> ����sched/deadline: Zero out positive runtime after throttling constrained tasks
> > 
> > Now queued up, thanks.
> > 
> >> There's another fix related to this, but it doesn't appear to�fix a
> >> regression and I don't know how critical it is:
> >>
> >> commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
> >> Author: Daniel Bristot de Oliveira <bristot@redhat.com>
> >> Date:���Mon May 29 16:24:03 2017 +0200
> >>
> >> ����sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
> > 
> > I'll hold off on this one until someone actually asks for it, as it's a
> > big change.
> > 
> > thanks again for the review,
> 
> Hi,
> 
> This fix is also needed. Do you guys need some help in the backport? if
> so, please let me know! I will be glad to help.

I've now backported it, was just some comment and formatting issues that
needed to be adjusted.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
  2018-01-19 12:40           ` Greg Kroah-Hartman
@ 2018-01-19 13:13             ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19 13:13 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira
  Cc: Ben Hutchings, linux-kernel, stable, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Fri, Jan 19, 2018 at 01:40:03PM +0100, Greg Kroah-Hartman wrote:
> On Fri, Jan 19, 2018 at 01:16:01PM +0100, Daniel Bristot de Oliveira wrote:
> > On 01/19/2018 08:53 AM, Greg Kroah-Hartman wrote:
> > > On Fri, Jan 19, 2018 at 01:00:45AM +0000, Ben Hutchings wrote:
> > >> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > >>> 4.4-stable review patch.  If anyone has any objections, please let me
> > >>> know.
> > >>>
> > >>> ------------------
> > >>>
> > >>> From: Daniel Bristot de Oliveira <bristot@redhat.com>
> > >>>
> > >>>
> > >>> [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
> > >> [...]
> > >>
> > >> I think this needs another fix on top:
> > >>
> > >> commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
> > >> Author: Xunlei Pang <xlpang@redhat.com>
> > >> Date:   Wed May 10 21:03:37 2017 +0800
> > >>
> > >>     sched/deadline: Zero out positive runtime after throttling constrained tasks
> > > 
> > > Now queued up, thanks.
> > > 
> > >> There's another fix related to this, but it doesn't appear to fix a
> > >> regression and I don't know how critical it is:
> > >>
> > >> commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
> > >> Author: Daniel Bristot de Oliveira <bristot@redhat.com>
> > >> Date:   Mon May 29 16:24:03 2017 +0200
> > >>
> > >>     sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
> > > 
> > > I'll hold off on this one until someone actually asks for it, as it's a
> > > big change.
> > > 
> > > thanks again for the review,
> > 
> > Hi,
> > 
> > This fix is also needed. Do you guys need some help in the backport? if
> > so, please let me know! I will be glad to help.
> 
> I've now backported it, was just some comment and formatting issues that
> needed to be adjusted.

Nope, my attempt broke the build :(

If you could provide a working backport, that would be great.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline
@ 2018-01-19 13:13             ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-19 13:13 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira
  Cc: Ben Hutchings, linux-kernel, stable, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Fri, Jan 19, 2018 at 01:40:03PM +0100, Greg Kroah-Hartman wrote:
> On Fri, Jan 19, 2018 at 01:16:01PM +0100, Daniel Bristot de Oliveira wrote:
> > On 01/19/2018 08:53 AM, Greg Kroah-Hartman wrote:
> > > On Fri, Jan 19, 2018 at 01:00:45AM +0000, Ben Hutchings wrote:
> > >> On Mon, 2017-12-18 at 16:48 +0100, Greg Kroah-Hartman wrote:
> > >>> 4.4-stable review patch.��If anyone has any objections, please let me
> > >>> know.
> > >>>
> > >>> ------------------
> > >>>
> > >>> From: Daniel Bristot de Oliveira <bristot@redhat.com>
> > >>>
> > >>>
> > >>> [ Upstream commit df8eac8cafce7d086be3bd5cf5a838fa37594dfb ]
> > >> [...]
> > >>
> > >> I think this needs another fix on top:
> > >>
> > >> commit ae83b56a56f8d9643dedbee86b457fa1c5d42f59
> > >> Author: Xunlei Pang <xlpang@redhat.com>
> > >> Date:���Wed May 10 21:03:37 2017 +0800
> > >>
> > >> ����sched/deadline: Zero out positive runtime after throttling constrained tasks
> > > 
> > > Now queued up, thanks.
> > > 
> > >> There's another fix related to this, but it doesn't appear to�fix a
> > >> regression and I don't know how critical it is:
> > >>
> > >> commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a
> > >> Author: Daniel Bristot de Oliveira <bristot@redhat.com>
> > >> Date:���Mon May 29 16:24:03 2017 +0200
> > >>
> > >> ����sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
> > > 
> > > I'll hold off on this one until someone actually asks for it, as it's a
> > > big change.
> > > 
> > > thanks again for the review,
> > 
> > Hi,
> > 
> > This fix is also needed. Do you guys need some help in the backport? if
> > so, please let me know! I will be glad to help.
> 
> I've now backported it, was just some comment and formatting issues that
> needed to be adjusted.

Nope, my attempt broke the build :(

If you could provide a working backport, that would be great.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host
  2017-12-18 15:49 ` [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host Greg Kroah-Hartman
@ 2018-01-21 23:05   ` Ben Hutchings
  2018-01-22  7:44       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 156+ messages in thread
From: Ben Hutchings @ 2018-01-21 23:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: stable, Don Brace, Martin Wilck, Martin K. Petersen, Sasha Levin

On Mon, 2017-12-18 at 16:49 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Martin Wilck <mwilck@suse.de>
> 
> 
> [ Upstream commit dfb2e6f46b3074eb85203d8f0888b71ec1c2e37a ]
> 
> This patch cleans up a lot of warnings when unloading the driver.
[...]
> This patch did not help until Hannes's
> commit 9441284fbc39 ("scsi-fixup-kernel-warning-during-rmmod")
> was applied to the kernel.
[...]

So shouldn't that also be applied to stable branches?

Ben. 

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host
  2018-01-21 23:05   ` Ben Hutchings
@ 2018-01-22  7:44       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-22  7:44 UTC (permalink / raw)
  To: Ben Hutchings, Sasha Levin
  Cc: linux-kernel, stable, Don Brace, Martin Wilck, Martin K. Petersen

On Sun, Jan 21, 2018 at 11:05:42PM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:49 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Martin Wilck <mwilck@suse.de>
> > 
> > 
> > [ Upstream commit dfb2e6f46b3074eb85203d8f0888b71ec1c2e37a ]
> > 
> > This patch cleans up a lot of warnings when unloading the driver.
> [...]
> > This patch did not help until Hannes's
> > commit 9441284fbc39 ("scsi-fixup-kernel-warning-during-rmmod")
> > was applied to the kernel.
> [...]
> 
> So shouldn't that also be applied to stable branches?

Odd, it should :(

Sasha, any ideas here why that didn't happen?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host
@ 2018-01-22  7:44       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-22  7:44 UTC (permalink / raw)
  To: Ben Hutchings, Sasha Levin
  Cc: linux-kernel, stable, Don Brace, Martin Wilck, Martin K. Petersen

On Sun, Jan 21, 2018 at 11:05:42PM +0000, Ben Hutchings wrote:
> On Mon, 2017-12-18 at 16:49 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.��If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Martin Wilck <mwilck@suse.de>
> > 
> > 
> > [ Upstream commit dfb2e6f46b3074eb85203d8f0888b71ec1c2e37a ]
> > 
> > This patch cleans up a lot of warnings when unloading the driver.
> [...]
> > This patch did not help until Hannes's
> > commit 9441284fbc39 ("scsi-fixup-kernel-warning-during-rmmod")
> > was applied to the kernel.
> [...]
> 
> So shouldn't that also be applied to stable branches?

Odd, it should :(

Sasha, any ideas here why that didn't happen?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

* [PATCH 4.4] sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
  2018-01-19 13:13             ` Greg Kroah-Hartman
  (?)
@ 2018-01-22 17:16             ` Daniel Bristot de Oliveira
  2018-01-24  9:35               ` Greg Kroah-Hartman
  -1 siblings, 1 reply; 156+ messages in thread
From: Daniel Bristot de Oliveira @ 2018-01-22 17:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ben Hutchings, linux-kernel, stable, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

----------- %< -------------------
Here it is! the backport for 4.4.y-stable.

The main difference from the original commit is that
the BW_SHIFT define was not present yet. As BW_SHIFT was
introduced in a new feature, I just used the value (20),
likewise we used to use before the #define.
Other changes were required because of comments.
----------- >% -------------------

[ Upstream commit 3effcb4247e74a51f5d8b775a1ee4abf87cc089a ]

We have been facing some problems with self-suspending constrained
deadline tasks. The main reason is that the original CBS was not
designed for such sort of tasks.

One problem reported by Xunlei Pang takes place when a task
suspends, and then is awakened before the deadline, but so close
to the deadline that its remaining runtime can cause the task
to have an absolute density higher than allowed. In such situation,
the original CBS assumes that the task is facing an early activation,
and so it replenishes the task and set another deadline, one deadline
in the future. This rule works fine for implicit deadline tasks.
Moreover, it allows the system to adapt the period of a task in which
the external event source suffered from a clock drift.

However, this opens the window for bandwidth leakage for constrained
deadline tasks. For instance, a task with the following parameters:

  runtime   = 5 ms
  deadline  = 7 ms
  [density] = 5 / 7 = 0.71
  period    = 1000 ms

If the task runs for 1 ms, and then suspends for another 1ms,
it will be awakened with the following parameters:

  remaining runtime = 4
  laxity = 5

presenting a absolute density of 4 / 5 = 0.80.

In this case, the original CBS would assume the task had an early
wakeup. Then, CBS will reset the runtime, and the absolute deadline will
be postponed by one relative deadline, allowing the task to run.

The problem is that, if the task runs this pattern forever, it will keep
receiving bandwidth, being able to run 1ms every 2ms. Following this
behavior, the task would be able to run 500 ms in 1 sec. Thus running
more than the 5 ms / 1 sec the admission control allowed it to run.

Trying to address the self-suspending case, Luca Abeni, Giuseppe
Lipari, and Juri Lelli [1] revisited the CBS in order to deal with
self-suspending tasks. In the new approach, rather than
replenishing/postponing the absolute deadline, the revised wakeup rule
adjusts the remaining runtime, reducing it to fit into the allowed
density.

A revised version of the idea is:

At a given time t, the maximum absolute density of a task cannot be
higher than its relative density, that is:

  runtime / (deadline - t) <= dl_runtime / dl_deadline

Knowing the laxity of a task (deadline - t), it is possible to move
it to the other side of the equality, thus enabling to define max
remaining runtime a task can use within the absolute deadline, without
over-running the allowed density:

  runtime = (dl_runtime / dl_deadline) * (deadline - t)

For instance, in our previous example, the task could still run:

  runtime = ( 5 / 7 ) * 5
  runtime = 3.57 ms

Without causing damage for other deadline tasks. It is note worthy
that the laxity cannot be negative because that would cause a negative
runtime. Thus, this patch depends on the patch:

  df8eac8cafce ("sched/deadline: Throttle a constrained deadline task activated after the deadline")

Which throttles a constrained deadline task activated after the
deadline.

Finally, it is also possible to use the revised wakeup rule for
all other tasks, but that would require some more discussions
about pros and cons.

Reported-by: Xunlei Pang <xpang@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
[peterz: replaced dl_is_constrained with dl_is_implicit]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luca Abeni <luca.abeni@santannapisa.it>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Romulo Silva de Oliveira <romulo.deoliveira@ufsc.br>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
Link: http://lkml.kernel.org/r/5c800ab3a74a168a84ee5f3f84d12a02e11383be.1495803804.git.bristot@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
---
 include/linux/sched.h   |  1 +
 kernel/sched/core.c     |  2 +
 kernel/sched/deadline.c | 98 +++++++++++++++++++++++++++++++++++++++++++------
 3 files changed, 89 insertions(+), 12 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index e887c8d6f395..90bea398e5e0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1313,6 +1313,7 @@ struct sched_dl_entity {
 	u64 dl_deadline;	/* relative deadline of each instance	*/
 	u64 dl_period;		/* separation of two instances (period) */
 	u64 dl_bw;		/* dl_runtime / dl_deadline		*/
+	u64 dl_density;		/* dl_runtime / dl_deadline		*/
 
 	/*
 	 * Actual scheduling parameters. Initialized with the values above,
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9d6b3d869592..e6d1173a2046 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2109,6 +2109,7 @@ void __dl_clear_params(struct task_struct *p)
 	dl_se->dl_period = 0;
 	dl_se->flags = 0;
 	dl_se->dl_bw = 0;
+	dl_se->dl_density = 0;
 
 	dl_se->dl_throttled = 0;
 	dl_se->dl_new = 1;
@@ -3647,6 +3648,7 @@ __setparam_dl(struct task_struct *p, const struct sched_attr *attr)
 	dl_se->dl_period = attr->sched_period ?: dl_se->dl_deadline;
 	dl_se->flags = attr->sched_flags;
 	dl_se->dl_bw = to_ratio(dl_se->dl_period, dl_se->dl_runtime);
+	dl_se->dl_density = to_ratio(dl_se->dl_deadline, dl_se->dl_runtime);
 
 	/*
 	 * Changing the parameters of a task is 'tricky' and we're not doing
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index a996f7356216..19484a49494c 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -480,13 +480,84 @@ static bool dl_entity_overflow(struct sched_dl_entity *dl_se,
 }
 
 /*
- * When a -deadline entity is queued back on the runqueue, its runtime and
- * deadline might need updating.
+ * Revised wakeup rule [1]: For self-suspending tasks, rather then
+ * re-initializing task's runtime and deadline, the revised wakeup
+ * rule adjusts the task's runtime to avoid the task to overrun its
+ * density.
  *
- * The policy here is that we update the deadline of the entity only if:
- *  - the current deadline is in the past,
- *  - using the remaining runtime with the current deadline would make
- *    the entity exceed its bandwidth.
+ * Reasoning: a task may overrun the density if:
+ *    runtime / (deadline - t) > dl_runtime / dl_deadline
+ *
+ * Therefore, runtime can be adjusted to:
+ *     runtime = (dl_runtime / dl_deadline) * (deadline - t)
+ *
+ * In such way that runtime will be equal to the maximum density
+ * the task can use without breaking any rule.
+ *
+ * [1] Luca Abeni, Giuseppe Lipari, and Juri Lelli. 2015. Constant
+ * bandwidth server revisited. SIGBED Rev. 11, 4 (January 2015), 19-24.
+ */
+static void
+update_dl_revised_wakeup(struct sched_dl_entity *dl_se, struct rq *rq)
+{
+	u64 laxity = dl_se->deadline - rq_clock(rq);
+
+	/*
+	 * If the task has deadline < period, and the deadline is in the past,
+	 * it should already be throttled before this check.
+	 *
+	 * See update_dl_entity() comments for further details.
+	 */
+	WARN_ON(dl_time_before(dl_se->deadline, rq_clock(rq)));
+
+	dl_se->runtime = (dl_se->dl_density * laxity) >> 20;
+}
+
+/*
+ * Regarding the deadline, a task with implicit deadline has a relative
+ * deadline == relative period. A task with constrained deadline has a
+ * relative deadline <= relative period.
+ *
+ * We support constrained deadline tasks. However, there are some restrictions
+ * applied only for tasks which do not have an implicit deadline. See
+ * update_dl_entity() to know more about such restrictions.
+ *
+ * The dl_is_implicit() returns true if the task has an implicit deadline.
+ */
+static inline bool dl_is_implicit(struct sched_dl_entity *dl_se)
+{
+	return dl_se->dl_deadline == dl_se->dl_period;
+}
+
+/*
+ * When a deadline entity is placed in the runqueue, its runtime and deadline
+ * might need to be updated. This is done by a CBS wake up rule. There are two
+ * different rules: 1) the original CBS; and 2) the Revisited CBS.
+ *
+ * When the task is starting a new period, the Original CBS is used. In this
+ * case, the runtime is replenished and a new absolute deadline is set.
+ *
+ * When a task is queued before the begin of the next period, using the
+ * remaining runtime and deadline could make the entity to overflow, see
+ * dl_entity_overflow() to find more about runtime overflow. When such case
+ * is detected, the runtime and deadline need to be updated.
+ *
+ * If the task has an implicit deadline, i.e., deadline == period, the Original
+ * CBS is applied. the runtime is replenished and a new absolute deadline is
+ * set, as in the previous cases.
+ *
+ * However, the Original CBS does not work properly for tasks with
+ * deadline < period, which are said to have a constrained deadline. By
+ * applying the Original CBS, a constrained deadline task would be able to run
+ * runtime/deadline in a period. With deadline < period, the task would
+ * overrun the runtime/period allowed bandwidth, breaking the admission test.
+ *
+ * In order to prevent this misbehave, the Revisited CBS is used for
+ * constrained deadline tasks when a runtime overflow is detected. In the
+ * Revisited CBS, rather than replenishing & setting a new absolute deadline,
+ * the remaining runtime of the task is reduced to avoid runtime overflow.
+ * Please refer to the comments update_dl_revised_wakeup() function to find
+ * more about the Revised CBS rule.
  */
 static void update_dl_entity(struct sched_dl_entity *dl_se,
 			     struct sched_dl_entity *pi_se)
@@ -505,6 +576,14 @@ static void update_dl_entity(struct sched_dl_entity *dl_se,
 
 	if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
 	    dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) {
+
+		if (unlikely(!dl_is_implicit(dl_se) &&
+			     !dl_time_before(dl_se->deadline, rq_clock(rq)) &&
+			     !dl_se->dl_boosted)){
+			update_dl_revised_wakeup(dl_se, rq);
+			return;
+		}
+
 		dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline;
 		dl_se->runtime = pi_se->dl_runtime;
 	}
@@ -989,11 +1068,6 @@ static void dequeue_dl_entity(struct sched_dl_entity *dl_se)
 	__dequeue_dl_entity(dl_se);
 }
 
-static inline bool dl_is_constrained(struct sched_dl_entity *dl_se)
-{
-	return dl_se->dl_deadline < dl_se->dl_period;
-}
-
 static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct task_struct *pi_task = rt_mutex_get_top_task(p);
@@ -1025,7 +1099,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
 	 * If that is the case, the task will be throttled and
 	 * the replenishment timer will be set to the next period.
 	 */
-	if (!p->dl.dl_throttled && dl_is_constrained(&p->dl))
+	if (!p->dl.dl_throttled && !dl_is_implicit(&p->dl))
 		dl_check_constrained_dl(&p->dl);
 
 	/*
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 156+ messages in thread

* Re: [PATCH 4.4] sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
  2018-01-22 17:16             ` [PATCH 4.4] sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks Daniel Bristot de Oliveira
@ 2018-01-24  9:35               ` Greg Kroah-Hartman
  0 siblings, 0 replies; 156+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-24  9:35 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira
  Cc: Ben Hutchings, linux-kernel, stable, Peter Zijlstra (Intel),
	Juri Lelli, Linus Torvalds, Luca Abeni, Mike Galbraith,
	Romulo Silva de Oliveira, Steven Rostedt, Thomas Gleixner,
	Tommaso Cucinotta, Ingo Molnar, Sasha Levin

On Mon, Jan 22, 2018 at 06:16:19PM +0100, Daniel Bristot de Oliveira wrote:
> ----------- %< -------------------
> Here it is! the backport for 4.4.y-stable.
> 
> The main difference from the original commit is that
> the BW_SHIFT define was not present yet. As BW_SHIFT was
> introduced in a new feature, I just used the value (20),
> likewise we used to use before the #define.
> Other changes were required because of comments.

Thanks for the backport, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 156+ messages in thread

end of thread, other threads:[~2018-01-24  9:35 UTC | newest]

Thread overview: 156+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-18 15:47 [PATCH 4.4 000/115] 4.4.107-stable review Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 001/115] crypto: hmac - require that the underlying hash algorithm is unkeyed Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 002/115] crypto: salsa20 - fix blkcipher_walk API usage Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 003/115] autofs: fix careless error in recent commit Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 004/115] tracing: Allocate mask_str buffer dynamically Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 005/115] USB: uas and storage: Add US_FL_BROKEN_FUA for another JMicron JMS567 ID Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 006/115] USB: core: prevent malicious bNumInterfaces overflow Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 007/115] usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 008/115] ceph: drop negative child dentries before try pruning inodes alias Greg Kroah-Hartman
2017-12-18 15:47 ` [PATCH 4.4 009/115] Bluetooth: btusb: driver to enable the usb-wakeup feature Greg Kroah-Hartman
2017-12-20 19:51   ` Brian Norris
2017-12-20 19:56     ` Brian Norris
2017-12-21  8:30     ` gregkh
2017-12-21 17:20       ` Brian Norris
2017-12-21 18:26         ` Guenter Roeck
2017-12-21 18:52           ` Ghorai, Sukumar
2017-12-21 18:58             ` Brian Norris
2017-12-21 19:00               ` Ghorai, Sukumar
2017-12-21 19:05               ` Ghorai, Sukumar
2017-12-21 19:10                 ` Brian Norris
2017-12-21 19:23                   ` Ghorai, Sukumar
2017-12-21 20:10                     ` Guenter Roeck
2017-12-21 20:15                       ` Ghorai, Sukumar
2017-12-21 20:04                   ` Guenter Roeck
2017-12-21 20:46                     ` gregkh
2017-12-21 20:50                       ` gregkh
2017-12-21 21:39                         ` Guenter Roeck
2017-12-22  7:48                           ` gregkh
2017-12-22 17:37                             ` Brian Norris
2017-12-23  9:18                               ` gregkh
2017-12-23 15:53                                 ` Ghorai, Sukumar
2017-12-23 16:14                                   ` gregkh
2017-12-18 15:47 ` [PATCH 4.4 010/115] xhci: Dont add a virt_dev to the devs array before its fully allocated Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 011/115] sched/rt: Do not pull from current CPU if only one CPU to pull Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 012/115] dmaengine: dmatest: move callback wait queue to thread context Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 013/115] ext4: fix fdatasync(2) after fallocate(2) operation Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 014/115] ext4: fix crash when a directorys i_size is too small Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 015/115] KEYS: add missing permission check for request_key() destination Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 017/115] usb: phy: isp1301: Add OF device ID table Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 018/115] md-cluster: free md_cluster_info if node leave cluster Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 019/115] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 020/115] userfaultfd: selftest: vm: allow to build in vm/ directory Greg Kroah-Hartman
2018-01-11 19:42   ` Ben Hutchings
2018-01-13 10:21     ` Greg Kroah-Hartman
2018-01-13 10:21       ` Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 021/115] net: initialize msg.msg_flags in recvfrom Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 022/115] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 023/115] net: bcmgenet: correct MIB access of UniMAC RUNT counters Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 024/115] net: bcmgenet: reserved phy revisions must be checked first Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 025/115] net: bcmgenet: power down internal phy if open or resume fails Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 026/115] net: bcmgenet: Power up the internal PHY before probing the MII Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 027/115] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 028/115] NFSD: fix nfsd_reset_versions for NFSv4 Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 029/115] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 030/115] drm/omap: fix dmabuf mmap for dma_alloced buffers Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 031/115] netfilter: bridge: honor frag_max_size when refragmenting Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 032/115] writeback: fix memory leak in wb_queue_work() Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 033/115] net: wimax/i2400m: fix NULL-deref at probe Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 034/115] dmaengine: Fix array index out of bounds warning in __get_unmap_pool() Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 035/115] net: Resend IGMP memberships upon peer notification Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 036/115] mlxsw: reg: Fix SPVM max record count Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 037/115] mlxsw: reg: Fix SPVMLR " Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 038/115] intel_th: pci: Add Gemini Lake support Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 039/115] openrisc: fix issue handling 8 byte get_user calls Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 040/115] scsi: hpsa: update check for logical volume status Greg Kroah-Hartman
2018-01-19  0:29   ` Ben Hutchings
2018-01-19  7:51     ` Greg Kroah-Hartman
2018-01-19  7:51       ` Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 041/115] scsi: hpsa: limit outstanding rescans Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 042/115] fjes: Fix wrong netdevice feature flags Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 044/115] sched/deadline: Make sure the replenishment timer fires in the next period Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 045/115] sched/deadline: Throttle a constrained deadline task activated after the deadline Greg Kroah-Hartman
2018-01-19  1:00   ` Ben Hutchings
2018-01-19  7:53     ` Greg Kroah-Hartman
2018-01-19  7:53       ` Greg Kroah-Hartman
2018-01-19 12:16       ` Daniel Bristot de Oliveira
2018-01-19 12:40         ` Greg Kroah-Hartman
2018-01-19 12:40           ` Greg Kroah-Hartman
2018-01-19 13:13           ` Greg Kroah-Hartman
2018-01-19 13:13             ` Greg Kroah-Hartman
2018-01-22 17:16             ` [PATCH 4.4] sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks Daniel Bristot de Oliveira
2018-01-24  9:35               ` Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 046/115] sched/deadline: Use deadline instead of period when calculating overflow Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 047/115] mmc: mediatek: Fixed bug where clock frequency could be set wrong Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 048/115] drm/radeon: reinstate oland workaround for sclk Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 049/115] afs: Fix missing put_page() Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 050/115] afs: Populate group ID from vnode status Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 051/115] afs: Adjust mode bits processing Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 052/115] afs: Flush outstanding writes when an fd is closed Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 053/115] afs: Migrate vlocation fields to 64-bit Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 054/115] afs: Prevent callback expiry timer overflow Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 055/115] afs: Fix the maths in afs_fs_store_data() Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 056/115] afs: Populate and use client modification time Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 057/115] afs: Fix page leak in afs_write_begin() Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 058/115] afs: Fix afs_kill_pages() Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 059/115] net/mlx4_core: Avoid delays during VF driver device shutdown Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 060/115] perf symbols: Fix symbols__fixup_end heuristic for corner cases Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 061/115] efi/esrt: Cleanup bad memory map log messages Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 062/115] NFSv4.1 respect servers max size in CREATE_SESSION Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 063/115] btrfs: add missing memset while reading compressed inline extents Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 064/115] target: Use system workqueue for ALUA transitions Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 065/115] target: fix ALUA transition timeout handling Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 066/115] target: fix race during implicit transition work flushes Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 067/115] sfc: dont warn on successful change of MAC Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 068/115] fbdev: controlfb: Add missing modes to fix out of bounds access Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 069/115] video: udlfb: Fix read EDID timeout Greg Kroah-Hartman
2017-12-18 15:48 ` [PATCH 4.4 070/115] video: fbdev: au1200fb: Release some resources if a memory allocation fails Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 071/115] video: fbdev: au1200fb: Return an error code " Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 072/115] rtc: pcf8563: fix output clock rate Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 073/115] dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 074/115] PCI/PME: Handle invalid data when reading Root Status Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 075/115] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 076/115] netfilter: ipvs: Fix inappropriate output of procfs Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 077/115] powerpc/opal: Fix EBUSY bug in acquiring tokens Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 078/115] powerpc/ipic: Fix status get and status clear Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 079/115] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 080/115] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 081/115] iscsi-target: fix memory leak in lio_target_tiqn_addtpg() Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 082/115] target:fix condition return in core_pr_dump_initiator_port() Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 083/115] target/file: Do not return error for UNMAP if length is zero Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 084/115] arm-ccn: perf: Prevent module unload while PMU is in use Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 085/115] crypto: tcrypt - fix buffer lengths in test_aead_speed() Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 086/115] mm: Handle 0 flags in _calc_vm_trans() macro Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 087/115] clk: mediatek: add the option for determining PLL source clock Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 090/115] ppp: Destroy the mutex when cleanup Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 092/115] GFS2: Take inode off order_write list when setting jdata flag Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 093/115] bcache: explicitly destroy mutex while exiting Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 094/115] bcache: fix wrong cache_misses statistics Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 095/115] l2tp: cleanup l2tp_tunnel_delete calls Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 096/115] xfs: fix log block underflow during recovery cycle verification Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 097/115] xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 098/115] PCI: Detach driver before procfs & sysfs teardown on device remove Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 099/115] scsi: hpsa: cleanup sas_phy structures in sysfs when unloading Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 100/115] scsi: hpsa: destroy sas transport properties before scsi_host Greg Kroah-Hartman
2018-01-21 23:05   ` Ben Hutchings
2018-01-22  7:44     ` Greg Kroah-Hartman
2018-01-22  7:44       ` Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 101/115] powerpc/perf/hv-24x7: Fix incorrect comparison in memord Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 102/115] tty fix oops when rmmod 8250 Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 103/115] usb: musb: da8xx: fix babble condition handling Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 104/115] pinctrl: adi2: Fix Kconfig build problem Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 105/115] raid5: Set R5_Expanded on parity devices as well as data Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 106/115] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 107/115] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 108/115] scsi: sd: change manage_start_stop to bool in sysfs interface Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 109/115] scsi: sd: change allow_restart " Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 110/115] scsi: bfa: integer overflow in debugfs Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 111/115] udf: Avoid overflow when session starts at large offset Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 112/115] macvlan: Only deliver one copy of the frame to the macvlan interface Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 113/115] RDMA/cma: Avoid triggering undefined behavior Greg Kroah-Hartman
2017-12-18 15:49 ` [PATCH 4.4 114/115] IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop Greg Kroah-Hartman
2017-12-18 18:17 ` [PATCH 4.4 000/115] 4.4.107-stable review Nathan Chancellor
2017-12-19  7:34   ` Greg Kroah-Hartman
2017-12-18 20:26 ` Shuah Khan
2017-12-19 14:35 ` Guenter Roeck
2017-12-19 17:21 ` Naresh Kamboju

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.