From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04F94C433EF for ; Mon, 11 Jul 2022 09:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231811AbiGKJOy (ORCPT ); Mon, 11 Jul 2022 05:14:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbiGKJNr (ORCPT ); Mon, 11 Jul 2022 05:13:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B2DD23BDB; Mon, 11 Jul 2022 02:09:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 17FA66115B; Mon, 11 Jul 2022 09:09:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22523C34115; Mon, 11 Jul 2022 09:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530594; bh=a9MgXYzEAI5HXFuZDKEJVg+krzAxUKavUqssLWc+OQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JYQaa1B6f1MUjt+RQVYL1bxBVSMIxBf6t032RP/53f0wY/m7cF+ipkPcETYE2QNim XQBDvE665obgYkfEyiSMYwEFkJ1D5zEyL8emK5B291nTucD48HRee0Om9AuBaKgfZo kLyenUzfyQIELXF0gQRW331uO5zoVSNXdS6LPXZc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sabrina Dubroca , Steffen Klassert Subject: [PATCH 5.4 01/38] esp: limit skb_page_frag_refill use to a single page Date: Mon, 11 Jul 2022 11:06:43 +0200 Message-Id: <20220711090538.769097008@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sabrina Dubroca commit 5bd8baab087dff657e05387aee802e70304cc813 upstream. Commit ebe48d368e97 ("esp: Fix possible buffer overflow in ESP transformation") tried to fix skb_page_frag_refill usage in ESP by capping allocsize to 32k, but that doesn't completely solve the issue, as skb_page_frag_refill may return a single page. If that happens, we will write out of bounds, despite the check introduced in the previous patch. This patch forces COW in cases where we would end up calling skb_page_frag_refill with a size larger than a page (first in esp_output_head with tailen, then in esp_output_tail with skb->data_len). Fixes: cac2661c53f3 ("esp4: Avoid skb_cow_data whenever possible") Fixes: 03e2a30f6a27 ("esp6: Avoid skb_cow_data whenever possible") Signed-off-by: Sabrina Dubroca Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/net/esp.h | 2 -- net/ipv4/esp4.c | 5 ++--- net/ipv6/esp6.c | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) --- a/include/net/esp.h +++ b/include/net/esp.h @@ -4,8 +4,6 @@ =20 #include =20 -#define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER) - struct ip_esp_hdr; =20 static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -277,7 +277,6 @@ int esp_output_head(struct xfrm_state *x struct page *page; struct sk_buff *trailer; int tailen =3D esp->tailen; - unsigned int allocsz; =20 /* this is non-NULL only with UDP Encapsulation */ if (x->encap) { @@ -287,8 +286,8 @@ int esp_output_head(struct xfrm_state *x return err; } =20 - allocsz =3D ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); - if (allocsz > ESP_SKB_FRAG_MAXSIZE) + if (ALIGN(tailen, L1_CACHE_BYTES) > PAGE_SIZE || + ALIGN(skb->data_len, L1_CACHE_BYTES) > PAGE_SIZE) goto cow; =20 if (!skb_cloned(skb)) { --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -230,10 +230,9 @@ int esp6_output_head(struct xfrm_state * struct page *page; struct sk_buff *trailer; int tailen =3D esp->tailen; - unsigned int allocsz; =20 - allocsz =3D ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); - if (allocsz > ESP_SKB_FRAG_MAXSIZE) + if (ALIGN(tailen, L1_CACHE_BYTES) > PAGE_SIZE || + ALIGN(skb->data_len, L1_CACHE_BYTES) > PAGE_SIZE) goto cow; =20 if (!skb_cloned(skb)) { From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27FA9C43334 for ; Mon, 11 Jul 2022 09:15:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231514AbiGKJPq (ORCPT ); Mon, 11 Jul 2022 05:15:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbiGKJO2 (ORCPT ); Mon, 11 Jul 2022 05:14:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16CB433E3E; Mon, 11 Jul 2022 02:10:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 940046118F; Mon, 11 Jul 2022 09:10:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CC3DC34115; Mon, 11 Jul 2022 09:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530622; bh=zp3JffDA6rZtfMFo04/+4E4M7pjTJoUkbaSDYbzk3MQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vRR6PJeQxHP+Osvhi1eOsReGunngrK6Bug4YiP0/AfzUuf8S+dm6KIFhho3ujcGyi WfTQxTTMgYcyt3dVFeVxAbD6gDnGstp+ohZtPBpLMm4PMAHxABaaQEL5YMCfzoAQ1s YE3EkNH2KtykUEoQ4LfTxDXUpNZUMFTl4TzEDgPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Christoph Lameter , David Rientjes , Muchun Song , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Vlastimil Babka Subject: [PATCH 5.4 02/38] mm/slub: add missing TID updates on slab deactivation Date: Mon, 11 Jul 2022 11:06:44 +0200 Message-Id: <20220711090538.798574175@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jann Horn commit eeaa345e128515135ccb864c04482180c08e3259 upstream. The fastpath in slab_alloc_node() assumes that c->slab is stable as long as the TID stays the same. However, two places in __slab_alloc() currently don't update the TID when deactivating the CPU slab. If multiple operations race the right way, this could lead to an object getting lost; or, in an even more unlikely situation, it could even lead to an object being freed onto the wrong slab's freelist, messing up the `inuse` counter and eventually causing a page to be freed to the page allocator while it still contains slab objects. (I haven't actually tested these cases though, this is just based on looking at the code. Writing testcases for this stuff seems like it'd be a pain...) The race leading to state inconsistency is (all operations on the same CPU and kmem_cache): - task A: begin do_slab_free(): - read TID - read pcpu freelist (=3D=3DNULL) - check `slab =3D=3D c->slab` (true) - [PREEMPT A->B] - task B: begin slab_alloc_node(): - fastpath fails (`c->freelist` is NULL) - enter __slab_alloc() - slub_get_cpu_ptr() (disables preemption) - enter ___slab_alloc() - take local_lock_irqsave() - read c->freelist as NULL - get_freelist() returns NULL - write `c->slab =3D NULL` - drop local_unlock_irqrestore() - goto new_slab - slub_percpu_partial() is NULL - get_partial() returns NULL - slub_put_cpu_ptr() (enables preemption) - [PREEMPT B->A] - task A: finish do_slab_free(): - this_cpu_cmpxchg_double() succeeds() - [CORRUPT STATE: c->slab=3D=3DNULL, c->freelist!=3DNULL] >From there, the object on c->freelist will get lost if task B is allowed to continue from here: It will proceed to the retry_load_slab label, set c->slab, then jump to load_freelist, which clobbers c->freelist. But if we instead continue as follows, we get worse corruption: - task A: run __slab_free() on object from other struct slab: - CPU_PARTIAL_FREE case (slab was on no list, is now on pcpu partial) - task A: run slab_alloc_node() with NUMA node constraint: - fastpath fails (c->slab is NULL) - call __slab_alloc() - slub_get_cpu_ptr() (disables preemption) - enter ___slab_alloc() - c->slab is NULL: goto new_slab - slub_percpu_partial() is non-NULL - set c->slab to slub_percpu_partial(c) - [CORRUPT STATE: c->slab points to slab-1, c->freelist has objects from slab-2] - goto redo - node_match() fails - goto deactivate_slab - existing c->freelist is passed into deactivate_slab() - inuse count of slab-1 is decremented to account for object from slab-2 At this point, the inuse count of slab-1 is 1 lower than it should be. This means that if we free all allocated objects in slab-1 except for one, SLUB will think that slab-1 is completely unused, and may free its page, leading to use-after-free. Fixes: c17dda40a6a4e ("slub: Separate out kmem_cache_cpu processing from de= activate_slab") Fixes: 03e404af26dc2 ("slub: fast release on full slab") Cc: stable@vger.kernel.org Signed-off-by: Jann Horn Acked-by: Christoph Lameter Acked-by: David Rientjes Reviewed-by: Muchun Song Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka Link: https://lore.kernel.org/r/20220608182205.2945720-1-jannh@google.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/slub.c +++ b/mm/slub.c @@ -2214,6 +2214,7 @@ redo: =20 c->page =3D NULL; c->freelist =3D NULL; + c->tid =3D next_tid(c->tid); } =20 /* @@ -2347,8 +2348,6 @@ static inline void flush_slab(struct kme { stat(s, CPUSLAB_FLUSH); deactivate_slab(s, c->page, c->freelist, c); - - c->tid =3D next_tid(c->tid); } =20 /* @@ -2632,6 +2631,7 @@ redo: =20 if (!freelist) { c->page =3D NULL; + c->tid =3D next_tid(c->tid); stat(s, DEACTIVATE_BYPASS); goto new_slab; } From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20695C43334 for ; Mon, 11 Jul 2022 09:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231535AbiGKJPy (ORCPT ); Mon, 11 Jul 2022 05:15:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231661AbiGKJOd (ORCPT ); Mon, 11 Jul 2022 05:14:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A5D729CBB; Mon, 11 Jul 2022 02:10:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE059B80D2C; Mon, 11 Jul 2022 09:10:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 528F4C34115; Mon, 11 Jul 2022 09:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530624; bh=SuR4s/jIkmb3L9Rd7RydHeU0F19C3tQ8whTRanpApLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1kqlJTwKBg6gVqNgI0V4MUzXYfE9bBsmBpFvI5Z3PIE89lbhHOE8+kNHrv4hjRf/ hDmTjrw/qi3GdplQZcImV8ur00d9wCRv+h2pBBHFP6ZTNxXc7Zlowz9jGEilgQ3jrj 4jiJlsun1+iIvGYhZkk80JRQZrHMq314FrYAwMLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Norbert Slusarek , Thadeu Lima de Souza Cascardo , Oliver Hartkopp , Marc Kleine-Budde Subject: [PATCH 5.4 03/38] can: bcm: use call_rcu() instead of costly synchronize_rcu() Date: Mon, 11 Jul 2022 11:06:45 +0200 Message-Id: <20220711090538.827305118@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Hartkopp commit f1b4e32aca0811aa011c76e5d6cf2fa19224b386 upstream. In commit d5f9023fa61e ("can: bcm: delay release of struct bcm_op after synchronize_rcu()") Thadeu Lima de Souza Cascardo introduced two synchronize_rcu() calls in bcm_release() (only once at socket close) and in bcm_delete_rx_op() (called on removal of each single bcm_op). Unfortunately this slow removal of the bcm_op's affects user space applications like cansniffer where the modification of a filter removes 2048 bcm_op's which blocks the cansniffer application for 40(!) seconds. In commit 181d4447905d ("can: gw: use call_rcu() instead of costly synchronize_rcu()") Eric Dumazet replaced the synchronize_rcu() calls with several call_rcu()'s to safely remove the data structures after the removal of CAN ID subscriptions with can_rx_unregister() calls. This patch adopts Erics approach for the can-bcm which should be applicable since the removal of tasklet_kill() in bcm_remove_op() and the introduction of the HRTIMER_MODE_SOFT timer handling in Linux 5.4. Fixes: d5f9023fa61e ("can: bcm: delay release of struct bcm_op after synchr= onize_rcu()") # >=3D 5.4 Link: https://lore.kernel.org/all/20220520183239.19111-1-socketcan@hartkopp= .net Cc: stable@vger.kernel.org Cc: Eric Dumazet Cc: Norbert Slusarek Cc: Thadeu Lima de Souza Cascardo Signed-off-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/can/bcm.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -102,6 +102,7 @@ static inline u64 get_u64(const struct c =20 struct bcm_op { struct list_head list; + struct rcu_head rcu; int ifindex; canid_t can_id; u32 flags; @@ -720,10 +721,9 @@ static struct bcm_op *bcm_find_op(struct return NULL; } =20 -static void bcm_remove_op(struct bcm_op *op) +static void bcm_free_op_rcu(struct rcu_head *rcu_head) { - hrtimer_cancel(&op->timer); - hrtimer_cancel(&op->thrtimer); + struct bcm_op *op =3D container_of(rcu_head, struct bcm_op, rcu); =20 if ((op->frames) && (op->frames !=3D &op->sframe)) kfree(op->frames); @@ -734,6 +734,14 @@ static void bcm_remove_op(struct bcm_op kfree(op); } =20 +static void bcm_remove_op(struct bcm_op *op) +{ + hrtimer_cancel(&op->timer); + hrtimer_cancel(&op->thrtimer); + + call_rcu(&op->rcu, bcm_free_op_rcu); +} + static void bcm_rx_unreg(struct net_device *dev, struct bcm_op *op) { if (op->rx_reg_dev =3D=3D dev) { @@ -759,6 +767,9 @@ static int bcm_delete_rx_op(struct list_ if ((op->can_id =3D=3D mh->can_id) && (op->ifindex =3D=3D ifindex) && (op->flags & CAN_FD_FRAME) =3D=3D (mh->flags & CAN_FD_FRAME)) { =20 + /* disable automatic timer on frame reception */ + op->flags |=3D RX_NO_AUTOTIMER; + /* * Don't care if we're bound or not (due to netdev * problems) can_rx_unregister() is always a save @@ -787,7 +798,6 @@ static int bcm_delete_rx_op(struct list_ bcm_rx_handler, op); =20 list_del(&op->list); - synchronize_rcu(); bcm_remove_op(op); return 1; /* done */ } From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48F38C433EF for ; Mon, 11 Jul 2022 09:16:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231546AbiGKJQB (ORCPT ); Mon, 11 Jul 2022 05:16:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231688AbiGKJOf (ORCPT ); Mon, 11 Jul 2022 05:14:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB03371A6; Mon, 11 Jul 2022 02:10:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFC96B80E7F; Mon, 11 Jul 2022 09:10:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31A8FC34115; Mon, 11 Jul 2022 09:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530627; bh=E/oaZfTiVY9vR0i6g6ujF38FIpD1f/3WJ1lvgnpdDpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YvpQv9Hp8eZ7Fj8vppEK/D/8LKjNh3I9J5uLMhEWRwN3maFbp5d1k++/4KW6sp24o RPl0peMnKSJg9b5OAndYs1IbcgLQNDgdyOi91xsZw/LlNvRvgZ29pBJicy5nskJOiG Kx88BxjuafOeaB8ZMbLlNZ938KMlDO6YOr8DcmiI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Larsson , Liang He , Marc Kleine-Budde Subject: [PATCH 5.4 04/38] can: grcan: grcan_probe(): remove extra of_node_get() Date: Mon, 11 Jul 2022 11:06:46 +0200 Message-Id: <20220711090538.856305298@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He commit 562fed945ea482833667f85496eeda766d511386 upstream. In grcan_probe(), of_find_node_by_path() has already increased the refcount. There is no need to call of_node_get() again, so remove it. Link: https://lore.kernel.org/all/20220619070257.4067022-1-windhl@126.com Fixes: 1e93ed26acf0 ("can: grcan: grcan_probe(): fix broken system id check= for errata workaround needs") Cc: stable@vger.kernel.org # v5.18 Cc: Andreas Larsson Signed-off-by: Liang He Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/grcan.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c @@ -1660,7 +1660,6 @@ static int grcan_probe(struct platform_d */ sysid_parent =3D of_find_node_by_path("/ambapp0"); if (sysid_parent) { - of_node_get(sysid_parent); err =3D of_property_read_u32(sysid_parent, "systemid", &sysid); if (!err && ((sysid & GRLIB_VERSION_MASK) >=3D GRCAN_TXBUG_SAFE_GRLIB_VERSION)) From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DEFFC433EF for ; Mon, 11 Jul 2022 09:16:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231552AbiGKJQI (ORCPT ); Mon, 11 Jul 2022 05:16:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231693AbiGKJOf (ORCPT ); Mon, 11 Jul 2022 05:14:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 541B523BDE; Mon, 11 Jul 2022 02:10:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC6AB61148; Mon, 11 Jul 2022 09:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D65B8C34115; Mon, 11 Jul 2022 09:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530630; bh=9KilP7OB14MW6KxOfwyS+L8S9vkInApzgoS28Yry5UA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QQEhAw+JQop4r22LMlNb9hRAGdLaUchEpPcjS9gyN2P/Lkz3td49vEr78x5ZUzjqR 3B1rgu5j1DSLQU9IekV8Ms8upw+oFclPn4hH8rT6b6CKpQ9q+4YtKQQ+oJZA7DiyBu 7kUeqS5Sluayf6ZLSTkVvJ52QdG+978okXksb+oU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rhett Aultman , Marc Kleine-Budde Subject: [PATCH 5.4 05/38] can: gs_usb: gs_usb_open/close(): fix memory leak Date: Mon, 11 Jul 2022 11:06:47 +0200 Message-Id: <20220711090538.886431070@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rhett Aultman commit 2bda24ef95c0311ab93bda00db40486acf30bd0a upstream. The gs_usb driver appears to suffer from a malady common to many USB CAN adapter drivers in that it performs usb_alloc_coherent() to allocate a number of USB request blocks (URBs) for RX, and then later relies on usb_kill_anchored_urbs() to free them, but this doesn't actually free them. As a result, this may be leaking DMA memory that's been used by the driver. This commit is an adaptation of the techniques found in the esd_usb2 driver where a similar design pattern led to a memory leak. It explicitly frees the RX URBs and their DMA memory via a call to usb_free_coherent(). Since the RX URBs were allocated in the gs_can_open(), we remove them in gs_can_close() rather than in the disconnect function as was done in esd_usb2. For more information, see the 928150fad41b ("can: esd_usb2: fix memory leak"). Link: https://lore.kernel.org/all/alpine.DEB.2.22.394.2206031547001.1630869= @thelappy Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices= ") Cc: stable@vger.kernel.org Signed-off-by: Rhett Aultman Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/usb/gs_usb.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -184,6 +184,8 @@ struct gs_can { =20 struct usb_anchor tx_submitted; atomic_t active_tx_urbs; + void *rxbuf[GS_MAX_RX_URBS]; + dma_addr_t rxbuf_dma[GS_MAX_RX_URBS]; }; =20 /* usb interface struct */ @@ -592,6 +594,7 @@ static int gs_can_open(struct net_device for (i =3D 0; i < GS_MAX_RX_URBS; i++) { struct urb *urb; u8 *buf; + dma_addr_t buf_dma; =20 /* alloc rx urb */ urb =3D usb_alloc_urb(0, GFP_KERNEL); @@ -602,7 +605,7 @@ static int gs_can_open(struct net_device buf =3D usb_alloc_coherent(dev->udev, sizeof(struct gs_host_frame), GFP_KERNEL, - &urb->transfer_dma); + &buf_dma); if (!buf) { netdev_err(netdev, "No memory left for USB buffer\n"); @@ -610,6 +613,8 @@ static int gs_can_open(struct net_device return -ENOMEM; } =20 + urb->transfer_dma =3D buf_dma; + /* fill, anchor, and submit rx urb */ usb_fill_bulk_urb(urb, dev->udev, @@ -633,10 +638,17 @@ static int gs_can_open(struct net_device rc); =20 usb_unanchor_urb(urb); + usb_free_coherent(dev->udev, + sizeof(struct gs_host_frame), + buf, + buf_dma); usb_free_urb(urb); break; } =20 + dev->rxbuf[i] =3D buf; + dev->rxbuf_dma[i] =3D buf_dma; + /* Drop reference, * USB core will take care of freeing it */ @@ -701,13 +713,20 @@ static int gs_can_close(struct net_devic int rc; struct gs_can *dev =3D netdev_priv(netdev); struct gs_usb *parent =3D dev->parent; + unsigned int i; =20 netif_stop_queue(netdev); =20 /* Stop polling */ parent->active_channels--; - if (!parent->active_channels) + if (!parent->active_channels) { usb_kill_anchored_urbs(&parent->rx_submitted); + for (i =3D 0; i < GS_MAX_RX_URBS; i++) + usb_free_coherent(dev->udev, + sizeof(struct gs_host_frame), + dev->rxbuf[i], + dev->rxbuf_dma[i]); + } =20 /* Stop sending URBs */ usb_kill_anchored_urbs(&dev->tx_submitted); From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32E14C433EF for ; Mon, 11 Jul 2022 09:16:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231592AbiGKJQT (ORCPT ); Mon, 11 Jul 2022 05:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231736AbiGKJOk (ORCPT ); Mon, 11 Jul 2022 05:14:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 145F92A414; Mon, 11 Jul 2022 02:10:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B896B80E5E; Mon, 11 Jul 2022 09:10:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 967A4C34115; Mon, 11 Jul 2022 09:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530633; bh=dChCWsb+4khBPPsnfWD9LiN8uRlrpm1uvS/5ig3Xag0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdMtt6zrQZUWo6vieh+38fmd/fbGSELQ5CWWO6S5c1his4JO59urTa79/GSd/nPoi F+132Zeq5hZ8Rnbnfa80Q75AvRwo+kWkEB1hsBDXyySDnW4k7XfDFEmpId0NQCbZaZ +ETFWu0kdDlZD7gKyKUx6Qvr0oCyF+s5OWMwfod4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Jakub Kicinski Subject: [PATCH 5.4 06/38] usbnet: fix memory leak in error case Date: Mon, 11 Jul 2022 11:06:48 +0200 Message-Id: <20220711090538.916851659@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Neukum commit b55a21b764c1e182014630fa5486d717484ac58f upstream. usbnet_write_cmd_async() mixed up which buffers need to be freed in which error case. v2: add Fixes tag v3: fix uninitialized buf pointer Fixes: 877bd862f32b8 ("usbnet: introduce usbnet 3 command helpers") Signed-off-by: Oliver Neukum Link: https://lore.kernel.org/r/20220705125351.17309-1-oneukum@suse.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/usb/usbnet.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -2120,7 +2120,7 @@ static void usbnet_async_cmd_cb(struct u int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, u16 value, u16 index, const void *data, u16 size) { - struct usb_ctrlrequest *req =3D NULL; + struct usb_ctrlrequest *req; struct urb *urb; int err =3D -ENOMEM; void *buf =3D NULL; @@ -2138,7 +2138,7 @@ int usbnet_write_cmd_async(struct usbnet if (!buf) { netdev_err(dev->net, "Error allocating buffer" " in %s!\n", __func__); - goto fail_free; + goto fail_free_urb; } } =20 @@ -2162,14 +2162,21 @@ int usbnet_write_cmd_async(struct usbnet if (err < 0) { netdev_err(dev->net, "Error submitting the control" " message: status=3D%d\n", err); - goto fail_free; + goto fail_free_all; } return 0; =20 +fail_free_all: + kfree(req); fail_free_buf: kfree(buf); -fail_free: - kfree(req); + /* + * avoid a double free + * needed because the flag can be set only + * after filling the URB + */ + urb->transfer_flags =3D 0; +fail_free_urb: usb_free_urb(urb); fail: return err; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAC02C43334 for ; Mon, 11 Jul 2022 09:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbiGKJQQ (ORCPT ); Mon, 11 Jul 2022 05:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbiGKJOl (ORCPT ); Mon, 11 Jul 2022 05:14:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FCD62A428; Mon, 11 Jul 2022 02:10:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CB68F611F9; Mon, 11 Jul 2022 09:10:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2EDAC34115; Mon, 11 Jul 2022 09:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530636; bh=lIq5QL1O+Kc+TdTym8+QkepgY8j0DpxAsVZjsV1n+AI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nkUgLCsskKyZLF7qmoxehx6brgjuA2RcEyjLRopAISTleALkPWg7bhOlcEYbN0diK os94p6TxCI+OdzWUZcl1/FuFGf5D2zMmi7wdtrBMshXsi2xQS57dMpyaTgD3kHb92m 1O5JEAvnojSO0bnLM5bAonCBGwgxevRepBuSGDIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Jakub Kicinski Subject: [PATCH 5.4 07/38] net: rose: fix UAF bug caused by rose_t0timer_expiry Date: Mon, 11 Jul 2022 11:06:49 +0200 Message-Id: <20220711090538.945388564@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou commit 148ca04518070910739dfc4eeda765057856403d upstream. There are UAF bugs caused by rose_t0timer_expiry(). The root cause is that del_timer() could not stop the timer handler that is running and there is no synchronization. One of the race conditions is shown below: (thread 1) | (thread 2) | rose_device_event | rose_rt_device_down | rose_remove_neigh rose_t0timer_expiry | rose_stop_t0timer(rose_neigh) ... | del_timer(&neigh->t0timer) | kfree(rose_neigh) //[1]FREE neigh->dce_mode //[2]USE | The rose_neigh is deallocated in position [1] and use in position [2]. The crash trace triggered by POC is like below: BUG: KASAN: use-after-free in expire_timers+0x144/0x320 Write of size 8 at addr ffff888009b19658 by task swapper/0/0 ... Call Trace: dump_stack_lvl+0xbf/0xee print_address_description+0x7b/0x440 print_report+0x101/0x230 ? expire_timers+0x144/0x320 kasan_report+0xed/0x120 ? expire_timers+0x144/0x320 expire_timers+0x144/0x320 __run_timers+0x3ff/0x4d0 run_timer_softirq+0x41/0x80 __do_softirq+0x233/0x544 ... This patch changes rose_stop_ftimer() and rose_stop_t0timer() in rose_remove_neigh() to del_timer_sync() in order that the timer handler could be finished before the resources such as rose_neigh and so on are deallocated. As a result, the UAF bugs could be mitigated. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Duoming Zhou Link: https://lore.kernel.org/r/20220705125610.77971-1-duoming@zju.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/rose/rose_route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -227,8 +227,8 @@ static void rose_remove_neigh(struct ros { struct rose_neigh *s; =20 - rose_stop_ftimer(rose_neigh); - rose_stop_t0timer(rose_neigh); + del_timer_sync(&rose_neigh->ftimer); + del_timer_sync(&rose_neigh->t0timer); =20 skb_queue_purge(&rose_neigh->queue); From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E2E9C433EF for ; Mon, 11 Jul 2022 09:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231602AbiGKJQV (ORCPT ); Mon, 11 Jul 2022 05:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229899AbiGKJOt (ORCPT ); Mon, 11 Jul 2022 05:14:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0DFA2A411; Mon, 11 Jul 2022 02:10:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4144FB80D2C; Mon, 11 Jul 2022 09:10:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 962D2C34115; Mon, 11 Jul 2022 09:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530639; bh=/Vlpw6/HGAgbn6PtVQ9mDsztGe7XJM2vq+5z3tLfz7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mUKip51wENfkEWj3mIRb+JZy82WGSbrRlCmbOWs34cEIV8g0bTPWm0IOlNZ5HCjBS eUIz8uUllM0ZBFLYi57yqc4qW3LLOY27ZVG7wdv6jQzx76nifADlgqnFYPawJCrirn o5pCODusOSynnJGtwB3Ag6NTepMM0hk+syZu5/ak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Zhang, Bernice" , Jacob Pan , Yian Chen , Joerg Roedel , Zhang@vger.kernel.org Subject: [PATCH 5.4 08/38] iommu/vt-d: Fix PCI bus rescan device hot add Date: Mon, 11 Jul 2022 11:06:50 +0200 Message-Id: <20220711090538.973522031@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yian Chen commit 316f92a705a4c2bf4712135180d56f3cca09243a upstream. Notifier calling chain uses priority to determine the execution order of the notifiers or listeners registered to the chain. PCI bus device hot add utilizes the notification mechanism. The current code sets low priority (INT_MIN) to Intel dmar_pci_bus_notifier and postpones DMAR decoding after adding new device into IOMMU. The result is that struct device pointer cannot be found in DRHD search for the new device's DMAR/IOMMU. Subsequently, the device is put under the "catch-all" IOMMU instead of the correct one. This could cause system hang when device TLB invalidation is sent to the wrong IOMMU. Invalidation timeout error and hard lockup have been observed and data inconsistency/crush may occur as well. This patch fixes the issue by setting a positive priority(1) for dmar_pci_bus_notifier while the priority of IOMMU bus notifier uses the default value(0), therefore DMAR decoding will be in advance of DRHD search for a new device to find the correct IOMMU. Following is a 2-step example that triggers the bug by simulating PCI device hot add behavior in Intel Sapphire Rapids server. echo 1 > /sys/bus/pci/devices/0000:6a:01.0/remove echo 1 > /sys/bus/pci/rescan Fixes: 59ce0515cdaf ("iommu/vt-d: Update DRHD/RMRR/ATSR device scope") Cc: stable@vger.kernel.org # v3.15+ Reported-by: Zhang, Bernice Signed-off-by: Jacob Pan Signed-off-by: Yian Chen Link: https://lore.kernel.org/r/20220521002115.1624069-1-yian.chen@intel.com Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/iommu/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c @@ -363,7 +363,7 @@ static int dmar_pci_bus_notifier(struct =20 static struct notifier_block dmar_pci_bus_nb =3D { .notifier_call =3D dmar_pci_bus_notifier, - .priority =3D INT_MIN, + .priority =3D 1, }; =20 static struct dmar_drhd_unit * From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F7E7C433EF for ; Mon, 11 Jul 2022 09:16:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbiGKJQ0 (ORCPT ); Mon, 11 Jul 2022 05:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbiGKJOu (ORCPT ); Mon, 11 Jul 2022 05:14:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 830DF3CBEE; Mon, 11 Jul 2022 02:10:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C8B7611F1; Mon, 11 Jul 2022 09:10:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D735C341CE; Mon, 11 Jul 2022 09:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530641; bh=AiqScboVoKrl9NbfUrwOqZcc0KyBFSunSKXP2EyflOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUVCBgqlo4XR0v4SXgM4Rw35J95q8PVXGVTZzrIYsPHj5mJTBK09saY8HHres9/wS EgqTYIPIuqS2cqAHhttJczO+fOS93rM6Phadu27uNG2RpxdUr9Cq2lJBNOSL6G1AoG 9MFLH+voZ9pFQQFjVRdnNWqrXm8nFzeWPI7PtrQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guiling Deng , Helge Deller Subject: [PATCH 5.4 09/38] fbdev: fbmem: Fix logo center image dx issue Date: Mon, 11 Jul 2022 11:06:51 +0200 Message-Id: <20220711090539.003201795@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guiling Deng commit 955f04766d4e6eb94bf3baa539e096808c74ebfb upstream. Image.dx gets wrong value because of missing '()'. If xres =3D=3D logo->width and n =3D=3D 1, image.dx =3D -16. Signed-off-by: Guiling Deng Fixes: 3d8b1933eb1c ("fbdev: fbmem: add config option to center the bootup = logo") Cc: stable@vger.kernel.org # v5.0+ Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/video/fbdev/core/fbmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -512,7 +512,7 @@ static int fb_show_logo_line(struct fb_i =20 while (n && (n * (logo->width + 8) - 8 > xres)) --n; - image.dx =3D (xres - n * (logo->width + 8) - 8) / 2; + image.dx =3D (xres - (n * (logo->width + 8) - 8)) / 2; image.dy =3D y ?: (yres - logo->height) / 2; } else { image.dx =3D 0; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A04CCCA480 for ; Mon, 11 Jul 2022 09:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbiGKJPI (ORCPT ); Mon, 11 Jul 2022 05:15:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbiGKJNy (ORCPT ); Mon, 11 Jul 2022 05:13:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E214A286E6; Mon, 11 Jul 2022 02:09:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6807AB80D2C; Mon, 11 Jul 2022 09:09:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5B94C34115; Mon, 11 Jul 2022 09:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530597; bh=6sP7RL3xTS8nI1qeT7Pu8e+0tD2TtYrZtzMZePXEVaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZKFqocZgopyMoMoQAjityRGj0X8FPG7vFefg2FYJiDcrGZji2Mb3GmiRAufKdzZP F4bKHT6CScZ/yn+XnbxE93sZ584an4O5LvMgdWrN/fqsdjFnnReSxHKF4h6+0FFKMS jpzJeZHDURewUIA6U1fV1o3fYLQOnSYA44EyGiTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , Geert Uytterhoeven Subject: [PATCH 5.4 10/38] fbmem: Check virtual screen sizes in fb_set_var() Date: Mon, 11 Jul 2022 11:06:52 +0200 Message-Id: <20220711090539.031561621@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit 6c11df58fd1ac0aefcb3b227f72769272b939e56 upstream. Verify that the fbdev or drm driver correctly adjusted the virtual screen sizes. On failure report the failing driver and reject the screen size change. Signed-off-by: Helge Deller Reviewed-by: Geert Uytterhoeven Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/video/fbdev/core/fbmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1014,6 +1014,16 @@ fb_set_var(struct fb_info *info, struct if (ret) return ret; =20 + /* verify that virtual resolution >=3D physical resolution */ + if (var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { + pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen siz= e (%ux%u vs. %ux%u)\n", + info->fix.id, + var->xres_virtual, var->yres_virtual, + var->xres, var->yres); + return -EINVAL; + } + if ((var->activate & FB_ACTIVATE_MASK) !=3D FB_ACTIVATE_NOW) return 0; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B35AEC43334 for ; Mon, 11 Jul 2022 09:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229984AbiGKJPC (ORCPT ); Mon, 11 Jul 2022 05:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbiGKJNy (ORCPT ); Mon, 11 Jul 2022 05:13:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039AB23BFB; Mon, 11 Jul 2022 02:10:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 94C75611E4; Mon, 11 Jul 2022 09:10:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D05EC341CE; Mon, 11 Jul 2022 09:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530600; bh=YRJkLFHxetNc+M6P65Y2zU3igiMyD3cTSTXJPlfQY80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GQjQf6EnMVROO37SjeLgqEceU4U/6tgZDiavjrJ171yiMtX0G1YOJ4ahLltu8su2c yNrsW1iFAgpBOnFW7T8uWtsAYPAB+lBxqk/2s2F42UY8RBNr56j/HMBdW4zIe6nzCn 5LL3KCtF2In6wOewOF5kVFPn1QPw/O1sI3OLckow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , Daniel Vetter , Geert Uytterhoeven Subject: [PATCH 5.4 11/38] fbcon: Disallow setting font bigger than screen size Date: Mon, 11 Jul 2022 11:06:53 +0200 Message-Id: <20220711090539.061048698@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit 65a01e601dbba8b7a51a2677811f70f783766682 upstream. Prevent that users set a font size which is bigger than the physical screen. It's unlikely this may happen (because screens are usually much larger than= the fonts and each font char is limited to 32x32 pixels), but it may happen on smaller screens/LCD displays. Signed-off-by: Helge Deller Reviewed-by: Daniel Vetter Reviewed-by: Geert Uytterhoeven Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/video/fbdev/core/fbcon.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2490,6 +2490,11 @@ static int fbcon_set_font(struct vc_data if (charcount !=3D 256 && charcount !=3D 512) return -EINVAL; =20 + /* font bigger than screen resolution ? */ + if (w > FBCON_SWAP(info->var.rotate, info->var.xres, info->var.yres) || + h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) + return -EINVAL; + /* Make sure drawing engine can handle the font */ if (!(info->pixmap.blit_x & (1 << (font->width - 1))) || !(info->pixmap.blit_y & (1 << (font->height - 1)))) From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 874D4C43334 for ; Mon, 11 Jul 2022 09:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231392AbiGKJPQ (ORCPT ); Mon, 11 Jul 2022 05:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbiGKJOD (ORCPT ); Mon, 11 Jul 2022 05:14:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84ADA3204E; Mon, 11 Jul 2022 02:10:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3968B80E79; Mon, 11 Jul 2022 09:10:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54F89C34115; Mon, 11 Jul 2022 09:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530602; bh=lDnrGg8XCrWs/U/ZDqKOXJWJ3M8ICXOK/64L4R+o3h0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dOPbot7d6CBUC5M2rKKN2/QaMuSgdChoqvYjgzUIHXf7H7nisId7U50mdg0J2qTGi f53d3taAv0OWhNSAS3G/aci0MwH8rplQoKhCCftdvJH1roBk6EedaTbmn1nKGcl47S FoZrAC1PkorKpIlAiSgPhaBnGFABm63he84+GLgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , Geert Uytterhoeven Subject: [PATCH 5.4 12/38] fbcon: Prevent that screen size is smaller than font size Date: Mon, 11 Jul 2022 11:06:54 +0200 Message-Id: <20220711090539.090838502@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit e64242caef18b4a5840b0e7a9bff37abd4f4f933 upstream. We need to prevent that users configure a screen size which is smaller than= the currently selected font size. Otherwise rendering chars on the screen will access memory outside the graphics memory region. This patch adds a new function fbcon_modechange_possible() which implements this check and which later may be extended with other checks if necessary. The new function is called from the FBIOPUT_VSCREENINFO ioctl handler in fbmem.c, which will return -EINVAL if userspace asked for a too small screen size. Signed-off-by: Helge Deller Reviewed-by: Geert Uytterhoeven Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/video/fbdev/core/fbcon.c | 28 ++++++++++++++++++++++++++++ drivers/video/fbdev/core/fbmem.c | 4 +++- include/linux/fbcon.h | 4 ++++ 3 files changed, 35 insertions(+), 1 deletion(-) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2761,6 +2761,34 @@ void fbcon_update_vcs(struct fb_info *in } EXPORT_SYMBOL(fbcon_update_vcs); =20 +/* let fbcon check if it supports a new screen resolution */ +int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screenin= fo *var) +{ + struct fbcon_ops *ops =3D info->fbcon_par; + struct vc_data *vc; + unsigned int i; + + WARN_CONSOLE_UNLOCKED(); + + if (!ops) + return 0; + + /* prevent setting a screen size which is smaller than font size */ + for (i =3D first_fb_vc; i <=3D last_fb_vc; i++) { + vc =3D vc_cons[i].d; + if (!vc || vc->vc_mode !=3D KD_TEXT || + registered_fb[con2fb_map[i]] !=3D info) + continue; + + if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) || + vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres)) + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL_GPL(fbcon_modechange_possible); + int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) { --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1114,7 +1114,9 @@ static long do_fb_ioctl(struct fb_info * return -EFAULT; console_lock(); lock_fb_info(info); - ret =3D fb_set_var(info, &var); + ret =3D fbcon_modechange_possible(info, &var); + if (!ret) + ret =3D fb_set_var(info, &var); if (!ret) fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL); unlock_fb_info(info); --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info * void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps); void fbcon_fb_blanked(struct fb_info *info, int blank); +int fbcon_modechange_possible(struct fb_info *info, + struct fb_var_screeninfo *var); void fbcon_update_vcs(struct fb_info *info, bool all); void fbcon_remap_all(struct fb_info *info); int fbcon_set_con2fb_map_ioctl(void __user *argp); @@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(st static inline void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} +static inline int fbcon_modechange_possible(struct fb_info *info, + struct fb_var_screeninfo *var) { return 0; } static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} static inline void fbcon_remap_all(struct fb_info *info) {} static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0= ; } From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA0D6CCA482 for ; Mon, 11 Jul 2022 09:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231420AbiGKJPJ (ORCPT ); Mon, 11 Jul 2022 05:15:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbiGKJOD (ORCPT ); Mon, 11 Jul 2022 05:14:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D3D32059; Mon, 11 Jul 2022 02:10:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E214D611CC; Mon, 11 Jul 2022 09:10:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2A35C341D0; Mon, 11 Jul 2022 09:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530605; bh=7glkkp0LLer/1vOu19Ra/fd2zYttlhPNl2QaoAA/NUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QvpRLPvEYl+EPu49K+s78eLAWYCGLPMvfCntJpAuCjtc/KaNvifq1MMkV6Yfe1VfO hzQwUzgPfKHZ3B25Wxy6q2MaLbC5CcaO0ovDOp2B9UbxfHtUh2ycBMY3fzh2LyTdLa BU+AM1WOX3L0WWFHypIhwBdGjn2culF3W5JNTbe0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , Hsin-Yi Wang , Helge Deller Subject: [PATCH 5.4 13/38] video: of_display_timing.h: include errno.h Date: Mon, 11 Jul 2022 11:06:55 +0200 Message-Id: <20220711090539.121543770@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hsin-Yi Wang commit 3663a2fb325b8782524f3edb0ae32d6faa615109 upstream. If CONFIG_OF is not enabled, default of_get_display_timing() returns an errno, so include the header. Fixes: 422b67e0b31a ("videomode: provide dummy inline functions for !CONFIG= _OF") Suggested-by: Stephen Boyd Signed-off-by: Hsin-Yi Wang Reviewed-by: Stephen Boyd Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/video/of_display_timing.h | 2 ++ 1 file changed, 2 insertions(+) --- a/include/video/of_display_timing.h +++ b/include/video/of_display_timing.h @@ -8,6 +8,8 @@ #ifndef __LINUX_OF_DISPLAY_TIMING_H #define __LINUX_OF_DISPLAY_TIMING_H =20 +#include + struct device_node; struct display_timing; struct display_timings; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92428C433EF for ; Mon, 11 Jul 2022 09:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231463AbiGKJPW (ORCPT ); Mon, 11 Jul 2022 05:15:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231504AbiGKJOP (ORCPT ); Mon, 11 Jul 2022 05:14:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AE80326E0; Mon, 11 Jul 2022 02:10:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AAE69CE1178; Mon, 11 Jul 2022 09:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B82DCC34115; Mon, 11 Jul 2022 09:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530608; bh=K6jNGp2dUuNiWhAggovJ4j01QWBZArB13C35cE1qd8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lxj8b5UlxBgIaTxTDGYvYZd5gwW1REwOfKxxlrN4cED3u8rTfoLBx8NSYno3Vbf/2 F92ewx1stECF1xputwu8kusYrKt885kSE1D7T7yLsebARjmL6+XEm98/EwRQorHoSO y/AGxlPGQseE2glU7Mm8FMuqfX0NEcrpN5lJyhJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sachin Sant , "Jason A. Donenfeld" , Michael Ellerman Subject: [PATCH 5.4 14/38] powerpc/powernv: delay rng platform device creation until later in boot Date: Mon, 11 Jul 2022 11:06:56 +0200 Message-Id: <20220711090539.150343511@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld commit 887502826549caa7e4215fd9e628f48f14c0825a upstream. The platform device for the rng must be created much later in boot. Otherwise it tries to connect to a parent that doesn't yet exist, resulting in this splat: [ 0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, = yet kobject_get() is being called. [ 0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x1= 00 (unreliable) [ 0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00 [ 0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0= x80 [ 0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_c= reate_pdata+0xd0/0x1b0 [ 0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_= early+0x240/0x2e4 [ 0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x2= 14 This patch fixes the issue by doing the platform device creation inside of machine_subsys_initcall. Fixes: f3eac426657d ("powerpc/powernv: wire up rng during setup_arch") Cc: stable@vger.kernel.org Reported-by: Sachin Sant Signed-off-by: Jason A. Donenfeld Tested-by: Sachin Sant [mpe: Change "of node" to "platform device" in change log] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220630121654.1939181-1-Jason@zx2c4.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/powerpc/platforms/powernv/rng.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/arch/powerpc/platforms/powernv/rng.c +++ b/arch/powerpc/platforms/powernv/rng.c @@ -176,12 +176,8 @@ static int __init pnv_get_random_long_ea NULL) !=3D pnv_get_random_long_early) return 0; =20 - for_each_compatible_node(dn, NULL, "ibm,power-rng") { - if (rng_create(dn)) - continue; - /* Create devices for hwrng driver */ - of_platform_device_create(dn, NULL, NULL); - } + for_each_compatible_node(dn, NULL, "ibm,power-rng") + rng_create(dn); =20 if (!ppc_md.get_random_seed) return 0; @@ -205,10 +201,18 @@ void __init pnv_rng_init(void) =20 static int __init pnv_rng_late_init(void) { + struct device_node *dn; unsigned long v; + /* In case it wasn't called during init for some other reason. */ if (ppc_md.get_random_seed =3D=3D pnv_get_random_long_early) pnv_get_random_long_early(&v); + + if (ppc_md.get_random_seed =3D=3D powernv_get_random_long) { + for_each_compatible_node(dn, NULL, "ibm,power-rng") + of_platform_device_create(dn, NULL, NULL); + } + return 0; } machine_subsys_initcall(powernv, pnv_rng_late_init); From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52D10C433EF for ; Mon, 11 Jul 2022 09:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231487AbiGKJP0 (ORCPT ); Mon, 11 Jul 2022 05:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231523AbiGKJOR (ORCPT ); Mon, 11 Jul 2022 05:14:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A22532ECF; Mon, 11 Jul 2022 02:10:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 948BE61148; Mon, 11 Jul 2022 09:10:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75B6DC34115; Mon, 11 Jul 2022 09:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530611; bh=4YkT1ZDU+2QEme55fsb4WXqr3G/hbOOfTPcF989QO/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aVujkym3PX1pUI8/O03A9XpB0Ybr7muJKMbGqtqi/u/2YinHkE1Fd5JPIa18VxsgY Jouc0o0p7cbLVG8m6pxWY7aOTR9N+Hq4ODnX2+nZgmGYBQKeNjqN8cLxB3wtadzFeL cSQGAv+8adXyahEQ6aDydSlG8rSl3RdlxWzakfZg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, "stable@vger.kernel.org, linux-can@vger.kernel.org, Marc Kleine-Budde" Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson Subject: [PATCH 5.4 15/38] can: kvaser_usb: replace run-time checks with struct kvaser_usb_driver_info Date: Mon, 11 Jul 2022 11:06:57 +0200 Message-Id: <20220711090539.179331682@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jimmy Assarsson commit 49f274c72357d2d74cba70b172cf369768909707 upstream. Unify and move compile-time known information into new struct kvaser_usb_driver_info, in favor of run-time checks. All Kvaser USBcanII supports listen-only mode and error counter reporting. Link: https://lore.kernel.org/all/20220603083820.800246-2-extja@kvaser.com Suggested-by: Marc Kleine-Budde Cc: stable@vger.kernel.org Signed-off-by: Jimmy Assarsson [mkl: move struct kvaser_usb_driver_info into kvaser_usb_core.c] Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 22 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 244 ++++++++++++------= ----- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 24 +- 3 files changed, 155 insertions(+), 135 deletions(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h @@ -35,9 +35,9 @@ #define KVASER_USB_RX_BUFFER_SIZE 3072 #define KVASER_USB_MAX_NET_DEVICES 5 =20 -/* USB devices features */ -#define KVASER_USB_HAS_SILENT_MODE BIT(0) -#define KVASER_USB_HAS_TXRX_ERRORS BIT(1) +/* Kvaser USB device quirks */ +#define KVASER_USB_QUIRK_HAS_SILENT_MODE BIT(0) +#define KVASER_USB_QUIRK_HAS_TXRX_ERRORS BIT(1) =20 /* Device capabilities */ #define KVASER_USB_CAP_BERR_CAP 0x01 @@ -65,12 +65,7 @@ struct kvaser_usb_dev_card_data_hydra { struct kvaser_usb_dev_card_data { u32 ctrlmode_supported; u32 capabilities; - union { - struct { - enum kvaser_usb_leaf_family family; - } leaf; - struct kvaser_usb_dev_card_data_hydra hydra; - }; + struct kvaser_usb_dev_card_data_hydra hydra; }; =20 /* Context for an outstanding, not yet ACKed, transmission */ @@ -84,7 +79,7 @@ struct kvaser_usb { struct usb_device *udev; struct usb_interface *intf; struct kvaser_usb_net_priv *nets[KVASER_USB_MAX_NET_DEVICES]; - const struct kvaser_usb_dev_ops *ops; + const struct kvaser_usb_driver_info *driver_info; const struct kvaser_usb_dev_cfg *cfg; =20 struct usb_endpoint_descriptor *bulk_in, *bulk_out; @@ -166,6 +161,12 @@ struct kvaser_usb_dev_ops { int *cmd_len, u16 transid); }; =20 +struct kvaser_usb_driver_info { + u32 quirks; + enum kvaser_usb_leaf_family family; + const struct kvaser_usb_dev_ops *ops; +}; + struct kvaser_usb_dev_cfg { const struct can_clock clock; const unsigned int timestamp_freq; @@ -185,4 +186,5 @@ int kvaser_usb_send_cmd_async(struct kva int len); =20 int kvaser_usb_can_rx_over_error(struct net_device *netdev); + #endif /* KVASER_USB_H */ --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -79,104 +79,125 @@ #define USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID 269 #define USB_HYBRID_PRO_CANLIN_PRODUCT_ID 270 =20 -static inline bool kvaser_is_leaf(const struct usb_device_id *id) -{ - return (id->idProduct >=3D USB_LEAF_DEVEL_PRODUCT_ID && - id->idProduct <=3D USB_CAN_R_PRODUCT_ID) || - (id->idProduct >=3D USB_LEAF_LITE_V2_PRODUCT_ID && - id->idProduct <=3D USB_MINI_PCIE_2HS_PRODUCT_ID); -} +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_hydra = =3D { + .quirks =3D 0, + .ops =3D &kvaser_usb_hydra_dev_ops, +}; =20 -static inline bool kvaser_is_usbcan(const struct usb_device_id *id) -{ - return id->idProduct >=3D USB_USBCAN_REVB_PRODUCT_ID && - id->idProduct <=3D USB_MEMORATOR_PRODUCT_ID; -} +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_usbcan = =3D { + .quirks =3D KVASER_USB_QUIRK_HAS_TXRX_ERRORS | + KVASER_USB_QUIRK_HAS_SILENT_MODE, + .family =3D KVASER_USBCAN, + .ops =3D &kvaser_usb_leaf_dev_ops, +}; =20 -static inline bool kvaser_is_hydra(const struct usb_device_id *id) -{ - return id->idProduct >=3D USB_BLACKBIRD_V2_PRODUCT_ID && - id->idProduct <=3D USB_HYBRID_PRO_CANLIN_PRODUCT_ID; -} +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf =3D= { + .quirks =3D 0, + .family =3D KVASER_LEAF, + .ops =3D &kvaser_usb_leaf_dev_ops, +}; + +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err= =3D { + .quirks =3D KVASER_USB_QUIRK_HAS_TXRX_ERRORS, + .family =3D KVASER_LEAF, + .ops =3D &kvaser_usb_leaf_dev_ops, +}; + +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err= _listen =3D { + .quirks =3D KVASER_USB_QUIRK_HAS_TXRX_ERRORS | + KVASER_USB_QUIRK_HAS_SILENT_MODE, + .family =3D KVASER_LEAF, + .ops =3D &kvaser_usb_leaf_dev_ops, +}; =20 static const struct usb_device_id kvaser_usb_table[] =3D { /* Leaf USB product IDs */ - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID) }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_LS_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_SWC_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_LIN_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_LS_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_SWC_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_DEVEL_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_HSHS_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_UPRO_HSHS_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_GI_PRODUCT_ID) }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_GI_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_OBDII_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS | - KVASER_USB_HAS_SILENT_MODE }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen= }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_HSLS_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_CH_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, { USB_DEVICE(KVASER_VENDOR_ID, USB_BLACKBIRD_SPRO_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, { USB_DEVICE(KVASER_VENDOR_ID, USB_OEM_MERCURY_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, { USB_DEVICE(KVASER_VENDOR_ID, USB_OEM_LEAF_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, { USB_DEVICE(KVASER_VENDOR_ID, USB_CAN_R_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID) }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, =20 /* USBCANII USB product IDs */ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_usbcan }, { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_REVB_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_usbcan }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMORATOR_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_usbcan }, { USB_DEVICE(KVASER_VENDOR_ID, USB_VCI2_PRODUCT_ID), - .driver_info =3D KVASER_USB_HAS_TXRX_ERRORS }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_usbcan }, =20 /* Minihydra USB product IDs */ - { USB_DEVICE(KVASER_VENDOR_ID, USB_BLACKBIRD_V2_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_5HS_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_5HS_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_4HS_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_HS_V2_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_2HS_V2_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_2HS_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_2HS_V2_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_CANLIN_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_PRO_CANLIN_PRODUCT_ID) }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_BLACKBIRD_V2_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_5HS_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_5HS_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_4HS_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_HS_V2_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_2HS_V2_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_2HS_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_2HS_V2_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_2CANLIN_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_PRO_CANLIN_PRODUCT_ID), + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, { } }; MODULE_DEVICE_TABLE(usb, kvaser_usb_table); @@ -267,6 +288,7 @@ int kvaser_usb_can_rx_over_error(struct static void kvaser_usb_read_bulk_callback(struct urb *urb) { struct kvaser_usb *dev =3D urb->context; + const struct kvaser_usb_dev_ops *ops =3D dev->driver_info->ops; int err; unsigned int i; =20 @@ -283,8 +305,8 @@ static void kvaser_usb_read_bulk_callbac goto resubmit_urb; } =20 - dev->ops->dev_read_bulk_callback(dev, urb->transfer_buffer, - urb->actual_length); + ops->dev_read_bulk_callback(dev, urb->transfer_buffer, + urb->actual_length); =20 resubmit_urb: usb_fill_bulk_urb(urb, dev->udev, @@ -378,6 +400,7 @@ static int kvaser_usb_open(struct net_de { struct kvaser_usb_net_priv *priv =3D netdev_priv(netdev); struct kvaser_usb *dev =3D priv->dev; + const struct kvaser_usb_dev_ops *ops =3D dev->driver_info->ops; int err; =20 err =3D open_candev(netdev); @@ -388,11 +411,11 @@ static int kvaser_usb_open(struct net_de if (err) goto error; =20 - err =3D dev->ops->dev_set_opt_mode(priv); + err =3D ops->dev_set_opt_mode(priv); if (err) goto error; =20 - err =3D dev->ops->dev_start_chip(priv); + err =3D ops->dev_start_chip(priv); if (err) { netdev_warn(netdev, "Cannot start device, error %d\n", err); goto error; @@ -449,22 +472,23 @@ static int kvaser_usb_close(struct net_d { struct kvaser_usb_net_priv *priv =3D netdev_priv(netdev); struct kvaser_usb *dev =3D priv->dev; + const struct kvaser_usb_dev_ops *ops =3D dev->driver_info->ops; int err; =20 netif_stop_queue(netdev); =20 - err =3D dev->ops->dev_flush_queue(priv); + err =3D ops->dev_flush_queue(priv); if (err) netdev_warn(netdev, "Cannot flush queue, error %d\n", err); =20 - if (dev->ops->dev_reset_chip) { - err =3D dev->ops->dev_reset_chip(dev, priv->channel); + if (ops->dev_reset_chip) { + err =3D ops->dev_reset_chip(dev, priv->channel); if (err) netdev_warn(netdev, "Cannot reset card, error %d\n", err); } =20 - err =3D dev->ops->dev_stop_chip(priv); + err =3D ops->dev_stop_chip(priv); if (err) netdev_warn(netdev, "Cannot stop device, error %d\n", err); =20 @@ -503,6 +527,7 @@ static netdev_tx_t kvaser_usb_start_xmit { struct kvaser_usb_net_priv *priv =3D netdev_priv(netdev); struct kvaser_usb *dev =3D priv->dev; + const struct kvaser_usb_dev_ops *ops =3D dev->driver_info->ops; struct net_device_stats *stats =3D &netdev->stats; struct kvaser_usb_tx_urb_context *context =3D NULL; struct urb *urb; @@ -545,8 +570,8 @@ static netdev_tx_t kvaser_usb_start_xmit goto freeurb; } =20 - buf =3D dev->ops->dev_frame_to_cmd(priv, skb, &context->dlc, &cmd_len, - context->echo_index); + buf =3D ops->dev_frame_to_cmd(priv, skb, &context->dlc, &cmd_len, + context->echo_index); if (!buf) { stats->tx_dropped++; dev_kfree_skb(skb); @@ -630,15 +655,16 @@ static void kvaser_usb_remove_interfaces } } =20 -static int kvaser_usb_init_one(struct kvaser_usb *dev, - const struct usb_device_id *id, int channel) +static int kvaser_usb_init_one(struct kvaser_usb *dev, int channel) { struct net_device *netdev; struct kvaser_usb_net_priv *priv; + const struct kvaser_usb_driver_info *driver_info =3D dev->driver_info; + const struct kvaser_usb_dev_ops *ops =3D driver_info->ops; int err; =20 - if (dev->ops->dev_reset_chip) { - err =3D dev->ops->dev_reset_chip(dev, channel); + if (ops->dev_reset_chip) { + err =3D ops->dev_reset_chip(dev, channel); if (err) return err; } @@ -667,20 +693,19 @@ static int kvaser_usb_init_one(struct kv priv->can.state =3D CAN_STATE_STOPPED; priv->can.clock.freq =3D dev->cfg->clock.freq; priv->can.bittiming_const =3D dev->cfg->bittiming_const; - priv->can.do_set_bittiming =3D dev->ops->dev_set_bittiming; - priv->can.do_set_mode =3D dev->ops->dev_set_mode; - if ((id->driver_info & KVASER_USB_HAS_TXRX_ERRORS) || + priv->can.do_set_bittiming =3D ops->dev_set_bittiming; + priv->can.do_set_mode =3D ops->dev_set_mode; + if ((driver_info->quirks & KVASER_USB_QUIRK_HAS_TXRX_ERRORS) || (priv->dev->card_data.capabilities & KVASER_USB_CAP_BERR_CAP)) - priv->can.do_get_berr_counter =3D dev->ops->dev_get_berr_counter; - if (id->driver_info & KVASER_USB_HAS_SILENT_MODE) + priv->can.do_get_berr_counter =3D ops->dev_get_berr_counter; + if (driver_info->quirks & KVASER_USB_QUIRK_HAS_SILENT_MODE) priv->can.ctrlmode_supported |=3D CAN_CTRLMODE_LISTENONLY; =20 priv->can.ctrlmode_supported |=3D dev->card_data.ctrlmode_supported; =20 if (priv->can.ctrlmode_supported & CAN_CTRLMODE_FD) { priv->can.data_bittiming_const =3D dev->cfg->data_bittiming_const; - priv->can.do_set_data_bittiming =3D - dev->ops->dev_set_data_bittiming; + priv->can.do_set_data_bittiming =3D ops->dev_set_data_bittiming; } =20 netdev->flags |=3D IFF_ECHO; @@ -711,29 +736,22 @@ static int kvaser_usb_probe(struct usb_i struct kvaser_usb *dev; int err; int i; + const struct kvaser_usb_driver_info *driver_info; + const struct kvaser_usb_dev_ops *ops; + + driver_info =3D (const struct kvaser_usb_driver_info *)id->driver_info; + if (!driver_info) + return -ENODEV; =20 dev =3D devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; =20 - if (kvaser_is_leaf(id)) { - dev->card_data.leaf.family =3D KVASER_LEAF; - dev->ops =3D &kvaser_usb_leaf_dev_ops; - } else if (kvaser_is_usbcan(id)) { - dev->card_data.leaf.family =3D KVASER_USBCAN; - dev->ops =3D &kvaser_usb_leaf_dev_ops; - } else if (kvaser_is_hydra(id)) { - dev->ops =3D &kvaser_usb_hydra_dev_ops; - } else { - dev_err(&intf->dev, - "Product ID (%d) is not a supported Kvaser USB device\n", - id->idProduct); - return -ENODEV; - } - dev->intf =3D intf; + dev->driver_info =3D driver_info; + ops =3D driver_info->ops; =20 - err =3D dev->ops->dev_setup_endpoints(dev); + err =3D ops->dev_setup_endpoints(dev); if (err) { dev_err(&intf->dev, "Cannot get usb endpoint(s)"); return err; @@ -747,22 +765,22 @@ static int kvaser_usb_probe(struct usb_i =20 dev->card_data.ctrlmode_supported =3D 0; dev->card_data.capabilities =3D 0; - err =3D dev->ops->dev_init_card(dev); + err =3D ops->dev_init_card(dev); if (err) { dev_err(&intf->dev, "Failed to initialize card, error %d\n", err); return err; } =20 - err =3D dev->ops->dev_get_software_info(dev); + err =3D ops->dev_get_software_info(dev); if (err) { dev_err(&intf->dev, "Cannot get software info, error %d\n", err); return err; } =20 - if (dev->ops->dev_get_software_details) { - err =3D dev->ops->dev_get_software_details(dev); + if (ops->dev_get_software_details) { + err =3D ops->dev_get_software_details(dev); if (err) { dev_err(&intf->dev, "Cannot get software details, error %d\n", err); @@ -780,14 +798,14 @@ static int kvaser_usb_probe(struct usb_i =20 dev_dbg(&intf->dev, "Max outstanding tx =3D %d URBs\n", dev->max_tx_urbs); =20 - err =3D dev->ops->dev_get_card_info(dev); + err =3D ops->dev_get_card_info(dev); if (err) { dev_err(&intf->dev, "Cannot get card info, error %d\n", err); return err; } =20 - if (dev->ops->dev_get_capabilities) { - err =3D dev->ops->dev_get_capabilities(dev); + if (ops->dev_get_capabilities) { + err =3D ops->dev_get_capabilities(dev); if (err) { dev_err(&intf->dev, "Cannot get capabilities, error %d\n", err); @@ -797,7 +815,7 @@ static int kvaser_usb_probe(struct usb_i } =20 for (i =3D 0; i < dev->nchannels; i++) { - err =3D kvaser_usb_init_one(dev, id, i); + err =3D kvaser_usb_init_one(dev, i); if (err) { kvaser_usb_remove_interfaces(dev); return err; --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -405,7 +405,7 @@ kvaser_usb_leaf_frame_to_cmd(const struc sizeof(struct kvaser_cmd_tx_can); cmd->u.tx_can.channel =3D priv->channel; =20 - switch (dev->card_data.leaf.family) { + switch (dev->driver_info->family) { case KVASER_LEAF: cmd_tx_can_flags =3D &cmd->u.tx_can.leaf.flags; break; @@ -551,7 +551,7 @@ static int kvaser_usb_leaf_get_software_ if (err) return err; =20 - switch (dev->card_data.leaf.family) { + switch (dev->driver_info->family) { case KVASER_LEAF: kvaser_usb_leaf_get_software_info_leaf(dev, &cmd.u.leaf.softinfo); break; @@ -598,7 +598,7 @@ static int kvaser_usb_leaf_get_card_info =20 dev->nchannels =3D cmd.u.cardinfo.nchannels; if (dev->nchannels > KVASER_USB_MAX_NET_DEVICES || - (dev->card_data.leaf.family =3D=3D KVASER_USBCAN && + (dev->driver_info->family =3D=3D KVASER_USBCAN && dev->nchannels > MAX_USBCAN_NET_DEVICES)) return -EINVAL; =20 @@ -734,7 +734,7 @@ kvaser_usb_leaf_rx_error_update_can_stat new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; =20 - switch (dev->card_data.leaf.family) { + switch (dev->driver_info->family) { case KVASER_LEAF: if (es->leaf.error_factor) { priv->can.can_stats.bus_error++; @@ -813,7 +813,7 @@ static void kvaser_usb_leaf_rx_error(con } } =20 - switch (dev->card_data.leaf.family) { + switch (dev->driver_info->family) { case KVASER_LEAF: if (es->leaf.error_factor) { cf->can_id |=3D CAN_ERR_BUSERROR | CAN_ERR_PROT; @@ -1005,7 +1005,7 @@ static void kvaser_usb_leaf_rx_can_msg(c stats =3D &priv->netdev->stats; =20 if ((cmd->u.rx_can_header.flag & MSG_FLAG_ERROR_FRAME) && - (dev->card_data.leaf.family =3D=3D KVASER_LEAF && + (dev->driver_info->family =3D=3D KVASER_LEAF && cmd->id =3D=3D CMD_LEAF_LOG_MESSAGE)) { kvaser_usb_leaf_leaf_rx_error(dev, cmd); return; @@ -1021,7 +1021,7 @@ static void kvaser_usb_leaf_rx_can_msg(c return; } =20 - switch (dev->card_data.leaf.family) { + switch (dev->driver_info->family) { case KVASER_LEAF: rx_data =3D cmd->u.leaf.rx_can.data; break; @@ -1036,7 +1036,7 @@ static void kvaser_usb_leaf_rx_can_msg(c return; } =20 - if (dev->card_data.leaf.family =3D=3D KVASER_LEAF && cmd->id =3D=3D + if (dev->driver_info->family =3D=3D KVASER_LEAF && cmd->id =3D=3D CMD_LEAF_LOG_MESSAGE) { cf->can_id =3D le32_to_cpu(cmd->u.leaf.log_message.id); if (cf->can_id & KVASER_EXTENDED_FRAME) @@ -1133,14 +1133,14 @@ static void kvaser_usb_leaf_handle_comma break; =20 case CMD_LEAF_LOG_MESSAGE: - if (dev->card_data.leaf.family !=3D KVASER_LEAF) + if (dev->driver_info->family !=3D KVASER_LEAF) goto warn; kvaser_usb_leaf_rx_can_msg(dev, cmd); break; =20 case CMD_CHIP_STATE_EVENT: case CMD_CAN_ERROR_EVENT: - if (dev->card_data.leaf.family =3D=3D KVASER_LEAF) + if (dev->driver_info->family =3D=3D KVASER_LEAF) kvaser_usb_leaf_leaf_rx_error(dev, cmd); else kvaser_usb_leaf_usbcan_rx_error(dev, cmd); @@ -1152,12 +1152,12 @@ static void kvaser_usb_leaf_handle_comma =20 /* Ignored commands */ case CMD_USBCAN_CLOCK_OVERFLOW_EVENT: - if (dev->card_data.leaf.family !=3D KVASER_USBCAN) + if (dev->driver_info->family !=3D KVASER_USBCAN) goto warn; break; =20 case CMD_FLUSH_QUEUE_REPLY: - if (dev->card_data.leaf.family !=3D KVASER_LEAF) + if (dev->driver_info->family !=3D KVASER_LEAF) goto warn; break; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FFCEC433EF for ; Mon, 11 Jul 2022 09:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbiGKJPd (ORCPT ); Mon, 11 Jul 2022 05:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231535AbiGKJOS (ORCPT ); Mon, 11 Jul 2022 05:14:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CAAA326DE; Mon, 11 Jul 2022 02:10:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 63605611E6; Mon, 11 Jul 2022 09:10:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F942C341C0; Mon, 11 Jul 2022 09:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530613; bh=q+VC+eXLIBOBoE//vkAaN9EDl5KlbVjXPIorHjYKILY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2f/RP9BdF4HkLKb7yDe19fehciehW9tfynax15JNCXtm/DJU/VrjqfR9/vsNif+92 1yFCn1F6NhctajmgpQW6No3HyqYLlvujnsX1EIjFDWRBsAsw9XWhWzjUZS67qUlvB9 Yv9P/3LKLdHrIPDhvlkoGdWnu8OG2gBzssb/+b2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, "stable@vger.kernel.org, linux-can@vger.kernel.org, Marc Kleine-Budde" Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson Subject: [PATCH 5.4 16/38] can: kvaser_usb: kvaser_usb_leaf: fix CAN clock frequency regression Date: Mon, 11 Jul 2022 11:06:58 +0200 Message-Id: <20220711090539.209352845@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jimmy Assarsson commit e6c80e601053ffdac5709f11ff3ec1e19ed05f7b upstream. The firmware of M32C based Leaf devices expects bittiming parameters calculated for 16MHz clock. Since we use the actual clock frequency of the device, the device may end up with wrong bittiming parameters, depending on user requested parameters. This regression affects M32C based Leaf devices with non-16MHz clock. Fixes: 68daa476f499 ("can: kvaser_usb: get CAN clock frequency from device") Link: https://lore.kernel.org/all/20220603083820.800246-3-extja@kvaser.com Cc: stable@vger.kernel.org Signed-off-by: Jimmy Assarsson Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 1=20 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 29 +++++++++++++++---= ----- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 25 ++++++++++++------- 3 files changed, 36 insertions(+), 19 deletions(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h @@ -38,6 +38,7 @@ /* Kvaser USB device quirks */ #define KVASER_USB_QUIRK_HAS_SILENT_MODE BIT(0) #define KVASER_USB_QUIRK_HAS_TXRX_ERRORS BIT(1) +#define KVASER_USB_QUIRK_IGNORE_CLK_FREQ BIT(2) =20 /* Device capabilities */ #define KVASER_USB_CAP_BERR_CAP 0x01 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -92,26 +92,33 @@ static const struct kvaser_usb_driver_in }; =20 static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf =3D= { - .quirks =3D 0, + .quirks =3D KVASER_USB_QUIRK_IGNORE_CLK_FREQ, .family =3D KVASER_LEAF, .ops =3D &kvaser_usb_leaf_dev_ops, }; =20 static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err= =3D { - .quirks =3D KVASER_USB_QUIRK_HAS_TXRX_ERRORS, + .quirks =3D KVASER_USB_QUIRK_HAS_TXRX_ERRORS | + KVASER_USB_QUIRK_IGNORE_CLK_FREQ, .family =3D KVASER_LEAF, .ops =3D &kvaser_usb_leaf_dev_ops, }; =20 static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err= _listen =3D { .quirks =3D KVASER_USB_QUIRK_HAS_TXRX_ERRORS | - KVASER_USB_QUIRK_HAS_SILENT_MODE, + KVASER_USB_QUIRK_HAS_SILENT_MODE | + KVASER_USB_QUIRK_IGNORE_CLK_FREQ, .family =3D KVASER_LEAF, .ops =3D &kvaser_usb_leaf_dev_ops, }; =20 +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leafimx = =3D { + .quirks =3D 0, + .ops =3D &kvaser_usb_leaf_dev_ops, +}; + static const struct usb_device_id kvaser_usb_table[] =3D { - /* Leaf USB product IDs */ + /* Leaf M32C USB product IDs */ { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID), .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID), @@ -152,16 +159,18 @@ static const struct usb_device_id kvaser .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, { USB_DEVICE(KVASER_VENDOR_ID, USB_CAN_R_PRODUCT_ID), .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err }, + + /* Leaf i.MX28 USB product IDs */ { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID), - .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID), - .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID), - .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID), - .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID), - .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leaf }, + .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_leafimx }, =20 /* USBCANII USB product IDs */ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID), @@ -190,7 +199,7 @@ static const struct usb_device_id kvaser .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_2HS_V2_PRODUCT_ID), .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_2CANLIN_PRODUCT_ID), + { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_CANLIN_PRODUCT_ID), .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID), .driver_info =3D (kernel_ulong_t)&kvaser_usb_driver_info_hydra }, --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -525,16 +525,23 @@ static void kvaser_usb_leaf_get_software dev->fw_version =3D le32_to_cpu(softinfo->fw_version); dev->max_tx_urbs =3D le16_to_cpu(softinfo->max_outstanding_tx); =20 - switch (sw_options & KVASER_USB_LEAF_SWOPTION_FREQ_MASK) { - case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK: + if (dev->driver_info->quirks & KVASER_USB_QUIRK_IGNORE_CLK_FREQ) { + /* Firmware expects bittiming parameters calculated for 16MHz + * clock, regardless of the actual clock + */ dev->cfg =3D &kvaser_usb_leaf_dev_cfg_16mhz; - break; - case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK: - dev->cfg =3D &kvaser_usb_leaf_dev_cfg_24mhz; - break; - case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK: - dev->cfg =3D &kvaser_usb_leaf_dev_cfg_32mhz; - break; + } else { + switch (sw_options & KVASER_USB_LEAF_SWOPTION_FREQ_MASK) { + case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK: + dev->cfg =3D &kvaser_usb_leaf_dev_cfg_16mhz; + break; + case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK: + dev->cfg =3D &kvaser_usb_leaf_dev_cfg_24mhz; + break; + case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK: + dev->cfg =3D &kvaser_usb_leaf_dev_cfg_32mhz; + break; + } } } From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35F7EC433EF for ; Mon, 11 Jul 2022 09:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbiGKJPh (ORCPT ); Mon, 11 Jul 2022 05:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231580AbiGKJOX (ORCPT ); Mon, 11 Jul 2022 05:14:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A58D33A3F; Mon, 11 Jul 2022 02:10:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F08E7B80D2C; Mon, 11 Jul 2022 09:10:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A1B6C34115; Mon, 11 Jul 2022 09:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530616; bh=ISSddOJwrfYJ67l+qWRGRS53lNFwLCrHeQ3tWTBa6Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HibgTc4U++bnuZXWjuxlmyHGxRHvq8MKbHbd4BRBvA5N6rz11UAa5JMBGegbpEALn 1PLgYJt3DAsfTTFgNEPrz8MQpUJKKT39Buz2odyQlwdXkKu+OjgC4FSEsOx1tVhAUO tea/ics9ycPCIuXUMszd+ebliLNPGS1vRdQk6UYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, "stable@vger.kernel.org, linux-can@vger.kernel.org, Marc Kleine-Budde" Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson Subject: [PATCH 5.4 17/38] can: kvaser_usb: kvaser_usb_leaf: fix bittiming limits Date: Mon, 11 Jul 2022 11:06:59 +0200 Message-Id: <20220711090539.239691835@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jimmy Assarsson commit b3b6df2c56d80b8c6740433cff5f016668b8de70 upstream. Use correct bittiming limits depending on device. For devices based on USBcanII, Leaf M32C or Leaf i.MX28. Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devic= es") Fixes: b4f20130af23 ("can: kvaser_usb: add support for Kvaser Leaf v2 and u= sb mini PCIe") Fixes: f5d4abea3ce0 ("can: kvaser_usb: Add support for the USBcan-II family= ") Link: https://lore.kernel.org/all/20220603083820.800246-4-extja@kvaser.com Cc: stable@vger.kernel.org Signed-off-by: Jimmy Assarsson [mkl: remove stray netlink.h include] [mkl: keep struct can_bittiming_const kvaser_usb_flexc_bittiming_const in k= vaser_usb_hydra.c] Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 2=20 drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 4 - drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 76 ++++++++++++-----= ----- 3 files changed, 47 insertions(+), 35 deletions(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h @@ -188,4 +188,6 @@ int kvaser_usb_send_cmd_async(struct kva =20 int kvaser_usb_can_rx_over_error(struct net_device *netdev); =20 +extern const struct can_bittiming_const kvaser_usb_flexc_bittiming_const; + #endif /* KVASER_USB_H */ --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -371,7 +371,7 @@ static const struct can_bittiming_const .brp_inc =3D 1, }; =20 -static const struct can_bittiming_const kvaser_usb_hydra_flexc_bittiming_c= =3D { +const struct can_bittiming_const kvaser_usb_flexc_bittiming_const =3D { .name =3D "kvaser_usb_flex", .tseg1_min =3D 4, .tseg1_max =3D 16, @@ -2024,5 +2024,5 @@ static const struct kvaser_usb_dev_cfg k .freq =3D 24000000, }, .timestamp_freq =3D 1, - .bittiming_const =3D &kvaser_usb_hydra_flexc_bittiming_c, + .bittiming_const =3D &kvaser_usb_flexc_bittiming_const, }; --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -100,16 +100,6 @@ #define USBCAN_ERROR_STATE_RX_ERROR BIT(1) #define USBCAN_ERROR_STATE_BUSERROR BIT(2) =20 -/* bittiming parameters */ -#define KVASER_USB_TSEG1_MIN 1 -#define KVASER_USB_TSEG1_MAX 16 -#define KVASER_USB_TSEG2_MIN 1 -#define KVASER_USB_TSEG2_MAX 8 -#define KVASER_USB_SJW_MAX 4 -#define KVASER_USB_BRP_MIN 1 -#define KVASER_USB_BRP_MAX 64 -#define KVASER_USB_BRP_INC 1 - /* ctrl modes */ #define KVASER_CTRL_MODE_NORMAL 1 #define KVASER_CTRL_MODE_SILENT 2 @@ -342,48 +332,68 @@ struct kvaser_usb_err_summary { }; }; =20 -static const struct can_bittiming_const kvaser_usb_leaf_bittiming_const = =3D { - .name =3D "kvaser_usb", - .tseg1_min =3D KVASER_USB_TSEG1_MIN, - .tseg1_max =3D KVASER_USB_TSEG1_MAX, - .tseg2_min =3D KVASER_USB_TSEG2_MIN, - .tseg2_max =3D KVASER_USB_TSEG2_MAX, - .sjw_max =3D KVASER_USB_SJW_MAX, - .brp_min =3D KVASER_USB_BRP_MIN, - .brp_max =3D KVASER_USB_BRP_MAX, - .brp_inc =3D KVASER_USB_BRP_INC, +static const struct can_bittiming_const kvaser_usb_leaf_m16c_bittiming_con= st =3D { + .name =3D "kvaser_usb_ucii", + .tseg1_min =3D 4, + .tseg1_max =3D 16, + .tseg2_min =3D 2, + .tseg2_max =3D 8, + .sjw_max =3D 4, + .brp_min =3D 1, + .brp_max =3D 16, + .brp_inc =3D 1, +}; + +static const struct can_bittiming_const kvaser_usb_leaf_m32c_bittiming_con= st =3D { + .name =3D "kvaser_usb_leaf", + .tseg1_min =3D 3, + .tseg1_max =3D 16, + .tseg2_min =3D 2, + .tseg2_max =3D 8, + .sjw_max =3D 4, + .brp_min =3D 2, + .brp_max =3D 128, + .brp_inc =3D 2, }; =20 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_8mhz =3D { +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_usbcan_dev_cfg =3D { .clock =3D { .freq =3D 8000000, }, .timestamp_freq =3D 1, - .bittiming_const =3D &kvaser_usb_leaf_bittiming_const, + .bittiming_const =3D &kvaser_usb_leaf_m16c_bittiming_const, +}; + +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_m32c_dev_cfg =3D { + .clock =3D { + .freq =3D 16000000, + }, + .timestamp_freq =3D 1, + .bittiming_const =3D &kvaser_usb_leaf_m32c_bittiming_const, }; =20 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_16mhz =3D { +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_16mhz = =3D { .clock =3D { .freq =3D 16000000, }, .timestamp_freq =3D 1, - .bittiming_const =3D &kvaser_usb_leaf_bittiming_const, + .bittiming_const =3D &kvaser_usb_flexc_bittiming_const, }; =20 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_24mhz =3D { +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_24mhz = =3D { .clock =3D { .freq =3D 24000000, }, .timestamp_freq =3D 1, - .bittiming_const =3D &kvaser_usb_leaf_bittiming_const, + .bittiming_const =3D &kvaser_usb_flexc_bittiming_const, }; =20 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_32mhz =3D { +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_32mhz = =3D { .clock =3D { .freq =3D 32000000, }, .timestamp_freq =3D 1, - .bittiming_const =3D &kvaser_usb_leaf_bittiming_const, + .bittiming_const =3D &kvaser_usb_flexc_bittiming_const, }; =20 static void * @@ -529,17 +539,17 @@ static void kvaser_usb_leaf_get_software /* Firmware expects bittiming parameters calculated for 16MHz * clock, regardless of the actual clock */ - dev->cfg =3D &kvaser_usb_leaf_dev_cfg_16mhz; + dev->cfg =3D &kvaser_usb_leaf_m32c_dev_cfg; } else { switch (sw_options & KVASER_USB_LEAF_SWOPTION_FREQ_MASK) { case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK: - dev->cfg =3D &kvaser_usb_leaf_dev_cfg_16mhz; + dev->cfg =3D &kvaser_usb_leaf_imx_dev_cfg_16mhz; break; case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK: - dev->cfg =3D &kvaser_usb_leaf_dev_cfg_24mhz; + dev->cfg =3D &kvaser_usb_leaf_imx_dev_cfg_24mhz; break; case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK: - dev->cfg =3D &kvaser_usb_leaf_dev_cfg_32mhz; + dev->cfg =3D &kvaser_usb_leaf_imx_dev_cfg_32mhz; break; } } @@ -566,7 +576,7 @@ static int kvaser_usb_leaf_get_software_ dev->fw_version =3D le32_to_cpu(cmd.u.usbcan.softinfo.fw_version); dev->max_tx_urbs =3D le16_to_cpu(cmd.u.usbcan.softinfo.max_outstanding_tx); - dev->cfg =3D &kvaser_usb_leaf_dev_cfg_8mhz; + dev->cfg =3D &kvaser_usb_leaf_usbcan_dev_cfg; break; } From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9062C433EF for ; Mon, 11 Jul 2022 09:15:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231510AbiGKJPk (ORCPT ); Mon, 11 Jul 2022 05:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbiGKJOZ (ORCPT ); Mon, 11 Jul 2022 05:14:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5484A22BE3; Mon, 11 Jul 2022 02:10:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B0AD0B80E76; Mon, 11 Jul 2022 09:10:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEDBCC34115; Mon, 11 Jul 2022 09:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530619; bh=qLea0AxIc99SW/1s9HO6AXWcrtBAjyvRjPO0jHRNnEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tEBduIbnBQGceKQa4T7zK5Mng1h0AvxSSWtbVcw9iaTDcmlStBZZNqGXRZgCJbCpX ePFDz6Pcv+sDGy/leHGQaimiKecSFHU6oCG0o11ln581QlVUwKyajwb+7wkEYVZjeC mDD1TBvoO91M/EMqyXTyXx4fxwblzGkUN6xit3CI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Bonzini , Eric Sandeen , "Darrick J. Wong" , Kuniyuki Iwashima Subject: [PATCH 5.4 18/38] xfs: remove incorrect ASSERT in xfs_rename Date: Mon, 11 Jul 2022 11:07:00 +0200 Message-Id: <20220711090539.270186245@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Sandeen commit e445976537ad139162980bee015b7364e5b64fff upstream. This ASSERT in xfs_rename is a) incorrect, because (RENAME_WHITEOUT|RENAME_NOREPLACE) is a valid combination, and b) unnecessary, because actual invalid flag combinations are already handled at the vfs level in do_renameat2() before we get called. So, remove it. Reported-by: Paolo Bonzini Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Fixes: 7dcf5c3e4527 ("xfs: add RENAME_WHITEOUT support") Signed-off-by: Kuniyuki Iwashima Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/xfs/xfs_inode.c | 1 - 1 file changed, 1 deletion(-) --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3232,7 +3232,6 @@ xfs_rename( * appropriately. */ if (flags & RENAME_WHITEOUT) { - ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE))); error =3D xfs_rename_alloc_whiteout(target_dp, &wip); if (error) return error; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C0C7C433EF for ; Mon, 11 Jul 2022 09:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231761AbiGKJSl (ORCPT ); Mon, 11 Jul 2022 05:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231728AbiGKJSF (ORCPT ); Mon, 11 Jul 2022 05:18:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4816E4B48F; Mon, 11 Jul 2022 02:11:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8277E611E4; Mon, 11 Jul 2022 09:11:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9058CC34115; Mon, 11 Jul 2022 09:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530698; bh=8xduzV9XPwv+MRJJNBuvjbGKAF/YIl6fxiUCeWx2Z4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fh7gVxJaKGoyx5oFIMmrO/RRfOk35vvtT+KYJ4ISeHh3GydNhqDJNnwsDe84ASsTL 5hSA18gWoVakZH92AJqoFEl32kss0fLjnUooxw/nKssCNvFUrwQrLHQM4QwQRxINDp 4Jnqbcu+WmQzKngrtA3D9IsJ4qwkc1shB2VhHDHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.4 19/38] ARM: meson: Fix refcount leak in meson_smp_prepare_cpus Date: Mon, 11 Jul 2022 11:07:01 +0200 Message-Id: <20220711090539.299572813@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 34d2cd3fccced12b958b8848e3eff0ee4296764c ] of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: d850f3e5d296 ("ARM: meson: Add SMP bringup code for Meson8 and Meson= 8b") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220512021611.47921-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/mach-meson/platsmp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-meson/platsmp.c b/arch/arm/mach-meson/platsmp.c index 4b8ad728bb42..32ac60b89fdc 100644 --- a/arch/arm/mach-meson/platsmp.c +++ b/arch/arm/mach-meson/platsmp.c @@ -71,6 +71,7 @@ static void __init meson_smp_prepare_cpus(const char *scu= _compatible, } =20 sram_base =3D of_iomap(node, 0); + of_node_put(node); if (!sram_base) { pr_err("Couldn't map SRAM registers\n"); return; @@ -91,6 +92,7 @@ static void __init meson_smp_prepare_cpus(const char *scu= _compatible, } =20 scu_base =3D of_iomap(node, 0); + of_node_put(node); if (!scu_base) { pr_err("Couldn't map SCU registers\n"); return; --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A26DC433EF for ; Mon, 11 Jul 2022 09:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231613AbiGKJQe (ORCPT ); Mon, 11 Jul 2022 05:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231828AbiGKJO4 (ORCPT ); Mon, 11 Jul 2022 05:14:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1518BC5; Mon, 11 Jul 2022 02:10:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80BF8B80E81; Mon, 11 Jul 2022 09:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C77F5C341CB; Mon, 11 Jul 2022 09:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530647; bh=JnbQUXFmoCPU/Ryxi5nJ3JILasfWjNYUzM7FYb5s3Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K0jYH8h9bkJVtHDRrtDZZ0H40Q3+x+Ve9XUlJs5BmxyhhUlJuYfUr+lnab8GtFmTA fBbfLybjTGNJ9lZVWHI9oH9i6kSBx3Mib2kjxAqVGlUQvTJFL+pbleQJFmg7emhjvS /2oPngUwb/+/NfBoWpVLq6B5u+aKLoG8DWQVcaiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Jernej Skrabec , Linus Walleij , Sasha Levin Subject: [PATCH 5.4 20/38] pinctrl: sunxi: a83t: Fix NAND function name for some pins Date: Mon, 11 Jul 2022 11:07:02 +0200 Message-Id: <20220711090539.329478616@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit aaefa29270d9551b604165a08406543efa9d16f5 ] The other NAND pins on Port C use the "nand0" function name. "nand0" also matches all of the other Allwinner SoCs. Fixes: 4730f33f0d82 ("pinctrl: sunxi: add allwinner A83T PIO controller sup= port") Signed-off-by: Samuel Holland Acked-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220526024956.49500-1-samuel@sholland.org Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c b/drivers/pinctrl/s= unxi/pinctrl-sun8i-a83t.c index 4ada80317a3b..b5c1a8f363f3 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c @@ -158,26 +158,26 @@ static const struct sunxi_desc_pin sun8i_a83t_pins[] = =3D { SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14), SUNXI_FUNCTION(0x0, "gpio_in"), SUNXI_FUNCTION(0x1, "gpio_out"), - SUNXI_FUNCTION(0x2, "nand"), /* DQ6 */ + SUNXI_FUNCTION(0x2, "nand0"), /* DQ6 */ SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15), SUNXI_FUNCTION(0x0, "gpio_in"), SUNXI_FUNCTION(0x1, "gpio_out"), - SUNXI_FUNCTION(0x2, "nand"), /* DQ7 */ + SUNXI_FUNCTION(0x2, "nand0"), /* DQ7 */ SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16), SUNXI_FUNCTION(0x0, "gpio_in"), SUNXI_FUNCTION(0x1, "gpio_out"), - SUNXI_FUNCTION(0x2, "nand"), /* DQS */ + SUNXI_FUNCTION(0x2, "nand0"), /* DQS */ SUNXI_FUNCTION(0x3, "mmc2")), /* RST */ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 17), SUNXI_FUNCTION(0x0, "gpio_in"), SUNXI_FUNCTION(0x1, "gpio_out"), - SUNXI_FUNCTION(0x2, "nand")), /* CE2 */ + SUNXI_FUNCTION(0x2, "nand0")), /* CE2 */ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 18), SUNXI_FUNCTION(0x0, "gpio_in"), SUNXI_FUNCTION(0x1, "gpio_out"), - SUNXI_FUNCTION(0x2, "nand")), /* CE3 */ + SUNXI_FUNCTION(0x2, "nand0")), /* CE3 */ /* Hole */ SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2), SUNXI_FUNCTION(0x0, "gpio_in"), --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC5B3C433EF for ; Mon, 11 Jul 2022 09:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231702AbiGKJRp (ORCPT ); Mon, 11 Jul 2022 05:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbiGKJRR (ORCPT ); Mon, 11 Jul 2022 05:17:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E57BDF1A; Mon, 11 Jul 2022 02:11:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A54C2B80E5E; Mon, 11 Jul 2022 09:11:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11DDEC34115; Mon, 11 Jul 2022 09:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530677; bh=TQ1o81IdEGrKyEmd0iBY/iyi7Ilq6/KNstQRS2Mu2Ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LY++gFRGpr8ehvo+oGaeAF/OSGU63hL3BjMiH7BHVFD+zR3qiSIiyUVvP2ZXUE0ps 5gnjJa39X2v5vKxtuMc42woafxjoE79EhugXsNDizC0JrUqWMN3/dHYpAIOxNMsht2 x7PfRy9ujolqMpx6YChb8LhlKzBLI3MHVXh1+efM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrei Lalaev , Samuel Holland , Linus Walleij , Sasha Levin Subject: [PATCH 5.4 21/38] pinctrl: sunxi: sunxi_pconf_set: use correct offset Date: Mon, 11 Jul 2022 11:07:03 +0200 Message-Id: <20220711090539.357246146@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrei Lalaev [ Upstream commit cd4c1e65a32afd003b08ad4aafe1e4d3e4e8e61b ] Some Allwinner SoCs have 2 pinctrls (PIO and R_PIO). Previous implementation used absolute pin numbering and it was incorrect for R_PIO pinctrl. It's necessary to take into account the base pin number. Fixes: 90be64e27621 ("pinctrl: sunxi: implement pin_config_set") Signed-off-by: Andrei Lalaev Reviewed-by: Samuel Holland Link: https://lore.kernel.org/r/20220525190423.410609-1-andrey.lalaev@gmail= .com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/= pinctrl-sunxi.c index 77783582080c..c4052eab6bfc 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -536,6 +536,8 @@ static int sunxi_pconf_set(struct pinctrl_dev *pctldev,= unsigned pin, struct sunxi_pinctrl *pctl =3D pinctrl_dev_get_drvdata(pctldev); int i; =20 + pin -=3D pctl->desc->pin_base; + for (i =3D 0; i < num_configs; i++) { enum pin_config_param param; unsigned long flags; --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D2AEC43334 for ; Mon, 11 Jul 2022 09:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbiGKJRs (ORCPT ); Mon, 11 Jul 2022 05:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231605AbiGKJRS (ORCPT ); Mon, 11 Jul 2022 05:17:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 167E5F58F; Mon, 11 Jul 2022 02:11:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A9699611E4; Mon, 11 Jul 2022 09:11:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B733BC341C0; Mon, 11 Jul 2022 09:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530680; bh=+NKRnrS4jQ0p5C2qoqyI4hp9rrnRdQsLMHaOBECx6NM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sx3gZBbWKX2badsBY18d9cD7DBTEesou+26Wl2kEcpFG3EaUPft+ykr+NumlqB3hR STK/crJlnbL7PkqlfqdedtUhCBosC85yPF+hoSsMGt39juYH5w8JVQy6pJAVv+yeDE DdC5BY5NpURF1wTnI4s0WC1/TVph/Vd0hL7vARvk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Sasha Levin Subject: [PATCH 5.4 22/38] ARM: at91: pm: use proper compatible for sama5d2s rtc Date: Mon, 11 Jul 2022 11:07:04 +0200 Message-Id: <20220711090539.386430884@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea [ Upstream commit ddc980da8043779119acaca106c6d9b445c9b65b ] Use proper compatible strings for SAMA5D2's RTC IPs. This is necessary for configuring wakeup sources for ULP1 PM mode. Fixes: d7484f5c6b3b ("ARM: at91: pm: configure wakeup sources for ULP1 mode= ") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220523092421.317345-2-claudiu.beznea@micr= ochip.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/mach-at91/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 676cc2a318f4..3e24e104e687 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -103,7 +103,7 @@ static const struct wakeup_source_info ws_info[] =3D { =20 static const struct of_device_id sama5d2_ws_ids[] =3D { { .compatible =3D "atmel,sama5d2-gem", .data =3D &ws_info[0] }, - { .compatible =3D "atmel,at91rm9200-rtc", .data =3D &ws_info[1] }, + { .compatible =3D "atmel,sama5d2-rtc", .data =3D &ws_info[1] }, { .compatible =3D "atmel,sama5d3-udc", .data =3D &ws_info[2] }, { .compatible =3D "atmel,at91rm9200-ohci", .data =3D &ws_info[2] }, { .compatible =3D "usb-ohci", .data =3D &ws_info[2] }, --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B27DC43334 for ; Mon, 11 Jul 2022 09:18:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231479AbiGKJSF (ORCPT ); Mon, 11 Jul 2022 05:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231368AbiGKJRY (ORCPT ); Mon, 11 Jul 2022 05:17:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD26B11C1D; Mon, 11 Jul 2022 02:11:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EED03B80E5E; Mon, 11 Jul 2022 09:11:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 674D6C34115; Mon, 11 Jul 2022 09:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530682; bh=a02+H42wUkYe63LHq1WCrt5fbzTp+faWnDZ6CDRlvPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGftgElpSPwl/TcFRVVKzd1KwEPlxSJqDUjsESFQ1tR1xtIw14Vy14h6X7DW2ETNG pR+akRisyXVcacRB4/nNcCj6ACC1w679UDEvVgP1jGmvO6m7iEMm19wV96THrJqS4p 5zVI8qQl7mh26+S3NCPktVCkWcJrHs/c/djON+K4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Sasha Levin Subject: [PATCH 5.4 23/38] ARM: at91: pm: use proper compatibles for sam9x60s rtc and rtt Date: Mon, 11 Jul 2022 11:07:05 +0200 Message-Id: <20220711090539.414777069@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea [ Upstream commit 641522665dbb25ce117c78746df1aad8b58c80e5 ] Use proper compatible strings for SAM9X60's RTC and RTT IPs. These are necessary for configuring wakeup sources for ULP1 PM mode. Fixes: eaedc0d379da ("ARM: at91: pm: add ULP1 support for SAM9X60") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220523092421.317345-3-claudiu.beznea@micr= ochip.com Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm/mach-at91/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 3e24e104e687..5d75ab82d5a6 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -114,12 +114,12 @@ static const struct of_device_id sama5d2_ws_ids[] =3D= { }; =20 static const struct of_device_id sam9x60_ws_ids[] =3D { - { .compatible =3D "atmel,at91sam9x5-rtc", .data =3D &ws_info[1] }, + { .compatible =3D "microchip,sam9x60-rtc", .data =3D &ws_info[1] }, { .compatible =3D "atmel,at91rm9200-ohci", .data =3D &ws_info[2] }, { .compatible =3D "usb-ohci", .data =3D &ws_info[2] }, { .compatible =3D "atmel,at91sam9g45-ehci", .data =3D &ws_info[2] }, { .compatible =3D "usb-ehci", .data =3D &ws_info[2] }, - { .compatible =3D "atmel,at91sam9260-rtt", .data =3D &ws_info[4] }, + { .compatible =3D "microchip,sam9x60-rtt", .data =3D &ws_info[4] }, { .compatible =3D "cdns,sam9x60-macb", .data =3D &ws_info[5] }, { /* sentinel */ } }; --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 245D1CCA47B for ; Mon, 11 Jul 2022 09:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbiGKJSH (ORCPT ); Mon, 11 Jul 2022 05:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231673AbiGKJRZ (ORCPT ); Mon, 11 Jul 2022 05:17:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42E7C48CAE; Mon, 11 Jul 2022 02:11:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 075DD611E9; Mon, 11 Jul 2022 09:11:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AC3DC385A9; Mon, 11 Jul 2022 09:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530685; bh=UAloPygui7BXRMZl5jb5TSPhIEqwcaUK4m+sbscM76U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=shJWk1XUnWBGvWzO0NfVFOsQk2yskOj3SXltcTQFSHYs0X6ow9veeYuLbRh3t1ep5 B8VpdQVtU5fC1ZoMr+TaQjBTMiNWo0h7F8JAsUUQeTJVfSfcB6xShDS5+4CfGJoswR 15xwZIAJ8EFRzXUNVQHoyJd23/8834YproqZRqw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Child , Brian King , Rick Lindsley , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 24/38] ibmvnic: Properly dispose of all skbs during a failover. Date: Mon, 11 Jul 2022 11:07:06 +0200 Message-Id: <20220711090539.443682381@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rick Lindsley [ Upstream commit 1b18f09d31cfa7148df15a7d5c5e0e86f105f7d1 ] During a reset, there may have been transmits in flight that are no longer valid and cannot be fulfilled. Resetting and clearing the queues is insufficient; each skb also needs to be explicitly freed so that upper levels are not left waiting for confirmation of a transmit that will never happen. If this happens frequently enough, the apparent backlog will cause TCP to begin "congestion control" unnecessarily, culminating in permanently decreased throughput. Fixes: d7c0ef36bde03 ("ibmvnic: Free and re-allocate scrqs when tx/rx scrqs= change") Tested-by: Nick Child Reviewed-by: Brian King Signed-off-by: Rick Lindsley Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/ibm/ibmvnic.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/= ibmvnic.c index 34bf6f4eef4a..bc313d85fe13 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -5022,6 +5022,15 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter= *adapter) release_sub_crqs(adapter, 0); rc =3D init_sub_crqs(adapter); } else { + /* no need to reinitialize completely, but we do + * need to clean up transmits that were in flight + * when we processed the reset. Failure to do so + * will confound the upper layer, usually TCP, by + * creating the illusion of transmits that are + * awaiting completion. + */ + clean_tx_pools(adapter); + rc =3D reset_sub_crq_queues(adapter); } } else { --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11200C43334 for ; Mon, 11 Jul 2022 09:18:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbiGKJSL (ORCPT ); Mon, 11 Jul 2022 05:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbiGKJRi (ORCPT ); Mon, 11 Jul 2022 05:17:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B30C4AD43; Mon, 11 Jul 2022 02:11:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6D6DEB80E7E; Mon, 11 Jul 2022 09:11:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3C18C341C0; Mon, 11 Jul 2022 09:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530688; bh=pbH4+/eifaogvlXXGDGFmEoG1UUw+Kn1yNbwrEJfSsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GgwD5iRrItoivj7ZaEG3P+B9S9zM5DeMLGKO1pZhVqQW2nzRW2uvHQDyvQQOrSFJ7 QSzZhwCgr05QdH1bQg32qF7qVlDpzh6fUQQ84feW9nRHpSB0Roobp2o9295ccBa182 v0t+XzV5Rg5u/kRoMYTDUjkcI+B2iEmiMtw12wBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Ido Schimmel , Paolo Abeni , Sasha Levin Subject: [PATCH 5.4 25/38] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT Date: Mon, 11 Jul 2022 11:07:07 +0200 Message-Id: <20220711090539.472540621@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit b8e629b05f5d23f9649c901bef09fab8b0c2e4b9 ] As mentioned in the blamed commit, flood_unicast_test() works by checking the match count on a tc filter placed on the receiving interface. But the second host interface (host2_if) has no interest in receiving a packet with MAC DA de:ad:be:ef:13:37, so its RX filter drops it even before the ingress tc filter gets to be executed. So we will incorrectly get the message "Packet was not flooded when should", when in fact, the packet was flooded as expected but dropped due to an unrelated reason, at some other layer on the receiving side. Force h2 to accept this packet by temporarily placing it in promiscuous mode. Alternatively we could either deliver to its MAC address or use tcpdump_start, but this has the fewest complications. This fixes the "flooding" test from bridge_vlan_aware.sh and bridge_vlan_unaware.sh, which calls flood_test from the lib. Fixes: 236dd50bf67a ("selftests: forwarding: Add a test for flooded traffic= ") Signed-off-by: Vladimir Oltean Reviewed-by: Ido Schimmel Tested-by: Ido Schimmel Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/testing/selftests/net/forwarding/lib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/= selftests/net/forwarding/lib.sh index 85c587a03c8a..be977cd4bfe3 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -960,6 +960,7 @@ flood_test_do() =20 # Add an ACL on `host2_if` which will tell us whether the packet # was flooded to it or not. + ip link set $host2_if promisc on tc qdisc add dev $host2_if ingress tc filter add dev $host2_if ingress protocol ip pref 1 handle 101 \ flower dst_mac $mac action drop @@ -977,6 +978,7 @@ flood_test_do() =20 tc filter del dev $host2_if ingress protocol ip pref 1 handle 101 flower tc qdisc del dev $host2_if ingress + ip link set $host2_if promisc off =20 return $err } --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C279C43334 for ; Mon, 11 Jul 2022 09:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbiGKJSP (ORCPT ); Mon, 11 Jul 2022 05:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231559AbiGKJRl (ORCPT ); Mon, 11 Jul 2022 05:17:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 167624AD4A; Mon, 11 Jul 2022 02:11:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 58C6D611E4; Mon, 11 Jul 2022 09:11:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63ADAC34115; Mon, 11 Jul 2022 09:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530690; bh=h7tt5IUgeXy7Pnwbr0Jf02OKdsi8fvuBb17cEyFIIAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpCm87ee885qlupIi3UjqKZXfzcGCCMR+pwnZCeZsUxe08AAOF4ND7H01nspgN82c TPab9bzjQPxlmLIUCEDO4pv9Vn4Ii/6Cg7EeRROZsTwKW9ifBKT653Gh7BhzWbnRD7 VxsoIo6Pl68TVGRl3Js1K9lPjKJVv0SDg78cbcTc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Ido Schimmel , Paolo Abeni , Sasha Levin Subject: [PATCH 5.4 26/38] selftests: forwarding: fix learning_test when h1 supports IFF_UNICAST_FLT Date: Mon, 11 Jul 2022 11:07:08 +0200 Message-Id: <20220711090539.501086115@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 1a635d3e1c80626237fdae47a5545b6655d8d81c ] The first host interface has by default no interest in receiving packets MAC DA de:ad:be:ef:13:37, so it might drop them before they hit the tc filter and this might confuse the selftest. Enable promiscuous mode such that the filter properly counts received packets. Fixes: d4deb01467ec ("selftests: forwarding: Add a test for FDB learning") Signed-off-by: Vladimir Oltean Reviewed-by: Ido Schimmel Tested-by: Ido Schimmel Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/testing/selftests/net/forwarding/lib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/= selftests/net/forwarding/lib.sh index be977cd4bfe3..b759f7903c06 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -894,6 +894,7 @@ learning_test() # FDB entry was installed. bridge link set dev $br_port1 flood off =20 + ip link set $host1_if promisc on tc qdisc add dev $host1_if ingress tc filter add dev $host1_if ingress protocol ip pref 1 handle 101 \ flower dst_mac $mac action drop @@ -943,6 +944,7 @@ learning_test() =20 tc filter del dev $host1_if ingress protocol ip pref 1 handle 101 flower tc qdisc del dev $host1_if ingress + ip link set $host1_if promisc off =20 bridge link set dev $br_port1 flood on =20 --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5B27C433EF for ; Mon, 11 Jul 2022 09:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231747AbiGKJSU (ORCPT ); Mon, 11 Jul 2022 05:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbiGKJRo (ORCPT ); Mon, 11 Jul 2022 05:17:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22B3949B7F; Mon, 11 Jul 2022 02:11:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21460611E3; Mon, 11 Jul 2022 09:11:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BD73C34115; Mon, 11 Jul 2022 09:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530693; bh=HSzoByN3zguKFAgIotEhKn7qxv6ee9YgGPcOGUZevy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cbdSD1IxazhEyS4kORl+FFpNoGDEw6taFK+enxMrLM9c9VvsTlUnhgWVY9UiqvDST Sykzky5kO5yS/l5hyKPeLA0Jqu0XI8IkQ667nJslO1mGgPbZP1y6ZE93AylTUiay6D 9ssLw6ulm9RLytJED+/vGypZENXiMPESfgYnytuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Ido Schimmel , Paolo Abeni , Sasha Levin Subject: [PATCH 5.4 27/38] selftests: forwarding: fix error message in learning_test Date: Mon, 11 Jul 2022 11:07:09 +0200 Message-Id: <20220711090539.530013137@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 83844aacab2015da1dba1df0cc61fc4b4c4e8076 ] When packets are not received, they aren't received on $host1_if, so the message talking about the second host not receiving them is incorrect. Fix it. Fixes: d4deb01467ec ("selftests: forwarding: Add a test for FDB learning") Signed-off-by: Vladimir Oltean Reviewed-by: Ido Schimmel Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/testing/selftests/net/forwarding/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/= selftests/net/forwarding/lib.sh index b759f7903c06..f190ad58e00d 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -905,7 +905,7 @@ learning_test() tc -j -s filter show dev $host1_if ingress \ | jq -e ".[] | select(.options.handle =3D=3D 101) \ | select(.options.actions[0].stats.packets =3D=3D 1)" &> /dev/null - check_fail $? "Packet reached second host when should not" + check_fail $? "Packet reached first host when should not" =20 $MZ $host1_if -c 1 -p 64 -a $mac -t ip -q sleep 1 --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6EB5C43334 for ; Mon, 11 Jul 2022 09:18:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231755AbiGKJSg (ORCPT ); Mon, 11 Jul 2022 05:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231712AbiGKJSB (ORCPT ); Mon, 11 Jul 2022 05:18:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D3C511C2C; Mon, 11 Jul 2022 02:11:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 774DFB80D2C; Mon, 11 Jul 2022 09:11:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE929C34115; Mon, 11 Jul 2022 09:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530696; bh=ZG3Rwy9JP7agOxmwR8S1bH1vQXy48ESdKQsRF6M9y7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vqeyddb/008She3tovImfeaz7cjO8Cp0fH6UbsDJnGmKhEmdBiPeIeHCjU1gEN212 4fa7NjQa4WZEynegkXHbdQWG0NPBKP9M+ZEceNMh0a7crofylRseWwIy094hDWYuuC sZfo4htBXrCYXkCV6SbnzXH0TeE+8VhFyi40HXNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Satish Nagireddy , Lars-Peter Clausen , Michal Simek , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 28/38] i2c: cadence: Unregister the clk notifier in error path Date: Mon, 11 Jul 2022 11:07:10 +0200 Message-Id: <20220711090539.558704008@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Satish Nagireddy [ Upstream commit 3501f0c663063513ad604fb1b3f06af637d3396d ] This patch ensures that the clock notifier is unregistered when driver probe is returning error. Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller") Signed-off-by: Satish Nagireddy Tested-by: Lars-Peter Clausen Reviewed-by: Michal Simek Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/i2c/busses/i2c-cadence.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cade= nce.c index 8a3a0991bc1c..3a1bdc75275f 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -985,6 +985,7 @@ static int cdns_i2c_probe(struct platform_device *pdev) return 0; =20 err_clk_dis: + clk_notifier_unregister(id->clk, &id->clk_rate_change_nb); clk_disable_unprepare(id->clk); pm_runtime_set_suspended(&pdev->dev); pm_runtime_disable(&pdev->dev); --=20 2.35.1 From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C98AC433EF for ; Mon, 11 Jul 2022 09:16:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231621AbiGKJQk (ORCPT ); Mon, 11 Jul 2022 05:16:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbiGKJO4 (ORCPT ); Mon, 11 Jul 2022 05:14:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08143C01; Mon, 11 Jul 2022 02:10:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A8A9611E9; Mon, 11 Jul 2022 09:10:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E0CCC34115; Mon, 11 Jul 2022 09:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530650; bh=Pe/pZg5QJzD1CRbxDtgY8MMA8jBKbD4EC2ecOckql1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYeYdqbe0zvw3x2Y8PNeRi/cAnntbjtEaua8gr9HPNMHHc5MGn2bbAlCJMjDtH2Xd 0rr3DloQ1SBEsU94Lb1Pf/D1dkGm1fgKjW/XNrUMiKvJeq8uU5HfYjINN5Zo8jsLBx 59WDmsgpq5LwRp/lKqcVBmVunTzaEdJ+RkW5mxAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Robinson , Fabio Estevam , Vinod Koul Subject: [PATCH 5.4 29/38] dmaengine: imx-sdma: Allow imx8m for imx7 FW revs Date: Mon, 11 Jul 2022 11:07:11 +0200 Message-Id: <20220711090539.587270102@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Robinson commit a7cd3cf0b2e5aaacfe5e02c472bd28e98e640be7 upstream. The revision of the imx-sdma IP that is in the i.MX8M series is the same is that as that in the i.MX7 series but the imx7d MODULE_FIRMWARE directive is wrapped in a condiditional which means it's not defined when built for aarch64 SOC_IMX8M platforms and hence you get the following errors when the driver loads on imx8m devices: imx-sdma 302c0000.dma-controller: Direct firmware load for imx/sdma/sdma-im= x7d.bin failed with error -2 imx-sdma 302c0000.dma-controller: external firmware not found, using ROM fi= rmware Add the SOC_IMX8M into the check so the firmware can load on i.MX8. Fixes: 1474d48bd639 ("arm64: dts: imx8mq: Add SDMA nodes") Fixes: 941acd566b18 ("dmaengine: imx-sdma: Only check ratio on parts that s= upport 1:1") Signed-off-by: Peter Robinson Cc: stable@vger.kernel.org # v5.2+ Reviewed-by: Fabio Estevam Link: https://lore.kernel.org/r/20220606161034.3544803-1-pbrobinson@gmail.c= om Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/imx-sdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -2208,7 +2208,7 @@ MODULE_DESCRIPTION("i.MX SDMA driver"); #if IS_ENABLED(CONFIG_SOC_IMX6Q) MODULE_FIRMWARE("imx/sdma/sdma-imx6q.bin"); #endif -#if IS_ENABLED(CONFIG_SOC_IMX7D) +#if IS_ENABLED(CONFIG_SOC_IMX7D) || IS_ENABLED(CONFIG_SOC_IMX8M) MODULE_FIRMWARE("imx/sdma/sdma-imx7d.bin"); #endif MODULE_LICENSE("GPL"); From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 833D2C433EF for ; Mon, 11 Jul 2022 09:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbiGKJQo (ORCPT ); Mon, 11 Jul 2022 05:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbiGKJO7 (ORCPT ); Mon, 11 Jul 2022 05:14:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD1D3ED5B; Mon, 11 Jul 2022 02:10:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 75494611F3; Mon, 11 Jul 2022 09:10:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BCDAC34115; Mon, 11 Jul 2022 09:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530652; bh=FM/xnDTajo5tg/nDWYB6juALM7uDbh8bArFdijDwNc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b0FL3vVAenfMrTPG01pcEVayMOOmX2EQTAE8vCD9tqxRb5n2P/rJRT8CSgcBKHJd8 wrXQEXasm9pDZdJsQ98Ow1667qMCh0/xADkBooabmfmeUzE8qe0EArgNdIdmmOXR2v UGxfNv9qhVUaRA3tHcFBNew67WKChPtiUxT8bV94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , stable Subject: [PATCH 5.4 30/38] misc: rtsx_usb: fix use of dma mapped buffer for usb bulk transfer Date: Mon, 11 Jul 2022 11:07:12 +0200 Message-Id: <20220711090539.617023346@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuah Khan commit eb7f8e28420372787933eec079735c35034bda7d upstream. rtsx_usb driver allocates coherent dma buffer for urb transfers. This buffer is passed to usb_bulk_msg() and usb core tries to map already mapped buffer running into a dma mapping error. xhci_hcd 0000:01:00.0: rejecting DMA map of vmalloc memory WARNING: CPU: 1 PID: 279 at include/linux/dma-mapping.h:326 usb_ hcd_map_ur= b_for_dma+0x7d6/0x820 ... xhci_map_urb_for_dma+0x291/0x4e0 usb_hcd_submit_urb+0x199/0x12b0 ... usb_submit_urb+0x3b8/0x9e0 usb_start_wait_urb+0xe3/0x2d0 usb_bulk_msg+0x115/0x240 rtsx_usb_transfer_data+0x185/0x1a8 [rtsx_usb] rtsx_usb_send_cmd+0xbb/0x123 [rtsx_usb] rtsx_usb_write_register+0x12c/0x143 [rtsx_usb] rtsx_usb_probe+0x226/0x4b2 [rtsx_usb] Fix it to use kmalloc() to get DMA-able memory region instead. Signed-off-by: Shuah Khan Cc: stable Link: https://lore.kernel.org/r/667d627d502e1ba9ff4f9b94966df3299d2d3c0d.16= 56642167.git.skhan@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/misc/cardreader/rtsx_usb.c | 13 +++++++------ include/linux/rtsx_usb.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) --- a/drivers/misc/cardreader/rtsx_usb.c +++ b/drivers/misc/cardreader/rtsx_usb.c @@ -631,8 +631,7 @@ static int rtsx_usb_probe(struct usb_int =20 ucr->pusb_dev =3D usb_dev; =20 - ucr->iobuf =3D usb_alloc_coherent(ucr->pusb_dev, IOBUF_SIZE, - GFP_KERNEL, &ucr->iobuf_dma); + ucr->iobuf =3D kmalloc(IOBUF_SIZE, GFP_KERNEL); if (!ucr->iobuf) return -ENOMEM; =20 @@ -668,8 +667,9 @@ static int rtsx_usb_probe(struct usb_int =20 out_init_fail: usb_set_intfdata(ucr->pusb_intf, NULL); - usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf, - ucr->iobuf_dma); + kfree(ucr->iobuf); + ucr->iobuf =3D NULL; + ucr->cmd_buf =3D ucr->rsp_buf =3D NULL; return ret; } =20 @@ -682,8 +682,9 @@ static void rtsx_usb_disconnect(struct u mfd_remove_devices(&intf->dev); =20 usb_set_intfdata(ucr->pusb_intf, NULL); - usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf, - ucr->iobuf_dma); + kfree(ucr->iobuf); + ucr->iobuf =3D NULL; + ucr->cmd_buf =3D ucr->rsp_buf =3D NULL; } =20 #ifdef CONFIG_PM --- a/include/linux/rtsx_usb.h +++ b/include/linux/rtsx_usb.h @@ -55,7 +55,6 @@ struct rtsx_ucr { struct usb_interface *pusb_intf; struct usb_sg_request current_sg; unsigned char *iobuf; - dma_addr_t iobuf_dma; =20 struct timer_list sg_timer; struct mutex dev_mutex; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6CE0C433EF for ; Mon, 11 Jul 2022 09:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231636AbiGKJQr (ORCPT ); Mon, 11 Jul 2022 05:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbiGKJPI (ORCPT ); Mon, 11 Jul 2022 05:15:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A3BB3F303; Mon, 11 Jul 2022 02:10:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 221AE611E4; Mon, 11 Jul 2022 09:10:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30670C34115; Mon, 11 Jul 2022 09:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530655; bh=6P8CXs3MGbhhmsH5Oe+Hzg9axBWkQxRbYazFIsEe6KE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2KfbMVRbtVvFWdVWgAUgOwbrOKwlRNnd5ZYgtBhsz+a9Jfj76hxiKPewX/7p1Jad /GA0saStIx+DNZSYZi6473DJBFuamiVJ87Hzixxj5zcgtFCPPePwuHlolpVxwWcjA7 AuhW4JjaXVaU6Oc/837i5x15orZRdzm2Y/q87Q7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , stable Subject: [PATCH 5.4 31/38] misc: rtsx_usb: use separate command and response buffers Date: Mon, 11 Jul 2022 11:07:13 +0200 Message-Id: <20220711090539.645902748@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuah Khan commit 3776c78559853fd151be7c41e369fd076fb679d5 upstream. rtsx_usb uses same buffer for command and response. There could be a potential conflict using the same buffer for both especially if retries and timeouts are involved. Use separate command and response buffers to avoid conflicts. Signed-off-by: Shuah Khan Cc: stable Link: https://lore.kernel.org/r/07e3721804ff07aaab9ef5b39a5691d0718b9ade.16= 56642167.git.skhan@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/misc/cardreader/rtsx_usb.c | 26 +++++++++++++++++--------- include/linux/rtsx_usb.h | 1 - 2 files changed, 17 insertions(+), 10 deletions(-) --- a/drivers/misc/cardreader/rtsx_usb.c +++ b/drivers/misc/cardreader/rtsx_usb.c @@ -631,15 +631,18 @@ static int rtsx_usb_probe(struct usb_int =20 ucr->pusb_dev =3D usb_dev; =20 - ucr->iobuf =3D kmalloc(IOBUF_SIZE, GFP_KERNEL); - if (!ucr->iobuf) + ucr->cmd_buf =3D kmalloc(IOBUF_SIZE, GFP_KERNEL); + if (!ucr->cmd_buf) return -ENOMEM; =20 + ucr->rsp_buf =3D kmalloc(IOBUF_SIZE, GFP_KERNEL); + if (!ucr->rsp_buf) + goto out_free_cmd_buf; + usb_set_intfdata(intf, ucr); =20 ucr->vendor_id =3D id->idVendor; ucr->product_id =3D id->idProduct; - ucr->cmd_buf =3D ucr->rsp_buf =3D ucr->iobuf; =20 mutex_init(&ucr->dev_mutex); =20 @@ -667,9 +670,11 @@ static int rtsx_usb_probe(struct usb_int =20 out_init_fail: usb_set_intfdata(ucr->pusb_intf, NULL); - kfree(ucr->iobuf); - ucr->iobuf =3D NULL; - ucr->cmd_buf =3D ucr->rsp_buf =3D NULL; + kfree(ucr->rsp_buf); + ucr->rsp_buf =3D NULL; +out_free_cmd_buf: + kfree(ucr->cmd_buf); + ucr->cmd_buf =3D NULL; return ret; } =20 @@ -682,9 +687,12 @@ static void rtsx_usb_disconnect(struct u mfd_remove_devices(&intf->dev); =20 usb_set_intfdata(ucr->pusb_intf, NULL); - kfree(ucr->iobuf); - ucr->iobuf =3D NULL; - ucr->cmd_buf =3D ucr->rsp_buf =3D NULL; + + kfree(ucr->cmd_buf); + ucr->cmd_buf =3D NULL; + + kfree(ucr->rsp_buf); + ucr->rsp_buf =3D NULL; } =20 #ifdef CONFIG_PM --- a/include/linux/rtsx_usb.h +++ b/include/linux/rtsx_usb.h @@ -54,7 +54,6 @@ struct rtsx_ucr { struct usb_device *pusb_dev; struct usb_interface *pusb_intf; struct usb_sg_request current_sg; - unsigned char *iobuf; =20 struct timer_list sg_timer; struct mutex dev_mutex; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABFBECCA47B for ; Mon, 11 Jul 2022 09:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231642AbiGKJRH (ORCPT ); Mon, 11 Jul 2022 05:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbiGKJPv (ORCPT ); Mon, 11 Jul 2022 05:15:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E353F332; Mon, 11 Jul 2022 02:11:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FECCB80E76; Mon, 11 Jul 2022 09:10:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0543CC34115; Mon, 11 Jul 2022 09:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530658; bh=lh7AYL4Z8YvuRd3eo1vbbmlhCCo0hOo/6FSah1I1Stk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ttCFD4c1a39pDJZTyf2efmbF+298BJi+ya9f9hUXfLVv/W9h88iGk+AJ+IlA7j9ST tTn+L3F2cs7SYenZpLSoJEtJnqToGbxn7qHFMAL+UXOZ0qkN8Qtr4/wQS2pC8dW0Ka mzEz02yvb32zMH+uShWzgB2lGopM2ecJtlyTRxmk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , stable , Shuah Khan Subject: [PATCH 5.4 32/38] misc: rtsx_usb: set return value in rsp_buf alloc err path Date: Mon, 11 Jul 2022 11:07:14 +0200 Message-Id: <20220711090539.674421302@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuah Khan commit 2cd37c2e72449a7add6da1183d20a6247d6db111 upstream. Set return value in rsp_buf alloc error path before going to error handling. drivers/misc/cardreader/rtsx_usb.c:639:6: warning: variable 'ret' is used u= ninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!ucr->rsp_buf) ^~~~~~~~~~~~~ drivers/misc/cardreader/rtsx_usb.c:678:9: note: uninitialized use occurs= here return ret; ^~~ drivers/misc/cardreader/rtsx_usb.c:639:2: note: remove the 'if' if its c= ondition is always false if (!ucr->rsp_buf) ^~~~~~~~~~~~~~~~~~ drivers/misc/cardreader/rtsx_usb.c:622:9: note: initialize the variable = 'ret' to silence this warning int ret; ^ =3D 0 Fixes: 3776c7855985 ("misc: rtsx_usb: use separate command and response buf= fers") Reported-by: kernel test robot Cc: stable Signed-off-by: Shuah Khan Link: https://lore.kernel.org/r/20220701165352.15687-1-skhan@linuxfoundatio= n.org Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/misc/cardreader/rtsx_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/misc/cardreader/rtsx_usb.c +++ b/drivers/misc/cardreader/rtsx_usb.c @@ -636,8 +636,10 @@ static int rtsx_usb_probe(struct usb_int return -ENOMEM; =20 ucr->rsp_buf =3D kmalloc(IOBUF_SIZE, GFP_KERNEL); - if (!ucr->rsp_buf) + if (!ucr->rsp_buf) { + ret =3D -ENOMEM; goto out_free_cmd_buf; + } =20 usb_set_intfdata(intf, ucr); From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19501C433EF for ; Mon, 11 Jul 2022 09:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231571AbiGKJRK (ORCPT ); Mon, 11 Jul 2022 05:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbiGKJQJ (ORCPT ); Mon, 11 Jul 2022 05:16:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE50B402D3; Mon, 11 Jul 2022 02:11:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B565B611E4; Mon, 11 Jul 2022 09:11:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5C19C341C8; Mon, 11 Jul 2022 09:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530661; bh=NbA28TAuTrYYXJwoVDSHTqYmT/Qw5wS2/4IKKLTHgKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tM0QHUO9JcwG5tph6jByehwLFBPWc+0sn/9sw760NelnSEwjC7jtpYlCEZDSCdznD 64skqtpIb7al/AZoD2t87T9YUeyhetol1v40OrLdm3idbZDfsDCFBATSR+2MJIwZ6i DqelGZnXx9Tfe0r4BwMwY9QhZrjud+qfn5d+BH84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Rob Herring , Vinod Koul Subject: [PATCH 5.4 33/38] dt-bindings: dma: allwinner,sun50i-a64-dma: Fix min/max typo Date: Mon, 11 Jul 2022 11:07:15 +0200 Message-Id: <20220711090539.702563238@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland commit 607a48c78e6b427b0b684d24e61c19e846ad65d6 upstream. The conditional block for variants with a second clock should have set minItems, not maxItems, which was already 2. Since clock-names requires two items, this typo should not have caused any problems. Fixes: edd14218bd66 ("dt-bindings: dmaengine: Convert Allwinner A31 and A64= DMA to a schema") Signed-off-by: Samuel Holland Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20220702031903.21703-1-samuel@sholland.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml | 2= +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml +++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml @@ -58,7 +58,7 @@ if: then: properties: clocks: - maxItems: 2 + minItems: 2 =20 required: - clock-names From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A64A4CCA47B for ; Mon, 11 Jul 2022 09:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbiGKJR0 (ORCPT ); Mon, 11 Jul 2022 05:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbiGKJQv (ORCPT ); Mon, 11 Jul 2022 05:16:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00BC419A5; Mon, 11 Jul 2022 02:11:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01A9DB80E7D; Mon, 11 Jul 2022 09:11:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FC60C34115; Mon, 11 Jul 2022 09:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530663; bh=pnH5lEehIUM44wvMDE6bRQXu7DvPpP9hGwDhZSSbevE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=juunUKx2n5OJvqAf1p5OKk8yukskIn44ogTOoRfHZcedjGjWX6JhhXsEJQZ8Vh082 I+8jJ+qtjDKlsawwJJ/e8LWwMe3fU/hPui9Rg45jkW9T97hvsHlk2ldh41KMfM6TCI KefGzScCEX6CiaBMM29fmY2dBayBzFppf8JiDe9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Itay Iellin , Matthew Wilcox , Linus Torvalds Subject: [PATCH 5.4 34/38] ida: dont use BUG_ON() for debugging Date: Mon, 11 Jul 2022 11:07:16 +0200 Message-Id: <20220711090539.731118592@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Torvalds commit fc82bbf4dede758007763867d0282353c06d1121 upstream. This is another old BUG_ON() that just shouldn't exist (see also commit a382f8fee42c: "signal handling: don't use BUG_ON() for debugging"). In fact, as Matthew Wilcox points out, this condition shouldn't really even result in a warning, since a negative id allocation result is just a normal allocation failure: "I wonder if we should even warn here -- sure, the caller is trying to free something that wasn't allocated, but we don't warn for kfree(NULL)" and goes on to point out how that current error check is only causing people to unnecessarily do their own index range checking before freeing it. This was noted by Itay Iellin, because the bluetooth HCI socket cookie code does *not* do that range checking, and ends up just freeing the error case too, triggering the BUG_ON(). The HCI code requires CAP_NET_RAW, and seems to just result in an ugly splat, but there really is no reason to BUG_ON() here, and we have generally striven for allocation models where it's always ok to just do free(alloc()); even if the allocation were to fail for some random reason (usually obviously that "random" reason being some resource limit). Fixes: 88eca0207cf1 ("ida: simplified functions for id allocation") Reported-by: Itay Iellin Suggested-by: Matthew Wilcox Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- lib/idr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/lib/idr.c +++ b/lib/idr.c @@ -489,7 +489,8 @@ void ida_free(struct ida *ida, unsigned struct ida_bitmap *bitmap; unsigned long flags; =20 - BUG_ON((int)id < 0); + if ((int)id < 0) + return; =20 xas_lock_irqsave(&xas, flags); bitmap =3D xas_load(&xas); From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ACACC43334 for ; Mon, 11 Jul 2022 09:17:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbiGKJRU (ORCPT ); Mon, 11 Jul 2022 05:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231294AbiGKJQb (ORCPT ); Mon, 11 Jul 2022 05:16:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22015419AE; Mon, 11 Jul 2022 02:11:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34A156111F; Mon, 11 Jul 2022 09:11:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35116C34115; Mon, 11 Jul 2022 09:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530666; bh=ge0wnp6fSGz7SqrbQkCUtV3muHF6FHU9WwT/7CW4CLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZnehRTMOH10fZf1Dh0RC1ecsg4ej3+KZskl16O3FoIhZXE9ClrISFYixo8VwCs6N u9/Wg0+dh7JD48+y8K6ac8c1QsjareWpbaodeeTEaU5UZSzCCofyX2fTDg+C2Hk66O avp1nhj+GP/V7U9x0Lji5s+/7FuQmaoL+UmGml5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Vinod Koul Subject: [PATCH 5.4 35/38] dmaengine: pl330: Fix lockdep warning about non-static key Date: Mon, 11 Jul 2022 11:07:17 +0200 Message-Id: <20220711090539.759915114@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit b64b3b2f1d81f83519582e1feee87d77f51f5f17 upstream. The DEFINE_SPINLOCK() macro shouldn't be used for dynamically allocated spinlocks. The lockdep warns about this and disables locking validator. Fix the warning by making lock static. INFO: trying to register non-static key. The code is fine but needs lockdep annotation, or maybe you didn't initialize this object before use? turning off the locking correctness validator. Hardware name: Radxa ROCK Pi 4C (DT) Call trace: dump_backtrace.part.0+0xcc/0xe0 show_stack+0x18/0x6c dump_stack_lvl+0x8c/0xb8 dump_stack+0x18/0x34 register_lock_class+0x4a8/0x4cc __lock_acquire+0x78/0x20cc lock_acquire.part.0+0xe0/0x230 lock_acquire+0x68/0x84 _raw_spin_lock_irqsave+0x84/0xc4 add_desc+0x44/0xc0 pl330_get_desc+0x15c/0x1d0 pl330_prep_dma_cyclic+0x100/0x270 snd_dmaengine_pcm_trigger+0xec/0x1c0 dmaengine_pcm_trigger+0x18/0x24 ... Fixes: e588710311ee ("dmaengine: pl330: fix descriptor allocation fail") Signed-off-by: Dmitry Osipenko Link: https://lore.kernel.org/r/20220520181432.149904-1-dmitry.osipenko@col= labora.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/pl330.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2585,7 +2585,7 @@ static struct dma_pl330_desc *pl330_get_ =20 /* If the DMAC pool is empty, alloc new */ if (!desc) { - DEFINE_SPINLOCK(lock); + static DEFINE_SPINLOCK(lock); LIST_HEAD(pool); =20 if (!add_desc(&pool, &lock, GFP_ATOMIC, 1)) From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FB17C43334 for ; Mon, 11 Jul 2022 09:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231528AbiGKJRd (ORCPT ); Mon, 11 Jul 2022 05:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbiGKJRB (ORCPT ); Mon, 11 Jul 2022 05:17:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D02542AF7; Mon, 11 Jul 2022 02:11:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A7ACB80E5E; Mon, 11 Jul 2022 09:11:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9C03C34115; Mon, 11 Jul 2022 09:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530669; bh=7+wQWifZoehsBLdojVlQMAj1oNFB+5tvGwcAx1N7vNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAe//7fERabEjaNlEPcwMhqGqxB6t0gGlX6Xsyno2u9QW74aCl8bSTERLRljmV7wl 09D8KLwRLliFsq/+/VWnATwv/oSYDBlN6zcjxP7OSy45BPLQDU0VnJSWD/NkMjGBYx 2sN3GotkS9fbWUn5LjGR8gBpSOCDeCM2QbSoIBVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Vinod Koul Subject: [PATCH 5.4 36/38] dmaengine: at_xdma: handle errors of at_xdmac_alloc_desc() correctly Date: Mon, 11 Jul 2022 11:07:18 +0200 Message-Id: <20220711090539.789841287@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle commit 3770d92bd5237d686e49da7b2fb86f53ee6ed259 upstream. It seems that it is valid to have less than the requested number of descriptors. But what is not valid and leads to subsequent errors is to have zero descriptors. In that case, abort the probing. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended D= MA Controller driver") Signed-off-by: Michael Walle Link: https://lore.kernel.org/r/20220526135111.1470926-1-michael@walle.cc Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/at_xdmac.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1848,6 +1848,11 @@ static int at_xdmac_alloc_chan_resources for (i =3D 0; i < init_nr_desc_per_channel; i++) { desc =3D at_xdmac_alloc_desc(chan, GFP_ATOMIC); if (!desc) { + if (i =3D=3D 0) { + dev_warn(chan2dev(chan), + "can't allocate any descriptors\n"); + return -EIO; + } dev_warn(chan2dev(chan), "only %d descriptors have been allocated\n", i); break; From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D0BBC43334 for ; Mon, 11 Jul 2022 09:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231538AbiGKJRf (ORCPT ); Mon, 11 Jul 2022 05:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbiGKJRG (ORCPT ); Mon, 11 Jul 2022 05:17:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686D343E77; Mon, 11 Jul 2022 02:11:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 98EB46111F; Mon, 11 Jul 2022 09:11:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F620C34115; Mon, 11 Jul 2022 09:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530672; bh=us7sw7URxp75xenIgNQ7lFfzcoPjklJXCLOWqPPJNQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yNBkdIBO2AzO77DtsuSaowzBVY89AIuUwXPIsN6AHVsQO/7bC1ToRn/NoIjdpsVUX 7k0Z3cnLupApkQHa7DObcmXZ7lhJobwQVYnNc8OURV76Qba0E5zg33oUEYsyE8GiNb 2ljWYlBdM8YMTfwYtxLCL0OL+dV+haQdFQMJpI0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Vinod Koul Subject: [PATCH 5.4 37/38] dmaengine: ti: Fix refcount leak in ti_dra7_xbar_route_allocate Date: Mon, 11 Jul 2022 11:07:19 +0200 Message-Id: <20220711090539.818277812@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit c132fe78ad7b4ce8b5d49a501a15c29d08eeb23a upstream. of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not needed anymore. Add missing of_node_put() in to fix this. Fixes: ec9bfa1e1a79 ("dmaengine: ti-dma-crossbar: dra7: Use bitops instead = of idr") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220605042723.17668-2-linmq006@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/ti/dma-crossbar.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/dma/ti/dma-crossbar.c +++ b/drivers/dma/ti/dma-crossbar.c @@ -270,6 +270,7 @@ static void *ti_dra7_xbar_route_allocate mutex_unlock(&xbar->mutex); dev_err(&pdev->dev, "Run out of free DMA requests\n"); kfree(map); + of_node_put(dma_spec->np); return ERR_PTR(-ENOMEM); } set_bit(map->xbar_out, xbar->dma_inuse); From nobody Sat Apr 18 21:01:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AA9BC433EF for ; Mon, 11 Jul 2022 09:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbiGKJRn (ORCPT ); Mon, 11 Jul 2022 05:17:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbiGKJRJ (ORCPT ); Mon, 11 Jul 2022 05:17:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68DF14507B; Mon, 11 Jul 2022 02:11:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C548B80E76; Mon, 11 Jul 2022 09:11:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CD13C34115; Mon, 11 Jul 2022 09:11:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530674; bh=xLZOiuU/pXl1/j8USvLoYf6qp+A9l3h0Rl+n8ZdBK+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P5PG7QY8S5t0fvFcHTIXkBp6wT7oqZyKA6HqyM5A34r6spGN6K8VO02niR9SuJwns Ag4z6nQ2C2TS5Ne0r/3WzAW6uj0Q8p+kB+BMgBKR0hSZ7XgadgjW2xIS8fifo33g64 l+cA7qFd7bQhOnvPYos5v5TaZ+2qZPuk5AEfflqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Peter Ujfalusi , Vinod Koul Subject: [PATCH 5.4 38/38] dmaengine: ti: Add missing put_device in ti_dra7_xbar_route_allocate Date: Mon, 11 Jul 2022 11:07:20 +0200 Message-Id: <20220711090539.846431997@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 615a4bfc426e11dba05c2cf343f9ac752fb381d2 upstream. of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Fixes: a074ae38f859 ("dmaengine: Add driver for TI DMA crossbar on DRA7x") Signed-off-by: Miaoqian Lin Acked-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20220605042723.17668-1-linmq006@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/dma/ti/dma-crossbar.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/dma/ti/dma-crossbar.c +++ b/drivers/dma/ti/dma-crossbar.c @@ -247,6 +247,7 @@ static void *ti_dra7_xbar_route_allocate if (dma_spec->args[0] >=3D xbar->xbar_requests) { dev_err(&pdev->dev, "Invalid XBAR request number: %d\n", dma_spec->args[0]); + put_device(&pdev->dev); return ERR_PTR(-EINVAL); } =20 @@ -254,12 +255,14 @@ static void *ti_dra7_xbar_route_allocate dma_spec->np =3D of_parse_phandle(ofdma->of_node, "dma-masters", 0); if (!dma_spec->np) { dev_err(&pdev->dev, "Can't get DMA master\n"); + put_device(&pdev->dev); return ERR_PTR(-EINVAL); } =20 map =3D kzalloc(sizeof(*map), GFP_KERNEL); if (!map) { of_node_put(dma_spec->np); + put_device(&pdev->dev); return ERR_PTR(-ENOMEM); } =20 @@ -271,6 +274,7 @@ static void *ti_dra7_xbar_route_allocate dev_err(&pdev->dev, "Run out of free DMA requests\n"); kfree(map); of_node_put(dma_spec->np); + put_device(&pdev->dev); return ERR_PTR(-ENOMEM); } set_bit(map->xbar_out, xbar->dma_inuse);