Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jan 21, 2022
    • Miaoqian Lin's avatar
      parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries · d24846a4
      Miaoqian Lin authored
      kobject_init_and_add() takes reference even when it fails.
      According to the doc of kobject_init_and_add():
      
         If this function returns an error, kobject_put() must be called to
         properly clean up the memory associated with the object.
      
      Fix memory leak by calling kobject_put().
      
      Fixes: 73f368cf
      
       ("Kobject: change drivers/parisc/pdc_stable.c to use kobject_init_and_add")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      d24846a4
    • Jason Gerecke's avatar
      HID: wacom: Avoid using stale array indicies to read contact count · 20f3cf5f
      Jason Gerecke authored
      If we ever see a touch report with contact count data we initialize
      several variables used to read the contact count in the pre-report
      phase. These variables are never reset if we process a report which
      doesn't contain a contact count, however. This can cause the pre-
      report function to trigger a read of arbitrary memory (e.g. NULL
      if we're lucky) and potentially crash the driver.
      
      This commit restores resetting of the variables back to default
      "none" values that were used prior to the commit mentioned
      below.
      
      Link: https://github.com/linuxwacom/input-wacom/issues/276
      Fixes: 003f50ab
      
       (HID: wacom: Update last_slot_field during pre_report phase)
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
      Reviewed-by: default avatarPing Cheng <ping.cheng@wacom.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      20f3cf5f
    • Jason Gerecke's avatar
      HID: wacom: Ignore the confidence flag when a touch is removed · df03e9bd
      Jason Gerecke authored
      AES hardware may internally re-classify a contact that it thought was
      intentional as a palm. Intentional contacts are reported as "down" with
      the confidence bit set. When this re-classification occurs, however, the
      state transitions to "up" with the confidence bit cleared. This kind of
      transition appears to be legal according to Microsoft docs, but we do
      not handle it correctly. Because the confidence bit is clear, we don't
      call `wacom_wac_finger_slot` and update userspace. This causes hung
      touches that confuse userspace and interfere with pen arbitration.
      
      This commit adds a special case to ignore the confidence flag if a contact
      is reported as removed. This ensures we do not leave a hung touch if one
      of these re-classification events occured. Ideally we'd have some way to
      also let userspace know that the touch has been re-classified as a palm
      and needs to be canceled, but that's not possible right now :)
      
      Link: https://github.com/linuxwacom/input-wacom/issues/288
      Fixes: 7fb0413b
      
       (HID: wacom: Use "Confidence" flag to prevent reporting invalid contacts)
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
      Reviewed-by: default avatarPing Cheng <ping.cheng@wacom.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      df03e9bd
    • Jason Gerecke's avatar
      HID: wacom: Reset expected and received contact counts at the same time · 546e41ac
      Jason Gerecke authored
      These two values go hand-in-hand and must be valid for the driver to
      behave correctly. We are currently lazy about updating the values and
      rely on the "expected" code flow to take care of making sure they're
      valid at the point they're needed. The "expected" flow changed somewhat
      with commit f8b6a747 ("HID: wacom: generic: Support multiple tools
      per report"), however. This led to problems with the DTH-2452 due (in
      part) to *all* contacts being fully processed -- even those past the
      expected contact count. Specifically, the received count gets reset to
      0 once all expected fingers are processed, but not the expected count.
      The rest of the contacts in the report are then *also* processed since
      now the driver thinks we've only processed 0 of N expected contacts.
      
      Later commits such as 7fb0413b (HID: wacom: Use "Confidence" flag to
      prevent reporting invalid contacts) worked around the DTH-2452 issue by
      skipping the invalid contacts at the end of the report, but this is not
      a complete fix. The confidence flag cannot be relied on when a contact
      is removed (see the following patch), and dealing with that condition
      re-introduces the DTH-2452 issue unless we also address this contact
      count laziness. By resetting expected and received counts at the same
      time we ensure the driver understands that there are 0 more contacts
      expected in the report. Similarly, we also make sure to reset the
      received count if for some reason we're out of sync in the pre-report
      phase.
      
      Link: https://github.com/linuxwacom/input-wacom/issues/288
      Fixes: f8b6a747
      
       ("HID: wacom: generic: Support multiple tools per report")
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
      Reviewed-by: default avatarPing Cheng <ping.cheng@wacom.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      546e41ac
  2. Jan 20, 2022
    • Lukas Bulwahn's avatar
      riscv: canaan: remove useless select of non-existing config SYSCON · 3c2905ea
      Lukas Bulwahn authored
      
      The config SYSCON never existed in the kernel repository; so, the select of
      that config in ./drivers/soc/canaan/Kconfig has no effect.
      
      Presumably, this was just some mistake, assuming some symmetry in handling
      and naming of configs that simply does not exist.
      
      Remove this useless select of a non-existing config.
      
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      3c2905ea
    • Yang Li's avatar
      gpio: mpc8xxx: Fix an ignored error return from platform_get_irq() · 9f51ce0b
      Yang Li authored
      
      The return from the call to platform_get_irq() is int, it can be
      a negative error code, however this is being assigned to an unsigned
      int variable 'irqn', so making 'irqn' an int.
      
      Eliminate the following coccicheck warning:
      ./drivers/gpio/gpio-mpc8xxx.c:391:5-21: WARNING: Unsigned expression
      compared with zero: mpc8xxx_gc -> irqn < 0
      
      Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
      Fixes: 0b39536c
      
       ("gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe")
      Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      9f51ce0b
    • Yang Li's avatar
      gpio: idt3243x: Fix an ignored error return from platform_get_irq() · 7c1cf555
      Yang Li authored
      
      The return from the call to platform_get_irq() is int, it can be
      a negative error code, however this is being assigned to an unsigned
      int variable 'parent_irq', so making 'parent_irq' an int.
      
      Eliminate the following coccicheck warning:
      ./drivers/gpio/gpio-idt3243x.c:167:6-16: WARNING: Unsigned expression
      compared with zero: parent_irq < 0
      
      Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
      Fixes: 30fee1d7
      
       ("gpio: idt3243x: Fix IRQ check in idt_gpio_probe")
      Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      7c1cf555
    • Isabella Basso's avatar
      hash.h: remove unused define directive · fd0a1462
      Isabella Basso authored
      Patch series "test_hash.c: refactor into KUnit", v3.
      
      We refactored the lib/test_hash.c file into KUnit as part of the student
      group LKCAMP [1] introductory hackathon for kernel development.
      
      This test was pointed to our group by Daniel Latypov [2], so its full
      conversion into a pure KUnit test was our goal in this patch series, but
      we ran into many problems relating to it not being split as unit tests,
      which complicated matters a bit, as the reasoning behind the original
      tests is quite cryptic for those unfamiliar with hash implementations.
      
      Some interesting developments we'd like to highlight are:
      
       - In patch 1/5 we noticed that there was an unused define directive
         that could be removed.
      
       - In patch 4/5 we noticed how stringhash and hash tests are all under
         the lib/test_hash.c file, which might cause some confusion, and we
         also broke those kernel config entries up.
      
      Overall KUnit developments have been made in the other patches in this
      series:
      
      In patche...
      fd0a1462
    • Yafang Shao's avatar
      drivers/infiniband: replace open-coded string copy with get_task_comm · 7b6397d7
      Yafang Shao authored
      We'd better use the helper get_task_comm() rather than the open-coded
      strlcpy() to get task comm.  As the comment above the hard-coded 16, we
      can replace it with TASK_COMM_LEN.
      
      Link: https://lkml.kernel.org/r/20211120112738.45980-4-laoar.shao@gmail.com
      
      
      Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Acked-by: default avatarDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
      Cc: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Petr Mladek <pmladek@su...
      7b6397d7
    • Andy Shevchenko's avatar
      include/linux/unaligned: replace kernel.h with the necessary inclusions · 22c03398
      Andy Shevchenko authored
      When kernel.h is used in the headers it adds a lot into dependency hell,
      especially when there are circular dependencies are involved.
      
      Replace kernel.h inclusion with the list of what is really being used.
      
      The rest of the changes are induced by the above and may not be split.
      
      Link: https://lkml.kernel.org/r/20211209123823.20425-1-andriy.shevchenko@linux.intel.com
      
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>	[brcmfmac]
      Acked-by: default avatarKalle Valo <kvalo@kernel.org>
      Cc: Arend van Spriel <aspriel@gmail.com>
      Cc: Franky Lin <franky.lin@broadcom.com>
      Cc: Hante Meuleman <hante.meuleman@broadcom.com>
      Cc: Chi-hsien Lin <chi-hsien.lin@infineon.com>
      Cc: Wright Feng <wright.feng@infineon.com>
      Cc: Chung-hsien Hsu <chung-hsien.hsu@infineon.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Heikki Kro...
      22c03398
    • Kefeng Wang's avatar
      mm: percpu: add generic pcpu_populate_pte() function · 20c03576
      Kefeng Wang authored
      With NEED_PER_CPU_PAGE_FIRST_CHUNK enabled, we need a function to
      populate pte, this patch adds a generic pcpu populate pte function,
      pcpu_populate_pte(), which is marked __weak and used on most
      architectures, but it is overridden on x86, which has its own
      implementation.
      
      Link: https://lkml.kernel.org/r/20211216112359.103822-5-wangkefeng.wang@huawei.com
      
      
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Christoph Lamete...
      20c03576
    • Kefeng Wang's avatar
      mm: percpu: add generic pcpu_fc_alloc/free funciton · 23f91716
      Kefeng Wang authored
      With the previous patch, we could add a generic pcpu first chunk
      allocate and free function to cleanup the duplicated definations on each
      architecture.
      
      Link: https://lkml.kernel.org/r/20211216112359.103822-4-wangkefeng.wang@huawei.com
      
      
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      23f91716
    • Kefeng Wang's avatar
      mm: percpu: add pcpu_fc_cpu_to_node_fn_t typedef · 1ca3fb3a
      Kefeng Wang authored
      Add pcpu_fc_cpu_to_node_fn_t and pass it into pcpu_fc_alloc_fn_t, pcpu
      first chunk allocation will call it to alloc memblock on the
      corresponding node by it, this is prepare for the next patch.
      
      Link: https://lkml.kernel.org/r/20211216112359.103822-3-wangkefeng.wang@huawei.com
      
      
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1ca3fb3a
  3. Jan 19, 2022
  4. Jan 18, 2022