Skip to content
  1. Jan 22, 2021
    • John Garry's avatar
      perf metricgroup: Fix for metrics containing duration_time · 9c880c24
      John Garry authored
      Metrics containing duration_time cause a segfault:
      
        $ perf stat -v -M L1D_Cache_Fill_BW sleep 1
        Using CPUID GenuineIntel-6-3D-4
        metric expr 64 * l1d.replacement / 1000000000 / duration_time for L1D_Cache_Fill_BW
        found event duration_time
        found event l1d.replacement
        adding {l1d.replacement}:W,duration_time
        l1d.replacement -> cpu/umask=0x1,(null)=0x1e8483,event=0x51/
        Segmentation fault
        $
      
      In commit c2337d67 ("perf metricgroup: Fix metrics using aliases
      covering multiple PMUs"), the logic in find_evsel_group() when iter'ing
      events was changed to not only select events in same group, but also for
      aliased PMUs.
      
      Checking whether events were for aliased PMUs was done by comparing the
      event PMU name. This was not safe for duration_time event, which has no
      associated PMU (and no PMU name), so fix by checking if the event PMU name
      is set also.
      
      Committer testing:
      
      Reproduced the bug, then, on a:
      
        $ grep -m1 ^'model name' /proc/cpuinfo
        model name	: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
        $
      
      We now get:
      
        $ perf stat -M L1D_Cache_Fill_BW sleep 1
      
         Performance counter stats for 'sleep 1':
      
                     4,141      l1d.replacement:u
             1,001,285,107 ns   duration_time:u
      
               1.001285107 seconds time elapsed
      
               0.000000000 seconds user
               0.001119000 seconds sys
      
        $
      
      Detais from -v:
      
        Using CPUID GenuineIntel-6-8E-A
        metric expr 64 * l1d.replacement / 1000000000 / duration_time for L1D_Cache_Fill_BW
        found event duration_time
        found event l1d.replacement
        adding {l1d.replacement}:W,duration_time
        l1d.replacement -> cpu/(null)=0x1e8483,umask=0x1,event=0x51/
        Control descriptor is not initialized
        Warning:
        kernel.perf_event_paranoid=2, trying to fall back to excluding kernel and hypervisor  samples
        Warning:
        kernel.perf_event_paranoid=2, trying to fall back to excluding kernel and hypervisor  samples
        l1d.replacement:u: 4592 612201 612201
        duration_time:u: 1001478621 1001478621 1001478621
      
      Fixes: c2337d67
      
       ("perf metricgroup: Fix metrics using aliases covering multiple PMUs")
      Reported-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linuxarm@openeuler.org
      Link: https://lore.kernel.org/r/1611159518-226883-1-git-send-email-john.garry@huawei.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9c880c24
    • Adrian Hunter's avatar
      perf evlist: Fix id index for heterogeneous systems · fc705fec
      Adrian Hunter authored
      perf_evlist__set_sid_idx() updates perf_sample_id with the evlist map
      index, CPU number and TID. It is passed indexes to the evsel's cpu and
      thread maps, but references the evlist's maps instead. That results in
      using incorrect CPU numbers on heterogeneous systems. Fix it by using
      evsel maps.
      
      The id index (PERF_RECORD_ID_INDEX) is used by AUX area tracing when in
      sampling mode. Having an incorrect CPU number causes the trace data to
      be attributed to the wrong CPU, and can result in decoder errors because
      the trace data is then associated with the wrong process.
      
      Committer notes:
      
      Keep the class prefix convention in the function name, switching from
      perf_evlist__set_sid_idx() to perf_evsel__set_sid_idx().
      
      Fixes: 3c659eed
      
       ("perf tools: Add id index")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20210121125446.11287-1-adrian.hunter@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fc705fec
    • Linus Torvalds's avatar
      Merge tag 'fs_for_v5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · 9f29bd8b
      Linus Torvalds authored
      Pull fs and udf fixes from Jan Kara:
       "A lazytime handling fix from Eric Biggers and a fix of UDF session
        handling for large devices"
      
      * tag 'fs_for_v5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        udf: fix the problem that the disc content is not displayed
        fs: fix lazytime expiration handling in __writeback_single_inode()
      9f29bd8b
    • Linus Torvalds's avatar
      Merge tag 'printk-for-5.11-printk-rework-fixup' of... · 2561bbbe
      Linus Torvalds authored
      Merge tag 'printk-for-5.11-printk-rework-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
      
      Pull printk fixes from Petr Mladek:
      
       - Fix line counting and buffer size calculation. Both regressions
         caused that a reader buffer might not get filled as much as possible.
      
       - Restore non-documented behavior of printk() reader API and make it
         official.
      
         It did not fill the last byte of the provided buffer before 5.10. Two
         architectures, powerpc and um, used it to add the trailing '\0'.
         There might theoretically be more callers depending on this behavior
         in userspace.
      
      * tag 'printk-for-5.11-printk-rework-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
        printk: fix buffer overflow potential for print_text()
        printk: fix kmsg_dump_get_buffer length calulations
        printk: ringbuffer: fix line counting
      2561bbbe
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 6a52f4cf
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Modify a helper function in the ACPI core to match the behavior
        expected by its users so as to prevent NULL pointer dereferences and
        occasional memory corruption from occurring (Hans de Goede)"
      
      * tag 'acpi-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: scan: Make acpi_bus_get_device() clear return pointer on error
      6a52f4cf
    • Linus Torvalds's avatar
      Merge tag 'sound-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 120fbdb8
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Here is a collection of sound fixes targeted for 5.11-rc5. Most
        notably, USB-audio still got a few intensive changes for covering the
        regressions while the rest are all small fixes.
      
         - A trivial fix for sequencer OSS emulation error path
      
         - HD-audio runtime PM regression fix, a few quirks and new IDs
      
         - USB-audio regression fixes for Pioneer device, Logitech webcams,
           etc
      
         - ASoC SOF Intel coverage
      
         - MAINTAINERS file update
      
         - A fix in the jack handling in ASoC HDMI codec"
      
      * tag 'sound-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: usb-audio: Fix hw constraints dependencies
        ALSA: hda: Balance runtime/system PM if direct-complete is disabled
        ALSA: usb-audio: Avoid implicit feedback on Pioneer devices
        ALSA: usb-audio: Set sample rate for all sharing EPs on UAC1
        ALSA: usb-audio: Fix UAC1 rate setup for secondary endpoints
        MAINTAINERS: update qcom ASoC drivers list
        MAINTAINERS: update maintainers of qcom audio
        ALSA: hda: Add Cometlake-R PCI ID
        ALSA: seq: oss: Fix missing error check in snd_seq_oss_synth_make_info()
        ALSA: hda/via: Add minimum mute flag
        ALSA: hda/realtek - Limit int mic boost on Acer Aspire E5-575T
        ALSA: usb-audio: Always apply the hw constraints for implicit fb sync
        ASoC: SOF: Intel: fix page fault at probe if i915 init fails
        ALSA: hda: Add AlderLake-P PCI ID and HDMI codec vid
        ASoC: SOF: Intel: hda: Avoid checking jack on system suspend
        ASoC: SOF: Intel: hda: Modify existing helper to disable WAKEEN
        ASoC: SOF: Intel: hda: Resume codec to do jack detection
        MAINTAINERS: update references to stm32 audio bindings
        ASoC: hdmi-codec: Fix return value in hdmi_codec_set_jack()
      120fbdb8
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · d7631e43
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - rework the character device code to avoid a frame size warning
      
       - fix printk format issues in gpio-tools
      
       - warn on redefinition of the to_irq callback in core gpiolib code
      
       - fix PWM period calculation in gpio-mvebu
      
       - make gpio-sifive Kconfig entry consistent with other drivers
      
       - fix a build issue in gpio-tegra
      
      * tag 'gpio-fixes-for-v5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: tegra: Add missing dependencies
        gpio: sifive: select IRQ_DOMAIN_HIERARCHY rather than depend on it
        gpio: mvebu: fix pwm .get_state period calculation
        gpiolib: add a warning on gpiochip->to_irq defined
        tools: gpio: fix %llu warning in gpio-watch.c
        tools: gpio: fix %llu warning in gpio-event-mon.c
        gpiolib: cdev: fix frame size warning in gpio_ioctl()
      d7631e43
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 63858ac3
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "These are all driver fixes, the Qualcomm stuff is the most widely used
        and important:
      
         - The main matter is a complicated fixup for the Qualcomm deep sleep
           states.
      
           This manifests in how interrupts get handled or in some cases not
           handled in cooperation with the PDC (Power Domain Controller). It's
           one of these really hardcore bug fixes that signifies high maturity
           of the platform.
      
         - Fix a register layout problem in the JZ4760 driver
      
         - Fix a register offset in the Aspeed G6 driver
      
         - Fix a compiler warning in the Nomadik driver
      
         - Fix a fallback code path in the mediatek driver"
      
      * tag 'pinctrl-v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: qcom: Don't clear pending interrupts when enabling
        pinctrl: qcom: Properly clear "intr_ack_high" interrupts when unmasking
        pinctrl: qcom: No need to read-modify-write the interrupt status
        pinctrl: qcom: Allow SoCs to specify a GPIO function that's not 0
        pinctrl: mediatek: Fix fallback call path
        pinctrl: nomadik: Remove unused variable in nmk_gpio_dbg_show_one
        pinctrl: aspeed: g6: Fix PWMG0 pinctrl setting
        pinctrl: ingenic: Rename registers from JZ4760_GPIO_* to JZ4770_GPIO_*
        pinctrl: ingenic: Fix JZ4760 support
      63858ac3
  2. Jan 21, 2021
    • Petr Mladek's avatar
      Merge branch 'printk-rework' into for-linus · 535b6a12
      Petr Mladek authored
      535b6a12
    • Linus Torvalds's avatar
      Merge tag 'for-5.11-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 9791581c
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A few more one line fixes for various bugs, stable material.
      
         - fix send when emitting clone operation from the same file and root
      
         - fix double free on error when cleaning backrefs
      
         - lockdep fix during relocation
      
         - handle potential error during reloc when starting transaction
      
         - skip running delayed refs during commit (leftover from code removal
           in this dev cycle)"
      
      * tag 'for-5.11-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: don't clear ret in btrfs_start_dirty_block_groups
        btrfs: fix lockdep splat in btrfs_recover_relocation
        btrfs: do not double free backref nodes on error
        btrfs: don't get an EINTR during drop_snapshot for reloc
        btrfs: send: fix invalid clone operations when cloning from the same file and root
        btrfs: no need to run delayed refs after commit_fs_roots during commit
      9791581c
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix hw constraints dependencies · 506c203c
      Takashi Iwai authored
      Since the recent refactoring, it's been reported that some USB-audio
      devices (typically webcams) are no longer detected properly by
      PulseAudio.  The debug session revealed that it's failing at probing
      by PA to try the sample rate 44.1kHz while the device has discrete
      sample rates other than 44.1kHz.  But the puzzle was that arecord
      works as is, and some other devices with the discrete rates work,
      either.
      
      After all, this turned out to be the lack of the dependencies in a few
      hw constraint rules: snd_pcm_hw_rule_add() has the (variable)
      arguments specifying the dependent parameters, and some functions
      didn't set the target parameter itself as the dependencies.  This
      resulted in an invalid parameter that could be generated only in a
      certain call pattern.  This bug itself has been present in the code,
      but it didn't trigger errors just because the rules were casually
      avoiding such a corner case.  After the recent refactoring and
      cleanup, however, the hw constraints work "as expected", and the
      problem surfaced now.
      
      For fixing the problem above, this patch adds the missing dependent
      parameters to each snd_pcm_hw_rule() call.
      
      Fixes: bc4e94aa ("ALSA: usb-audio: Handle discrete rates properly in hw constraints")
      BugLink: http://bugzilla.opensuse.org/show_bug.cgi?id=1181014
      Link: https://lore.kernel.org/r/20210120204554.30177-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      506c203c
    • Linus Torvalds's avatar
      Merge tag 'net-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 75439bc4
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Networking fixes for 5.11-rc5, including fixes from bpf, wireless, and
        can trees.
      
        Current release - regressions:
      
         - nfc: nci: fix the wrong NCI_CORE_INIT parameters
      
        Current release - new code bugs:
      
         - bpf: allow empty module BTFs
      
        Previous releases - regressions:
      
         - bpf: fix signed_{sub,add32}_overflows type handling
      
         - tcp: do not mess with cloned skbs in tcp_add_backlog()
      
         - bpf: prevent double bpf_prog_put call from bpf_tracing_prog_attach
      
         - bpf: don't leak memory in bpf getsockopt when optlen == 0
      
         - tcp: fix potential use-after-free due to double kfree()
      
         - mac80211: fix encryption issues with WEP
      
         - devlink: use right genl user_ptr when handling port param get/set
      
         - ipv6: set multicast flag on the multicast route
      
         - tcp: fix TCP_USER_TIMEOUT with zero window
      
        Previous releases - always broken:
      
         - bpf: local storage helpers should check nullness of owner ptr passed
      
         - mac80211: fix incorrect strlen of .write in debugfs
      
         - cls_flower: call nla_ok() before nla_next()
      
         - skbuff: back tiny skbs with kmalloc() in __netdev_alloc_skb() too"
      
      * tag 'net-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (52 commits)
        net: systemport: free dev before on error path
        net: usb: cdc_ncm: don't spew notifications
        net: mscc: ocelot: Fix multicast to the CPU port
        tcp: Fix potential use-after-free due to double kfree()
        bpf: Fix signed_{sub,add32}_overflows type handling
        can: peak_usb: fix use after free bugs
        can: vxcan: vxcan_xmit: fix use after free bug
        can: dev: can_restart: fix use after free bug
        tcp: fix TCP socket rehash stats mis-accounting
        net: dsa: b53: fix an off by one in checking "vlan->vid"
        tcp: do not mess with cloned skbs in tcp_add_backlog()
        selftests: net: fib_tests: remove duplicate log test
        net: nfc: nci: fix the wrong NCI_CORE_INIT parameters
        sh_eth: Fix power down vs. is_opened flag ordering
        net: Disable NETIF_F_HW_TLS_RX when RXCSUM is disabled
        netfilter: rpfilter: mask ecn bits before fib lookup
        udp: mask TOS bits in udp_v4_early_demux()
        xsk: Clear pool even for inactive queues
        bpf: Fix helper bpf_map_peek_elem_proto pointing to wrong callback
        sh_eth: Make PHY access aware of Runtime PM to fix reboot crash
        ...
      75439bc4
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.11-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 2e4ceed6
      Linus Torvalds authored
      Pull xen fix from Juergen Gross:
       "A fix for build failure showing up in some configurations"
      
      * tag 'for-linus-5.11-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        x86/xen: fix 'nopvspin' build error
      2e4ceed6
    • Tianjia Zhang's avatar
      X.509: Fix crash caused by NULL pointer · 7178a107
      Tianjia Zhang authored
      On the following call path, `sig->pkey_algo` is not assigned
      in asymmetric_key_verify_signature(), which causes runtime
      crash in public_key_verify_signature().
      
        keyctl_pkey_verify
          asymmetric_key_verify_signature
            verify_signature
              public_key_verify_signature
      
      This patch simply check this situation and fixes the crash
      caused by NULL pointer.
      
      Fixes: 21552563
      
       ("X.509: support OSCCA SM2-with-SM3 certificate verification")
      Reported-by: default avatarTobias Markus <tobias@markus-regensburg.de>
      Signed-off-by: default avatarTianjia Zhang <tianjia.zhang@linux.alibaba.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-and-tested-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Tested-by: default avatarJoão Fonseca <jpedrofonseca@ua.pt>
      Acked-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Cc: stable@vger.kernel.org # v5.10+
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7178a107
    • Takashi Iwai's avatar
      cachefiles: Drop superfluous readpages aops NULL check · db58465f
      Takashi Iwai authored
      After the recent actions to convert readpages aops to readahead, the
      NULL checks of readpages aops in cachefiles_read_or_alloc_page() may
      hit falsely.  More badly, it's an ASSERT() call, and this panics.
      
      Drop the superfluous NULL checks for fixing this regression.
      
      [DH: Note that cachefiles never actually used readpages, so this check was
       never actually necessary]
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208883
      BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1175245
      Fixes: 9ae326a6
      
       ("CacheFiles: A cache that backs onto a mounted filesystem")
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      db58465f
    • Hans de Goede's avatar
      ACPI: scan: Make acpi_bus_get_device() clear return pointer on error · 78a18fec
      Hans de Goede authored
      Set the acpi_device pointer which acpi_bus_get_device() returns-by-
      reference to NULL on errors.
      
      We've recently had 2 cases where callers of acpi_bus_get_device()
      did not properly error check the return value, so set the returned-
      by-reference acpi_device pointer to NULL, because at least some
      callers of acpi_bus_get_device() expect that to be done on errors.
      
      [ rjw: This issue was exposed by commit 71da201f ("ACPI: scan:
        Defer enumeration of devices with _DEP lists") which caused it to
        be much more likely to occur on some systems, but the real defect
        had been introduced by an earlier commit. ]
      
      Fixes: 40e7fcb1 ("ACPI: Add _DEP support to fix battery issue on Asus T100TA")
      Fixes: bcfcd409
      
       ("usb: split code locating ACPI companion into port and device")
      Reported-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Tested-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Diagnosed-by: default avatarRafael J. Wysocki <rafael@kernel.org>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: All applicable <stable@vger.kernel.org>
      [ rjw: Subject and changelog edits ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      78a18fec
    • Jakub Kicinski's avatar
      Merge tag 'linux-can-fixes-for-5.11-20210120' of... · 535d3159
      Jakub Kicinski authored
      Merge tag 'linux-can-fixes-for-5.11-20210120' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine-Budde says:
      
      ====================
      linux-can-fixes-for-5.11-20210120
      
      All three patches are by Vincent Mailhol and fix a potential use after free bug
      in the CAN device infrastructure, the vxcan driver, and the peak_usk driver. In
      the TX-path the skb is used to read from after it was passed to the networking
      stack with netif_rx_ni().
      
      * tag 'linux-can-fixes-for-5.11-20210120' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
        can: peak_usb: fix use after free bugs
        can: vxcan: vxcan_xmit: fix use after free bug
        can: dev: can_restart: fix use after free bug
      ====================
      
      Link: https://lore.kernel.org/r/20210120125202.2187358-1-mkl@pengutronix.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      535d3159
    • Pan Bian's avatar
      net: systemport: free dev before on error path · 0c630a66
      Pan Bian authored
      On the error path, it should goto the error handling label to free
      allocated memory rather than directly return.
      
      Fixes: 31bc72d9
      
       ("net: systemport: fetch and use clock resources")
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20210120044423.1704-1-bianpan2016@163.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0c630a66
    • Grant Grundler's avatar
      net: usb: cdc_ncm: don't spew notifications · de658a19
      Grant Grundler authored
      RTL8156 sends notifications about every 32ms.
      Only display/log notifications when something changes.
      
      This issue has been reported by others:
      	https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1832472
      	https://lkml.org/lkml/2020/8/27/1083
      
      
      
      ...
      [785962.779840] usb 1-1: new high-speed USB device number 5 using xhci_hcd
      [785962.929944] usb 1-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=30.00
      [785962.929949] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
      [785962.929952] usb 1-1: Product: USB 10/100/1G/2.5G LAN
      [785962.929954] usb 1-1: Manufacturer: Realtek
      [785962.929956] usb 1-1: SerialNumber: 000000001
      [785962.991755] usbcore: registered new interface driver cdc_ether
      [785963.017068] cdc_ncm 1-1:2.0: MAC-Address: 00:24:27:88:08:15
      [785963.017072] cdc_ncm 1-1:2.0: setting rx_max = 16384
      [785963.017169] cdc_ncm 1-1:2.0: setting tx_max = 16384
      [785963.017682] cdc_ncm 1-1:2.0 usb0: register 'cdc_ncm' at usb-0000:00:14.0-1, CDC NCM, 00:24:27:88:08:15
      [785963.019211] usbcore: registered new interface driver cdc_ncm
      [785963.023856] usbcore: registered new interface driver cdc_wdm
      [785963.025461] usbcore: registered new interface driver cdc_mbim
      [785963.038824] cdc_ncm 1-1:2.0 enx002427880815: renamed from usb0
      [785963.089586] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
      [785963.121673] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
      [785963.153682] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
      ...
      
      This is about 2KB per second and will overwrite all contents of a 1MB
      dmesg buffer in under 10 minutes rendering them useless for debugging
      many kernel problems.
      
      This is also an extra 180 MB/day in /var/logs (or 1GB per week) rendering
      the majority of those logs useless too.
      
      When the link is up (expected state), spew amount is >2x higher:
      ...
      [786139.600992] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
      [786139.632997] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
      [786139.665097] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
      [786139.697100] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
      [786139.729094] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
      [786139.761108] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
      ...
      
      Chrome OS cannot support RTL8156 until this is fixed.
      
      Signed-off-by: default avatarGrant Grundler <grundler@chromium.org>
      Reviewed-by: default avatarHayes Wang <hayeswang@realtek.com>
      Link: https://lore.kernel.org/r/20210120011208.3768105-1-grundler@chromium.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      de658a19
    • Alban Bedel's avatar
      net: mscc: ocelot: Fix multicast to the CPU port · 584b7cfc
      Alban Bedel authored
      Multicast entries in the MAC table use the high bits of the MAC
      address to encode the ports that should get the packets. But this port
      mask does not work for the CPU port, to receive these packets on the
      CPU port the MAC_CPU_COPY flag must be set.
      
      Because of this IPv6 was effectively not working because neighbor
      solicitations were never received. This was not apparent before commit
      9403c158
      
       (net: mscc: ocelot: support IPv4, IPv6 and plain Ethernet mdb
      entries) as the IPv6 entries were broken so all incoming IPv6
      multicast was then treated as unknown and flooded on all ports.
      
      To fix this problem rework the ocelot_mact_learn() to set the
      MAC_CPU_COPY flag when a multicast entry that target the CPU port is
      added. For this we have to read back the ports endcoded in the pseudo
      MAC address by the caller. It is not a very nice design but that avoid
      changing the callers and should make backporting easier.
      
      Signed-off-by: default avatarAlban Bedel <alban.bedel@aerq.com>
      Fixes: 9403c158 ("net: mscc: ocelot: support IPv4, IPv6 and plain Ethernet mdb entries")
      Link: https://lore.kernel.org/r/20210119140638.203374-1-alban.bedel@aerq.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      584b7cfc
    • Kuniyuki Iwashima's avatar
      tcp: Fix potential use-after-free due to double kfree() · c89dffc7
      Kuniyuki Iwashima authored
      Receiving ACK with a valid SYN cookie, cookie_v4_check() allocates struct
      request_sock and then can allocate inet_rsk(req)->ireq_opt. After that,
      tcp_v4_syn_recv_sock() allocates struct sock and copies ireq_opt to
      inet_sk(sk)->inet_opt. Normally, tcp_v4_syn_recv_sock() inserts the full
      socket into ehash and sets NULL to ireq_opt. Otherwise,
      tcp_v4_syn_recv_sock() has to reset inet_opt by NULL and free the full
      socket.
      
      The commit 01770a16 ("tcp: fix race condition when creating child
      sockets from syncookies") added a new path, in which more than one cores
      create full sockets for the same SYN cookie. Currently, the core which
      loses the race frees the full socket without resetting inet_opt, resulting
      in that both sock_put() and reqsk_put() call kfree() for the same memory:
      
        sock_put
          sk_free
            __sk_free
              sk_destruct
                __sk_destruct
                  sk->sk_destruct/inet_sock_destruct
                    kfree(rcu_dereference_protected(inet->inet_opt, 1));
      
        reqsk_put
          reqsk_free
            __reqsk_free
              req->rsk_ops->destructor/tcp_v4_reqsk_destructor
                kfree(rcu_dereference_protected(inet_rsk(req)->ireq_opt, 1));
      
      Calling kmalloc() between the double kfree() can lead to use-after-free, so
      this patch fixes it by setting NULL to inet_opt before sock_put().
      
      As a side note, this kind of issue does not happen for IPv6. This is
      because tcp_v6_syn_recv_sock() clones both ipv6_opt and pktopts which
      correspond to ireq_opt in IPv4.
      
      Fixes: 01770a16
      
       ("tcp: fix race condition when creating child sockets from syncookies")
      CC: Ricardo Dias <rdias@singlestore.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.co.jp>
      Reviewed-by: default avatarBenjamin Herrenschmidt <benh@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20210118055920.82516-1-kuniyu@amazon.co.jp
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c89dffc7
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · b3741b43
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2021-01-20
      
      1) Fix wrong bpf_map_peek_elem_proto helper callback, from Mircea Cirjaliu.
      
      2) Fix signed_{sub,add32}_overflows type truncation, from Daniel Borkmann.
      
      3) Fix AF_XDP to also clear pools for inactive queues, from Maxim Mikityanskiy.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        bpf: Fix signed_{sub,add32}_overflows type handling
        xsk: Clear pool even for inactive queues
        bpf: Fix helper bpf_map_peek_elem_proto pointing to wrong callback
      ====================
      
      Link: https://lore.kernel.org/r/20210120163439.8160-1-daniel@iogearbox.net
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b3741b43
    • Daniel Borkmann's avatar
      bpf: Fix signed_{sub,add32}_overflows type handling · bc895e8b
      Daniel Borkmann authored
      Fix incorrect signed_{sub,add32}_overflows() input types (and a related buggy
      comment). It looks like this might have slipped in via copy/paste issue, also
      given prior to 3f50f132 ("bpf: Verifier, do explicit ALU32 bounds tracking")
      the signature of signed_sub_overflows() had s64 a and s64 b as its input args
      whereas now they are truncated to s32. Thus restore proper types. Also, the case
      of signed_add32_overflows() is not consistent to signed_sub32_overflows(). Both
      have s32 as inputs, therefore align the former.
      
      Fixes: 3f50f132
      
       ("bpf: Verifier, do explicit ALU32 bounds tracking")
      Reported-by: default avatarDe4dCr0w <sa516203@mail.ustc.edu.cn>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      bc895e8b
  3. Jan 20, 2021