06 Dec, 2016

1 commit

  • When the calls to kzalloc() fail, the value of return variable ret may
    be 0. 0 means success in this context. This patch fixes the bug,
    assigning "-ENOMEM" to ret before calling kzalloc().

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188971

    Signed-off-by: Pan Bian
    Signed-off-by: David S. Miller

    Pan Bian
     

28 Nov, 2016

1 commit

  • irda_get_mtt() returns a hardcoded '10000' in some cases,
    and with gcc-7, we get a build error because this triggers a
    compile-time check in udelay():

    drivers/net/irda/w83977af_ir.o: In function `w83977af_hard_xmit':
    w83977af_ir.c:(.text.w83977af_hard_xmit+0x14c): undefined reference to `__bad_udelay'

    Older compilers did not run into this because they either did not
    completely inline the irda_get_mtt() or did not consider the
    10000 value a constant expression.

    The code has been wrong since the start of git history.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

20 May, 2016

1 commit


05 May, 2016

1 commit

  • Replace all trans_start updates with netif_trans_update helper.
    change was done via spatch:

    struct net_device *d;
    @@
    - d->trans_start = jiffies
    + netif_trans_update(d)

    Compile tested only.

    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: linux-xtensa@linux-xtensa.org
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: linux-rdma@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: MPT-FusionLinux.pdl@broadcom.com
    Cc: linux-scsi@vger.kernel.org
    Cc: linux-can@vger.kernel.org
    Cc: linux-parisc@vger.kernel.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-hams@vger.kernel.org
    Cc: linux-usb@vger.kernel.org
    Cc: linux-wireless@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: devel@driverdev.osuosl.org
    Cc: b.a.t.m.a.n@lists.open-mesh.org
    Cc: linux-bluetooth@vger.kernel.org
    Signed-off-by: Florian Westphal
    Acked-by: Felipe Balbi
    Acked-by: Mugunthan V N
    Acked-by: Antonio Quartulli
    Signed-off-by: David S. Miller

    Florian Westphal
     

05 Apr, 2016

1 commit


15 Feb, 2016

1 commit


07 Feb, 2016

1 commit

  • The N_IRDA line discipline may access the previous line discipline's closed
    and already-fre private data on open [1].

    The tty->disc_data field _never_ refers to valid data on entry to the
    line discipline's open() method. Rather, the ldisc is expected to
    initialize that field for its own use for the lifetime of the instance
    (ie. from open() to close() only).

    [1]
    ==================================================================
    BUG: KASAN: use-after-free in irtty_open+0x422/0x550 at addr ffff8800331dd068
    Read of size 4 by task a.out/13960
    =============================================================================
    BUG kmalloc-512 (Tainted: G B ): kasan: bad access detected
    -----------------------------------------------------------------------------
    ...
    Call Trace:
    [] __asan_report_load4_noabort+0x3e/0x40 mm/kasan/report.c:279
    [] irtty_open+0x422/0x550 drivers/net/irda/irtty-sir.c:436
    [] tty_ldisc_open.isra.2+0x60/0xa0 drivers/tty/tty_ldisc.c:447
    [] tty_set_ldisc+0x1a0/0x940 drivers/tty/tty_ldisc.c:567
    [< inline >] tiocsetd drivers/tty/tty_io.c:2650
    [] tty_ioctl+0xace/0x1fd0 drivers/tty/tty_io.c:2883
    [< inline >] vfs_ioctl fs/ioctl.c:43
    [] do_vfs_ioctl+0x57c/0xe60 fs/ioctl.c:607
    [< inline >] SYSC_ioctl fs/ioctl.c:622
    [] SyS_ioctl+0x74/0x80 fs/ioctl.c:613
    [] entry_SYSCALL_64_fastpath+0x16/0x7a

    Reported-and-tested-by: Dmitry Vyukov
    Cc:
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

22 Jan, 2016

1 commit

  • The defconfig build of blackfin is failing with the error:

    arch/blackfin/include/asm/bfin_serial.h:269:0: warning: "port_membase" redefined
    drivers/net/irda/bfin_sir.h:85:0: note: this is the location of the previous definition
    arch/blackfin/include/asm/bfin_serial.h:382:0: warning: "get_lsr_cache" redefined
    drivers/net/irda/bfin_sir.h:86:0: note: this is the location of the previous definition
    arch/blackfin/include/asm/bfin_serial.h:383:0: warning: "put_lsr_cache" redefined
    drivers/net/irda/bfin_sir.h:87:0: note: this is the location of the previous definition

    port_membase, get_lsr_cache, put_lsr_cache are already defined in the
    architecture files, no need to define them again in the driver.

    Signed-off-by: Sudip Mukherjee
    Signed-off-by: David S. Miller

    Sudip Mukherjee
     

09 Jan, 2016

1 commit


29 Sep, 2015

3 commits

  • Convert pxaficp_ir to dmaengine. As pxa architecture is shifting from
    raw DMA registers access to pxa_dma dmaengine driver, convert this
    driver to dmaengine.

    Signed-off-by: Robert Jarzmik
    Tested-by: Petr Cvek
    Signed-off-by: David S. Miller

    Robert Jarzmik
     
  • Convert the pxa IRDA driver to readl and writel primitives, and remove
    another set of direct registers access. This leaves only the DMA
    registers access, which will be dealt with dmaengine conversion.

    Signed-off-by: Robert Jarzmik
    Tested-by: Petr Cvek
    Signed-off-by: David S. Miller

    Robert Jarzmik
     
  • Instead of using directly the OS timer through direct register access,
    use the standard sched_clock(), which will end up in OSCR reading
    anyway.

    This is a first step for direct access register removal and machine
    specific code removal from this driver.

    This commit changes the behavior, as previously the minimum turnaround
    time was counted in 76ns steps, while with this patch it is counted in
    microsecond steps. The strictly equal formula would have been :
    while ((sched_clock() - si->last_clk) * 76 < mtt)

    Signed-off-by: Robert Jarzmik
    Signed-off-by: David S. Miller

    Robert Jarzmik
     

12 Sep, 2015

1 commit

  • ali_ircc_sir_change_speed() is always called with self->lock held,
    so acquiring the lock inside it leads to unavoidable deadlock.

    Call graph:
    ali_ircc_sir_change_speed() is called from ali_ircc_change_speed()
    ali_ircc_fir_hard_xmit() under spin_lock_irqsave(&self->lock, flags);
    ali_ircc_sir_hard_xmit() under spin_lock_irqsave(&self->lock, flags);
    ali_ircc_net_ioctl() under spin_lock_irqsave(&self->lock, flags);
    ali_ircc_dma_xmit_complete()
    ali_ircc_fir_interrupt()
    ali_ircc_interrupt() under spin_lock(&self->lock);
    ali_ircc_sir_write_wakeup()
    ali_ircc_sir_interrupt()
    ali_ircc_interrupt() under spin_lock(&self->lock);

    The patch removes spin_lock/unlock from ali_ircc_sir_change_speed().

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Alexey Khoroshilov
    Signed-off-by: David S. Miller

    Alexey Khoroshilov
     

26 May, 2015

1 commit

  • API compliance scanning with coccinelle flagged:

    Converting milliseconds to jiffies by "val * HZ / 1000" is technically
    is not a clean solution as it does not handle all corner cases correctly.
    By changing the conversion to use msecs_to_jiffies(val) conversion is
    correct in all cases.

    in the current code:
    mod_timer(&self->rx_defer_timer, jiffies + (10 * HZ / 1000));
    for HZ < 100 (e.g. CONFIG_HZ == 64|32 in alpha) this effectively results
    in no delay at all.

    Patch was compile tested for x86_64_defconfig (implies CONFIG_USB_IRDA=m)

    Patch is against 4.1-rc4 (localversion-next is -next-20150522)

    Signed-off-by: Nicholas Mc Guire
    Signed-off-by: David S. Miller

    Nicholas Mc Guire
     

12 Jan, 2015

6 commits

  • The vlsi ir driver uses 'timeval', which we try to remove in the kernel
    because all 32-bit time types will break in the year 2038.

    This patch also changes do_gettimeofday() to ktime_get() accordingly,
    since ktime_get returns a ktime_t, but do_gettimeofday returns a
    struct timeval, and the other reason is that ktime_get() uses
    the monotonic clock.

    This patch uses ktime_us_delta to get the elapsed time of microsecond,
    and uses div_s64_rem to get what seconds & microseconds time elapsed
    for printing.

    This patch also changes the function 'vlsi_hard_start_xmit' to do the
    same things as the others drivers, that is passing the remaining time
    into udelay() instead of looping until enough time has passed.

    Signed-off-by: Chunyan Zhang
    Reviewed-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Chunyan Zhang
     
  • The stir4200 driver uses 'timeval', which we try to remove in the kernel
    because all 32-bit time types will break in the year 2038.

    This patch also changes do_gettimeofday() to ktime_get() accordingly,
    since ktime_get returns a ktime_t, but do_gettimeofday returns a
    struct timeval, and the other reason is that ktime_get() uses
    the monotonic clock.

    This patch uses ktime_us_delta to get the elapsed time of microsecond.

    Signed-off-by: Chunyan Zhang
    Reviewed-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Chunyan Zhang
     
  • The nsc ircc driver uses 'timeval', which we try to remove in the kernel
    because all 32-bit time types will break in the year 2038.

    This patch also changes do_gettimeofday() to ktime_get() accordingly,
    since ktime_get returns a ktime_t, but do_gettimeofday returns a
    struct timeval, and the other reason is that ktime_get() uses
    the monotonic clock.

    This patch uses ktime_us_delta to get the elapsed time, and in this
    way it no longer needs to check for the overflow, because
    ktime_us_delta returns time difference of microsecond.

    Signed-off-by: Chunyan Zhang
    Reviewed-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Chunyan Zhang
     
  • The irda usb driver uses 'timeval', which we try to remove in the kernel
    because all 32-bit time types will break in the year 2038.

    This patch also changes do_gettimeofday() to ktime_get() accordingly,
    since ktime_get returns a ktime_t, but do_gettimeofday returns a
    struct timeval, and the other reason is that ktime_get() uses
    the monotonic clock.

    This patch uses ktime_us_delta to get the elapsed time, and in this
    way it no longer needs to check for the overflow, because
    ktime_us_delta returns time difference of microsecond.

    Signed-off-by: Chunyan Zhang
    Reviewed-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Chunyan Zhang
     
  • The ali ircc driver uses 'timeval', which we try to remove in the kernel
    because all 32-bit time types will break in the year 2038.

    This patch also changes do_gettimeofday() to ktime_get() accordingly,
    since ktime_get returns a ktime_t, but do_gettimeofday returns a
    struct timeval, and the other reason is that ktime_get() uses
    the monotonic clock.

    This patch uses ktime_us_delta to get the elapsed time, and in this
    way it no longer needs to check for the overflow, because
    ktime_us_delta returns time difference of microsecond.

    Signed-off-by: Chunyan Zhang
    Reviewed-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Chunyan Zhang
     
  • In the file au1k_ir.c & via-ircc.h, there were two unused definitions of the
    timeval type members, this commit therefore removes this unneeded code.

    In other three files, the same problem is the rx_time member is only ever
    written, never read, so removed it entirely.

    Signed-off-by: Chunyan Zhang
    Reviewed-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Chunyan Zhang
     

31 Dec, 2014

1 commit


15 Dec, 2014

1 commit

  • Pull driver core update from Greg KH:
    "Here's the set of driver core patches for 3.19-rc1.

    They are dominated by the removal of the .owner field in platform
    drivers. They touch a lot of files, but they are "simple" changes,
    just removing a line in a structure.

    Other than that, a few minor driver core and debugfs changes. There
    are some ath9k patches coming in through this tree that have been
    acked by the wireless maintainers as they relied on the debugfs
    changes.

    Everything has been in linux-next for a while"

    * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
    Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
    fs: debugfs: add forward declaration for struct device type
    firmware class: Deletion of an unnecessary check before the function call "vunmap"
    firmware loader: fix hung task warning dump
    devcoredump: provide a one-way disable function
    device: Add dev__once variants
    ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
    ath: use seq_file api for ath9k debugfs files
    debugfs: add helper function to create device related seq_file
    drivers/base: cacheinfo: remove noisy error boot message
    Revert "core: platform: add warning if driver has no owner"
    drivers: base: support cpu cache information interface to userspace via sysfs
    drivers: base: add cpu_device_create to support per-cpu devices
    topology: replace custom attribute macros with standard DEVICE_ATTR*
    cpumask: factor out show_cpumap into separate helper function
    driver core: Fix unbalanced device reference in drivers_probe
    driver core: fix race with userland in device_add()
    sysfs/kernfs: make read requests on pre-alloc files use the buffer.
    sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
    fs: sysfs: return EGBIG on write if offset is larger than file size
    ...

    Linus Torvalds
     

13 Nov, 2014

1 commit

  • Use the normal kernel debugging mechanism which also
    enables dynamic_debug at the same time.

    Other miscellanea:

    o Remove sysctl for irda_debug
    o Remove function tracing like uses (use ftrace instead)
    o Coalesce formats
    o Realign arguments
    o Remove unnecessary OOM messages

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

12 Nov, 2014

1 commit

  • And use the more common mechanisms directly.

    Other miscellanea:

    o Coalesce formats
    o Add missing newlines
    o Realign arguments
    o Remove unnecessary OOM message logging as
    there's a generic stack dump already on OOM.

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

20 Oct, 2014

1 commit


04 Oct, 2014

1 commit

  • SH_IRDA needs HAS_IOMEM, so depend on it. The related error(with
    allmodconfig under um):

    CC [M] drivers/net/irda/sh_irda.o
    drivers/net/irda/sh_irda.c: In function ‘sh_irda_probe’:
    drivers/net/irda/sh_irda.c:776:2: error: implicit declaration of function ‘ioremap_nocache’ [-Werror=implicit-function-declaration]
    self->membase = ioremap_nocache(res->start, resource_size(res));
    ^
    drivers/net/irda/sh_irda.c:776:16: warning: assignment makes pointer from integer without a cast [enabled by default]
    self->membase = ioremap_nocache(res->start, resource_size(res));
    ^
    drivers/net/irda/sh_irda.c:821:2: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration]
    iounmap(self->membase);
    ^

    Signed-off-by: Chen Gang
    Signed-off-by: David S. Miller

    Chen Gang
     

10 Sep, 2014

1 commit


15 Aug, 2014

1 commit

  • Pull DEFINE_PCI_DEVICE_TABLE removal from Bjorn Helgaas:
    "Part two of the PCI changes for v3.17:

    - Remove DEFINE_PCI_DEVICE_TABLE macro use (Benoit Taine)

    It's a mechanical change that removes uses of the
    DEFINE_PCI_DEVICE_TABLE macro. I waited until later in the merge
    window to reduce conflicts, but it's possible you'll still see a few"

    * tag 'pci-v3.17-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
    PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use

    Linus Torvalds
     

14 Aug, 2014

1 commit


13 Aug, 2014

1 commit

  • We should prefer `struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to
    meet kernel coding style guidelines. This issue was reported by checkpatch.

    A simplified version of the semantic patch that makes this change is as
    follows (http://coccinelle.lip6.fr/):

    //

    @@
    identifier i;
    declarer name DEFINE_PCI_DEVICE_TABLE;
    initializer z;
    @@

    - DEFINE_PCI_DEVICE_TABLE(i)
    + const struct pci_device_id i[]
    = z;

    //

    [bhelgaas: add semantic patch]
    Signed-off-by: Benoit Taine
    Signed-off-by: Bjorn Helgaas

    Benoit Taine
     

09 Aug, 2014

1 commit


07 Aug, 2014

1 commit

  • Pull MIPS updates from Ralf Baechle:
    "This is the main pull request for 3.17. It contains:

    - misc Cavium Octeon, BCM47xx, BCM63xx and Alchemy updates
    - MIPS ptrace updates and cleanups
    - various fixes that will also go to -stable
    - a number of cleanups and small non-critical fixes.
    - NUMA support for the Loongson 3.
    - more support for MSA
    - support for MAAR
    - various FP enhancements and fixes"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (139 commits)
    MIPS: jz4740: remove unnecessary null test before debugfs_remove
    MIPS: Octeon: remove unnecessary null test before debugfs_remove_recursive
    MIPS: ZBOOT: implement stack protector in compressed boot phase
    MIPS: mipsreg: remove duplicate MIPS_CONF4_FTLBSETS_SHIFT
    MIPS: Bonito64: remove a duplicate define
    MIPS: Malta: initialise MAARs
    MIPS: Initialise MAARs
    MIPS: detect presence of MAARs
    MIPS: define MAAR register accessors & bits
    MIPS: mark MSA experimental
    MIPS: Don't build MSA support unless it can be used
    MIPS: consistently clear MSA flags when starting & copying threads
    MIPS: 16 byte align MSA vector context
    MIPS: disable preemption whilst initialising MSA
    MIPS: ensure MSA gets disabled during boot
    MIPS: fix read_msa_* & write_msa_* functions on non-MSA toolchains
    MIPS: fix MSA context for tasks which don't use FP first
    MIPS: init upper 64b of vector registers when MSA is first used
    MIPS: save/disable MSA in lose_fpu
    MIPS: preserve scalar FP CSR when switching vector context
    ...

    Linus Torvalds
     

30 Jul, 2014

1 commit


20 Jun, 2014

1 commit


13 Jun, 2014

1 commit

  • Pull networking updates from David Miller:

    1) Seccomp BPF filters can now be JIT'd, from Alexei Starovoitov.

    2) Multiqueue support in xen-netback and xen-netfront, from Andrew J
    Benniston.

    3) Allow tweaking of aggregation settings in cdc_ncm driver, from Bjørn
    Mork.

    4) BPF now has a "random" opcode, from Chema Gonzalez.

    5) Add more BPF documentation and improve test framework, from Daniel
    Borkmann.

    6) Support TCP fastopen over ipv6, from Daniel Lee.

    7) Add software TSO helper functions and use them to support software
    TSO in mvneta and mv643xx_eth drivers. From Ezequiel Garcia.

    8) Support software TSO in fec driver too, from Nimrod Andy.

    9) Add Broadcom SYSTEMPORT driver, from Florian Fainelli.

    10) Handle broadcasts more gracefully over macvlan when there are large
    numbers of interfaces configured, from Herbert Xu.

    11) Allow more control over fwmark used for non-socket based responses,
    from Lorenzo Colitti.

    12) Do TCP congestion window limiting based upon measurements, from Neal
    Cardwell.

    13) Support busy polling in SCTP, from Neal Horman.

    14) Allow RSS key to be configured via ethtool, from Venkata Duvvuru.

    15) Bridge promisc mode handling improvements from Vlad Yasevich.

    16) Don't use inetpeer entries to implement ID generation any more, it
    performs poorly, from Eric Dumazet.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1522 commits)
    rtnetlink: fix userspace API breakage for iproute2 < v3.9.0
    tcp: fixing TLP's FIN recovery
    net: fec: Add software TSO support
    net: fec: Add Scatter/gather support
    net: fec: Increase buffer descriptor entry number
    net: fec: Factorize feature setting
    net: fec: Enable IP header hardware checksum
    net: fec: Factorize the .xmit transmit function
    bridge: fix compile error when compiling without IPv6 support
    bridge: fix smatch warning / potential null pointer dereference
    via-rhine: fix full-duplex with autoneg disable
    bnx2x: Enlarge the dorq threshold for VFs
    bnx2x: Check for UNDI in uncommon branch
    bnx2x: Fix 1G-baseT link
    bnx2x: Fix link for KR with swapped polarity lane
    sctp: Fix sk_ack_backlog wrap-around problem
    net/core: Add VF link state control policy
    net/fsl: xgmac_mdio is dependent on OF_MDIO
    net/fsl: Make xgmac_mdio read error message useful
    net_sched: drr: warn when qdisc is not work conserving
    ...

    Linus Torvalds
     

03 Jun, 2014

1 commit

  • This patch remove variables that are initialized with a constant,
    are never updated, and are only used as parameter of return.
    Return the constant instead of using a variable.

    Verified by compilation only.

    The coccinelle script that find and fixes this issue is:
    //
    @@
    type T;
    constant C;
    identifier ret;
    @@
    - T ret = C;
    ... when != ret
    when strict
    return
    - ret
    + C
    ;
    //

    Signed-off-by: Peter Senna Tschudin
    Signed-off-by: David S. Miller

    Peter Senna Tschudin
     

15 May, 2014

1 commit


08 May, 2014

1 commit

  • Ever since v2.3.5 the driver for "Winbond W83977AF (IR)" contains two
    unneeded preprocessor macros.

    CONFIG_NETWINDER_TX_DMA_PROBLEMS is never defined and can safely be
    removed. And CONFIG_NETWINDER_RX_DMA_PROBLEMS is just an alias for
    CONFIG_ARCH_NETWINDER, so that (valid) Kconfig macro can be used
    instead.

    Signed-off-by: Paul Bolle
    Signed-off-by: David S. Miller

    Paul Bolle
     

30 Apr, 2014

1 commit


18 Feb, 2014

1 commit

  • Issuing set_termios() from irtty_close() causes kernel Oops for
    unplugged usb-serial devices.

    Since no other tty_ldisc calls set_termios() on close and no tty driver
    seem to check if tty->device_data is NULL or not on entry to set_termios(),
    the only solution I can come up with is to remove the irtty_stop_receiver()
    call, which only updates termios.

    Signed-off-by: Tommie Gannert
    Signed-off-by: David S. Miller

    Tommie Gannert