From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FB4922B6A2; Sun, 24 Mar 2024 23:50:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324217; cv=none; b=tdGvid4+uPb/l0PA7XEzeDYuWBFt0J+5e5CF3b8GcA80M3ULoXprVmJHWwbiPhUnes/9ETaXbmGlcHm0HFILZX2Lh+rfuaQJBgAHdqMZuCUKi2qFrkQzZptA18bmiNs11WyfUXn3ZZ+dfXOnnrL09tAjKtB8Fg75GWFKZO40z54= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324217; c=relaxed/simple; bh=3ModxzCcpUG0d9LbmghcwvwYJku55QFxYGr7tgIyJy8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P/vLIEVC8o6ebsh66WQMPaqctQaWPZ5RGcgd8qvlgUUAv79tkEDFtiCDoipc0Ev01dw9OydMnjIWDOnrVPS5mfR4K6HRN8lzb1NrKTgQvf5TphkC2XmOaG5Gj3B4Uqsa7lDWvWC2X4ViXYmjhFUizoI9cMaHpP4AFY5waAFgKbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jZJiBN4J; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jZJiBN4J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BD50C433C7; Sun, 24 Mar 2024 23:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324216; bh=3ModxzCcpUG0d9LbmghcwvwYJku55QFxYGr7tgIyJy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jZJiBN4JSNLWjwpLeZZGzj6wPvjsy9UwqCGUGpVRxfjjN/wSASBvy9n0J0rJok/q9 O/ILeP+Z7BnILvI0smqNBDZcJUBkCBBEiraGn531e0J2G9nkRHXSjLfv7kyopcecpO Kk11MWzft34/9YN1NfnmVysGJbx4sZkBj2PJ6Gk3dJosjHWEulE8zWNsKoVZZv0oeV +lQJW69RM6uIKPHNTEqptDriQJghjz5BZcMBu9cOc3AEBF5d/6qxbhLui5xb/HiCJF xnPhrct8gwt5uWElfWUakSgNjTVOElhYIJRMdRsnJwSiGS769Q/fHD/WKqb239fmDh QlDAnhdjTf7ZQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Mark Brown , Sasha Levin Subject: [PATCH 4.19 001/148] ASoC: rt5645: Make LattePanda board DMI match more precise Date: Sun, 24 Mar 2024 19:47:45 -0400 Message-ID: <20240324235012.1356413-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 551539a8606e28cb2a130f8ef3e9834235b456c4 ] The DMI strings used for the LattePanda board DMI quirks are very generic. Using the dmidecode database from https://linux-hardware.org/ shows that the chosen DMI strings also match the following 2 laptops which also have a rt5645 codec: Insignia NS-P11W7100 https://linux-hardware.org/?computer=3DE092FFF8BA04 Insignia NS-P10W8100 https://linux-hardware.org/?computer=3DAFB6C0BF7934 All 4 hw revisions of the LattePanda board have "S70CR" in their BIOS version DMI strings: DF-BI-7-S70CR100-* DF-BI-7-S70CR110-* DF-BI-7-S70CR200-* LP-BS-7-S70CR700-* See e.g. https://linux-hardware.org/?computer=3DD98250A817C0 Add a partial (non exact) DMI match on this string to make the LattePanda board DMI match more precise to avoid false-positive matches. Signed-off-by: Hans de Goede Link: https://msgid.link/r/20240211212736.179605-1-hdegoede@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt5645.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 5ec6e9f251c5b..5f23369d7ccad 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3797,6 +3797,16 @@ static const struct dmi_system_id dmi_platform_data[= ] =3D { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), DMI_EXACT_MATCH(DMI_BOARD_VERSION, "Default string"), + /* + * Above strings are too generic, LattePanda BIOS versions for + * all 4 hw revisions are: + * DF-BI-7-S70CR100-* + * DF-BI-7-S70CR110-* + * DF-BI-7-S70CR200-* + * LP-BS-7-S70CR700-* + * Do a partial match for S70CR to avoid false positive matches. + */ + DMI_MATCH(DMI_BIOS_VERSION, "S70CR"), }, .driver_data =3D (void *)&lattepanda_board_platform_data, }, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BD0113C8EC; Sun, 24 Mar 2024 23:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324220; cv=none; b=InjePGCBjJUOs2WDX1KJVx6gG/Xc//Oiwi50PMqJyAt3yMl1H/L+nGScThaFg8Hs3ZA3pRNJFgMZuJ7qY+Y1xCRNkkGcHH4b8Y4iMFUmk13aGRZqJELnZzPl5VTNrTuTdvDF3gNsHOckg2xMFLkEGdFFvSaEFwYe2Qze+7176Qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324220; c=relaxed/simple; bh=KXobGiOoIaXzXOXJJJNhZJEIoAnZhnUZnhGA9Ii+OtU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CCiJq82SkIRVMEekP1FH6wK59vp5lDmIIgWbY1UPSsa/XfpyrCawoXtPRScKpx4cWD6VdAHM5hiMHVooAOG+A7Tzc4QqDBTowCkHdyExunCaeOd0EX3IWjIApd+00V4an0WM1GT1hHlTe9w7lLwD/NphWPLvYvUZz+JszbQImAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mnhHeOvO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mnhHeOvO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 363E1C43399; Sun, 24 Mar 2024 23:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324219; bh=KXobGiOoIaXzXOXJJJNhZJEIoAnZhnUZnhGA9Ii+OtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnhHeOvOaz36TSZHzWTyITyAYQoi9ZDhVgkRiOu/yoqqzKeNU/kAI8cJGubNIHyIQ KraJDITnxRu8ep093PQmUFqYT+I8wV3a3RR829/mX61HA1pWTpTDr2WZdQxXB6RHUD EBV3lU6AQF6wJrwaf5C0csj2ceJUn35UHcmt20nj/2bJaPY/aBByUHz3a7JFxYgI0Y zapTy4aQ+/ApboD8KU+HTpLzl7c2rJp85W0tuOMFlQK/+kqjoSPHKvmbRhVnL9KYcn BW7qE9hBS9w+e/1MwUaxOsR5G0k2FJKBuRW0U0fxdUxL652BGKW7GNuO8Vcb4uqhkR rHwQ3Z8sNSJVA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kunwu Chan , kernel test robot , Markus Elfring , Juergen Gross , Sasha Levin Subject: [PATCH 4.19 002/148] x86/xen: Add some null pointer checking to smp.c Date: Sun, 24 Mar 2024 19:47:46 -0400 Message-ID: <20240324235012.1356413-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kunwu Chan [ Upstream commit 3693bb4465e6e32a204a5b86d3ec7e6b9f7e67c2 ] kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity. Signed-off-by: Kunwu Chan Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202401161119.iof6BQsf-lkp@int= el.com/ Suggested-by: Markus Elfring Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20240119094948.275390-1-chentao@kylinos.cn Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- arch/x86/xen/smp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index a1cc855c539c1..a76ba342a6695 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -65,6 +65,8 @@ int xen_smp_intr_init(unsigned int cpu) char *resched_name, *callfunc_name, *debug_name; =20 resched_name =3D kasprintf(GFP_KERNEL, "resched%d", cpu); + if (!resched_name) + goto fail_mem; per_cpu(xen_resched_irq, cpu).name =3D resched_name; rc =3D bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu, @@ -77,6 +79,8 @@ int xen_smp_intr_init(unsigned int cpu) per_cpu(xen_resched_irq, cpu).irq =3D rc; =20 callfunc_name =3D kasprintf(GFP_KERNEL, "callfunc%d", cpu); + if (!callfunc_name) + goto fail_mem; per_cpu(xen_callfunc_irq, cpu).name =3D callfunc_name; rc =3D bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, cpu, @@ -90,6 +94,9 @@ int xen_smp_intr_init(unsigned int cpu) =20 if (!xen_fifo_events) { debug_name =3D kasprintf(GFP_KERNEL, "debug%d", cpu); + if (!debug_name) + goto fail_mem; + per_cpu(xen_debug_irq, cpu).name =3D debug_name; rc =3D bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, @@ -101,6 +108,9 @@ int xen_smp_intr_init(unsigned int cpu) } =20 callfunc_name =3D kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); + if (!callfunc_name) + goto fail_mem; + per_cpu(xen_callfuncsingle_irq, cpu).name =3D callfunc_name; rc =3D bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, cpu, @@ -114,6 +124,8 @@ int xen_smp_intr_init(unsigned int cpu) =20 return 0; =20 + fail_mem: + rc =3D -ENOMEM; fail: xen_smp_intr_free(cpu); return rc; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05568181D0A; Sun, 24 Mar 2024 23:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324221; cv=none; b=swP4X6fJYHHe+hebB8h+QF/L+s8tn2z7gubv94rU0bis6hOsrsM/EVR4XVhnez4wtInB0bLywy+iWt92N+ZF1GWPHBFKVP9+XThq6Bk2XaeYI1LirfNUqVkcbLJWHH5/nL2tg22fy6uVIOm5OGwM3q6/9O18aNY+zm47pxCxP5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324221; c=relaxed/simple; bh=/nChahqELmINXvbQzfOoAMqupqs+JnDqhzIcM9K/gI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ngqkYV5XFG7I8zR5ppc8aovrc5/a1iDJUapmPnR1bnvY8UZFIXDBxWQzhcCx3VQswWmL3FHiI+ZFIe8XcI9UzPWx3Q+klH+n6T/BVfBFJbYL38GMIz2e9l6hWHRnXMUm6GJBCZ08U8fQRkCi8Tisk1SknXtbL/mdf94cb9XLz88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pgfAWwYZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pgfAWwYZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 401ACC433F1; Sun, 24 Mar 2024 23:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324219; bh=/nChahqELmINXvbQzfOoAMqupqs+JnDqhzIcM9K/gI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pgfAWwYZGbIJE12neJQOZJQckuLLTebkE/wQJJBgPsFrC5grSXmQUxEd+r/sUcssA 0EUzAwueRJ9Xf6nBta74fLX51q542KgCDA7Dk3CNgs0carUZ77lDbEt9Pqc0OdXOQ6 vYqUSqPbnAaBerDYdYuTHHQR5enJNZYhhRk/gv3y7WvkbfDtDiKDoR4OEIiL0NeEaL Iaov/2zgGzK2pKuVuTdGbdED2gwYMI2sZqmQ9baBCywB71gKcqaMUyr9f6a//vY6PR hEU/B/1dAYF/USaaKJKWpzzOf1FwVLOl7oCqKMHvEA5dEZulWWV/aXxYmUIwCSCg/K YyoLju+FqUggg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jiaxun Yang , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 4.19 003/148] MIPS: Clear Cause.BD in instruction_pointer_set Date: Sun, 24 Mar 2024 19:47:47 -0400 Message-ID: <20240324235012.1356413-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jiaxun Yang [ Upstream commit 9d6e21ddf20293b3880ae55b9d14de91c5891c59 ] Clear Cause.BD after we use instruction_pointer_set to override EPC. This can prevent exception_epc check against instruction code at new return address. It won't be considered as "in delay slot" after epc being overridden anyway. Signed-off-by: Jiaxun Yang Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/include/asm/ptrace.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h index b6578611dddbf..e45c082e12316 100644 --- a/arch/mips/include/asm/ptrace.h +++ b/arch/mips/include/asm/ptrace.h @@ -65,6 +65,7 @@ static inline void instruction_pointer_set(struct pt_regs= *regs, unsigned long val) { regs->cp0_epc =3D val; + regs->cp0_cause &=3D ~CAUSEF_BD; } =20 /* Query offset/name of register from its name/offset */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 105551836C9; Sun, 24 Mar 2024 23:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324222; cv=none; b=uVSktg+/pePFvlgVIOqEXKj0j7pSCaQSTGCM96YR/4HIY5QnbF85TeJlhUpvZoWmUPTwRoHr9IK125x3+VxwRLQL+gEkonT5jzUzmStrg/4sSMwNhgiFVbHIbboQI/J5IO7uLoYnkKLzkBpKjp5b0/Pgf1Ys3zkIWu8/o8b/Yyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324222; c=relaxed/simple; bh=1jDYd53jim3o+DnL/gcsQfkGwzdeqRP4MNNLaXnXoPo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b0btKCZAvyxrqiUkIRRz3CYEq8/nHvvpFS9mzv4f65rwfIxDUi59bf8nGVvfBrLSqUxMpoH8KgjengahFff+YiAM2D/uL6KK6zsilX7iAqW/SbJ1JcTNwk7pNkfpeoPB3kpsKIBldPoJRyCbho1GfWx8bK0gAhMGY8OPDjW9guM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eE90f+GV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eE90f+GV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35EFAC433C7; Sun, 24 Mar 2024 23:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324220; bh=1jDYd53jim3o+DnL/gcsQfkGwzdeqRP4MNNLaXnXoPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eE90f+GVztFPnhnvyxNuiScDGmZ7CuSJztlUZSUnhlRLmYLlMnb+KAL8xMetCs8Uj hoY5d1Pumcr+AAV9YN0JvKm6kyHgom0NK4oswFL3ykuKjpwa5nlkSe6IbNL+dwdgq+ 2KmsJAUQ87VAoQwomFx1e5HuiEmJAR0anAIg7Dtj+e18YG604MsM8xu8ToGDCHU9R3 OlorhczTcT6h3HU4rNUlImuEhi6Cy2EoZyO+ghz0hoTZeJqO2e374CmSjjQ9XhIrRN E6Ls2MjJ//hkxqIfNKJ/pv53n8Z59w/43WL3ZDdOmp/7CUst4q2U3UUOMDNTATcjjv T41sE7iy5Aivw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexander Gordeev , Alexandra Winter , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 004/148] net/iucv: fix the allocation size of iucv_path_table array Date: Sun, 24 Mar 2024 19:47:48 -0400 Message-ID: <20240324235012.1356413-5-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit b4ea9b6a18ebf7f9f3a7a60f82e925186978cfcf ] iucv_path_table is a dynamically allocated array of pointers to struct iucv_path items. Yet, its size is calculated as if it was an array of struct iucv_path items. Signed-off-by: Alexander Gordeev Reviewed-by: Alexandra Winter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/iucv/iucv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c index aacaa5119b456..da4cee91fc63d 100644 --- a/net/iucv/iucv.c +++ b/net/iucv/iucv.c @@ -192,7 +192,7 @@ static char iucv_error_pathid[16] =3D "INVALID PATHID"; static LIST_HEAD(iucv_handler_list); =20 /* - * iucv_path_table: an array of iucv_path structures. + * iucv_path_table: array of pointers to iucv_path structures. */ static struct iucv_path **iucv_path_table; static unsigned long iucv_max_pathid; @@ -603,7 +603,7 @@ static int iucv_enable(void) =20 get_online_cpus(); rc =3D -ENOMEM; - alloc_size =3D iucv_max_pathid * sizeof(struct iucv_path); + alloc_size =3D iucv_max_pathid * sizeof(*iucv_path_table); iucv_path_table =3D kzalloc(alloc_size, GFP_KERNEL); if (!iucv_path_table) goto out; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62FD71836D8; Sun, 24 Mar 2024 23:50:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324223; cv=none; b=qsaA7cyeiZhcS6gArMj7XztheBdFJDEaqAFV/8AFb/S8wnhT/JWvq+VMP+X4eW1z0oTWbc2Dv1+wb6jKi+G3j6WGXzDKeNwF8RSBk3w9PqnyFcnbjQ0hJzpSXSUEzzL56dH/RfIFS4Yy2LNZ+n7SOqZFIStn9K/rBnsFBqC/RFQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324223; c=relaxed/simple; bh=pPqTwLB7TLaUTeD8LOWSvUk2b+PMhg//U8wFczNoAVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PCHAqgwgYWBTQR7ZH9qaM6gEsUYeMiZzcU1NkymnWbd9fxzJ7GF5EwNrInxhYP+BJA9mpAxlk/QXCC/HaxnDkm05B2VvTcgJX90AvM8hFq0FpL+PLwf1E4Rkq4WD7WjjbWRiP65zuyKcXMznd79nzUCKSlIOT7mWj03D4dHn2YY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QEnzQu0e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QEnzQu0e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35D1DC433F1; Sun, 24 Mar 2024 23:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324221; bh=pPqTwLB7TLaUTeD8LOWSvUk2b+PMhg//U8wFczNoAVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QEnzQu0eDIgMMy8LR43mfGcZPFswBf3Lryc8MB1tXtTxgX9up+RSYT9IcAetIwtNy ruZ7ayw181ByaHBuAPwUDDElcRny7kbdHyXLKVWJUWUM5v2txIrO5/SANm2tLeeDKQ X2p/ayyEp1uhvuWjLDCaoN8DAanbyDCe8maIScJQOY8ATV9pmrZ5Ufbs+LaulUXC4h Ldyv7VEgjR5QlpbEVxMkIfvhivTgxR4ykPcnG22FS7Yxr6RMzaOTeh3gGqZg3sM+S2 SNxAXVXDKez61nOhjB5d0iNf46/B/owh+tLVKRCMyp278rkdfXELaeZi/jKHl+A1HC CkTYtRpC5I6mQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Joyce , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 005/148] block: sed-opal: handle empty atoms when parsing response Date: Sun, 24 Mar 2024 19:47:49 -0400 Message-ID: <20240324235012.1356413-6-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Greg Joyce [ Upstream commit 5429c8de56f6b2bd8f537df3a1e04e67b9c04282 ] The SED Opal response parsing function response_parse() does not handle the case of an empty atom in the response. This causes the entry count to be too high and the response fails to be parsed. Recognizing, but ignoring, empty atoms allows response handling to succeed. Signed-off-by: Greg Joyce Link: https://lore.kernel.org/r/20240216210417.3526064-2-gjoyce@linux.ibm.c= om Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/opal_proto.h | 1 + block/sed-opal.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block/opal_proto.h b/block/opal_proto.h index e20be82588542..2456b8adc4574 100644 --- a/block/opal_proto.h +++ b/block/opal_proto.h @@ -73,6 +73,7 @@ enum opal_response_token { #define SHORT_ATOM_BYTE 0xBF #define MEDIUM_ATOM_BYTE 0xDF #define LONG_ATOM_BYTE 0xE3 +#define EMPTY_ATOM_BYTE 0xFF =20 #define OPAL_INVAL_PARAM 12 #define OPAL_MANUFACTURED_INACTIVE 0x08 diff --git a/block/sed-opal.c b/block/sed-opal.c index 9651c40e093a5..7c7cd27411541 100644 --- a/block/sed-opal.c +++ b/block/sed-opal.c @@ -844,16 +844,20 @@ static int response_parse(const u8 *buf, size_t lengt= h, token_length =3D response_parse_medium(iter, pos); else if (pos[0] <=3D LONG_ATOM_BYTE) /* long atom */ token_length =3D response_parse_long(iter, pos); + else if (pos[0] =3D=3D EMPTY_ATOM_BYTE) /* empty atom */ + token_length =3D 1; else /* TOKEN */ token_length =3D response_parse_token(iter, pos); =20 if (token_length < 0) return token_length; =20 + if (pos[0] !=3D EMPTY_ATOM_BYTE) + num_entries++; + pos +=3D token_length; total -=3D token_length; iter++; - num_entries++; } =20 if (num_entries =3D=3D 0) { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E86671836E0; Sun, 24 Mar 2024 23:50:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324224; cv=none; b=BZ1euEApya7vBR5rl8wDoC4dU2+BK2UVyYcnoz/WyAhPGFuEMqfOoRRH92GmBD807V4HHIhwLqdPOsQ1DEdixSsZt65Puwb4nuGL09Sv+FNlwk6PJd/4zCowQkOiwCd0wVCjBQVCAwQi6w6rsc4M8xZyX7l5CyAlnMATbK+fz+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324224; c=relaxed/simple; bh=cubP+c0OUfdvbOgQY+o8BUv8QtzcIjoJECvSJtCfpII=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRlG1G0TJqGVhzV1FrsP1gzkzH4gP8AQ/DL/l8ErVR1uKd5h+tpFaYWGYSyhLtkpqffnHx9koglQZFrhGvfOMADKPARmm5WWI4E3IDbx+jXeCGo3GkMPq7B44NKIxxifd8NKRjuLeLWAzNwQpwf2a9OOsirIfsPk56ouEL6OciQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s2H8Sf6L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s2H8Sf6L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E9A2C43394; Sun, 24 Mar 2024 23:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324222; bh=cubP+c0OUfdvbOgQY+o8BUv8QtzcIjoJECvSJtCfpII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s2H8Sf6L1lXL7fSB+i5LCydkU2jTvxVNVj6pPUuTqAuKleLggK3SocDvpXqAdaxBg hlnhlLDT8amTicB27C5gGTMh+GJiv6SpRH7Tx2/Y6U2LJepo3HJrVWUO/pxioNyeZW RtsGgfDFVVvn6HsFjBlw6OoaousjNBvDUPhOaNT4A7x6YMm/v3IimSnxjazjrQe1RZ 6kHnKw0z35XNcpv6qvb76KixR4jmeStVd0QTmetY1Q9EMirIgqVJobtWniX2UHzgQX b20W5Q+PNE/XxTty7hOt+TZdem2qSj0usxLFaZ0bjQVzSJD7rPYzOWkp1YD+uEEjgL DY0t+Gw0cZ1eg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 4.19 006/148] dm-verity, dm-crypt: align "struct bvec_iter" correctly Date: Sun, 24 Mar 2024 19:47:50 -0400 Message-ID: <20240324235012.1356413-7-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit 787f1b2800464aa277236a66eb3c279535edd460 ] "struct bvec_iter" is defined with the __packed attribute, so it is aligned on a single byte. On X86 (and on other architectures that support unaligned addresses in hardware), "struct bvec_iter" is accessed using the 8-byte and 4-byte memory instructions, however these instructions are less efficient if they operate on unaligned addresses. (on RISC machines that don't have unaligned access in hardware, GCC generates byte-by-byte accesses that are very inefficient - see [1]) This commit reorders the entries in "struct dm_verity_io" and "struct convert_context", so that "struct bvec_iter" is aligned on 8 bytes. [1] https://lore.kernel.org/all/ZcLuWUNRZadJr0tQ@fedora/T/ Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-crypt.c | 4 ++-- drivers/md/dm-verity.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 569904f73994a..95ed46930a90e 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -46,11 +46,11 @@ struct convert_context { struct completion restart; struct bio *bio_in; - struct bio *bio_out; struct bvec_iter iter_in; + struct bio *bio_out; struct bvec_iter iter_out; - u64 cc_sector; atomic_t cc_pending; + u64 cc_sector; union { struct skcipher_request *req; struct aead_request *req_aead; diff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h index 6e65ec0e627a6..04ef89e318564 100644 --- a/drivers/md/dm-verity.h +++ b/drivers/md/dm-verity.h @@ -72,11 +72,11 @@ struct dm_verity_io { /* original value of bio->bi_end_io */ bio_end_io_t *orig_bi_end_io; =20 + struct bvec_iter iter; + sector_t block; unsigned n_blocks; =20 - struct bvec_iter iter; - struct work_struct work; =20 /* --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFCC11836C8; Sun, 24 Mar 2024 23:50:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324223; cv=none; b=FjnATCIw8m2daBAG/bSQOgZSlqquxt+C9EbpZS2FnU4gPVZd6jSiQ722209ZWqMxr9MAhY7/DQLR90JT37/fTzJChvAF1YeG1FgE6VHdWnV3669QUr7JEJuynWcCTfrJXFSWLuETgSPNOaQkOtOUrAr1u9UeYa86Ba/7g9CAsYQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324223; c=relaxed/simple; bh=paOHW1kIZrwXOBOt+eRefXVJRjuNEshaUz8HY4Qj0Ms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J1AtcUacJrbmZ4jyYcWJyRBLtZzSMHuBtsiu4MbqpzQqFaysPfLO/BWLCAAQ6NBsnw739GsS9m9qJB56t7TfVBCQtdikpv9igvzLloRT6OP6ADzkIYlXMnMQGfs0NiWHgjTKIAqSUdJPXqX8Iutx5X2CNyV3aRS5+4Zuxa81Tpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PArOGCLX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PArOGCLX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15640C433C7; Sun, 24 Mar 2024 23:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324223; bh=paOHW1kIZrwXOBOt+eRefXVJRjuNEshaUz8HY4Qj0Ms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PArOGCLXf/SXW/MASWdAIdee/OMuosdoNqKwQr/xADF72ZbMZupMTEJoi41zz/kzy 8JGdDS2QJk1XOZrvW/+b93nNT3vlHd1SnC5vea3q3lrQVy9F+bsh9Izu1yGivT/fP5 CLon2djfsNhl0mK/0917tJnfZ1JoC70baxs6Rx4AyEjmWF4po2hrT+Ebdz4hHDDmWM sLTFxZUFSA5j1kvt/0QfYQSHhKTVRFAZ9Nb3AYdO+qVaJdyiY/IaS89jHYnQ5X9Z04 obTcokdnpcgKMLJF6NPDJqna0R2UxqhqMoEXk/WcciUqeeQ6stkTejEObnaVaJ5Y7c s/fP1jvC1kGcg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ranjan Kumar , "Martin K . Petersen" , Sasha Levin Subject: [PATCH 4.19 007/148] scsi: mpt3sas: Prevent sending diag_reset when the controller is ready Date: Sun, 24 Mar 2024 19:47:51 -0400 Message-ID: <20240324235012.1356413-8-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ranjan Kumar [ Upstream commit ee0017c3ed8a8abfa4d40e42f908fb38c31e7515 ] If the driver detects that the controller is not ready before sending the first IOC facts command, it will wait for a maximum of 10 seconds for it to become ready. However, even if the controller becomes ready within 10 seconds, the driver will still issue a diagnostic reset. Modify the driver to avoid sending a diag reset if the controller becomes ready within the 10-second wait time. Signed-off-by: Ranjan Kumar Link: https://lore.kernel.org/r/20240221071724.14986-1-ranjan.kumar@broadco= m.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/mpt3sas/mpt3sas_base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt= 3sas_base.c index 447ac667f4b2b..7588c2c11a879 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -5584,7 +5584,9 @@ _base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, = int timeout) return -EFAULT; } =20 - issue_diag_reset: + return 0; + +issue_diag_reset: rc =3D _base_diag_reset(ioc); return rc; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1FCA1836E7; Sun, 24 Mar 2024 23:50:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324224; cv=none; b=W4bi0tnzGQVNp7ZpV642BYIfFZhFdtBksxEJUcyGks/82JI5T39xEeF12f9LLBX3uUzzlzGgoYF0pX7lGhPNlwXA5e+wp9pcB0POGZLoJLW8Ya82lxI1pfgV74eVQde8qZcMAxW2wddAXhtlWgV8emD/AzWXUohzYpKH+3Iufcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324224; c=relaxed/simple; bh=+Edrx2XfKxPuOmgT1J/mjBl3Z5EuYP0xs8ERWYUbd6A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NWn/IOHFq430TfAc0Ex+nCeVd8PwTM2TR3FhrmKa4GsKUzHHmdRKvUWBlX1jrZKmpKVUV0AqN7m4pTy/za5ai0VJnUBtyQUZBoiCJ+YcS2AbpRvGZrcb+Lpu/lBbnQTZtTHAiqkEG+yKXCQcNIWPo1I78ygEG1VZUyVxaLS4YNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MNS0mxck; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MNS0mxck" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F13E8C43399; Sun, 24 Mar 2024 23:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324224; bh=+Edrx2XfKxPuOmgT1J/mjBl3Z5EuYP0xs8ERWYUbd6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNS0mxckh3PhX2JDY5jWMgjJbWcTx56fzVMebAPiewHrTFhlzUhm5xs4fjHCqjWQ3 8fkhOdJnjZHz8oNCl3DkHtNvAkXzgBuHF2DyYs5uWoBtbtXrbL0skUigub4biKyA92 1Z3wSohXXRhIDcWeZRuzwO2ieqG5AwGUlqAECt62J08VIfhwcyXGp6YCdPpsoxE1E2 gy415X1l+Nsqk9+UcsLNvCJEEtf7TkYAUAQcZ4m12xSDXB2CIoB0p87xg+8CN5L2Qw UkCD1mCAwVzFsiNsunBbiko9gu108pJf10HSbyw87D63Mt08OdS+78magn1//8fY9z TL2LULP10uJFw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yuxuan Hu <20373622@buaa.edu.cn>, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 4.19 008/148] Bluetooth: rfcomm: Fix null-ptr-deref in rfcomm_check_security Date: Sun, 24 Mar 2024 19:47:52 -0400 Message-ID: <20240324235012.1356413-9-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yuxuan Hu <20373622@buaa.edu.cn> [ Upstream commit 2535b848fa0f42ddff3e5255cf5e742c9b77bb26 ] During our fuzz testing of the connection and disconnection process at the RFCOMM layer, we discovered this bug. By comparing the packets from a normal connection and disconnection process with the testcase that triggered a KASAN report. We analyzed the cause of this bug as follows: 1. In the packets captured during a normal connection, the host sends a `Read Encryption Key Size` type of `HCI_CMD` packet (Command Opcode: 0x1408) to the controller to inquire the length of encryption key.After receiving this packet, the controller immediately replies with a Command Completepacket (Event Code: 0x0e) to return the Encryption Key Size. 2. In our fuzz test case, the timing of the controller's response to this packet was delayed to an unexpected point: after the RFCOMM and L2CAP layers had disconnected but before the HCI layer had disconnected. 3. After receiving the Encryption Key Size Response at the time described in point 2, the host still called the rfcomm_check_security function. However, by this time `struct l2cap_conn *conn =3D l2cap_pi(sk)->chan->conn= ;` had already been released, and when the function executed `return hci_conn_security(conn->hcon, d->sec_level, auth_type, d->out);`, specifically when accessing `conn->hcon`, a null-ptr-deref error occurred. To fix this bug, check if `sk->sk_state` is BT_CLOSED before calling rfcomm_recv_frame in rfcomm_process_rx. Signed-off-by: Yuxuan Hu <20373622@buaa.edu.cn> Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/rfcomm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 86edf512d4971..b2e69500439c9 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -1939,7 +1939,7 @@ static struct rfcomm_session *rfcomm_process_rx(struc= t rfcomm_session *s) /* Get data directly from socket receive queue without copying it. */ while ((skb =3D skb_dequeue(&sk->sk_receive_queue))) { skb_orphan(skb); - if (!skb_linearize(skb)) { + if (!skb_linearize(skb) && sk->sk_state !=3D BT_CLOSED) { s =3D rfcomm_recv_frame(s, skb); if (!s) break; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFED81836E2; Sun, 24 Mar 2024 23:50:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324225; cv=none; b=GfBoURjzNn5E2dhtsHHv2pCAjtPBRK3dyfr+DPxee7FCXSDhUjzt3bYvtmxCpVhA/LWtrdgVYIme+jtgWvppSeOPXbcggc+nwnSdXeGkRr0V8F3D6IUciqRFzPgIYhdXMQF7fBisOWF98D/tbY1mQUEnCdyeuH6rGPlYQAFU0TI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324225; c=relaxed/simple; bh=kXACYfDvNXWJZ25333pEuC5/kN5XG42wdVPy74Tagjk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rorfKXsR34Dmfea03qdyGecbcDlRhwcnJzSYG7m6LkIv8odfbkko1na8ltx1MP9HcbuLcejH4+6ssPskCW5uQv/iKLDDyGyvBnFrY58zsMX5ZaoKg/odFFcpkTEVsV+NGI1Q12ZPs2MKPnqC00F8WB3eJ0wiI8BCtHdx4MKXlps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eSWFcCfD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eSWFcCfD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0245C433F1; Sun, 24 Mar 2024 23:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324225; bh=kXACYfDvNXWJZ25333pEuC5/kN5XG42wdVPy74Tagjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSWFcCfDf3bKEQJ3iIXarHSBXTtAndjU/unFTz2roxrV2TeGAQ2VjrjRQRYRKV/I2 fz9Fskyo/bRQ/ajUJLrYQq79juV1yvzafWL5glyb/T8vTqmgqmiIQWbOYmEHGBECxF Ri0ztMBGsIdrsSUz+EmF659TAc2crQ3d9Kogqr5Yg5Uld2AhvP8aQOlXB//1z4V+dC cx1OrMxWOJOQcNGpuZ9ocqbbKM/29CwPcSXb/HWEHijBX6/oB9BTXJv2zuVsxQX45G gDt02/0t1L+qHXJqwdtMmi1HRzQVBQ1cU5Kt904mT6g+QtLLrtFL1EGRsfvbqrc8PQ BV0yNAxKCsqJQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Sakamoto , Adam Goldman , Sasha Levin Subject: [PATCH 4.19 009/148] firewire: core: use long bus reset on gap count error Date: Sun, 24 Mar 2024 19:47:53 -0400 Message-ID: <20240324235012.1356413-10-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Takashi Sakamoto [ Upstream commit d0b06dc48fb15902d7da09c5c0861e7f042a9381 ] When resetting the bus after a gap count error, use a long rather than short bus reset. IEEE 1394-1995 uses only long bus resets. IEEE 1394a adds the option of short bus resets. When video or audio transmission is in progress and a device is hot-plugged elsewhere on the bus, the resulting bus reset can cause video frame drops or audio dropouts. Short bus resets reduce or eliminate this problem. Accordingly, short bus resets are almost always preferred. However, on a mixed 1394/1394a bus, a short bus reset can trigger an immediate additional bus reset. This double bus reset can be interpreted differently by different nodes on the bus, resulting in an inconsistent gap count after the bus reset. An inconsistent gap count will cause another bus reset, leading to a neverending bus reset loop. This only happens for some bus topologies, not for all mixed 1394/1394a buses. By instead sending a long bus reset after a gap count inconsistency, we avoid the doubled bus reset, restoring the bus to normal operation. Signed-off-by: Adam Goldman Link: https://sourceforge.net/p/linux1394/mailman/message/58741624/ Signed-off-by: Takashi Sakamoto Signed-off-by: Sasha Levin --- drivers/firewire/core-card.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 0e6f96c0e3957..6c464c75ac9d5 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c @@ -513,7 +513,19 @@ static void bm_work(struct work_struct *work) fw_notice(card, "phy config: new root=3D%x, gap_count=3D%d\n", new_root_id, gap_count); fw_send_phy_config(card, new_root_id, generation, gap_count); - reset_bus(card, true); + /* + * Where possible, use a short bus reset to minimize + * disruption to isochronous transfers. But in the event + * of a gap count inconsistency, use a long bus reset. + * + * As noted in 1394a 8.4.6.2, nodes on a mixed 1394/1394a bus + * may set different gap counts after a bus reset. On a mixed + * 1394/1394a bus, a short bus reset can get doubled. Some + * nodes may treat the double reset as one bus reset and others + * may treat it as two, causing a gap count inconsistency + * again. Using a long bus reset prevents this. + */ + reset_bus(card, card->gap_count !=3D 0); /* Will allocate broadcast channel after the reset. */ goto out; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFDD71836FC; Sun, 24 Mar 2024 23:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324227; cv=none; b=GiThF+dWifKgzxep77Bre804yTRgH4853YNfv68KJpY/J1UKcEBSrqRjuf3QsfSeUgY9WHSmuR87zxCSu9E6wXtelvKld6E+S7z37dl69zWCFS2Yi25HT8cH6FRgEijnPv8Jn6wIrOAQqC1WTwUTdt+5is6B7MZ0P0lf1UvoTnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324227; c=relaxed/simple; bh=uNcha0HaSrS1R7aswxavoG+kOXCMFOfXe9i+/jnZIug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p+kKOCnnsEFbpLNwqkwDFsZEwg92VgmRep1ZlZSPzo8vxXeTY1hX8GPnjhQo5sPWxNp/ydFDsLdmqC1QN9c6SJVd9bs0ln7wfPv0Ccq1k5jFdx2fdFs9goe2DB4GiKwPbAwhgipnGdE7cYInOc3wHq58IuTMsOpw9VaiH0D0D3E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TrSwQyEE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TrSwQyEE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9608C433B1; Sun, 24 Mar 2024 23:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324226; bh=uNcha0HaSrS1R7aswxavoG+kOXCMFOfXe9i+/jnZIug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TrSwQyEENYsQegAVF3dqqQQAIjvfed3+o7jXyTJgcMw1DjyZ4xl8tkDCx8/ZJmrc2 3yI1Yr83Q8UzNmlP46oCx5p/ZqyiTkL+6RJ/KGIfEeGQ4UpvdTaUR9hDwnGFydKuEg 9DgbjFJ+POnaUUNkkuEE4kpWoshco+Rje1d891kZE6F7qh/xedbeh22Qod8MGByzwr QK+gwn6Ppr1gVc5L6jVaTcEOQacMWgH0pBZbFAC0IEssTggWogy4SFStWSz/QDStiF iTPa4qeEtxyAJqKNxi5lqJXCHzgzUH9xgZx9Q6HP20TRaE/uDpOq9YlVwgL/Ze6TbC lQ6EcSKRx/VlQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Alban=20Boy=C3=A9?= , Cezary Rojewski , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 4.19 010/148] ASoC: Intel: bytcr_rt5640: Add an extra entry for the Chuwi Vi8 tablet Date: Sun, 24 Mar 2024 19:47:54 -0400 Message-ID: <20240324235012.1356413-11-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Alban Boy=C3=A9 [ Upstream commit f8b0127aca8c60826e7354e504a12d4a46b1c3bb ] The bios version can differ depending if it is a dual-boot variant of the t= ablet. Therefore another DMI match is required. Signed-off-by: Alban Boy=C3=A9 Reviewed-by: Cezary Rojewski Acked-by: Pierre-Louis Bossart Link: https://msgid.link/r/20240228192807.15130-1-alban.boye@protonmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards= /bytcr_rt5640.c index d27dd170bedaf..19f425eb4a40f 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -523,6 +523,18 @@ static const struct dmi_system_id byt_rt5640_quirk_tab= le[] =3D { BYT_RT5640_SSP0_AIF1 | BYT_RT5640_MCLK_EN), }, + { /* Chuwi Vi8 dual-boot (CWI506) */ + .matches =3D { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "i86"), + /* The above are too generic, also match BIOS info */ + DMI_MATCH(DMI_BIOS_VERSION, "CHUWI2.D86JHBNR02"), + }, + .driver_data =3D (void *)(BYTCR_INPUT_DEFAULTS | + BYT_RT5640_MONO_SPEAKER | + BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { /* Chuwi Vi10 (CWI505) */ .matches =3D { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 265031836F8; Sun, 24 Mar 2024 23:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324229; cv=none; b=RKWMqNFdKxkMM7CkT/DZ3/py5fPRUrb47jmLfi64JnPdw/NWAIIRHZv7Ar2zKckYG/jPJkX6uM0vntqCUYKP5tNfQsU03X3LRewh90mpkR6ra4y1/0MPCOC9nZ+tiTsxf7VP+SZ0vsjE8VFRZIo21baDPgj1zHM8DH18ucY2Ig4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324229; c=relaxed/simple; bh=3Q6+nkFmLZ8LSriDKFXBaKSN3UtPPBNDjNc8HitH7HM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IJ8bS6LkffAdcM1GyD1YCqTgDVWnQ/8PvwG4jwgUkIS454JmEtEPxkmG2k39nMORBDokEwfelwq6H/YPYNMLmVGKeYFlJ70lCFjcmvo3Budd+kmA33XNxckoAv0ep7vHmbX49NMM/GgPKVa1vvpH1XFjyBoMqyWemXBSE2wSfuc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UJM5+T13; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UJM5+T13" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5845C433F1; Sun, 24 Mar 2024 23:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324227; bh=3Q6+nkFmLZ8LSriDKFXBaKSN3UtPPBNDjNc8HitH7HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJM5+T13DL+UuTWs6Nt1JGSuo26Nv5AtPaM8n0Z1IXV5YNaWKQvFyykor7ZNiQYM2 fGYXu2pIfC28MmimTLogPJJ9CZWiITzXhHeGtAD+8K1S7wD6SJKgoaIAaILaQdnT9r w9HAzXhDu5O0XHhAKmAtQh2jykIrCuS8iLbt9c7z8wmM9blZwEXSjzgVYNbtk9H1g5 eiepPjO36fVq3cqCucCt/JOb10W3yqRPp9CsZGXrfbB5ICSj33IEKwwyUel33sScjI t3xN1jzw1pqpPVIE3rjfCNoR6OHEYr38wAhyvz+O2hvag8BuXWP8FtvrWF5lz7a2GA xyhVJg8lp7DIA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Linus Walleij , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.19 011/148] Input: gpio_keys_polled - suppress deferred probe error for gpio Date: Sun, 24 Mar 2024 19:47:55 -0400 Message-ID: <20240324235012.1356413-12-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Uwe Kleine-K=C3=B6nig [ Upstream commit 963465a33141d0d52338e77f80fe543d2c9dc053 ] On a PC Engines APU our admins are faced with: $ dmesg | grep -c "gpio-keys-polled gpio-keys-polled: unable to claim gpio= 0, err=3D-517" 261 Such a message always appears when e.g. a new USB device is plugged in. Suppress this message which considerably clutters the kernel log for EPROBE_DEFER (i.e. -517). Signed-off-by: Uwe Kleine-K=C3=B6nig Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20240305101042.10953-2-u.kleine-koenig@peng= utronix.de Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/keyboard/gpio_keys_polled.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyb= oard/gpio_keys_polled.c index edc7262103b9a..96e47b2401490 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -328,12 +328,10 @@ static int gpio_keys_polled_probe(struct platform_dev= ice *pdev) =20 error =3D devm_gpio_request_one(dev, button->gpio, flags, button->desc ? : DRV_NAME); - if (error) { - dev_err(dev, - "unable to claim gpio %u, err=3D%d\n", - button->gpio, error); - return error; - } + if (error) + return dev_err_probe(dev, error, + "unable to claim gpio %u\n", + button->gpio); =20 bdata->gpiod =3D gpio_to_desc(button->gpio); if (!bdata->gpiod) { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7D0822BF66; Sun, 24 Mar 2024 23:50:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324229; cv=none; b=jaRc5lisF6nOUVG4fJT81kTMn84QERQdSB6E8wHq7HSCmWVPnDpKXV8SrYH7r2Exw0hYrGTXvz44fbn7RTqdKXb3Y14vz0gn+SMYDW4JrUKckL9JoxnLB6anF3Swc03o8bvKREH52/koJMFDVk8M1N6GInHB06sx2Xo4A14ZcQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324229; c=relaxed/simple; bh=lqUQWIx+8Xr3kNZFo3F/Pk5FsJwY8BoGx7jkaoPKYX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IPOI0QRMEhRHtjHuD12EAN/5gR8ie3m2QxEqwFiQQFZkvBJ++Yp/W5rzP1LFvxVjSyemunPd4Mr1bTX1PPn1Egj7b0SWN9bwZqWicaY7ZUgBUgOWirl7YYz1sVzTIREmoAjPVb63d0+Xnp09ZSGnWVdL6ilcqb1yeQZ9NuuKgss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ldo6+76+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ldo6+76+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC476C43394; Sun, 24 Mar 2024 23:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324228; bh=lqUQWIx+8Xr3kNZFo3F/Pk5FsJwY8BoGx7jkaoPKYX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ldo6+76+iFIq6qIZWy8r6Z2MD6WAHNJVuQyXPpgNy0loO0Jdf3l0U+/gfkkxgy54c qrIyB6KNBoYSsQmO8ZTUf9Kh46w87XFcvkEsJehmqjY44/M+4TrHB2cbz0mLS+onLn +DEJGrsHkHjEVaR1wyV7LzLsI5eV3+uwtLnVfxHWRasWB7YgLZ57Y27BNSZtSwwgDE GH/ZDgpcphHMTMKHmtB3p1/GG6nOCd3yKWZ2QKIDbg2hKkTixeJrCwL/fusOp5Yqmr BiWHxWtlqHV6JGZO5CPA1GnFmSKLMdPJg/LsvNbHDWRai8KnzcL9TE8xT3oC2UoGp6 41ll5Mfl7GyRA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stuart Henderson , Mark Brown , Sasha Levin Subject: [PATCH 4.19 012/148] ASoC: wm8962: Enable oscillator if selecting WM8962_FLL_OSC Date: Sun, 24 Mar 2024 19:47:56 -0400 Message-ID: <20240324235012.1356413-13-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stuart Henderson [ Upstream commit 03c7874106ca5032a312626b927b1c35f07b1f35 ] Signed-off-by: Stuart Henderson Link: https://msgid.link/r/20240306161439.1385643-1-stuarth@opensource.cirr= us.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm8962.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 3f75cb3209ffa..674bc6f65ed0e 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -2848,8 +2848,12 @@ static int wm8962_set_fll(struct snd_soc_component *= component, int fll_id, int s switch (fll_id) { case WM8962_FLL_MCLK: case WM8962_FLL_BCLK: + fll1 |=3D (fll_id - 1) << WM8962_FLL_REFCLK_SRC_SHIFT; + break; case WM8962_FLL_OSC: fll1 |=3D (fll_id - 1) << WM8962_FLL_REFCLK_SRC_SHIFT; + snd_soc_component_update_bits(component, WM8962_PLL2, + WM8962_OSC_ENA, WM8962_OSC_ENA); break; case WM8962_FLL_INT: snd_soc_component_update_bits(component, WM8962_FLL_CONTROL_1, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F228D22BF75; Sun, 24 Mar 2024 23:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324231; cv=none; b=tMt31ZVrLESsbIM+oWt2xSzf4KbsR7xcObXF1MvovqYuG4rWEKGjNIhBkALmkr4Rw7ksIkQcZB/ihM4+mOGE/w/z/X03pDUFPJk2tNYX9aI9k65B1c4WNLYEn1/91at03VVKjJvaRSL/207lrJ4Q3ktB7dPWzyDMS/NvO+DdD7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324231; c=relaxed/simple; bh=y6SI1aGswLNseRZzTvYEXZFknUO2uW6XeSH+ZI2z+LQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PVCvD/b8WBY+p3nq9mtBm4jRdE1BH/BAl5XUmnLWT6C8iR05HoJ2DG05W64BkDV57BQCGGTqo8J7nZtdkWwQ3ItHOfYamKD3zclBpBAT5Wrf6pd43X+p3gJHCiJ//6FtWxw0IpWb8PpmH4OWwlzU3I6//Tp9UcglPsJcowS9low= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LsjtxOvK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LsjtxOvK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7507C433C7; Sun, 24 Mar 2024 23:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324229; bh=y6SI1aGswLNseRZzTvYEXZFknUO2uW6XeSH+ZI2z+LQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LsjtxOvKpRfaPX/tjpNAeDKdj7Km+l8ivZdS76TsU3TZtKV+0K+mUyU2h3RYrRVaq +9Bd7B+MJCVm8AZeMQS2NYODtq1i0xS8/4CHguEhXc+YORnbR7DjpuYw7mBArs/F7R ilW+YO/eJr3uhhuNSgwwsk4H82TL9ZfaAlgSgcYznS1yuPSDnsNW9xC70WWg7zj1yV meZHniUX8b4cpXq40FduL9X/KELHf023J9kNopcysH4P3m81VH43irsWULfcDpwUG/ oefkjxPckfkuGq24zWTDRYiTw3b9GboMYE7hHaE41R2lDBCRQNizLdgLZfhZatTeCb Pn+vi11KqvxaA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stuart Henderson , Mark Brown , Sasha Levin Subject: [PATCH 4.19 013/148] ASoC: wm8962: Enable both SPKOUTR_ENA and SPKOUTL_ENA in mono mode Date: Sun, 24 Mar 2024 19:47:57 -0400 Message-ID: <20240324235012.1356413-14-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stuart Henderson [ Upstream commit 6fa849e4d78b880e878138bf238e4fd2bac3c4fa ] Signed-off-by: Stuart Henderson Link: https://msgid.link/r/20240306161439.1385643-2-stuarth@opensource.cirr= us.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm8962.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 674bc6f65ed0e..55e041031d398 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -2177,6 +2177,9 @@ SND_SOC_DAPM_PGA_E("HPOUT", SND_SOC_NOPM, 0, 0, NULL,= 0, hp_event, =20 SND_SOC_DAPM_OUTPUT("HPOUTL"), SND_SOC_DAPM_OUTPUT("HPOUTR"), + +SND_SOC_DAPM_PGA("SPKOUTL Output", WM8962_CLASS_D_CONTROL_1, 6, 0, NULL, 0= ), +SND_SOC_DAPM_PGA("SPKOUTR Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0= ), }; =20 static const struct snd_soc_dapm_widget wm8962_dapm_spk_mono_widgets[] =3D= { @@ -2184,7 +2187,6 @@ SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENAB= LES, 1, 0, spkmixl, ARRAY_SIZE(spkmixl)), SND_SOC_DAPM_MUX_E("Speaker PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux, out_pga_event, SND_SOC_DAPM_POST_PMU), -SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0= ), SND_SOC_DAPM_OUTPUT("SPKOUT"), }; =20 @@ -2199,9 +2201,6 @@ SND_SOC_DAPM_MUX_E("SPKOUTL PGA", WM8962_PWR_MGMT_2, = 4, 0, &spkoutl_mux, SND_SOC_DAPM_MUX_E("SPKOUTR PGA", WM8962_PWR_MGMT_2, 3, 0, &spkoutr_mux, out_pga_event, SND_SOC_DAPM_POST_PMU), =20 -SND_SOC_DAPM_PGA("SPKOUTR Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0= ), -SND_SOC_DAPM_PGA("SPKOUTL Output", WM8962_CLASS_D_CONTROL_1, 6, 0, NULL, 0= ), - SND_SOC_DAPM_OUTPUT("SPKOUTL"), SND_SOC_DAPM_OUTPUT("SPKOUTR"), }; @@ -2311,12 +2310,18 @@ static const struct snd_soc_dapm_route wm8962_spk_m= ono_intercon[] =3D { { "Speaker PGA", "Mixer", "Speaker Mixer" }, { "Speaker PGA", "DAC", "DACL" }, =20 - { "Speaker Output", NULL, "Speaker PGA" }, - { "Speaker Output", NULL, "SYSCLK" }, - { "Speaker Output", NULL, "TOCLK" }, - { "Speaker Output", NULL, "TEMP_SPK" }, + { "SPKOUTL Output", NULL, "Speaker PGA" }, + { "SPKOUTL Output", NULL, "SYSCLK" }, + { "SPKOUTL Output", NULL, "TOCLK" }, + { "SPKOUTL Output", NULL, "TEMP_SPK" }, + + { "SPKOUTR Output", NULL, "Speaker PGA" }, + { "SPKOUTR Output", NULL, "SYSCLK" }, + { "SPKOUTR Output", NULL, "TOCLK" }, + { "SPKOUTR Output", NULL, "TEMP_SPK" }, =20 - { "SPKOUT", NULL, "Speaker Output" }, + { "SPKOUT", NULL, "SPKOUTL Output" }, + { "SPKOUT", NULL, "SPKOUTR Output" }, }; =20 static const struct snd_soc_dapm_route wm8962_spk_stereo_intercon[] =3D { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34F3722BF80; Sun, 24 Mar 2024 23:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324232; cv=none; b=ILYT36S6gh5bOOYLGmAMyO9UKuldurFIItY53CXPiweB6GqpJiDDVNWcK1DOKtMUjKgsDKja+dmK3wevyoIs6LUtNUt6pRoKyLOr9MBAgGL5/sGaL+mVEKblpmEbDyy44bzpO2ihnTOWy8QjjLHJe8+J7dcfrzkZ4VMR8xutwI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324232; c=relaxed/simple; bh=NbFoFKDFJZ/lAIRyGGvrwioKM5cI7LsQ0SBfnOwu3Sg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IateY19U9hWd9JVZzio8XuBhMmgk3QOcHLFPNLlI9WN++g0hGjZ7OuO1BNmcsR23zTyC0ovA+0nwfVgFZ7EhrbfFcydTZxrFrYBjwkaB+ypgLc304J4jfp8XC0+jq5uE9yuENGBCCqu2zn0whz+ZN9TFM15qB6mgO7WXoOoPXSY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rTh+vaNK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rTh+vaNK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1C8BC433F1; Sun, 24 Mar 2024 23:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324231; bh=NbFoFKDFJZ/lAIRyGGvrwioKM5cI7LsQ0SBfnOwu3Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rTh+vaNKGaFgMwhYBeiZevwKhM9gXstPnOxx95OxkAQGdxAO/cUa87nRN6TwKhRhB NaVJKItUv7NLnAuHuvpgjo7Csno21BcMiyN52xoLULfbpadue4Ug8Z9VLKUOXxEDCL Eoc66KOPsrWN3oDUME7m16uS1i57rRyT7xLgNwPKNcAImc7eh05oleBONSfHWJHL3T qEmyXZ3o81xQqEK774F420mEpg8aZKwsgdIY3tKT/Zqg54I5T+lVLFnOcaz1SgQ/FD ez/ipHRU6MS/XIA24PscPt9fazPAOCxqn1UHAlogOtYiVrr812q5QYboI0UZiZlNUM yoT/Wjrr1etdA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stuart Henderson , Mark Brown , Sasha Levin Subject: [PATCH 4.19 014/148] ASoC: wm8962: Fix up incorrect error message in wm8962_set_fll Date: Sun, 24 Mar 2024 19:47:58 -0400 Message-ID: <20240324235012.1356413-15-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stuart Henderson [ Upstream commit 96e202f8c52ac49452f83317cf3b34cd1ad81e18 ] Use source instead of ret, which seems to be unrelated and will always be zero. Signed-off-by: Stuart Henderson Link: https://msgid.link/r/20240306161439.1385643-5-stuarth@opensource.cirr= us.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm8962.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 55e041031d398..74321c16e41f4 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -2867,7 +2867,7 @@ static int wm8962_set_fll(struct snd_soc_component *c= omponent, int fll_id, int s WM8962_FLL_FRC_NCO, WM8962_FLL_FRC_NCO); break; default: - dev_err(component->dev, "Unknown FLL source %d\n", ret); + dev_err(component->dev, "Unknown FLL source %d\n", source); return -EINVAL; } =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8064722BF90; Sun, 24 Mar 2024 23:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324233; cv=none; b=D5uFm20JihbRb0UCJ7J37VwrDLUV765j1sokGVErnKIoaX+YNWB5Cx2hAxAW+z9xjhJWjhO8toUoAobVAOkcgWlB8SGH50xWCdlF9HuTtl6WLv2XFyyq9HspkU7ZUuRi1LotmKZFQCQ64WfThGhTPWvd9iEIKz8Rga/oPUE23Hw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324233; c=relaxed/simple; bh=QMhrV214RLPZ2ZrKumKQA+aTfeZeVAws8l4YnWi2/c8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bVvcPtK7JVMCHehPMUMROjbllDhlL39PVgZKK+JVuVUznEsiOJcrUjrsUnWbi2AHCW3Sz0umLZWD1PlDRPKEazFUCxgtiPVU/XvpSRMiAMKz1QIWMF9HQc0MAPxMi7krANVZmqjGeeXEiLvwbdCj4C8wUPZDifX6g6DGzciBLMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KZjJGZJF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KZjJGZJF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BADCC43390; Sun, 24 Mar 2024 23:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324232; bh=QMhrV214RLPZ2ZrKumKQA+aTfeZeVAws8l4YnWi2/c8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZjJGZJFqiMO36edUgziFClUgUPtsW6w/AgWHjBnZiN2jD6NPX2D7204w6NSB/ZTC KmFXw8vHdSN8CnI2A4p6HGk5dRAVcsYeIQ/wCdQIoSkcrFkNFFnTWMC9UspxdIEmgo do51sN1Ujexsl2YwgvsGiX4FTtqyxrJ/iNn0HXLW7Aouaa29BYyK/tZ5oDx4XccOsr xHLpEbXDbavvb30TXQj3KkGRkJIfzIlYgyv31WJePEA7RPlF6h56fNB9FqH5B2TLqo FSVR/zvjw6YKMNyF8ArkgU0v2SXQx7n5Z496+pBq9sEhSh4IfCKuNcicK5iJIqRenf xJfOHzrhnk2fA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ondrej Mosnacek , Stephan Mueller , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 015/148] crypto: algif_aead - fix uninitialized ctx->init Date: Sun, 24 Mar 2024 19:47:59 -0400 Message-ID: <20240324235012.1356413-16-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ondrej Mosnacek [ Upstream commit 21dfbcd1f5cbff9cf2f9e7e43475aed8d072b0dd ] In skcipher_accept_parent_nokey() the whole af_alg_ctx structure is cleared by memset() after allocation, so add such memset() also to aead_accept_parent_nokey() so that the new "init" field is also initialized to zero. Without that the initial ctx->init checks might randomly return true and cause errors. While there, also remove the redundant zero assignments in both functions. Found via libkcapi testsuite. Cc: Stephan Mueller Fixes: f3c802a1f300 ("crypto: algif_aead - Only wake up when ctx->more is z= ero") Suggested-by: Herbert Xu Signed-off-by: Ondrej Mosnacek Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/algif_aead.c | 6 ------ crypto/algif_skcipher.c | 7 +------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index 182783801ffa6..4cb2b12175490 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c @@ -563,12 +563,6 @@ static int aead_accept_parent_nokey(void *private, str= uct sock *sk) =20 INIT_LIST_HEAD(&ctx->tsgl_list); ctx->len =3D len; - ctx->used =3D 0; - atomic_set(&ctx->rcvused, 0); - ctx->more =3D 0; - ctx->merge =3D 0; - ctx->enc =3D 0; - ctx->aead_assoclen =3D 0; crypto_init_wait(&ctx->wait); =20 ask->private =3D ctx; diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index 9d2e9783c0d4e..af08fc18a4926 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c @@ -337,6 +337,7 @@ static int skcipher_accept_parent_nokey(void *private, = struct sock *sk) ctx =3D sock_kmalloc(sk, len, GFP_KERNEL); if (!ctx) return -ENOMEM; + memset(ctx, 0, len); =20 ctx->iv =3D sock_kmalloc(sk, crypto_skcipher_ivsize(tfm), GFP_KERNEL); @@ -344,16 +345,10 @@ static int skcipher_accept_parent_nokey(void *private= , struct sock *sk) sock_kfree_s(sk, ctx, len); return -ENOMEM; } - memset(ctx->iv, 0, crypto_skcipher_ivsize(tfm)); =20 INIT_LIST_HEAD(&ctx->tsgl_list); ctx->len =3D len; - ctx->used =3D 0; - atomic_set(&ctx->rcvused, 0); - ctx->more =3D 0; - ctx->merge =3D 0; - ctx->enc =3D 0; crypto_init_wait(&ctx->wait); =20 ask->private =3D ctx; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2709422BF99; Sun, 24 Mar 2024 23:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324234; cv=none; b=XVxSGVQPRXZY1aaOjhYWMm+S5GxXe2WLs1qp1R3yEGKcRdSPi14ch/CxAPQLX9mxHvLjKBLx7I1uxcIC/bTi8f2cHuv52FhlAYcaoNA48TpPh4iO13KX6+UIz4oL/OTIcI/tW7r9S++AZ5TvtRYR12o4MJjIFmxN56R5MP3DdwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324234; c=relaxed/simple; bh=yEXvRrcGEs1LrMgD2vUSSiAEV+7hUKTAAOpMzsUJkAc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HPYIkPoM9TtcbzAPaPdmzwjfi532NVk4OFbsUkD5MsW+bl8R5Q4To451rbZnuzLkz3uXySlk6SIqSOxAQZKRhDiWa9ytUWwU6B6fbkdZp9QyPEx3IMpILG/e9HEW7Y28tq/bkzLOAMO8GULustnyV7Qc0z0K+xVI7ZDViR8e3nQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jxEeFK3A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jxEeFK3A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E520C433F1; Sun, 24 Mar 2024 23:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324233; bh=yEXvRrcGEs1LrMgD2vUSSiAEV+7hUKTAAOpMzsUJkAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxEeFK3AHD2+1CqrYUfnd742FOwEHvYSaNU+Oa+IksTgazw40GffRlLh3DLLZ6MQ4 F7W1fQ7OCkKpBEyFXn6letMAoFO2V3bpE0RmBfviZaM2DBkOSwARRO0yVpJJg9qR7x EgP7gO3dpscvsfs6hcvPlvNu2dgZjO7bTZtKCTEBTUPhJ/lDC6UmRHTtDB8K8GRg/y ajfUWpRfpXDFqgvrGKV7P7BP3i6vRC1qqXUBWhe9dwfmqY7kspsFAPbFXdH6IzH5IQ gHMFPjYbxY1Gvx7sMGwvy9yIND1kJ27HO60Mr9SShIBA9W3/EUU9q+VdwxxbWfRHZY eShlk15xpRx2Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Biggers , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 016/148] crypto: af_alg - make some functions static Date: Sun, 24 Mar 2024 19:48:00 -0400 Message-ID: <20240324235012.1356413-17-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Biggers [ Upstream commit 466e0759269d31485074126700574230bfff3b1c ] Some exported functions in af_alg.c aren't used outside of that file. Therefore, un-export them and make them 'static'. Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu Stable-dep-of: f3c802a1f300 ("crypto: algif_aead - Only wake up when ctx->m= ore is zero") Signed-off-by: Sasha Levin --- crypto/af_alg.c | 20 +++++++------------- include/crypto/if_alg.h | 7 ------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 914496b184a97..ed62632a1c355 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -429,12 +429,12 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov= _iter *iter, int len) } EXPORT_SYMBOL_GPL(af_alg_make_sg); =20 -void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_ne= w) +static void af_alg_link_sg(struct af_alg_sgl *sgl_prev, + struct af_alg_sgl *sgl_new) { sg_unmark_end(sgl_prev->sg + sgl_prev->npages - 1); sg_chain(sgl_prev->sg, sgl_prev->npages + 1, sgl_new->sg); } -EXPORT_SYMBOL_GPL(af_alg_link_sg); =20 void af_alg_free_sg(struct af_alg_sgl *sgl) { @@ -445,7 +445,7 @@ void af_alg_free_sg(struct af_alg_sgl *sgl) } EXPORT_SYMBOL_GPL(af_alg_free_sg); =20 -int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con) +static int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con) { struct cmsghdr *cmsg; =20 @@ -484,7 +484,6 @@ int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_= control *con) =20 return 0; } -EXPORT_SYMBOL_GPL(af_alg_cmsg_send); =20 /** * af_alg_alloc_tsgl - allocate the TX SGL @@ -492,7 +491,7 @@ EXPORT_SYMBOL_GPL(af_alg_cmsg_send); * @sk socket of connection to user space * @return: 0 upon success, < 0 upon error */ -int af_alg_alloc_tsgl(struct sock *sk) +static int af_alg_alloc_tsgl(struct sock *sk) { struct alg_sock *ask =3D alg_sk(sk); struct af_alg_ctx *ctx =3D ask->private; @@ -521,7 +520,6 @@ int af_alg_alloc_tsgl(struct sock *sk) =20 return 0; } -EXPORT_SYMBOL_GPL(af_alg_alloc_tsgl); =20 /** * aead_count_tsgl - Count number of TX SG entries @@ -658,7 +656,7 @@ EXPORT_SYMBOL_GPL(af_alg_pull_tsgl); * * @areq Request holding the TX and RX SGL */ -void af_alg_free_areq_sgls(struct af_alg_async_req *areq) +static void af_alg_free_areq_sgls(struct af_alg_async_req *areq) { struct sock *sk =3D areq->sk; struct alg_sock *ask =3D alg_sk(sk); @@ -687,7 +685,6 @@ void af_alg_free_areq_sgls(struct af_alg_async_req *are= q) sock_kfree_s(sk, tsgl, areq->tsgl_entries * sizeof(*tsgl)); } } -EXPORT_SYMBOL_GPL(af_alg_free_areq_sgls); =20 /** * af_alg_wait_for_wmem - wait for availability of writable memory @@ -696,7 +693,7 @@ EXPORT_SYMBOL_GPL(af_alg_free_areq_sgls); * @flags If MSG_DONTWAIT is set, then only report if function would sleep * @return 0 when writable memory is available, < 0 upon error */ -int af_alg_wait_for_wmem(struct sock *sk, unsigned int flags) +static int af_alg_wait_for_wmem(struct sock *sk, unsigned int flags) { DEFINE_WAIT_FUNC(wait, woken_wake_function); int err =3D -ERESTARTSYS; @@ -721,7 +718,6 @@ int af_alg_wait_for_wmem(struct sock *sk, unsigned int = flags) =20 return err; } -EXPORT_SYMBOL_GPL(af_alg_wait_for_wmem); =20 /** * af_alg_wmem_wakeup - wakeup caller when writable memory is available @@ -790,8 +786,7 @@ EXPORT_SYMBOL_GPL(af_alg_wait_for_data); * * @sk socket of connection to user space */ - -void af_alg_data_wakeup(struct sock *sk) +static void af_alg_data_wakeup(struct sock *sk) { struct alg_sock *ask =3D alg_sk(sk); struct af_alg_ctx *ctx =3D ask->private; @@ -809,7 +804,6 @@ void af_alg_data_wakeup(struct sock *sk) sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); rcu_read_unlock(); } -EXPORT_SYMBOL_GPL(af_alg_data_wakeup); =20 /** * af_alg_sendmsg - implementation of sendmsg system call handler diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h index 2c1748dc66405..f0c83a7bd078b 100644 --- a/include/crypto/if_alg.h +++ b/include/crypto/if_alg.h @@ -172,9 +172,6 @@ int af_alg_accept(struct sock *sk, struct socket *newso= ck, bool kern); =20 int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len); void af_alg_free_sg(struct af_alg_sgl *sgl); -void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_ne= w); - -int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con); =20 static inline struct alg_sock *alg_sk(struct sock *sk) { @@ -233,15 +230,11 @@ static inline bool af_alg_readable(struct sock *sk) return PAGE_SIZE <=3D af_alg_rcvbuf(sk); } =20 -int af_alg_alloc_tsgl(struct sock *sk); unsigned int af_alg_count_tsgl(struct sock *sk, size_t bytes, size_t offse= t); void af_alg_pull_tsgl(struct sock *sk, size_t used, struct scatterlist *ds= t, size_t dst_offset); -void af_alg_free_areq_sgls(struct af_alg_async_req *areq); -int af_alg_wait_for_wmem(struct sock *sk, unsigned int flags); void af_alg_wmem_wakeup(struct sock *sk); int af_alg_wait_for_data(struct sock *sk, unsigned flags); -void af_alg_data_wakeup(struct sock *sk); int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, unsigned int ivsize); ssize_t af_alg_sendpage(struct socket *sock, struct page *page, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2942813C90C; Sun, 24 Mar 2024 23:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324235; cv=none; b=I0oEbR0PUm4ON3HT/C2ys16Spr1aDDgXlSgnmrlp91BLOkftRvCdCTB700Fh3PQvaqZDObqN9FUFlxIPSG45pPMRCe40c+rBjBt6EEL8KQCTH30IUfn9zsrPun9buv9EeaIdGU9DN5O+bx3sIDysR0AvQLAbJtGJeVdpIOxqbf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324235; c=relaxed/simple; bh=THPvOALJ4wvUxBHy4l+81UW2a018QyQ7BQ7O93l7i20=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O7wZl0SnnARUVSgPTHvxe5PF9TZ+X7+5Qbh5KcvekLXXaH2zSqgqMMC42OcvRHjA9vxxC6dwafu6FIlmRNVURLsfqttpnHLjmQO30eKZ7gTVDL84viBpDhChmqt4gdw0QLVKihqV4AvaxuwpWH+UMYd16d3TO6jtzJZacjPimPw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mP6+/gNl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mP6+/gNl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 492CAC43394; Sun, 24 Mar 2024 23:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324233; bh=THPvOALJ4wvUxBHy4l+81UW2a018QyQ7BQ7O93l7i20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mP6+/gNlUHU1C+Y8v/LdI7f2Yy4aFt2Ypq/LKCemTmdYkzsBJDa1qfALKxZ16GUbE TA+3KQ+vwxazi1UdKmBgTX/AXDaGUN2QnX+5eu8OgOh3bNftakNLFhasym0r0LLwVU 2BLHPt4Akl7pIPDhVxhEGw9Ewd9tFLonHmcauTRDZq8BQHBFQzzJ+4Zs7tMQQkZLlZ jpntQvKYRP6CVb3gQXj3GBX84Pm3pzP0KMUyBKG8dyEKlYkZ0R5tgNeQFbA/saikfv 7w2ZmdzHKMW6zJB/eUBfvMmjjodp/+r3VZS0WW9sMHGYP6c+J8PoXoYgSDI36Iogla Dnbo4wPDBDFRw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Herbert Xu , Sasha Levin Subject: [PATCH 4.19 017/148] crypto: algif_aead - Only wake up when ctx->more is zero Date: Sun, 24 Mar 2024 19:48:01 -0400 Message-ID: <20240324235012.1356413-18-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Herbert Xu [ Upstream commit f3c802a1f30013f8f723b62d7fa49eb9e991da23 ] AEAD does not support partial requests so we must not wake up while ctx->more is set. In order to distinguish between the case of no data sent yet and a zero-length request, a new init flag has been added to ctx. SKCIPHER has also been modified to ensure that at least a block of data is available if there is more data to come. Fixes: 2d97591ef43d ("crypto: af_alg - consolidation of...") Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/af_alg.c | 11 ++++++++--- crypto/algif_aead.c | 4 ++-- crypto/algif_skcipher.c | 4 ++-- include/crypto/if_alg.h | 4 +++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index ed62632a1c355..78f041754f04f 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -648,6 +648,7 @@ void af_alg_pull_tsgl(struct sock *sk, size_t used, str= uct scatterlist *dst, =20 if (!ctx->used) ctx->merge =3D 0; + ctx->init =3D ctx->more; } EXPORT_SYMBOL_GPL(af_alg_pull_tsgl); =20 @@ -747,9 +748,10 @@ EXPORT_SYMBOL_GPL(af_alg_wmem_wakeup); * * @sk socket of connection to user space * @flags If MSG_DONTWAIT is set, then only report if function would sleep + * @min Set to minimum request size if partial requests are allowed. * @return 0 when writable memory is available, < 0 upon error */ -int af_alg_wait_for_data(struct sock *sk, unsigned flags) +int af_alg_wait_for_data(struct sock *sk, unsigned flags, unsigned min) { DEFINE_WAIT_FUNC(wait, woken_wake_function); struct alg_sock *ask =3D alg_sk(sk); @@ -767,7 +769,9 @@ int af_alg_wait_for_data(struct sock *sk, unsigned flag= s) if (signal_pending(current)) break; timeout =3D MAX_SCHEDULE_TIMEOUT; - if (sk_wait_event(sk, &timeout, (ctx->used || !ctx->more), + if (sk_wait_event(sk, &timeout, + ctx->init && (!ctx->more || + (min && ctx->used >=3D min)), &wait)) { err =3D 0; break; @@ -856,7 +860,7 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *= msg, size_t size, } =20 lock_sock(sk); - if (!ctx->more && ctx->used) { + if (ctx->init && (init || !ctx->more)) { err =3D -EINVAL; goto unlock; } @@ -867,6 +871,7 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *= msg, size_t size, memcpy(ctx->iv, con.iv->iv, ivsize); =20 ctx->aead_assoclen =3D con.aead_assoclen; + ctx->init =3D true; } =20 while (size) { diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index 4cb2b12175490..63ba443b23157 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c @@ -110,8 +110,8 @@ static int _aead_recvmsg(struct socket *sock, struct ms= ghdr *msg, size_t usedpages =3D 0; /* [in] RX bufs to be used from user */ size_t processed =3D 0; /* [in] TX bufs to be consumed */ =20 - if (!ctx->used) { - err =3D af_alg_wait_for_data(sk, flags); + if (!ctx->init || ctx->more) { + err =3D af_alg_wait_for_data(sk, flags, 0); if (err) return err; } diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index af08fc18a4926..6cfdbe71a2ce3 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c @@ -65,8 +65,8 @@ static int _skcipher_recvmsg(struct socket *sock, struct = msghdr *msg, int err =3D 0; size_t len =3D 0; =20 - if (!ctx->used) { - err =3D af_alg_wait_for_data(sk, flags); + if (!ctx->init || (ctx->more && ctx->used < bs)) { + err =3D af_alg_wait_for_data(sk, flags, bs); if (err) return err; } diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h index f0c83a7bd078b..69fc69973269e 100644 --- a/include/crypto/if_alg.h +++ b/include/crypto/if_alg.h @@ -140,6 +140,7 @@ struct af_alg_async_req { * SG? * @enc: Cryptographic operation to be performed when * recvmsg is invoked. + * @init: True if metadata has been sent. * @len: Length of memory allocated for this data structure. * @inflight: Non-zero when AIO requests are in flight. */ @@ -157,6 +158,7 @@ struct af_alg_ctx { bool more; bool merge; bool enc; + bool init; =20 unsigned int len; =20 @@ -234,7 +236,7 @@ unsigned int af_alg_count_tsgl(struct sock *sk, size_t = bytes, size_t offset); void af_alg_pull_tsgl(struct sock *sk, size_t used, struct scatterlist *ds= t, size_t dst_offset); void af_alg_wmem_wakeup(struct sock *sk); -int af_alg_wait_for_data(struct sock *sk, unsigned flags); +int af_alg_wait_for_data(struct sock *sk, unsigned flags, unsigned min); int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, unsigned int ivsize); ssize_t af_alg_sendpage(struct socket *sock, struct page *page, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3AAB291B65; Sun, 24 Mar 2024 23:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324236; cv=none; b=pIc7RhlpuPlgjn4iej5h+PlcVzIRIVB+1WOG4QuSQ51xQsffvYVrLX52q4mDTxW9yxfW1Pv4HIymq7qrDrj/zByUqo9wSqBo2uPXZHCjZl94XlTUL4swnd8/0Qv53CxdR5jF0voSNyqZg330xi24VtZ1TM4UCkyEx2x7FJTORnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324236; c=relaxed/simple; bh=C33EEltJRwHMDdwN6dS+Wo7jrwyUKT4NvKbIs0EN4cM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hjN5m7o8vHCHYGMOHAmbLKnMjgeOBJ42N3hjV+S+An47hV6LOyd/RgKj4QReuOmUonOE2sqS/ZHx7essN21Jjq9O3gmQINmRtdu6Js4yVn1gom/KR34qQJ07r1ig3lixo17kZI1kc5o1hOeV8/3AuyX3Aq5zgYG9y85R+6OF3ss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GpY2x8uO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GpY2x8uO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19379C433A6; Sun, 24 Mar 2024 23:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324235; bh=C33EEltJRwHMDdwN6dS+Wo7jrwyUKT4NvKbIs0EN4cM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GpY2x8uOK0zA8PegS5Qrq1Y2AmuNw6sH33hhcQtZSMY9C8hcsnLDYVp+rFtUAruwx vbJG1Xjsc5F/QIgf0kT49coHId4suyCN16Fi6/SQmz6PBW5mUjb106TVFyACin4I9O tDt3Ntp4ZYJJR52U7raa9VCM8UbqsB5q7JJxAfaXExGpSEaI5luHZNleVMQ1oLjK+p bywSb95wBoAKSBJ7cswVL3vahYtuEVt2xnw82KY7mSDdEJ/MYwHPSYR0l+WPLtR4XH TJsx+D1dFG+k89AR2DxSIMaEQ0yqZahHLw/ff1R2tHA6NohRSc2PQcHhPGxA56UWmN zxiTTKXNYaPEg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nikita Zhandarovich , Chuck Lever III , syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com, Jan Kara , Christian Brauner , Sasha Levin Subject: [PATCH 4.19 018/148] do_sys_name_to_handle(): use kzalloc() to fix kernel-infoleak Date: Sun, 24 Mar 2024 19:48:02 -0400 Message-ID: <20240324235012.1356413-19-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nikita Zhandarovich [ Upstream commit 3948abaa4e2be938ccdfc289385a27342fb13d43 ] syzbot identified a kernel information leak vulnerability in do_sys_name_to_handle() and issued the following report [1]. [1] "BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instr= umented.h:114 [inline] BUG: KMSAN: kernel-infoleak in _copy_to_user+0xbc/0x100 lib/usercopy.c:40 instrument_copy_to_user include/linux/instrumented.h:114 [inline] _copy_to_user+0xbc/0x100 lib/usercopy.c:40 copy_to_user include/linux/uaccess.h:191 [inline] do_sys_name_to_handle fs/fhandle.c:73 [inline] __do_sys_name_to_handle_at fs/fhandle.c:112 [inline] __se_sys_name_to_handle_at+0x949/0xb10 fs/fhandle.c:94 __x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94 ... Uninit was created at: slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768 slab_alloc_node mm/slub.c:3478 [inline] __kmem_cache_alloc_node+0x5c9/0x970 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1006 [inline] __kmalloc+0x121/0x3c0 mm/slab_common.c:1020 kmalloc include/linux/slab.h:604 [inline] do_sys_name_to_handle fs/fhandle.c:39 [inline] __do_sys_name_to_handle_at fs/fhandle.c:112 [inline] __se_sys_name_to_handle_at+0x441/0xb10 fs/fhandle.c:94 __x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94 ... Bytes 18-19 of 20 are uninitialized Memory access of size 20 starts at ffff888128a46380 Data copied to user address 0000000020000240" Per Chuck Lever's suggestion, use kzalloc() instead of kmalloc() to solve the problem. Fixes: 990d6c2d7aee ("vfs: Add name to file handle conversion support") Suggested-by: Chuck Lever III Reported-and-tested-by: Signed-off-by: Nikita Zhandarovich Link: https://lore.kernel.org/r/20240119153906.4367-1-n.zhandarovich@fintec= h.ru Reviewed-by: Jan Kara Signed-off-by: Christian Brauner Signed-off-by: Sasha Levin --- fs/fhandle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fhandle.c b/fs/fhandle.c index 0ee727485615b..cb78dbfd7cd51 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -37,7 +37,7 @@ static long do_sys_name_to_handle(struct path *path, if (f_handle.handle_bytes > MAX_HANDLE_SZ) return -EINVAL; =20 - handle =3D kmalloc(sizeof(struct file_handle) + f_handle.handle_bytes, + handle =3D kzalloc(sizeof(struct file_handle) + f_handle.handle_bytes, GFP_KERNEL); if (!handle) return -ENOMEM; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD4F8291B71; Sun, 24 Mar 2024 23:50:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324237; cv=none; b=Cd9avDY926LeMs2EemoSJKH9tDehFT+15SK7/aXgLiPjM8/ovJhMwTSd/IiOrzntArtFHiDdy85A6D8TcL6z6n626lHASNioLG6UfsYGpUqx3xTBrTR0os1ecg+58Qei3b0aelnanwQ9L4OgHGMsywetkArO0yLfGN07/OwvrRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324237; c=relaxed/simple; bh=YwkUYtGUobi3t4tiHcyMA4AKW9oJPCy4a1YK7+7rYIU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pNagUEm8/vTKag3dl4J3c6j5Il3aUIojMgHHuYDpaY5fHfcMV10z58LdCIQO7Izqt9lfanVD00Ob0YPyRUot197VzTjZ7iVY/YI2nC5Ma6UDOstEsI4Ny2AVM5aObe89dLDiTUOztR6lmyCxFTKbAlBXYcMCyJx+2XzGWooX7Uk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GSb5uQwx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GSb5uQwx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1572C43394; Sun, 24 Mar 2024 23:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324236; bh=YwkUYtGUobi3t4tiHcyMA4AKW9oJPCy4a1YK7+7rYIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GSb5uQwxFoNiJJMnngo1COEc57IK1Q3ttVCNlOXkk0wnmueTX5Scq79U6D1P/+M4s F6I9rf3w15r6+4HkCiAu4gL5JQ+5rQPOyHG+d38rCtqe/K97bOZ9bn6VwtL0lu6nPe wlsmaCdlYvLrrz9sWjEFcv81Mfv2bQqoSMT3f/FMHQopEsjq0+ikFcyCRkAu8lk883 F9pY8aGyHrFuZLOXYddI+8H9jz2CALcYWh9eUVKexp39x1Cyde7UgO6zAYRK36WOki HX/ij6i1V8aA0L7C7t/i114p+jUNMaO/N8WLGvR0a9TR6L8P4eNSClLCIAO133V0ZR V9GFcflr905wQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Kees Cook , Andi Kleen , Jan Kara , Christian Brauner , Sasha Levin Subject: [PATCH 4.19 019/148] fs/select: rework stack allocation hack for clang Date: Sun, 24 Mar 2024 19:48:03 -0400 Message-ID: <20240324235012.1356413-20-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit ddb9fd7a544088ed70eccbb9f85e9cc9952131c1 ] A while ago, we changed the way that select() and poll() preallocate a temporary buffer just under the size of the static warning limit of 1024 bytes, as clang was frequently going slightly above that limit. The warnings have recently returned and I took another look. As it turns out, clang is not actually inherently worse at reserving stack space, it just happens to inline do_select() into core_sys_select(), while gcc never inlines it. Annotate do_select() to never be inlined and in turn remove the special case for the allocation size. This should give the same behavior for both clang and gcc all the time and once more avoids those warnings. Fixes: ad312f95d41c ("fs/select: avoid clang stack usage warning") Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20240216202352.2492798-1-arnd@kernel.org Reviewed-by: Kees Cook Reviewed-by: Andi Kleen Reviewed-by: Jan Kara Signed-off-by: Christian Brauner Signed-off-by: Sasha Levin --- fs/select.c | 2 +- include/linux/poll.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/select.c b/fs/select.c index 1c3985d0bcc3e..e09c43cd75bbb 100644 --- a/fs/select.c +++ b/fs/select.c @@ -448,7 +448,7 @@ static inline void wait_key_set(poll_table *wait, unsig= ned long in, wait->_key |=3D POLLOUT_SET; } =20 -static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) +static noinline_for_stack int do_select(int n, fd_set_bits *fds, struct ti= mespec64 *end_time) { ktime_t expire, *to =3D NULL; struct poll_wqueues table; diff --git a/include/linux/poll.h b/include/linux/poll.h index 1cdc32b1f1b08..7e0fdcf905d2e 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -16,11 +16,7 @@ extern struct ctl_table epoll_table[]; /* for sysctl */ /* ~832 bytes of stack space used max in sys_select/sys_poll before alloca= ting additional memory. */ -#ifdef __clang__ -#define MAX_STACK_ALLOC 768 -#else #define MAX_STACK_ALLOC 832 -#endif #define FRONTEND_STACK_ALLOC 256 #define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC #define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A503A291B7C; Sun, 24 Mar 2024 23:50:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324238; cv=none; b=tpBemvVAliVXyie77DUi4ZxOW4HqoUCc2QAZ0Q4oOm6kaUQOQ0T68VMGRACNNQhGF0JDriIKA9xT8V3sL7aH6BQM3RjC15RnjjxxbnpT/wxXnNPhSznjss9gVAWLV9353IPojFqyunOuRvH7Oxd0lU4Wo6IIOk2KS0hjDKr5XRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324238; c=relaxed/simple; bh=2K95XuFUUlB5s66cKWmbhLkdOpfBkjlpzMybXLaXRhE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K5kenHCtgl94YQHz/VDtR3J8itykHzxKE1C9VPYYh5/4lXhsqG64+ERXh1fPo3a7CB+nR9+ynn4rhb8pGz1pHLcXvbTZEEsG9ePZHj0r+O7FLLT5njrb4qZsXwm7OzZYF7h4rJP6Ia/e7Hz7r0OSE+EBJnz47za4uKo6IMH1Uws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RIUpUvU4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RIUpUvU4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D31D1C43399; Sun, 24 Mar 2024 23:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324237; bh=2K95XuFUUlB5s66cKWmbhLkdOpfBkjlpzMybXLaXRhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RIUpUvU4GlLWp/tdZl17isLU250oHTLZ/tCpToygpS45eK4veiWUvDlG6DgS41S6Q 1WtwOpF2vxNhndIs2cCWYgNJarQueUUZOXVlgyBHkAbDm7rGSiPSYgTynoiMVxrU08 6v7yMli51f9AQ2thAq0U079oqoVOc3Yn3YscS50v/dzhFsHYKsqQtklDcS3E1QhwT1 3B1hkOzCJnhx9nbZa+8SYaPqzvr4DTtZ54wl3axsbmRVspMk0VG2NqkmtZba8cnq2W lzrYCw9EfMJd62i6da9SBSNjLYUmD7rfQGPj6xpwJsdcIJOHeYHjpAL8M1KIzjxxpv +vTSJM1Uo9+7w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 020/148] md: switch to ->check_events for media change notifications Date: Sun, 24 Mar 2024 19:48:04 -0400 Message-ID: <20240324235012.1356413-21-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit a564e23f0f99759f453dbefcb9160dec6d99df96 ] md is the last driver using the legacy media_changed method. Switch it over to (not so) new ->clear_events approach, which also removes the need for the ->revalidate_disk method. Signed-off-by: Christoph Hellwig [axboe: remove unused 'bdops' variable in disk_clear_events()] Signed-off-by: Jens Axboe Stable-dep-of: 9674f54e41ff ("md: Don't clear MD_CLOSING when the raid is a= bout to stop") Signed-off-by: Sasha Levin --- Documentation/filesystems/Locking | 4 +--- block/genhd.c | 8 +------- drivers/md/md.c | 19 ++++++++----------- include/linux/blkdev.h | 2 -- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/= Locking index efea228ccd8af..da300708404d1 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking @@ -404,7 +404,6 @@ prototypes: int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned l= ong); int (*direct_access) (struct block_device *, sector_t, void **, unsigned long *); - int (*media_changed) (struct gendisk *); void (*unlock_native_capacity) (struct gendisk *); int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); @@ -417,13 +416,12 @@ release: yes ioctl: no compat_ioctl: no direct_access: no -media_changed: no unlock_native_capacity: no revalidate_disk: no getgeo: no swap_slot_free_notify: no (see below) =20 -media_changed, unlock_native_capacity and revalidate_disk are called only = from +unlock_native_capacity and revalidate_disk are called only from check_disk_change(). =20 swap_slot_free_notify is called with swap_lock and sometimes the page lock diff --git a/block/genhd.c b/block/genhd.c index 27a410d310870..d2502e175aca0 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1771,18 +1771,12 @@ void disk_flush_events(struct gendisk *disk, unsign= ed int mask) */ unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask) { - const struct block_device_operations *bdops =3D disk->fops; struct disk_events *ev =3D disk->ev; unsigned int pending; unsigned int clearing =3D mask; =20 - if (!ev) { - /* for drivers still using the old ->media_changed method */ - if ((mask & DISK_EVENT_MEDIA_CHANGE) && - bdops->media_changed && bdops->media_changed(disk)) - return DISK_EVENT_MEDIA_CHANGE; + if (!ev) return 0; - } =20 disk_block_events(disk); =20 diff --git a/drivers/md/md.c b/drivers/md/md.c index 3cc28b2836078..a137f8b4a0541 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5455,6 +5455,7 @@ static int md_alloc(dev_t dev, char *name) * remove it now. */ disk->flags |=3D GENHD_FL_EXT_DEVT; + disk->events |=3D DISK_EVENT_MEDIA_CHANGE; mddev->gendisk =3D disk; add_disk(disk); =20 @@ -7565,20 +7566,17 @@ static void md_release(struct gendisk *disk, fmode_= t mode) mddev_put(mddev); } =20 -static int md_media_changed(struct gendisk *disk) -{ - struct mddev *mddev =3D disk->private_data; - - return mddev->changed; -} - -static int md_revalidate(struct gendisk *disk) +static unsigned int md_check_events(struct gendisk *disk, unsigned int cle= aring) { struct mddev *mddev =3D disk->private_data; + unsigned int ret =3D 0; =20 + if (mddev->changed) + ret =3D DISK_EVENT_MEDIA_CHANGE; mddev->changed =3D 0; - return 0; + return ret; } + static const struct block_device_operations md_fops =3D { .owner =3D THIS_MODULE, @@ -7589,8 +7587,7 @@ static const struct block_device_operations md_fops = =3D .compat_ioctl =3D md_compat_ioctl, #endif .getgeo =3D md_getgeo, - .media_changed =3D md_media_changed, - .revalidate_disk=3D md_revalidate, + .check_events =3D md_check_events, }; =20 static int md_thread(void *arg) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 56fe682d9beb4..ac407c1d4d40f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1994,8 +1994,6 @@ struct block_device_operations { int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned l= ong); unsigned int (*check_events) (struct gendisk *disk, unsigned int clearing); - /* ->media_changed() is DEPRECATED, use ->check_events() instead */ - int (*media_changed) (struct gendisk *); void (*unlock_native_capacity) (struct gendisk *); int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD2AD291B76; Sun, 24 Mar 2024 23:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324240; cv=none; b=qqNJHC5N0DKPAfdLmJYcRkRkyye47R2OVuhnuuH8kRsSR4HgGfxX8M9QWTNY8A2nZTIuBWhapq3Yn79Knn6JVPOK5JQaaMSh7TIhKWJL9Fgue6vrUuvUzXNMubdQjRvoQmGrwbv7QtjeaoHrkjK+dj+uWNGNTYPfldQEjIBtons= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324240; c=relaxed/simple; bh=M5YgR7dp89qvG5/MBGCVJI1h4SHXDq4czn6ZSPk3NT4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L0bF4ASScNL4jN3yoWcepPm2ynBxybkNJa6VfDi7Vyz5qxqa+W5XKAWLeGIHtuWxjKM8ym3U+U7L7cNxUlKZaKo8TKIXvtRykz+z3vhCzyjLBniV71IucAlW+zRWxFpP37WhJA/3ZIgjBAnOZuGzZuM42qd05LHSNaDqAVy+2V4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q3kDPozZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q3kDPozZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4584C433C7; Sun, 24 Mar 2024 23:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324238; bh=M5YgR7dp89qvG5/MBGCVJI1h4SHXDq4czn6ZSPk3NT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q3kDPozZOAEILnXDZF9VvnoSotmHR28PBVIdCy0pynr/qHf9kLh+PM4dRvGddQ9x3 Hi2HCL08f3Mv8JUjlevKDyT0foTNmTv3TSy03NF5UC8xGffSbI/wO7KSa1ilBrHJlE ZOLIDeFTl7p/LBBphgaPegc/y6LG1vjp25xuQPXQGpIl4VREJ5n0zEUeGy9dBoBF6L W1XfjXmdeeg9WaSPQqXuMRbkNMCzkIrmH39HmHOa0SKup4/mx9Ni40cyWji4+UuBgK TEj6r8OsW5LIUX0nqvHZ97dNYzELDjncUrPHr+/WJInom9mbUKn4UgrosmqZCQzz+G seiT5igIIiDVQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 021/148] block: add a new set_read_only method Date: Sun, 24 Mar 2024 19:48:05 -0400 Message-ID: <20240324235012.1356413-22-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit e00adcadf3af7a8335026d71ab9f0e0a922191ac ] Add a new method to allow for driver-specific processing when setting or clearing the block device read-only state. This allows to replace the cumbersome and error-prone override of the whole ioctl implementation. Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Stable-dep-of: 9674f54e41ff ("md: Don't clear MD_CLOSING when the raid is a= bout to stop") Signed-off-by: Sasha Levin --- block/ioctl.c | 5 +++++ include/linux/blkdev.h | 1 + 2 files changed, 6 insertions(+) diff --git a/block/ioctl.c b/block/ioctl.c index 3884d810efd27..6d6c4f4c411a6 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -451,6 +451,11 @@ static int blkdev_roset(struct block_device *bdev, fmo= de_t mode, return ret; if (get_user(n, (int __user *)arg)) return -EFAULT; + if (bdev->bd_disk->fops->set_read_only) { + ret =3D bdev->bd_disk->fops->set_read_only(bdev, n); + if (ret) + return ret; + } set_device_ro(bdev, n); return 0; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ac407c1d4d40f..8f0aafae09d97 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1997,6 +1997,7 @@ struct block_device_operations { void (*unlock_native_capacity) (struct gendisk *); int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); + int (*set_read_only)(struct block_device *bdev, bool ro); /* this callback is with swap_lock and sometimes page table lock held */ void (*swap_slot_free_notify) (struct block_device *, unsigned long); struct module *owner; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A083291B81; Sun, 24 Mar 2024 23:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324240; cv=none; b=QNUJYdt13jc5SxYV+SUapGz61ZYvO3ZPYkfrJl5sVGpU79i9orR186HFA0YbRN/Zycjz55jLxl9voXat7RBEwVlXuXBknKm4utaJLx3tXO0oz41+y2Q00370jOIE3bq1KhNw2QPDJZiMXOAfFWhj2uqRmEyLo5aoshJwkmiD0Tc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324240; c=relaxed/simple; bh=so3jRYMGbySBRs2qMRh+Igr+9lA6q80jvIqCKMuk8bc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B05bocf2QJ9uO0fmMUM7mA7SqwbQTVbZ/n1p7bPEJHIgPT5vCwffJeL5iiKK4rZp0Z5A5RUqT0kjyMCIRMeCHHWeCXDehJEzzyszCcX6Rwnu+GmzfnAR48BfMNEzjBZpabHh7KeXcqkhKQxtRzBT+1yBd38XoN8dq6GPBOm7mUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RaZQbhPr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RaZQbhPr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9917C433F1; Sun, 24 Mar 2024 23:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324239; bh=so3jRYMGbySBRs2qMRh+Igr+9lA6q80jvIqCKMuk8bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RaZQbhPrCBWEYs7QSceJr3g8ReJAn6BahZ7BHRHfJtTzyi7Outae4SqGUnFHTO7eu 2g0GJyIAn1LGV32w2gronUOFF+I8qHQTM8viIu0JO28yQprM+89sVGpITu9+KP9UMU sSQrN7rkwZRxxjMzMBZxFIDLfiIhyyv0mHkDBs0UDag4ZxRdbN/z3MAYVEBVxeBJOe 9LY9qTci39RaQDZopYBzq0zdvGmsp8KsDkWSlMocCCkx/fzgbyQkucjESWWqz81cBn 8Bbx1PXDHLDx8blSNaF1CmgkB9dFvftepcV0j82YTgjXrLOiiGqY3peOHAtiC6Y1MR yF0YQMg8errUQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Song Liu , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 022/148] md: implement ->set_read_only to hook into BLKROSET processing Date: Sun, 24 Mar 2024 19:48:06 -0400 Message-ID: <20240324235012.1356413-23-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit 118cf084adb3964d06e1667cf7d702e56e5cd2c5 ] Implement the ->set_read_only method instead of parsing the actual ioctl command. Signed-off-by: Christoph Hellwig Acked-by: Song Liu Signed-off-by: Jens Axboe Stable-dep-of: 9674f54e41ff ("md: Don't clear MD_CLOSING when the raid is a= bout to stop") Signed-off-by: Sasha Levin --- drivers/md/md.c | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index a137f8b4a0541..8123c44de7dc8 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7172,7 +7172,6 @@ static inline bool md_ioctl_valid(unsigned int cmd) { switch (cmd) { case ADD_NEW_DISK: - case BLKROSET: case GET_ARRAY_INFO: case GET_BITMAP_FILE: case GET_DISK_INFO: @@ -7200,7 +7199,6 @@ static int md_ioctl(struct block_device *bdev, fmode_= t mode, int err =3D 0; void __user *argp =3D (void __user *)arg; struct mddev *mddev =3D NULL; - int ro; bool did_set_md_closing =3D false; =20 if (!md_ioctl_valid(cmd)) @@ -7391,35 +7389,6 @@ static int md_ioctl(struct block_device *bdev, fmode= _t mode, goto unlock; } break; - - case BLKROSET: - if (get_user(ro, (int __user *)(arg))) { - err =3D -EFAULT; - goto unlock; - } - err =3D -EINVAL; - - /* if the bdev is going readonly the value of mddev->ro - * does not matter, no writes are coming - */ - if (ro) - goto unlock; - - /* are we are already prepared for writes? */ - if (mddev->ro !=3D 1) - goto unlock; - - /* transitioning to readauto need only happen for - * arrays that call md_write_start - */ - if (mddev->pers) { - err =3D restart_array(mddev); - if (err =3D=3D 0) { - mddev->ro =3D 2; - set_disk_ro(mddev->gendisk, 0); - } - } - goto unlock; } =20 /* @@ -7513,6 +7482,36 @@ static int md_compat_ioctl(struct block_device *bdev= , fmode_t mode, } #endif /* CONFIG_COMPAT */ =20 +static int md_set_read_only(struct block_device *bdev, bool ro) +{ + struct mddev *mddev =3D bdev->bd_disk->private_data; + int err; + + err =3D mddev_lock(mddev); + if (err) + return err; + + if (!mddev->raid_disks && !mddev->external) { + err =3D -ENODEV; + goto out_unlock; + } + + /* + * Transitioning to read-auto need only happen for arrays that call + * md_write_start and which are not ready for writes yet. + */ + if (!ro && mddev->ro =3D=3D 1 && mddev->pers) { + err =3D restart_array(mddev); + if (err) + goto out_unlock; + mddev->ro =3D 2; + } + +out_unlock: + mddev_unlock(mddev); + return err; +} + static int md_open(struct block_device *bdev, fmode_t mode) { /* @@ -7588,6 +7587,7 @@ static const struct block_device_operations md_fops = =3D #endif .getgeo =3D md_getgeo, .check_events =3D md_check_events, + .set_read_only =3D md_set_read_only, }; =20 static int md_thread(void *arg) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B03213C907; Sun, 24 Mar 2024 23:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324241; cv=none; b=R0+4kEOhUCJWpIxxYt9LLcI60Zvp3+gNK77N9GDxhuaOBNw755srSL301PRMOMpmiWjAGTHuCkC4iqa+MVjVPU23jyvLRIPIep2Bq9Ewnj2N4CBGerpwooEr6FLVzcMu2sHCM2LllHB1mtFdJfOaEtcz7xlzmcWG+E19Jd4S/MY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324241; c=relaxed/simple; bh=YNK11JBRy/npL12b7ivY2GafbRJ5idFF/fFNwrKvM8I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n57GQyDn3VMtY+pIJzT/nmrgsHwwpgEagfa3Q01QOgXZa7LonaU7I7/BHav7dE3J/G0N0+n6lqeguZnd3cgO8wyU7FMumpG/btVEgDJ1xzRa0Iq32AQ4fxJojPed9Dy/+YtOuXcXz0+GHiQ5uVbjyd3nFMSMB+yujb2I4PyTxZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y8Gvyxo9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y8Gvyxo9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C02AEC43390; Sun, 24 Mar 2024 23:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324240; bh=YNK11JBRy/npL12b7ivY2GafbRJ5idFF/fFNwrKvM8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y8Gvyxo9fs8hByAqVM5uHsvH9fXUYmXxiOx2Jd/Av0Wzmk8vaTPtfNS3j9lmr2WBL 01njgM/odwF7MT8qaH7POg0WaN1xCIEcOTrJxt9IUBt1e5y+vDw0k2SRNgBQ6IRaRB ei+LST0gPpDDvxxCHuI0HkV1rflUkOPWzN+w0qsig5czXiQzOTiObeA4gXdzKw24dP DJQGcq5AkhfDK+4HHjuaoxo/sKdsfk/u1z33ZMBhAJlVD+CCJGwd+cMSpa9DAFkN8d Pbmlh/UB3yMdiTthmWRQwKAxrjdspY66ku9yUc/Y5CU4Wo3uXSuUQXjU6Chle4IQwp XFDSbV2S4Zr2g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Li Nan , Yu Kuai , Song Liu , Sasha Levin Subject: [PATCH 4.19 023/148] md: Don't clear MD_CLOSING when the raid is about to stop Date: Sun, 24 Mar 2024 19:48:07 -0400 Message-ID: <20240324235012.1356413-24-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li Nan [ Upstream commit 9674f54e41fffaf06f6a60202e1fa4cc13de3cf5 ] The raid should not be opened anymore when it is about to be stopped. However, other processes can open it again if the flag MD_CLOSING is cleared before exiting. From now on, this flag will not be cleared when the raid will be stopped. Fixes: 065e519e71b2 ("md: MD_CLOSING needs to be cleared after called md_se= t_readonly or do_md_stop") Signed-off-by: Li Nan Reviewed-by: Yu Kuai Signed-off-by: Song Liu Link: https://lore.kernel.org/r/20240226031444.3606764-6-linan666@huaweiclo= ud.com Signed-off-by: Sasha Levin --- drivers/md/md.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 8123c44de7dc8..68eb3220be1c9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5886,7 +5886,15 @@ static void md_clean(struct mddev *mddev) mddev->persistent =3D 0; mddev->level =3D LEVEL_NONE; mddev->clevel[0] =3D 0; - mddev->flags =3D 0; + /* + * Don't clear MD_CLOSING, or mddev can be opened again. + * 'hold_active !=3D 0' means mddev is still in the creation + * process and will be used later. + */ + if (mddev->hold_active) + mddev->flags =3D 0; + else + mddev->flags &=3D BIT_ULL_MASK(MD_CLOSING); mddev->sb_flags =3D 0; mddev->ro =3D 0; mddev->metadata_type[0] =3D 0; @@ -7199,7 +7207,6 @@ static int md_ioctl(struct block_device *bdev, fmode_= t mode, int err =3D 0; void __user *argp =3D (void __user *)arg; struct mddev *mddev =3D NULL; - bool did_set_md_closing =3D false; =20 if (!md_ioctl_valid(cmd)) return -ENOTTY; @@ -7294,7 +7301,6 @@ static int md_ioctl(struct block_device *bdev, fmode_= t mode, err =3D -EBUSY; goto out; } - did_set_md_closing =3D true; mutex_unlock(&mddev->open_mutex); sync_blockdev(bdev); } @@ -7458,7 +7464,7 @@ static int md_ioctl(struct block_device *bdev, fmode_= t mode, mddev->hold_active =3D 0; mddev_unlock(mddev); out: - if(did_set_md_closing) + if (cmd =3D=3D STOP_ARRAY_RO || (err && cmd =3D=3D STOP_ARRAY)) clear_bit(MD_CLOSING, &mddev->flags); return err; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8523913C905; Sun, 24 Mar 2024 23:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324241; cv=none; b=mvn2t5iAcF/+lgUW7SkUVLbGqYGUxi/4KoWgq1BrwEaA5aMqWz1a9FFjQyc2QmlBfxL1TFUnNdxPHueAl8oajjskoza+1KLYo1xjdn8sRU3YBd1IGoRV8bO2CWGawmKfZlsaXvNVyVKxdv6Rv1rELN1p/Binli2XANVg9Pw5tFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324241; c=relaxed/simple; bh=TguXJKuy5CaVUAV88Cbuqnahj5AOGBnq+XeOpYY/+Hk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rZcNlic9Ved6sN1b1VQ7LhwpNwseTeIwIvx7OaiS5Y3E/34/Os3BApeiWziXFxvftMn7+Nw8OzI2/33Gj19rwJGSZlbOG06ZkE//u/5yLjYklKdJpWW/+xLI1M0qCTWERoUL4e9+FhjOCzWqwIjsoXWGqH/253PTJdXeXWfz0tI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MGKO8QGw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MGKO8QGw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C20AAC433F1; Sun, 24 Mar 2024 23:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324241; bh=TguXJKuy5CaVUAV88Cbuqnahj5AOGBnq+XeOpYY/+Hk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MGKO8QGwgVySskkac3zsU2JLAJH4QEgqEB0tYIFZ2xSi3ghUuwglV4EkGXsJsY8Zg mcY2MHcYm8jAVJuHFvV3I54QDKzvdP/FwK5QtZrTFNUqX557gpYw/ZklJbio1/2wsB F3aUujsL4Qshc733o0b09t/sLswYfLQM/vRaS0CjEXZR0bzYEft/0MBazeoBYZY0Vl Ik42au7yTanPCTE+YVdVHgdNRMoAyc0w/Z0SMcy/YFRWpTPFOkXCbyk5XgOIy9qtSI ieGygiXSZs7oKn+21rh1Mk2aCH9i6CMv2ML4cxScJJwmYlVBnfT+eLtkSUb+wKRDQw a+QvS4E61fiwg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chun-Yi Lee , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 024/148] aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts Date: Sun, 24 Mar 2024 19:48:08 -0400 Message-ID: <20240324235012.1356413-25-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Chun-Yi Lee [ Upstream commit f98364e926626c678fb4b9004b75cacf92ff0662 ] This patch is against CVE-2023-6270. The description of cve is: A flaw was found in the ATA over Ethernet (AoE) driver in the Linux kernel. The aoecmd_cfg_pkts() function improperly updates the refcnt on `struct net_device`, and a use-after-free can be triggered by racing between the free on the struct and the access through the `skbtxq` global queue. This could lead to a denial of service condition or potential code execution. In aoecmd_cfg_pkts(), it always calls dev_put(ifp) when skb initial code is finished. But the net_device ifp will still be used in later tx()->dev_queue_xmit() in kthread. Which means that the dev_put(ifp) should NOT be called in the success path of skb initial code in aoecmd_cfg_pkts(). Otherwise tx() may run into use-after-free because the net_device is freed. This patch removed the dev_put(ifp) in the success path in aoecmd_cfg_pkts(), and added dev_put() after skb xmit in tx(). Link: https://nvd.nist.gov/vuln/detail/CVE-2023-6270 Fixes: 7562f876cd93 ("[NET]: Rework dev_base via list_head (v3)") Signed-off-by: Chun-Yi Lee Link: https://lore.kernel.org/r/20240305082048.25526-1-jlee@suse.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/aoe/aoecmd.c | 12 ++++++------ drivers/block/aoe/aoenet.c | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 136dc507d0206..c2b32c53da2bb 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c @@ -420,13 +420,16 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoemin= or, struct sk_buff_head *qu rcu_read_lock(); for_each_netdev_rcu(&init_net, ifp) { dev_hold(ifp); - if (!is_aoe_netif(ifp)) - goto cont; + if (!is_aoe_netif(ifp)) { + dev_put(ifp); + continue; + } =20 skb =3D new_skb(sizeof *h + sizeof *ch); if (skb =3D=3D NULL) { printk(KERN_INFO "aoe: skb alloc failure\n"); - goto cont; + dev_put(ifp); + continue; } skb_put(skb, sizeof *h + sizeof *ch); skb->dev =3D ifp; @@ -441,9 +444,6 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor= , struct sk_buff_head *qu h->major =3D cpu_to_be16(aoemajor); h->minor =3D aoeminor; h->cmd =3D AOECMD_CFG; - -cont: - dev_put(ifp); } rcu_read_unlock(); } diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index 63773a90581dd..1e66c7a188a12 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c @@ -64,6 +64,7 @@ tx(int id) __must_hold(&txlock) pr_warn("aoe: packet could not be sent on %s. %s\n", ifp ? ifp->name : "netif", "consider increasing tx_queue_len"); + dev_put(ifp); spin_lock_irq(&txlock); } return 0; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E24AE292283; Sun, 24 Mar 2024 23:50:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324244; cv=none; b=JYvXeTElU5a2H/Em41JwZzYVuRi2zBP2zppdsY6OurVGGfb8ItOZd1MplVZb+FFzRDJIPGptu0OQTXJNvnT/+2rLvLtnE36w74ivNaxNY1oWZb4+LidkA9czD/iNM18AZz/DMCttPguGV1LgDhGLIyovndu9hBvYcnsR7eCVctw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324244; c=relaxed/simple; bh=YBZ/Z3qxETClGZ9YmPiZZ8L2J5W54q8SBZw6ZTNOx0k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N2uDOTYZm0RwKvnyGnS9+2MObVAEx+q7LrLr6hbtxML/NdJVQ8gEi1lVK+vTkE3taRrVorOVQt4/qipExxdFBojj7Yrgc5fRAl1UMJu2Ls0BjBPzyngdhJ0+c5hmRVn13RO3Plc9bPrvV0oa1uOr6Shx3d14cz2GGv4yQEklfA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mEnR/ZPe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mEnR/ZPe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC3B7C43399; Sun, 24 Mar 2024 23:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324242; bh=YBZ/Z3qxETClGZ9YmPiZZ8L2J5W54q8SBZw6ZTNOx0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mEnR/ZPeKjwGmg6ld7U1XlTn1PkyUIqPCkuEkMwIMuXLHqQXRUqBa5JCq4yUm1Vs9 47Liz5L4WK9Ipo3S5vwfdwmJ2DHayn5QqAZPr7NKwNd8MEBTqErQo5UCgsRd3laiQk NNbfQbNTVW0D5U+1sjewHBnwbiIaYCaV+moK+lpESQ5m/0DyWnDPtQPfpJzWRFTPc+ ga8ANuO/yY/Za9+4xoAbiTU+AzNjxqUYpG0bzMiE18g0IwyDBVLw4ln1d59u9awhVo rjtuCbks1k+4xoRuqxBgyofaxsNVxLrSzbpnzvRfK9SpBDzPuP8qd7MiEmeAD3p77T CnGJr6wONn5yg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Hilber , Thomas Gleixner , John Stultz , Sasha Levin Subject: [PATCH 4.19 025/148] timekeeping: Fix cross-timestamp interpolation on counter wrap Date: Sun, 24 Mar 2024 19:48:09 -0400 Message-ID: <20240324235012.1356413-26-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Hilber [ Upstream commit 84dccadd3e2a3f1a373826ad71e5ced5e76b0c00 ] cycle_between() decides whether get_device_system_crosststamp() will interpolate for older counter readings. cycle_between() yields wrong results for a counter wrap-around where after < before < test, and for the case after < test < before. Fix the comparison logic. Fixes: 2c756feb18d9 ("time: Add history to cross timestamp interface suppor= ting slower devices") Signed-off-by: Peter Hilber Signed-off-by: Thomas Gleixner Acked-by: John Stultz Link: https://lore.kernel.org/r/20231218073849.35294-2-peter.hilber@opensyn= ergy.com Signed-off-by: Sasha Levin --- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 087f71183c3f2..7a306bad183bf 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1097,7 +1097,7 @@ static bool cycle_between(u64 before, u64 test, u64 a= fter) { if (test > before && test < after) return true; - if (test < before && before > after) + if (before > after && (test > before || test < after)) return true; return false; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AAA829228C; Sun, 24 Mar 2024 23:50:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324244; cv=none; b=Seu2LkH/6u5XpsY+v3q5IlwDhM/s8Yr3oERZkbPZ1k9whBAtf4uN3JALQm7MxkHyNdy3eDQzgtSaWTH5rioFnsRO1pktISfclRjjOKBOL9kQCinf6NwVqk7C40ORFVowoQoDUHYao+eBhaQ+D+F0lXWPu44dBwgnpa1hoYPnrJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324244; c=relaxed/simple; bh=Hp/udDsapKe89ZqHMUz64ohyNInEBirBb3dx0/MEa2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JD0Eftduo7OJ6nE3bn1l/r2yozFDdsUXU6RDXC8lbbTuxbPve3fppPOUn3gagproQO+STpYu2NaDukvPOlxWITilEmdx3AYCPbf6FItYbpqn90pIsUgIkDT1RL9niZlelVvGe9dJvoH307cG6iqmpy+ShgyHj8ou5mK3z8GJeUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ut/FJ0AV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ut/FJ0AV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6530C43390; Sun, 24 Mar 2024 23:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324243; bh=Hp/udDsapKe89ZqHMUz64ohyNInEBirBb3dx0/MEa2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ut/FJ0AV6Lc3Dwmmifxgfs0XoyHItgRbQOkRK4pKmX+JpxTjjr6jcpIdtyBdOzBb3 MoHMXkdbdQCb+vbZ2nZcTgjVNSlXRMfeIgR8VSfv2/tGQt5rffWUsbBO1TgUJn8qfn 6vJ0tIiAKJ0nU/PYPkXfkYITCCpH46zWGU1jhxOfXdCPSZRA8ldbAVKiOMYfzBCkFW pP0aphTeKlQfhkpJew7ej8rU+I6lbd13+q0NZBdWT+YRDV3mFVG0iWT/IGyPlTGbBq zJYh9ucEkhS7tsIOsDUtRjscubal4n8mHLKc9WChD2TUR46kSxtFz487PNe4adoBmx Arxo81xWod0eQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Hilber , Thomas Gleixner , Sasha Levin Subject: [PATCH 4.19 026/148] timekeeping: Fix cross-timestamp interpolation corner case decision Date: Sun, 24 Mar 2024 19:48:10 -0400 Message-ID: <20240324235012.1356413-27-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Hilber [ Upstream commit 87a41130881995f82f7adbafbfeddaebfb35f0ef ] The cycle_between() helper checks if parameter test is in the open interval (before, after). Colloquially speaking, this also applies to the counter wrap-around special case before > after. get_device_system_crosststamp() currently uses cycle_between() at the first call site to decide whether to interpolate for older counter readings. get_device_system_crosststamp() has the following problem with cycle_between() testing against an open interval: Assume that, by chance, cycles =3D=3D tk->tkr_mono.cycle_last (in the following, "cycle_last" for brevity). Then, cycle_between() at the first call site, with effective argument values cycle_between(cycle_last, cycles, now), returns false, enabling interpolation. During interpolation, get_device_system_crosststamp() will then call cycle_between() at the second call site (if a history_begin was supplied). The effective argument values are cycle_between(history_begin->cycles, cycles, cycles), since system_counterval.cycles =3D=3D interval_start =3D=3D cycles, per the assum= ption. Due to the test against the open interval, cycle_between() returns false again. This causes get_device_system_crosststamp() to return -EINVAL. This failure should be avoided, since get_device_system_crosststamp() works both when cycles follows cycle_last (no interpolation), and when cycles precedes cycle_last (interpolation). For the case cycles =3D=3D cycle_last, interpolation is actually unneeded. Fix this by changing cycle_between() into timestamp_in_interval(), which now checks against the closed interval, rather than the open interval. This changes the get_device_system_crosststamp() behavior for three corner cases: 1. Bypass interpolation in the case cycles =3D=3D tk->tkr_mono.cycle_last, fixing the problem described above. 2. At the first timestamp_in_interval() call site, cycles =3D=3D now no lon= ger causes failure. 3. At the second timestamp_in_interval() call site, history_begin->cycles =3D=3D system_counterval.cycles no longer causes failure. adjust_historical_crosststamp() also works for this corner case, where partial_history_cycles =3D=3D total_history_cycles. These behavioral changes should not cause any problems. Fixes: 2c756feb18d9 ("time: Add history to cross timestamp interface suppor= ting slower devices") Signed-off-by: Peter Hilber Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20231218073849.35294-3-peter.hilber@opensyn= ergy.com Signed-off-by: Sasha Levin --- kernel/time/timekeeping.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 7a306bad183bf..ab36b20cdbec2 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1091,13 +1091,15 @@ static int adjust_historical_crosststamp(struct sys= tem_time_snapshot *history, } =20 /* - * cycle_between - true if test occurs chronologically between before and = after + * timestamp_in_interval - true if ts is chronologically in [start, end] + * + * True if ts occurs chronologically at or after start, and before or at e= nd. */ -static bool cycle_between(u64 before, u64 test, u64 after) +static bool timestamp_in_interval(u64 start, u64 end, u64 ts) { - if (test > before && test < after) + if (ts >=3D start && ts <=3D end) return true; - if (before > after && (test > before || test < after)) + if (start > end && (ts >=3D start || ts <=3D end)) return true; return false; } @@ -1157,7 +1159,7 @@ int get_device_system_crosststamp(int (*get_time_fn) */ now =3D tk_clock_read(&tk->tkr_mono); interval_start =3D tk->tkr_mono.cycle_last; - if (!cycle_between(interval_start, cycles, now)) { + if (!timestamp_in_interval(interval_start, now, cycles)) { clock_was_set_seq =3D tk->clock_was_set_seq; cs_was_changed_seq =3D tk->cs_was_changed_seq; cycles =3D interval_start; @@ -1188,13 +1190,13 @@ int get_device_system_crosststamp(int (*get_time_fn) bool discontinuity; =20 /* - * Check that the counter value occurs after the provided + * Check that the counter value is not before the provided * history reference and that the history doesn't cross a * clocksource change */ if (!history_begin || - !cycle_between(history_begin->cycles, - system_counterval.cycles, cycles) || + !timestamp_in_interval(history_begin->cycles, + cycles, system_counterval.cycles) || history_begin->cs_was_changed_seq !=3D cs_was_changed_seq) return -EINVAL; partial_history_cycles =3D cycles - system_counterval.cycles; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 239FC2922A1; Sun, 24 Mar 2024 23:50:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324246; cv=none; b=MS3+PHvjk61ji4YTLsCcjHe5rpL4Rj2JGkVqdJHZaRtYwG3jTL6vZR8y4OZ0qY+1hLN0jMI/xf/7EOnNPFmBom4vvulUV6u5SQUE5VjiJ9nElyWq7d6BGbs6UtktMTfu0+gFWHBs3nWbtt+91CBDpHTxJt9Qo3pBINqDZjW5BZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324246; c=relaxed/simple; bh=QlKPp7qNBSAXPKEws/Yji1u9tXamMxzPDlnODcN9YBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FzQU8bhuQ/74CZPup2yeJNpe6RRNqs+rThDrW/5OfQpBlFFi5fHYTllAz4NkOjaDCKeeEBR2BarweFkh33B+4VLpW/0esucG9dCXiL8Rl/NRMwMbVL4ipzww3NlbQVEQCAstRgRuHPvjZ9b01UXMte5a4o54tgROCso6r8O61Ck= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AZPA2ty/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AZPA2ty/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E27B7C43394; Sun, 24 Mar 2024 23:50:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324244; bh=QlKPp7qNBSAXPKEws/Yji1u9tXamMxzPDlnODcN9YBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZPA2ty/BSPkSEmQsVIxACcSTLwLdmP41rG7/IAYc18GEEwe6/RlCtjBf0SFwNj9w qnevFXyDrSOms1pskQnr6ZjsLMkFhWf/+anKYCkAy2KvzygJaX/1xAj/z4vo551zOj EVRPsDU6PeoJo0ax+GIhero8cJhhBWRx66R0RmzlQ1dAwaqSRXfXGDwFD3QR+NnC+/ SQNwUlnfCHcatk7cafyqDVFl4ueaAEm0EZ0znq9tqJJA4G1R89E3ysf6wAPbEdCoXa Sv9fs7mW8KVam9WDFFpWQw8UTC6sC1+Xrn+U1IOHPwkkoiZ/+p0s1MiNJ7DZ5gtZYD 8909C83GHgwNw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Hilber , Thomas Gleixner , John Stultz , Sasha Levin Subject: [PATCH 4.19 027/148] timekeeping: Fix cross-timestamp interpolation for non-x86 Date: Sun, 24 Mar 2024 19:48:11 -0400 Message-ID: <20240324235012.1356413-28-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Hilber [ Upstream commit 14274d0bd31b4debf28284604589f596ad2e99f2 ] So far, get_device_system_crosststamp() unconditionally passes system_counterval.cycles to timekeeping_cycles_to_ns(). But when interpolating system time (do_interp =3D=3D true), system_counterval.cycles= is before tkr_mono.cycle_last, contrary to the timekeeping_cycles_to_ns() expectations. On x86, CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE will mitigate on interpolating, setting delta to 0. With delta =3D=3D 0, xtstamp->sys_monoraw and xtstamp->sys_realtime are then set to the last update time, as implicitly expected by adjust_historical_crosststamp(). On other architectures, the resulting nonsense xtstamp->sys_monoraw and xtstamp->sys_realtime corrupt the xtstamp (ts) adjustment in adjust_historical_crosststamp(). Fix this by deriving xtstamp->sys_monoraw and xtstamp->sys_realtime from the last update time when interpolating, by using the local variable "cycles". The local variable already has the right value when interpolating, unlike system_counterval.cycles. Fixes: 2c756feb18d9 ("time: Add history to cross timestamp interface suppor= ting slower devices") Signed-off-by: Peter Hilber Signed-off-by: Thomas Gleixner Acked-by: John Stultz Link: https://lore.kernel.org/r/20231218073849.35294-4-peter.hilber@opensyn= ergy.com Signed-off-by: Sasha Levin --- kernel/time/timekeeping.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ab36b20cdbec2..e43706e2c038f 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1172,10 +1172,8 @@ int get_device_system_crosststamp(int (*get_time_fn) tk_core.timekeeper.offs_real); base_raw =3D tk->tkr_raw.base; =20 - nsec_real =3D timekeeping_cycles_to_ns(&tk->tkr_mono, - system_counterval.cycles); - nsec_raw =3D timekeeping_cycles_to_ns(&tk->tkr_raw, - system_counterval.cycles); + nsec_real =3D timekeeping_cycles_to_ns(&tk->tkr_mono, cycles); + nsec_raw =3D timekeeping_cycles_to_ns(&tk->tkr_raw, cycles); } while (read_seqcount_retry(&tk_core.seq, seq)); =20 xtstamp->sys_realtime =3D ktime_add_ns(base_real, nsec_real); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 791072922B2; Sun, 24 Mar 2024 23:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324247; cv=none; b=Yz4MkXfwqWu5Nc9mbDXpkIbXpx9H8nJ0QIwxK9EBWavWZLnJMg4aI3kdoezQYoWimHl48OEmBQKbFrH3PedZJuz50T0kU1HpNWLpFwv6WoP2Ve/BW0iBNyiQJO5bIjEoIJrtzoZTfFjuQC0dg+jLcLivPxoKwGA1uAmHGgW+OSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324247; c=relaxed/simple; bh=JXlbG+tRxwqUWRpCzakl4kGGlgD5ASN65oakHttJqHk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NvB3VW3YDSTHSBWH07okO+f7qCgVXepxMGdEqwp1Gh9cWOkXechbhSSnCjzjYf8aDYwRfPVUXCcgcDcB+MnrEW9ImB0L7iKhVq79sqBZqvPNX7q+Wuxe4PgymsM/GlldO8LI29PCEWH9qUepaMKuYx/2hbuv5AKuOAuZP5obwFU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hA+J2DWr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hA+J2DWr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8A3BC433C7; Sun, 24 Mar 2024 23:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324246; bh=JXlbG+tRxwqUWRpCzakl4kGGlgD5ASN65oakHttJqHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hA+J2DWr6/CzfuQ/znmuKe+XJGIR5cp78s17SFU7x6XUC522WKE68tGcUPBwYyHmD glwflRpsXeGQ9QWCY4kYsB9gjeBgCcxtqdHxBMp2IE+0tdkUQOgLGKehcZgYkAY5Xi zUYVDig/9vXmbj+EPjUah1k5n7xmrlfYyTmi63DWVw4vNh/TsIqcF53SoM9yOD6YRn MJXgIJnpgDfZzYscGGpw/spsoau4dBzawO7YHfCDVXYNFWGErZyI8Cvjsx6eNHI4Wl G4JFrLtCcbnbKn1pvJCzbc6+x3OqYSiZ3qy1SOOn6NAkIYt0HLPHcT/S2V9k61o1ar wcPPQShbN5jqw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xingyuan Mo , Jeff Johnson , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 028/148] wifi: ath10k: fix NULL pointer dereference in ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev() Date: Sun, 24 Mar 2024 19:48:12 -0400 Message-ID: <20240324235012.1356413-29-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xingyuan Mo [ Upstream commit ad25ee36f00172f7d53242dc77c69fff7ced0755 ] We should check whether the WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_EVENT tlv is present before accessing it, otherwise a null pointer deference error will occur. Fixes: dc405152bb64 ("ath10k: handle mgmt tx completion event") Signed-off-by: Xingyuan Mo Acked-by: Jeff Johnson Signed-off-by: Kalle Valo Link: https://msgid.link/20231208043433.271449-1-hdthky0@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wirele= ss/ath/ath10k/wmi-tlv.c index 243887fdb343e..c9df78950ff4b 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -684,6 +684,10 @@ ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev(struct ath10k = *ar, struct sk_buff *skb, } =20 ev =3D tb[WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_EVENT]; + if (!ev) { + kfree(tb); + return -EPROTO; + } =20 arg->desc_id =3D ev->desc_id; arg->status =3D ev->status; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0F912922BF; Sun, 24 Mar 2024 23:50:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324248; cv=none; b=l8W0hPD5ZgiO56JkKdk22wV/i6VuON9gSySRO8+hMvM+fcbA6mnoYaM/vaF6ldD7ZD1eUtbJGqEw6V/RbsLXHCJECCYFCZ9EwonWQczBuvNz7Abzv+C92XV9Wh3xye/tW5Tz+Beti5Y1pvOsknQIx3ami/Mn+g0EQwIRZ2P1JAM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324248; c=relaxed/simple; bh=smshtFHAwlVcTOQX9VhkAJrOCcm3yVbANEIS75plS4o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AD/45oBV2GomjwcRK1QgucrSHDDiGhbVQQWl0lVzb7WWdJrTxSl6MdKqv8Yr8N6ULIq+4Y9snov0IDGd55KukyVlqIC/2qe5XXy30CyFxPCTv1IrFrgL+773wb7se2p+L1CzdRMGA3bi4R0s75b7MH5DPlJUSYghsPV8hcQsvaA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DQ+r9d05; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DQ+r9d05" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 500B5C43390; Sun, 24 Mar 2024 23:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324247; bh=smshtFHAwlVcTOQX9VhkAJrOCcm3yVbANEIS75plS4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQ+r9d05rrL2NeNrkKsEyy07w5EZBopIRyelaCBTwC7flMe5gIB8FLshuiUjU0FRq 99nMCFbJltrTvaL61IDzdj/qI47YX4bk0wjFL4ceQGvALF00pjgjiZN8HBeNeCaK/X Ia09rqPuWUGt/YnzQg7Fz27G2tP7mIo0Hpz0Z0upJlq+v8/VEQY1pB7nnmpp2xdEfD 36VcstCSDNnBCWZ3Py9OrauCF+xl8Zu2LURK4CJ1R3EswH01U4uOPRWcAop45WaIUZ N0D8fnOAE5qwhwUjO4sEkW+96ZJUmZFrWEeha8E2JojLKcm0967HpMQVZ1L9GDuFPs sjrHa5Xct9C2Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Saurav Girepunje , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 029/148] b43: dma: Fix use true/false for bool type variable Date: Sun, 24 Mar 2024 19:48:13 -0400 Message-ID: <20240324235012.1356413-30-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Saurav Girepunje [ Upstream commit a9160bb35ad9ada8428a4d48426f7fc128db40cc ] use true/false for bool type variables assignment. Signed-off-by: Saurav Girepunje Signed-off-by: Kalle Valo Stable-dep-of: 9636951e4468 ("wifi: b43: Stop/wake correct queue in DMA Tx = path when QoS is disabled") Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/b43/dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/dma.c b/drivers/net/wireless= /broadcom/b43/dma.c index 06139835055fa..cd809d5e46791 100644 --- a/drivers/net/wireless/broadcom/b43/dma.c +++ b/drivers/net/wireless/broadcom/b43/dma.c @@ -1462,7 +1462,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff = *skb) /* This TX ring is full. */ unsigned int skb_mapping =3D skb_get_queue_mapping(skb); ieee80211_stop_queue(dev->wl->hw, skb_mapping); - dev->wl->tx_queue_stopped[skb_mapping] =3D 1; + dev->wl->tx_queue_stopped[skb_mapping] =3D true; ring->stopped =3D true; if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { b43dbg(dev->wl, "Stopped TX ring %d\n", ring->index); @@ -1628,7 +1628,7 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, } =20 if (dev->wl->tx_queue_stopped[ring->queue_prio]) { - dev->wl->tx_queue_stopped[ring->queue_prio] =3D 0; + dev->wl->tx_queue_stopped[ring->queue_prio] =3D false; } else { /* If the driver queue is running wake the corresponding * mac80211 queue. */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 270C0183B94; Sun, 24 Mar 2024 23:50:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324250; cv=none; b=WF7djO0iC+YdREpcVeGRdMxkBFRXDqftT9dU6pbW4zxjXlP1swDWM9Q7zlNPVA0zyPU6cdIJLpIC44w/QVLqrkDYLzAmk3b1+VyM3hd8UUCWHefRSSiVV4Hkhg2jlQSfHyhM+VAf720DA2fD12dNfsdWQABJ5wxv2VvEDyoMepo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324250; c=relaxed/simple; bh=tlAVRSjqREzsAPoPaExTm8Y8eu0M3S9+PrgzO+O93Uw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eXUC9X/qdjATOnNZ+ImXcf6vDJ8p0n7DkV257DgMRppPaEk3uxYM1vAeTZXW0Q4QuZR16iRSmmp6ADUshUSUxKlea0rw6H8F2EO61tCuF0lM8qh/YbjAyjleMBIQw9kUCOdrTR6CNAaoUQMsJxOjju1Bb6FQfUNuP18bytptfwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FOB4pwYL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FOB4pwYL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCF75C43394; Sun, 24 Mar 2024 23:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324249; bh=tlAVRSjqREzsAPoPaExTm8Y8eu0M3S9+PrgzO+O93Uw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOB4pwYLlK3uj/wBsQn5IQUecQbfqjqezLvDyJZw9qd46cZDEmEBrJS4ix6Pv6h1v ugZe+RU7kZPlQGtBWY6mjXBgz9ksxboYnBm/S9rxVs3f5TVM0o7ekwlLHYjO767hoj BlzS8qIk+BsPSs2ISG2bOEJFzahgrIHMz7nyQTmmKQCXy+kNlvFxoP1tu0VvHOWhGK Kqa58CI1eP9rQsgsFCXJihZ32NBIJ95SrbZdlfvH5K6aWAPEroZ5DUKsjscUGj6r6k +Bdf+mahUEtEbOUeY95w2/NY8rrqWvHSWjqezstMFjaGsHsdG2yHun0xniNPWSFptr gjrLCRRv6ndxA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rahul Rameshbabu , Julian Calaby , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 030/148] wifi: b43: Stop/wake correct queue in DMA Tx path when QoS is disabled Date: Sun, 24 Mar 2024 19:48:14 -0400 Message-ID: <20240324235012.1356413-31-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rahul Rameshbabu [ Upstream commit 9636951e4468f02c72cc75a82dc65d003077edbc ] When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop/wake queue 0 when QoS is disabled to prevent trying to stop/wake a non-existent queue and failing to stop/wake the actual queue instantiated. Log of issue before change (with kernel parameter qos=3D0): [ +5.112651] ------------[ cut here ]------------ [ +0.000005] WARNING: CPU: 7 PID: 25513 at net/mac80211/util.c:449 __i= eee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000067] Modules linked in: b43(O) snd_seq_dummy snd_hrtimer snd_s= eq snd_seq_device nft_chain_nat xt_MASQUERADE nf_nat xfrm_user xfrm_algo xt= _addrtype overlay ccm af_packet amdgpu snd_hda_codec_cirrus snd_hda_codec_g= eneric ledtrig_audio drm_exec amdxcp gpu_sched xt_conntrack nf_conntrack nf= _defrag_ipv6 nf_defrag_ipv4 ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf= _log_syslog xt_tcpudp nft_compat nf_tables nfnetlink sch_fq_codel btusb uin= put iTCO_wdt ctr btrtl intel_pmc_bxt i915 intel_rapl_msr mei_hdcp mei_pxp j= oydev at24 watchdog btintel atkbd libps2 serio radeon btbcm vivaldi_fmap bt= mtk intel_rapl_common snd_hda_codec_hdmi bluetooth uvcvideo nls_iso8859_1 a= pplesmc nls_cp437 x86_pkg_temp_thermal snd_hda_intel intel_powerclamp vfat = videobuf2_vmalloc coretemp fat snd_intel_dspcfg crc32_pclmul uvc polyval_cl= mulni snd_intel_sdw_acpi loop videobuf2_memops snd_hda_codec tun drm_suball= oc_helper polyval_generic drm_ttm_helper drm_buddy tap ecdh_generic videobu= f2_v4l2 gf128mul macvlan ttm ghash_clmulni_intel ecc tg3 [ +0.000044] videodev bridge snd_hda_core rapl crc16 drm_display_help= er cec mousedev snd_hwdep evdev intel_cstate bcm5974 hid_appleir videobuf2_= common stp mac_hid libphy snd_pcm drm_kms_helper acpi_als mei_me intel_unco= re llc mc snd_timer intel_gtt industrialio_triggered_buffer apple_mfi_fastc= harge i2c_i801 mei snd lpc_ich agpgart ptp i2c_smbus thunderbolt apple_gmux= i2c_algo_bit kfifo_buf video industrialio soundcore pps_core wmi tiny_powe= r_button sbs sbshc button ac cordic bcma mac80211 cfg80211 ssb rfkill libar= c4 kvm_intel kvm drm irqbypass fuse backlight firmware_class efi_pstore con= figfs efivarfs dmi_sysfs ip_tables x_tables autofs4 dm_crypt cbc encrypted_= keys trusted asn1_encoder tee tpm rng_core input_leds hid_apple led_class h= id_generic usbhid hid sd_mod t10_pi crc64_rocksoft crc64 crc_t10dif crct10d= if_generic ahci libahci libata uhci_hcd ehci_pci ehci_hcd crct10dif_pclmul = crct10dif_common sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_= intel usbcore scsi_mod libaes crypto_simd cryptd scsi_common [ +0.000055] usb_common rtc_cmos btrfs blake2b_generic libcrc32c crc3= 2c_generic crc32c_intel xor raid6_pq dm_snapshot dm_bufio dm_mod dax [last = unloaded: b43(O)] [ +0.000009] CPU: 7 PID: 25513 Comm: irq/17-b43 Tainted: G W O= 6.6.7 #1-NixOS [ +0.000003] Hardware name: Apple Inc. MacBookPro8,3/Mac-942459F5819B1= 71B, BIOS 87.0.0.0.0 06/13/2019 [ +0.000001] RIP: 0010:__ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000046] Code: 00 45 85 e4 0f 85 9b 00 00 00 48 8d bd 40 09 00 00 = f0 48 0f ba ad 48 09 00 00 00 72 0f 5b 5d 41 5c 41 5d 41 5e e9 cb 6d 3c d0 = <0f> 0b 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc 48 8d b4 16 94 00 00 [ +0.000002] RSP: 0018:ffffc90003c77d60 EFLAGS: 00010097 [ +0.000001] RAX: 0000000000000001 RBX: 0000000000000002 RCX: 00000000= 00000000 [ +0.000001] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff8882= 0b924900 [ +0.000002] RBP: ffff88820b924900 R08: ffffc90003c77d90 R09: 00000000= 0003bfd0 [ +0.000001] R10: ffff88820b924900 R11: ffffc90003c77c68 R12: 00000000= 00000000 [ +0.000001] R13: 0000000000000000 R14: ffffc90003c77d90 R15: ffffffff= c0fa6f40 [ +0.000001] FS: 0000000000000000(0000) GS:ffff88846fb80000(0000) knl= GS:0000000000000000 [ +0.000001] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ +0.000001] CR2: 00007fafda7ae008 CR3: 000000046d220005 CR4: 00000000= 000606e0 [ +0.000002] Call Trace: [ +0.000003] [ +0.000001] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000044] ? __warn+0x81/0x130 [ +0.000005] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000045] ? report_bug+0x171/0x1a0 [ +0.000004] ? handle_bug+0x41/0x70 [ +0.000004] ? exc_invalid_op+0x17/0x70 [ +0.000003] ? asm_exc_invalid_op+0x1a/0x20 [ +0.000005] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000043] ieee80211_wake_queue+0x4a/0x80 [mac80211] [ +0.000044] b43_dma_handle_txstatus+0x29c/0x3a0 [b43] [ +0.000016] ? __pfx_irq_thread_fn+0x10/0x10 [ +0.000002] b43_handle_txstatus+0x61/0x80 [b43] [ +0.000012] b43_interrupt_thread_handler+0x3f9/0x6b0 [b43] [ +0.000011] irq_thread_fn+0x23/0x60 [ +0.000002] irq_thread+0xfe/0x1c0 [ +0.000002] ? __pfx_irq_thread_dtor+0x10/0x10 [ +0.000001] ? __pfx_irq_thread+0x10/0x10 [ +0.000001] kthread+0xe8/0x120 [ +0.000003] ? __pfx_kthread+0x10/0x10 [ +0.000003] ret_from_fork+0x34/0x50 [ +0.000002] ? __pfx_kthread+0x10/0x10 [ +0.000002] ret_from_fork_asm+0x1b/0x30 [ +0.000004] [ +0.000001] ---[ end trace 0000000000000000 ]--- [ +0.000065] ------------[ cut here ]------------ [ +0.000001] WARNING: CPU: 0 PID: 56077 at net/mac80211/util.c:514 __i= eee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000077] Modules linked in: b43(O) snd_seq_dummy snd_hrtimer snd_s= eq snd_seq_device nft_chain_nat xt_MASQUERADE nf_nat xfrm_user xfrm_algo xt= _addrtype overlay ccm af_packet amdgpu snd_hda_codec_cirrus snd_hda_codec_g= eneric ledtrig_audio drm_exec amdxcp gpu_sched xt_conntrack nf_conntrack nf= _defrag_ipv6 nf_defrag_ipv4 ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf= _log_syslog xt_tcpudp nft_compat nf_tables nfnetlink sch_fq_codel btusb uin= put iTCO_wdt ctr btrtl intel_pmc_bxt i915 intel_rapl_msr mei_hdcp mei_pxp j= oydev at24 watchdog btintel atkbd libps2 serio radeon btbcm vivaldi_fmap bt= mtk intel_rapl_common snd_hda_codec_hdmi bluetooth uvcvideo nls_iso8859_1 a= pplesmc nls_cp437 x86_pkg_temp_thermal snd_hda_intel intel_powerclamp vfat = videobuf2_vmalloc coretemp fat snd_intel_dspcfg crc32_pclmul uvc polyval_cl= mulni snd_intel_sdw_acpi loop videobuf2_memops snd_hda_codec tun drm_suball= oc_helper polyval_generic drm_ttm_helper drm_buddy tap ecdh_generic videobu= f2_v4l2 gf128mul macvlan ttm ghash_clmulni_intel ecc tg3 [ +0.000073] videodev bridge snd_hda_core rapl crc16 drm_display_help= er cec mousedev snd_hwdep evdev intel_cstate bcm5974 hid_appleir videobuf2_= common stp mac_hid libphy snd_pcm drm_kms_helper acpi_als mei_me intel_unco= re llc mc snd_timer intel_gtt industrialio_triggered_buffer apple_mfi_fastc= harge i2c_i801 mei snd lpc_ich agpgart ptp i2c_smbus thunderbolt apple_gmux= i2c_algo_bit kfifo_buf video industrialio soundcore pps_core wmi tiny_powe= r_button sbs sbshc button ac cordic bcma mac80211 cfg80211 ssb rfkill libar= c4 kvm_intel kvm drm irqbypass fuse backlight firmware_class efi_pstore con= figfs efivarfs dmi_sysfs ip_tables x_tables autofs4 dm_crypt cbc encrypted_= keys trusted asn1_encoder tee tpm rng_core input_leds hid_apple led_class h= id_generic usbhid hid sd_mod t10_pi crc64_rocksoft crc64 crc_t10dif crct10d= if_generic ahci libahci libata uhci_hcd ehci_pci ehci_hcd crct10dif_pclmul = crct10dif_common sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_= intel usbcore scsi_mod libaes crypto_simd cryptd scsi_common [ +0.000084] usb_common rtc_cmos btrfs blake2b_generic libcrc32c crc3= 2c_generic crc32c_intel xor raid6_pq dm_snapshot dm_bufio dm_mod dax [last = unloaded: b43] [ +0.000012] CPU: 0 PID: 56077 Comm: kworker/u16:17 Tainted: G = W O 6.6.7 #1-NixOS [ +0.000003] Hardware name: Apple Inc. MacBookPro8,3/Mac-942459F5819B1= 71B, BIOS 87.0.0.0.0 06/13/2019 [ +0.000001] Workqueue: phy7 b43_tx_work [b43] [ +0.000019] RIP: 0010:__ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000076] Code: 74 11 48 8b 78 08 0f b7 d6 89 e9 4c 89 e6 e8 ab f4 = 00 00 65 ff 0d 9c b7 34 3f 0f 85 55 ff ff ff 0f 1f 44 00 00 e9 4b ff ff ff = <0f> 0b 5b 5d 41 5c 41 5d c3 cc cc cc cc 0f 1f 80 00 00 00 00 90 90 [ +0.000002] RSP: 0000:ffffc90004157d50 EFLAGS: 00010097 [ +0.000002] RAX: 0000000000000001 RBX: 0000000000000002 RCX: 00000000= 00000000 [ +0.000002] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff8882= d65d0900 [ +0.000002] RBP: 0000000000000000 R08: 0000000000000001 R09: 00000000= 00000001 [ +0.000001] R10: 00000000000000ff R11: ffff88814d0155a0 R12: ffff8882= d65d0900 [ +0.000002] R13: 0000000000000000 R14: ffff8881002d2800 R15: 00000000= 000000d0 [ +0.000002] FS: 0000000000000000(0000) GS:ffff88846f800000(0000) knl= GS:0000000000000000 [ +0.000003] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ +0.000002] CR2: 00007f2e8c10c880 CR3: 0000000385b66005 CR4: 00000000= 000606f0 [ +0.000002] Call Trace: [ +0.000001] [ +0.000001] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000075] ? __warn+0x81/0x130 [ +0.000004] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000075] ? report_bug+0x171/0x1a0 [ +0.000005] ? handle_bug+0x41/0x70 [ +0.000003] ? exc_invalid_op+0x17/0x70 [ +0.000004] ? asm_exc_invalid_op+0x1a/0x20 [ +0.000004] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000076] ieee80211_stop_queue+0x36/0x50 [mac80211] [ +0.000077] b43_dma_tx+0x550/0x780 [b43] [ +0.000023] b43_tx_work+0x90/0x130 [b43] [ +0.000018] process_one_work+0x174/0x340 [ +0.000003] worker_thread+0x27b/0x3a0 [ +0.000004] ? __pfx_worker_thread+0x10/0x10 [ +0.000002] kthread+0xe8/0x120 [ +0.000003] ? __pfx_kthread+0x10/0x10 [ +0.000004] ret_from_fork+0x34/0x50 [ +0.000002] ? __pfx_kthread+0x10/0x10 [ +0.000003] ret_from_fork_asm+0x1b/0x30 [ +0.000006] [ +0.000001] ---[ end trace 0000000000000000 ]--- Fixes: e6f5b934fba8 ("b43: Add QOS support") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby Signed-off-by: Kalle Valo Link: https://msgid.link/20231231050300.122806-2-sergeantsagara@protonmail.= com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/b43/b43.h | 16 ++++++++++++++++ drivers/net/wireless/broadcom/b43/dma.c | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/b43.h b/drivers/net/wireless= /broadcom/b43/b43.h index a449561fccf28..f6bf07dfb7488 100644 --- a/drivers/net/wireless/broadcom/b43/b43.h +++ b/drivers/net/wireless/broadcom/b43/b43.h @@ -1082,6 +1082,22 @@ static inline bool b43_using_pio_transfers(struct b4= 3_wldev *dev) return dev->__using_pio_transfers; } =20 +static inline void b43_wake_queue(struct b43_wldev *dev, int queue_prio) +{ + if (dev->qos_enabled) + ieee80211_wake_queue(dev->wl->hw, queue_prio); + else + ieee80211_wake_queue(dev->wl->hw, 0); +} + +static inline void b43_stop_queue(struct b43_wldev *dev, int queue_prio) +{ + if (dev->qos_enabled) + ieee80211_stop_queue(dev->wl->hw, queue_prio); + else + ieee80211_stop_queue(dev->wl->hw, 0); +} + /* Message printing */ __printf(2, 3) void b43info(struct b43_wl *wl, const char *fmt, ...); __printf(2, 3) void b43err(struct b43_wl *wl, const char *fmt, ...); diff --git a/drivers/net/wireless/broadcom/b43/dma.c b/drivers/net/wireless= /broadcom/b43/dma.c index cd809d5e46791..8a3806aec5ee8 100644 --- a/drivers/net/wireless/broadcom/b43/dma.c +++ b/drivers/net/wireless/broadcom/b43/dma.c @@ -1461,7 +1461,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff = *skb) should_inject_overflow(ring)) { /* This TX ring is full. */ unsigned int skb_mapping =3D skb_get_queue_mapping(skb); - ieee80211_stop_queue(dev->wl->hw, skb_mapping); + b43_stop_queue(dev, skb_mapping); dev->wl->tx_queue_stopped[skb_mapping] =3D true; ring->stopped =3D true; if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { @@ -1632,7 +1632,7 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, } else { /* If the driver queue is running wake the corresponding * mac80211 queue. */ - ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); + b43_wake_queue(dev, ring->queue_prio); if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { b43dbg(dev->wl, "Woke up TX ring %d\n", ring->index); } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 328BC22BC16; Sun, 24 Mar 2024 23:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324250; cv=none; b=f1K2tCL23HzsBlF+vWloacF6VGRcgYy0P4VWJL50qXV2D3P1t13M02ScxHHPp+QqzfjJvY/0exUFhF4cK5W1u+L92WlaaYimIA+GBLpoNG7Zp8UPTCHBn/rGtsGH3zOT5kqFy7M0rQugi6pa6Ld+XXWN3FLZqWCgpoihynBF2ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324250; c=relaxed/simple; bh=5z5T5U+rc/bIpLonhsBzQWnhc990gxEqPP+rxRuF7gU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RGpbY5H130kWMYQbbxT5N7LP0lKzqbieG3n9Vs4BpCV5z7Pl+0s89GLGGxqan4xWnSgjyt9Zlx3i9j4gflUkXuaaPxaohTD5hFVNhXBGebsdbVbT9+sCLS7KT45L0PfR44oZqGuKrbpNDua6g4Ifl/XOCKkarTjshCeo113Szws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eDU4ByJS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eDU4ByJS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 547C0C433C7; Sun, 24 Mar 2024 23:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324250; bh=5z5T5U+rc/bIpLonhsBzQWnhc990gxEqPP+rxRuF7gU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDU4ByJSiaqxFXDA2FMKC2wYiV/tdX4lFedwZexGVYxLcQ4xyDPDKZBX5JegDENup JCz7L6IpQHEimL4dhalte/bF5nAjRLQ7YkduEiQazZNh01tElmBtUxuXfl7YvBUgZJ vtGa2fMeHq/fYxLNR7K2xGU/h+l29NGuC3iL1Lv+LwJs9BgCuXoPHj2a4F+vnO6GFS 19jCN28LRKVHXYOiKtdxld1Ht6o2IvZq4X40D4gTP+M4vQ2z0A1lKDg23KE6I5fY8Q 9+fO2xD88sJcsjYsYTmyotldW90ouSkJguG8/xtPq+xVjiGgZ4/MgzA3m4l5qmV+gw pXpiewryUBLQA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rahul Rameshbabu , Julian Calaby , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 031/148] wifi: b43: Stop/wake correct queue in PIO Tx path when QoS is disabled Date: Sun, 24 Mar 2024 19:48:15 -0400 Message-ID: <20240324235012.1356413-32-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rahul Rameshbabu [ Upstream commit 77135a38f6c2f950d2306ac3d37cbb407e6243f2 ] When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop/wake queue 0 when QoS is disabled to prevent trying to stop/wake a non-existent queue and failing to stop/wake the actual queue instantiated. Fixes: 5100d5ac81b9 ("b43: Add PIO support for PCMCIA devices") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby Signed-off-by: Kalle Valo Link: https://msgid.link/20231231050300.122806-3-sergeantsagara@protonmail.= com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/b43/pio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/pio.c b/drivers/net/wireless= /broadcom/b43/pio.c index a4ff5e2a42b95..b5126edcdc803 100644 --- a/drivers/net/wireless/broadcom/b43/pio.c +++ b/drivers/net/wireless/broadcom/b43/pio.c @@ -538,7 +538,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *s= kb) if (total_len > (q->buffer_size - q->buffer_used)) { /* Not enough memory on the queue. */ err =3D -EBUSY; - ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); + b43_stop_queue(dev, skb_get_queue_mapping(skb)); q->stopped =3D true; goto out; } @@ -565,7 +565,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *s= kb) if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) || (q->free_packet_slots =3D=3D 0)) { /* The queue is full. */ - ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); + b43_stop_queue(dev, skb_get_queue_mapping(skb)); q->stopped =3D true; } =20 @@ -600,7 +600,7 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev, list_add(&pack->list, &q->packets_list); =20 if (q->stopped) { - ieee80211_wake_queue(dev->wl->hw, q->queue_prio); + b43_wake_queue(dev, q->queue_prio); q->stopped =3D false; } } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5995B292B67; Sun, 24 Mar 2024 23:50:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324251; cv=none; b=hdi60BpbwZJM1V+pS1EwxEOuCbXWU+ZawlZI07tokioJ3nRyZlw5XM0GiFAJoLdqFZN1jDofrocz8m34JN7k90Ixiicn/+VgfQTaSsZTGwQxWAxTNVYUlPakr7hseA/OQme9D+hnoLbyPDUkMLa4o6057U4ieV6fqhOa9cYqSt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324251; c=relaxed/simple; bh=EhBvnKGSZLniY1L5nfRKi85l59tR4Iws3UV+tHLHoqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=naCxsJRUndb2gC9QtBzilWlpv/tXiyIjB+P8HB83M9VO0Lo4uJi25YyyMoUM704Z/LAChCPoqrLVWyBPiZp8JVn8KcDLkew8ltMcktUeKKSXu5SFKki1oC63eLxWVAXz3K6zeAEhXrwv/YZlYHNU+wMsHdLgeW39Ml76tLeVSJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jj/aBrbo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jj/aBrbo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 584D2C43394; Sun, 24 Mar 2024 23:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324251; bh=EhBvnKGSZLniY1L5nfRKi85l59tR4Iws3UV+tHLHoqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jj/aBrboeiTw8PmEiDxwc13yysHoR4wQ2YF8ESYD/4KoLUsAh/8Kzu7WK7sCwJfT8 /P4tcICIMGCPwC9wDA9+M8DhNJc0yVejVdyRUo0/pJC84oBI1PF4VDhWdOsQZQe6ZG GQNf28UEe60NsewKCTgiU0qAcOz3HFcregIOd9TJgb53XsZA27x5DVXwBtulqSQIId L1tPa9cvQBoDdSDntenB4ETBccZdEbBi2J9mDYR57bFWpw6fDBr8CN/f/RcaGXasJX 0RqeE+FfQL9zdkNndk/9KSygBqDKUCmah+a97AAtKBa7pFoYFaXMRdFr5txdWZM4Oz O7kohuxxjiPRg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Saurav Girepunje , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 032/148] b43: main: Fix use true/false for bool type Date: Sun, 24 Mar 2024 19:48:16 -0400 Message-ID: <20240324235012.1356413-33-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Saurav Girepunje [ Upstream commit 6db774c1725059f98e4fce97f878688248584be5 ] use true/false on bool type variable assignment. Signed-off-by: Saurav Girepunje Signed-off-by: Kalle Valo Stable-dep-of: 581c8967d66c ("wifi: b43: Stop correct queue in DMA worker w= hen QoS is disabled") Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/b43/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireles= s/broadcom/b43/main.c index 8a226a9d755e2..9a3563de60a77 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -3625,7 +3625,7 @@ static void b43_tx_work(struct work_struct *work) else err =3D b43_dma_tx(dev, skb); if (err =3D=3D -ENOSPC) { - wl->tx_queue_stopped[queue_num] =3D 1; + wl->tx_queue_stopped[queue_num] =3D true; ieee80211_stop_queue(wl->hw, queue_num); skb_queue_head(&wl->tx_queue[queue_num], skb); break; @@ -3636,7 +3636,7 @@ static void b43_tx_work(struct work_struct *work) } =20 if (!err) - wl->tx_queue_stopped[queue_num] =3D 0; + wl->tx_queue_stopped[queue_num] =3D false; } =20 #if B43_DEBUG @@ -5630,7 +5630,7 @@ static struct b43_wl *b43_wireless_init(struct b43_bu= s_dev *dev) /* Initialize queues and flags. */ for (queue_num =3D 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) { skb_queue_head_init(&wl->tx_queue[queue_num]); - wl->tx_queue_stopped[queue_num] =3D 0; + wl->tx_queue_stopped[queue_num] =3D false; } =20 snprintf(chip_name, ARRAY_SIZE(chip_name), --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A33C292B6E; Sun, 24 Mar 2024 23:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324252; cv=none; b=puNyzbLzU+c8xcw+/oyHshDhyZKQimCvf9HknqSdO1KlieGXJ/jFIQAara/ei+i6QHYuYl5gLeu+GeBOOyyzbMqC3WlKVB6LClFSNi/CfYOlpgGDwZMZC376lYel3COIXKyaNszVcAW2zwQYh1c1uOvwVaT+u8gtrvXYStMundo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324252; c=relaxed/simple; bh=3ZuJ+pXQ/AnszgvSm+zgL7hh1Uz2YSr6DW2ZNTAK8NY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k9TfpNBJ2fwMz3nkEgAtd5a660D2gwyV2cl4OKYkKkssmGSEbF/Hk/N3xKTeYG9c9gVaPFMTqRnLoYgj2d/ulEPHsvXSlgW9jw8mICsESY8W9qipaV+9NqT6Fvyg2Jk2DNtXuEan4QUGWW3Ppvk2Zjlc/N835+y7nUcBm3PSoAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t16ssajP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t16ssajP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40506C433C7; Sun, 24 Mar 2024 23:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324252; bh=3ZuJ+pXQ/AnszgvSm+zgL7hh1Uz2YSr6DW2ZNTAK8NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t16ssajPakozxFrgqwPeksp0KmFiTDX1aSOO1HoTTklfkHqGKD7X9p+h3Q0NIhXux NLcuRclQt5lLDI2+t9EBbYOdgvj/KEkEFTr8YGE5uqkf/ef6vpwD1pdSYgSSJ9cE+W dls2Y5U4lYYhJUrZhYrs0qjSm+46TyWn1P7GG/XVqD6XlwDjfok2BKc7qUgP5k3rhg Qf2Op0eP0qjIj+6KA/1AB2zgDmisR8xsQPd/PsIA29h/gOTwtTfzOX6jZrpJZeoR00 m24J5NtuX+FWJRBoDiaP0O2XyGuLy/KBxHPk4fX/b+KP0qC7x1nA0Wpnnagm9ZoF/e 6rRbphtbyRx8Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rahul Rameshbabu , Julian Calaby , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 033/148] wifi: b43: Stop correct queue in DMA worker when QoS is disabled Date: Sun, 24 Mar 2024 19:48:17 -0400 Message-ID: <20240324235012.1356413-34-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rahul Rameshbabu [ Upstream commit 581c8967d66c4961076dbbee356834e9c6777184 ] When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop queue 0 when QoS is disabled to prevent trying to stop a non-existent queue and failing to stop the actual queue instantiated. Fixes: bad691946966 ("b43: avoid packet losses in the dma worker code.") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby Signed-off-by: Kalle Valo Link: https://msgid.link/20231231050300.122806-4-sergeantsagara@protonmail.= com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/b43/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireles= s/broadcom/b43/main.c index 9a3563de60a77..8d50ebdbeb1e5 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -3626,7 +3626,7 @@ static void b43_tx_work(struct work_struct *work) err =3D b43_dma_tx(dev, skb); if (err =3D=3D -ENOSPC) { wl->tx_queue_stopped[queue_num] =3D true; - ieee80211_stop_queue(wl->hw, queue_num); + b43_stop_queue(dev, queue_num); skb_queue_head(&wl->tx_queue[queue_num], skb); break; } @@ -3650,6 +3650,7 @@ static void b43_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { struct b43_wl *wl =3D hw_to_b43_wl(hw); + u16 skb_queue_mapping; =20 if (unlikely(skb->len < 2 + 2 + 6)) { /* Too short, this can't be a valid frame. */ @@ -3658,12 +3659,12 @@ static void b43_op_tx(struct ieee80211_hw *hw, } B43_WARN_ON(skb_shinfo(skb)->nr_frags); =20 - skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb); - if (!wl->tx_queue_stopped[skb->queue_mapping]) { + skb_queue_mapping =3D skb_get_queue_mapping(skb); + skb_queue_tail(&wl->tx_queue[skb_queue_mapping], skb); + if (!wl->tx_queue_stopped[skb_queue_mapping]) ieee80211_queue_work(wl->hw, &wl->tx_work); - } else { - ieee80211_stop_queue(wl->hw, skb->queue_mapping); - } + else + b43_stop_queue(wl->current_dev, skb_queue_mapping); } =20 static void b43_qos_params_upload(struct b43_wldev *dev, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88B2C292B86; Sun, 24 Mar 2024 23:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324254; cv=none; b=O3XcE13lXPQf7z9DEjaGc67VK72T7r3PCTf0wl7KPcc4QQut85AGeJE4unJXhQvbwXkPUPIYmeENrQftTdO1gqPwQlCBNpqmhs3ufqvB56jMwX++0p/dtRTdxUioNeGsjbaIIaOoiwBFumMZPCBZPoyC827vBTB5HyYFjmRpkRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324254; c=relaxed/simple; bh=Cl2+9RAXpiG4edPW2c0wWsSig5huvF3UphIRctKOF5E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qUh+WusRhrImDuY/nhXwXSY9UslSdmTa+YjGM1Yc7Q6eTY+n21AGDYyaj2bbM09DZCfrc31LS3IOvQY07k5f/NJ481SKxIEk2dtdZ+2Bgvs2Q0jOBXqNrKz72vTZvonCP7eXtVKUY8olqkskb2xkaX59htbtgJEj2ylhj7Ix/Sw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BmWmZIZz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BmWmZIZz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42A98C43390; Sun, 24 Mar 2024 23:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324253; bh=Cl2+9RAXpiG4edPW2c0wWsSig5huvF3UphIRctKOF5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BmWmZIZz35nu3yz0Mq27OXutBbpNdeIYyZedgFCCIlTTjjC8am/f7R5Gqv8yVdBm/ 3GguweXp0xSmQm33br4MvDajtpBx7Mt084dB9QY9eAb2v0Z30FJlVeLSzuXLoKIJX2 tjC4woc6xxEsvzlWIkWKM3HFGTeyn1dyKsSxEAQxGXvE4sM+OcJ7gPQgVvKybosVpN lpGnPY4iaYVPz3+KSwDWmnJxk+XG6Sz05fWtqHXo7+qipojwHcMbH79QkDE5TprkXy tgbA8pTPkYH3CRbewi5J69ZzqVYU+rw2gi8TWvbrtMQ47X4htHXmk2W367wPHkSecj xklsPuitRvjeA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rahul Rameshbabu , Julian Calaby , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 034/148] wifi: b43: Disable QoS for bcm4331 Date: Sun, 24 Mar 2024 19:48:18 -0400 Message-ID: <20240324235012.1356413-35-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rahul Rameshbabu [ Upstream commit 09795bded2e725443fe4a4803cae2079cdaf7b26 ] bcm4331 seems to not function correctly with QoS support. This may be due to issues with currently available firmware or potentially a device specific issue. When queues that are not of the default "best effort" priority are selected, traffic appears to not transmit out of the hardware while no errors are returned. This behavior is present among all the other priority queues: video, voice, and background. While this can be worked around by setting a kernel parameter, the default behavior is problematic for most users and may be difficult to debug. This patch offers a working out-of-box experience for bcm4331 users. Log of the issue (using ssh low-priority traffic as an example): ssh -T -vvvv git@github.com OpenSSH_9.6p1, OpenSSL 3.0.12 24 Oct 2023 debug1: Reading configuration data /etc/ssh/ssh_config debug2: checking match for 'host * exec "/nix/store/q1c2flcykgr4wwg5a6h= 450hxbk4ch589-bash-5.2-p15/bin/bash -c '/nix/store/c015armnkhr6v18za0rypm7s= h1i8js8w-gnupg-2.4.1/bin/gpg-connect-agent --quiet updatestartuptty /bye >/= dev/null 2>&1'"' host github.com originally github.com debug3: /etc/ssh/ssh_config line 5: matched 'host "github.com"' debug1: Executing command: '/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589= -bash-5.2-p15/bin/bash -c '/nix/store/c015armnkhr6v18za0rypm7sh1i8js8w-gnup= g-2.4.1/bin/gpg-connect-agent --quiet updatestartuptty /bye >/dev/null 2>&1= '' debug3: command returned status 0 debug3: /etc/ssh/ssh_config line 5: matched 'exec "/nix/store/q1c2flcyk= gr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash -c '/nix/store/c015armnkhr6v1= 8za0r"' debug2: match found debug1: /etc/ssh/ssh_config line 9: Applying options for * debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/bina= ry-eater/.ssh/known_hosts' debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/bin= ary-eater/.ssh/known_hosts2' debug2: resolving "github.com" port 22 debug3: resolve_host: lookup github.com:22 debug3: channel_clear_timeouts: clearing debug3: ssh_connect_direct: entering debug1: Connecting to github.com [192.30.255.113] port 22. debug3: set_sock_tos: set socket 3 IP_TOS 0x48 Fixes: e6f5b934fba8 ("b43: Add QOS support") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby Signed-off-by: Kalle Valo Link: https://msgid.link/20231231050300.122806-5-sergeantsagara@protonmail.= com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/b43/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireles= s/broadcom/b43/main.c index 8d50ebdbeb1e5..6d18c01b18dd7 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -2605,7 +2605,8 @@ static void b43_request_firmware(struct work_struct *= work) =20 start_ieee80211: wl->hw->queues =3D B43_QOS_QUEUE_NUM; - if (!modparam_qos || dev->fw.opensource) + if (!modparam_qos || dev->fw.opensource || + dev->dev->chip_id =3D=3D BCMA_CHIP_ID_BCM4331) wl->hw->queues =3D 1; =20 err =3D ieee80211_register_hw(wl->hw); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95DCE292B87; Sun, 24 Mar 2024 23:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324254; cv=none; b=Y8KTpw2HWUaPRSG1s0zXV2VYz9Ffnx/Xr1KagHvN/+nnDojN2Z9qop8qMt1XgZu99RjJRD0WCLsZfo7m06JOhYceamFsyksV/1wmxZEsuyHpI7SSifDWxHjQdt4e0LEjD3aj+kKy4y5u3Mw78ycxBmknjoWw1iyKeJSIEpeCxJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324254; c=relaxed/simple; bh=7XJBJ3ssNqsZXuFbQT4PN2MmLcu/dCRwK9QCwYai6S0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fwm+sW+i20aRsYqZH4JM5NBSk9HMoxh2FH+SH7GpK8irP/B/L4FOOjBeV7yciczPDawccKCAelQUPzXPnnUI+cE348dK5ZjjWiD7LJjCJqfLQ8f6M29BG++INXBC+AtlLG75FwSxV/TdWUTz5Jp6HDXVxnE9I6kX03vu5yKcXQw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zk47uWqI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zk47uWqI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE274C433C7; Sun, 24 Mar 2024 23:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324254; bh=7XJBJ3ssNqsZXuFbQT4PN2MmLcu/dCRwK9QCwYai6S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zk47uWqIy/e0+h7AGoXGOgQFosoM8Pbq2UlvCtLsNaTp1lt6BTSJf8M20CY9do7tU Gf61Ww/Ep4oPF6Bd8Hm3cVtKTdK+Lq6OOSNOMcykuxG6yM76WTSuDl7SMoBTjR4G/p jtGs4UfafjWja73+hv75L2fEWoYT8f87P/6bTMLoJwMX8hfVf6aXl5KM6y5YSw34NQ 7FipvyiUTiSZjtMTS4X7oGpfdSRF1OmetCow4czCsRbEQxr9Xh4zg8c9Bvg/xTIGQs HmjJFPO4ykd8FxAKk5prjQ+4FgIx8DbjnQZnWzoi1eKJf3zqNXI+EcG7ljbWdK9uxi uJcMJubQf+/6g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jinjie Ruan , Russell King , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 035/148] wifi: mwifiex: debugfs: Drop unnecessary error check for debugfs_create_dir() Date: Sun, 24 Mar 2024 19:48:19 -0400 Message-ID: <20240324235012.1356413-36-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jinjie Ruan [ Upstream commit 50180c7f8e3de7c2d87f619131776598fcb1478d ] debugfs_create_dir() returns ERR_PTR and never return NULL. As Russell suggested, this patch removes the error checking for debugfs_create_dir(). This is because the DebugFS kernel API is developed in a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes. The debugfs APIs have a IS_ERR() judge in start_creating() which can handle it gracefully. So these checks are unnecessary. Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex= driver") Signed-off-by: Jinjie Ruan Suggested-by: Russell King (Oracle) Signed-off-by: Kalle Valo Link: https://msgid.link/20230903030216.1509013-3-ruanjinjie@huawei.com Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/debugfs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/w= ireless/marvell/mwifiex/debugfs.c index 0f62da50e11a2..63af04202d75f 100644 --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c @@ -977,9 +977,6 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv) priv->dfs_dev_dir =3D debugfs_create_dir(priv->netdev->name, mwifiex_dfs_dir); =20 - if (!priv->dfs_dev_dir) - return; - MWIFIEX_DFS_ADD_FILE(info); MWIFIEX_DFS_ADD_FILE(debug); MWIFIEX_DFS_ADD_FILE(getlog); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27C5A292B99; Sun, 24 Mar 2024 23:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324257; cv=none; b=sYPBybo4+CDQKeri2xOAU2twfNIN8+hOX7qjnN8KlWy8zEjMubECkJGfI1V/VSsyKBrx9/EmKpa8mKhKPWAu31gQd+q+nFKP3eYDAWbkStGWLs6MZhUbC83lTYjN3Z38PGR6YuVrMFSBbwlqJ9qiO63FF4Eh48wIhosrFiCWeFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324257; c=relaxed/simple; bh=nF8gTecMHJ28MLnw2KqbYOA6uuPsOhH922znxV+wWrY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b5u7luy0lCcg+f8o6GnPHmOs16JJTL5IdfIz8Y/BCZ2DEjSWlWULsCFMwBqFxjZDs+tLZMQu/fABB6YG+T00e5jrNcoXE/xB3iHAZfQ8Ae9xQQPLIpe2Gru1EdFS0L5vIeHVk2m5ZrXtKvnCt2KQkOIhy5j7P2ci+ZjEmBOmQtQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Akq55MEu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Akq55MEu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15407C433F1; Sun, 24 Mar 2024 23:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324256; bh=nF8gTecMHJ28MLnw2KqbYOA6uuPsOhH922znxV+wWrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Akq55MEuFkoWK/MWpaH/985nXOmA1k3XYtFG/5NOMAF2UCt0lMjhnfmVUdj+R7CXz EOJVv21KGII3jys0of+D0bvMvRew97K+2pcst4J+9nQdWEQz/3x02TTDOuHR0WrbDF t0MBKZLOGsGUvr2ehvxoaixH7Ly5oOqs55aEseb8270hBEoCKeiHh3L6rpsyHHvtlN QxZolg6g2lTVDTAo4wNDiJU60lZoYIpY4ed8+77bgyofwPlBr5BkiDzxHmZhURNn1O T61or+lf6PRoRuVwmsyEzSHW3e2znRdmplcNtoGOmQqw1t6My4Oie1MyOwkW97Vecx CtftkcROU3ZEQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Sasha Levin Subject: [PATCH 4.19 036/148] ARM: dts: renesas: r8a73a4: Fix external clocks and clock rate Date: Sun, 24 Mar 2024 19:48:20 -0400 Message-ID: <20240324235012.1356413-37-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Geert Uytterhoeven [ Upstream commit 090c4094574705b0afc7d37825cdc5d06f0e7e02 ] External clocks should be defined as zero-Hz clocks in the SoC .dtsi, and overridden in the board .dts when present. Correct the clock rate of extal1 from 25 to 26 MHz, to match the crystal oscillator present on the APE6-EVM board. Fixes: a76809a329d6ebae ("ARM: shmobile: r8a73a4: Common clock framework DT= description") Signed-off-by: Geert Uytterhoeven Reviewed-by: Niklas S=C3=B6derlund Link: https://lore.kernel.org/r/1692bc8cd465d62168cbf110522ad62a7af3f606.17= 05315614.git.geert+renesas@glider.be Signed-off-by: Sasha Levin --- arch/arm/boot/dts/r8a73a4-ape6evm.dts | 12 ++++++++++++ arch/arm/boot/dts/r8a73a4.dtsi | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm.dts b/arch/arm/boot/dts/r8a7= 3a4-ape6evm.dts index d530f451467e2..c077a7c1874a6 100644 --- a/arch/arm/boot/dts/r8a73a4-ape6evm.dts +++ b/arch/arm/boot/dts/r8a73a4-ape6evm.dts @@ -184,6 +184,18 @@ &cmt1 { status =3D "okay"; }; =20 +&extal1_clk { + clock-frequency =3D <26000000>; +}; + +&extal2_clk { + clock-frequency =3D <48000000>; +}; + +&extalr_clk { + clock-frequency =3D <32768>; +}; + &pfc { scifa0_pins: scifa0 { groups =3D "scifa0_data"; diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi index 4447f45f0cba9..48121ef690c9d 100644 --- a/arch/arm/boot/dts/r8a73a4.dtsi +++ b/arch/arm/boot/dts/r8a73a4.dtsi @@ -494,17 +494,20 @@ clocks { extalr_clk: extalr { compatible =3D "fixed-clock"; #clock-cells =3D <0>; - clock-frequency =3D <32768>; + /* This value must be overridden by the board. */ + clock-frequency =3D <0>; }; extal1_clk: extal1 { compatible =3D "fixed-clock"; #clock-cells =3D <0>; - clock-frequency =3D <25000000>; + /* This value must be overridden by the board. */ + clock-frequency =3D <0>; }; extal2_clk: extal2 { compatible =3D "fixed-clock"; #clock-cells =3D <0>; - clock-frequency =3D <48000000>; + /* This value must be overridden by the board. */ + clock-frequency =3D <0>; }; fsiack_clk: fsiack { compatible =3D "fixed-clock"; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 120FB183B8D; Sun, 24 Mar 2024 23:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324258; cv=none; b=fVD7lVfCWuTiboUGhYdaoWkx9Vi2ua++PLRLubkh+zDagHtSJbZyLC+ezx/OzXxe3Plm4lZLndG+L1rCTLwcX4yWnznVkpjvKS5hXztHsaPCzWYM7JW3eExu7aS5rnQBaFzBX2VUyi5PNOnTSiSo3uj4wCgiG+MaqnOcz9ixbTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324258; c=relaxed/simple; bh=/7/1b9rks8twEubNpUt8qsAQs2IeCT+nNQFQ6FdH8sI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SqFSndJu1U1xFEklDdE3SHDYbUVj4W/+UrMjlFKNy+OJqapAQKBRRZUGv/xSWki7oxcckbyLV9IsX0xphGclR+3aUlCNSXojGxv1+6pjkextB7cHoH6noiXvA7QpdG5qDtG5x51lW7z+aUy9XPMoT51rm0Jnzwzf30ugbGKCnBk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BVDbu7rZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BVDbu7rZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B548C43394; Sun, 24 Mar 2024 23:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324256; bh=/7/1b9rks8twEubNpUt8qsAQs2IeCT+nNQFQ6FdH8sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVDbu7rZML13csxl7Y+8xuHjEClBj/izOWzwipHX40Xsa0z/cG/UY1FAIK2B2pEqG Oj6Ju6QZXhjyHRiTKHN0qk3BnLZ8c9/a9iSFbFx5QdIKcstH1ieT9RB6bDSJhcAU/1 WZr/MT9SsK9Ae6ddTLJ6I4mUudAB5fRpB59/AAfI1mda4hv5iMpm7ty4ykwIijT8RD /QGRhnbEvBxVCemQ8i6dcl/W0NcJxQUDY7Ylf635OWyKbNaikFoyGxes1jf/MFcITy L8yXCwjdaryU2exfZdxovTflQI2Nyf69ES7+k+AvgUR8SZY/cHMRHS3Hq1G+e2Iaxg 7X47nj1JMXJTQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anastasia Belova , Viresh Kumar , Sasha Levin Subject: [PATCH 4.19 037/148] cpufreq: brcmstb-avs-cpufreq: add check for cpufreq_cpu_get's return value Date: Sun, 24 Mar 2024 19:48:21 -0400 Message-ID: <20240324235012.1356413-38-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Anastasia Belova [ Upstream commit f661017e6d326ee187db24194cabb013d81bc2a6 ] cpufreq_cpu_get may return NULL. To avoid NULL-dereference check it and return 0 in case of error. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for = Broadcom STB SoCs") Signed-off-by: Anastasia Belova Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/cpufreq/brcmstb-avs-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmst= b-avs-cpufreq.c index 541486217984b..1302e1900dcb1 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c @@ -457,6 +457,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_= data *priv) static unsigned int brcm_avs_cpufreq_get(unsigned int cpu) { struct cpufreq_policy *policy =3D cpufreq_cpu_get(cpu); + if (!policy) + return 0; struct private_data *priv =3D policy->driver_data; =20 return brcm_avs_get_frequency(priv->base); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F4B3183B9B; Sun, 24 Mar 2024 23:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324258; cv=none; b=B9/QYHriowAq3GQwoDDnE4CrOxZpixfK9D04PO4oLNSkz5wSFVz0QT0nWrl+Rc0WesDz3VZgGiZ826eEXOnCuFwkp3WTlFxakxjCxe4LLZxNg8TF7REW0Z2Sx22LNB7RJCwE9td/T1V8CpfYe7uEFaMMWdAFQ676Y9Hylm2eFjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324258; c=relaxed/simple; bh=2mIOyCLUxen6vMiVviNHH630xVdtDk1+xUvLm5fHfaM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l3RMVIIuvCs5Trer/mdSY8fXc+gbHQjLAhnSbnCdET4zX5tzKAixuismkekWmnMIaEmUJh0XX1TIXM8rcUkD5+Y4bKj7PxdNKjDHQGnzx0hA7+/VlLIsqfL10UcaNox8JzDF4i/9qD4g3G/wi6ZjuTslZIrAul0PwnVoweiagWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bcx1Wwmh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Bcx1Wwmh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3727CC433C7; Sun, 24 Mar 2024 23:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324258; bh=2mIOyCLUxen6vMiVviNHH630xVdtDk1+xUvLm5fHfaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bcx1Wwmh4lPpHFGLczO/GjRLzBPFK4NDUUzAGGzs49aSOo1QvXUDb/Qiv7y3kBxi2 +gwBk6rDwNuhGfxts/tTaaH2sGAtjQ3ljE62QH0TwWxkdUwr1w/bMDRgCAwP/GYWlf 0B9nO9XP9/eEZBqo2L0rgeiUvqg1AGEcNDnpTncaKHwv0q/MeIpTuc2TrqJDU3S5Kx LmDe3prTlh2AbVFDT+rGypiolYG9UqSmCYty5/Ql02+Si0jodTwM6oIYydG6coFPAI 0AAI0zpm1W6CqHeiUNlXmfD96axAz1RrxJKAPejX+CnkPKdPYbqYV6OUaHvd+C9Gj4 hmPe94Y9K8f6Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Dumazet , Guillaume Nault , Kuniyuki Iwashima , Willem de Bruijn , Paolo Abeni , Sasha Levin Subject: [PATCH 4.19 038/148] sock_diag: annotate data-races around sock_diag_handlers[family] Date: Sun, 24 Mar 2024 19:48:22 -0400 Message-ID: <20240324235012.1356413-39-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit efd402537673f9951992aea4ef0f5ff51d858f4b ] __sock_diag_cmd() and sock_diag_bind() read sock_diag_handlers[family] without a lock held. Use READ_ONCE()/WRITE_ONCE() annotations to avoid potential issues. Fixes: 8ef874bfc729 ("sock_diag: Move the sock_ code to net/core/") Signed-off-by: Eric Dumazet Reviewed-by: Guillaume Nault Reviewed-by: Kuniyuki Iwashima Reviewed-by: Willem de Bruijn Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/core/sock_diag.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c index 3312a5849a974..980a2d4650628 100644 --- a/net/core/sock_diag.c +++ b/net/core/sock_diag.c @@ -187,7 +187,7 @@ int sock_diag_register(const struct sock_diag_handler *= hndl) if (sock_diag_handlers[hndl->family]) err =3D -EBUSY; else - sock_diag_handlers[hndl->family] =3D hndl; + WRITE_ONCE(sock_diag_handlers[hndl->family], hndl); mutex_unlock(&sock_diag_table_mutex); =20 return err; @@ -203,7 +203,7 @@ void sock_diag_unregister(const struct sock_diag_handle= r *hnld) =20 mutex_lock(&sock_diag_table_mutex); BUG_ON(sock_diag_handlers[family] !=3D hnld); - sock_diag_handlers[family] =3D NULL; + WRITE_ONCE(sock_diag_handlers[family], NULL); mutex_unlock(&sock_diag_table_mutex); } EXPORT_SYMBOL_GPL(sock_diag_unregister); @@ -221,7 +221,7 @@ static int __sock_diag_cmd(struct sk_buff *skb, struct = nlmsghdr *nlh) return -EINVAL; req->sdiag_family =3D array_index_nospec(req->sdiag_family, AF_MAX); =20 - if (sock_diag_handlers[req->sdiag_family] =3D=3D NULL) + if (READ_ONCE(sock_diag_handlers[req->sdiag_family]) =3D=3D NULL) sock_load_diag_module(req->sdiag_family, 0); =20 mutex_lock(&sock_diag_table_mutex); @@ -280,12 +280,12 @@ static int sock_diag_bind(struct net *net, int group) switch (group) { case SKNLGRP_INET_TCP_DESTROY: case SKNLGRP_INET_UDP_DESTROY: - if (!sock_diag_handlers[AF_INET]) + if (!READ_ONCE(sock_diag_handlers[AF_INET])) sock_load_diag_module(AF_INET, 0); break; case SKNLGRP_INET6_TCP_DESTROY: case SKNLGRP_INET6_UDP_DESTROY: - if (!sock_diag_handlers[AF_INET6]) + if (!READ_ONCE(sock_diag_handlers[AF_INET6])) sock_load_diag_module(AF_INET6, 0); break; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72F83183BB1; Sun, 24 Mar 2024 23:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324260; cv=none; b=Zwke9QW2Hl/S1J1bEivBT79sJnHMCyWAxOYn01O378JfP8SzcJcSB3EvB9ZQqdWN8PCfnjXOYwZe/scHs9IXVaLSTZ6fAQLSYNUqM4Kz7yANJb7C6NuINypQnEhDeDtYO2f8GDdcOy3OpvtEO2xGgQ7tgOtDTqg909Sb6oIyS1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324260; c=relaxed/simple; bh=yzQuo6nvZxgBaP3+SBHQ5uuPQzapeRQVVkdaSwYNq6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AWYaJ6WS9lPkd3MdaYsRcHFQM2YBl7X/rbfuaxs2srpgo90gQYwTdZfrHXLU+ojpFLAZr+ReLCMIdD5F7dC9fXSeOkU239sN2pLh1UAird3Dc/1btYqH2SZcuJ/1yvLVlHtu89g6XSVe7iMLkOKWHJ0s2aA/BkvBjxYIjjaDqhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O5t1hBap; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O5t1hBap" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD41BC433F1; Sun, 24 Mar 2024 23:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324259; bh=yzQuo6nvZxgBaP3+SBHQ5uuPQzapeRQVVkdaSwYNq6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O5t1hBapQ+g4eyLa6NFAgnDx4daAqgNBYOsVJjqE93MtHACmP1Zn4slBq2d7McPa7 aNXRNRz/HyS3t+PFRtiMdWzbm3TEdiKP+9IRi+2diTOfAspEQKoCRvI16+l1ih1Te/ sjElT1lUF/QH3I99wIamjk7TDJvmFkWSRQ5596FvesOOuWhCYgTCtRG0pKvpnLY4XM lEzSWKa7A3jA6jqn3fH29ZPUgW+5DEqpES8ilbYV7AIHIdvtgAvGyrPgRr2NMlAh1g Mc4J3Qs4Ks6ny6NxyXBlrVg4li1Xrk4zCWSNwBv6nx5V9o6Q8aIJU6cMjboLJ3QQQx ItcAUP3zDFPBA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kuniyuki Iwashima , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 039/148] af_unix: Annotate data-race of gc_in_progress in wait_for_unix_gc(). Date: Sun, 24 Mar 2024 19:48:23 -0400 Message-ID: <20240324235012.1356413-40-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 31e03207119a535d0b0e3b3a7f91983aeb2cb14d ] gc_in_progress is changed under spin_lock(&unix_gc_lock), but wait_for_unix_gc() reads it locklessly. Let's use READ_ONCE(). Fixes: 5f23b734963e ("net: Fix soft lockups/OOM issues w/ unix garbage coll= ector") Signed-off-by: Kuniyuki Iwashima Link: https://lore.kernel.org/r/20240123170856.41348-2-kuniyu@amazon.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/unix/garbage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 4d283e26d8162..0a212422b513c 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -203,7 +203,7 @@ void wait_for_unix_gc(void) if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && !READ_ONCE(gc_in_progress)) unix_gc(); - wait_event(unix_gc_wait, gc_in_progress =3D=3D false); + wait_event(unix_gc_wait, !READ_ONCE(gc_in_progress)); } =20 /* The external entry point: unix_gc() */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 605B5183BB0; Sun, 24 Mar 2024 23:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324260; cv=none; b=IGPLTGArB1IUIcDhuhF8p6c7Fq7312em9aaTH5QaCrfbrTmdNLgBkdMnt5CgETtHdyXPTXiyx6zWBlyLxV0QB48WKUGD+4X1bkWeYO9ekz/nMONG+XWTVpNLiHybG+kwUOEwMvI5CTKwglYNKUW1YW8nrowKu/qj9NbYY+TLtjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324260; c=relaxed/simple; bh=QjY6aZN1hS5n+MvNAri57QJpxl0NRj7LaNQvjtQ+YUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KywZkPvvmSU7ChQVsOWCyckUXH98sawdVNqfvt44EM9F5ik/iyi2CagadmPIB9XSrisxueZXyNIaWoja5VHdOU0Qwabeups663tVaA6fY3Vmfu6AaGUgs6D2UMZuZ525tDkOzCDmJL0AyasW/2EABrahC/RPUXgANb+OBxXb1u0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GMQHYtHA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GMQHYtHA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94F3AC433B1; Sun, 24 Mar 2024 23:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324260; bh=QjY6aZN1hS5n+MvNAri57QJpxl0NRj7LaNQvjtQ+YUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GMQHYtHAI7dYa+fGdRvArYO03MWgFzDpKy+uWRVXrW+BoaxYy+729BcvGYqcNmERI mcqr0qeKqrIEqzQDgSohKZugHrF3lfiY/p1m+qW7fWIBVUlzhI/sV3qIKcrOku1l6s zK0dMXZJCzmIJ8wNCS0prB6mTWVODtfkCmzVKngg4aZLi9PVL/6phvSD/Z4buO6XM7 ZvpIumV8teBQB9DEX5Tcw/IbkvlNLhBYSgcBUCX23prxwGHPzcdjiMU2+N1JvYwis0 brT7DEN9lTnX4/M8H5tBGplOAVe+6oHWaCxb5yeLUtkVMwXgWt3OjVDU1IbGoMIv28 52h1OySjkuJJg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhipeng Lu , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 040/148] wifi: libertas: fix some memleaks in lbs_allocate_cmd_buffer() Date: Sun, 24 Mar 2024 19:48:24 -0400 Message-ID: <20240324235012.1356413-41-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhipeng Lu [ Upstream commit 5f0e4aede01cb01fa633171f0533affd25328c3a ] In the for statement of lbs_allocate_cmd_buffer(), if the allocation of cmdarray[i].cmdbuf fails, both cmdarray and cmdarray[i].cmdbuf needs to be freed. Otherwise, there will be memleaks in lbs_allocate_cmd_buffer(). Fixes: 876c9d3aeb98 ("[PATCH] Marvell Libertas 8388 802.11b/g USB driver") Signed-off-by: Zhipeng Lu Signed-off-by: Kalle Valo Link: https://msgid.link/20240126075336.2825608-1-alexious@zju.edu.cn Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/libertas/cmd.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/libertas/cmd.c b/drivers/net/wire= less/marvell/libertas/cmd.c index c1f4229187378..d1984f03fdfca 100644 --- a/drivers/net/wireless/marvell/libertas/cmd.c +++ b/drivers/net/wireless/marvell/libertas/cmd.c @@ -1132,7 +1132,7 @@ int lbs_allocate_cmd_buffer(struct lbs_private *priv) if (!cmdarray[i].cmdbuf) { lbs_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n"); ret =3D -1; - goto done; + goto free_cmd_array; } } =20 @@ -1140,8 +1140,17 @@ int lbs_allocate_cmd_buffer(struct lbs_private *priv) init_waitqueue_head(&cmdarray[i].cmdwait_q); lbs_cleanup_and_insert_cmd(priv, &cmdarray[i]); } - ret =3D 0; + return 0; =20 +free_cmd_array: + for (i =3D 0; i < LBS_NUM_CMD_BUFFERS; i++) { + if (cmdarray[i].cmdbuf) { + kfree(cmdarray[i].cmdbuf); + cmdarray[i].cmdbuf =3D NULL; + } + } + kfree(priv->cmd_array); + priv->cmd_array =3D NULL; done: return ret; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D720184115; Sun, 24 Mar 2024 23:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324262; cv=none; b=TPIMy1ipH41bgAUv638b5sosRHBTnp/wtJrRI6n+oecM2uELou0jR0RnszIBU2Wa+OvqvxwdlwcgBs3oA6rz+AzCxGVawDt8uxZX0lZQdOsHHVrUAv5zOrjm80hYhLt0Ori58dI9biH++rDGxL0vAHtRsNLmRxZ6jICZnueboAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324262; c=relaxed/simple; bh=ok/GvGcNOMCQjekODVX2opWbPxRrqeKYFoczaD0CvvQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fq0NSwAmAlTQerFX/ayuwKeAZt4WNlZgYNTDcuP8Y/2pEnwUXaV2rm6qNM8kfWZvKMTlx5A/494/3UWzCdfgCmCzVZjB50zI5RsLlfVQqRfOxLIXZDPF7c/UhZxZN9JHtLvni9Pw5sOTP8uED7pTCCI1LgoWAVH/oxevTy1KOjY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LLBkBgG6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LLBkBgG6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CCF3C43399; Sun, 24 Mar 2024 23:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324261; bh=ok/GvGcNOMCQjekODVX2opWbPxRrqeKYFoczaD0CvvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLBkBgG6J8M+h6O1x6/YLyLDPxpWBEeEm0AxvNPlqZ0Xv7g2Cp/eVOPiyrTHokvT/ CMAq3/XVOXUuL0k4W7aNFb56PXGQ7pEDheWNZwXM2SlIv2JZhDN+G1BKxJ51t+L1Gc bMYUPcQukpIijO+dj2aiHzgYEK2Sbt5N4tiT9mk1OS+LGsIKbFpIn23eeKfMlmKa7A 5ajgz5Zqp3WbvKAcjvejbYOHQFkG7uXxwnTyRzpXHzdrvIxzs0+CeChaMJmpwhuCOr sirofg9S0zrQ7m7BLo60liW7xgkxsmi/avgvBxFraPF6n1t1J8srSePTcbIgAw1l1Z f11/Bs19zRWjg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Armin Wolf , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH 4.19 041/148] ACPI: processor_idle: Fix memory leak in acpi_processor_power_exit() Date: Sun, 24 Mar 2024 19:48:25 -0400 Message-ID: <20240324235012.1356413-42-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Armin Wolf [ Upstream commit e18afcb7b2a12b635ac10081f943fcf84ddacc51 ] After unregistering the CPU idle device, the memory associated with it is not freed, leading to a memory leak: unreferenced object 0xffff896282f6c000 (size 1024): comm "swapper/0", pid 1, jiffies 4294893170 hex dump (first 32 bytes): 00 00 00 00 0b 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc 8836a742): [] kmalloc_trace+0x29d/0x340 [] acpi_processor_power_init+0xf3/0x1c0 [] __acpi_processor_start+0xd3/0xf0 [] acpi_processor_start+0x2c/0x50 [] really_probe+0xe2/0x480 [] __driver_probe_device+0x78/0x160 [] driver_probe_device+0x1f/0x90 [] __driver_attach+0xce/0x1c0 [] bus_for_each_dev+0x70/0xc0 [] bus_add_driver+0x112/0x210 [] driver_register+0x55/0x100 [] acpi_processor_driver_init+0x3b/0xc0 [] do_one_initcall+0x41/0x300 [] kernel_init_freeable+0x320/0x470 [] kernel_init+0x16/0x1b0 [] ret_from_fork+0x2d/0x50 Fix this by freeing the CPU idle device after unregistering it. Fixes: 3d339dcbb56d ("cpuidle / ACPI : move cpuidle_device field out of the= acpi_processor_power structure") Signed-off-by: Armin Wolf Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/processor_idle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index d80010ac2a43a..22b56a6e9ccac 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1530,6 +1530,8 @@ int acpi_processor_power_exit(struct acpi_processor *= pr) acpi_processor_registered--; if (acpi_processor_registered =3D=3D 0) cpuidle_unregister_driver(&acpi_idle_driver); + + kfree(dev); } =20 pr->flags.power_setup_done =3D 0; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94A7C18411E; Sun, 24 Mar 2024 23:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324263; cv=none; b=oPmuQkGFe1cLqrwI8HI0OtPf/RYmx8Xt/inHzisBifOPIGo5MU7hA+fv3pgJglTsbmomeiVCnM+xIabmFHseTrSrXI1IowZNFXk27l16/iRABP0nqv7plC8h4Vv7z+sloUjoZD4So/+pwLNEfqDtXnRYr+LJulGG0JsUukU3gM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324263; c=relaxed/simple; bh=9wwExgAB4sB/tBUpT+ZhNtlqdGcbolB8jF8LTbKf1yA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=soWqe8UZxltqo4B7Ajn/NvMjBjPJOvZjN5yG5hwjHgKPIqg7qDTwqCMyCpguyugwIvwQ+bHvOZo58Z1MDhU3VBA7w/44pbiPF9KYCkpvSzXBY+eoTu0Z6M/RzILRz37LMd2nbB8Vi5LF7wPEW+gO6E9jn6i3Y2wQjKQuXkMFSBw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CsP/CEda; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CsP/CEda" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBC53C433C7; Sun, 24 Mar 2024 23:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324262; bh=9wwExgAB4sB/tBUpT+ZhNtlqdGcbolB8jF8LTbKf1yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CsP/CEdasFcakEVxb4HKdpWdMLdvYRHESFHF+uA10W8pcgepUUWM3NBAD/TVtpK9J buix/SUBFVOVyinKJPLhv39Nhfd3/qhOgwgmC8Rl5S6AZZX7COLEnxm5gX6W++KwPT GmiRhsComdgRNHE+De7a/OGbiN728mhTjrNl6YvjpxvRsSZs9tbLe6FGZRsVbPds0T TEUfxhG+2tj50JjB/tuV/7dQUizf9KqzSFvfTTjCH1di46y2QiEsrCznK4uioZwQEK Z5EE781sIg7I3n56gt8C0ZuP64lbLArA6Caua7NkMwG64KoHiFdl+ZYPK4+WIld+3N 7xRpdMGaGWNBA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Robinson , Jon Hunter , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 042/148] bus: tegra-aconnect: Update dependency to ARCH_TEGRA Date: Sun, 24 Mar 2024 19:48:26 -0400 Message-ID: <20240324235012.1356413-43-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Robinson [ Upstream commit 4acd21a45c1446277e2abaece97d7fa7c2e692a9 ] Update the architecture dependency to be the generic Tegra because the driver works on the four latest Tegra generations not just Tegra210, if you build a kernel with a specific ARCH_TEGRA_xxx_SOC option that excludes Tegra210 you don't get this driver. Fixes: 46a88534afb59 ("bus: Add support for Tegra ACONNECT") Signed-off-by: Peter Robinson Cc: Jon Hunter Cc: Thierry Reding Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/bus/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index 1851112ccc294..02ef3399bf810 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -126,12 +126,13 @@ config SUNXI_RSB =20 config TEGRA_ACONNECT tristate "Tegra ACONNECT Bus Driver" - depends on ARCH_TEGRA_210_SOC + depends on ARCH_TEGRA depends on OF && PM select PM_CLK help Driver for the Tegra ACONNECT bus which is used to interface with - the devices inside the Audio Processing Engine (APE) for Tegra210. + the devices inside the Audio Processing Engine (APE) for + Tegra210 and later. =20 config TEGRA_GMI tristate "Tegra Generic Memory Interface bus driver" --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4C6718412C; Sun, 24 Mar 2024 23:51:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324264; cv=none; b=kELIPhS+ZfTtq0Sfy1vh8RF9go7gFfc30N2S7QimxO0Fkqkzs+b26tpS67/q/7mS7xVYKaH86lpdEVJhvcWZ0XcZlhndTvaMsV2BNjrBkGgAqMLV+wEEZYSoIrI4PF02SD72dnJhBYu9PLyWCebYmZ821q7G3KuMgujvUvKomvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324264; c=relaxed/simple; bh=j05TyZE3A4IyBcXu/JkFUxDlnIVdQ1ayF1VviiH1ODE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bxTTEMjhH08sVVg57Z8x9KmBjyHIvPsk7Ql8RxbdLgzFt/YT4DjSo3NtY2yOf9uRhx5tYZoxKoAJXEtuTlesivdzqJz3+z0XHf+eshkGaWsX7559EtyVcp4apY3l/KqUDisv/clEhuGOlLH0eHXZwXt5tKE30+dqhd9ge3RBFIY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CvLte50v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CvLte50v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7418C43390; Sun, 24 Mar 2024 23:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324263; bh=j05TyZE3A4IyBcXu/JkFUxDlnIVdQ1ayF1VviiH1ODE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CvLte50vfljFWHZ/LfEC/WmZKaW63ehBq8hh/mXOd2I9iUoEz03vEFKr+KK6l4A/y fNj9MBZdZpQkCisZbxfU0iTLz16k9fzr22uk9OKSepqNyYV+H9FthSOGSIwiQIQ3fj wm5oPA3oUZhe8Y81E256sMNA88fxpO7MyitEB55VtZWtqZd+Shucpv0VA/ZUrp+G6n //Hl29okoRnOkYPHGz4Iy6UY5HR6F4rmnGV3DXKxMZxUs/V+/i6HVNT71jahRYMxak Tm8/wkOX8G5vMHc46zv9H81OsqlL/HtYEaeQU9WHjApzADhkGOcQmVDQyuQ0IVn2iB EAXgkvReU0Bqw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mario Limonciello , Vasant Hegde , Joerg Roedel , Sasha Levin Subject: [PATCH 4.19 043/148] iommu/amd: Mark interrupt as managed Date: Sun, 24 Mar 2024 19:48:27 -0400 Message-ID: <20240324235012.1356413-44-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello [ Upstream commit 0feda94c868d396fac3b3cb14089d2d989a07c72 ] On many systems that have an AMD IOMMU the following sequence of warnings is observed during bootup. ``` pci 0000:00:00.2 can't derive routing for PCI INT A pci 0000:00:00.2: PCI INT A: not connected ``` This series of events happens because of the IOMMU initialization sequence order and the lack of _PRT entries for the IOMMU. During initialization the IOMMU driver first enables the PCI device using pci_enable_device(). This will call acpi_pci_irq_enable() which will check if the interrupt is declared in a PCI routing table (_PRT) entry. According to the PCI spec [1] these routing entries are only required under PCI root bridges: The _PRT object is required under all PCI root bridges The IOMMU is directly connected to the root complex, so there is no parent bridge to look for a _PRT entry. The first warning is emitted since no entry could be found in the hierarchy. The second warning is then emitted because the interrupt hasn't yet been configured to any value. The pin was configured in pci_read_irq() but the byte in PCI_INTERRUPT_LINE return 0xff which means "Unknown". After that sequence of events pci_enable_msi() is called and this will allocate an interrupt. That is both of these warnings are totally harmless because the IOMMU uses MSI for interrupts. To avoid even trying to probe for a _PRT entry mark the IOMMU as IRQ managed. This avoids both warnings. Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/06_Device_Configuration= /Device_Configuration.html?highlight=3D_prt#prt-pci-routing-table [1] Signed-off-by: Mario Limonciello Fixes: cffe0a2b5a34 ("x86, irq: Keep balance of IOAPIC pin reference count") Reviewed-by: Vasant Hegde Link: https://lore.kernel.org/r/20240122233400.1802-1-mario.limonciello@amd= .com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/amd_iommu_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 12e7254b39489..efb11ca91dd72 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -1733,6 +1733,9 @@ static int __init iommu_init_pci(struct amd_iommu *io= mmu) /* Prevent binding other PCI device drivers to IOMMU devices */ iommu->dev->match_driver =3D false; =20 + /* ACPI _PRT won't have an IRQ for IOMMU */ + iommu->dev->irq_managed =3D 1; + pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET, &iommu->cap); pci_read_config_dword(iommu->dev, cap_ptr + MMIO_RANGE_OFFSET, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1388184121; Sun, 24 Mar 2024 23:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324265; cv=none; b=W6LT+5g8EodjFXJv/ZDUUgNbK444cWWNS2D4QW+cYTRp92eEmGQVrMyFpy4qkoSNuD9WtKj69xJIP5l/ZfsH5Db/T5+GUssfS9kwA9bzajjPztL7iRFlJk7dUrKBNvkYvhQg7ZapWRXhXgukFSs/oDiZTra4G9/Ieni7rLaY8MI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324265; c=relaxed/simple; bh=bFIW337YZEgPJGcH3SHvm6AhFeA3r3vl6XB2wyPDraM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OeOTCpxgAuZmbIA0UKNIlWJMAMXRULv/qIRZmuSLeufreKy7ro/nVp+a4t3b/jYLMHc/3YtvyhWyyoAbSS70xgF/FNxDytDGoI1fKSTjJbhyLnSruNYTfcnv6Qc+TqjCvbyhofPA9YO9PoFINYYpaIRgja9lCTSibJjR8il/K1o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sKvs4eCw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sKvs4eCw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD884C433C7; Sun, 24 Mar 2024 23:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324264; bh=bFIW337YZEgPJGcH3SHvm6AhFeA3r3vl6XB2wyPDraM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sKvs4eCwJNycwuAK+gUJ48A3KdXbau3D7+iHualN/aOEBd7wudtdTK7S10H2Hv2VX 1qkkiBsLCbh7h3CNjgc2iesP/Rx9zsb+urNiPh0V2PQ3qF2RaJqxVqzJ/wmms75oO4 sFQHWJRy5HpPkZ4g+chEal0qyy3ssU4jLGEL0WPiNAuyswftJ4ig5FG7cUG2oZJX9z GKlrpupLKsstJv0aIPSUh6LxO8UzCuAwC+l4laU9besVbp5IgGmgNfFDo8DIDTv/KY txNbojdxKdV3lcl8ZbuDRPQtyMSskTKLuVzIh13Gyr++b80vRTEUbf49qeoeTZo28+ 5A3sOeXAHn8IA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Arend van Spriel , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 044/148] wifi: brcmsmac: avoid function pointer casts Date: Sun, 24 Mar 2024 19:48:28 -0400 Message-ID: <20240324235012.1356413-45-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit e1ea6db35fc3ba5ff063f097385e9f7a88c25356 ] An old cleanup went a little too far and causes a warning with clang-16 and higher as it breaks control flow integrity (KCFI) rules: drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c:64:34: error: c= ast from 'void (*)(struct brcms_phy *)' to 'void (*)(void *)' converts to i= ncompatible function type [-Werror,-Wcast-function-type-strict] 64 | brcms_init_timer(physhim->wl, (void (*)(voi= d *))fn, | ^~~~~~~~~~~~~= ~~~~~~~ Change this one instance back to passing a void pointer so it can be used with the timer callback interface. Fixes: d89a4c80601d ("staging: brcm80211: removed void * from softmac phy") Signed-off-by: Arnd Bergmann Acked-by: Arend van Spriel Signed-off-by: Kalle Valo Link: https://msgid.link/20240213100548.457854-1-arnd@kernel.org Signed-off-by: Sasha Levin --- .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c | 3 ++- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c | 5 ++--- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c= b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c index 35e3b101e5cf0..bedb1f73ef24e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c @@ -394,8 +394,9 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_= phy_params *shp) return sh; } =20 -static void wlc_phy_timercb_phycal(struct brcms_phy *pi) +static void wlc_phy_timercb_phycal(void *ptr) { + struct brcms_phy *pi =3D ptr; uint delay =3D 5; =20 if (PHY_PERICAL_MPHASE_PENDING(pi)) { diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c b/= drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c index a0de5db0cd646..b723817915365 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c @@ -57,12 +57,11 @@ void wlc_phy_shim_detach(struct phy_shim_info *physhim) } =20 struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim, - void (*fn)(struct brcms_phy *pi), + void (*fn)(void *pi), void *arg, const char *name) { return (struct wlapi_timer *) - brcms_init_timer(physhim->wl, (void (*)(void *))fn, - arg, name); + brcms_init_timer(physhim->wl, fn, arg, name); } =20 void wlapi_free_timer(struct wlapi_timer *t) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h b/= drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h index dd8774717adee..27d0934e600ed 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.h @@ -131,7 +131,7 @@ void wlc_phy_shim_detach(struct phy_shim_info *physhim); =20 /* PHY to WL utility functions */ struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim, - void (*fn)(struct brcms_phy *pi), + void (*fn)(void *pi), void *arg, const char *name); void wlapi_free_timer(struct wlapi_timer *t); void wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A215A18413E; Sun, 24 Mar 2024 23:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324266; cv=none; b=c6SKBNksOsNz0SCQOelxfIJ6f4/CNJpA/5YG63L7nbhFcpq32HtrPyhc5OkE5q8iMZeuLn3b8NYXATIe629GfD9psjbNLCaMqhgFdnhI3DrN52af+Zu2sPKsFBlbAKf7nM8LMjrnF0juGsuEI04fmwyoJYhYBc8fsWz2Sk0thP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324266; c=relaxed/simple; bh=+aq8RLJbLgc5VXsalxjuBQSCjf84gqPif4nLSjN1eYE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jD/d45iKzh4TqFTNEJGtFdzOGbzzqggLnwOGAnwx91Q6H17cx8aACa6HmLHh+Tz+ms1ju7IjmUt8LMoUclNSeWPj6AkVEaQg0uP7Pg1zbKdo0TVplcZQDTR0epsgnVouPipkzqCxCzg1hxNZyHdj0Kv2xSintsaszmq3nVnXuNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H/jMGFHB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H/jMGFHB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D81A2C43390; Sun, 24 Mar 2024 23:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324265; bh=+aq8RLJbLgc5VXsalxjuBQSCjf84gqPif4nLSjN1eYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H/jMGFHBSZ/oQJt1+OUQ4Hs7y0E7EJZIrymcomZt+IfYZqiknljxA8FnFg9dxRzp6 9R03o7QgwxI2rUzY5g4P5x3gy1kPd0YY1QRIDtMajqSwxwm8YAMxajxjWrlY+qpzs6 Yo6GB5RoHE86w2GV8MRwB8Zus1UYjY/2Iy1G7l+rhjBSrZtXm7oiEnTTw3wq55LqqQ aEP1Lbt6YOkoNhK5yIULnImW/i71Wb8lW7TXMAMXXRKqu/75YojZuuLxKQLupieDQx 0fvV/SyDVSNADKhU1rA+rF3iGG4Jf6X/Up2meD35DfWFIyCwKRLfIrkEg6JM8GAu1q tQcZ1mFqjSxWg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Geert Uytterhoeven , Linus Walleij , Sasha Levin Subject: [PATCH 4.19 045/148] ARM: dts: arm: realview: Fix development chip ROM compatible value Date: Sun, 24 Mar 2024 19:48:29 -0400 Message-ID: <20240324235012.1356413-46-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 3baa4c5143d65ebab2de0d99a395e5f4f1f46608 ] When the development chip ROM was added, the "direct-mapped" compatible value was already obsolete. In addition, the device node lacked the accompanying "probe-type" property, causing the old physmap_of_core driver to fall back to trying all available probe types. Unfortunately this fallback was lost when the DT and pdata cases were merged. Fix this by using the modern "mtd-rom" compatible value instead. Fixes: 5c3f5edbe0a1dff3 ("ARM: realview: add flash devices to the PB1176 DT= S") Fixes: 642b1e8dbed7bbbf ("mtd: maps: Merge physmap_of.c into physmap-core.c= ") Signed-off-by: Geert Uytterhoeven Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- arch/arm/boot/dts/arm-realview-pb1176.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/arm-realview-pb1176.dts b/arch/arm/boot/dts/= arm-realview-pb1176.dts index 83e0fbc4a1a10..350a5dbd36130 100644 --- a/arch/arm/boot/dts/arm-realview-pb1176.dts +++ b/arch/arm/boot/dts/arm-realview-pb1176.dts @@ -427,7 +427,7 @@ pb1176_serial3: serial@1010f000 { =20 /* Direct-mapped development chip ROM */ pb1176_rom@10200000 { - compatible =3D "direct-mapped"; + compatible =3D "mtd-rom"; reg =3D <0x10200000 0x4000>; bank-width =3D <1>; }; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1D0817ADD8; Sun, 24 Mar 2024 23:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324268; cv=none; b=aIw81XG/uqN9cpg7YWPYBignrY4WS2yoaWkahUHTPYy/MeJPUk6S7phpw/7ajJHywVYAOBFaV76TBMYgaiX6cZuJjUhkySf4QY6cLR/WzeuehIRLGCIRQNQVv9PPxB6Gsu0hJUZT3jgVUqsAvIuqFz1Zd632qHxJoryHQn3vFRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324268; c=relaxed/simple; bh=9Ip9mEpa6TN8g4FP9wQPYH3+tz8QM2hDeFv91hXNndk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MCxgDWvQAuOBxqU2F0SyiX2MzQmvZtrT5Kmvli2bQwV9UjxP1wcgWMg/bUIfXdikfF2M5mIKQj3pwUxPgdP+Ctvwxh1dthRRcBoHqXR7iSCvqeardnidMYkBP/ZU7w0kGfCDkEo0VmvA8IfBcqJcE0bRDnbr9rntaTaeUVvLp24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tJmBflbR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tJmBflbR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCC0FC433F1; Sun, 24 Mar 2024 23:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324266; bh=9Ip9mEpa6TN8g4FP9wQPYH3+tz8QM2hDeFv91hXNndk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJmBflbRvs48ckqkyXzJOjlSveebh4325l4nTVa6XhO8Qo28cBKi2LffdBUteTTM0 3zsBcukRKUoD/SHhgWEYx/itixhCvKVpSQcqyVtWF7SHe4jGCfeF5OAp7ybNNDsjOU AfTtdANtc19ioyLY4et35Mxgh55P0x0KCjkIU+K0gH4BATzYdxngHxMCAUdiceHgYt ABg3Q4oEYznXrYv6hHnaeT19J4p0I5SeMTXZ1ATTXTTKKfmXb4jKxoaHLaSKtDEmDf fJgu/tsQwkpfp3UrVaLsoIABMAVARZM9joh1vZyiPfOq+KgSx4VpGtp4JfyRUiQcPV ictN+YsWUAzIQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Rafael J. Wysocki" , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.19 046/148] ACPI: scan: Fix device check notification handling Date: Sun, 24 Mar 2024 19:48:30 -0400 Message-ID: <20240324235012.1356413-47-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Rafael J. Wysocki" [ Upstream commit 793551c965116d9dfaf0550dacae1396a20efa69 ] It is generally invalid to fail a Device Check notification if the scan handler has not been attached to the given device after a bus rescan, because there may be valid reasons for the scan handler to refuse attaching to the device (for example, the device is not ready). For this reason, modify acpi_scan_device_check() to return 0 in that case without printing a warning. While at it, reduce the log level of the "already enumerated" message in the same function, because it is only interesting when debugging notification handling Fixes: 443fc8202272 ("ACPI / hotplug: Rework generic code to handle suprise= removals") Signed-off-by: Rafael J. Wysocki Reviewed-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/acpi/scan.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 1e7e2c438acf0..60417cee19b9b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -321,18 +321,14 @@ static int acpi_scan_device_check(struct acpi_device = *adev) * again). */ if (adev->handler) { - dev_warn(&adev->dev, "Already enumerated\n"); - return -EALREADY; + dev_dbg(&adev->dev, "Already enumerated\n"); + return 0; } error =3D acpi_bus_scan(adev->handle); if (error) { dev_warn(&adev->dev, "Namespace scan failure\n"); return error; } - if (!adev->handler) { - dev_warn(&adev->dev, "Enumeration failure\n"); - error =3D -ENODEV; - } } else { error =3D acpi_scan_device_not_present(adev); } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15FAA184303; Sun, 24 Mar 2024 23:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324269; cv=none; b=VgqvgjH1SjPvKUyYTv7M2EnG+TxhKMf2WoTBaMGsdtpagYEhgyPSr8mA2JrAhZ4JCIBcIh4X21q1MRdV0p3cBcn6YSqV2+hceMzjIg1nCgGikrE7ABgG9BIPjk5D/pD08F4kb0sYkZ8mUVVdwtkQ5zH0P8qX3xFX8u8EZydC5tA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324269; c=relaxed/simple; bh=FaVXkdVeySI9vjG797fmEk7rhM4ih4kJDsRRP8xVya4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FqVAn6Em5U5D1lnVfUFovMdeHHflQzod6yG6/7kJzKSI+DHnsdcRZBsmLdHKq9cmGUHcB9wvp21PElKdgzGupl/UHorZhEpVrDm8eiScdE9F0PRUSgdgkHVG8LlefHSRbsvwDAG7YjQ7anAbOYrN1JOSEKv5bKmxUTTKZTQhpwY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yuzr3y6k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Yuzr3y6k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10FB3C43394; Sun, 24 Mar 2024 23:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324268; bh=FaVXkdVeySI9vjG797fmEk7rhM4ih4kJDsRRP8xVya4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yuzr3y6kf1qwzmiejBDEg3k7up/VIjmcXDNGor1M6W1o1nKbFokNF5RTUArgRko0X DAsIAuxl/zWbdnyr2PlbyG+JuSvKJrLA4yv8ensqJs76JcVoMGkVS/5SbFOlu2u3tj jldlvdgR1BOJWuz6j3JIGUmWfftkLP8m3Bp75n+msH2b5zivNSHbhk4aRam6p8ILWY QZvliqxpy9ToQeotgWz+PWQyM0MYnSNcD3ReaHEdpZQwoiMgwqpn/jUx3lEciGdv9K 13aAtZ1DntLl+eGz9JTP01p4cFonfd10VdVV0WJ9Xkz7hkZOZA3b7wJWwT4FH9nQfi ACrLUNFvoK/hw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kees Cook , Guixiong Wei , Juergen Gross , Sasha Levin Subject: [PATCH 4.19 047/148] x86, relocs: Ignore relocations in .notes section Date: Sun, 24 Mar 2024 19:48:31 -0400 Message-ID: <20240324235012.1356413-48-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit aaa8736370db1a78f0e8434344a484f9fd20be3b ] When building with CONFIG_XEN_PV=3Dy, .text symbols are emitted into the .notes section so that Xen can find the "startup_xen" entry point. This information is used prior to booting the kernel, so relocations are not useful. In fact, performing relocations against the .notes section means that the KASLR base is exposed since /sys/kernel/notes is world-readable. To avoid leaking the KASLR base without breaking unprivileged tools that are expecting to read /sys/kernel/notes, skip performing relocations in the .notes section. The values readable in .notes are then identical to those found in System.map. Reported-by: Guixiong Wei Closes: https://lore.kernel.org/all/20240218073501.54555-1-guixiongwei@gmai= l.com/ Fixes: 5ead97c84fa7 ("xen: Core Xen implementation") Fixes: da1a679cde9b ("Add /sys/kernel/notes") Reviewed-by: Juergen Gross Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/x86/tools/relocs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c index aa046d46ff8ff..c7f1d1759c855 100644 --- a/arch/x86/tools/relocs.c +++ b/arch/x86/tools/relocs.c @@ -579,6 +579,14 @@ static void print_absolute_relocs(void) if (!(sec_applies->shdr.sh_flags & SHF_ALLOC)) { continue; } + /* + * Do not perform relocations in .notes section; any + * values there are meant for pre-boot consumption (e.g. + * startup_xen). + */ + if (sec_applies->shdr.sh_type =3D=3D SHT_NOTE) { + continue; + } sh_symtab =3D sec_symtab->symtab; sym_strtab =3D sec_symtab->link->strtab; for (j =3D 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00763184403; Sun, 24 Mar 2024 23:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324270; cv=none; b=Ccr8rf9NqqIULkK38NsPbwPIDRkQr4kpl7VnYhDwQceZVUlqnJZYyzNteEz4/ofgL4B8trskkjU9sY6idctZp3rTo0Km+hbCgGS6Y1eLos4w7oY03wUu41MArvHcA7wuPfyf3pU3Kl4fKxLrawd/13RotPsJCfbufWasdbzEivo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324270; c=relaxed/simple; bh=t0dlIHKdQlh5FOxOWMgprE0F0SGdYtgOUdiJq8cKvLg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eBVNS7XvonIRCrGCLlaoCfiuVyhHF4Rcffsr5w4oqQofN3FuD9ZX5lIPPtyJ9UG1TovWbe+kEVlEkJ2tvWWCGZrQY8SFjhhbGMW0G9JRNEmuaXFGqj5wg2O+ElRiFsgyxSCgRRU9U3+MF1o8w9RIuEs051wi4IP9l/PfqnQvEtQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g+S0MSJQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g+S0MSJQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A85AC433C7; Sun, 24 Mar 2024 23:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324268; bh=t0dlIHKdQlh5FOxOWMgprE0F0SGdYtgOUdiJq8cKvLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g+S0MSJQbzShn6+1lhH83E4nepGjkZXnS9yH01EvY/MsrnM+sXqsSiUh8mxXfjZDm tYA2x2OV+xCyeeowKb2X3hN3+r15desgnhUmp5NDKJPk6jXEnJ4bX5x437k4BMsd8S orToadriWLygdJiCIPuY6DVZNvOY3Xg5b4b7wERcw9ZM868fvYtTpzxPh+GPK7YXJB oLIQTwfXVzMAbuicbl+J3jZg/nTL5QEHFU4Jp7DVGoUyxLutXk47OWkeO4zWf07tRl xyLnVkVSKq2i81U7WMgeFkuiY1xnhQI83vnJ1gsXaIOLn7TsfD9krwl3oRU6TDayqC 3lLG79Wihy/IA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhipeng Lu , Chuck Lever , Sasha Levin Subject: [PATCH 4.19 048/148] SUNRPC: fix some memleaks in gssx_dec_option_array Date: Sun, 24 Mar 2024 19:48:32 -0400 Message-ID: <20240324235012.1356413-49-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhipeng Lu [ Upstream commit 3cfcfc102a5e57b021b786a755a38935e357797d ] The creds and oa->data need to be freed in the error-handling paths after their allocation. So this patch add these deallocations in the corresponding paths. Fixes: 1d658336b05f ("SUNRPC: Add RPC based upcall mechanism for RPCGSS aut= h") Signed-off-by: Zhipeng Lu Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- net/sunrpc/auth_gss/gss_rpc_xdr.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rp= c_xdr.c index 444380f968f11..730a9c4dc9931 100644 --- a/net/sunrpc/auth_gss/gss_rpc_xdr.c +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c @@ -263,8 +263,8 @@ static int gssx_dec_option_array(struct xdr_stream *xdr, =20 creds =3D kzalloc(sizeof(struct svc_cred), GFP_KERNEL); if (!creds) { - kfree(oa->data); - return -ENOMEM; + err =3D -ENOMEM; + goto free_oa; } =20 oa->data[0].option.data =3D CREDS_VALUE; @@ -278,29 +278,40 @@ static int gssx_dec_option_array(struct xdr_stream *x= dr, =20 /* option buffer */ p =3D xdr_inline_decode(xdr, 4); - if (unlikely(p =3D=3D NULL)) - return -ENOSPC; + if (unlikely(p =3D=3D NULL)) { + err =3D -ENOSPC; + goto free_creds; + } =20 length =3D be32_to_cpup(p); p =3D xdr_inline_decode(xdr, length); - if (unlikely(p =3D=3D NULL)) - return -ENOSPC; + if (unlikely(p =3D=3D NULL)) { + err =3D -ENOSPC; + goto free_creds; + } =20 if (length =3D=3D sizeof(CREDS_VALUE) && memcmp(p, CREDS_VALUE, sizeof(CREDS_VALUE)) =3D=3D 0) { /* We have creds here. parse them */ err =3D gssx_dec_linux_creds(xdr, creds); if (err) - return err; + goto free_creds; oa->data[0].value.len =3D 1; /* presence */ } else { /* consume uninteresting buffer */ err =3D gssx_dec_buffer(xdr, &dummy); if (err) - return err; + goto free_creds; } } return 0; + +free_creds: + kfree(creds); +free_oa: + kfree(oa->data); + oa->data =3D NULL; + return err; } =20 static int gssx_dec_status(struct xdr_stream *xdr, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 942B1184413; Sun, 24 Mar 2024 23:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324271; cv=none; b=ZPu1ECxOm0wPJa6HO3l7F6B1DzZRR2/4zXLbNgmSq9rANdAeRV9nuo7rl8OVOercB9Zk2tnlv/p1iU6VmBwOuOZWCrjSxSDCWx7S8JR4dfTSHwEMp66l7/ajsV0VmOTkE+8GC6jA+4X6JKAe2X26N3Z6fo868r5u0KvqJMu5FPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324271; c=relaxed/simple; bh=l485m+fXhDkUqfuTzwl2ig3RmXGGE0NcaQlA0aG6S9M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y6N28gBUEXVL6Jnv8d3zV9fwLvu6Kl1Yx2Faz8fHxcvyOIMmalAOoFSJeuLgW4ry/J/8QJpThcbWNy6JUGjpGql5RDohr9Zi80lupKHxtTXI0R5i0peile7nJUh9x+J5DScgqZ9/0dJqohXcYjsVQwIi3OFWKxpqVeaOjuS5Z7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Tb3Qejsa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Tb3Qejsa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 246E4C433F1; Sun, 24 Mar 2024 23:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324270; bh=l485m+fXhDkUqfuTzwl2ig3RmXGGE0NcaQlA0aG6S9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tb3Qejsa95dADAMb10dLLs1zfAa59nc7MXJT/ooUOIuxFKHZF+wgnb0VMsQP4AdvT 4W+Y+r2imPhIzA5cFyEWLQvu4D9ymGM7hreWP5Opv5eBfq0IOnT1h3sV0g9UNrX04P kZvmtmcAUtzFgGZ1ACQqA1QHg0qS0myUcPvpiwamX/RT9X4cyjB8/QXNHs3eVGNtpc Ru3EHZD1IONGG/FsIWSTKNEnVfpT+dRiqRrjrM7zZDkm3WMYeUEwC1yVnfzsuI7qnB fQXV7GLk7anmVtq8s7qxI+r/xd1HN+Sy4yv0macp/Al4ZqfAeLRdtCyrSxVbuhiUN+ Ne94rP3dRz5Bg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 4.19 049/148] mmc: wmt-sdmmc: remove an incorrect release_mem_region() call in the .remove function Date: Sun, 24 Mar 2024 19:48:33 -0400 Message-ID: <20240324235012.1356413-50-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit ae5004a40a262d329039b99b62bd3fe7645b66ad ] This looks strange to call release_mem_region() in a remove function without any request_mem_region() in the probe or "struct resource" somewhere. So remove the corresponding code. Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM= 8650") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/bb0bb1ed1e18de55e8c0547625bde271e64b8c31.17= 08983064.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/wmt-sdmmc.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index a132bc822b5c6..b6369bfd64fd5 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -893,7 +893,6 @@ static int wmt_mci_remove(struct platform_device *pdev) { struct mmc_host *mmc; struct wmt_mci_priv *priv; - struct resource *res; u32 reg_tmp; =20 mmc =3D platform_get_drvdata(pdev); @@ -921,9 +920,6 @@ static int wmt_mci_remove(struct platform_device *pdev) clk_disable_unprepare(priv->clk_sdmmc); clk_put(priv->clk_sdmmc); =20 - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, resource_size(res)); - mmc_free_host(mmc); =20 dev_info(&pdev->dev, "WMT MCI device removed\n"); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A84918441B; Sun, 24 Mar 2024 23:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324272; cv=none; b=KE2yaO3xEOCdLoabgdygaVHyz2tRHQ6Z8uNahwE+XbRkDrCdoB5A8tu1dBJzQ49TpvWy5sQVFqRx/St/Sl6SZmlPTPu2J3Pf+Sp0FCQpr3+LTVsdQynrIIqbLX7XlLKkYg5BtSmit7qM+dUedIfTZ9RkH1ZF7SxgmvH8hZqCOfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324272; c=relaxed/simple; bh=mIw4xy5YW1KbmrbCjGSqusqwOOX5O8qIg1Zb5Hszfto=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MWyqKwS32W/9BZ7z3kEMiaq3dvFoGWUoAP1eB+NISNeb4NGwoICyWLpd9bVWYVSYrkpuN/nrlRIEjCtZhmBlFcRT6PGX2bW81DQ8+lM2aXy5hm8HwUiAvemoowgdZH7AnAL9YoutSKGjixhexIHo2DpZqlVOMfjryM8YwVTaBYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WlXNqVbQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WlXNqVbQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5947EC43390; Sun, 24 Mar 2024 23:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324271; bh=mIw4xy5YW1KbmrbCjGSqusqwOOX5O8qIg1Zb5Hszfto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WlXNqVbQJ4nsichSKeOOcdS5S98UmvtfdESbyxCWBYmnFiRSgzydnvVOhVXXcOOO2 StFr7qauxtwHpAZiyrlVuetP88fCfdJoUGfQYIPxO97j8hmsNU94N/YDgW1T0in0Pi 0cM9TS/zAk9Fjj/c8O7otJo9yg6re6+NR/ePCzGRFqm1vSNIhnsna/CxqndhlrHDeY 78UmEfFa92D5W7wdanPhZHnUJrHHROUpAADgqYDznglobuqdD4BQtoes81Bzfqt/pc +EcaMMjFRdh/H0cvM4vccWfqHbrCaGxgYW1EaFei88QMQI1kD6pDT+xj5XJVkMRcde 3qSoY6NeOoNDQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ruud Bos , Gurucharan G , Tony Nguyen , Sasha Levin Subject: [PATCH 4.19 050/148] igb: move PEROUT and EXTTS isr logic to separate functions Date: Sun, 24 Mar 2024 19:48:34 -0400 Message-ID: <20240324235012.1356413-51-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ruud Bos [ Upstream commit cf99c1dd7b7729091043374b90807c7a5f9fd9b1 ] Remove code duplication in the tsync interrupt handler function by moving this logic to separate functions. This keeps the interrupt handler readable and allows the new functions to be extended for adapter types other than i210. Signed-off-by: Ruud Bos Tested-by: Gurucharan G Signed-off-by: Tony Nguyen Stable-dep-of: ee14cc9ea19b ("igb: Fix missing time sync events") Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_main.c | 81 +++++++++++++---------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethern= et/intel/igb/igb_main.c index 00d8f1e8177e7..c0e2323e50c6e 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6511,12 +6511,52 @@ void igb_update_stats(struct igb_adapter *adapter) } } =20 +static void igb_perout(struct igb_adapter *adapter, int tsintr_tt) +{ + int pin =3D ptp_find_pin(adapter->ptp_clock, PTP_PF_PEROUT, tsintr_tt); + struct e1000_hw *hw =3D &adapter->hw; + struct timespec64 ts; + u32 tsauxc; + + if (pin < 0 || pin >=3D IGB_N_PEROUT) + return; + + spin_lock(&adapter->tmreg_lock); + ts =3D timespec64_add(adapter->perout[pin].start, + adapter->perout[pin].period); + /* u32 conversion of tv_sec is safe until y2106 */ + wr32((tsintr_tt =3D=3D 1) ? E1000_TRGTTIML1 : E1000_TRGTTIML0, ts.tv_nsec= ); + wr32((tsintr_tt =3D=3D 1) ? E1000_TRGTTIMH1 : E1000_TRGTTIMH0, (u32)ts.tv= _sec); + tsauxc =3D rd32(E1000_TSAUXC); + tsauxc |=3D TSAUXC_EN_TT0; + wr32(E1000_TSAUXC, tsauxc); + adapter->perout[pin].start =3D ts; + spin_unlock(&adapter->tmreg_lock); +} + +static void igb_extts(struct igb_adapter *adapter, int tsintr_tt) +{ + int pin =3D ptp_find_pin(adapter->ptp_clock, PTP_PF_EXTTS, tsintr_tt); + struct e1000_hw *hw =3D &adapter->hw; + struct ptp_clock_event event; + u32 sec, nsec; + + if (pin < 0 || pin >=3D IGB_N_EXTTS) + return; + + nsec =3D rd32((tsintr_tt =3D=3D 1) ? E1000_AUXSTMPL1 : E1000_AUXSTMPL0); + sec =3D rd32((tsintr_tt =3D=3D 1) ? E1000_AUXSTMPH1 : E1000_AUXSTMPH0); + event.type =3D PTP_CLOCK_EXTTS; + event.index =3D tsintr_tt; + event.timestamp =3D sec * 1000000000ULL + nsec; + ptp_clock_event(adapter->ptp_clock, &event); +} + static void igb_tsync_interrupt(struct igb_adapter *adapter) { struct e1000_hw *hw =3D &adapter->hw; + u32 ack =3D 0, tsicr =3D rd32(E1000_TSICR); struct ptp_clock_event event; - struct timespec64 ts; - u32 ack =3D 0, tsauxc, sec, nsec, tsicr =3D rd32(E1000_TSICR); =20 if (tsicr & TSINTR_SYS_WRAP) { event.type =3D PTP_CLOCK_PPS; @@ -6532,51 +6572,22 @@ static void igb_tsync_interrupt(struct igb_adapter = *adapter) } =20 if (tsicr & TSINTR_TT0) { - spin_lock(&adapter->tmreg_lock); - ts =3D timespec64_add(adapter->perout[0].start, - adapter->perout[0].period); - /* u32 conversion of tv_sec is safe until y2106 */ - wr32(E1000_TRGTTIML0, ts.tv_nsec); - wr32(E1000_TRGTTIMH0, (u32)ts.tv_sec); - tsauxc =3D rd32(E1000_TSAUXC); - tsauxc |=3D TSAUXC_EN_TT0; - wr32(E1000_TSAUXC, tsauxc); - adapter->perout[0].start =3D ts; - spin_unlock(&adapter->tmreg_lock); + igb_perout(adapter, 0); ack |=3D TSINTR_TT0; } =20 if (tsicr & TSINTR_TT1) { - spin_lock(&adapter->tmreg_lock); - ts =3D timespec64_add(adapter->perout[1].start, - adapter->perout[1].period); - wr32(E1000_TRGTTIML1, ts.tv_nsec); - wr32(E1000_TRGTTIMH1, (u32)ts.tv_sec); - tsauxc =3D rd32(E1000_TSAUXC); - tsauxc |=3D TSAUXC_EN_TT1; - wr32(E1000_TSAUXC, tsauxc); - adapter->perout[1].start =3D ts; - spin_unlock(&adapter->tmreg_lock); + igb_perout(adapter, 1); ack |=3D TSINTR_TT1; } =20 if (tsicr & TSINTR_AUTT0) { - nsec =3D rd32(E1000_AUXSTMPL0); - sec =3D rd32(E1000_AUXSTMPH0); - event.type =3D PTP_CLOCK_EXTTS; - event.index =3D 0; - event.timestamp =3D sec * 1000000000ULL + nsec; - ptp_clock_event(adapter->ptp_clock, &event); + igb_extts(adapter, 0); ack |=3D TSINTR_AUTT0; } =20 if (tsicr & TSINTR_AUTT1) { - nsec =3D rd32(E1000_AUXSTMPL1); - sec =3D rd32(E1000_AUXSTMPH1); - event.type =3D PTP_CLOCK_EXTTS; - event.index =3D 1; - event.timestamp =3D sec * 1000000000ULL + nsec; - ptp_clock_event(adapter->ptp_clock, &event); + igb_extts(adapter, 1); ack |=3D TSINTR_AUTT1; } =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2B1C184424; Sun, 24 Mar 2024 23:51:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324273; cv=none; b=GMq28/S3g/q0QArHqZpDjoTaUdywWnA2YGyR5Z3l/yEaDcS7CCWtx8zxFLIbyKrA5QchLs9T37CasmaPvh2t1QssnuA7QZ8fMPucDGOVyzlM9iEBrMaF/0/c4sCgGPVWTzWmd4hnAbnt5FrOQkrlRzl1mX3Y11fWCdJKIJAGRYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324273; c=relaxed/simple; bh=YUlZ7Qh9XrKOvLc5vbPfNIAQyjzjHe192nRk8wGzRjA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZY3HyNywwQR5G0rJyHKFle8Uu5EEmmvMP2FVET47BwT/bfRuey3ph/wQ7khLALHadWU8Km/IzfcNFToaC01wM46ODaj6nAsA67VMjIKjVDCdVY9IlC9i2NELi3BRc+uvMYvEyfV1Nlm3VIvfe4FV2ZCFwB/fgjvF6lVwzCRQaaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FXzGKkq0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FXzGKkq0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCFD3C433C7; Sun, 24 Mar 2024 23:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324272; bh=YUlZ7Qh9XrKOvLc5vbPfNIAQyjzjHe192nRk8wGzRjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXzGKkq0pyHIrxfCW21wXs9gbEJ0WcHiFi/n9q12j8J/zHm/S3haVFOvIcPNWDuvF Cp1c0GL2D97SB1oh2Uu2g9LAzOswFDQMUhHaTCKEhmwp+S5bGF+APjJHs8XMHz6J+B qHPjndDTzMDQFNaimgfqRAyhsJKPqrBjLUbhZ5Lt5FALEaEq8CB8yPjZHtVnpR4xt2 R2+CvGnr1LfKqLqHIBAoK4meC191HceLLqmzNezmV9JQo3kFgozI8X/a5g3GwL1COT qjasGA9Mgg2+rMTdSnK1iM5k7RNiDj2rwdICCHeRgNsyOLApvSFQ28K376VFHRkaAo 8eB/kxgLlK0sg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vinicius Costa Gomes , Richard Cochran , Pucha Himasekhar Reddy , Tony Nguyen , Sasha Levin Subject: [PATCH 4.19 051/148] igb: Fix missing time sync events Date: Sun, 24 Mar 2024 19:48:35 -0400 Message-ID: <20240324235012.1356413-52-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vinicius Costa Gomes [ Upstream commit ee14cc9ea19ba9678177e2224a9c58cce5937c73 ] Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed. The E1000_TSIRC Time Sync Interrupt Cause register can be cleared in two ways, by either reading it or by writing '1' into the specific cause bit. This is documented in section 8.16.1. The following flow was used: 1. read E1000_TSIRC into 'tsicr'; 2. handle the interrupts present into 'tsirc' and mark them in 'ack'; 3. write 'ack' into E1000_TSICR; As both (1) and (3) will clear the interrupt cause, if the same interrupt happens again between (1) and (3) it will be ignored, causing events to be missed. Remove the extra clear in (3). Fixes: 00c65578b47b ("igb: enable internal PPS for the i210") Acked-by: Richard Cochran Signed-off-by: Vinicius Costa Gomes Tested-by: Pucha Himasekhar Reddy (A Co= ntingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethern= et/intel/igb/igb_main.c index c0e2323e50c6e..5d8d5915bc276 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6555,44 +6555,31 @@ static void igb_extts(struct igb_adapter *adapter, = int tsintr_tt) static void igb_tsync_interrupt(struct igb_adapter *adapter) { struct e1000_hw *hw =3D &adapter->hw; - u32 ack =3D 0, tsicr =3D rd32(E1000_TSICR); + u32 tsicr =3D rd32(E1000_TSICR); struct ptp_clock_event event; =20 if (tsicr & TSINTR_SYS_WRAP) { event.type =3D PTP_CLOCK_PPS; if (adapter->ptp_caps.pps) ptp_clock_event(adapter->ptp_clock, &event); - ack |=3D TSINTR_SYS_WRAP; } =20 if (tsicr & E1000_TSICR_TXTS) { /* retrieve hardware timestamp */ schedule_work(&adapter->ptp_tx_work); - ack |=3D E1000_TSICR_TXTS; } =20 - if (tsicr & TSINTR_TT0) { + if (tsicr & TSINTR_TT0) igb_perout(adapter, 0); - ack |=3D TSINTR_TT0; - } =20 - if (tsicr & TSINTR_TT1) { + if (tsicr & TSINTR_TT1) igb_perout(adapter, 1); - ack |=3D TSINTR_TT1; - } =20 - if (tsicr & TSINTR_AUTT0) { + if (tsicr & TSINTR_AUTT0) igb_extts(adapter, 0); - ack |=3D TSINTR_AUTT0; - } =20 - if (tsicr & TSINTR_AUTT1) { + if (tsicr & TSINTR_AUTT1) igb_extts(adapter, 1); - ack |=3D TSINTR_AUTT1; - } - - /* acknowledge the interrupts */ - wr32(E1000_TSICR, ack); } =20 static irqreturn_t igb_msix_other(int irq, void *data) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E76C818442E; Sun, 24 Mar 2024 23:51:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324275; cv=none; b=i3ucFLlYNvdqdmxsAuxhCdq7+5S9VMdLdCk83ZFcROuWak89KEXeSOy+yC9AFEgjAa7aX60LDJW/X8FX75e7Xd7gep+gifMy340W7w/MMmCoUiIRobcyo6E+6SurhYyO2vX/V8g+sAcs+QfEB1SjnLI2bI0K/rbVP9tDsYAqL+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324275; c=relaxed/simple; bh=KqsAUPQeP4Ko1impn9N/u7BwalSitQSSqAyxjHQ428A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Su2BP/gmZnkgy5o+OuIGmOinsTJE/6fHxEOAS39oPHAi+To2dGWkkKd7RAdB4nucWj10GH8AOfrdqXrqJbW5H37lIBstZu6yV1DEOg4Iw/KSdNj4u0bGQKTVbWyWHMP3EqiGsnqknYe4oz383GOmEXd3wc+upp6G993DQHNQX2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eWybTXkQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eWybTXkQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6880C43390; Sun, 24 Mar 2024 23:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324273; bh=KqsAUPQeP4Ko1impn9N/u7BwalSitQSSqAyxjHQ428A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWybTXkQKMBQ4FvM/t4+D7+NTzmDE9usaD7XyMyAAqx4r8Li5M3RlQfGDsnld3a0i qsK4Mqr3TIL2d94uAmaaVJ5jC/LqwnQJV54ISSWxwdQ85OlQHRDgBohqAQkUIh9EHO 6dHoHrPpK6LvhgN6p3eJptr3gDuw6uJE7VGuIy+i/irT0y7jQFhqu0BiEV1mA/KrOn 8Z33nLh/URZ4JgzH8HRDVjqjdRbhULIvCOWjY0DM8zeZpC0uI2wNnj3X1A6jwM/OoN ksA1MIIh2sdvsXufprJEGFNBFEGyM3paD1j/VdXMzyeASJBXGUp7EAibsJkW30kt/q 3d12zqHdBrwrQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 4.19 052/148] Bluetooth: Remove superfluous call to hci_conn_check_pending() Date: Sun, 24 Mar 2024 19:48:36 -0400 Message-ID: <20240324235012.1356413-53-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Jonas Dre=C3=9Fler [ Upstream commit 78e3639fc8031275010c3287ac548c0bc8de83b1 ] The "pending connections" feature was originally introduced with commit 4c67bc74f016 ("[Bluetooth] Support concurrent connect requests") and 6bd57416127e ("[Bluetooth] Handling pending connect attempts after inquiry") to handle controllers supporting only a single connection request at a time. Later things were extended to also cancel ongoing inquiries on connect() with commit 89e65975fea5 ("Bluetooth: Cancel Inquiry before Create Connection"). With commit a9de9248064b ("[Bluetooth] Switch from OGF+OCF to using only opcodes"), hci_conn_check_pending() was introduced as a helper to consolidate a few places where we check for pending connections (indicated by the BT_CONNECT2 flag) and then try to connect. This refactoring commit also snuck in two more calls to hci_conn_check_pending(): - One is in the failure callback of hci_cs_inquiry(), this one probably makes sense: If we send an "HCI Inquiry" command and then immediately after a "Create Connection" command, the "Create Connection" command might fail before the "HCI Inquiry" command, and then we want to retry the "Create Connection" on failure of the "HCI Inquiry". - The other added call to hci_conn_check_pending() is in the event handler for the "Remote Name" event, this seems unrelated and is possibly a copy-paste error, so remove that one. Fixes: a9de9248064b ("[Bluetooth] Switch from OGF+OCF to using only opcodes= ") Signed-off-by: Jonas Dre=C3=9Fler Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_event.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 4811855259267..0e9325057b3a9 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2777,8 +2777,6 @@ static void hci_remote_name_evt(struct hci_dev *hdev,= struct sk_buff *skb) =20 BT_DBG("%s", hdev->name); =20 - hci_conn_check_pending(hdev); - hci_dev_lock(hdev); =20 conn =3D hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5DB7184435; Sun, 24 Mar 2024 23:51:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324275; cv=none; b=P2DroZEzLg3zQsDzDKs63RQEyFU4l21PkHCUzS7BFTxeJ6PJiQC6mZUiwZbSr22WlFcShgG6b30eSwPMasOVUCSCH1G2GntTKQYI5Xg3769tmMm/ZHMrpPkrF5oKSB8lO8OWHAFaDK/eGUYmmI5gJr5/6adu5WP9Jq+exgYnCbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324275; c=relaxed/simple; bh=PiF46aRx2uACoNISWlyOPAv5iPvh0dEnjtRpiyJfEoA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qt3zEMrjLdlSycd1yhgzKS3WtaZhnKrOjOEnWvjnMTzphMCTsSKY/ooY54AN9cjoyT3uHcMrIDbIYTNvdhmlBiqD4aDfZhHRNM3NE0HXsEOly9f8R7q4qRxfWmow4MA4F/go5vVIj1nM0yeSbUB24lkPKuzMAIKlwL4tRhUqC54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sfe4jBWR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Sfe4jBWR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16A1FC43399; Sun, 24 Mar 2024 23:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324274; bh=PiF46aRx2uACoNISWlyOPAv5iPvh0dEnjtRpiyJfEoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sfe4jBWRtrUaCLs5icVkNQCUoM6d3iB10j4qY9uQ2zeQT/uPSXH4yzrl+fBpNcw3z oNKxoJrFsgOEam11pyxoIWK7n2uQZXBtnedVVEUeWN/D5vbTdWcy6J0Rm7Q8BTJz4C Su3u8n4E5rIyazAdXTI/w+sH5wwgGet3dVk0VM79ulxqF4jTCYi8dWZR5qPuHAIK40 IvzlJrcRrJYJ3g5Vg7d6mo5zqnAUNrrR2MaPUyk1x5f/lb49lcdf8Taj6zbqMUL6/3 0TI1IjorTb3tOHH2an+oZRmATesUwiPIloAPjXuQYZztp5wpz1k3NilT8DiOj2hTUD 7mCgU7//q0/Xw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 4.19 053/148] Bluetooth: hci_core: Fix possible buffer overflow Date: Sun, 24 Mar 2024 19:48:37 -0400 Message-ID: <20240324235012.1356413-54-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit 81137162bfaa7278785b24c1fd2e9e74f082e8e4 ] struct hci_dev_info has a fixed size name[8] field so in the event that hdev->name is bigger than that strcpy would attempt to write past its size, so this fixes this problem by switching to use strscpy. Fixes: dcda165706b9 ("Bluetooth: hci_core: Fix build warnings") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index f455a503f5b04..47f1eec0eb35f 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2074,7 +2074,7 @@ int hci_get_dev_info(void __user *arg) else flags =3D hdev->flags; =20 - strcpy(di.name, hdev->name); + strscpy(di.name, hdev->name, sizeof(di.name)); di.bdaddr =3D hdev->bdaddr; di.type =3D (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4); di.flags =3D flags; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2CE0184436; Sun, 24 Mar 2024 23:51:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324275; cv=none; b=C1Cb8qJZBIvM3oZ+FciaS5tzA+yk8TdDa8+/s1K3ePxNOZpQQ9mhTiEFCmFuZrisHV/iIxG3u/O+DaDi8Bnx0tA9MQbZggXMWQ8H+4cnU8cyDwTuF8JODjYUf2pOe7Vv7nuFgay9n073ewW91E6vhccm2BnxyUvzBN4tE5Wkf+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324275; c=relaxed/simple; bh=RlpN8v+SpRk98+w7H3gbi89e8+2REgiqFkpTpNGHH7E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pwxqvzKLPUAnruOmdAisMyLn5LBD2Kn34DqqbxFgIiLPw98w1scnhvpsBduWTAg6g2YuEpRjGPA5Qwk4GtlGNG/8KGByd8fjvc3UoIxxmRf2cSxhr4jIeUKY6Ru6mrCL2xXFuCp2XCZYMHqqbUwwoX/+plWD/fNFADsmxDX4Pp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o8azG9SF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o8azG9SF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCA6EC433A6; Sun, 24 Mar 2024 23:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324275; bh=RlpN8v+SpRk98+w7H3gbi89e8+2REgiqFkpTpNGHH7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o8azG9SFh1c6klOLrgZI5bD+O5Me98wp8WKXBvEa7A0eAqKCf18CrvvT95YOLwLgO bZUWxOiXd5sRTbHKSGo6s1sFJltqjfpijFz3eEnAHUNJy7pGNClenBY9yO8kDtcFHV rL2AkknqD4jiobHnUdq0o2Ha1l+zO+6sOtUPYrgfSyy8PW3Pk2Zt5kwBZY0aYQodXN zAC4JQKQzR9eGA/gaFIhTRDGcnqbEV4glxmHJ0RPJ6TujAtDZIM4WvTIsEHoIuyHhg ppnk1MhZlupp9NhmxbeGzZhVlBm0Xrc7Z4ob4P/mhPWHpQX6XSaKRTzV8EOE1PUXPc GYPk+SkvFb/xw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chen Ni , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 054/148] sr9800: Add check for usbnet_get_endpoints Date: Sun, 24 Mar 2024 19:48:38 -0400 Message-ID: <20240324235012.1356413-55-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Chen Ni [ Upstream commit 07161b2416f740a2cb87faa5566873f401440a61 ] Add check for usbnet_get_endpoints() and return the error if it fails in order to transfer the error. Signed-off-by: Chen Ni Reviewed-by: Simon Horman Fixes: 19a38d8e0aa3 ("USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Dev= ice Driver Support") Link: https://lore.kernel.org/r/20240305075927.261284-1-nichen@iscas.ac.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/usb/sr9800.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c index 8f8c9ede88c26..a5ff7df10505b 100644 --- a/drivers/net/usb/sr9800.c +++ b/drivers/net/usb/sr9800.c @@ -737,7 +737,9 @@ static int sr9800_bind(struct usbnet *dev, struct usb_i= nterface *intf) =20 data->eeprom_len =3D SR9800_EEPROM_LEN; =20 - usbnet_get_endpoints(dev, intf); + ret =3D usbnet_get_endpoints(dev, intf); + if (ret) + goto out; =20 /* LED Setting Rule : * AABB:CCDD --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65C83184314; Sun, 24 Mar 2024 23:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324278; cv=none; b=fqPwWpv31r8ebvRju4UlMfxUOVvqA331U1RNbJZzB6o8XSFbXcVR9bI2/YOLrwUNZdQ0Oyp2J3yjbRF/8wns1HJDrri3a/sgbCRCCCyWAbbwlu5IxO3CXdpmHPcjnx1z8du5QAXNVP9i4I/lHplgnSozompa+sPliX5XEeFMVZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324278; c=relaxed/simple; bh=QnZwcPZGcyCW/XtB6zKt3HftXxpmW+ty+R0k8p/gbuM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iLpKuaiMgQTWfbC1nm02MgDMD8G1s5d0rNdNXuUTgOUnT4wDKUPdU3j/XyH30GsB/A1s/jzJ/VS2itL8Q8YHeDPkcFRr0IGWhVlPF5+FsUrEsMm86emEsyohUyHMpeXv2Y1dezH2NRl2qd2uT/JD5/GBBnfJcGMm2cBZg/45sEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lKAm6kJZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lKAm6kJZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43EE6C433F1; Sun, 24 Mar 2024 23:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324277; bh=QnZwcPZGcyCW/XtB6zKt3HftXxpmW+ty+R0k8p/gbuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lKAm6kJZG5o+Yrv12/rDm2rOu9NAK0xYYfrndCs53LrYPGEZMps7H9mddxVu+kIIg AkD/yTiQo6WjQiGoqWecuyKa3flzXQgz1VKUN9os35IVDcTbDlUuxlkvqWXEV/eu6m Tv8v/yws8cqvl11isxZHH6MUqK4sSCdxqLMY7WyPpltsemKnbb/F3HloIYx7diqcXT 8crc12GQIO9s9wiibgpk4lHgnyi9buf24MOv6QK/JKLY7m83ZjKNkgWShahGqvmC6u Nt1fk2hJJP98KkJKz3CUiGafFmsUToV1zplkv8hOvrfgRyYh/1OWQP8PwaZeamTpJE 1e6ukPWYFUL1w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Alexei Starovoitov , Sasha Levin Subject: [PATCH 4.19 055/148] bpf: Fix hashtab overflow check on 32-bit arches Date: Sun, 24 Mar 2024 19:48:39 -0400 Message-ID: <20240324235012.1356413-56-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Toke H=C3=B8iland-J=C3=B8rgensen [ Upstream commit 6787d916c2cf9850c97a0a3f73e08c43e7d973b1 ] The hashtab code relies on roundup_pow_of_two() to compute the number of hash buckets, and contains an overflow check by checking if the resulting value is 0. However, on 32-bit arches, the roundup code itself can overflow by doing a 32-bit left-shift of an unsigned long value, which is undefined behaviour, so it is not guaranteed to truncate neatly. This was triggered by syzbot on the DEVMAP_HASH type, which contains the same check, copied from the hashtab code. So apply the same fix to hashtab, by moving the overflow check to before the roundup. Fixes: daaf427c6ab3 ("bpf: fix arraymap NULL deref and missing overflow and= zero size checks") Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Message-ID: <20240307120340.99577-3-toke@redhat.com> Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/bpf/hashtab.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 8e379b667a0f7..16081d8384bfc 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -330,7 +330,13 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *= attr) num_possible_cpus()); } =20 - /* hash table size must be power of 2 */ + /* hash table size must be power of 2; roundup_pow_of_two() can overflow + * into UB on 32-bit arches, so check that first + */ + err =3D -E2BIG; + if (htab->map.max_entries > 1UL << 31) + goto free_htab; + htab->n_buckets =3D roundup_pow_of_two(htab->map.max_entries); =20 htab->elem_size =3D sizeof(struct htab_elem) + @@ -340,10 +346,8 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *= attr) else htab->elem_size +=3D round_up(htab->map.value_size, 8); =20 - err =3D -E2BIG; - /* prevent zero size kmalloc and check for u32 overflow */ - if (htab->n_buckets =3D=3D 0 || - htab->n_buckets > U32_MAX / sizeof(struct bucket)) + /* check for u32 overflow */ + if (htab->n_buckets > U32_MAX / sizeof(struct bucket)) goto free_htab; =20 cost =3D (u64) htab->n_buckets * sizeof(struct bucket) + --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD0FD18431F; Sun, 24 Mar 2024 23:51:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324279; cv=none; b=aLcjxNP7WLucV447njlS13hToSsX1W47aiGsYzsBfY+zFsfFxpDvkwAM8r15EdrO463x28PQvawAHdtVyO6HYQIoI+lyYgmicQZj+eJfqwB1ZJLGnY11LCgRiFjid27PAAciJ7q7M4gJTnvNCUweVVjzDIcWK4foyUVqeX8SF+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324279; c=relaxed/simple; bh=ZhE1dZQ4Yu9nivZcDGnzC9MzTKCMqaSKKsVcmNvEnMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EyajHbx55i2JiCKQ3cKmkO1tHzbELuYaOBNkqnKumHfDscsJWtinZqCIH+Q163j9xg/L5GhyudgubE6dokHutIjZDO5vzg6VkD6xiJ7qB1HEl4xvcA7brAiJhDS2RD52CxkcXHryF3UwLuWvQrf7HO5/s40DTagWl1SRwTRu2Fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Piv0c9kw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Piv0c9kw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CC98C43390; Sun, 24 Mar 2024 23:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324278; bh=ZhE1dZQ4Yu9nivZcDGnzC9MzTKCMqaSKKsVcmNvEnMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Piv0c9kwkNPzHtDTdgaNEnL+HoeTLQIxTJqaElWtTIfOyi8Hvo8ZlJS6aE6Lreno+ ud+wWgOWo3IBeKEd5DucRhaLK6TWElRUgtQgw1NmI3w4IcCEFXuPNvOBALFUm4iE5j WHSNdKF4IAOPzUfsqZiQkYlqgG23qkkB1Iik+LAnQzw1OacUy1+1kliU4EPUYVQaWO 4mJ7as8/zRP0oEJsNVdnBtaQWbpgvDofCjJ6KOB9gDnIM4wZL1gpE6CNKbsc4KCtxH heTAmSy2PccMJWHyJYI9Ro7DaGV7UBpf09Eb2cnympbsHJSl84MFF1olQOfSmV3X6R 0tqvMYBb2IKlQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Bui Quang Minh , Alexei Starovoitov , Sasha Levin Subject: [PATCH 4.19 056/148] bpf: Fix stackmap overflow check on 32-bit arches Date: Sun, 24 Mar 2024 19:48:40 -0400 Message-ID: <20240324235012.1356413-57-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Toke H=C3=B8iland-J=C3=B8rgensen [ Upstream commit 7a4b21250bf79eef26543d35bd390448646c536b ] The stackmap code relies on roundup_pow_of_two() to compute the number of hash buckets, and contains an overflow check by checking if the resulting value is 0. However, on 32-bit arches, the roundup code itself can overflow by doing a 32-bit left-shift of an unsigned long value, which is undefined behaviour, so it is not guaranteed to truncate neatly. This was triggered by syzbot on the DEVMAP_HASH type, which contains the same check, copied from the hashtab code. The commit in the fixes tag actually attempted to fix this, but the fix did not account for the UB, so the fix only works on CPUs where an overflow does result in a neat truncation to zero, which is not guaranteed. Checking the value before rounding does not have this problem. Fixes: 6183f4d3a0a2 ("bpf: Check for integer overflow when using roundup_po= w_of_two()") Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Reviewed-by: Bui Quang Minh Message-ID: <20240307120340.99577-4-toke@redhat.com> Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/bpf/stackmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c index 92310b07cb98e..a41858db14416 100644 --- a/kernel/bpf/stackmap.c +++ b/kernel/bpf/stackmap.c @@ -113,11 +113,14 @@ static struct bpf_map *stack_map_alloc(union bpf_attr= *attr) } else if (value_size / 8 > sysctl_perf_event_max_stack) return ERR_PTR(-EINVAL); =20 - /* hash table size must be power of 2 */ - n_buckets =3D roundup_pow_of_two(attr->max_entries); - if (!n_buckets) + /* hash table size must be power of 2; roundup_pow_of_two() can overflow + * into UB on 32-bit arches, so check that first + */ + if (attr->max_entries > 1UL << 31) return ERR_PTR(-E2BIG); =20 + n_buckets =3D roundup_pow_of_two(attr->max_entries); + cost =3D n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap); if (cost >=3D U32_MAX - PAGE_SIZE) return ERR_PTR(-E2BIG); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14FB022C640; Sun, 24 Mar 2024 23:51:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324281; cv=none; b=do8qpehv9UCmeW3TbHmwGWBO3arymnE+QV4CxhAzNijo948WgkLRhIgj3pq7NxmDUaKKfDB/Pzn/Fe4wpQjgyQfqPAB2Lx15TO3KyKUEhGNjlBVpYBKysxlXiZnutvZTEiCdGtKd/jol5YwUrVrvDoKwzD6Dyqu6BcK5ulk/Aa0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324281; c=relaxed/simple; bh=qC98P5/GrlglsIhfMpYTW+QmAAft/+8E9Zd4Pkn3EbQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZM8ayQGUbkA65O9r77m2S11bSxvXQG3wMdU9NJGdB+b1QpW4XvulRLwrTIXQscjdh8MFTvpALEgQomL5JTNnOf8RO7CWAUuqavI+WPR5oadePFU/sKXe2ZapjXBs/iZPWPVYkLZ9xt1hWT7CoR9x3mRJvtwo4S7ni1MMDkc2fVU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VK9yMqPi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VK9yMqPi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5CA4C43394; Sun, 24 Mar 2024 23:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324279; bh=qC98P5/GrlglsIhfMpYTW+QmAAft/+8E9Zd4Pkn3EbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VK9yMqPiZHuPUHmlf7Tn/nk5WGN32LN0GFvu8UIc8J6rMMHeOTffiJEYC/ZqdrX0w nY9g646qK6s2UoIaFM43tOSQQ9jYm0CFJEMRC8PoOf8vldpX5+enPl2gW6mf8jfCLM kMXdsN8SAA1Ff/zxMr+aSmDD/6L5ux3waUid+EXek2bL1sSB2jCC5UegOs2CKiC9wy /SUVKF2fiUcYugwO3prxqXVCiYKAulW27tHz/65T19C56o3WuHrrQXVb8dmWYV9sAI WdL7vgH0CJJGcd61t72+8zuDSh9zr+m5DWSS8b0ib3Sp7BpXECb+OcA2eqpizkP7CQ oyeiuVsHZMvgg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shiming Cheng , Lena Wang , David Ahern , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 057/148] ipv6: fib6_rules: flush route cache when rule is changed Date: Sun, 24 Mar 2024 19:48:41 -0400 Message-ID: <20240324235012.1356413-58-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shiming Cheng [ Upstream commit c4386ab4f6c600f75fdfd21143f89bac3e625d0d ] When rule policy is changed, ipv6 socket cache is not refreshed. The sock's skb still uses a outdated route cache and was sent to a wrong interface. To avoid this error we should update fib node's version when rule is changed. Then skb's route will be reroute checked as route cache version is already different with fib node version. The route cache is refreshed to match the latest rule. Fixes: 101367c2f8c4 ("[IPV6]: Policy Routing Rules") Signed-off-by: Shiming Cheng Signed-off-by: Lena Wang Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/fib6_rules.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index f590446595d8b..1913801f4273c 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -437,6 +437,11 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule = *rule) + nla_total_size(16); /* src */ } =20 +static void fib6_rule_flush_cache(struct fib_rules_ops *ops) +{ + rt_genid_bump_ipv6(ops->fro_net); +} + static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = =3D { .family =3D AF_INET6, .rule_size =3D sizeof(struct fib6_rule), @@ -449,6 +454,7 @@ static const struct fib_rules_ops __net_initconst fib6_= rules_ops_template =3D { .compare =3D fib6_rule_compare, .fill =3D fib6_rule_fill, .nlmsg_payload =3D fib6_rule_nlmsg_payload, + .flush_cache =3D fib6_rule_flush_cache, .nlgroup =3D RTNLGRP_IPV6_RULE, .policy =3D fib6_rule_policy, .owner =3D THIS_MODULE, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C324A294483; Sun, 24 Mar 2024 23:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324281; cv=none; b=KDyPowbw8ix1lQknDczHYjGlq4QLRSauiH4KXded7zdlj+mfe9cNLNK5Vt6GEMNjEOkLUkc1SPEO+fb6antYOA91gu6XYteFopzLmbYES3DIEA17xQnk7jl/klVfGWUIeeC2roLETjkqWVvZIg6AGF/iGsKFRmU5I3kz5XSwRDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324281; c=relaxed/simple; bh=/4z3zV4j4Wj0YNPYCHyF512kgVBeggTd4PFDIWxIE2k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RaQq9NPw7ItjtOthr2ZGjLG1nwRJJxwZ8eOtUa6jpks6x6t2phOVtj7wLtY0WcgZwwzKKq/gR/hWpp7J1WD6DeuaDHJLQSq8I6dhg1x9CN6t+Ch8AcT4hmvwp7gsN16Fbox87Qlyljf1/Y8FsAzguIrvyYKy0RVxBWoYB+nub1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HxFjuEF1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HxFjuEF1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39BD9C433C7; Sun, 24 Mar 2024 23:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324281; bh=/4z3zV4j4Wj0YNPYCHyF512kgVBeggTd4PFDIWxIE2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HxFjuEF1nWozwZ3CLDboeaZBYAuHicxBXSC0SU54tOBNIKgx+nmzD4rs6Q+XDzvEe XghJtcWaIILPu1zqRIoP+fqKGKogTtax5wSdV1VL07cVaN0z4R3NowVer3oJpCsckm dCz0J+TYFX7ZdN/vk5jSdl0ZuDiF958ySGrX+KWKkr3yZi0ZADYgSq5OGaupibsB7d Lz9A5iegZobkHhkue4vqVu2X32Wgb8FH20lA74tGZtKlzd3N+44J9e2k4oClZyL2Gk X4Eco53e4R4FZL69THs47yptl/3Ky+XyruJomburz1LxFHciwWeVKpJ11rE2uwRmEV CJEPceOLzD8rA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Gavrilov Ilia , Jason Xing , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 058/148] tcp: fix incorrect parameter validation in the do_tcp_getsockopt() function Date: Sun, 24 Mar 2024 19:48:42 -0400 Message-ID: <20240324235012.1356413-59-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gavrilov Ilia [ Upstream commit 716edc9706deb3bb2ff56e2eeb83559cea8f22db ] The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen. To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Gavrilov Ilia Reviewed-by: Jason Xing Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 712186336997b..3df973d22295c 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3369,11 +3369,11 @@ static int do_tcp_getsockopt(struct sock *sk, int l= evel, if (get_user(len, optlen)) return -EFAULT; =20 - len =3D min_t(unsigned int, len, sizeof(int)); - if (len < 0) return -EINVAL; =20 + len =3D min_t(unsigned int, len, sizeof(int)); + switch (optname) { case TCP_MAXSEG: val =3D tp->mss_cache; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F14CB29448E; Sun, 24 Mar 2024 23:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324283; cv=none; b=NiZ7NzzBREGXXBsIpGQxGJarNIz1nPbFKFjymlxdMGWQ/vo63+wFsMVFExBG5uJcRcDLq1/nX5lUYIoNcJ4IKNgmxn1YAuErRA9u10hqE/yh7k4QvVhnzjkej4GBkqxw8ME36Z5B4gSKFHlJBl8Tl2K8OAKCaCig+6MTmZonpeU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324283; c=relaxed/simple; bh=lwzXxwSWoOLNU+zV6aEFEVRdKo2gqhEXmatN3mGmyDQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T7ri2A5oirSd2vAWVRWs93tCoDaEwCsaWq9hUDFdzHlb17luay3Lfd3+vxOTjFNECBQ/A7aXx2f2j1Y4DakcnxyscE8okez4jgqPIMw/nCkCQna3JiC9M8JXq426uJlROBwIiRN1Qz891OYZU39G4R0funGrC+0XzNpXhLxgeWY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uMi1MDye; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uMi1MDye" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E79F2C43390; Sun, 24 Mar 2024 23:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324282; bh=lwzXxwSWoOLNU+zV6aEFEVRdKo2gqhEXmatN3mGmyDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uMi1MDyeQgiE/tl2v15zpxbbrg+aExXjvhp+cdfH7h5G2pgjzj7yjvlIAQdB860q6 3GjmFH5jTwJoGbD1DsDnYyi0x6/2RazHOgwrr5l+rE7huXBVTMcPdK8STqYxBUlGI6 J5lw5os1TyB6ScISBhREU/4+PifvY3nyFAl8CcPMozUdZYEBmCZa8t553YxZ5TIrx9 ANZj0IkcTIyhupww/hh3U4HxMC3G0or+L956fBC5/69h/dgRjV+CCW0S+bfLGhEt8l N4f91t9ATwyBhhHUq6jfwp7/NWHyZ1jMNGOqyGTS0BU1f01cbIG9iEI+GhyfTT/9bU puf5qKekKTHAw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Gavrilov Ilia , Tom Parkin , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 059/148] l2tp: fix incorrect parameter validation in the pppol2tp_getsockopt() function Date: Sun, 24 Mar 2024 19:48:43 -0400 Message-ID: <20240324235012.1356413-60-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gavrilov Ilia [ Upstream commit 955e9876ba4ee26eeaab1b13517f5b2c88e73d55 ] The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen. To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int. Fixes: 3557baabf280 ("[L2TP]: PPP over L2TP driver core") Reviewed-by: Tom Parkin Signed-off-by: Gavrilov Ilia Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/l2tp/l2tp_ppp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index c0956781665e1..3ed3b85f30b6e 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -1380,11 +1380,11 @@ static int pppol2tp_getsockopt(struct socket *sock,= int level, int optname, if (get_user(len, optlen)) return -EFAULT; =20 - len =3D min_t(unsigned int, len, sizeof(int)); - if (len < 0) return -EINVAL; =20 + len =3D min_t(unsigned int, len, sizeof(int)); + err =3D -ENOTCONN; if (sk->sk_user_data =3D=3D NULL) goto end; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06CC7294499; Sun, 24 Mar 2024 23:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324284; cv=none; b=dZnITW1pD8ILHM8k2zJMjFp0uJKzki7IiAAqQ573/X4yxPIBWxC7098M8F+Nens/TFdZM9d6iFDUg1h1dj0YNRVcqkWplzBhKxeQ+Bj2cjmc7bUSVrTPAzh4gJlxTuT5ePXpFnQW1qIcG1nIcSj2JjS1H+ouVa/ma3kWKPqlYcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324284; c=relaxed/simple; bh=atV4Yx4MhmIzRCUgPE+jW/ilVM46Ib2MxgB5BaFEVnM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K8S+HRXvbEWaWwwHhmjGl+jObLS2JYWJnkih6Ikimz7H5ue2F1relga4wTEqgTAnktP6BAprdfexNCbd3UyTvBDTqWvCR8kB6Y3UQr2SO1/J/vX8SdU9I9bOGtcMEZNJMeUe4oCvNVVJ/s88qVFDlWJGEHBmGsw455WU30f/gOU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dls6411u; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dls6411u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26F89C433C7; Sun, 24 Mar 2024 23:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324283; bh=atV4Yx4MhmIzRCUgPE+jW/ilVM46Ib2MxgB5BaFEVnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dls6411uLjHRGn3Xrj8983+LUV2LwIuLOwymqri0hTya6gMai7bqqkcIogd+QB0T9 uKSdxpU2mjYOGGTuCZFeHkd+dwc+KXalvtCehyj5r1jlb6sRCNy9lhEniK4ssGN/5Y p4ozn1bttkNDi8F3RwCnJsR8mhcHeS+JX3J4KSfJb5aoV6p+3qi5muLIrpKQNazq0z oySGv94mIKDoEigvuNBeWEAXAI9KLzZAqp/nojhC4LkvwCp/skou27ZwDmFHPoP59E Mux7H4w3fhw5AuuzhWjoiItiIpdobT8sGmEK3qRZGEF1XGGDfXOCLsS/r2rdYIGpo9 gwRAFAiCOcw8g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Gavrilov Ilia , Willem de Bruijn , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 060/148] udp: fix incorrect parameter validation in the udp_lib_getsockopt() function Date: Sun, 24 Mar 2024 19:48:44 -0400 Message-ID: <20240324235012.1356413-61-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gavrilov Ilia [ Upstream commit 4bb3ba7b74fceec6f558745b25a43c6521cf5506 ] The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen. To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reviewed-by: Willem de Bruijn Signed-off-by: Gavrilov Ilia Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/udp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index a6048cc7fc35f..6e4b26c6f97c2 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2579,11 +2579,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, = int optname, if (get_user(len, optlen)) return -EFAULT; =20 - len =3D min_t(unsigned int, len, sizeof(int)); - if (len < 0) return -EINVAL; =20 + len =3D min_t(unsigned int, len, sizeof(int)); + switch (optname) { case UDP_CORK: val =3D READ_ONCE(up->corkflag); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 406DF2944A9; Sun, 24 Mar 2024 23:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324286; cv=none; b=KbLnvjuiE0mW26Wwi+IFXK56SF6wj17IPpbg84v96LrrllHQ+NaB6z2uFihOpIajzB7q6o+sNQ8a73JjAOCn6VCHi31WPq+X9JHXliPD0+Z1PS1wMamhBjp8Ih8L9RhzVSAY9IEgis3Gfc0knc7QCwvX2QoBpZ+p9+MbMoNi90g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324286; c=relaxed/simple; bh=8y2ALWR45OaPP3Yk7OH4re6Oss8mMCQwxJVebggh1Wc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ab5zgNKONiNwqYDYUwbMZkjC5nhBNsPzFmiU6JDcU3L5wntiNYZJPtkH68o37umqxT/rdKGlpZF3rfaFg0He0Dy2fADiyIFd8wwf3CyGbPJS7nMrgFmQxcHapfqvlqWh3xMfkSr/IyUiGKi1aCQOSdvmlLGAK5zNjRpmOdxMrVA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O7tUZDH0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O7tUZDH0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28DFFC43394; Sun, 24 Mar 2024 23:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324285; bh=8y2ALWR45OaPP3Yk7OH4re6Oss8mMCQwxJVebggh1Wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7tUZDH0IL8g2nGp1D9zwpbQBdEwtfHH8KF/w8890dBPb4z9yMH/VqQgXxNGgWYx1 +2teSjcRURxO0ff01QQlcf0KfRTqMI8tBoMUOhU+Vp0EvCtlEbSiPJm8jjoipBPEAK sxD/6lkqAAw7YLEzZ4/erZ6dvTXxplWfwXJGsil+tI52+hkBVNwwN3p68xnuJnB2+K 8AIhfFvTO3ncT9S06QHMkETaiLeSXtMuBxDvnZBwmA8Rva/iKvPUbihWJa5oAKA1Sp i2tdtGS/Xp/0c8NkI1+52IqaJQsEQqu8Zx7DgM4Rf71Wqf0469GnQYPrbD7J1SzSaX /C7LRkpie3fYg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Gavrilov Ilia , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 061/148] net: kcm: fix incorrect parameter validation in the kcm_getsockopt) function Date: Sun, 24 Mar 2024 19:48:45 -0400 Message-ID: <20240324235012.1356413-62-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gavrilov Ilia [ Upstream commit 3ed5f415133f9b7518fbe55ba9ae9a3f5e700929 ] The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen. To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int. Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module") Signed-off-by: Gavrilov Ilia Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/kcm/kcmsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index a82892c288600..45450f0fd9acb 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -1276,10 +1276,11 @@ static int kcm_getsockopt(struct socket *sock, int = level, int optname, if (get_user(len, optlen)) return -EFAULT; =20 - len =3D min_t(unsigned int, len, sizeof(int)); if (len < 0) return -EINVAL; =20 + len =3D min_t(unsigned int, len, sizeof(int)); + switch (optname) { case KCM_RECV_DISABLE: val =3D kcm->rx_disabled; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A0CC2944A1; Sun, 24 Mar 2024 23:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324287; cv=none; b=Rydr6EGhtqR+2dN7Eu6bE9/DzLfQYuc64A6H/6YxftJtesFy7SBfU/bL7BArIrmvBD7HNIS9gCkroM1ZefTbnIWwS5FU0F+3X/IZJiz8xGp81l4wFh3EBDlryV2NbfhLxD+sMuCHfYHj6NML16OiqVh1v1DHXsVDKX9jamkuCe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324287; c=relaxed/simple; bh=AtFzqDVBmi7701nAnV2WFXR0J4wXEjsi4aMYf0fKSDE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PwdrtcFX/cGlTaDNZhcNA2Yrlad+cQE5a5iCKc56S4F5K5tKNznH/Va9quJqsCeDZomOtSYT8tUE6+n0pjDdN+a92wQtGwvYkwFTKvx3l5LX4PuZc8ftMi9k7f8rcCImDvIAa6SmFKg5R9qejEnojHJ7RWDmYi28onJm4R4t3ow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HVl2O/Qg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HVl2O/Qg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6683AC433A6; Sun, 24 Mar 2024 23:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324286; bh=AtFzqDVBmi7701nAnV2WFXR0J4wXEjsi4aMYf0fKSDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVl2O/QgvXYWUQm7eLnvGv1688zmcksbEdBX9aIBuvsXbkGCMor+X/HRR6YLSp33T RkShRrOq2/N6uGSVwqLWyn4RdbB3hZ/Z/70xoEWKdHGXwRliw2A01EtsoyO6ls/giq 7stYlFkHx8GTALBgqiQTQU3zJlIO8t2xgocPuiejZ/mLjT+eyb5zYD8mcoommvmBfC tSJiy3PDKBxAfIfcna+MTyo3e6zeJPLf/4L17Ik0aDToxbKg92e+wi4wid2SZxWuoe 94U3vyNt+RBtcm5iKPuCg0lPWKEQ+m0eFgob2DGNC1hgTs/gM9AHDT1yeMT8a7f7+R iLLRy9mYBAsNg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Gavrilov Ilia , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 062/148] net/x25: fix incorrect parameter validation in the x25_getsockopt() function Date: Sun, 24 Mar 2024 19:48:46 -0400 Message-ID: <20240324235012.1356413-63-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gavrilov Ilia [ Upstream commit d6eb8de2015f0c24822e47356f839167ebde2945 ] The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen. To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Gavrilov Ilia Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/x25/af_x25.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 9d0328bb30ca1..8d78f204ba3c1 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -475,12 +475,12 @@ static int x25_getsockopt(struct socket *sock, int le= vel, int optname, if (get_user(len, optlen)) goto out; =20 - len =3D min_t(unsigned int, len, sizeof(int)); - rc =3D -EINVAL; if (len < 0) goto out; =20 + len =3D min_t(unsigned int, len, sizeof(int)); + rc =3D -EFAULT; if (put_user(len, optlen)) goto out; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8287F2944B6; Sun, 24 Mar 2024 23:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324287; cv=none; b=h/QZIHp5mVEiwsiO4j1s7z1uNeTpuldCS0b+pHx2FnOHPO+sIH3NMepZF6S1kyD4SvvDkFKMOi5NmurCDOX3OxOoajx3Y+V6p+VlJv7O3SZxfHrUa2Z3xQLUKFSzvmSEgS3rpN3pts4AQy9H4rsyA9B9QmzDWitd1G52uiDFqs8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324287; c=relaxed/simple; bh=FaKGe9dFoSMlkOYS7BvtaFwqewWRRVHkf5kCa79y7HY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uDgMh2o5NPsHS0kde8/c2gy5xbOnv8WdakEAvdXCQqfXis1iMLWfGumVnJIHD+VxaA33HsrMrGRhdDxdy+XLQ1JRXjXcfcshXCaDPq0l0Cz8+ijPC7bEn4HVfN1yxZT0eCiyShPjst5+FbtfmGfORwNFTh/e1eqd72k/chaFTx8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PJ9qgCw8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PJ9qgCw8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A07E2C433C7; Sun, 24 Mar 2024 23:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324287; bh=FaKGe9dFoSMlkOYS7BvtaFwqewWRRVHkf5kCa79y7HY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJ9qgCw8W2F6RUJbfcsC2YOohzv53IaSmLfO3dQ/pxIAv2bc0BhYhbizIgi4crN4h JZNWjeD8ItqvTAFUa4ez/x2XyPDKQdGXz72CWRvP1H0FOaig9zdxWAYUmFUbtDuB/Q k507i7kWUkAosubrNCP8fniQhkMcUJWzPLbhAcQiEVqU9vN5+BEc9SQEWPnnQbgJl1 6clpw7Hoik9F2lfWPvvAsnctpFMuvxgVk+jAhyFGOPx9PCGQJ6uSMzL8fivdsJJHLg 3+WbYHtqWgLNzv6P36NNgcElq+pNptAMGi2HkYLOLnLNHDQL1oGafaGE9PV3IufqG4 IWFvt5aY4Wx+w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Duoming Zhou , Louis Peens , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 063/148] nfp: flower: handle acti_netdevs allocation failure Date: Sun, 24 Mar 2024 19:48:47 -0400 Message-ID: <20240324235012.1356413-64-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit 84e95149bd341705f0eca6a7fcb955c548805002 ] The kmalloc_array() in nfp_fl_lag_do_work() will return null, if the physical memory has run out. As a result, if we dereference the acti_netdevs, the null pointer dereference bugs will happen. This patch adds a check to judge whether allocation failure occurs. If it happens, the delayed work will be rescheduled and try again. Fixes: bb9a8d031140 ("nfp: flower: monitor and offload LAG groups") Signed-off-by: Duoming Zhou Reviewed-by: Louis Peens Link: https://lore.kernel.org/r/20240308142540.9674-1-duoming@zju.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c b/drivers= /net/ethernet/netronome/nfp/flower/lag_conf.c index bf10598f66ae0..1b5e0cef97713 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c @@ -336,6 +336,11 @@ static void nfp_fl_lag_do_work(struct work_struct *wor= k) =20 acti_netdevs =3D kmalloc_array(entry->slave_cnt, sizeof(*acti_netdevs), GFP_KERNEL); + if (!acti_netdevs) { + schedule_delayed_work(&lag->work, + NFP_FL_LAG_DELAY); + continue; + } =20 /* Include sanity check in the loop. It may be that a bond has * changed between processing the last notification and the --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94256184325; Sun, 24 Mar 2024 23:51:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324288; cv=none; b=X79RfVa2cwrBEVjgh7IqbTIq3vRb/fuyqcA9CcQPFkhwPw8M32cRFdKtqBjAc1N4qi9fuapJ2Wkw4SgkuKSOxPhjHvaPO1MG8bMYf9yrsoVD/7sXDrgho+gNzjxWLp7CTk0+Wfn1363zaAYuj9wLnutHZkcJ2SXjIXJpmhD+RVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324288; c=relaxed/simple; bh=bk37W52OwdXA5m+3hvBG8EWN0UixpIkRNLuOL4i2+U4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eyu7nHzfQD3nflr8Cp4hjrdgszpKtd3YLm+MAhYWke42DU0BFMPKqY2MR69kSEhlbQ/+J+237Y8/sp4w4zvb9T5BBW0bOmioiXh46uXNdQf6ef64ei1HzZVjl1lkqQqt/f/P9MYf/X4DolDjC9K/ZwGZrGLuH3b3dzc+3CY5hzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GlqL+7y6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GlqL+7y6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA1D6C433A6; Sun, 24 Mar 2024 23:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324288; bh=bk37W52OwdXA5m+3hvBG8EWN0UixpIkRNLuOL4i2+U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GlqL+7y6Oi1py71VcjY10KU4xndR6LfOOs2sFfVbFa3v5nUnnGnUHe3paC98R/nDp g8XdvsP1OcgPRKXgfOWwpesNpOh2tKG4qZGhMEFf/tFeIKhaQjCvlO9I728RjECBPG FOFd5AfD6ZkWfq+HGq+PTLEsro7DntRA+/CLelvsz9cmoq+40KtuTQ2YtowFEe2jeO pW9zhbHd7Z/QbRpUvlNvr0SnNEx9PYTgyI3Cm0WuvFz0Ytn2mf7xM/I6WWal3FeIQ7 KWaifDm6Kp0RUZFuHRcaBwNyI4IFwkAHYckv5PgzOuBoowkEJiKSmBfdLDZq84Py0B tc24MQHy1Bk9w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ming Lei , Patrick Plenefisch , Mike Snitzer , Sasha Levin Subject: [PATCH 4.19 064/148] dm raid: fix false positive for requeue needed during reshape Date: Sun, 24 Mar 2024 19:48:48 -0400 Message-ID: <20240324235012.1356413-65-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ming Lei [ Upstream commit b25b8f4b8ecef0f48c05f0c3572daeabefe16526 ] An empty flush doesn't have a payload, so it should never be looked at when considering to possibly requeue a bio for the case when a reshape is in progress. Fixes: 9dbd1aa3a81c ("dm raid: add reshaping support to the target") Reported-by: Patrick Plenefisch Signed-off-by: Ming Lei Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-raid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 72aa5097b68ff..1759134fce824 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3348,14 +3348,14 @@ static int raid_map(struct dm_target *ti, struct bi= o *bio) struct mddev *mddev =3D &rs->md; =20 /* - * If we're reshaping to add disk(s)), ti->len and + * If we're reshaping to add disk(s), ti->len and * mddev->array_sectors will differ during the process * (ti->len > mddev->array_sectors), so we have to requeue * bios with addresses > mddev->array_sectors here or * there will occur accesses past EOD of the component * data images thus erroring the raid set. */ - if (unlikely(bio_end_sector(bio) > mddev->array_sectors)) + if (unlikely(bio_has_data(bio) && bio_end_sector(bio) > mddev->array_sect= ors)) return DM_MAPIO_REQUEUE; =20 md_handle_request(mddev, bio); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BC33184324; Sun, 24 Mar 2024 23:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324290; cv=none; b=VEqnkDzcp/zTS+k/bfD5ueAvbyu7nLfXTJ2gAx/rJo7/iSracEL/15CpTiK8j0lOQF0iTEMQ/x0LboTH5pyHU73sI40rw1ojH6tDkVOW4x3DLN3YF1htgnmcxZXOUs5Ia489z6vZBg+fQuh5/tGcMjPPWk7BjwKEVm0D7OqR64M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324290; c=relaxed/simple; bh=3gtvXEiYEiuX+EOiBlHvzbZHrs+XWTEwGzX1WEO+EBI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O3wt1MgNmnUVQKAk9uYQNOjhbEfwdlr3tZ4gk7gulkyc7Ktck9cJsMl5GA/6ksN21yf+j7KRua7g/2o5bZyzxTmx+U19IAuGtFFbgEtZAkwKt01WjOX6brpxVJCIn6W8AMgXHhC+eDeXzfFjTEpiNV5niY8QHtKu7GSnrEd8O0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N+99+fm2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N+99+fm2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA615C433C7; Sun, 24 Mar 2024 23:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324289; bh=3gtvXEiYEiuX+EOiBlHvzbZHrs+XWTEwGzX1WEO+EBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+99+fm2/0A9bUr0OhB4F3znVlBRYv+dgLEMBt8H4P2R+cGRXGavNEVENyHxAOadd p8NGTRQZsJsBMfgAc+2Ylh8/YwBhO8e3Ww+cueJXdKMJJPOkVcrm6cq1N8ivGmwp2k VC7mQc8kaPp5HWtMi6gWQ+URN8HTXEPkghJqOZL+cUg2TwTxKdq3Qx0fNZlSE7tjIz jPSw1Q1nrgToTfd6TLz+lSQamx+LQ/ODgw02wUELZa9mzZLOM5NvdmZuI4JAeZ6zzd 9GpDgNSi8Ea+bPVwP48thUcKEyw/rykLDhKAtEIrgO9WNn/6yKIKLqjy7HhIoU2MTL 6gGao/N+lMgZw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 4.19 065/148] dm: call the resume method on internal suspend Date: Sun, 24 Mar 2024 19:48:49 -0400 Message-ID: <20240324235012.1356413-66-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit 65e8fbde64520001abf1c8d0e573561b4746ef38 ] There is this reported crash when experimenting with the lvm2 testsuite. The list corruption is caused by the fact that the postsuspend and resume methods were not paired correctly; there were two consecutive calls to the origin_postsuspend function. The second call attempts to remove the "hash_list" entry from a list, while it was already removed by the first call. Fix __dm_internal_resume so that it calls the preresume and resume methods of the table's targets. If a preresume method of some target fails, we are in a tricky situation. We can't return an error because dm_internal_resume isn't supposed to return errors. We can't return success, because then the "resume" and "postsuspend" methods would not be paired correctly. So, we set the DMF_SUSPENDED flag and we fake normal suspend - it may confuse userspace tools, but it won't cause a kernel crash. ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:56! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 1 PID: 8343 Comm: dmsetup Not tainted 6.8.0-rc6 #4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/= 2014 RIP: 0010:__list_del_entry_valid_or_report+0x77/0xc0 RSP: 0018:ffff8881b831bcc0 EFLAGS: 00010282 RAX: 000000000000004e RBX: ffff888143b6eb80 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffffffff819053d0 RDI: 00000000ffffffff RBP: ffff8881b83a3400 R08: 00000000fffeffff R09: 0000000000000058 R10: 0000000000000000 R11: ffffffff81a24080 R12: 0000000000000001 R13: ffff88814538e000 R14: ffff888143bc6dc0 R15: ffffffffa02e4bb0 FS: 00000000f7c0f780(0000) GS:ffff8893f0a40000(0000) knlGS:0000000000000000 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 0000000057fb5000 CR3: 0000000143474000 CR4: 00000000000006b0 Call Trace: ? die+0x2d/0x80 ? do_trap+0xeb/0xf0 ? __list_del_entry_valid_or_report+0x77/0xc0 ? do_error_trap+0x60/0x80 ? __list_del_entry_valid_or_report+0x77/0xc0 ? exc_invalid_op+0x49/0x60 ? __list_del_entry_valid_or_report+0x77/0xc0 ? asm_exc_invalid_op+0x16/0x20 ? table_deps+0x1b0/0x1b0 [dm_mod] ? __list_del_entry_valid_or_report+0x77/0xc0 origin_postsuspend+0x1a/0x50 [dm_snapshot] dm_table_postsuspend_targets+0x34/0x50 [dm_mod] dm_suspend+0xd8/0xf0 [dm_mod] dev_suspend+0x1f2/0x2f0 [dm_mod] ? table_deps+0x1b0/0x1b0 [dm_mod] ctl_ioctl+0x300/0x5f0 [dm_mod] dm_compat_ctl_ioctl+0x7/0x10 [dm_mod] __x64_compat_sys_ioctl+0x104/0x170 do_syscall_64+0x184/0x1b0 entry_SYSCALL_64_after_hwframe+0x46/0x4e RIP: 0033:0xf7e6aead ---[ end trace 0000000000000000 ]--- Fixes: ffcc39364160 ("dm: enhance internal suspend and resume interface") Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 9a9b2adcf39e3..50dcda27144eb 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2849,6 +2849,9 @@ static void __dm_internal_suspend(struct mapped_devic= e *md, unsigned suspend_fla =20 static void __dm_internal_resume(struct mapped_device *md) { + int r; + struct dm_table *map; + BUG_ON(!md->internal_suspend_count); =20 if (--md->internal_suspend_count) @@ -2857,12 +2860,23 @@ static void __dm_internal_resume(struct mapped_devi= ce *md) if (dm_suspended_md(md)) goto done; /* resume from nested suspend */ =20 - /* - * NOTE: existing callers don't need to call dm_table_resume_targets - * (which may fail -- so best to avoid it for now by passing NULL map) - */ - (void) __dm_resume(md, NULL); - + map =3D rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_l= ock)); + r =3D __dm_resume(md, map); + if (r) { + /* + * If a preresume method of some target failed, we are in a + * tricky situation. We can't return an error to the caller. We + * can't fake success because then the "resume" and + * "postsuspend" methods would not be paired correctly, and it + * would break various targets, for example it would cause list + * corruption in the "origin" target. + * + * So, we fake normal suspend here, to make sure that the + * "resume" and "postsuspend" methods will be paired correctly. + */ + DMERR("Preresume method failed: %d", r); + set_bit(DMF_SUSPENDED, &md->flags); + } done: clear_bit(DMF_SUSPENDED_INTERNALLY, &md->flags); smp_mb__after_atomic(); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61A7318433C; Sun, 24 Mar 2024 23:51:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324291; cv=none; b=CJe46xXL+dXaDuR/KiIfPBHGqfiL+lV7Sspn1n1Ps8sUWLiCrnFP+0hBf9Ffw9G+SQj9NbgcKP0HAPIMlPol2JJL2ICLfNq/ZqbjVRpnEkGUQ90cKxujokYNbg7VYAKpMHTValEBXbYXcgiF1iOvf6v9DRMtS+6eUrEFatEHky4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324291; c=relaxed/simple; bh=FQx08IgEuuG/JJmoSLZ6AkS4KoSw8v8dVldMzdTD5Tw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GeFjgZ24ARbg8k0ZuA2BI2VUy3n8l4yhDGDfxoBy1hSrwVolXwultexSWF8RBhCscIvNNMpJP+cxqcA5am7AFjIDd7iRk2cBhOsbbxNQa0zSVlWwI5hkn8lD73i6xm4jgzalm08BmLE3XzsG5aQJOI/ZHgh7v6RiOdWGwnRYoE0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N8fxdZDH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N8fxdZDH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F38AC43399; Sun, 24 Mar 2024 23:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324290; bh=FQx08IgEuuG/JJmoSLZ6AkS4KoSw8v8dVldMzdTD5Tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8fxdZDH+gHuKf7j5jJRKwHjdFyre9pnQZwDtIexZ9bCfJWTUQXzQl64Dp5R3Q1jZ Y9LdtCtAvSPSzxhzmm9fYTK/a6KO857HMvCMgN8jDulgHHHCHRWIWcZOOzoSVkZYA7 lr7sLWsHquJ7e/WKIXkp06i4y6PuHSK6u6bxkJavyioaGIo23FmUFd/Q+ioS9FPw8l 5pqK1mgHqJNVBQ+uzuWyFrMGu+KvsiWuj8+jPZTxIHFNsp6i6KaGzcKtFycwYRqUqE HmRFjSww0oBnPtg38Eur5KTSV4Xj2MhfoAbGbXEgRyZBRD/k+rqimxguZXrFUX/E5B jAuJGJGv/CDVg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chen Ni , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 066/148] drm/tegra: dsi: Add missing check for of_find_device_by_node Date: Sun, 24 Mar 2024 19:48:50 -0400 Message-ID: <20240324235012.1356413-67-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Chen Ni [ Upstream commit afe6fcb9775882230cd29b529203eabd5d2a638d ] Add check for the return value of of_find_device_by_node() and return the error if it fails in order to avoid NULL pointer dereference. Fixes: e94236cde4d5 ("drm/tegra: dsi: Add ganged mode support") Signed-off-by: Chen Ni Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/20231024080738.825553-1= -nichen@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index e2903bf7821b1..70cc960d3ff58 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1452,9 +1452,11 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *= dsi) np =3D of_parse_phandle(dsi->dev->of_node, "nvidia,ganged-mode", 0); if (np) { struct platform_device *gangster =3D of_find_device_by_node(np); + of_node_put(np); + if (!gangster) + return -EPROBE_DEFER; =20 dsi->slave =3D platform_get_drvdata(gangster); - of_node_put(np); =20 if (!dsi->slave) { put_device(&gangster->dev); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 464B922C66B; Sun, 24 Mar 2024 23:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324292; cv=none; b=puw8+IgLeLloLSn7OebjhtgK35p1zGNhz+v97PWYy4k2Qc8/YXFM5WhLJmB05xFQxFq8SpOV9+t4B7I83rYApcAkbrskUw+/y28I+dmGqtI60pADHTUM4FCuj1H4crPfmol6pHDPiiJwV6+j4TErSuykGanl7xNWW175TSG5U5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324292; c=relaxed/simple; bh=G0c+udVpKFOi8AWsLyHdaHk+W6Sar4vDtf+9xm8Am3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dQK6jU8w/f6Waxbdo+W22YuHeqPXJNT+bq+1X6TnsaRVIc31LRdVPe3hF5+iZpNdSv1uFt+qMEBcItDcmi8jNvs1KGuwM5D4fWMuP15ww0xr//Ce+Gd7BOAYvaEs7/V2NW68HfpjrdzXwNt2j/09J9Jy4EWJwB80b7px+Z0IYk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VzlHvUHU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VzlHvUHU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 871DEC433B2; Sun, 24 Mar 2024 23:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324291; bh=G0c+udVpKFOi8AWsLyHdaHk+W6Sar4vDtf+9xm8Am3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VzlHvUHU4dKSgWpp/6v5CHvqJM4OXUV8ebiMb63ua1ApddmN9tN0OeS3JZxHPDb7+ ft12kJW0Z7trBfpQ3TsKtsYwmJ9ja8GL6LrRAF00ueRTrYKZGhF9gI6vre7e0R+CaE vJCxFfV79RCX5vRpuz92QL9WI/izdqxedm3mYUfG45qywe7VE0xyNyExMyl6UHWh2+ sl0nBW7qzxXMQV7Lk8rg9bwU1f6TwIJgwpY3yZngQHjotwg15MA6EkH0pYkmOJ/T2c rXuP/jUc351CH0Kyeo4kHf4I0AaY3v4jYXl+wOY7ACoNNVwoYKR0JRn5Xu18E/6b/x quKmteOK+KLEQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sowjanya Komatineni , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 067/148] gpu: host1x: mipi: Update tegra_mipi_request() to be node based Date: Sun, 24 Mar 2024 19:48:51 -0400 Message-ID: <20240324235012.1356413-68-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sowjanya Komatineni [ Upstream commit 767598d447aa46411289c5808b0e45e20a1823b4 ] Tegra CSI driver need a separate MIPI device for each channel as calibration of corresponding MIPI pads for each channel should happen independently. So, this patch updates tegra_mipi_request() API to add a device_node pointer argument to allow creating mipi device for specific device node rather than a device. Signed-off-by: Sowjanya Komatineni Signed-off-by: Thierry Reding Stable-dep-of: 830c1ded3563 ("drm/tegra: dsi: Fix some error handling paths= in tegra_dsi_probe()") Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/dsi.c | 2 +- drivers/gpu/host1x/mipi.c | 4 ++-- include/linux/host1x.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 70cc960d3ff58..7033ab28f7716 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1543,7 +1543,7 @@ static int tegra_dsi_probe(struct platform_device *pd= ev) if (IS_ERR(dsi->regs)) return PTR_ERR(dsi->regs); =20 - dsi->mipi =3D tegra_mipi_request(&pdev->dev); + dsi->mipi =3D tegra_mipi_request(&pdev->dev, pdev->dev.of_node); if (IS_ERR(dsi->mipi)) return PTR_ERR(dsi->mipi); =20 diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c index e00809d996a29..762d349ad00f1 100644 --- a/drivers/gpu/host1x/mipi.c +++ b/drivers/gpu/host1x/mipi.c @@ -206,9 +206,9 @@ static int tegra_mipi_power_down(struct tegra_mipi *mip= i) return 0; } =20 -struct tegra_mipi_device *tegra_mipi_request(struct device *device) +struct tegra_mipi_device *tegra_mipi_request(struct device *device, + struct device_node *np) { - struct device_node *np =3D device->of_node; struct tegra_mipi_device *dev; struct of_phandle_args args; int err; diff --git a/include/linux/host1x.h b/include/linux/host1x.h index aef6e2f738027..903c0ec204442 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h @@ -327,7 +327,8 @@ int host1x_client_unregister(struct host1x_client *clie= nt); =20 struct tegra_mipi_device; =20 -struct tegra_mipi_device *tegra_mipi_request(struct device *device); +struct tegra_mipi_device *tegra_mipi_request(struct device *device, + struct device_node *np); void tegra_mipi_free(struct tegra_mipi_device *device); int tegra_mipi_enable(struct tegra_mipi_device *device); int tegra_mipi_disable(struct tegra_mipi_device *device); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D55F294E0B; Sun, 24 Mar 2024 23:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324293; cv=none; b=lw0IVc2T5v1K1+zKVcaFx77vZ6OnpNrBmd5tmToZgT8nVCsNcpPWsjn/SfUyhBVr3Cqe7TtJ4uwzlCNEJ9cabAsnACspigYUdnC5Rj7q/jdano5XgmYct2qXS64kOYP29l/btbd6kPRb6ROs/Q/icjdHBRNT2cJJ4wn+FPz0Afc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324293; c=relaxed/simple; bh=jlytCQnOmqtIWrua3+DJqrL72f/zZ/tYkRgyQ7+DaiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SkXu4fISPIIGzo8iEzTT9vEPpXbyppe41K12eTLHV/jYDUDQ+9vzpKTf62B8vYw8D8BCUdax2+fnBeFGcvmO+cpod/i0bAr7KkzI2kq02Fej+d3oH+0huoP6PK50Oza3vOqlqZr8ioOi7j0ti6S/ebGubPC5LfUtWXhnv9mdrnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FK+tQPKs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FK+tQPKs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D8F7C43390; Sun, 24 Mar 2024 23:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324292; bh=jlytCQnOmqtIWrua3+DJqrL72f/zZ/tYkRgyQ7+DaiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FK+tQPKsKD7D+CXdF67tN+LjUnrJ+rz+1/8lBzOzwuqVZCYlWKfXWZAiRMyXfZ9C0 aDFHRplqqoKLYNAs0lV/3A7RMivQW9vUjFmHxygAKTUX0PWwAPr9TjPqL11fyGx2fw AVLbt4+haPCGLzuZNMlH46cCep+KwIAdyyY9ArMkbr+r4EXSNZ0ihWzlQW+41Jc5Au NN1hegginnbCC3W2FDkuk+Gj6no7RjE22zGo4LYn3hfKJqzbXnfbbypndZsUOL0kRK qy3axjMzmXFdVaWPwA7v3zWvtogcD7gOtM5xVl3ZC2b5AaDqKhLWYBjQ/mdBiccGBW 2VsgOKXCn+NBA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Cai Huoqing , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 068/148] drm/tegra: dsi: Make use of the helper function dev_err_probe() Date: Sun, 24 Mar 2024 19:48:52 -0400 Message-ID: <20240324235012.1356413-69-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cai Huoqing [ Upstream commit fc75e4fcbd1e4252a0481ebb23cd4516c127a8e2 ] When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. And using dev_err_probe() can reduce code size, the error value gets printed. Signed-off-by: Cai Huoqing Signed-off-by: Thierry Reding Stable-dep-of: 830c1ded3563 ("drm/tegra: dsi: Fix some error handling paths= in tegra_dsi_probe()") Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/dsi.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 7033ab28f7716..04bf4c89d870e 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1509,28 +1509,24 @@ static int tegra_dsi_probe(struct platform_device *= pdev) } =20 dsi->clk =3D devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dsi->clk)) { - dev_err(&pdev->dev, "cannot get DSI clock\n"); - return PTR_ERR(dsi->clk); - } + if (IS_ERR(dsi->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk), + "cannot get DSI clock\n"); =20 dsi->clk_lp =3D devm_clk_get(&pdev->dev, "lp"); - if (IS_ERR(dsi->clk_lp)) { - dev_err(&pdev->dev, "cannot get low-power clock\n"); - return PTR_ERR(dsi->clk_lp); - } + if (IS_ERR(dsi->clk_lp)) + return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_lp), + "cannot get low-power clock\n"); =20 dsi->clk_parent =3D devm_clk_get(&pdev->dev, "parent"); - if (IS_ERR(dsi->clk_parent)) { - dev_err(&pdev->dev, "cannot get parent clock\n"); - return PTR_ERR(dsi->clk_parent); - } + if (IS_ERR(dsi->clk_parent)) + return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_parent), + "cannot get parent clock\n"); =20 dsi->vdd =3D devm_regulator_get(&pdev->dev, "avdd-dsi-csi"); - if (IS_ERR(dsi->vdd)) { - dev_err(&pdev->dev, "cannot get VDD supply\n"); - return PTR_ERR(dsi->vdd); - } + if (IS_ERR(dsi->vdd)) + return dev_err_probe(&pdev->dev, PTR_ERR(dsi->vdd), + "cannot get VDD supply\n"); =20 err =3D tegra_dsi_setup_clocks(dsi); if (err < 0) { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3860F294E16; Sun, 24 Mar 2024 23:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324295; cv=none; b=ZmzesFU6Qx6nKaq4c5cwLx5Uo1NX7D7BULrnLooE9nCdPEYdvoae+BdHhZOWTFG2823Xw+xupBlgQWqqju+Yz9VWyCxSLvut16WP+dUrCWvPdGwTvQXLTUCUySgam5a32pNYJlugzPyw3EqGvhac3jZHf7+3YFnat9hpMTWuMjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324295; c=relaxed/simple; bh=GGdJXw7IPvTlgH5M7TjKCj6PgFdkhX0+h/5VPGMIh/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OpWuHYr/zV2d0fLBjAXkwtwjdvKRpbmCvZYx+ayP1EMFuaoUVK5SVe/pwI46IBbbUldmGYtE5vV9XbVmQhc7kse0tpV3JW01Tf+G0T71dLXHke/FMUQNogsgHUVpxRsiygM6RKTh7Fyc4HiD5F9snbWNPvKR9ZEwuzKjwODtF7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WyjVjJ62; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WyjVjJ62" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AA6DC433C7; Sun, 24 Mar 2024 23:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324294; bh=GGdJXw7IPvTlgH5M7TjKCj6PgFdkhX0+h/5VPGMIh/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WyjVjJ62s/Rf//7yE5FDM/a6a0BT9qdOLfISwzxmC5rCaEYFpz8eq8dFFMAlv/GJ4 rnrIR2q4zVmvnFj3I0EEGON4cCNHeADI+xQfQkMlHN7uV044xCt55enPeIJhleRdb+ itfTSA27YYipVSJMkFpSzSzG7CXY8xoTs/tmmCwZnE/cKi7smUkmQkWyihIL5xQwmq Dnz5TZWraoKIWS/QzGHbI+DXZ28zlXrFkUKVcv9C6DHCE8n5HV2Gx/YuDZ8i/Y2m3w NRGxmuNzijYzuWSNmBli91jeJ89C9WUcRPKbSGERcm3l2FCKoBPhVgpUPoWo5nxpsP OmDsAeCRgJ6eg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 069/148] drm/tegra: dsi: Fix some error handling paths in tegra_dsi_probe() Date: Sun, 24 Mar 2024 19:48:53 -0400 Message-ID: <20240324235012.1356413-70-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 830c1ded356369cd1303e8bb87ce3fea6e744de8 ] If an error occurs after calling tegra_output_probe(), tegra_output_remove() should be called as already done in the remove function. Fixes: dec727399a4b ("drm/tegra: Add DSI support") Signed-off-by: Christophe JAILLET Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/16820073278d031f6c474a0= 8d5f22a255158585e.1693667005.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/dsi.c | 54 ++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 04bf4c89d870e..44bf5a731ba72 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1504,44 +1504,58 @@ static int tegra_dsi_probe(struct platform_device *= pdev) =20 if (!pdev->dev.pm_domain) { dsi->rst =3D devm_reset_control_get(&pdev->dev, "dsi"); - if (IS_ERR(dsi->rst)) - return PTR_ERR(dsi->rst); + if (IS_ERR(dsi->rst)) { + err =3D PTR_ERR(dsi->rst); + goto remove; + } } =20 dsi->clk =3D devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dsi->clk)) - return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk), - "cannot get DSI clock\n"); + if (IS_ERR(dsi->clk)) { + err =3D dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk), + "cannot get DSI clock\n"); + goto remove; + } =20 dsi->clk_lp =3D devm_clk_get(&pdev->dev, "lp"); - if (IS_ERR(dsi->clk_lp)) - return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_lp), - "cannot get low-power clock\n"); + if (IS_ERR(dsi->clk_lp)) { + err =3D dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_lp), + "cannot get low-power clock\n"); + goto remove; + } =20 dsi->clk_parent =3D devm_clk_get(&pdev->dev, "parent"); - if (IS_ERR(dsi->clk_parent)) - return dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_parent), - "cannot get parent clock\n"); + if (IS_ERR(dsi->clk_parent)) { + err =3D dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_parent), + "cannot get parent clock\n"); + goto remove; + } =20 dsi->vdd =3D devm_regulator_get(&pdev->dev, "avdd-dsi-csi"); - if (IS_ERR(dsi->vdd)) - return dev_err_probe(&pdev->dev, PTR_ERR(dsi->vdd), - "cannot get VDD supply\n"); + if (IS_ERR(dsi->vdd)) { + err =3D dev_err_probe(&pdev->dev, PTR_ERR(dsi->vdd), + "cannot get VDD supply\n"); + goto remove; + } =20 err =3D tegra_dsi_setup_clocks(dsi); if (err < 0) { dev_err(&pdev->dev, "cannot setup clocks\n"); - return err; + goto remove; } =20 regs =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); dsi->regs =3D devm_ioremap_resource(&pdev->dev, regs); - if (IS_ERR(dsi->regs)) - return PTR_ERR(dsi->regs); + if (IS_ERR(dsi->regs)) { + err =3D PTR_ERR(dsi->regs); + goto remove; + } =20 dsi->mipi =3D tegra_mipi_request(&pdev->dev, pdev->dev.of_node); - if (IS_ERR(dsi->mipi)) - return PTR_ERR(dsi->mipi); + if (IS_ERR(dsi->mipi)) { + err =3D PTR_ERR(dsi->mipi); + goto remove; + } =20 dsi->host.ops =3D &tegra_dsi_host_ops; dsi->host.dev =3D &pdev->dev; @@ -1572,6 +1586,8 @@ static int tegra_dsi_probe(struct platform_device *pd= ev) mipi_dsi_host_unregister(&dsi->host); mipi_free: tegra_mipi_free(dsi->mipi); +remove: + tegra_output_remove(&dsi->output); return err; } =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69D0C294E07; Sun, 24 Mar 2024 23:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324295; cv=none; b=EMORG7CZamd+3v8lAJSJ9L7yMnD5e2INQ7ik0BPsUitbNgqJ/nd/7870dz23LTd+4ws5colaL/3SUqHtl2Qh0briVapFQmv44dBm7aPVzm+aRUwDX9Y8bpXA24W0nhRwC/OoUBw3K/l/gaCtXd18Bt9X8hkwngOlrr3nGUblrA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324295; c=relaxed/simple; bh=nwY4BXfYiszV2ZimaeSXexafpBAW7FnAPleR3Q3aaCo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QcZ0OC2pZXVPxx7d5Y3wEZpD7XjtqPxNuDgKbREmBRjKiFgt6C3f5VGitTfXlupRYHUU5sS21q+XOuRQDWD/6lLiWc2U3k/EZzVbJ2jy6og1yhEjjvZcFj8jJ8P4aejNGB3kwG/Lwv+obsFoSCBtMziNSu+M+kOZs1JPsEVQwjU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pankwxRA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pankwxRA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B4DFC43390; Sun, 24 Mar 2024 23:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324295; bh=nwY4BXfYiszV2ZimaeSXexafpBAW7FnAPleR3Q3aaCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pankwxRAYKDlypBOZn7Gr+wl1DcIzOETU8pb+AKNbJlhv9gtwEiSBZYExr2eunBCP tKNrYct9WAunuawMjLeAloOTb9RLA2Ex7aXN/SDdWzlNalfsI3D9n1fV2NqikMTzWN E5pFzVwG3vek1BfHfQNkotBocODHgGZBQXKFLS08HjN39q+KxgAKMrt/EeZndxDkjA deuScqlfTNKcQ5iGgdRREq/7YJikFkqRKW+175RZAR/qfiezBCXifEOQNF5fJWaiYg Y7fkQIlwxH3VotzshPX+GTRTtZvsqNWX8I5uhcWV5yeBZunoTgEhXc/Q9lfULyggxF /vft3rJbgzzOQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 070/148] drm/tegra: dsi: Fix missing pm_runtime_disable() in the error handling path of tegra_dsi_probe() Date: Sun, 24 Mar 2024 19:48:54 -0400 Message-ID: <20240324235012.1356413-71-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 5286a9fc280c45b6b307ee1b07f7a997e042252c ] If an error occurs after calling pm_runtime_enable(), pm_runtime_disable() should be called as already done in the remove function. Fixes: ef8187d75265 ("drm/tegra: dsi: Implement runtime PM") Signed-off-by: Christophe JAILLET Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/ee4a15c9cd4b574a55cd67c= 30d2411239ba2cee9.1693667005.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 44bf5a731ba72..fb7b000d4d341 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -1583,6 +1583,7 @@ static int tegra_dsi_probe(struct platform_device *pd= ev) return 0; =20 unregister: + pm_runtime_disable(&pdev->dev); mipi_dsi_host_unregister(&dsi->host); mipi_free: tegra_mipi_free(dsi->mipi); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4BAC294E22; Sun, 24 Mar 2024 23:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324296; cv=none; b=Q8AHAgJw2YSQpSoqxcaMDy7THcLr9jR9mYGzrQTrBjvAKua1raO2zgHrc59pq9cGeRtr4QmnWpp5JgywDd1XOGNLg8LC5bE760BDuLPpXzTcGDknwJQyv3DQuXJjM/Ubj/lWi44m7463LffRvUFjgZt+7RvBaC7irfUUnXoQvZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324296; c=relaxed/simple; bh=kWGuqHl5CC1lHEqPCwaKWVxeC8jkTmBoQhuiTXg7F9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8G6HKH6qxLzEb+QTtIfkHcYK2lBMSejAsXXhPaIFuOIItUaUrgjhpYBlkLyGAqOBsqUWePj3R4Gzw82saATUNUbhMahvKdQHfdoZVxcn3jnbLipYK61frYCdfw0VMqRXHRyk6BjH6om5AldJVl1C/YCIRZ1mLU085If5nK50xg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=chaNTRUL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="chaNTRUL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 907E3C433F1; Sun, 24 Mar 2024 23:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324296; bh=kWGuqHl5CC1lHEqPCwaKWVxeC8jkTmBoQhuiTXg7F9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=chaNTRUL43hmwuWPrF/nhz5WsX6Jvb+HvCCMYfds1lvxy8Y0OeS9Gggu2ngUCJrEv e0gWRhu1D4gMjb9r5DNKWoKVcfnoAQm7eLy9NMoSkYUlF6NYIj0XLF4E0AXAdS6co1 kxg5aOe9j13q/QkwfnYI5EYYjezugNie/prQzV2Wl3A/31CABja+XByyLWIn8o2Wip uGxTFupHJPX2KtkZCxXdduiPXqTVXnl2d4bM2D4gWH+23yjGm7tHq4124l4FI0IYhC a7W97JllZr6aSr5Kdw7z/G9ohrXDZ17UyaYaiQdkvYdmRmT2jz37axZop/zlUbWAPl Uevh2ADPytSYg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alex Bee , Zheng Yang , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.19 071/148] drm/rockchip: inno_hdmi: Fix video timing Date: Sun, 24 Mar 2024 19:48:55 -0400 Message-ID: <20240324235012.1356413-72-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alex Bee [ Upstream commit 47a145c03484d33e65d773169d5ca1b9fe2a492e ] The controller wants the difference between *total and *sync_start in the HDMI_VIDEO_EXT_*DELAY registers. Otherwise the signal is very unstable for certain non-VIC modes. See downstream commit [0]. [0] https://github.com/rockchip-linux/kernel/commit/8eb559f2502c Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support") Co-developed-by: Zheng Yang Signed-off-by: Zheng Yang Signed-off-by: Alex Bee Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20231222174220.55249-4-= knaerzche@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/rockchip/inno_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchi= p/inno_hdmi.c index 1c02b3e61299c..229a1c908ad02 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -408,7 +408,7 @@ static int inno_hdmi_config_video_timing(struct inno_hd= mi *hdmi, hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HBLANK_L, value & 0xFF); hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HBLANK_H, (value >> 8) & 0xFF); =20 - value =3D mode->hsync_start - mode->hdisplay; + value =3D mode->htotal - mode->hsync_start; hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDELAY_L, value & 0xFF); hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDELAY_H, (value >> 8) & 0xFF); =20 @@ -423,7 +423,7 @@ static int inno_hdmi_config_video_timing(struct inno_hd= mi *hdmi, value =3D mode->vtotal - mode->vdisplay; hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VBLANK, value & 0xFF); =20 - value =3D mode->vsync_start - mode->vdisplay; + value =3D mode->vtotal - mode->vsync_start; hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VDELAY, value & 0xFF); =20 value =3D mode->vsync_end - mode->vsync_start; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61A1E1327E4; Sun, 24 Mar 2024 23:51:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324299; cv=none; b=CXsET9mSlDNvGrqkFAtLcLqAGaX7KoDSSCJUxJQlU0EjD9xQupDNoFmdx05ZoF0qV3xJq/KWCveSg6nH9gXD0l0XSlEFs80oQCwCGWHvHEQ+sotwM5qXwQADPdJsNVuk2A6D2plMjW8Et9JBbGNa/NtXP/pQlSAK5NKQA/X6IVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324299; c=relaxed/simple; bh=gbU2EowSPlHE2x6WXeXSsOfbfUQE1IU/R3YYLu6N2co=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WHAbUBpm9P9Ui00eolt4XS6RtLh5sKDN1Pnl3zpMkibCEc6zi3HQb/WRSpZduqvUyWc70IgHZcLRUoRAUiuZzpIZdUM6TYWmPv2LgYb/jvG6yM61fZz2hGDkQx/6v3PS7TZscL0IAXXmFbgkyj2GzjoRvwO7Gjj6QbuD1LsFlDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EJfrUx2O; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EJfrUx2O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 971DAC43394; Sun, 24 Mar 2024 23:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324298; bh=gbU2EowSPlHE2x6WXeXSsOfbfUQE1IU/R3YYLu6N2co=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EJfrUx2OXY0uZ6N15hprJsheyIFX+cBtrhw1RlQsfHPqPWL37uNuYJPWWzQYMTk0c Sc9bzffMlLH00EDngAaFSbGtDQ4sD2EkyfthDWl/UciLAw5XZZwWnJwVMBGsQ6lH4R 1Ed3Ef6MhBypfdOA29a18klLsC+/2MgrPllW+zjJbTPUmN+y3K1cphM92Q5iMZqLu+ oxzejZ0LFJQG2Al4e0cwyk6ssv6ICDBMZhrzopRg1rTbo/MtdFpr3HD1g2YJS509Kj jk+AI/uOwUr+aLlrYRpNKusaLXWnUeLVOk/wz/hjBxVU83XcmQaZ9ggFJ3C7DqA2v+ FdIRxxkGqpwuw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Harry Wentland , Simon Ser , Melissa Wen , Melissa Wen , Sasha Levin Subject: [PATCH 4.19 072/148] drm: Don't treat 0 as -1 in drm_fixp2int_ceil Date: Sun, 24 Mar 2024 19:48:56 -0400 Message-ID: <20240324235012.1356413-73-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Harry Wentland [ Upstream commit cf8837d7204481026335461629b84ac7f4538fa5 ] Unit testing this in VKMS shows that passing 0 into this function returns -1, which is highly counter- intuitive. Fix it by checking whether the input is >=3D 0 instead of > 0. Fixes: 64566b5e767f ("drm: Add drm_fixp_from_fraction and drm_fixp2int_ceil= ") Signed-off-by: Harry Wentland Reviewed-by: Simon Ser Reviewed-by: Melissa Wen Signed-off-by: Melissa Wen Link: https://patchwork.freedesktop.org/patch/msgid/20231108163647.106853-2= -harry.wentland@amd.com Signed-off-by: Sasha Levin --- include/drm/drm_fixed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index 553210c02ee0f..627efa56e59fb 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h @@ -88,7 +88,7 @@ static inline int drm_fixp2int(s64 a) =20 static inline int drm_fixp2int_ceil(s64 a) { - if (a > 0) + if (a >=3D 0) return drm_fixp2int(a + DRM_FIXED_ALMOST_ONE); else return drm_fixp2int(a - DRM_FIXED_ALMOST_ONE); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3AA0294E3A; Sun, 24 Mar 2024 23:51:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324300; cv=none; b=NXn+4q3yqUH2CYbhS9ypzLGbIRXVzGQXRuXxTr15nrbrrOPco2tZt08dXfAmTBJIuObb4jpAwhkzgSLegDQeHlTmh+1+svussXoimsADP8+fowMtKzIdYGP3qCnEGUgcwr6coMXkLsYNsQTcuSkTft7IzQOa2XdJ3QDwSQOS/F0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324300; c=relaxed/simple; bh=qHUqDEVnUyC8jvQK3TsQQlVfLcutvmYMKDDZVZDmIdU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pQ0Q4bEoz5T3lWKvHtI7GNWN9uSPpl9eIFy9/M7g0JeAhHjdVENpdFEo2iIeNz16SgNgPfP3BMoCqXfRutx5XUC73fEqX0SlrfK8BwJ6cWcN4qiLWtdPl28sQWYHtNMp9rLlYTzbmmcvVmUD13sBDMjB7RmTn5DH1Hd57d4giuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dg0lzkn3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dg0lzkn3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 873A2C433F1; Sun, 24 Mar 2024 23:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324299; bh=qHUqDEVnUyC8jvQK3TsQQlVfLcutvmYMKDDZVZDmIdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dg0lzkn3CRvy1E3MOrUkWdu//083Rj4HvR5UQxp56c6oBQGzeenvGW5+GDWJKrZXG U4eqSZJeayvXQ02HZLCtb+CLGFA0AEDKs/p+pIEipUW9qDO645MdWlXBWcR5hrNjrx MICRK/Acf07B9T/Z9CFw3NMCe4X/1GcIK5yYRAXI/7LRIV4Tv7c/wfp5mlWmnFe/Yd k6fh1O8Q0Jmj2yTVUdzAcnReASr7CECeAgYnZ+lJRxuFvio583XlLoYhWd4lXjI42m MK4iKO4vvm1/qxIQPgWfKveKN08Vtv9f+E+yEPv90oot5qo4rvL6ilaACglb1tTlVl pCntXFdGFgGiw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Quentin Schulz , Quentin Schulz , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.19 073/148] drm/rockchip: lvds: do not overwrite error code Date: Sun, 24 Mar 2024 19:48:57 -0400 Message-ID: <20240324235012.1356413-74-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Quentin Schulz [ Upstream commit 79b09453c4e369ca81cfb670d0136d089e3b92f0 ] ret variable stores the return value of drm_of_find_panel_or_bridge which can return error codes different from EPROBE_DEFER. Therefore, let's just return that error code instead of forcing it to EPROBE_DEFER. Fixes: 34cc0aa25456 ("drm/rockchip: Add support for Rockchip Soc LVDS") Cc: Quentin Schulz Signed-off-by: Quentin Schulz Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20231120-rk-lvds-defer-= msg-v2-1-9c59a5779cf9@theobroma-systems.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/rockchip/rockchip_lvds.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/roc= kchip/rockchip_lvds.c index 456bd9f13baef..215885c780759 100644 --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c @@ -374,7 +374,6 @@ static int rockchip_lvds_bind(struct device *dev, struc= t device *master, goto err_put_port; } else if (ret) { DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n"); - ret =3D -EPROBE_DEFER; goto err_put_port; } if (lvds->panel) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EC3422E7E6; Sun, 24 Mar 2024 23:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324302; cv=none; b=RSpBImAslAMk/jStax10anGeeeY0/m0MCc00Rh9cebkbHVVIVSbVwb+cYe4z9Eugm2LMkBjSdKoTSSaOIapyj3Ga654jVQYY78+unpMH0TqpJGjD7rwPb3NxcYXq6XrJ9MYVeMPOK1sL3ZfjxR7yebFlHkiKXv0EKZO4EcZrits= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324302; c=relaxed/simple; bh=b1ImpgjqeU3iPayTihEvHsUtn/HigkooHHkmMme9Wzo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JJi9eLsCAr6UvqWZ6Op/5gCPgMC8EmponONlGk6HEpB/uEjnHSh8uZwqRGcMEcOToOB/udRynIG7HGl/Ji73fu2c0cc+kAgfNOzFKmXccNGAkHbpWHq+OKy0+uoAwAOBkb7Lq3qJ2zVYo9wBH9CbTExKy3MLkIVUm8QWcTUykd8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qpqjwLpb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qpqjwLpb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D61AFC43390; Sun, 24 Mar 2024 23:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324300; bh=b1ImpgjqeU3iPayTihEvHsUtn/HigkooHHkmMme9Wzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qpqjwLpbsMnOQ0YugrrqOB1AfQjeRgTzrT6+/OX3VltmhqoDb0NmCfs+tnqPQk+Vz gJ73BUJpaig5BvjpWrMqtlMMqFKN363lwi7teND5e9tzfW2f6mFGDsZalZJzQ89ScM cxwsSm9jUB1NviF9EismtybaJIwQpdN2mE5C0ueEJaxdhcR2kciNumeY3Kdj2dVNO7 i+2+BC91ZkEpbhwXIEC56NrQPH4w3v5SPdNtuSUYaFDjiiRKySwCJCXEOTBCUHAa9O O7jqTr/LneenG6/VHJSbdIVFrzc7lEPUu3/KzoCTUZc0rI/0eCC6w/l+EeCsaKXsbY 00IEGLP3eG3bQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Quentin Schulz , Quentin Schulz , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.19 074/148] drm/rockchip: lvds: do not print scary message when probing defer Date: Sun, 24 Mar 2024 19:48:58 -0400 Message-ID: <20240324235012.1356413-75-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Quentin Schulz [ Upstream commit 52d11c863ac92e36a0365249f7f6d27ac48c78bc ] This scary message can misled the user into thinking something bad has happened and needs to be fixed, however it could simply be part of a normal boot process where EPROBE_DEFER is taken into account. Therefore, let's use dev_err_probe so that this message doesn't get shown (by default) when the return code is EPROBE_DEFER. Fixes: 34cc0aa25456 ("drm/rockchip: Add support for Rockchip Soc LVDS") Cc: Quentin Schulz Signed-off-by: Quentin Schulz Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20231120-rk-lvds-defer-= msg-v2-2-9c59a5779cf9@theobroma-systems.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/rockchip/rockchip_lvds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/roc= kchip/rockchip_lvds.c index 215885c780759..39a17c46dbf11 100644 --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c @@ -373,7 +373,7 @@ static int rockchip_lvds_bind(struct device *dev, struc= t device *master, ret =3D -EINVAL; goto err_put_port; } else if (ret) { - DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n"); + dev_err_probe(dev, ret, "failed to find panel and bridge node\n"); goto err_put_port; } if (lvds->panel) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC72A22E7EE; Sun, 24 Mar 2024 23:51:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324302; cv=none; b=VaKWmHC2K2KsJgEdqY240mNCmqJ9KF+f4Cpn8+c/637LemAs3xYEmzaW6SgiCQU69upkT/Cv4VgW7Tpf77BdZZn62AdLgN1n7VKlrSZDm+j4eZjx2K7DciJR2+G/UO5aBrI3fR47tm1BhNZNgM658EFLnRlRMna/EWPl4OYyFR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324302; c=relaxed/simple; bh=C+/70BqqoyuoI5rGiAd0yfx6Jfh9xe8UtZavuyGWL7E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aGlkpncpAmRySBmVRKLD8faMFb1CocjhUDE5PkC5DVk9nbrYPB8USPUJ3cnYWEj33xF9IgshVvg6ajdSJc0QgmBv20oY+4kIMNBwVgvv/yT/uRjdOmdbd9KrD4q97BrKagIpG+Q+LxVdUuI+3hBE5/mjZdyWT9PEOHN6Y6iPnAY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X4kly8S/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X4kly8S/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAA5CC433C7; Sun, 24 Mar 2024 23:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324301; bh=C+/70BqqoyuoI5rGiAd0yfx6Jfh9xe8UtZavuyGWL7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4kly8S/Psnianm9om9dt9zjWpNyxNc9dRCpobL67lSivDB4daq2uAdkaE613sXx5 53uXUw1ytRJqqkj9SZaB0wl9LhdDpddlVxSkFLLrKooQY5elfh/1n6VaWGWVxYpt+O 5FoV6Z1UVkxVghIContedz2XKxCGwxAIlAbKj3Ew7gq3mloNFIpcDUBzzGu1QfTr/Y rFDqeRtP762lzHlp2yKr09OMtoD/iDddq6Ylxe25Xc+j3Z7zBZJnj1kEEoGVpE8SfN 4pE62tiFixsFNzaLD9pXvvyKC8ToCsVMh37hJ/8HTEtW+qgKygkWV0hiKoRcSRimFL bgoqA7O9Xfu/Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexander Stein , Robert Foss , Sasha Levin Subject: [PATCH 4.19 075/148] media: tc358743: register v4l2 async device only after successful setup Date: Sun, 24 Mar 2024 19:48:59 -0400 Message-ID: <20240324235012.1356413-76-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 87399f1ff92203d65f1febf5919429f4bb613a02 ] Ensure the device has been setup correctly before registering the v4l2 async device, thus allowing userspace to access. Signed-off-by: Alexander Stein Reviewed-by: Robert Foss Fixes: 4c5211a10039 ("[media] tc358743: register v4l2 asynchronous subdevic= e") Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20240110090111.458115-1= -alexander.stein@ew.tq-group.com Signed-off-by: Sasha Levin --- drivers/media/i2c/tc358743.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 079b8db4bc48b..2650be358b027 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -2107,9 +2107,6 @@ static int tc358743_probe(struct i2c_client *client, state->mbus_fmt_code =3D MEDIA_BUS_FMT_RGB888_1X24; =20 sd->dev =3D &client->dev; - err =3D v4l2_async_register_subdev(sd); - if (err < 0) - goto err_hdl; =20 mutex_init(&state->confctl_mutex); =20 @@ -2167,6 +2164,10 @@ static int tc358743_probe(struct i2c_client *client, if (err) goto err_work_queues; =20 + err =3D v4l2_async_register_subdev(sd); + if (err < 0) + goto err_work_queues; + v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, client->addr << 1, client->adapter->name); =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CFC322E7F3; Sun, 24 Mar 2024 23:51:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324303; cv=none; b=poCgRhD2Dobz9/YF932BQaljxbVKGU+hDe6u7mtbbuzzbQLSq1FoxPfniDa6pbpsKpAmxTG+bgEEktmIOSERtkIq89qTqKh5YXZaEfmQBpeRtq4BSW0AUJcglG2CdWV0VppimX0EXa5vbP8I3pebyF8i0DphLMQyKGLWdFCezKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324303; c=relaxed/simple; bh=6gbpBif9goTkU8krONbkMQJBzcRlkeg/lr9CK6CErfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IDU+xAiFA7SuCUKI/1xyorLgcLWynW6g5+OT4bx0lKE4QAFCgIYKx8+6PCugnhe7buUL8/+MEnkRiUX5pYj9d6DYY3ySxw43ec0oh/eBL8edwasWfQaVhbLUUKps8N2L6e5XXJqdTQApgTqWfXqFOMhawwlNeEtZfHnnkvRV87c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NmAUavp5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NmAUavp5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD52AC433F1; Sun, 24 Mar 2024 23:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324303; bh=6gbpBif9goTkU8krONbkMQJBzcRlkeg/lr9CK6CErfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NmAUavp5225H+Qc6XrjoqP43EfTkxZHXUgs/aGeTwufKoI6/stDrOLJh4DbbjmHLg u7Xjee+O11oJ0Kb5Dn09TJ86OxUgMa/QgszFBKuc6TcKX3UQIjBWg4r+XJJWAW5OpT rqGoyL++FjoSuFanD/YvIH4TqqQIMv1z1r574pLmkMx4iHG/2uoSc/ztQO9f4pLA+f DvGKvs2QoXaCXqGssWFNP7+nQ+C0hNFtp5J3qp3CrL5aBmo4ac29rj10xdVwquYWEI fUIvqvRHijfjeU1GhqwRJn9RhppkyilrPc/pCFpwDmcTmZvidRPmlr8Vx51PG3O1ud rq/2U+SlKlKOg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Jihong , Arnaldo Carvalho de Melo , Ian Rogers , Namhyung Kim , Sasha Levin Subject: [PATCH 4.19 076/148] perf evsel: Fix duplicate initialization of data->id in evsel__parse_sample() Date: Sun, 24 Mar 2024 19:49:00 -0400 Message-ID: <20240324235012.1356413-77-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yang Jihong [ Upstream commit 4962aec0d684c8edb14574ccd0da53e4926ff834 ] data->id has been initialized at line 2362, remove duplicate initialization. Fixes: 3ad31d8a0df2 ("perf evsel: Centralize perf_sample initialization") Signed-off-by: Yang Jihong Reviewed-by: Arnaldo Carvalho de Melo Reviewed-by: Ian Rogers Signed-off-by: Namhyung Kim Link: https://lore.kernel.org/r/20240127025756.4041808-1-yangjihong1@huawei= .com Signed-off-by: Sasha Levin --- tools/perf/util/evsel.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 11a2aa80802d5..0644ae23122cd 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -2116,7 +2116,6 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel= , union perf_event *event, data->period =3D evsel->attr.sample_period; data->cpumode =3D event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; data->misc =3D event->header.misc; - data->id =3D -1ULL; data->data_src =3D PERF_MEM_DATA_SRC_NONE; =20 if (event->header.type !=3D PERF_RECORD_SAMPLE) { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 243BF22E803; Sun, 24 Mar 2024 23:51:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324305; cv=none; b=tWe9/6sZj7gxl4G0rAeFRHJbbJVNaCuxrlHc+ReVKyncfsdfDEqCwLiCWyDYfHfH3S1BuZnbxiu7Fpb8HDO6UtNWyAjWYhmCEjomfJykAybanZSihl2fUCvoPbkBzO2G25A1oi8OBb8dXWrL0rvuyGltxgC39zOKRLJHatsrs8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324305; c=relaxed/simple; bh=8klRyTWkxBJY9mtFt54/MDexI3MPHXzw9//0eOHJF/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cxTJR6GW1zbPmCVjk8pFbTKFwm+VaGmI3wgdtclc2r3XqKEYBrpJ002Cl8FVEd6iDXlQWYYLY1EVxHzlJ4a6a9WBwWulbHY3jVMeY5wksIdDssLcg9A4TPFExRFhyNJYFnZDITkc6k1EEQ/F2f+Wvukvi/E97PdAwlhxrwW+Maw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ng7x8F+s; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ng7x8F+s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52B6AC433C7; Sun, 24 Mar 2024 23:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324305; bh=8klRyTWkxBJY9mtFt54/MDexI3MPHXzw9//0eOHJF/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ng7x8F+sRU4TYnf1Q/wWeOa+DoBlyxWb6tC28+6JJ4lcQFey68wsDN1D7iuZIs2wN 5xAcZcWGMIBZAWBtt/Y8pxvP2/IrYDNhok3u3K0bSBVCav+DPEHpvWyO1871yOdyLD laR4Oikm1P04oUeim502HpvR98QkAnI9m0eynSVtoba6qsY5Hd6pjasy7yGo1TJjS6 t+CvvDTmEdrEsjJ2eQs5eoIsfZLRVK+v254V+XoICbhSHvm8fw5az0ZKh/l7KkeUFP B7fAUaLS7HvZLhmYbg459EJbk6sGjznAXXwAfAbjPQFlqSFj5TjuA8b+kcgfkDg9uz 2iXdF9mVnI3lQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.19 077/148] ABI: sysfs-bus-pci-devices-aer_stats uses an invalid tag Date: Sun, 24 Mar 2024 19:49:01 -0400 Message-ID: <20240324235012.1356413-78-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mauro Carvalho Chehab [ Upstream commit abf313b5a8b72302062dd407ed7e470d67d389bb ] According with Documentation/ABI/, the right tag to describe an ABI symbol is "What:", and not "Where:". Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 0e7d29a39a54 ("PCI/AER: Fix rootport attribute paths in ABI = docs") Signed-off-by: Sasha Levin --- .../ABI/testing/sysfs-bus-pci-devices-aer_stats | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats b/Do= cumentation/ABI/testing/sysfs-bus-pci-devices-aer_stats index 4b0318c99507f..ff229d71961c3 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats @@ -9,7 +9,7 @@ errors may be "seen" / reported by the link partner and not= the problematic endpoint itself (which may report all counters as 0 as it never saw any problems). =20 -Where: /sys/bus/pci/devices//aer_dev_correctable +What: /sys/bus/pci/devices//aer_dev_correctable Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com @@ -31,7 +31,7 @@ Header Log Overflow 0 TOTAL_ERR_COR 2 ------------------------------------------------------------------------- =20 -Where: /sys/bus/pci/devices//aer_dev_fatal +What: /sys/bus/pci/devices//aer_dev_fatal Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com @@ -62,7 +62,7 @@ TLP Prefix Blocked Error 0 TOTAL_ERR_FATAL 0 ------------------------------------------------------------------------- =20 -Where: /sys/bus/pci/devices//aer_dev_nonfatal +What: /sys/bus/pci/devices//aer_dev_nonfatal Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com @@ -103,19 +103,19 @@ collectors) that are AER capable. These indicate the = number of error messages as device, so these counters include them and are thus cumulative of all the = error messages on the PCI hierarchy originating at that root port. =20 -Where: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_cor +What: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_cor Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com Description: Total number of ERR_COR messages reported to rootport. =20 -Where: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_fat= al +What: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_fatal Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com Description: Total number of ERR_FATAL messages reported to rootport. =20 -Where: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_non= fatal +What: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_nonf= atal Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2156122E80E; Sun, 24 Mar 2024 23:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324306; cv=none; b=WBdZGU26pAJUmsQYHsfrD9tSRlrYYd9DVZjAo+gS4XMLVKKYU4CNRUhUlDcWhrwhVfzSsFHcQlQFqs8sZ/FZh9mq/styUWjX2F0Ui7ydl1ozBovBHgpvw0jTo3hmKU6Br7mmUJsSPAKm0RkirGNEZZNUj5qIT9Y05riOVuMsVJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324306; c=relaxed/simple; bh=UqehTMGg7Fn+zZSiEgY3XgpNnzC1QL9aW+I7SEnJRHo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nOdxGLikbf2kRsjJ6JKL24oWswtaU6i2UTB7EFpFatgzgt7n4sMEGRzSK1M+GkrAZGCb9XebWYNhzXOwmLzvM91x4KoCuoVS537s8R04arHcQcOcwcrIhYtJSUwhO5EWgvA0RL5mZi5Ic2FDo/HTItV+Pm19EgzX8eH8WxWJFjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SzF9qJY/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SzF9qJY/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 474F8C43399; Sun, 24 Mar 2024 23:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324306; bh=UqehTMGg7Fn+zZSiEgY3XgpNnzC1QL9aW+I7SEnJRHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SzF9qJY/ugHK/bQy+4hVktAiVNM6neb7H0CiFwKw//GA6EnU3NTqa5U1TFW9tayke IjsyuFYq3H+OGBYbfX+dd56jlapeQNY6SDyEPsLgToilsJrzsgue2Q+PxTuYrAbmgm qxxw0gsP+fkqS9TbUkKE/NXuum20kb5nAiaqD00SFwCujCUkSr/94lxlHKVviUShmW 317ug93vWTLnHtzYsjKVJ1grCVYmX14jVgpQkdjssHo2T+fXJVGWA6Sb35pl6AznrL wv5EsPzocYhnAYylx82IseAL44lbS+yxrona2QsJ12bBe0VMJJOTqrs6RIvlM3F3rF 0RwEI3480Q2vA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johan Hovold , Bjorn Helgaas , Sasha Levin Subject: [PATCH 4.19 078/148] PCI/AER: Fix rootport attribute paths in ABI docs Date: Sun, 24 Mar 2024 19:49:02 -0400 Message-ID: <20240324235012.1356413-79-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 0e7d29a39a546161ea3a49e8e282a43212d7ff68 ] The 'aer_stats' directory never made it into the sixth and final revision of the series adding the sysfs AER attributes. Link: https://lore.kernel.org/r/20240202131635.11405-2-johan+linaro@kernel.= org Link: https://lore.kernel.org/lkml/20180621184822.GB14136@bhelgaas-glaptop.= roam.corp.google.com/ Fixes: 12833017e581 ("PCI/AER: Add sysfs attributes for rootport cumulative= stats") Signed-off-by: Johan Hovold Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats b/Do= cumentation/ABI/testing/sysfs-bus-pci-devices-aer_stats index ff229d71961c3..afe7bdf4f9ad0 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats @@ -103,19 +103,19 @@ collectors) that are AER capable. These indicate the = number of error messages as device, so these counters include them and are thus cumulative of all the = error messages on the PCI hierarchy originating at that root port. =20 -What: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_cor +What: /sys/bus/pci/devices//aer_rootport_total_err_cor Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com Description: Total number of ERR_COR messages reported to rootport. =20 -What: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_fatal +What: /sys/bus/pci/devices//aer_rootport_total_err_fatal Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com Description: Total number of ERR_FATAL messages reported to rootport. =20 -What: /sys/bus/pci/devices//aer_stats/aer_rootport_total_err_nonf= atal +What: /sys/bus/pci/devices//aer_rootport_total_err_nonfatal Date: July 2018 Kernel Version: 4.19.0 Contact: linux-pci@vger.kernel.org, rajatja@google.com --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EFB322E81A; Sun, 24 Mar 2024 23:51:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324308; cv=none; b=PWiCeXSRPHvdfMzyXItsXMHHpkP/yfB3u+Wh6bukj5aHkh7Hdzh9QyznsyW607C7jh9s6abSsKRsUP/rN0FAA9Ftb0IquWRdN327fwWgNOf41+AoI6D+jvxkZkmjOSh4SIXh+FjVFbROQi89UzPeTKXuPgBL/kO07ZJwrSz5IMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324308; c=relaxed/simple; bh=YEoU5PFm52D5s+v/MhMGx8B0s7OKjBl9UBYhekISz4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZLYVx0wvI4KzDTIxVS3dp3ypsJa+3LlYSJRVA1RhHmf72kwP4MTgGvibU49AK+1ekFI72sXYP9yTBJz7mShT69x5GqpF310xoiXycQO0llhAdeB48AequMpVevfdHyRswEzqp/6w0jSW8VA6L7agr3T5oVJCQDLQy7mAlKjlj7s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UGWc7OnL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UGWc7OnL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FB85C433C7; Sun, 24 Mar 2024 23:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324307; bh=YEoU5PFm52D5s+v/MhMGx8B0s7OKjBl9UBYhekISz4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UGWc7OnL6PCEdcHp+H0h1t3MagDZB+D6TMVLGKvqdHEJAO/e+SBadEUYrTVPV6g7U JQcGHqsVbJYtlkCOfwPLLK27Rhd6Khai2fGK+6Pn/bSx7z+Ty+ivP+lCOExHBzw/qe 6XDaAQ8coiGumJsUZ2yeSI1JQNhNicn1C0Rk3tnHYDfkZEVERkm8EihajeN3jH+iNN hmmF0w/SHObZTpdI0HK1PZvVO3t4fccc/p0sUrzIiibV/66V2GZb9Pcv18XOpDnHPh 2jVeBfFhuqTB0fU3rO/OwKH6rr3uunCMRY+VFNR0uX7aKU3Sw/kDKLnNnu45AMWYfY RmtG9YqFb8bmA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nikita Zhandarovich , Mauro Carvalho Chehab , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 079/148] media: em28xx: annotate unchecked call to media_device_register() Date: Sun, 24 Mar 2024 19:49:03 -0400 Message-ID: <20240324235012.1356413-80-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nikita Zhandarovich [ Upstream commit fd61d77a3d28444b2635f0c8b5a2ecd6a4d94026 ] Static analyzers generate alerts for an unchecked call to `media_device_register()`. However, in this case, the device will work reliably without the media controller API. Add a comment above the call to prevent future unnecessary changes. Suggested-by: Mauro Carvalho Chehab Fixes: 37ecc7b1278f ("[media] em28xx: add media controller support") Signed-off-by: Nikita Zhandarovich Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/em28xx/em28xx-cards.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em= 28xx/em28xx-cards.c index b14bff7b4ec88..b9874324d1c44 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3990,6 +3990,10 @@ static int em28xx_usb_probe(struct usb_interface *in= tf, * topology will likely change after the load of the em28xx subdrivers. */ #ifdef CONFIG_MEDIA_CONTROLLER + /* + * No need to check the return value, the device will still be + * usable without media controller API. + */ retval =3D media_device_register(dev->media_dev); #endif =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5378522E818; Sun, 24 Mar 2024 23:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324309; cv=none; b=aWC55azaySUXPRacdZohMBTcLID5cW1Djjvsktf+ZCN2TW3S6gHNIN0N9TAkL65XlGwTjQbxELdqbuPfZMeqPTEPzoAaSxYGO+2MvoTyWxUMfGx9bz8TkSZjnv9QAzFIa3GjZZ+w+K3lSPKMUcXi/G+i11V2wq0gPMp7tE3dXAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324309; c=relaxed/simple; bh=S9uLLi/8atLuxegltsLWhu4dmc6BgpwNdMCZp5eDUl8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XuiUGrNkvZydKHIo3sSjlZY2MQlc6JJ6BzPezmJ8MyaaI2ozVysJsmWDSe9n9dC1MQRTREqIQBmmAptNZPOeVUpnoUIWS2n3on+7AMam7SSzXvgGp/z2VLnQJhnWAdg8XU1/9uzi59xO9jNus5aX0Z6Q+0J7jOl1ymdkp5uM89M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EGyhlUJJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EGyhlUJJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EA38C433F1; Sun, 24 Mar 2024 23:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324307; bh=S9uLLi/8atLuxegltsLWhu4dmc6BgpwNdMCZp5eDUl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EGyhlUJJ8bt2QaCgZe/t6SojhU/vw3WtQ1jNSZnqst5fUS5a7/UXBX/ETsm47viNg f0tN/wsK78mgb+OJ6/xXlBmhexUS6FjMUqeBGLWgLmHH8BehhlTmJGlilpIop3bfI6 xjOFo0FRK8223Vr60yj4CgOFjW7290fXAtZYCZxlD+KingRqqc/is2vCt0uXp6Wj6U 8QoNtejnzLQ1TpI/FPj3mCI16iI5gD3LoepOsQ7tq1stkrPPFzmqEA8SmD7LJEsPwy +ljzxtOUy1lnu2l7ruKOZehIiJSyzFAiLGXcZvHG7YKTa0nI3FAmC1pGRD5Oq8X9XX /jGP5uo1CAWTg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhipeng Lu , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 080/148] media: v4l2-tpg: fix some memleaks in tpg_alloc Date: Sun, 24 Mar 2024 19:49:04 -0400 Message-ID: <20240324235012.1356413-81-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhipeng Lu [ Upstream commit 8cf9c5051076e0eb958f4361d50d8b0c3ee6691c ] In tpg_alloc, resources should be deallocated in each and every error-handling paths, since they are allocated in for statements. Otherwise there would be memleaks because tpg_free is called only when tpg_alloc return 0. Fixes: 63881df94d3e ("[media] vivid: add the Test Pattern Generator") Signed-off-by: Zhipeng Lu Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 52 +++++++++++++++---- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/= common/v4l2-tpg/v4l2-tpg-core.c index 2036b94269afe..182a300e2d445 100644 --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c @@ -113,6 +113,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) { unsigned pat; unsigned plane; + int ret =3D 0; =20 tpg->max_line_width =3D max_w; for (pat =3D 0; pat < TPG_MAX_PAT_LINES; pat++) { @@ -121,14 +122,18 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) =20 tpg->lines[pat][plane] =3D vzalloc(array3_size(max_w, 2, pixelsz)); - if (!tpg->lines[pat][plane]) - return -ENOMEM; + if (!tpg->lines[pat][plane]) { + ret =3D -ENOMEM; + goto free_lines; + } if (plane =3D=3D 0) continue; tpg->downsampled_lines[pat][plane] =3D vzalloc(array3_size(max_w, 2, pixelsz)); - if (!tpg->downsampled_lines[pat][plane]) - return -ENOMEM; + if (!tpg->downsampled_lines[pat][plane]) { + ret =3D -ENOMEM; + goto free_lines; + } } } for (plane =3D 0; plane < TPG_MAX_PLANES; plane++) { @@ -136,18 +141,45 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) =20 tpg->contrast_line[plane] =3D vzalloc(array_size(pixelsz, max_w)); - if (!tpg->contrast_line[plane]) - return -ENOMEM; + if (!tpg->contrast_line[plane]) { + ret =3D -ENOMEM; + goto free_contrast_line; + } tpg->black_line[plane] =3D vzalloc(array_size(pixelsz, max_w)); - if (!tpg->black_line[plane]) - return -ENOMEM; + if (!tpg->black_line[plane]) { + ret =3D -ENOMEM; + goto free_contrast_line; + } tpg->random_line[plane] =3D vzalloc(array3_size(max_w, 2, pixelsz)); - if (!tpg->random_line[plane]) - return -ENOMEM; + if (!tpg->random_line[plane]) { + ret =3D -ENOMEM; + goto free_contrast_line; + } } return 0; + +free_contrast_line: + for (plane =3D 0; plane < TPG_MAX_PLANES; plane++) { + vfree(tpg->contrast_line[plane]); + vfree(tpg->black_line[plane]); + vfree(tpg->random_line[plane]); + tpg->contrast_line[plane] =3D NULL; + tpg->black_line[plane] =3D NULL; + tpg->random_line[plane] =3D NULL; + } +free_lines: + for (pat =3D 0; pat < TPG_MAX_PAT_LINES; pat++) + for (plane =3D 0; plane < TPG_MAX_PLANES; plane++) { + vfree(tpg->lines[pat][plane]); + tpg->lines[pat][plane] =3D NULL; + if (plane =3D=3D 0) + continue; + vfree(tpg->downsampled_lines[pat][plane]); + tpg->downsampled_lines[pat][plane] =3D NULL; + } + return ret; } EXPORT_SYMBOL_GPL(tpg_alloc); =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56695132808; Sun, 24 Mar 2024 23:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324310; cv=none; b=YxoinMpwo5XDh32DjkpmsgiNcshWQ8KrZxpxm29SuIR2tYd20mVaNiu5AwqN12aEllcv/K5cU7P+pq7h7bKtbAsClHyzIoCJPTGIJx7u6uf+DD0C2xe2GZfokBNhvVvYXAl8iC34nKcAJHR1iIY1fOjwjEM8khrBbpXmTy4pBYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324310; c=relaxed/simple; bh=8z5IHMv3GWG41+xjtTI2imOucUx5FAko19b1cKHsbNI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pKyu+f2UIu5/zhni1Ihga1QqigoKL9+GhErE9RIV4ElVLq6vREWdCujmMz9bgvnfcWZgXCoL4607Tdak66N8yYzTYuJm8IKwzWHWOZQkDw6QfJ7Zlou5fmccczxU6cmJ4mm3y47dRZB7oKTNIwOSQcexAwtI/OyEaXqLD7hQkcc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sDW1mlv4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sDW1mlv4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A8C5C43390; Sun, 24 Mar 2024 23:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324309; bh=8z5IHMv3GWG41+xjtTI2imOucUx5FAko19b1cKHsbNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sDW1mlv4dDWUW69Sgid9mVGHxwwz1PziL3IHAvQrDEZcFTKx/YiE9FDLnW6OlIh9d IgW9UAbkkd/A20YGItd8xMn0STghEky9WwBJNa03ytxREWDqi2XQhX/lK05fdsmcOB lZk5JTdV+3H3Xa+fgcUF+PfeliBRU6cWVcYduvv5tHR7158EPJw41Qag7a10AHap/9 QcLZtcLWdj62Nj6wjrcizXvBdyHR3ki/hDm0OfuDcfJxVVgmYaPmOS6wtm0iqAFsuQ 0q0eMAnZPKj16vkEvirUnoZj5hOT3pJWos71mJW3XEjvqleyJbWMn8KQcquDP1yEXY rRaMdSnAuKedA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhipeng Lu , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 081/148] media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity Date: Sun, 24 Mar 2024 19:49:05 -0400 Message-ID: <20240324235012.1356413-82-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhipeng Lu [ Upstream commit 8f94b49a5b5d386c038e355bef6347298aabd211 ] The entity->name (i.e. name) is allocated in v4l2_m2m_register_entity but isn't freed in its following error-handling paths. This patch adds such deallocation to prevent memleak of entity->name. Fixes: be2fff656322 ("media: add helpers for memory-to-memory media control= ler") Signed-off-by: Zhipeng Lu Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/v4l2-core/v4l2-mem2mem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-co= re/v4l2-mem2mem.c index 75c51007768e3..5c4e4d101ca46 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -775,11 +775,17 @@ static int v4l2_m2m_register_entity(struct media_devi= ce *mdev, entity->function =3D function; =20 ret =3D media_entity_pads_init(entity, num_pads, pads); - if (ret) + if (ret) { + kfree(entity->name); + entity->name =3D NULL; return ret; + } ret =3D media_device_register_entity(mdev, entity); - if (ret) + if (ret) { + kfree(entity->name); + entity->name =3D NULL; return ret; + } =20 return 0; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BFE313280B; Sun, 24 Mar 2024 23:51:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324310; cv=none; b=hi/D5U+gEKwg1Qspr24idqLuBXE2sUNsX+T84Jix01sahGYqAUWBORzM9a+O1IduJxyiEc6McXT+1oK+qsqH883Md9OIODy/W26u7xB7PeT8ngvDntHToJyMcS/5Yuvb0++2VuHslzmlZZ0g+3Kax0v86nkxtCwXsqw7qaRqG5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324310; c=relaxed/simple; bh=E3ev4s0/MWK6GrCYFP2vej+WNCRhvaN5iAa8vNsJbHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V6khlqh9iWJbzLZS1/I3XLqpeqiQzE208WCo4dA5UjwMf/QSDZnCUhcmO1RVpdKBUe5EeAF/xKduFZPAvzzybVhahRkkm0eD8LiXbxJCvhj8QFJ5UzVAhL/2sKnk5DVKszTVnol8b52sIaMP/sNOCAd5Kx4BKLpppf3NjeEBaIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nMqX1Vz+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nMqX1Vz+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C39EC43399; Sun, 24 Mar 2024 23:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324310; bh=E3ev4s0/MWK6GrCYFP2vej+WNCRhvaN5iAa8vNsJbHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMqX1Vz+xQtUaYwh4PadyzErvDFF60iTgL18lEd28FWyR+04ABCeb6Qv/pu8QW2N2 6QIWisSyyrJBgVfDkvPlOkeY6cxO+nkRggbS8Tu+sGfVWnWdXLh8m8jC8HMpAhbQUf IMqsqwwNpxoho8KHo1xGD6/JRnvM/ltnxcRnHCiUK6JeoN4jNinDgT+QzrMWhKBwOd UY8mDNykoAjmRn0FaiQRE0zu74kFM0EmIfnPOuvjYgVEsWJPKLs0FPGbb2fqezadKY SrOxn8cCj/ECcA2HLuOi8CF+DFSZy/3j29lFjDjgyTZ91g2/hE9XU5WnyfpQEr/jk6 2g5dbMBw0uIoA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 082/148] media: dvbdev: remove double-unlock Date: Sun, 24 Mar 2024 19:49:06 -0400 Message-ID: <20240324235012.1356413-83-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mauro Carvalho Chehab [ Upstream commit 122d0e8dd050cc5dc3fb9e9b5f2dee3c5276ce35 ] As warned by smatch: drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:529 dvb_r= egister_device() error: double unlock 'sem:&minor_rwsem' Reported-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Stable-dep-of: 8c64f4cdf4e6 ("media: edia: dvbdev: fix a use-after-free") Signed-off-by: Sasha Levin --- drivers/media/dvb-core/dvbdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbde= v.c index b8335ede66264..1f80c4fa31c9b 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -536,7 +536,6 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, dvb_media_device_free(dvbdev); kfree(dvbdevfops); kfree(dvbdev); - up_write(&minor_rwsem); mutex_unlock(&dvbdev_register_lock); return ret; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EFB0296166; Sun, 24 Mar 2024 23:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324313; cv=none; b=pTd9vkBYvBLL8PdQ1A0YUYlfBW43fqRYCOcn5oUi0GYQgJipCRdCS5+3n8y3b0H3c+fTLsgt2Dy0X3yqbdBDU3itCy/Om/H1zdDAZslIsZ9UfCa1rHFzc8MDgXGiXfqAU6Z0bKmvTPKMsH5bHa2j6FXTz1wIKYxB/hbUuhJ5xRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324313; c=relaxed/simple; bh=me2HpTQgosWZGh8i0coUrQySsAR7m8rC0zF8tIHzlWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qLn0x+t7jvd3NbvB/1wmKggvm69BwxCPxEQxwHbJEpNPpTejm5uxHnJ7/WFI8jSBu1ue6eCrukqQy7V0jPMO1xIdExjxtHSAKmMT00JaSczlBV5fguZMm/BkEsRIneqq5PvspYmvgttKLEv0nKxOIZF9bTj5vMGy1K4qOM6ekyo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=brBLmfR2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="brBLmfR2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6409DC433A6; Sun, 24 Mar 2024 23:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324312; bh=me2HpTQgosWZGh8i0coUrQySsAR7m8rC0zF8tIHzlWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=brBLmfR2K87teGQ7ZOe0lWcMSwRFziK995A0bJGC3ewdr3Cr87OtNl353USOiJLXF /F+y9ijEg1Tea5SPMzFRzFPsnHT2Evc2/n1WiirOF4/qTcY7f9NdLrgpih06lm8S22 A97JGgLDv2W1SSoCjq/xIl1JmeyMrBA+IlecCPFoJhAKcuQlstEvpLnFwbj5bQvl21 qcnOPguV2YmGvhuYwmjp9ZcnAYifGgcC/XK82wO/X1Qx/E1WKWKu37DOr1mXlGu0qr yg1SK7M8qzauj6HZTVpqVTOsDBQ8yE4YaSzL9qDZoW3upc8VBYUBLnqPcg8PRaSA52 qd6PYmZf72Bag== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fuqian Huang , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 083/148] media: media/dvb: Use kmemdup rather than duplicating its implementation Date: Sun, 24 Mar 2024 19:49:07 -0400 Message-ID: <20240324235012.1356413-84-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Fuqian Huang [ Upstream commit f6af820ef1be58c2e4b81aa479b9f109eb6344ce ] kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy. Signed-off-by: Fuqian Huang Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Stable-dep-of: 8c64f4cdf4e6 ("media: edia: dvbdev: fix a use-after-free") Signed-off-by: Sasha Levin --- drivers/media/dvb-core/dvbdev.c | 3 +-- drivers/media/dvb-frontends/drx39xyj/drxj.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbde= v.c index 1f80c4fa31c9b..5d68ad0ac5d26 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -485,7 +485,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, return -ENOMEM; } =20 - dvbdevfops =3D kzalloc(sizeof(struct file_operations), GFP_KERNEL); + dvbdevfops =3D kmemdup(template->fops, sizeof(*dvbdevfops), GFP_KERNEL); =20 if (!dvbdevfops){ kfree (dvbdev); @@ -502,7 +502,6 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, dvbdev->fops =3D dvbdevfops; init_waitqueue_head (&dvbdev->wait_queue); =20 - memcpy(dvbdevfops, template->fops, sizeof(struct file_operations)); dvbdevfops->owner =3D adap->module; =20 list_add_tail (&dvbdev->list_head, &adap->device_list); diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dv= b-frontends/drx39xyj/drxj.c index 9670bc98b45a9..33cf6dccb547f 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -12287,7 +12287,8 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_ada= pter *i2c) if (state =3D=3D NULL) goto error; =20 - demod =3D kmalloc(sizeof(struct drx_demod_instance), GFP_KERNEL); + demod =3D kmemdup(&drxj_default_demod_g, + sizeof(struct drx_demod_instance), GFP_KERNEL); if (demod =3D=3D NULL) goto error; =20 @@ -12311,8 +12312,6 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_ada= pter *i2c) state->demod =3D demod; =20 /* setup the demod data */ - memcpy(demod, &drxj_default_demod_g, sizeof(struct drx_demod_instance)); - demod->my_i2c_dev_addr =3D demod_addr; demod->my_common_attr =3D demod_comm_attr; demod->my_i2c_dev_addr->user_data =3D state; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 264D2296173; Sun, 24 Mar 2024 23:51:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324314; cv=none; b=B3R2d9Qo5HG7JHWxyS1P4lHcfX8eoJ6xW+CWdIETzh5AMFQYVjn6LI9qzoGtzOCHz6CszgM0gRE5gKTQ5BVDTW7Jnx7KSE+g8Kc2ISfZstP+7vrlf8TsUh3lZrcMps8s9zCCUKeKvtJLjIwDoRmtFUQX7T17yHFbrT4oaME1pnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324314; c=relaxed/simple; bh=P/PAhYD5AdDh+C56c3tbDfUP3ouaglcCX/oQHeHaGdY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ah3Lyxhq2Bh6q+VjyQl1MuWt5fzhJYnTRZAEUPM3d07PUbPCihFO2dPqxWlCCnBXxDof1Qfv0m26XJbRnpTFMA74I5aZXCxila8QrddxUL3Kf5NnV114EaNKTY4onT0skbZLd1ZX0vi5SrVq1JJ9nVhbG2G8oaoKN0eL5HEmDzk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t+k3imjf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t+k3imjf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A933C433F1; Sun, 24 Mar 2024 23:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324313; bh=P/PAhYD5AdDh+C56c3tbDfUP3ouaglcCX/oQHeHaGdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+k3imjfhqleyqj9LRhlk/Mcb7uJ2yuzwTYL+wMP1mbDXCy0bVWegqEut0KlFYs5D xLQwiKtBW4vTN6EQMurie/rNA6LEFryXR7IEdLg0TpYCgBusoNH4i8WnIJv86vih8Y SZ1OUGgWIAbOZ5/cNdSbFrIYDdkLi49N6FRcBXSgOjYLv2in/tHj4VZjWdt9+84bRo SXn5mQLeNmBm1ROTdmHx4jxFpQ5XcpUmi1oywBPBPk/5BUwAyRtI121vZtykLNAm65 wpExJzFZ4/TpZgDKvyJD1iffYNSelafAojsoZyi/dkCAG8o03CoSYZ0OkCkiuBprs9 QFBAC2LwREpHg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dinghao Liu , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 084/148] media: dvbdev: Fix memleak in dvb_register_device Date: Sun, 24 Mar 2024 19:49:08 -0400 Message-ID: <20240324235012.1356413-85-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dinghao Liu [ Upstream commit 167faadfcf9339088910e9e85a1b711fcbbef8e9 ] When device_create() fails, dvbdev and dvbdevfops should be freed just like when dvb_register_media_device() fails. Signed-off-by: Dinghao Liu Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Stable-dep-of: 8c64f4cdf4e6 ("media: edia: dvbdev: fix a use-after-free") Signed-off-by: Sasha Levin --- drivers/media/dvb-core/dvbdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbde= v.c index 5d68ad0ac5d26..8273c969358e6 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -547,6 +547,9 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, if (IS_ERR(clsdev)) { pr_err("%s: failed to create device dvb%d.%s%d (%ld)\n", __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); + dvb_media_device_free(dvbdev); + kfree(dvbdevfops); + kfree(dvbdev); return PTR_ERR(clsdev); } dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9600296179; Sun, 24 Mar 2024 23:51:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324315; cv=none; b=au3RKugZPvUwCwYWXHi7MG8pCUkjD2KfOhXPjAS4ZlUs3SIOTC9mc2TiCXNqTBOITdPZQmZ0ZxOBqSfTtk06VGc/ZEXSk9k1Dwq/tnzGPUYkUoNrxLJgr9xZ70Oqpz4kXqf7tXtaU4qpTBEGhSZgoRlNLmenYBFjJSTh9b2SJfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324315; c=relaxed/simple; bh=VZsBu+Ttvi19cA8CEXfjnmf7ujuFCHpyubcJGasIOGY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mk4j9xg8tdftPXWqCXcW6miwbLVRSabpQs3Cbl594jXWt4S+5zRNFrkUWmvqVhPC9tp2PHOwcB1acirqlf4uYDCy527CgBQn+XxuHf4dFkWSpoqfYrYcloV05q2hngTD+RX7mhmnLoR2R9dChQN9M+FSPwjP5OAo3cJ2arR8Nak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MOKw251n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MOKw251n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AEC0C433C7; Sun, 24 Mar 2024 23:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324313; bh=VZsBu+Ttvi19cA8CEXfjnmf7ujuFCHpyubcJGasIOGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MOKw251nRLFNpD6o1huTBcELobLN1/O5zsvyF2zjHbslyYGSGwKXvYjLqw6x39f+w SMzOAr1+QLjVayGpsN20yDcP7Jp9BT9UkNmm94eR2lr7yWDHHfDOFyIjoiZq02Vpl3 FckXOdLSoZNwwygPwZRDI7X+Tq0Wa1g9deJRZy8g4Tu4iHEDSy5C/bOBRD18J7CIey K4jcVqayrkob4S5nS4Uqtmw716KbjavKa9NuT3cGujOxY5dP7lud4L1/oZaRmN5kS4 YIGEF9ytIQ9PXzzo1MZVjK5G3Z5rh2PZMmdaHSGgeMjk6c1HSzFC+Ci7XCGRuhBgdP 3eXtqJ6raS1QQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 085/148] media: dvbdev: fix error logic at dvb_register_device() Date: Sun, 24 Mar 2024 19:49:09 -0400 Message-ID: <20240324235012.1356413-86-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mauro Carvalho Chehab [ Upstream commit 1fec2ecc252301110e4149e6183fa70460d29674 ] As reported by smatch: drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:510 dvb_r= egister_device() warn: '&dvbdev->list_head' not removed from list drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:530 dvb_r= egister_device() warn: '&dvbdev->list_head' not removed from list drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:545 dvb_r= egister_device() warn: '&dvbdev->list_head' not removed from list The error logic inside dvb_register_device() doesn't remove devices from the dvb_adapter_list in case of errors. Signed-off-by: Mauro Carvalho Chehab Stable-dep-of: 8c64f4cdf4e6 ("media: edia: dvbdev: fix a use-after-free") Signed-off-by: Sasha Levin --- drivers/media/dvb-core/dvbdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbde= v.c index 8273c969358e6..cf0c428f5776b 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -513,6 +513,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, break; =20 if (minor =3D=3D MAX_DVB_MINORS) { + list_del (&dvbdev->list_head); kfree(dvbdevfops); kfree(dvbdev); up_write(&minor_rwsem); @@ -533,6 +534,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, __func__); =20 dvb_media_device_free(dvbdev); + list_del (&dvbdev->list_head); kfree(dvbdevfops); kfree(dvbdev); mutex_unlock(&dvbdev_register_lock); @@ -548,6 +550,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, pr_err("%s: failed to create device dvb%d.%s%d (%ld)\n", __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); dvb_media_device_free(dvbdev); + list_del (&dvbdev->list_head); kfree(dvbdevfops); kfree(dvbdev); return PTR_ERR(clsdev); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3278E29617D; Sun, 24 Mar 2024 23:51:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324315; cv=none; b=OWQgZxaXOvrDr5+DYB98wdu1YNAKs6fGuIwQz+FnQz6BOPGTb7d7dnLWXTU5ApGYIvYy4Deyl9oB2ei5FXbgOr+VkGgpOmyVbW5OLy7WnkNJY6nr4hV0joY+XE1qThGFcAJ9d10eKeUlowZz0oBPI7rtnQUt2/nBYxKybpGc82M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324315; c=relaxed/simple; bh=deSVadvuUG1ckQLc/0sZcVTEfikkjUcgOGef72yAj6Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hOS7SlVRx8G+lfGhWb5P4+CalOzauGrgR8+T3B5WsW7LHYLvtH407ZcPF5jf3XlaZM9A/Gp7TB2+hXhk88ohbgDT1HprpQ6EI+T+1menDFCMBjjqbaMCpOtDCZmQCXWeOpXSkXE3vBvfXekdvs4xf6+PLF/odNA854bQY/4vKSc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jLsFVE2s; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jLsFVE2s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AB6CC43394; Sun, 24 Mar 2024 23:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324315; bh=deSVadvuUG1ckQLc/0sZcVTEfikkjUcgOGef72yAj6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jLsFVE2sOhNK7rRz0hBk55Rgg79z5hnTh+9iMYkpd1XRsy6+uq9qvuVZA3hu/D2ic IFkquaoADyjtcRqf/WQDvtdIrJA02/32vi1t4ARxo5jXG2tWjHYG7uIF/Gu5njR32Z U5TgLzY+7cl6rcFPFMljhxbW9spj6CIoX/LSLVwHqIOX5+FfFGHG1DYDPbvzGXzB51 0vuX1CXl/QEiTgqJY3uHJF+nvUyyOkmAJdhbdG+56/FXsy2FXNgQ7CYmhTT4WptcG4 dRwX/adxp8ytjeYDzzdCVtS/67gTYA+mVPTWzo2RqKiPcMrk/iWmyRnCrUWorI2e5z 8tHcRSI5Z+rsA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hyunwoo Kim , kernel test robot , Dan Carpenter , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 086/148] media: dvb-core: Fix use-after-free due to race at dvb_register_device() Date: Sun, 24 Mar 2024 19:49:10 -0400 Message-ID: <20240324235012.1356413-87-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Hyunwoo Kim [ Upstream commit 627bb528b086b4136315c25d6a447a98ea9448d3 ] dvb_register_device() dynamically allocates fops with kmemdup() to set the fops->owner. And these fops are registered in 'file->f_ops' using replace_fops() in the dvb_device_open() process, and kfree()d in dvb_free_device(). However, it is not common to use dynamically allocated fops instead of 'static const' fops as an argument of replace_fops(), and UAF may occur. These UAFs can occur on any dvb type using dvb_register_device(), such as dvb_dvr, dvb_demux, dvb_frontend, dvb_net, etc. So, instead of kfree() the fops dynamically allocated in dvb_register_device() in dvb_free_device() called during the .disconnect() process, kfree() it collectively in exit_dvbdev() called when the dvbdev.c module is removed. Link: https://lore.kernel.org/linux-media/20221117045925.14297-4-imv4bel@gm= ail.com Signed-off-by: Hyunwoo Kim Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab Stable-dep-of: 8c64f4cdf4e6 ("media: edia: dvbdev: fix a use-after-free") Signed-off-by: Sasha Levin --- drivers/media/dvb-core/dvbdev.c | 84 ++++++++++++++++++++++++--------- include/media/dvbdev.h | 15 ++++++ 2 files changed, 78 insertions(+), 21 deletions(-) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbde= v.c index cf0c428f5776b..35c272d77375e 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -37,6 +37,7 @@ #include =20 static DEFINE_MUTEX(dvbdev_mutex); +static LIST_HEAD(dvbdevfops_list); static int dvbdev_debug; =20 module_param(dvbdev_debug, int, 0644); @@ -464,14 +465,15 @@ int dvb_register_device(struct dvb_adapter *adap, str= uct dvb_device **pdvbdev, enum dvb_device_type type, int demux_sink_pads) { struct dvb_device *dvbdev; - struct file_operations *dvbdevfops; + struct file_operations *dvbdevfops =3D NULL; + struct dvbdevfops_node *node =3D NULL, *new_node =3D NULL; struct device *clsdev; int minor; int id, ret; =20 mutex_lock(&dvbdev_register_lock); =20 - if ((id =3D dvbdev_get_free_id (adap, type)) < 0){ + if ((id =3D dvbdev_get_free_id (adap, type)) < 0) { mutex_unlock(&dvbdev_register_lock); *pdvbdev =3D NULL; pr_err("%s: couldn't find free device id\n", __func__); @@ -479,18 +481,45 @@ int dvb_register_device(struct dvb_adapter *adap, str= uct dvb_device **pdvbdev, } =20 *pdvbdev =3D dvbdev =3D kzalloc(sizeof(*dvbdev), GFP_KERNEL); - if (!dvbdev){ mutex_unlock(&dvbdev_register_lock); return -ENOMEM; } =20 - dvbdevfops =3D kmemdup(template->fops, sizeof(*dvbdevfops), GFP_KERNEL); + /* + * When a device of the same type is probe()d more than once, + * the first allocated fops are used. This prevents memory leaks + * that can occur when the same device is probe()d repeatedly. + */ + list_for_each_entry(node, &dvbdevfops_list, list_head) { + if (node->fops->owner =3D=3D adap->module && + node->type =3D=3D type && + node->template =3D=3D template) { + dvbdevfops =3D node->fops; + break; + } + } =20 - if (!dvbdevfops){ - kfree (dvbdev); - mutex_unlock(&dvbdev_register_lock); - return -ENOMEM; + if (dvbdevfops =3D=3D NULL) { + dvbdevfops =3D kmemdup(template->fops, sizeof(*dvbdevfops), GFP_KERNEL); + if (!dvbdevfops) { + kfree(dvbdev); + mutex_unlock(&dvbdev_register_lock); + return -ENOMEM; + } + + new_node =3D kzalloc(sizeof(struct dvbdevfops_node), GFP_KERNEL); + if (!new_node) { + kfree(dvbdevfops); + kfree(dvbdev); + mutex_unlock(&dvbdev_register_lock); + return -ENOMEM; + } + + new_node->fops =3D dvbdevfops; + new_node->type =3D type; + new_node->template =3D template; + list_add_tail (&new_node->list_head, &dvbdevfops_list); } =20 memcpy(dvbdev, template, sizeof(struct dvb_device)); @@ -501,20 +530,20 @@ int dvb_register_device(struct dvb_adapter *adap, str= uct dvb_device **pdvbdev, dvbdev->priv =3D priv; dvbdev->fops =3D dvbdevfops; init_waitqueue_head (&dvbdev->wait_queue); - dvbdevfops->owner =3D adap->module; - list_add_tail (&dvbdev->list_head, &adap->device_list); - down_write(&minor_rwsem); #ifdef CONFIG_DVB_DYNAMIC_MINORS for (minor =3D 0; minor < MAX_DVB_MINORS; minor++) if (dvb_minors[minor] =3D=3D NULL) break; - if (minor =3D=3D MAX_DVB_MINORS) { + if (new_node) { + list_del (&new_node->list_head); + kfree(dvbdevfops); + kfree(new_node); + } list_del (&dvbdev->list_head); - kfree(dvbdevfops); kfree(dvbdev); up_write(&minor_rwsem); mutex_unlock(&dvbdev_register_lock); @@ -523,41 +552,47 @@ int dvb_register_device(struct dvb_adapter *adap, str= uct dvb_device **pdvbdev, #else minor =3D nums2minor(adap->num, type, id); #endif - dvbdev->minor =3D minor; dvb_minors[minor] =3D dvb_device_get(dvbdev); up_write(&minor_rwsem); - ret =3D dvb_register_media_device(dvbdev, type, minor, demux_sink_pads); if (ret) { pr_err("%s: dvb_register_media_device failed to create the mediagraph\n", __func__); - + if (new_node) { + list_del (&new_node->list_head); + kfree(dvbdevfops); + kfree(new_node); + } dvb_media_device_free(dvbdev); list_del (&dvbdev->list_head); - kfree(dvbdevfops); kfree(dvbdev); mutex_unlock(&dvbdev_register_lock); return ret; } =20 - mutex_unlock(&dvbdev_register_lock); - clsdev =3D device_create(dvb_class, adap->device, MKDEV(DVB_MAJOR, minor), dvbdev, "dvb%d.%s%d", adap->num, dnames[type], id); if (IS_ERR(clsdev)) { pr_err("%s: failed to create device dvb%d.%s%d (%ld)\n", __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); + if (new_node) { + list_del (&new_node->list_head); + kfree(dvbdevfops); + kfree(new_node); + } dvb_media_device_free(dvbdev); list_del (&dvbdev->list_head); - kfree(dvbdevfops); kfree(dvbdev); + mutex_unlock(&dvbdev_register_lock); return PTR_ERR(clsdev); } + dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", adap->num, dnames[type], id, minor, minor); =20 + mutex_unlock(&dvbdev_register_lock); return 0; } EXPORT_SYMBOL(dvb_register_device); @@ -586,7 +621,6 @@ static void dvb_free_device(struct kref *ref) { struct dvb_device *dvbdev =3D container_of(ref, struct dvb_device, ref); =20 - kfree (dvbdev->fops); kfree (dvbdev); } =20 @@ -1082,9 +1116,17 @@ static int __init init_dvbdev(void) =20 static void __exit exit_dvbdev(void) { + struct dvbdevfops_node *node, *next; + class_destroy(dvb_class); cdev_del(&dvb_device_cdev); unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); + + list_for_each_entry_safe(node, next, &dvbdevfops_list, list_head) { + list_del (&node->list_head); + kfree(node->fops); + kfree(node); + } } =20 subsys_initcall(init_dvbdev); diff --git a/include/media/dvbdev.h b/include/media/dvbdev.h index 09279ed0051ea..0e2bda5ccadd5 100644 --- a/include/media/dvbdev.h +++ b/include/media/dvbdev.h @@ -189,6 +189,21 @@ struct dvb_device { void *priv; }; =20 +/** + * struct dvbdevfops_node - fops nodes registered in dvbdevfops_list + * + * @fops: Dynamically allocated fops for ->owner registration + * @type: type of dvb_device + * @template: dvb_device used for registration + * @list_head: list_head for dvbdevfops_list + */ +struct dvbdevfops_node { + struct file_operations *fops; + enum dvb_device_type type; + const struct dvb_device *template; + struct list_head list_head; +}; + /** * dvb_device_get - Increase dvb_device reference * --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6605F29618D; Sun, 24 Mar 2024 23:51:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324317; cv=none; b=mA6DncKh9hRPmnl802d3+6b+5ZGGctuDJ0KAPIgY9Wg/LMsCJH9oWG+J3g1EMT3ce4d4z3qVj2PL5J4Bzzp1+cjnqAERCKgO05n5BYEbe7cIByAe3f7GWldENwnC5oUXtGi+sPxLoRJWKQaRJXgyM2NPl2QMuTlwThF0l9mRyRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324317; c=relaxed/simple; bh=xhecuLVwTF/x3m+Vd/DgeBCVK7TzpAqqQH6UaRkUs2U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N/144OoHrBHKlcFgPYdBjQocWgdYaJ+W0weaIbIJqGea8+y/i/hCL5pRbMcIwH8+JQ6dxfRhaX+U+wyPq7UxPw0FvKvykoJKop4IAbONdhF8MqF0/DfCb3tjkW/cN7JGGML1h9KQb1eP6Hc4wu38U39nTRRsEIajIvXZr+Ay71s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UXurerOg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UXurerOg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45252C433B1; Sun, 24 Mar 2024 23:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324316; bh=xhecuLVwTF/x3m+Vd/DgeBCVK7TzpAqqQH6UaRkUs2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UXurerOgJQShx5x1RX1jrlOYFDdDtTXWj+VBID/dBI10Vf5PwHpb1w7XUZINsZKTN xdapYpHR+IrguI8vaHusUpoxUQg9QE4jxtEX+RZFiuibZa0Q39WCLgun36vggHJHq8 8PgKiFTAJ6bh9GHH1WOuxKNaJH5lyxmU4wFA7r+MYucdCnXVVnavT17QVvx3146h3m OJgPillJlBOxcAiqGIvINtizAIc0j7EjFYN+jhzIwIgwcYZrbNXVTQuQYl5JyaSR7g h/Q6MqEGpF1E5l4900hCc+TJjuOgs2hYukoWCGuq/TOXNPhQlU+W/WBqb+aopB0JAS Oc00iAeLc7sIQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhipeng Lu , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 087/148] media: edia: dvbdev: fix a use-after-free Date: Sun, 24 Mar 2024 19:49:11 -0400 Message-ID: <20240324235012.1356413-88-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhipeng Lu [ Upstream commit 8c64f4cdf4e6cc5682c52523713af8c39c94e6d5 ] In dvb_register_device, *pdvbdev is set equal to dvbdev, which is freed in several error-handling paths. However, *pdvbdev is not set to NULL after dvbdev's deallocation, causing use-after-frees in many places, for example, in the following call chain: budget_register |-> dvb_dmxdev_init |-> dvb_register_device |-> dvb_dmxdev_release |-> dvb_unregister_device |-> dvb_remove_device |-> dvb_device_put |-> kref_put When calling dvb_unregister_device, dmxdev->dvbdev (i.e. *pdvbdev in dvb_register_device) could point to memory that had been freed in dvb_register_device. Thereafter, this pointer is transferred to kref_put and triggering a use-after-free. Link: https://lore.kernel.org/linux-media/20240203134046.3120099-1-alexious= @zju.edu.cn Fixes: b61901024776 ("V4L/DVB (5244): Dvbdev: fix illegal re-usage of fileo= perations struct") Signed-off-by: Zhipeng Lu Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/dvb-core/dvbdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbde= v.c index 35c272d77375e..f426e1bf16f0a 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -504,6 +504,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, dvbdevfops =3D kmemdup(template->fops, sizeof(*dvbdevfops), GFP_KERNEL); if (!dvbdevfops) { kfree(dvbdev); + *pdvbdev =3D NULL; mutex_unlock(&dvbdev_register_lock); return -ENOMEM; } @@ -512,6 +513,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, if (!new_node) { kfree(dvbdevfops); kfree(dvbdev); + *pdvbdev =3D NULL; mutex_unlock(&dvbdev_register_lock); return -ENOMEM; } @@ -545,6 +547,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, } list_del (&dvbdev->list_head); kfree(dvbdev); + *pdvbdev =3D NULL; up_write(&minor_rwsem); mutex_unlock(&dvbdev_register_lock); return -EINVAL; @@ -567,6 +570,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, dvb_media_device_free(dvbdev); list_del (&dvbdev->list_head); kfree(dvbdev); + *pdvbdev =3D NULL; mutex_unlock(&dvbdev_register_lock); return ret; } @@ -585,6 +589,7 @@ int dvb_register_device(struct dvb_adapter *adap, struc= t dvb_device **pdvbdev, dvb_media_device_free(dvbdev); list_del (&dvbdev->list_head); kfree(dvbdev); + *pdvbdev =3D NULL; mutex_unlock(&dvbdev_register_lock); return PTR_ERR(clsdev); } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 578C4296169; Sun, 24 Mar 2024 23:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324317; cv=none; b=U9K/yQS3CbJw2sXZ3XLFQ3xKOBeXW4yu54T2QxI6izNZS4REPrlwRiIlR0PtRYq5YQ2CU5BmIU/NQgBmDNDRSv+oqRo6FbThy4uGk2W7sP7zrVVtJi638NvIr5f2HhjkcEfMa7WoHBKHQ8b3AOACp8qdeyBb0XY0TfKuUh/akFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324317; c=relaxed/simple; bh=YSgfR+iwNZXq5JgYJ4A2KR4Tqnl/88XavKHKucwJQ+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KcMnQVmNyr7taGiWOAMRCNzsJJTMIfdZV+3i3kQlAi+HyKjHeVyvrxiMoVoyew5xZ/s/nUZyOYK9R4xFU1Ur6qcbNIX+EDLXmmxdg0AFS0Jx1LjSMnLc+fXiyBcaUrU9Hjud5o3rzn8F06+Ol/GkpUXFQN2EhFDzU7LNXvlqMbI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RbGdeduh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RbGdeduh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90FD8C433C7; Sun, 24 Mar 2024 23:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324317; bh=YSgfR+iwNZXq5JgYJ4A2KR4Tqnl/88XavKHKucwJQ+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RbGdeduhp1aXbeoqrbyAXoYwV1OoOz1QJu4jLISI3pikO4yQbBFbVR7glFUpLsURN PADvZXAKgZElldv5DI0zgp8/RKn9RzTnpJc7wrrk36REYfgNws7tlHxkDRWtx+oHoS xAlOQHDrfPe2n959F4Jct9kaouOi6bqx1BkcWFuzfWhVLFNmi9ld7a60Ah2dE1Ots5 ik5bV78FoF6/53vSNlI91W04DMnPUUD25OrEaM7npb+7hwTmvuop43UAY/Uq69LS5/ CwzaqbQwc4gyl6ya1dg9ctz5mvWrp0kzxYdspI01BzkJNzsHZpXL0ArwCFj2S+TtUw vG0Zwy2w6oSUg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephan Gerhold , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 088/148] clk: qcom: reset: Allow specifying custom reset delay Date: Sun, 24 Mar 2024 19:49:12 -0400 Message-ID: <20240324235012.1356413-89-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit 2cb8a39b6781ea23accd1fa93b3ad000d0948aec ] The amount of time required between asserting and deasserting the reset signal can vary depending on the involved hardware component. Sometimes 1 us might not be enough and a larger delay is necessary to conform to the specifications. Usually this is worked around in the consuming drivers, by replacing reset_control_reset() with a sequence of reset_control_assert(), waiting for a custom delay, followed by reset_control_deassert(). However, in some cases the driver making use of the reset is generic and can be used with different reset controllers. In this case the reset time requirement is better handled directly by the reset controller driver. Make this possible by adding an "udelay" field to the qcom_reset_map that allows setting a different reset delay (in microseconds). Signed-off-by: Stephan Gerhold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220706134132.3623415-4-stephan.gerhold@ke= rnkonzept.com Stable-dep-of: 2f8cf2c3f3e3 ("clk: qcom: reset: Ensure write completion on = reset de/assertion") Signed-off-by: Sasha Levin --- drivers/clk/qcom/reset.c | 4 +++- drivers/clk/qcom/reset.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c index 0324d8daab9bc..fc68c8fa30ac7 100644 --- a/drivers/clk/qcom/reset.c +++ b/drivers/clk/qcom/reset.c @@ -21,8 +21,10 @@ =20 static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id) { + struct qcom_reset_controller *rst =3D to_qcom_reset_controller(rcdev); + rcdev->ops->assert(rcdev, id); - udelay(1); + udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */ rcdev->ops->deassert(rcdev, id); return 0; } diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h index cda877927d43a..3e30f6724c7a4 100644 --- a/drivers/clk/qcom/reset.h +++ b/drivers/clk/qcom/reset.h @@ -19,6 +19,7 @@ struct qcom_reset_map { unsigned int reg; u8 bit; + u8 udelay; }; =20 struct regmap; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42B7D296194; Sun, 24 Mar 2024 23:51:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324318; cv=none; b=uYkB4CVocQy3zkAWv7lPJ/Sz/2pxJhHuIYet4PaWRcaAiks9DWspq6P/U5ANgX8aLF+zDAexouOVc7qLKF1inUY0EPn0SHTKGOdGn8svta/38kOOu/BKgHcKPRMAVONQ8oxPuOrtKPpYGilJWCOi2En4bMkDjAqarjDHq796oGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324318; c=relaxed/simple; bh=lADsJniJZHzbQRfYWEvMrBb8j0yKXv7+WxDIULm0MAs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sdYxalRgoHKNZPd8CWNWCrA4UjagScww6VkApyC4MhZVKe9rOSXFErzcIVFgXbll4AslBT7TO/pNvsdkDUVKVEX4yAepZuYxABpNycRHe9dAJMh6cnlsrXLYhlgwKDnKNImiT/Y/7GIVuICyOyGPmmg35oOzUrsnXP5h1JrBr8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J0IHf/Al; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J0IHf/Al" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CEFAC433F1; Sun, 24 Mar 2024 23:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324318; bh=lADsJniJZHzbQRfYWEvMrBb8j0yKXv7+WxDIULm0MAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J0IHf/Alu+nB+HsU4bIEuPIHKx7eWUdMggiugDZMH2UNsfYIBA6kIn75AC8OX0Vug WAJcY9sbcd7Io9NsDD/sLPcuF32ejC9XCH9/sKy7rM5OwDxfhvLVVnaXYi7DDKbmZB YAcCyuBBkBGFKqRRPAb1Ftdg4cL4+HjDj/pxNPYQZ2a+2RxpG/docDiX0ibHThOVgf 6O7opwtt1OdbIBxoJUA1NQojR25lqYyQIhYggRBc0XqRytJeHryi4L3XHoSwM4tw0n 0zCFrYn66FwPfO1vwOOTw5lcP70lzUnkngGGjeJXWq5ys3/iG3IiH3kMsYpE33NFC0 r43Fj1Ccf8kSw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 089/148] clk: qcom: reset: support resetting multiple bits Date: Sun, 24 Mar 2024 19:49:13 -0400 Message-ID: <20240324235012.1356413-90-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit 4a5210893625f89723ea210d7c630b730abb37ad ] This patch adds the support for giving the complete bitmask in reset structure and reset operation will use this bitmask for all reset operations. Currently, reset structure only takes a single bit for each reset and then calculates the bitmask by using the BIT() macro. However, this is not sufficient anymore for newer SoC-s like IPQ8074, IPQ6018 and more, since their networking resets require multiple bits to be asserted in order to properly reset the HW block completely. So, in order to allow asserting multiple bits add "bitmask" field to qcom_reset_map, and then use that bitmask value if its populated in the driver, if its not populated, then we just default to existing behaviour and calculate the bitmask on the fly. Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20221107132901.489240-1-robimarko@gmail.com Stable-dep-of: 2f8cf2c3f3e3 ("clk: qcom: reset: Ensure write completion on = reset de/assertion") Signed-off-by: Sasha Levin --- drivers/clk/qcom/reset.c | 4 ++-- drivers/clk/qcom/reset.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c index fc68c8fa30ac7..60b60631c3445 100644 --- a/drivers/clk/qcom/reset.c +++ b/drivers/clk/qcom/reset.c @@ -38,7 +38,7 @@ qcom_reset_assert(struct reset_controller_dev *rcdev, uns= igned long id) =20 rst =3D to_qcom_reset_controller(rcdev); map =3D &rst->reset_map[id]; - mask =3D BIT(map->bit); + mask =3D map->bitmask ? map->bitmask : BIT(map->bit); =20 return regmap_update_bits(rst->regmap, map->reg, mask, mask); } @@ -52,7 +52,7 @@ qcom_reset_deassert(struct reset_controller_dev *rcdev, u= nsigned long id) =20 rst =3D to_qcom_reset_controller(rcdev); map =3D &rst->reset_map[id]; - mask =3D BIT(map->bit); + mask =3D map->bitmask ? map->bitmask : BIT(map->bit); =20 return regmap_update_bits(rst->regmap, map->reg, mask, 0); } diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h index 3e30f6724c7a4..a118311503d41 100644 --- a/drivers/clk/qcom/reset.h +++ b/drivers/clk/qcom/reset.h @@ -20,6 +20,7 @@ struct qcom_reset_map { unsigned int reg; u8 bit; u8 udelay; + u32 bitmask; }; =20 struct regmap; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A89435D8E4; Sun, 24 Mar 2024 23:51:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324319; cv=none; b=lUEHNglFoc7NOqHrG6/BRuqDc8rA/20SRfmLxTi0EXfCzHYYn3ZEJbiqLzfwStGuBmmFUUnXLIFQnMKktpeTdxmdcWUWY0La3gEfVxRQCon3czEwZlh2H+AsaH8OQPMy3LFWvq/ltCjPIR7T9p2s64lwUEazBuGPhzdyqN1jPXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324319; c=relaxed/simple; bh=scI6lGnl7mC+3v3Tva6fJDWXp2yAMb5siCGv3tnO+S0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c9mke9EH5487V1GSblps4DEvdfXiWXdBKJ27/xxd7ArhpAVtZ6hm0Lp7PMUmAWEeyWAqS1JpgV/xIKGLWmL37A2nrpbMXVmBWKpNHoX73e9HV8+LygjeUpNILa7IPjbhSwuqnKEMd5Kh2MLWXXmMiYkUqQlxuC/nQsGi7DJlCKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UfZhh0rJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UfZhh0rJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 697BBC43390; Sun, 24 Mar 2024 23:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324319; bh=scI6lGnl7mC+3v3Tva6fJDWXp2yAMb5siCGv3tnO+S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfZhh0rJwJbuHVV5ZRs8ERUN1ejJq5YR9VRTVZ0ww0EBVa7bWrusROXPK9GL5xAR/ 7nq6lvP9iJk2wBt69KnELM96b85GZ99w8+8SEBa9dDwoBZ6B8u9cfaBl6mHcSWhlGW yXKIB6GRg3adk2AUsMb34x9noVQSFEk0x3ve8sQY4YiT0T6o9JUpcnS6+PBwbWA8P/ 0mO/X5Vsr/Ls0ZLYi8GgraJTdMkoJ98xAufhUE0r350vmXSrZYDm5VcPJ85mjX4s/D uXhzNJ+ehPHE2efRJzqdtFVBfHpFv9sWDwjZJMb6Vnnd3oOeP+GSHypz6wrpnoJq8Q xKt89wiM9U6zQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Konrad Dybcio , Bryan O'Donoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 090/148] clk: qcom: reset: Commonize the de/assert functions Date: Sun, 24 Mar 2024 19:49:14 -0400 Message-ID: <20240324235012.1356413-91-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit eda40d9c583e95e0b6ac69d2950eec10f802e0e8 ] They do the same thing, except the last argument of the last function call differs. Commonize them. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio Link: https://lore.kernel.org/r/20240105-topic-venus_reset-v2-2-c37eba13b5c= e@linaro.org Signed-off-by: Bjorn Andersson Stable-dep-of: 2f8cf2c3f3e3 ("clk: qcom: reset: Ensure write completion on = reset de/assertion") Signed-off-by: Sasha Levin --- drivers/clk/qcom/reset.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c index 60b60631c3445..252d7abf577e3 100644 --- a/drivers/clk/qcom/reset.c +++ b/drivers/clk/qcom/reset.c @@ -29,8 +29,8 @@ static int qcom_reset(struct reset_controller_dev *rcdev,= unsigned long id) return 0; } =20 -static int -qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) +static int qcom_reset_set_assert(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) { struct qcom_reset_controller *rst; const struct qcom_reset_map *map; @@ -40,21 +40,17 @@ qcom_reset_assert(struct reset_controller_dev *rcdev, u= nsigned long id) map =3D &rst->reset_map[id]; mask =3D map->bitmask ? map->bitmask : BIT(map->bit); =20 - return regmap_update_bits(rst->regmap, map->reg, mask, mask); + return regmap_update_bits(rst->regmap, map->reg, mask, assert ? mask : 0); } =20 -static int -qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id) +static int qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned = long id) { - struct qcom_reset_controller *rst; - const struct qcom_reset_map *map; - u32 mask; - - rst =3D to_qcom_reset_controller(rcdev); - map =3D &rst->reset_map[id]; - mask =3D map->bitmask ? map->bitmask : BIT(map->bit); + return qcom_reset_set_assert(rcdev, id, true); +} =20 - return regmap_update_bits(rst->regmap, map->reg, mask, 0); +static int qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigne= d long id) +{ + return qcom_reset_set_assert(rcdev, id, false); } =20 const struct reset_control_ops qcom_reset_ops =3D { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D54D296BA3; Sun, 24 Mar 2024 23:52:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324321; cv=none; b=gliF+3sdzrcMcbpw1FYqh8N/TBtqvLzBmRoqHIRr1QUiyKDsxAV1A8B8UQ5tQ0srVINCY/WEsS8HhdSl74BBHwdGR256wr0L+0dmQnyXbYiIrIXeHz8HADF1nUVdUIj+Dwni3ld4eNKEDsuQolOXhPVs1Z4vdUQh1MzTHkazGQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324321; c=relaxed/simple; bh=inW2J0Jzb+uXUTJeTih5K0+7+5J240UsLGu8g35ShlE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LOuCPOquid1n38187/ajjvkb9YcL1XaD9UyGO6+vcj2tVBY9A7AoIkCNwAdMntTlDca4BmplAY1yHPewbcJf1bodONMTZbxEnSh+fC2xET5cZGx7ePOMdjJ8zzx4JfJMIHbkWX0iw7vf7AsfUr+5uxF5vFWX4El2S73rGbDrf24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G10bMdEO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G10bMdEO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7878EC433F1; Sun, 24 Mar 2024 23:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324320; bh=inW2J0Jzb+uXUTJeTih5K0+7+5J240UsLGu8g35ShlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G10bMdEOMBw+cIIAUYJbp7nIXTI88H+K+tqorvxecDxgr/wITs1N9jRmwNr8HsDci +zSPqzUdB6nzyIJTg5wMyXFz1pP0isEhwHa+XOlK2SoGxhygOS3cH6YMq10a1ttjLX aGEjUP1I8H5ohvrk6PrT8/pCmgZwhwRKc9I1KmJg+gjfEOmsnAf70DcBKURAxXGHUF cMfY0Q2eK+/DUIWse13VxTvNa0Ju+MUkvlZnupNjn6CU1aUEAqOFGkMBBhRSst7O9c /GLRFsVvCX5Bwhd2BR+KFhsw9I4dZjZ7LbnNdtwDyCl6dU/MOBw7EakKxaEwGfofq9 QqMGyRd/MapUQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 091/148] clk: qcom: reset: Ensure write completion on reset de/assertion Date: Sun, 24 Mar 2024 19:49:15 -0400 Message-ID: <20240324235012.1356413-92-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 2f8cf2c3f3e3f7ef61bd19abb4b0bb797ad50aaf ] Trying to toggle the resets in a rapid fashion can lead to the changes not actually arriving at the clock controller block when we expect them to. This was observed at least on SM8250. Read back the value after regmap_update_bits to ensure write completion. Fixes: b36ba30c8ac6 ("clk: qcom: Add reset controller support") Signed-off-by: Konrad Dybcio Link: https://lore.kernel.org/r/20240105-topic-venus_reset-v2-3-c37eba13b5c= e@linaro.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/clk/qcom/reset.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c index 252d7abf577e3..3a1cfc2dd94c9 100644 --- a/drivers/clk/qcom/reset.c +++ b/drivers/clk/qcom/reset.c @@ -40,7 +40,12 @@ static int qcom_reset_set_assert(struct reset_controller= _dev *rcdev, map =3D &rst->reset_map[id]; mask =3D map->bitmask ? map->bitmask : BIT(map->bit); =20 - return regmap_update_bits(rst->regmap, map->reg, mask, assert ? mask : 0); + regmap_update_bits(rst->regmap, map->reg, mask, assert ? mask : 0); + + /* Read back the register to ensure write completion, ignore the value */ + regmap_read(rst->regmap, map->reg, &mask); + + return 0; } =20 static int qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned = long id) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F993296BA2; Sun, 24 Mar 2024 23:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324321; cv=none; b=r6ci0/iW+MnEIcnCWJ/abztLUktCyiClgl9JPeF9mLFlMbRoWYFjpkwTcbM+tZEThrnfLxC8A+T4R+/MC9POq2CBwC6LhmmPBLmNJ2JMFEF69SiQSCoOH0/osmDxDq169gVUtPWRDPra5tCc3VCp0kt9IHVx5I2PUO8nk9ekMGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324321; c=relaxed/simple; bh=j88f6MVWIj6QWwWfbnjDtoeTnPFD2JD3YzW5KfJVf3k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SO7SERxzb6ZknVqc5oXRlc4U9NYxJ+KTNhHrTb1Wtyks2lGBlGICqIbN7zrHkxTuV87qnKbwvWehOMBO0aS5J1UBPLwsXH8DAZ7GMTPzVKM8H0kP4cWxwy0U79pj+wm+UPGlFfAhle/cbRcgq/o6YzcGX8itBrQ0QQpisMjyAfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M4l/D5Bc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M4l/D5Bc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2293C433C7; Sun, 24 Mar 2024 23:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324321; bh=j88f6MVWIj6QWwWfbnjDtoeTnPFD2JD3YzW5KfJVf3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M4l/D5Bct9FjdDNI0UfIiNAI2AHaeo3YFVGUafl62Za/pCyWwYRUND0oLBvcvVw7G 0xcjbsgh9Eq00UfXgxH1IICnfZuKiwKjKb+R7D2RSSx8OBs+OaJPvFp/cdpMYaU8lP k2RWIXRaB/QEVL7MTq0I8UFvqSME1WIVIcAzjPP7NjCRJQQ/VMws0jzeL8uH+Za+rf JNRpPDv28lwbA+ojCJfRGHQ+9t4TLNepvUIOLHc5d1z/CrbNVf4FQvLLfiJP+cr4vi FXrCCZLMJ4ywtk9JfjXJgkbh9CBMcq0o2WI3c5yxQGtrOYAhnzSxFRsVGnNsQHhujq oc7eNJChpKzxQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chengguang Xu , Jan Kara , Sasha Levin Subject: [PATCH 4.19 092/148] quota: code cleanup for __dquot_alloc_space() Date: Sun, 24 Mar 2024 19:49:16 -0400 Message-ID: <20240324235012.1356413-93-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Chengguang Xu [ Upstream commit df15a2a59d0b29d86e17140b83ed231adaded12f ] Replace (flags & DQUOT_SPACE_RESERVE) with variable reserve. Signed-off-by: Chengguang Xu Signed-off-by: Jan Kara Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot poi= nters") Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 868936076f41d..683727c5758c0 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1743,7 +1743,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t = number, int flags) for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { if (!dquots[cnt]) continue; - if (flags & DQUOT_SPACE_RESERVE) { + if (reserve) { ret =3D dquot_add_space(dquots[cnt], 0, number, flags, &warn[cnt]); } else { @@ -1756,7 +1756,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t = number, int flags) if (!dquots[cnt]) continue; spin_lock(&dquots[cnt]->dq_dqb_lock); - if (flags & DQUOT_SPACE_RESERVE) { + if (reserve) { dquots[cnt]->dq_dqb.dqb_rsvspace -=3D number; } else { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C83D296BA9; Sun, 24 Mar 2024 23:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324322; cv=none; b=npn15b92koY/rwAb5aIIMK5aS+qujzh7FzUhtba81t6gnvTemMl+L89tQpMGyQTN9iqfESNW0AJyw3vSHuOHT2MySFlJ0L/YtFTi9yeuo88Jvt5FPfJn/8L6mP1P21WgSriXJi/V4dqbjV6/4ADVeJN8LNWVxVVvhhLRwgeHjcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324322; c=relaxed/simple; bh=v2O7Te2gUiMryxEplDSahEdoCwle9NUThvljuAWldk8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SDZSgaatIH9gRQ2aofSkUKHO9QWZknFCw+XwXS+9pUldofPzepzvnhtwIIBcv+8qOgvSESXwJKd66SIbM3F9vF/FepGEUzzm4nIuKCtm/eQ7eJczspuURzMOd/Y/HDZCQ1QId/9mMOd18+7wZICXgET4eDGIYvU3cEmRJeyuSUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qCTk7SUS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qCTk7SUS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3A43C43390; Sun, 24 Mar 2024 23:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324322; bh=v2O7Te2gUiMryxEplDSahEdoCwle9NUThvljuAWldk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCTk7SUSDu0tfaWODCgr7vcmS7OLiUPoK8NQ9k2tmBlm4s67dFBwu3BkAIdO5AfUt cAeyktC2Y5XdHDMtZZcoEZ7T/SPuvYa7nZlu+aQv99gg5two2DxOZSFvbVj6g/w9Ux /z6RLjISKeCA8HLldtfUItBkJihlZ4Ic3jbthBsiWlKiidm0LagJxd/xBC1z2ZW8Ij 23pXJfMnbh7tZc68YKnIceksgnnKXhCJzuobFA5VKqjjfxmT0LvoX5kYDJp8WxImwh yMCrRHxFliPC2h9/aKu17IP8nawfZY9KIjRYuDDR7Fp04rY0LVkEfCEXb7ZJKt5cdE W6QW/KUre+pKA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jiang Biao , Jan Kara , Sasha Levin Subject: [PATCH 4.19 093/148] fs/quota: erase unused but set variable warning Date: Sun, 24 Mar 2024 19:49:17 -0400 Message-ID: <20240324235012.1356413-94-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jiang Biao [ Upstream commit 78bc3334a69ff289dbc973a9db7c52a2d7757e5b ] Local variable *reserved* of remove_dquot_ref() is only used if define CONFIG_QUOTA_DEBUG, but not ebraced in CONFIG_QUOTA_DEBUG macro, which leads to unused-but-set-variable warning when compiling. This patch ebrace it into CONFIG_QUOTA_DEBUG macro like what is done in add_dquot_ref(). Signed-off-by: Jiang Biao Signed-off-by: Jan Kara Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot poi= nters") Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 683727c5758c0..b55d91d3d87c2 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1129,7 +1129,9 @@ static void remove_dquot_ref(struct super_block *sb, = int type, struct list_head *tofree_head) { struct inode *inode; +#ifdef CONFIG_QUOTA_DEBUG int reserved =3D 0; +#endif =20 spin_lock(&sb->s_inode_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { @@ -1141,8 +1143,10 @@ static void remove_dquot_ref(struct super_block *sb,= int type, */ spin_lock(&dq_data_lock); if (!IS_NOQUOTA(inode)) { +#ifdef CONFIG_QUOTA_DEBUG if (unlikely(inode_get_rsv_space(inode) > 0)) reserved =3D 1; +#endif remove_inode_dquot_ref(inode, type, tofree_head); } spin_unlock(&dq_data_lock); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C752296BB1; Sun, 24 Mar 2024 23:52:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324323; cv=none; b=JsxhaTJJY0q0AGnOmJgmBdAjjG0vIkXRa35POt2bR/fcBzKW7dzX/7VOyxqUjBPeRKpZCOZi84+SS54X1LAd67GFVj0Qzw7Pca+ojTOa/Ei8KvtsFVWTwKyNJPTvq487uC0ZTYkX7vxyJvwY9ssHaKaDO3iw6Tyxoj1Y1KFZZrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324323; c=relaxed/simple; bh=vFwkb/ECA43oJr9FZc50G4ViBhPU2rPobIrvVl1aWxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s984+d8ol0QZez2qyDku5HgacWM8XrnoVtFRa0k4tyXC2V6ijR0WzfeoQ5iCToezrrtrA8QgQAkhhhZ4+lBxbhrYFZMWu5TYsKvPIP8fi26WAWVQ23P+gbwRr0JEHVLu+RzStTnSVqIVX7Ij4UyyrLN/vZXDKcBWgRxitbZL1yg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E4QB37Ry; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E4QB37Ry" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91D74C433C7; Sun, 24 Mar 2024 23:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324323; bh=vFwkb/ECA43oJr9FZc50G4ViBhPU2rPobIrvVl1aWxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4QB37Ry6yrpDepTTiXZdUfKFqp7VZHp4xDFoubKjiaQmtyv9RKm77Xov/cJrC3P1 IPTld1V2DL2QbwvFcMejsRaN/p5HCDqY01bywR8yxDN3mCIs4LP9E6z6to0PYIZUV9 PLJHfOFz4GWPVDTwFocg9IDk4qNOHu57kn5au7hou14UE+pnQ5BMYlRHPk8eKkR6td DFGJBDI/Db19+qOOEeYumQfIsEN5PKDE0fMFgvxluXbNLHrWJWiD8r0WDHesH6llJU eM6b5RI20LBvlXXBlEU8PQN550Gx+2fAx7lY77VE8dAXg0SB25Qzcl5NTeMyIdRhYU Gu1UXF+ewwWVQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chengguang Xu , Jan Kara , Sasha Levin Subject: [PATCH 4.19 094/148] quota: check time limit when back out space/inode change Date: Sun, 24 Mar 2024 19:49:18 -0400 Message-ID: <20240324235012.1356413-95-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Chengguang Xu [ Upstream commit 632a9f3acd6687376cbb0b178df6048e19cbacc9 ] When we fail from allocating inode/space, we back out the change we already did. In a special case which has exceeded soft limit by the change, we should also check time limit and reset it properly. Signed-off-by: Chengguang Xu Signed-off-by: Jan Kara Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot poi= nters") Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index b55d91d3d87c2..895636fd655f6 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1760,13 +1760,11 @@ int __dquot_alloc_space(struct inode *inode, qsize_= t number, int flags) if (!dquots[cnt]) continue; spin_lock(&dquots[cnt]->dq_dqb_lock); - if (reserve) { - dquots[cnt]->dq_dqb.dqb_rsvspace -=3D - number; - } else { - dquots[cnt]->dq_dqb.dqb_curspace -=3D - number; - } + if (reserve) + dquot_free_reserved_space(dquots[cnt], + number); + else + dquot_decr_space(dquots[cnt], number); spin_unlock(&dquots[cnt]->dq_dqb_lock); } spin_unlock(&inode->i_lock); @@ -1817,7 +1815,7 @@ int dquot_alloc_inode(struct inode *inode) continue; /* Back out changes we already did */ spin_lock(&dquots[cnt]->dq_dqb_lock); - dquots[cnt]->dq_dqb.dqb_curinodes--; + dquot_decr_inodes(dquots[cnt], 1); spin_unlock(&dquots[cnt]->dq_dqb_lock); } goto warn_put_all; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DB93296BC1; Sun, 24 Mar 2024 23:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324325; cv=none; b=D4qd8IvOmCOrNX+qHbXlqjJR/sjgDzfF7mmLorcx/ODRGy8zDcg8j4GeVLeTP/Jt8TYuVkoE2fDTcSDXKYGtfF1BT1OBHSE1R/d8PpStWXllRLYeCsTWOaFL1EwDQNE2ws7nAQztjko8YvkfyNTnZf7HjIVPyNA192yZbNxFU50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324325; c=relaxed/simple; bh=fHsIk2F+tT+hNKQUTOKDjMGFCBH6cPvUL/nt2XFd5/8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KGS0Cad5dwRxWgG6zfo6+BFm2IJoXVSLtdyO0xzy/SXNgwkTZNiiSLXw3VjsQ49ajmli+kU9pYEbHTkyuwkhoXnU6p7hOw8Uj1YoKJF6Yrv4xl+MjzYc6uwVWZ7GHyzIwQ8pecV3yZuMorynKHVlYOppQelGaW8NfsU7J7w5pvs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SWjHuBgD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SWjHuBgD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 842E1C43394; Sun, 24 Mar 2024 23:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324324; bh=fHsIk2F+tT+hNKQUTOKDjMGFCBH6cPvUL/nt2XFd5/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SWjHuBgDtMXAdm4PChYzrHNXZDt/aURL2Zv0qH/lO1BDH38ndeFRN9XW5zH3hOnVm Cxyt2tj7jxU1NPHFNkTOUe3CYR6GN9+4iPqM07P8SVhEFiQBI1ULSD5wCoYzpV3TfN VtG4fFTxtcrsIvaDXc52OrSaahrQfM+DxhltRmZedMFwPW25CsNhPJhkN2jzUs+c9Z SnaS/gODicZFCOGYLu2e+urOhJR1AB5Mm2fqIVOIhVrVyK720MUTOwP3eqcI61Xcic p2K1KdmM3LygAeubzl69jWg8R+hqe1PHkh01b2BudshR7Gh/P0yKybIh4Vki7g0sFO YaJddQaMwuw4g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Baokun Li , Jan Kara , Sasha Levin Subject: [PATCH 4.19 095/148] quota: simplify drop_dquot_ref() Date: Sun, 24 Mar 2024 19:49:19 -0400 Message-ID: <20240324235012.1356413-96-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit 7bce48f0fec602b3b6c335963b26d9eefa417788 ] As Honza said, remove_inode_dquot_ref() currently does not release the last dquot reference but instead adds the dquot to tofree_head list. This is because dqput() can sleep while dropping of the last dquot reference (writing back the dquot and calling ->release_dquot()) and that must not happen under dq_list_lock. Now that dqput() queues the final dquot cleanup into a workqueue, remove_inode_dquot_ref() can call dqput() unconditionally and we can significantly simplify it. Here we open code the simplified code of remove_inode_dquot_ref() into remove_dquot_ref() and remove the function put_dquot_list() which is no longer used. Signed-off-by: Baokun Li Signed-off-by: Jan Kara Message-Id: <20230630110822.3881712-6-libaokun1@huawei.com> Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot poi= nters") Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 70 +++++++----------------------------------------- 1 file changed, 9 insertions(+), 61 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 895636fd655f6..dd9c381b874fd 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1074,59 +1074,7 @@ static int add_dquot_ref(struct super_block *sb, int= type) return err; } =20 -/* - * Remove references to dquots from inode and add dquot to list for freeing - * if we have the last reference to dquot - */ -static void remove_inode_dquot_ref(struct inode *inode, int type, - struct list_head *tofree_head) -{ - struct dquot **dquots =3D i_dquot(inode); - struct dquot *dquot =3D dquots[type]; - - if (!dquot) - return; - - dquots[type] =3D NULL; - if (list_empty(&dquot->dq_free)) { - /* - * The inode still has reference to dquot so it can't be in the - * free list - */ - spin_lock(&dq_list_lock); - list_add(&dquot->dq_free, tofree_head); - spin_unlock(&dq_list_lock); - } else { - /* - * Dquot is already in a list to put so we won't drop the last - * reference here. - */ - dqput(dquot); - } -} - -/* - * Free list of dquots - * Dquots are removed from inodes and no new references can be got so we a= re - * the only ones holding reference - */ -static void put_dquot_list(struct list_head *tofree_head) -{ - struct list_head *act_head; - struct dquot *dquot; - - act_head =3D tofree_head->next; - while (act_head !=3D tofree_head) { - dquot =3D list_entry(act_head, struct dquot, dq_free); - act_head =3D act_head->next; - /* Remove dquot from the list so we won't have problems... */ - list_del_init(&dquot->dq_free); - dqput(dquot); - } -} - -static void remove_dquot_ref(struct super_block *sb, int type, - struct list_head *tofree_head) +static void remove_dquot_ref(struct super_block *sb, int type) { struct inode *inode; #ifdef CONFIG_QUOTA_DEBUG @@ -1143,11 +1091,16 @@ static void remove_dquot_ref(struct super_block *sb= , int type, */ spin_lock(&dq_data_lock); if (!IS_NOQUOTA(inode)) { + struct dquot **dquots =3D i_dquot(inode); + struct dquot *dquot =3D dquots[type]; + #ifdef CONFIG_QUOTA_DEBUG if (unlikely(inode_get_rsv_space(inode) > 0)) reserved =3D 1; #endif - remove_inode_dquot_ref(inode, type, tofree_head); + dquots[type] =3D NULL; + if (dquot) + dqput(dquot); } spin_unlock(&dq_data_lock); } @@ -1164,13 +1117,8 @@ static void remove_dquot_ref(struct super_block *sb,= int type, /* Gather all references from inodes and drop them */ static void drop_dquot_ref(struct super_block *sb, int type) { - LIST_HEAD(tofree_head); - - if (sb->dq_op) { - remove_dquot_ref(sb, type, &tofree_head); - synchronize_srcu(&dquot_srcu); - put_dquot_list(&tofree_head); - } + if (sb->dq_op) + remove_dquot_ref(sb, type); } =20 static inline --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75E61296BCA; Sun, 24 Mar 2024 23:52:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324326; cv=none; b=cOygnm38zv/dZBcHd9m3qDrAzDCv+aoWycRsIUDQxbvy77MIqhsSPjfYPwDUvv3N20gCfQz5HWuSzxJZRHaUk3C/dXHmUFcUOiAPoIJcnWGFcBDU/Ouz5D+9bEgzehmWefrqUN4lkpiqtOa6eeuiBUeJendr0FD6v9TVqfFZ/5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324326; c=relaxed/simple; bh=paOl2NWjP3PETxonbQe2C2nz6fAWC1jeqqa1EuP7GiE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h6T69SjEzDCBqZj4hiMoGW5aEkc4P0G9Vxupho/hnJPqEnEY5gCIzk/Ccde2+5QZ0m3MNmR1igxvHuBdbbOC2OBgfOhIJgS2PV7RvHr6LtOdAfEOEbkEfb4IEw9oaLHo2KV5tgJ4k2tcKDSAu7GtWz5nO+x5GUE6rH5I6ae1AN0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cL8glapf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cL8glapf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 795EBC433C7; Sun, 24 Mar 2024 23:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324325; bh=paOl2NWjP3PETxonbQe2C2nz6fAWC1jeqqa1EuP7GiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cL8glapfa1JAMD4NEcUAIUaBohlF3MIx2vXDNCnZkQjl0TngO3o5idHQuFhx/AyHT 5ZeuKzyj+g78twbkSQqA+AilfcU1nM5dzE2oJwrXh9E9VX62+6WOcy/WM+lFZkEHHd r9ATjkRL4J2rYxKJ7zQeU+rdHx7yHZbeqgtM93Ga9dYs+4sq04K7pxQbSsBbkDW3wn 0o/c2uCJDPCFVybrjet9V8GsJO0TBWKL/IqLtZOiWweRUsYUPtcm/5LBjse3wIMSdL kjOaiupOjJ6lnh+c7+SzQeaOvEgPaLD8zvmEuT2Ti3g3KPcM669pTmvhKvhZ4wxKT/ YC3UXANkYWIdw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wang Jianjian , Jan Kara , Sasha Levin Subject: [PATCH 4.19 096/148] quota: Fix potential NULL pointer dereference Date: Sun, 24 Mar 2024 19:49:20 -0400 Message-ID: <20240324235012.1356413-97-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Wang Jianjian [ Upstream commit d0aa72604fbd80c8aabb46eda00535ed35570f1f ] Below race may cause NULL pointer dereference P1 P2 dquot_free_inode quota_off drop_dquot_ref remove_dquot_ref dquots =3D i_dquot(inode) dquots =3D i_dquot(inode) srcu_read_lock dquots[cnt]) !=3D NULL (1) dquots[type] =3D NULL (2) spin_lock(&dquots[cnt]->dq_dqb_lock) (3) .... If dquot_free_inode(or other routines) checks inode's quota pointers (1) before quota_off sets it to NULL(2) and use it (3) after that, NULL pointer dereference will be triggered. So let's fix it by using a temporary pointer to avoid this issue. Signed-off-by: Wang Jianjian Signed-off-by: Jan Kara Message-Id: <20240202081852.2514092-1-wangjianjian3@huawei.com> Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot poi= nters") Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 98 ++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 41 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index dd9c381b874fd..133ca865de976 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -399,15 +399,17 @@ int dquot_mark_dquot_dirty(struct dquot *dquot) EXPORT_SYMBOL(dquot_mark_dquot_dirty); =20 /* Dirtify all the dquots - this can block when journalling */ -static inline int mark_all_dquot_dirty(struct dquot * const *dquot) +static inline int mark_all_dquot_dirty(struct dquot * const *dquots) { int ret, err, cnt; + struct dquot *dquot; =20 ret =3D err =3D 0; for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { - if (dquot[cnt]) + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (dquot) /* Even in case of error we have to continue */ - ret =3D mark_dquot_dirty(dquot[cnt]); + ret =3D mark_dquot_dirty(dquot); if (!err) err =3D ret; } @@ -1674,6 +1676,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t = number, int flags) struct dquot_warn warn[MAXQUOTAS]; int reserve =3D flags & DQUOT_SPACE_RESERVE; struct dquot **dquots; + struct dquot *dquot; =20 if (!inode_quota_active(inode)) { if (reserve) { @@ -1693,27 +1696,26 @@ int __dquot_alloc_space(struct inode *inode, qsize_= t number, int flags) index =3D srcu_read_lock(&dquot_srcu); spin_lock(&inode->i_lock); for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { - if (!dquots[cnt]) + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (!dquot) continue; if (reserve) { - ret =3D dquot_add_space(dquots[cnt], 0, number, flags, - &warn[cnt]); + ret =3D dquot_add_space(dquot, 0, number, flags, &warn[cnt]); } else { - ret =3D dquot_add_space(dquots[cnt], number, 0, flags, - &warn[cnt]); + ret =3D dquot_add_space(dquot, number, 0, flags, &warn[cnt]); } if (ret) { /* Back out changes we already did */ for (cnt--; cnt >=3D 0; cnt--) { - if (!dquots[cnt]) + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (!dquot) continue; - spin_lock(&dquots[cnt]->dq_dqb_lock); + spin_lock(&dquot->dq_dqb_lock); if (reserve) - dquot_free_reserved_space(dquots[cnt], - number); + dquot_free_reserved_space(dquot, number); else - dquot_decr_space(dquots[cnt], number); - spin_unlock(&dquots[cnt]->dq_dqb_lock); + dquot_decr_space(dquot, number); + spin_unlock(&dquot->dq_dqb_lock); } spin_unlock(&inode->i_lock); goto out_flush_warn; @@ -1744,6 +1746,7 @@ int dquot_alloc_inode(struct inode *inode) int cnt, ret =3D 0, index; struct dquot_warn warn[MAXQUOTAS]; struct dquot * const *dquots; + struct dquot *dquot; =20 if (!inode_quota_active(inode)) return 0; @@ -1754,17 +1757,19 @@ int dquot_alloc_inode(struct inode *inode) index =3D srcu_read_lock(&dquot_srcu); spin_lock(&inode->i_lock); for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { - if (!dquots[cnt]) + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (!dquot) continue; - ret =3D dquot_add_inodes(dquots[cnt], 1, &warn[cnt]); + ret =3D dquot_add_inodes(dquot, 1, &warn[cnt]); if (ret) { for (cnt--; cnt >=3D 0; cnt--) { - if (!dquots[cnt]) + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (!dquot) continue; /* Back out changes we already did */ - spin_lock(&dquots[cnt]->dq_dqb_lock); - dquot_decr_inodes(dquots[cnt], 1); - spin_unlock(&dquots[cnt]->dq_dqb_lock); + spin_lock(&dquot->dq_dqb_lock); + dquot_decr_inodes(dquot, 1); + spin_unlock(&dquot->dq_dqb_lock); } goto warn_put_all; } @@ -1786,6 +1791,7 @@ EXPORT_SYMBOL(dquot_alloc_inode); int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) { struct dquot **dquots; + struct dquot *dquot; int cnt, index; =20 if (!inode_quota_active(inode)) { @@ -1801,9 +1807,8 @@ int dquot_claim_space_nodirty(struct inode *inode, qs= ize_t number) spin_lock(&inode->i_lock); /* Claim reserved quotas to allocated quotas */ for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { - if (dquots[cnt]) { - struct dquot *dquot =3D dquots[cnt]; - + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (dquot) { spin_lock(&dquot->dq_dqb_lock); if (WARN_ON_ONCE(dquot->dq_dqb.dqb_rsvspace < number)) number =3D dquot->dq_dqb.dqb_rsvspace; @@ -1828,6 +1833,7 @@ EXPORT_SYMBOL(dquot_claim_space_nodirty); void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number) { struct dquot **dquots; + struct dquot *dquot; int cnt, index; =20 if (!inode_quota_active(inode)) { @@ -1843,9 +1849,8 @@ void dquot_reclaim_space_nodirty(struct inode *inode,= qsize_t number) spin_lock(&inode->i_lock); /* Claim reserved quotas to allocated quotas */ for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { - if (dquots[cnt]) { - struct dquot *dquot =3D dquots[cnt]; - + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (dquot) { spin_lock(&dquot->dq_dqb_lock); if (WARN_ON_ONCE(dquot->dq_dqb.dqb_curspace < number)) number =3D dquot->dq_dqb.dqb_curspace; @@ -1872,6 +1877,7 @@ void __dquot_free_space(struct inode *inode, qsize_t = number, int flags) unsigned int cnt; struct dquot_warn warn[MAXQUOTAS]; struct dquot **dquots; + struct dquot *dquot; int reserve =3D flags & DQUOT_SPACE_RESERVE, index; =20 if (!inode_quota_active(inode)) { @@ -1892,17 +1898,18 @@ void __dquot_free_space(struct inode *inode, qsize_= t number, int flags) int wtype; =20 warn[cnt].w_type =3D QUOTA_NL_NOWARN; - if (!dquots[cnt]) + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (!dquot) continue; - spin_lock(&dquots[cnt]->dq_dqb_lock); - wtype =3D info_bdq_free(dquots[cnt], number); + spin_lock(&dquot->dq_dqb_lock); + wtype =3D info_bdq_free(dquot, number); if (wtype !=3D QUOTA_NL_NOWARN) - prepare_warning(&warn[cnt], dquots[cnt], wtype); + prepare_warning(&warn[cnt], dquot, wtype); if (reserve) - dquot_free_reserved_space(dquots[cnt], number); + dquot_free_reserved_space(dquot, number); else - dquot_decr_space(dquots[cnt], number); - spin_unlock(&dquots[cnt]->dq_dqb_lock); + dquot_decr_space(dquot, number); + spin_unlock(&dquot->dq_dqb_lock); } if (reserve) *inode_reserved_space(inode) -=3D number; @@ -1927,6 +1934,7 @@ void dquot_free_inode(struct inode *inode) unsigned int cnt; struct dquot_warn warn[MAXQUOTAS]; struct dquot * const *dquots; + struct dquot *dquot; int index; =20 if (!inode_quota_active(inode)) @@ -1937,16 +1945,16 @@ void dquot_free_inode(struct inode *inode) spin_lock(&inode->i_lock); for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { int wtype; - warn[cnt].w_type =3D QUOTA_NL_NOWARN; - if (!dquots[cnt]) + dquot =3D srcu_dereference(dquots[cnt], &dquot_srcu); + if (!dquot) continue; - spin_lock(&dquots[cnt]->dq_dqb_lock); - wtype =3D info_idq_free(dquots[cnt], 1); + spin_lock(&dquot->dq_dqb_lock); + wtype =3D info_idq_free(dquot, 1); if (wtype !=3D QUOTA_NL_NOWARN) - prepare_warning(&warn[cnt], dquots[cnt], wtype); - dquot_decr_inodes(dquots[cnt], 1); - spin_unlock(&dquots[cnt]->dq_dqb_lock); + prepare_warning(&warn[cnt], dquot, wtype); + dquot_decr_inodes(dquot, 1); + spin_unlock(&dquot->dq_dqb_lock); } spin_unlock(&inode->i_lock); mark_all_dquot_dirty(dquots); @@ -1973,7 +1981,7 @@ int __dquot_transfer(struct inode *inode, struct dquo= t **transfer_to) qsize_t rsv_space =3D 0; qsize_t inode_usage =3D 1; struct dquot *transfer_from[MAXQUOTAS] =3D {}; - int cnt, ret =3D 0; + int cnt, index, ret =3D 0; char is_valid[MAXQUOTAS] =3D {}; struct dquot_warn warn_to[MAXQUOTAS]; struct dquot_warn warn_from_inodes[MAXQUOTAS]; @@ -2062,8 +2070,16 @@ int __dquot_transfer(struct inode *inode, struct dqu= ot **transfer_to) spin_unlock(&inode->i_lock); spin_unlock(&dq_data_lock); =20 + /* + * These arrays are local and we hold dquot references so we don't need + * the srcu protection but still take dquot_srcu to avoid warning in + * mark_all_dquot_dirty(). + */ + index =3D srcu_read_lock(&dquot_srcu); mark_all_dquot_dirty(transfer_from); mark_all_dquot_dirty(transfer_to); + srcu_read_unlock(&dquot_srcu, index); + flush_warnings(warn_to); flush_warnings(warn_from_inodes); flush_warnings(warn_from_space); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71BEA296BC3; Sun, 24 Mar 2024 23:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324327; cv=none; b=KaVz5JpJh9LMGYj5cyrvlkQIwUDZH+QB8cnj0WDVEmvaqF0Q/zptA0zPmKgZIzuYrRWwc59Dr9w9xUott4elZWoMS6de8F70Or+3vuyS4CCp5/GFjTbUWR8G0oiMlNepqTyVGYwygOfrYd25ivYWgu0rvZuHIVCKIt4VnaYye5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324327; c=relaxed/simple; bh=pQnA4IcKGV7FFiBT7LgGM0PTBP2YnaYluDU1LXQhSYU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cqe8assMiceu5LrGJghd0hY/14ElYVkqNifIvutvynpKrKUaIAomIA5y1v4MeiMkR94ABObRXKFU+utoWKf62QIsv29Wt6GtteHUdupJFEbs6eBJ1RrSk7aT7lENzyB+z2AwpssNnS0Pd0y1mnTuMR5ORNbE9BJZOy1z46xX4uw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g3jSUZMb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g3jSUZMb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91CE3C43399; Sun, 24 Mar 2024 23:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324326; bh=pQnA4IcKGV7FFiBT7LgGM0PTBP2YnaYluDU1LXQhSYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3jSUZMb4SHmTOLuZmHsCye0GuYvyfx62SGoH+8ORicsamFOtBtQ3+HovTtPW7o+a p/4bFO1OeV58T5k9pd7JDuhttWDJE5IvfEknckpXZP4DBBscZJvox0QHoqFkb1kcSs +eqFbNQ/Cdvaijtcnv2cZ/E3ISaQgx7NEJ6S1GSrZ4805KjisKvIccAPkIUIQBV5Bp 1L/PIx4Y+94RRIwmTuUQUZqlrcgerXfGQ0aefphHDR0RFrQtdRvSRcwt/Ts+syViyW Hhh0mVpe00iz4rC++KjALAf5HW4zhxyIwIpsTQJYY8rHddUMLLElO6iIrnvF84RNs5 bx4DzOwWYfSfQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jan Kara , kernel test robot , Sasha Levin Subject: [PATCH 4.19 097/148] quota: Fix rcu annotations of inode dquot pointers Date: Sun, 24 Mar 2024 19:49:21 -0400 Message-ID: <20240324235012.1356413-98-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 179b8c97ebf63429589f5afeba59a181fe70603e ] Dquot pointers in i_dquot array in the inode are protected by dquot_srcu. Annotate the array pointers with __rcu, perform the locked dereferences with srcu_dereference_check() instead of plain reads, and set the array elements with rcu_assign_pointer(). Fixes: b9ba6f94b238 ("quota: remove dqptr_sem") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202402061900.rTuYDlo6-lkp@int= el.com/ Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 66 ++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 133ca865de976..6bdb44fb07a7f 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -399,7 +399,7 @@ int dquot_mark_dquot_dirty(struct dquot *dquot) EXPORT_SYMBOL(dquot_mark_dquot_dirty); =20 /* Dirtify all the dquots - this can block when journalling */ -static inline int mark_all_dquot_dirty(struct dquot * const *dquots) +static inline int mark_all_dquot_dirty(struct dquot __rcu * const *dquots) { int ret, err, cnt; struct dquot *dquot; @@ -996,14 +996,15 @@ struct dquot *dqget(struct super_block *sb, struct kq= id qid) } EXPORT_SYMBOL(dqget); =20 -static inline struct dquot **i_dquot(struct inode *inode) +static inline struct dquot __rcu **i_dquot(struct inode *inode) { - return inode->i_sb->s_op->get_dquots(inode); + /* Force __rcu for now until filesystems are fixed */ + return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots(inode); } =20 static int dqinit_needed(struct inode *inode, int type) { - struct dquot * const *dquots; + struct dquot __rcu * const *dquots; int cnt; =20 if (IS_NOQUOTA(inode)) @@ -1093,14 +1094,16 @@ static void remove_dquot_ref(struct super_block *sb= , int type) */ spin_lock(&dq_data_lock); if (!IS_NOQUOTA(inode)) { - struct dquot **dquots =3D i_dquot(inode); - struct dquot *dquot =3D dquots[type]; + struct dquot __rcu **dquots =3D i_dquot(inode); + struct dquot *dquot =3D srcu_dereference_check( + dquots[type], &dquot_srcu, + lockdep_is_held(&dq_data_lock)); =20 #ifdef CONFIG_QUOTA_DEBUG if (unlikely(inode_get_rsv_space(inode) > 0)) reserved =3D 1; #endif - dquots[type] =3D NULL; + rcu_assign_pointer(dquots[type], NULL); if (dquot) dqput(dquot); } @@ -1453,7 +1456,8 @@ static int inode_quota_active(const struct inode *ino= de) static int __dquot_initialize(struct inode *inode, int type) { int cnt, init_needed =3D 0; - struct dquot **dquots, *got[MAXQUOTAS] =3D {}; + struct dquot __rcu **dquots; + struct dquot *got[MAXQUOTAS] =3D {}; struct super_block *sb =3D inode->i_sb; qsize_t rsv; int ret =3D 0; @@ -1528,7 +1532,7 @@ static int __dquot_initialize(struct inode *inode, in= t type) if (!got[cnt]) continue; if (!dquots[cnt]) { - dquots[cnt] =3D got[cnt]; + rcu_assign_pointer(dquots[cnt], got[cnt]); got[cnt] =3D NULL; /* * Make quota reservation system happy if someone @@ -1536,12 +1540,16 @@ static int __dquot_initialize(struct inode *inode, = int type) */ rsv =3D inode_get_rsv_space(inode); if (unlikely(rsv)) { + struct dquot *dquot =3D srcu_dereference_check( + dquots[cnt], &dquot_srcu, + lockdep_is_held(&dq_data_lock)); + spin_lock(&inode->i_lock); /* Get reservation again under proper lock */ rsv =3D __inode_get_rsv_space(inode); - spin_lock(&dquots[cnt]->dq_dqb_lock); - dquots[cnt]->dq_dqb.dqb_rsvspace +=3D rsv; - spin_unlock(&dquots[cnt]->dq_dqb_lock); + spin_lock(&dquot->dq_dqb_lock); + dquot->dq_dqb.dqb_rsvspace +=3D rsv; + spin_unlock(&dquot->dq_dqb_lock); spin_unlock(&inode->i_lock); } } @@ -1563,7 +1571,7 @@ EXPORT_SYMBOL(dquot_initialize); =20 bool dquot_initialize_needed(struct inode *inode) { - struct dquot **dquots; + struct dquot __rcu **dquots; int i; =20 if (!inode_quota_active(inode)) @@ -1588,13 +1596,14 @@ EXPORT_SYMBOL(dquot_initialize_needed); static void __dquot_drop(struct inode *inode) { int cnt; - struct dquot **dquots =3D i_dquot(inode); + struct dquot __rcu **dquots =3D i_dquot(inode); struct dquot *put[MAXQUOTAS]; =20 spin_lock(&dq_data_lock); for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { - put[cnt] =3D dquots[cnt]; - dquots[cnt] =3D NULL; + put[cnt] =3D srcu_dereference_check(dquots[cnt], &dquot_srcu, + lockdep_is_held(&dq_data_lock)); + rcu_assign_pointer(dquots[cnt], NULL); } spin_unlock(&dq_data_lock); dqput_all(put); @@ -1602,7 +1611,7 @@ static void __dquot_drop(struct inode *inode) =20 void dquot_drop(struct inode *inode) { - struct dquot * const *dquots; + struct dquot __rcu * const *dquots; int cnt; =20 if (IS_NOQUOTA(inode)) @@ -1675,7 +1684,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t = number, int flags) int cnt, ret =3D 0, index; struct dquot_warn warn[MAXQUOTAS]; int reserve =3D flags & DQUOT_SPACE_RESERVE; - struct dquot **dquots; + struct dquot __rcu **dquots; struct dquot *dquot; =20 if (!inode_quota_active(inode)) { @@ -1745,7 +1754,7 @@ int dquot_alloc_inode(struct inode *inode) { int cnt, ret =3D 0, index; struct dquot_warn warn[MAXQUOTAS]; - struct dquot * const *dquots; + struct dquot __rcu * const *dquots; struct dquot *dquot; =20 if (!inode_quota_active(inode)) @@ -1790,7 +1799,7 @@ EXPORT_SYMBOL(dquot_alloc_inode); */ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) { - struct dquot **dquots; + struct dquot __rcu **dquots; struct dquot *dquot; int cnt, index; =20 @@ -1832,7 +1841,7 @@ EXPORT_SYMBOL(dquot_claim_space_nodirty); */ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number) { - struct dquot **dquots; + struct dquot __rcu **dquots; struct dquot *dquot; int cnt, index; =20 @@ -1876,7 +1885,7 @@ void __dquot_free_space(struct inode *inode, qsize_t = number, int flags) { unsigned int cnt; struct dquot_warn warn[MAXQUOTAS]; - struct dquot **dquots; + struct dquot __rcu **dquots; struct dquot *dquot; int reserve =3D flags & DQUOT_SPACE_RESERVE, index; =20 @@ -1933,7 +1942,7 @@ void dquot_free_inode(struct inode *inode) { unsigned int cnt; struct dquot_warn warn[MAXQUOTAS]; - struct dquot * const *dquots; + struct dquot __rcu * const *dquots; struct dquot *dquot; int index; =20 @@ -1980,6 +1989,7 @@ int __dquot_transfer(struct inode *inode, struct dquo= t **transfer_to) qsize_t cur_space; qsize_t rsv_space =3D 0; qsize_t inode_usage =3D 1; + struct dquot __rcu **dquots; struct dquot *transfer_from[MAXQUOTAS] =3D {}; int cnt, index, ret =3D 0; char is_valid[MAXQUOTAS] =3D {}; @@ -2012,6 +2022,7 @@ int __dquot_transfer(struct inode *inode, struct dquo= t **transfer_to) } cur_space =3D __inode_get_bytes(inode); rsv_space =3D __inode_get_rsv_space(inode); + dquots =3D i_dquot(inode); /* * Build the transfer_from list, check limits, and update usage in * the target structures. @@ -2026,7 +2037,8 @@ int __dquot_transfer(struct inode *inode, struct dquo= t **transfer_to) if (!sb_has_quota_active(inode->i_sb, cnt)) continue; is_valid[cnt] =3D 1; - transfer_from[cnt] =3D i_dquot(inode)[cnt]; + transfer_from[cnt] =3D srcu_dereference_check(dquots[cnt], + &dquot_srcu, lockdep_is_held(&dq_data_lock)); ret =3D dquot_add_inodes(transfer_to[cnt], inode_usage, &warn_to[cnt]); if (ret) @@ -2065,7 +2077,7 @@ int __dquot_transfer(struct inode *inode, struct dquo= t **transfer_to) rsv_space); spin_unlock(&transfer_from[cnt]->dq_dqb_lock); } - i_dquot(inode)[cnt] =3D transfer_to[cnt]; + rcu_assign_pointer(dquots[cnt], transfer_to[cnt]); } spin_unlock(&inode->i_lock); spin_unlock(&dq_data_lock); @@ -2076,8 +2088,8 @@ int __dquot_transfer(struct inode *inode, struct dquo= t **transfer_to) * mark_all_dquot_dirty(). */ index =3D srcu_read_lock(&dquot_srcu); - mark_all_dquot_dirty(transfer_from); - mark_all_dquot_dirty(transfer_to); + mark_all_dquot_dirty((struct dquot __rcu **)transfer_from); + mark_all_dquot_dirty((struct dquot __rcu **)transfer_to); srcu_read_unlock(&dquot_srcu, index); =20 flush_warnings(warn_to); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8643C184EE3; Sun, 24 Mar 2024 23:52:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324328; cv=none; b=PEefcilEkjU1k5L/A/Vi4PJVoUUCobfj/R5JIsAnnenUGToKTUWSg6kKniynlE6HH7YfyJ0lPf1XsbZOtFxg2gAyR8hMjmmljTcsjW56rea94+AUxwmGIOGys0E6evtM+JUg2odjTkYiB0ENrfUaO5CO+Ib+bSV6vsRnAYk38pg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324328; c=relaxed/simple; bh=FSd3R12bw/igCt1ElSZBvFnCIQDWQqoLxORK3/TtGwI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XQ8O3xxoM4NeW9vBdmZbV3axvveieMS5KL6SAnYstnqEl06Ne8O6i9csxngRrLMTig9r4ZZUzZMiFGNP8D4uFu3c/W7yp/m3umlrgQr1AQFYq9fSRyF380liieXpGJ6KSR/3RYTt4V1MDXQMcvA6Ju5V21hlScqHYx8ceOqcl2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D6OZGS21; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D6OZGS21" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 965C7C43390; Sun, 24 Mar 2024 23:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324327; bh=FSd3R12bw/igCt1ElSZBvFnCIQDWQqoLxORK3/TtGwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6OZGS21zDHzjUL4+Ro1p0+idV9c3t8u92q23rvNDnR2q0bGYBp6UwPeTvi9senaR aCYRX7nvNqJqRS5U6rUh1fu9CCkqYKF+WMNGFpaLiLsyz6/jqBHkonZIBfuupD8Bas 11byWe0J968PK84ZHRt4shosXVE3XatLoPfP0HIepRHANRJyfkgJW+43K+Arj6KTmj xqJcX9gcuCzaeYXruvZTfxHaH9V6y7H1lgdKk/X8kM2/CguHln0kZzp3hCPBOH2hAK czLJiKIuzRfxBKTwKq5pHQUz6Vc/7wRqR5+YMQvsVkndH2PlR+0YMI9oxxfbi/7Hfm 6KoGTAzoLamnA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Jihong , Arnaldo Carvalho de Melo , Namhyung Kim , Sasha Levin Subject: [PATCH 4.19 098/148] perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str() Date: Sun, 24 Mar 2024 19:49:22 -0400 Message-ID: <20240324235012.1356413-99-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yang Jihong [ Upstream commit 1eb3d924e3c0b8c27388b0583a989d757866efb6 ] slist needs to be freed in both error path and normal path in thread_map__new_by_tid_str(). Fixes: b52956c961be3a04 ("perf tools: Allow multiple threads or processes i= n record, stat, top") Reviewed-by: Arnaldo Carvalho de Melo Signed-off-by: Yang Jihong Signed-off-by: Namhyung Kim Link: https://lore.kernel.org/r/20240206083228.172607-6-yangjihong1@huawei.= com Signed-off-by: Sasha Levin --- tools/perf/util/thread_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index 5d467d8ae9abf..6ee38f2458040 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c @@ -313,13 +313,13 @@ struct thread_map *thread_map__new_by_tid_str(const c= har *tid_str) threads->nr =3D ntasks; } out: + strlist__delete(slist); if (threads) refcount_set(&threads->refcnt, 1); return threads; =20 out_free_threads: zfree(&threads); - strlist__delete(slist); goto out; } =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6B69184EEC; Sun, 24 Mar 2024 23:52:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324329; cv=none; b=j/lIELcI9K4VUD2FZSD6ABUM2BfKwYRuHGmCuVv+ZwMyWWMTwTphrhrSqpIN+VZJRJ2U9Ixf/cjKDRGptSEySoR2uoo+lZez0BgXn4O0kR2I1P9ymTBzzp/PfXM0Spax+eyTky6Hljqg01kqgFd6fzKo1gvbUsk3eJ6Aj4CQGEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324329; c=relaxed/simple; bh=sDG4rOwpzFaELZWsI+4BlWSlAny5s8pTTOdaMh72O5w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nEhj/C8dU4PsaZhdHWnF2ypDurjM7+V1ieR0gr2yYcwvQOvmybS7Si7wPvJMqh93mTFHWTLQPyqYNH3vNT60TWlObUVFCsUPs6RB+YoYbG5JG381IaYuuxj8CyO2ato+ddaAOzjXzTA1zymvRMT2M/75NQawsTdJftgSAIYcdsQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PqSc7+mr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PqSc7+mr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A76E2C43399; Sun, 24 Mar 2024 23:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324328; bh=sDG4rOwpzFaELZWsI+4BlWSlAny5s8pTTOdaMh72O5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqSc7+mro36y0StvWewDCExNMu2Sbvk5kuakSxm5IGte38EykFfuPWsPJ2adKkP8f mP3cpfPm3MJoyczPIM06EXV3BLt1gOR8k2k6LG/cgjdnJsG+L5iskn/2dsSOfWuUU/ AtxXCO6HaNNfzY/MXceGG/+QXkvc2yOlzbw6AXWYwiErHFf+h5J2BZwYCOHQmzCcCM 0WI6uIA5sFkZ0Oj8kH0N93+70sQE3hRpZuoQxP/XTi2wczLbd4o4AavvjuwuUezsYS nXCEAwVoJ34MpWVa9MjVXsy6gj5zeT2BF5jINrsviwxaAF2FW7F3JhDUUuMpfa+6ue oxemAhGLxbLZQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nikita Zhandarovich , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 099/148] drm/radeon/ni: Fix wrong firmware size logging in ni_init_microcode() Date: Sun, 24 Mar 2024 19:49:23 -0400 Message-ID: <20240324235012.1356413-100-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nikita Zhandarovich [ Upstream commit c4891d979c7668b195a0a75787967ec95a24ecef ] Clean up a typo in pr_err() erroneously printing NI MC 'rdev->mc_fw->size' during SMC firmware load. Log 'rdev->smc_fw->size' instead. Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Fixes: 6596afd48af4 ("drm/radeon/kms: add dpm support for btc (v3)") Signed-off-by: Nikita Zhandarovich Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 381b0255ff027..e2f8b68a999af 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -823,7 +823,7 @@ int ni_init_microcode(struct radeon_device *rdev) err =3D 0; } else if (rdev->smc_fw->size !=3D smc_req_size) { pr_err("ni_mc: Bogus length %zu in firmware \"%s\"\n", - rdev->mc_fw->size, fw_name); + rdev->smc_fw->size, fw_name); err =3D -EINVAL; } } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B524D184EF4; Sun, 24 Mar 2024 23:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324330; cv=none; b=NbcYOnnFhCkLqgJ7sF6U/EsyU97faAABOmgy/JvWucgL7Tv/jBC/U71TfiFurBrBv+O1l5vuU+YTy79KeAOvehEZ5fWBWCRE1/synCsRwXXLnAcphUkMu8yZ8/Z8BHFs6UsezP5DPUeRnNgSbOHdnxopkIhxSRph8FIIpXQCLyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324330; c=relaxed/simple; bh=+y0TYPZiAtd+NHd92IK2TWo0iPyidCyhPNGn/a34lRE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ctKdQv7UIg9EfTsYNjWCvTzop6BwdrcBL22Q6eesZyGnndgyvNyefXjewVsW61bDwNEr5EvnHq4B4nBpyaoOptu9uP+JZ/KGwBlXvc7SYziqVm9sFtlfXu14zdZ1L/ZldGL9pnzVy39+9Y3VNPND8Kmdcv5d9HABXHfgRin/duA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qez0EzZj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qez0EzZj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE08AC433F1; Sun, 24 Mar 2024 23:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324329; bh=+y0TYPZiAtd+NHd92IK2TWo0iPyidCyhPNGn/a34lRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qez0EzZjjAy37NcmxfsxCH5XH6HbHJfFaNJNvq1FRXoiaLOZ8FWf3IYhEpIf/0TVd MCYtdxvcS8pXvHl5ktIXJjhuiux0v/s2wiv8W+racL/Q8pNelJ3ljkS0TasZ3LzX32 uDt0kQ/KBdSeTbvfDr3F78eqahKjFbSW/8UOCspTxRLgpffYmmsIG9FEnDMvdwpPUw 7ZICgRP4pvvLRRRACMxdhq/0C3FmF7vI4E82IL/PMm5DSWyn3qHVyu6zYEXa0/xQ9T Fz1DICsm1wL5czx/xR6E55ybrVR2tJXNcipbHIkbdFQXY0D64sGXcNxKaPPdsL13Eh SOkiUuX+Gs1cw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai , Arnd Bergmann , Sasha Levin Subject: [PATCH 4.19 100/148] ALSA: seq: fix function cast warnings Date: Sun, 24 Mar 2024 19:49:24 -0400 Message-ID: <20240324235012.1356413-101-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit d7bf73809849463f76de42aad62c850305dd6c5d ] clang-16 points out a control flow integrity (kcfi) issue when event callbacks get converted to incompatible types: sound/core/seq/seq_midi.c:135:30: error: cast from 'int (*)(struct snd_rawm= idi_substream *, const char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)= (void *, void *, int)') converts to incompatible function type [-Werror,-Wc= ast-function-type-strict] 135 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dum= p_midi, substream); | ^~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~ sound/core/seq/seq_virmidi.c:83:31: error: cast from 'int (*)(struct snd_ra= wmidi_substream *, const unsigned char *, int)' to 'snd_seq_dump_func_t' (a= ka 'int (*)(void *, void *, int)') converts to incompatible function type [= -Werror,-Wcast-function-type-strict] 83 | snd_seq_dump_var_event(ev, (snd_seq_dump_fu= nc_t)snd_rawmidi_receive, vmidi->substream); | ^~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~ For addressing those errors, introduce wrapper functions that are used for callbacks and bridge to the actual function call with pointer cast. The code was originally added with the initial ALSA merge in linux-2.5.4. [ the patch description shamelessly copied from Arnd's original patch -- tiwai ] Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Arnd Bergmann Link: https://lore.kernel.org/r/20240213101020.459183-1-arnd@kernel.org Link: https://lore.kernel.org/r/20240213135343.16411-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/seq/seq_midi.c | 8 +++++++- sound/core/seq/seq_virmidi.c | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 9e0dabd3ce5f5..2bb6f21ac1964 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c @@ -125,6 +125,12 @@ static int dump_midi(struct snd_rawmidi_substream *sub= stream, const char *buf, i return 0; } =20 +/* callback for snd_seq_dump_var_event(), bridging to dump_midi() */ +static int __dump_midi(void *ptr, void *buf, int count) +{ + return dump_midi(ptr, buf, count); +} + static int event_process_midi(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop) { @@ -144,7 +150,7 @@ static int event_process_midi(struct snd_seq_event *ev,= int direct, pr_debug("ALSA: seq_midi: invalid sysex event flags =3D 0x%x\n", ev->fl= ags); return 0; } - snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); + snd_seq_dump_var_event(ev, __dump_midi, substream); snd_midi_event_reset_decode(msynth->parser); } else { if (msynth->parser =3D=3D NULL) diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index af9af89a44d4e..23975b86e1d4b 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -76,6 +76,13 @@ static void snd_virmidi_init_event(struct snd_virmidi *v= midi, /* * decode input event and put to read buffer of each opened file */ + +/* callback for snd_seq_dump_var_event(), bridging to snd_rawmidi_receive(= ) */ +static int dump_to_rawmidi(void *ptr, void *buf, int count) +{ + return snd_rawmidi_receive(ptr, buf, count); +} + static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, struct snd_seq_event *ev, bool atomic) @@ -94,7 +101,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virm= idi_dev *rdev, if (ev->type =3D=3D SNDRV_SEQ_EVENT_SYSEX) { if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) !=3D SNDRV_SEQ_EVENT_LENG= TH_VARIABLE) continue; - snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vm= idi->substream); + snd_seq_dump_var_event(ev, dump_to_rawmidi, vmidi->substream); snd_midi_event_reset_decode(vmidi->parser); } else { len =3D snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A15CE22D892; Sun, 24 Mar 2024 23:52:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324331; cv=none; b=ZX/A8Agusp6FpsmBEA1cU5nUhup4Korbng8BZ8pjjRm911w+EahdTYDAU5ZhiClCiZeZi5P6XVEZo5kRRmnQfd8zwtWBtgMEb3AJhSnbdRyuIIcQWw9BlmUjFHTC8jJGhJv7EB50cJPKUjQkVghE+9qCyuFEtqaN2RwchC2tLSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324331; c=relaxed/simple; bh=OKnaw5oQbcHWIiwkqxdEnLd9NQl2MIeN415S5Zds2L8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lKuTxZ5/1lMKcHwZh9vcVhqGIe775F5oVzk95yzMa6X86ozkn1D7Azx37GF0gSi1L1W3VoECZLSasbWmBkhP7OU4T9Q08DChzT7cM2pwgZfEiWCxq2x2XuxwI2MXNkg3uYInh9kMpqVj5RU2oXrpeNYT/8M/JC0jAWIHUQVrWXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ogRCzPAO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ogRCzPAO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBA61C433C7; Sun, 24 Mar 2024 23:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324330; bh=OKnaw5oQbcHWIiwkqxdEnLd9NQl2MIeN415S5Zds2L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogRCzPAOn9FmxbxwJZWMRw+yu2GveHbvxhgOQqfzmDbzsOwXQZbq6UqVQrcQ9iNif HVp9jqdu78jy7jqVEMEK0JH7limPBYSvRHzgVrnFtHgSzIJsQ6CXvQ2mGgtE28FGes fqP2rEX7mCgyqQ04DPps+KwigwBhFuxQSU2qkZeNKPj3Ue6XH/pfEfwY5ljwDm2+fn RyM8AvkCrb/jxQYjHxBWSEM3d0WC+PXZMbPVQNdGOYvqZ2CnUCpCuUUn3gpPA/J3Ym oAFOgi9a1lUSjwYWAprzijyVfFirTi6tIxQxtvqUwRhq/hVD99Fbcho6ivnANA0Ugv biqYDq/aED60w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniil Dulov , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 101/148] media: go7007: add check of return value of go7007_read_addr() Date: Sun, 24 Mar 2024 19:49:25 -0400 Message-ID: <20240324235012.1356413-102-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Daniil Dulov [ Upstream commit 0b70530ee740861f4776ff724fcc25023df1799a ] If go7007_read_addr() returns error channel is not assigned a value. In this case go to allocfail. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 866b8695d67e ("Staging: add the go7007 video driver") Signed-off-by: Daniil Dulov Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/go7007/go7007-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go70= 07/go7007-usb.c index b84a6f6548610..957c07479713f 100644 --- a/drivers/media/usb/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c @@ -1206,7 +1206,9 @@ static int go7007_usb_probe(struct usb_interface *int= f, u16 channel; =20 /* read channel number from GPIO[1:0] */ - go7007_read_addr(go, 0x3c81, &channel); + if (go7007_read_addr(go, 0x3c81, &channel)) + goto allocfail; + channel &=3D 0x3; go->board_id =3D GO7007_BOARDID_ADLINK_MPG24; usb->board =3D board =3D &board_adlink_mpg24; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BDDD18520B; Sun, 24 Mar 2024 23:52:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324332; cv=none; b=kWAE+6fpH/fdQhK9r1blQSj+ZoNQcNXgHeU1bAXZFN/VTBpJt192l8pjRqTGdnrNUGT0YRh3D7KeIwVNulJHQif2hxF4BQqErKj+xHKL3E39g2WrMFoGpoeDHGzTo06+T2yuCDYGUvkitT1uUAi0cMgw9y6xkXFVrGqFUeUhrD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324332; c=relaxed/simple; bh=5s0pWDmBEPFIOy02KFQp8liTlWUa2O7endpq9tizYYc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nHyC2iGJW/p6JrBPAoMqG4msNYRU3+sAG2ZULbVL9J+I1oprsfbxleowX/AOKEbP8bpzBvTZfS9v13swz3/+DsSLJ944nLiHoyD2S7TDWAZjG3THVeqk8+RY88DxE7apWCn3GP73jVRg00CyY5ugpLzQeY2Lf8raQpANqw5/rHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tVb8LdNd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tVb8LdNd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7D2DC43399; Sun, 24 Mar 2024 23:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324331; bh=5s0pWDmBEPFIOy02KFQp8liTlWUa2O7endpq9tizYYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tVb8LdNdBn0AWBKsCziX53A81poQKGHBDIrX3OzcWcwMnvCYl9ntqCWNfyrNtWjQb 3lcv5qnUcdVdmCKEEQ7c+rRTNsHS8pxOCMm97PNZpidab/KX/kHZZdy1UCj4KhMWf+ CX0yfjR96nFrr4Rne1bMxyWsbPHX/NCZmwKfTGaz1Xp2rRXSAbOG9sdpMtivd/oZki vNOr7mc2g41PPsou1x60zW7NmiR1YmvKqrOvZ8oOlclvH3bqobRTUdvVgpqUaCVeh/ /GMKpAxcakH5umo+dsFWy+A+DU1mXNkzNVuS8d63XEDDPDDlKpvNj0/X0ZGJZbpYuI RuQitMXGGJwyA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 102/148] media: pvrusb2: fix pvr2_stream_callback casts Date: Sun, 24 Mar 2024 19:49:26 -0400 Message-ID: <20240324235012.1356413-103-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 30baa4a96b23add91a87305baaeba82c4e109e1f ] clang-16 complains about a control flow integrity (KCFI) issue in pvrusb2, which casts three different prototypes into pvr2_stream_callback: drivers/media/usb/pvrusb2/pvrusb2-v4l2.c:1070:30: error: cast from 'void (*= )(struct pvr2_v4l2_fh *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)'= ) converts to incompatible function type [-Werror,-Wcast-function-type-stri= ct] 1070 | pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2= _notify,fh); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~ drivers/media/usb/pvrusb2/pvrusb2-context.c:110:6: error: cast from 'void (= *)(struct pvr2_context *)' to 'void (*)(void *)' converts to incompatible f= unction type [-Werror,-Wcast-function-type-strict] 110 | (void (*)(void *))pvr2_cont= ext_notify, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~ drivers/media/usb/pvrusb2/pvrusb2-dvb.c:152:6: error: cast from 'void (*)(s= truct pvr2_dvb_adapter *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)= ') converts to incompatible function type [-Werror,-Wcast-function-type-str= ict] 152 | (pvr2_stream_callback) pvr2_dvb_no= tify, adap); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ Change the functions to actually take a void* argument so the cast is no lo= nger needed. Fixes: bb8ce9d9143c ("V4L/DVB (7682): pvrusb2-dvb: finish up stream & buffe= r handling") Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/pvrusb2/pvrusb2-context.c | 8 ++++---- drivers/media/usb/pvrusb2/pvrusb2-dvb.c | 6 ++++-- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/us= b/pvrusb2/pvrusb2-context.c index 9236463ba269f..28a9cfef8f9f2 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-context.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-context.c @@ -99,8 +99,10 @@ static void pvr2_context_destroy(struct pvr2_context *mp) } =20 =20 -static void pvr2_context_notify(struct pvr2_context *mp) +static void pvr2_context_notify(void *ptr) { + struct pvr2_context *mp =3D ptr; + pvr2_context_set_notify(mp,!0); } =20 @@ -115,9 +117,7 @@ static void pvr2_context_check(struct pvr2_context *mp) pvr2_trace(PVR2_TRACE_CTXT, "pvr2_context %p (initialize)", mp); /* Finish hardware initialization */ - if (pvr2_hdw_initialize(mp->hdw, - (void (*)(void *))pvr2_context_notify, - mp)) { + if (pvr2_hdw_initialize(mp->hdw, pvr2_context_notify, mp)) { mp->video_stream.stream =3D pvr2_hdw_get_video_stream(mp->hdw); /* Trigger interface initialization. By doing this diff --git a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c b/drivers/media/usb/pv= rusb2/pvrusb2-dvb.c index 4b32b21411695..f326ab9a272e6 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c @@ -97,8 +97,10 @@ static int pvr2_dvb_feed_thread(void *data) return stat; } =20 -static void pvr2_dvb_notify(struct pvr2_dvb_adapter *adap) +static void pvr2_dvb_notify(void *ptr) { + struct pvr2_dvb_adapter *adap =3D ptr; + wake_up(&adap->buffer_wait_data); } =20 @@ -158,7 +160,7 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_ada= pter *adap) } =20 pvr2_stream_set_callback(pvr->video_stream.stream, - (pvr2_stream_callback) pvr2_dvb_notify, adap); + pvr2_dvb_notify, adap); =20 ret =3D pvr2_stream_set_buffer_count(stream, PVR2_DVB_BUFFER_COUNT); if (ret < 0) return ret; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/p= vrusb2/pvrusb2-v4l2.c index 04d334152eae2..5e2c9aa649648 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -1055,8 +1055,10 @@ static int pvr2_v4l2_open(struct file *file) } =20 =20 -static void pvr2_v4l2_notify(struct pvr2_v4l2_fh *fhp) +static void pvr2_v4l2_notify(void *ptr) { + struct pvr2_v4l2_fh *fhp =3D ptr; + wake_up(&fhp->wait_data); } =20 @@ -1089,7 +1091,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh) =20 hdw =3D fh->channel.mc_head->hdw; sp =3D fh->pdi->stream->stream; - pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2_notify,fh); + pvr2_stream_set_callback(sp, pvr2_v4l2_notify, fh); pvr2_hdw_set_stream_type(hdw,fh->pdi->config); if ((ret =3D pvr2_hdw_set_streaming(hdw,!0)) < 0) return ret; return pvr2_ioread_set_enabled(fh->rhp,!0); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B467B185218; Sun, 24 Mar 2024 23:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324333; cv=none; b=HsOLDxTCuv7XH3glb2spfR++6oKcHTAVT9vB9lFRScXJnapHQmWnahXKNIOuy+TM+INEsOPyMr3XmRqR0YGPYI1FfS33Lt+TvLNWDFvm6lJenYz1rXLm+Nm2s5sUICoynlZOhc0laxUUbPH+3HmB3NAQicuWqp/fhV/fg1GRB70= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324333; c=relaxed/simple; bh=YCkvSQzEv+R4kiRtPg/vr7zwuz9GHECujORNUOw4sgA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R92IL3/L4I5cpsikleFc2/7xdfYF+66M1LX4xZLqIfPQqLR4gsPb1iZG6nYAXYUhdiV63mje4i8yD49I9MNkhgmxs9lKREyX08guhrI8dI944ARb0eLpZfKoqjPben0st9p+mlNZTmgd6ovFCTqzn3Ii5AkvhkhJxnyJai5WxzQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QZOQM20e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QZOQM20e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF659C43390; Sun, 24 Mar 2024 23:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324332; bh=YCkvSQzEv+R4kiRtPg/vr7zwuz9GHECujORNUOw4sgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZOQM20eEqJBKzyb8zA97RTNGtp9wRElpJhebDelx5A5f4GzPsf9JvoOgqTm/4mCs bngnZmlRkhNn8oohw7n/UZ840H6Z+7SCll8A4Cb6eFaIZpUgnMCD1D0/KuJXmXtq5o UrBgYp2gyeOip8Jm27JyEDVO67UacHbc3u/XHk6b8eJtad/H/mfK+vlc0k8GVmvbEI WEy28xl4CiiMQi57c/BAYURj0RFJTF+tnm0lz5c+Ga24xgbGwDYmv2M5Vd3X9Oz7JA ohXDf5j18Gp/TECRp9ed+vfyYwen1HARt/E6Ue3GX854jO0CENv2bDZf7NJaNr39ZM brWdMmxWh/lKg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Govind Singh , Bjorn Andersson , Niklas Cassel , Brian Norris , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 103/148] firmware: qcom: scm: Add WLAN VMID for Qualcomm SCM interface Date: Sun, 24 Mar 2024 19:49:27 -0400 Message-ID: <20240324235012.1356413-104-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Govind Singh [ Upstream commit cc53aabcc283c36274d3f3ce9adc4b40c21d4838 ] Add WLAN related VMID's to support wlan driver to set up the remote's permissions call via TrustZone. Signed-off-by: Govind Singh Reviewed-by: Bjorn Andersson Acked-by: Niklas Cassel Reviewed-by: Brian Norris Signed-off-by: Kalle Valo Stable-dep-of: 117e7dc697c2 ("clk: qcom: dispcc-sdm845: Adjust internal GDS= C wait times") Signed-off-by: Sasha Levin --- include/linux/qcom_scm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index 116b81ac442ad..1637385bcc171 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2010-2015, 2018, The Linux Foundation. All rights reserve= d. * Copyright (C) 2015 Linaro Ltd. * * This program is free software; you can redistribute it and/or modify @@ -33,6 +33,8 @@ struct qcom_scm_vmperm { =20 #define QCOM_SCM_VMID_HLOS 0x3 #define QCOM_SCM_VMID_MSS_MSA 0xF +#define QCOM_SCM_VMID_WLAN 0x18 +#define QCOM_SCM_VMID_WLAN_CE 0x19 #define QCOM_SCM_PERM_READ 0x4 #define QCOM_SCM_PERM_WRITE 0x2 #define QCOM_SCM_PERM_EXEC 0x1 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07C9718521E; Sun, 24 Mar 2024 23:52:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324335; cv=none; b=MMILoFDjbQtph99vCT/zqyE6MyTKld5we0B6IBovwPJhshi0yyZKBj8g+d3uGSAedL9Qc8VrbN4LKxO/YJ6KRYkcUICFvum4JNFKrc8Uo3W1QcEHk7KJB3WyQxp9Ub9kSc3bCkz7Jq7BN8ycWhaKf3L5TYnPIiCOtpa5buhNK/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324335; c=relaxed/simple; bh=ZfOUDs7jrsD7iao803en/1YeW13GBtchnkANuEkhMvg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UVeCy4LN9988Du0wGXmnLpXPJlvDN5H59WSfj+iGFqTGOlBlpbWpqSpQ+RsT6u4jsY7vIGTgHwDZ7qp3Ht4YUaI2EkPU3+dovIWdy2h5p5POuXd8G1kV9Ca3tz0tuNyLq0KWrV1cxNXzr14ye33D/KdFXMld821EVTcKcjTkZqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rZSw/NFw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rZSw/NFw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAE9EC433C7; Sun, 24 Mar 2024 23:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324333; bh=ZfOUDs7jrsD7iao803en/1YeW13GBtchnkANuEkhMvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZSw/NFwRq1yPkycdMnKRYkxGhJeZIBmw09ZjyUIAOBHEO19QjRXWUPvpVHTdQwhK X3gxNmcQsg3IBt4ofnQ3NvGWbRL2mP5P2jOF+vfKtKcZZ6x3ZTXdOgcjh9Pb+OolCU H+UoF8yAaUrZ3tYta3E4RbfUulOfpr0HLdyfk08m3DqoB+ADNqEyyuxDxWmzZcAXf4 YCz0NQPbpFLL/Lr9GqIFJTUK9Rkmu9skXsGYwKXQiEc2SYuV9Yuq03W9X7GKT5Yljc i6rEn+192fmrxKX1vmt3QzALVo433AL5fqSx+xocWKkpuUy/aUJF0nPl9EaxR5cdIH EkGd2o+UfWTfA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Konrad Dybcio , Caleb Connolly , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 104/148] clk: qcom: dispcc-sdm845: Adjust internal GDSC wait times Date: Sun, 24 Mar 2024 19:49:28 -0400 Message-ID: <20240324235012.1356413-105-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 117e7dc697c2739d754db8fe0c1e2d4f1f5d5f82 ] SDM845 downstream uses non-default values for GDSC internal waits. Program them accordingly to avoid surprises. Fixes: 81351776c9fb ("clk: qcom: Add display clock controller driver for SD= M845") Signed-off-by: Konrad Dybcio Tested-by: Caleb Connolly # OnePlus 6 Link: https://lore.kernel.org/r/20240103-topic-845gdsc-v1-1-368efbe1a61d@li= naro.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/clk/qcom/dispcc-sdm845.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/qcom/dispcc-sdm845.c b/drivers/clk/qcom/dispcc-sdm= 845.c index 0cc4909b5dbef..cb7a2d9247b04 100644 --- a/drivers/clk/qcom/dispcc-sdm845.c +++ b/drivers/clk/qcom/dispcc-sdm845.c @@ -569,6 +569,8 @@ static struct clk_branch disp_cc_mdss_vsync_clk =3D { =20 static struct gdsc mdss_gdsc =3D { .gdscr =3D 0x3000, + .en_few_wait_val =3D 0x6, + .en_rest_wait_val =3D 0x5, .pd =3D { .name =3D "mdss_gdsc", }, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 969BD18522E; Sun, 24 Mar 2024 23:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324336; cv=none; b=j3Y46AukDXj4QhHjy2a4dja6qH4MXpB+qYxOiM0FmWfy2bZ1eJ1uHkT9THb22Ehlmtxvvh+nZ5asJhUVvlUV1Lg/6YfIFervx2ffj27aCRYaD8BN5fCRe+KpsTeEAOYYsy8P95glzgFusPVRsHD9wDSiiUlU/n/EI0p6um65tuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324336; c=relaxed/simple; bh=4OzIDx8mOzZcafrIUvsTC0DM+4w7wuZBIwiHzu5cbow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h5SqQFw84Tw/RCIVHAdx3DZ7HIu/J/2iUfpwEcYOjQDHNkRtD3CykWHzmWzzDmRYHx9ncZVBeJANtED2rqW1hzEvXh4Krb1wQ2+R6Wp0IlLtYH6rGfOqHt8P/g/SbYzvLly88jyJR40y1CHEGAJKrkvq+4AqiV6xVEvPhMqUbIE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JWNvVz8D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JWNvVz8D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E490C433F1; Sun, 24 Mar 2024 23:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324335; bh=4OzIDx8mOzZcafrIUvsTC0DM+4w7wuZBIwiHzu5cbow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JWNvVz8DVcmdRHLiPAaWIr1nXjQBjE8Eb6mvR71aRqWpfuamYEViQLAP39kAuBSrW DAbqMddmdL9Cpm0yeoJhyXKDWR+75e7siNMAd7+Def/CyQDFW0Jblxxfxv6HqRH0NS p2Qy3UoXVv7UIiRcE+lALkKlPh66bg7KGDdMq7hj2ntQT1bnBwT9d95nVM/rRf9GIm ArCrYUHraSQ40458C48URenYOwUXuKF3QapuVZb1p8k0QxwtkNsDdd8tyqftM2z2MV AKYRAq9E4G4kLRPZyd9aZCcsv4CwYNxOBMi4aD4PQpr55uTpMTSZpMShJ0caLYR6aQ K1NRfNdsN75MA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: AngeloGioacchino Del Regno , Alexandre Mergnat , CK Hu , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 4.19 105/148] drm/mediatek: dsi: Fix DSI RGB666 formats and definitions Date: Sun, 24 Mar 2024 19:49:29 -0400 Message-ID: <20240324235012.1356413-106-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: AngeloGioacchino Del Regno [ Upstream commit fae6f815505301b92d9113764f4d76d0bfe45607 ] The register bits definitions for RGB666 formats are wrong in multiple ways: first, in the DSI_PS_SEL bits region, the Packed 18-bits RGB666 format is selected with bit 1, while the Loosely Packed one is bit 2, and second - the definition name "LOOSELY_PS_18BIT_RGB666" is wrong because the loosely packed format is 24 bits instead! Either way, functions mtk_dsi_ps_control_vact() and mtk_dsi_ps_control() do not even agree on the DSI_PS_SEL bit to set in DSI_PSCTRL: one sets loosely packed (24) on RGB666, the other sets packed (18), and the other way around for RGB666_PACKED. Fixing this entire stack of issues is done in one go: - Use the correct bit for the Loosely Packed RGB666 definition - Rename LOOSELY_PS_18BIT_RGB666 to LOOSELY_PS_24BIT_RGB666 - Change ps_bpp_mode in mtk_dsi_ps_control_vact() to set: - Loosely Packed, 24-bits for MIPI_DSI_FMT_RGB666 - Packed, 18-bits for MIPI_DSI_FMT_RGB666_PACKED Fixes: 2e54c14e310f ("drm/mediatek: Add DSI sub driver") Reviewed-by: Alexandre Mergnat Reviewed-by: CK Hu Signed-off-by: AngeloGioacchino Del Regno Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.5= 6835-3-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index a629a69c27568..6a7a5a485bad7 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -70,8 +70,8 @@ #define DSI_PS_WC 0x3fff #define DSI_PS_SEL (3 << 16) #define PACKED_PS_16BIT_RGB565 (0 << 16) -#define LOOSELY_PS_18BIT_RGB666 (1 << 16) -#define PACKED_PS_18BIT_RGB666 (2 << 16) +#define PACKED_PS_18BIT_RGB666 (1 << 16) +#define LOOSELY_PS_24BIT_RGB666 (2 << 16) #define PACKED_PS_24BIT_RGB888 (3 << 16) =20 #define DSI_VSA_NL 0x20 @@ -327,10 +327,10 @@ static void mtk_dsi_ps_control_vact(struct mtk_dsi *d= si) ps_bpp_mode |=3D PACKED_PS_24BIT_RGB888; break; case MIPI_DSI_FMT_RGB666: - ps_bpp_mode |=3D PACKED_PS_18BIT_RGB666; + ps_bpp_mode |=3D LOOSELY_PS_24BIT_RGB666; break; case MIPI_DSI_FMT_RGB666_PACKED: - ps_bpp_mode |=3D LOOSELY_PS_18BIT_RGB666; + ps_bpp_mode |=3D PACKED_PS_18BIT_RGB666; break; case MIPI_DSI_FMT_RGB565: ps_bpp_mode |=3D PACKED_PS_16BIT_RGB565; @@ -381,7 +381,7 @@ static void mtk_dsi_ps_control(struct mtk_dsi *dsi) dsi_tmp_buf_bpp =3D 3; break; case MIPI_DSI_FMT_RGB666: - tmp_reg =3D LOOSELY_PS_18BIT_RGB666; + tmp_reg =3D LOOSELY_PS_24BIT_RGB666; dsi_tmp_buf_bpp =3D 3; break; case MIPI_DSI_FMT_RGB666_PACKED: --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E516185236; Sun, 24 Mar 2024 23:52:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324337; cv=none; b=t6dm/yNjQu41eZCitDOtV4RSNbTrhURAe+76WWBfRu2nzfsK++SbbNvsdRh7SFk0qy84L3ug7sC+h9NEErQUG3LIUNJaDGdHqLP83zeiHu1+b6g1A1XfYqfvprMrNM1F0BSX9j5q4xsuxWCNJvhcxkhxZ9zxIQnTJucorlUWtnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324337; c=relaxed/simple; bh=HjJ/dTR++zAMfVXYPFsG/0p7h3CxF6pmnwiIwdiU8Ng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lN6vO8HOQCGkK8P+YjqFiB8EZD/1QVkvFGsB/UUAjUB2A6ngor7hapeypGGH4mBCBJVEiXBnGGmy6hmqesRHEi0BA+ox+GNj00e5D5FfnRCIygDqKOjldfj4nL2UtwVocvhI0Ow4KqzzzdLiUQsiwYfIVVwWQ6dw67ZIUCyhJOo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ptXdiobx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ptXdiobx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF3BEC433A6; Sun, 24 Mar 2024 23:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324336; bh=HjJ/dTR++zAMfVXYPFsG/0p7h3CxF6pmnwiIwdiU8Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptXdiobxMI2okkptNbeTZP3AFnGJsAUiZJyDRyMYdVLz2dkfTMIINNb7YbcrLX593 qlHnsAhTJoCGNC1pQCajeO1L64uOUWcJVCM56AxbpF7piEQ+hx1DCjJ8yXhXtbuNo1 QZToqx5x+4IdrzAYfomLFSvd9iZf/fNYnsQofus1dYYddF/XpHVPc0ZpDa021Ruk2e kAXwDDbwdJmQmFA+NJdRImxd3Jll1sWz0CvToRl5XcPjswgiE2ud7YzA9PylIn7MUj A9M5dE27J03ghS5yo+b4MXcmcA6CM4FYCgM9ZyIQNcmiPORtsLu9676WOstWZ4jL0F 8oBRB3OUrpDaA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?J=C3=B6rg=20Wedekind?= , Bjorn Helgaas , Sasha Levin Subject: [PATCH 4.19 106/148] PCI: Mark 3ware-9650SE Root Port Extended Tags as broken Date: Sun, 24 Mar 2024 19:49:30 -0400 Message-ID: <20240324235012.1356413-107-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: J=C3=B6rg Wedekind [ Upstream commit baf67aefbe7d7deafa59ca49612d163f8889934c ] Per PCIe r6.1, sec 2.2.6.2 and 7.5.3.4, a Requester may not use 8-bit Tags unless its Extended Tag Field Enable is set, but all Receivers/Completers must handle 8-bit Tags correctly regardless of their Extended Tag Field Enable. Some devices do not handle 8-bit Tags as Completers, so add a quirk for them. If we find such a device, we disable Extended Tags for the entire hierarchy to make peer-to-peer DMA possible. The 3ware 9650SE seems to have issues with handling 8-bit tags. Mark it as broken. This fixes PCI Parity Errors like : 3w-9xxx: scsi0: ERROR: (0x06:0x000C): PCI Parity Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000D): PCI Abort: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000E): Controller Queue Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x0010): Microcontroller Error: clearing. Link: https://lore.kernel.org/r/20240219132811.8351-1-joerg@wedekind.de Fixes: 60db3a4d8cc9 ("PCI: Enable PCIe Extended Tags if supported") Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D202425 Signed-off-by: J=C3=B6rg Wedekind Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 99a8a24ea79dc..bb51820890965 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -5189,6 +5189,7 @@ static void quirk_no_ext_tags(struct pci_dev *pdev) =20 pci_walk_bus(bridge->bus, pci_configure_extended_tags, NULL); } +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_3WARE, 0x1004, quirk_no_ext_tags); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0132, quirk_no_ext_ta= gs); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0140, quirk_no_ext_ta= gs); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0141, quirk_no_ext_ta= gs); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B36C8184EFD; Sun, 24 Mar 2024 23:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324338; cv=none; b=QCAFiBrUYKco5JXfRPH3MAdYndy975PiWP2bkgZ9JhCCmdhuNQ/10DeHYVgS9d2x/tT+wBmbnHzNoByx84ctUd22uCl1Hk4Tr4UVcIU/uAKZK3aj/nHqgAwa4DekyvBNUM51pvn4CpY7RYrEr1vJnoDSTdj68d6g1lOsYNkfhdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324338; c=relaxed/simple; bh=KgzdISlknt7VdZFatRB38/qjLQ9kXZXtbuQfpsc4PfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YBCyS/3l4i7ndCe6oyqSpGo1/OPHrGmU1zOCrI2Ok+WsFTJnWMev3f8CAQdx8CdKG+aREGdo5m8M7T7MzBqaKkQtox3KK4t4X15jXkOhOC7F++IFaQdkyck2uyyMGdx5sUbbaHLWaf3ar9enBsTjYEAGb4NKi19mwbb2NtVAZcM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kFFnNuEW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kFFnNuEW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E7E4C43390; Sun, 24 Mar 2024 23:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324337; bh=KgzdISlknt7VdZFatRB38/qjLQ9kXZXtbuQfpsc4PfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kFFnNuEWf0rv+qBOBDV1q9xKufZJ+cnDSVVGPZ1H3K9CK4Si2SgLBIc36aC6zA9nX K6GjCnd32oSbCZcoRtaOk4p+6kIjLpbrCR+lq8gg2c21mnD+or7KLtqoBM/vztPAjR yJ+YrIvwaAT4nvhlCI1vdg24M+7tPmstzGugbKqboH8IKphJRMDPIxExzkWgWBMHU+ veHzkSheTzXF+BZqgjpf35PJ5Sx2uyDtimTyQloFppg1AuOpcfvdqZ2cb+hz37idLA yx++ceM0vmeEvGB2P1iqZcGiuzJHYQH4R/8LMcuodsBxYN22e8GW1u7B117papZxt6 U7g2IvsPj6brw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 107/148] clk: hisilicon: hi3519: Release the correct number of gates in hi3519_clk_unregister() Date: Sun, 24 Mar 2024 19:49:31 -0400 Message-ID: <20240324235012.1356413-108-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 74e39f526d95c0c119ada1874871ee328c59fbee ] The gates are stored in 'hi3519_gate_clks', not 'hi3519_mux_clks'. This is also in line with how hisi_clk_register_gate() is called in the probe. Fixes: 224b3b262c52 ("clk: hisilicon: hi3519: add driver remove path and fi= x some issues") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/c3f1877c9a0886fa35c949c8f0ef25547f284f18.17= 04912510.git.christophe.jaillet@wanadoo.fr Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/hisilicon/clk-hi3519.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/hisilicon/clk-hi3519.c b/drivers/clk/hisilicon/clk= -hi3519.c index 51b173ef1ddad..d789735160a2b 100644 --- a/drivers/clk/hisilicon/clk-hi3519.c +++ b/drivers/clk/hisilicon/clk-hi3519.c @@ -142,7 +142,7 @@ static void hi3519_clk_unregister(struct platform_devic= e *pdev) of_clk_del_provider(pdev->dev.of_node); =20 hisi_clk_unregister_gate(hi3519_gate_clks, - ARRAY_SIZE(hi3519_mux_clks), + ARRAY_SIZE(hi3519_gate_clks), crg->clk_data); hisi_clk_unregister_mux(hi3519_mux_clks, ARRAY_SIZE(hi3519_mux_clks), --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63D6B184F03; Sun, 24 Mar 2024 23:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324339; cv=none; b=LIlemU7Cq+8F0SLQJJ3GaKRsvnGZJ97CM6+ryPRU6LpiCYWcMduZp43oKnSBgc4A0y/t8DqgYkmh52oxzMXEzQa2VM8JpiCYtKBOOm/WdLmlN96V647mxaGqPwRLBesimemmz1jxUQHAK2T/Yi0Y77iarww98L1PYXyxDdlsnho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324339; c=relaxed/simple; bh=QDqgZV5Fcdtcnfr801KMcgRP7NgSQJ85Lz+W/n382oE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D+NQ9nDtHdA9/h6bBncOaTUnRwVC5gA1mjvT6I9wDDLcwfqJv5nHe1WmVOIV8uD1DMR1XsQab3n6V91iTppbPE5WxwjsBedyLz5W7FihGrx+yVouexR+a0/VsW9wak8b92qQfCVyARN3/JBWaylW8ExVdvYW9CL98I9va0UtEMA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GOLp1qvr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GOLp1qvr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B1E3C43394; Sun, 24 Mar 2024 23:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324338; bh=QDqgZV5Fcdtcnfr801KMcgRP7NgSQJ85Lz+W/n382oE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GOLp1qvr/i9Ply+BWzGEakFlPPNRMuRizHmaJXPXGN/28WKcFIKEYthmFt+iJMgTA BLnia4i9U9r7QjyKIwvhstWfd9FlZkyWeq2hzThU5CX93f4K/8DjTpE7bWDkiCeghb awCGKLgFyFZirujJ+YDLEpZyA0vZ/B5K5LC6ZQReYJfik6kii5UX/KN2XecImueTXk KKqUMo8HLUGVG3+AjjmEPeQACrWBqkLyYTe4HWsCcRGxwzNQdUnKoh39XLKeJprRrP i+40YVXc2BsDDcDB3p/x1G0Zga2+ehilP/tFrXQkElC1yXtzdLkSfi+SazAqVp4thn 7+vQsVJUFvohA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fedor Pchelkin , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 108/148] drm/tegra: put drm_gem_object ref on error in tegra_fb_create Date: Sun, 24 Mar 2024 19:49:32 -0400 Message-ID: <20240324235012.1356413-109-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Fedor Pchelkin [ Upstream commit 32e5a120a5105bce01561978ee55aee8e40ac0dc ] Inside tegra_fb_create(), drm_gem_object_lookup() increments ref count of the found object. But if the following size check fails then the last found object's ref count should be put there as the unreferencing loop can't detect this situation. Found by Linux Verification Center (linuxtesting.org). Fixes: de2ba664c30f ("gpu: host1x: drm: Add memory manager and fb") Signed-off-by: Fedor Pchelkin Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/20231215093356.12067-1-= pchelkin@ispras.ru Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 4c22cdded3c21..e39d33f66d795 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -157,6 +157,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_devi= ce *drm, =20 if (gem->size < size) { err =3D -EINVAL; + drm_gem_object_put(gem); goto unreference; } =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52FD8184F0C; Sun, 24 Mar 2024 23:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324340; cv=none; b=MVsPttx+Zr+6n91nA8yHkPtWZKhQ0riIXVTFj1I8FC+b4QQifhWUyo3D0IbVc5qQrsPMD9NBqLKjbVs6tQr5Y8U9unY6S8MeYxqVRUH0JvWEnAP9Ym63Ce9xIjKyAfjzHrFpbwdSu76r5PZ9QgvaO/3pq4deN3QK6RpXf08SToE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324340; c=relaxed/simple; bh=Sti5y1M+NCqNbLP1ipleqJZwYr8eyzP543f+H+/2zBY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t0ruY4MJbQuMNJdwIeBWb1dHu9Ojw6nguBcpNAFG8fT60/96vKOOiwfPJFyXCimXKLNCcP1rs9oEJjzOVLwyPzwWl1wiSMxr40vqAKvJekW7GYdHuGc2x56FIANl2YzrKiJZdWzThBU7uucgot1ZGWarwlQvVGgH+YXlrPZ/DAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ya8gl1g/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ya8gl1g/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 882BAC43399; Sun, 24 Mar 2024 23:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324339; bh=Sti5y1M+NCqNbLP1ipleqJZwYr8eyzP543f+H+/2zBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ya8gl1g/meQBUDg+BTOsOL8zdnJNg8yKRXM2iCf7npBTqflizQ4nCnFdaJEz9d2OZ 0EiIwQ16aBDzllcTpUrShrfs7CnNLSfgStY0O7LFvHdxJ7aJLWa2xmefa0vCwR0TM7 f1KsWGGV5jOJKL7gUWHAR6JvXy6hYiGWl7MpR1fOsYlw2Cg2MnlkhuwyI3yOLvhpVs ag/G8eKSVktHEssfo4ENFkxS6sJa2CIq5Qrzu+l4jS69F1X3zkyoaBFTKSNWnesaO0 V1BBHWPO9xsYa+olEqN/0qXCCsm15kP2//295Z9DeM9HxndO0LtFXy+Wyx6O79VlGG iIjrccBbAUdbw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Griffin , Lee Jones , Sasha Levin Subject: [PATCH 4.19 109/148] mfd: syscon: Call of_node_put() only when of_parse_phandle() takes a ref Date: Sun, 24 Mar 2024 19:49:33 -0400 Message-ID: <20240324235012.1356413-110-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Griffin [ Upstream commit d2b0680cf3b05490b579e71b0df6e07451977745 ] of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node. Fixes: 45330bb43421 ("mfd: syscon: Allow property as NULL in syscon_regmap_= lookup_by_phandle") Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20240220115012.471689-2-peter.griffin@linar= o.org Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/syscon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index b6d05cd934e66..d73869889166f 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -211,7 +211,9 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct d= evice_node *np, return ERR_PTR(-ENODEV); =20 regmap =3D syscon_node_to_regmap(syscon_np); - of_node_put(syscon_np); + + if (property) + of_node_put(syscon_np); =20 return regmap; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 350F5184F0A; Sun, 24 Mar 2024 23:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324340; cv=none; b=pZH4+WDsoktXrHoPoN/jtlJl/DYOdzyWPZ+3Rd9aNnD2TSk5ptbEqDqkCx6swUUBDFdWhbagKToJvjg3bjyFhYHr9O6/XkBvmGDkJt9GsY3VMA2J74972g7v0ZOOMHgkrpFHwQXUhYn26QQnvjqTw3TfLaYVwmS8V4jtHtUIhfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324340; c=relaxed/simple; bh=5bMpDei5pQBV7TFItVqG+PgNFyz4lHjg/J19IK10tro=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L9o6FW4yUOlJbz5/R8bDL5aazHjuKIABpjuz6HiwKVcBdFoUsdVyVfdKqid+qwY1Yu0pHRFmVFT2zN3uj1vQzFJR3jvJZd4lRLKEkPiP4jlIuI/SliFAwjtRz0W5uvpvplLdAu2PHx4jRnw+msnuvhma1koiQ37x26QzOeVO4iQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sPi/vjOW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sPi/vjOW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76538C433C7; Sun, 24 Mar 2024 23:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324340; bh=5bMpDei5pQBV7TFItVqG+PgNFyz4lHjg/J19IK10tro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPi/vjOWoDdkz8HlmaIZrC3Zg9MG0POta1VI8MFT4IMwgAcrGrS1umb3LDw6bNw2O JzHV4mDqWpeFbP+MPtgUtbjyEAEbLE01dQ3EtrnuwkW3+i/87H4KHE+nlrtyO032LX +RVEu18AJ7pfngedLQzlwEOhTOOqzSZPSv0o5nuGIS/K09uxQhpoj41TQvbrjRTR6e l6QuYm8WgpZQkcKa0nNC2Rzh+M6Fo6pcRwsEVzXE/ecq7tE/ZxEX4UY9n6/liH5PDX s5dMV4yL+ReF1+UT+fBJKmvqb6n+3VUl6F/mJggw2J2dfmLAJvKxcbRy1/CWfJfhR3 f/xXgdG4U8dbg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 110/148] crypto: arm - Rename functions to avoid conflict with crypto/sha256.h Date: Sun, 24 Mar 2024 19:49:34 -0400 Message-ID: <20240324235012.1356413-111-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit e4dcc1be15268b6d34de3968f906577591521bd5 ] Rename static / file-local functions so that they do not conflict with the functions declared in crypto/sha256.h. This is a preparation patch for folding crypto/sha256.h into crypto/sha.h. Signed-off-by: Hans de Goede Signed-off-by: Herbert Xu Stable-dep-of: 53cc9baeb9bc ("crypto: arm/sha - fix function cast warnings") Signed-off-by: Sasha Levin --- arch/arm/crypto/sha256_glue.c | 8 ++++---- arch/arm/crypto/sha256_neon_glue.c | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/crypto/sha256_glue.c b/arch/arm/crypto/sha256_glue.c index 0ae900e778f3b..040c744ef9f50 100644 --- a/arch/arm/crypto/sha256_glue.c +++ b/arch/arm/crypto/sha256_glue.c @@ -44,7 +44,7 @@ int crypto_sha256_arm_update(struct shash_desc *desc, con= st u8 *data, } EXPORT_SYMBOL(crypto_sha256_arm_update); =20 -static int sha256_final(struct shash_desc *desc, u8 *out) +static int crypto_sha256_arm_final(struct shash_desc *desc, u8 *out) { sha256_base_do_finalize(desc, (sha256_block_fn *)sha256_block_data_order); @@ -56,7 +56,7 @@ int crypto_sha256_arm_finup(struct shash_desc *desc, cons= t u8 *data, { sha256_base_do_update(desc, data, len, (sha256_block_fn *)sha256_block_data_order); - return sha256_final(desc, out); + return crypto_sha256_arm_final(desc, out); } EXPORT_SYMBOL(crypto_sha256_arm_finup); =20 @@ -64,7 +64,7 @@ static struct shash_alg algs[] =3D { { .digestsize =3D SHA256_DIGEST_SIZE, .init =3D sha256_base_init, .update =3D crypto_sha256_arm_update, - .final =3D sha256_final, + .final =3D crypto_sha256_arm_final, .finup =3D crypto_sha256_arm_finup, .descsize =3D sizeof(struct sha256_state), .base =3D { @@ -78,7 +78,7 @@ static struct shash_alg algs[] =3D { { .digestsize =3D SHA224_DIGEST_SIZE, .init =3D sha224_base_init, .update =3D crypto_sha256_arm_update, - .final =3D sha256_final, + .final =3D crypto_sha256_arm_final, .finup =3D crypto_sha256_arm_finup, .descsize =3D sizeof(struct sha256_state), .base =3D { diff --git a/arch/arm/crypto/sha256_neon_glue.c b/arch/arm/crypto/sha256_ne= on_glue.c index 1d82c6cd31a41..8d296529c8ba7 100644 --- a/arch/arm/crypto/sha256_neon_glue.c +++ b/arch/arm/crypto/sha256_neon_glue.c @@ -29,8 +29,8 @@ asmlinkage void sha256_block_data_order_neon(u32 *digest, const void *data, unsigned int num_blks); =20 -static int sha256_update(struct shash_desc *desc, const u8 *data, - unsigned int len) +static int crypto_sha256_neon_update(struct shash_desc *desc, const u8 *da= ta, + unsigned int len) { struct sha256_state *sctx =3D shash_desc_ctx(desc); =20 @@ -46,8 +46,8 @@ static int sha256_update(struct shash_desc *desc, const u= 8 *data, return 0; } =20 -static int sha256_finup(struct shash_desc *desc, const u8 *data, - unsigned int len, u8 *out) +static int crypto_sha256_neon_finup(struct shash_desc *desc, const u8 *dat= a, + unsigned int len, u8 *out) { if (!may_use_simd()) return crypto_sha256_arm_finup(desc, data, len, out); @@ -63,17 +63,17 @@ static int sha256_finup(struct shash_desc *desc, const = u8 *data, return sha256_base_finish(desc, out); } =20 -static int sha256_final(struct shash_desc *desc, u8 *out) +static int crypto_sha256_neon_final(struct shash_desc *desc, u8 *out) { - return sha256_finup(desc, NULL, 0, out); + return crypto_sha256_neon_finup(desc, NULL, 0, out); } =20 struct shash_alg sha256_neon_algs[] =3D { { .digestsize =3D SHA256_DIGEST_SIZE, .init =3D sha256_base_init, - .update =3D sha256_update, - .final =3D sha256_final, - .finup =3D sha256_finup, + .update =3D crypto_sha256_neon_update, + .final =3D crypto_sha256_neon_final, + .finup =3D crypto_sha256_neon_finup, .descsize =3D sizeof(struct sha256_state), .base =3D { .cra_name =3D "sha256", @@ -85,9 +85,9 @@ struct shash_alg sha256_neon_algs[] =3D { { }, { .digestsize =3D SHA224_DIGEST_SIZE, .init =3D sha224_base_init, - .update =3D sha256_update, - .final =3D sha256_final, - .finup =3D sha256_finup, + .update =3D crypto_sha256_neon_update, + .final =3D crypto_sha256_neon_final, + .finup =3D crypto_sha256_neon_finup, .descsize =3D sizeof(struct sha256_state), .base =3D { .cra_name =3D "sha224", --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CB63297D41; Sun, 24 Mar 2024 23:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324342; cv=none; b=spo4SSWRUveUxtSxAwQzwSWRZUXYWuEWvEyVmI0KICLh0YH0wojyxTibSGTzf1WEh25VhCLh7YF1ptBF7GtGy/bO1ckxKvdpY6l+ss7pHXFP4+cAb5Aa1YmtB1yn3ojxm+YlFuomGL5Ek+Y0am+4hK9D4TJJ4/2UITfJ8SRueUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324342; c=relaxed/simple; bh=r+RjWSfVA/ZL2fgpwGCGbqFq5ybAzwUc5uRZndVc73A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iPCsWzhrliP7nYwxvSrCrNvWw096nAezGRDKZOz9ziL/QbLJaDZ1IRms9G1fg01I7e6aDtwau3O3Nm8xGvalxa2abp8nSGLQX5qmb8XwQvNCeKMEK3C9Z+HdIIxOO+VVtLFd4J3gVx7szMXezCodYzG2pl1uQ2e7gzJ1diOnX3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YAk6ySa/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YAk6ySa/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D340C433F1; Sun, 24 Mar 2024 23:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324341; bh=r+RjWSfVA/ZL2fgpwGCGbqFq5ybAzwUc5uRZndVc73A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAk6ySa/RZLXKI1ZLFEQJQ6nRhLoqTlr7bHdgTfZUsr7nIGMSV6An69i/VdrOoo7P 29vvCc79TG/f7+eEfqqwofvIB0QEh9JlKacDPDqwE5x/Y2dP7iyfT08I6BfiveGMV2 72RahaDyw9dWfNA10N/0M6Gp2jCZHC0zeUx9uFHUFjG+0riOsVZhOSHChyAp9QU/RD 4eig9g9XAL4RP4jvCbKweAb5/+JdEkY5XCqwy3pqdVcvNWr1NlWWdVCN6bNrEx9Pg9 TPY7dxfaNvGe1x/OF62TY7XI0ztNlD86S2eYvgl/dnI8zSzzjthAApNdpWeCHXN7ac 0yn1ggEpSrXjQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Ard Biesheuvel , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 111/148] crypto: arm/sha - fix function cast warnings Date: Sun, 24 Mar 2024 19:49:35 -0400 Message-ID: <20240324235012.1356413-112-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 53cc9baeb9bc2a187eb9c9790d30995148852b12 ] clang-16 warns about casting between incompatible function types: arch/arm/crypto/sha256_glue.c:37:5: error: cast from 'void (*)(u32 *, const= void *, unsigned int)' (aka 'void (*)(unsigned int *, const void *, unsign= ed int)') to 'sha256_block_fn *' (aka 'void (*)(struct sha256_state *, cons= t unsigned char *, int)') converts to incompatible function type [-Werror,-= Wcast-function-type-strict] 37 | (sha256_block_fn *)sha256_block_dat= a_order); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~ arch/arm/crypto/sha512-glue.c:34:3: error: cast from 'void (*)(u64 *, const= u8 *, int)' (aka 'void (*)(unsigned long long *, const unsigned char *, in= t)') to 'sha512_block_fn *' (aka 'void (*)(struct sha512_state *, const uns= igned char *, int)') converts to incompatible function type [-Werror,-Wcast= -function-type-strict] 34 | (sha512_block_fn *)sha512_block_data_order); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix the prototypes for the assembler functions to match the typedef. The code already relies on the digest being the first part of the state structure, so there is no change in behavior. Fixes: c80ae7ca3726 ("crypto: arm/sha512 - accelerated SHA-512 using ARM ge= neric ASM and NEON") Fixes: b59e2ae3690c ("crypto: arm/sha256 - move SHA-224/256 ASM/NEON implem= entation to base layer") Signed-off-by: Arnd Bergmann Reviewed-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- arch/arm/crypto/sha256_glue.c | 13 +++++-------- arch/arm/crypto/sha512-glue.c | 12 +++++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/arch/arm/crypto/sha256_glue.c b/arch/arm/crypto/sha256_glue.c index 040c744ef9f50..a46878560d77d 100644 --- a/arch/arm/crypto/sha256_glue.c +++ b/arch/arm/crypto/sha256_glue.c @@ -30,8 +30,8 @@ =20 #include "sha256_glue.h" =20 -asmlinkage void sha256_block_data_order(u32 *digest, const void *data, - unsigned int num_blks); +asmlinkage void sha256_block_data_order(struct sha256_state *state, + const u8 *data, int num_blks); =20 int crypto_sha256_arm_update(struct shash_desc *desc, const u8 *data, unsigned int len) @@ -39,23 +39,20 @@ int crypto_sha256_arm_update(struct shash_desc *desc, c= onst u8 *data, /* make sure casting to sha256_block_fn() is safe */ BUILD_BUG_ON(offsetof(struct sha256_state, state) !=3D 0); =20 - return sha256_base_do_update(desc, data, len, - (sha256_block_fn *)sha256_block_data_order); + return sha256_base_do_update(desc, data, len, sha256_block_data_order); } EXPORT_SYMBOL(crypto_sha256_arm_update); =20 static int crypto_sha256_arm_final(struct shash_desc *desc, u8 *out) { - sha256_base_do_finalize(desc, - (sha256_block_fn *)sha256_block_data_order); + sha256_base_do_finalize(desc, sha256_block_data_order); return sha256_base_finish(desc, out); } =20 int crypto_sha256_arm_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { - sha256_base_do_update(desc, data, len, - (sha256_block_fn *)sha256_block_data_order); + sha256_base_do_update(desc, data, len, sha256_block_data_order); return crypto_sha256_arm_final(desc, out); } EXPORT_SYMBOL(crypto_sha256_arm_finup); diff --git a/arch/arm/crypto/sha512-glue.c b/arch/arm/crypto/sha512-glue.c index 86540cd4a6faa..242d0ef08dfef 100644 --- a/arch/arm/crypto/sha512-glue.c +++ b/arch/arm/crypto/sha512-glue.c @@ -28,27 +28,25 @@ MODULE_ALIAS_CRYPTO("sha512"); MODULE_ALIAS_CRYPTO("sha384-arm"); MODULE_ALIAS_CRYPTO("sha512-arm"); =20 -asmlinkage void sha512_block_data_order(u64 *state, u8 const *src, int blo= cks); +asmlinkage void sha512_block_data_order(struct sha512_state *state, + u8 const *src, int blocks); =20 int sha512_arm_update(struct shash_desc *desc, const u8 *data, unsigned int len) { - return sha512_base_do_update(desc, data, len, - (sha512_block_fn *)sha512_block_data_order); + return sha512_base_do_update(desc, data, len, sha512_block_data_order); } =20 int sha512_arm_final(struct shash_desc *desc, u8 *out) { - sha512_base_do_finalize(desc, - (sha512_block_fn *)sha512_block_data_order); + sha512_base_do_finalize(desc, sha512_block_data_order); return sha512_base_finish(desc, out); } =20 int sha512_arm_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { - sha512_base_do_update(desc, data, len, - (sha512_block_fn *)sha512_block_data_order); + sha512_base_do_update(desc, data, len, sha512_block_data_order); return sha512_arm_final(desc, out); } =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9056422D8B0; Sun, 24 Mar 2024 23:52:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324342; cv=none; b=IONnZBOiR2PsT0U8c0wd8o8TPAbtF5Ul0h6ZbN+EdKyKwTx/Wk9nDCe2G/n264icR48qvpH4+V67Ldu+53HjMBrKX6JSbdMcFPGtrEOgnnrlq4UEwcgziUGFJBgRN/UwAZWOCp8u9V9+oc55Plw7fsiOQcoXFPgqORdJ5zI/3xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324342; c=relaxed/simple; bh=LMaHUsLZCx3wS/MdEVXY4na3Ng6kslGf1QlQOmafudU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RlrjfLXqDbmScAZI+tTKCFZQFZp2mzgzfMRSM6bsS4JF+BAQVGiO24jekn1YjWFFNfOheMxwDlGMLNZ2Ky9qCjtmWCY/F3EyLGQlIuPlMrWlY/HIrFOkQUB9zBpULDWNKdlTIEs1gHWPc5Uo0r8c1sGp8ygSNpDrUu2KiB+Qp0I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nhy6Nzjd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nhy6Nzjd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 782A3C433B1; Sun, 24 Mar 2024 23:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324342; bh=LMaHUsLZCx3wS/MdEVXY4na3Ng6kslGf1QlQOmafudU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nhy6Nzjd2tzXpUmABLU6zptE290DRP2VM60zR3CoRJIYpsMtwrDj15rNeQ7CI3/yb sBPisFXc9IBGyKAhc/TQL1Q7CfeJZF0IOQYI8jfqbMHdjNRd/zSMjHCmSWZnRebfjD xCXilocUX7MW3rE33OLRdkUm4VsWimHF776qe1IAnQcSqM5g6xETZWyrm4ahkC+bjT oAITGGDHu3bbnYDgTizE7HBPADpp/NC4/xbtP70RKB147ewzsLpQ7gBs7HmZvlayOB bZT0jSlrPr+jSWXxaaXiYgxuaXOzWb6glFFCHVN/HL+r8Uw74wCKvGNfiJEfFG1n11 p5O43cDWsGhKA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Miquel Raynal , Sasha Levin Subject: [PATCH 4.19 112/148] mtd: rawnand: lpc32xx_mlc: fix irq handler prototype Date: Sun, 24 Mar 2024 19:49:36 -0400 Message-ID: <20240324235012.1356413-113-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 347b828882e6334690e7003ce5e2fe5f233dc508 ] clang-16 warns about mismatched function prototypes: drivers/mtd/nand/raw/lpc32xx_mlc.c:783:29: error: cast from 'irqreturn_t (*= )(int, struct lpc32xx_nand_host *)' (aka 'enum irqreturn (*)(int, struct lp= c32xx_nand_host *)') to 'irq_handler_t' (aka 'enum irqreturn (*)(int, void = *)') converts to incompatible function type [-Werror,-Wcast-function-type-s= trict] Change the interrupt handler to the normal way of just passing a void* pointer and converting it inside the function.. Fixes: 70f7cb78ec53 ("mtd: add LPC32xx MLC NAND driver") Signed-off-by: Arnd Bergmann Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240213100146.455811-1-arnd@kernel= .org Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/lpc32xx_mlc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/lpc32xx_mlc.c b/drivers/mtd/nand/raw/lpc3= 2xx_mlc.c index d240b8ff40cad..507b2bd58f734 100644 --- a/drivers/mtd/nand/raw/lpc32xx_mlc.c +++ b/drivers/mtd/nand/raw/lpc32xx_mlc.c @@ -316,8 +316,9 @@ static int lpc32xx_nand_device_ready(struct mtd_info *m= td) return 0; } =20 -static irqreturn_t lpc3xxx_nand_irq(int irq, struct lpc32xx_nand_host *hos= t) +static irqreturn_t lpc3xxx_nand_irq(int irq, void *data) { + struct lpc32xx_nand_host *host =3D data; uint8_t sr; =20 /* Clear interrupt flag by reading status */ @@ -790,7 +791,7 @@ static int lpc32xx_nand_probe(struct platform_device *p= dev) goto release_dma_chan; } =20 - if (request_irq(host->irq, (irq_handler_t)&lpc3xxx_nand_irq, + if (request_irq(host->irq, &lpc3xxx_nand_irq, IRQF_TRIGGER_HIGH, DRV_NAME, host)) { dev_err(&pdev->dev, "Error requesting NAND IRQ\n"); res =3D -ENXIO; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EC5D297D43; Sun, 24 Mar 2024 23:52:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324343; cv=none; b=SxhDXdmmw/Xp5u7g9xBaHM2iSkrhDmt6iE9plGH7jQjGTiTcQ4SCdZpykW97hqIZlLPzavnG6o4PPboAy0X6WlRTq1hhLL/6YPyqQj1qdoNYCn7w3Z54NohVTGwzkEpHfg6Oo+dB4kuoth02R5Vbf3IW8w36yRv5X35t67PmIEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324343; c=relaxed/simple; bh=1+tHARB2vxR+ibEk527kzygBTsc1DKby60Sbcozc8hc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NxWGLc+Qi26j7VhAgReccQSqUs3MNDuH3iM5YoAUCkVfuvqJ1tOgoUNuS4YYPdGZY4Hc1jcJsy3FSgjFbbHInY4VKM2ToirZCRg+84J+L5XkRxzqf6pCsw3e0YfBSpC4fAvPJs3Wmsjq0eYMf9N8Q3bxaMJ08ntXAlG5gRmqxLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RcGpiiJ1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RcGpiiJ1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B14BAC43390; Sun, 24 Mar 2024 23:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324343; bh=1+tHARB2vxR+ibEk527kzygBTsc1DKby60Sbcozc8hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RcGpiiJ13SP+W6SKY+Bv+gq1h37IMBM7b44zWW2/tA9JO6VwyldLg7XgdSMFKTd1Q F7NfU5qb26SLe/kt9LjO+kQEdQ06Ilohaf5YXUzdQU1y0iFI3IgErNp7fF03fXrr7w oS0zusTALhj5I4UJ65Nmt6dbViHNQl7xOwM4XttyHz/MNv+ls3/86y/3fs36jFZnLM lgQ1pEvt+7a1eR7ePAjyMJGURZ3AaG5Cr+43lKZkoM8tI34fxVs5nESSzj6RfUTZAi mCyrkgbTLGU3Tvo+40f9HA3/yT/2TiTB3QNgcEQqH4qV1hz1hte6A6f42F3a3RvtVw 34hP2sTtF59jg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jerome Brunet , Mark Brown , Sasha Levin Subject: [PATCH 4.19 113/148] ASoC: meson: axg-tdm-interface: fix mclk setup without mclk-fs Date: Sun, 24 Mar 2024 19:49:37 -0400 Message-ID: <20240324235012.1356413-114-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jerome Brunet [ Upstream commit e3741a8d28a1137f8b19ae6f3d6e3be69a454a0a ] By default, when mclk-fs is not provided, the tdm-interface driver requests an MCLK that is 4x the bit clock, SCLK. However there is no justification for this: * If the codec needs MCLK for its operation, mclk-fs is expected to be set according to the codec requirements. * If the codec does not need MCLK the minimum is 2 * SCLK, because this is minimum the divider between SCLK and MCLK can do. Multiplying by 4 may cause problems because the PLL limit may be reached sooner than it should, so use 2x instead. Fixes: d60e4f1e4be5 ("ASoC: meson: add tdm interface driver") Signed-off-by: Jerome Brunet Link: https://msgid.link/r/20240223175116.2005407-2-jbrunet@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/meson/axg-tdm-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-= interface.c index 01cc551a8e3fa..2a7ea41fc49e5 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -258,8 +258,8 @@ static int axg_tdm_iface_set_sclk(struct snd_soc_dai *d= ai, srate =3D iface->slots * iface->slot_width * params_rate(params); =20 if (!iface->mclk_rate) { - /* If no specific mclk is requested, default to bit clock * 4 */ - clk_set_rate(iface->mclk, 4 * srate); + /* If no specific mclk is requested, default to bit clock * 2 */ + clk_set_rate(iface->mclk, 2 * srate); } else { /* Check if we can actually get the bit clock from mclk */ if (iface->mclk_rate % srate) { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94BE3297D4E; Sun, 24 Mar 2024 23:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324344; cv=none; b=X8F1WYTFOOnoprz4mEbbWcamuK7e4DNEf2OWV+glthgnCOUsQ4DlCz67LUXo5MUriQJyR6XbeipO2enyv49uJD/eKlzpwEI8oayjW++p0bXaJZion6WOBiEa7s9sOzefz5NAJbbHjJAWgE7bmYFwXxvS7y1TblGXXVlZtUikPSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324344; c=relaxed/simple; bh=ZAT3ncz812PIt8v3RzdCC/9OCXWgUcc+8Gwq9u9p1Bo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K26bO6bceTTqK+G+PppssoPQ31KyQ720hpGUDvTnFsAsyRFqicBl4K9g0t9/lxXhrwqtjb4L86H6UxaXkFOT75ZxM7bj67L+lojIGjiA25Rq9HB4BgMecBSx/2+tot64RVjXHgEuYWgf6BSoaec7hwqgQ7EsDRh6YGgvgnmigZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oarQq/B0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oarQq/B0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4267C433F1; Sun, 24 Mar 2024 23:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324344; bh=ZAT3ncz812PIt8v3RzdCC/9OCXWgUcc+8Gwq9u9p1Bo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oarQq/B0brE161VG/TPRIiPhXgwb6fPiRzeWbp2c6HLA6D+7Ypa4+7A93wK0rA7OW mKGq48um7U8sILyfDEM6/laqTlbnwF9HTfjHBiDd5JPNaoZjdcWFk58CzoJt+b8fye Ol8+o75tYKrcuBbFKqimiX2Hz41EaJbRxG5m9xrxQvzKU85EJ9J14SxbIw3HG2OR9T 1A2/f2CxrmLOr/PyVvYMKYYVNw708Ki4ZDN7KsvgTOv/YK7Z9puLHqNpzC1J7RA+qG Q7EuVTH6f49xn2+T+INgjWVq77ATZxMjItRoqmG6sKYq90I8lieHTQnHyBdd87hbQG z233azaJN1MiA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivasan Shanmugam , Jammy Zhou , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 114/148] drm/amdgpu: Fix missing break in ATOM_ARG_IMM Case of atom_get_src_int() Date: Sun, 24 Mar 2024 19:49:38 -0400 Message-ID: <20240324235012.1356413-115-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Srinivasan Shanmugam [ Upstream commit 7cf1ad2fe10634238b38442a851d89514cb14ea2 ] Missing break statement in the ATOM_ARG_IMM case of a switch statement, adds the missing break statement, ensuring that the program's control flow is as intended. Fixes the below: drivers/gpu/drm/amd/amdgpu/atom.c:323 atom_get_src_int() warn: ignoring unr= eachable code. Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)") Cc: Jammy Zhou Cc: Christian K=C3=B6nig Cc: Alex Deucher Signed-off-by: Srinivasan Shanmugam Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu= /atom.c index 0222bb7ea49b4..805ac556635d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/atom.c +++ b/drivers/gpu/drm/amd/amdgpu/atom.c @@ -306,7 +306,7 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx= , uint8_t attr, DEBUG("IMM 0x%02X\n", val); return val; } - return 0; + break; case ATOM_ARG_PLL: idx =3D U8(*ptr); (*ptr)++; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C29F297D65; Sun, 24 Mar 2024 23:52:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324347; cv=none; b=nZLpbsIrqNwAh1hjY013S6Diz/gsogA5R9joFBoMWykTGw4c/fhmEyNjRvnT34VwgQcFzAps7mo0QlUAeVce4qe4dE6oWamV8v26PG7KBGM14CueN+e045XC8LgqfN2kcrqnVZDU+AbiAq8GQWtYNat9w7XbbfBw7u/aFLiUxTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324347; c=relaxed/simple; bh=u7Zf4bD+Y7udepLlcLk7p8H0EMJhFzh/6XX54JfeMXc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eoqeh6T2IhoLr2BbqHCAE/H5XCR6SLE8iIBtp8s6l/adQBeReZU4UN3Pof8XysuAgPFp61PGrQY6apMdVLa3DIIv6aOpSzQmU2P0bFy8NGU6jahS046vpjtz3lecocgv312pDY/l5SHowz++EhTawmZ67pFtxQaSCuSX7hVriZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C7Id2qGK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C7Id2qGK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA8F1C43390; Sun, 24 Mar 2024 23:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324346; bh=u7Zf4bD+Y7udepLlcLk7p8H0EMJhFzh/6XX54JfeMXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7Id2qGKKCs23cqtc7rg6+0IQA8Ul+heCS7443IHzqe8hY/oXYf7KDdEecfeIAb3C FvWWpvWibER0oCZAfpkAHPcLmBqsybuMeUrl8/YRtBPoH2SGi+JRNdko1pbMtqKBrD B+dOKl658bzk+Z2DO/wgr8qWxGriBaSi+OuNML/S/KyoGueU0iEhdup6LK4dmVTWdA 3l6iDHWQdo9yaWIoFgNiteKJ+wh4igT9pjECVRTukQHDzBJ7deGa04CwBtgf2i8wQa ayMp5vx9r3XQRFK3uVUHIV9j/RTwSgrlS/GylQH39oK1mt7l4vVNHbINjgNLEeoBki OwcL3jYEane5A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Edward Adam Davis , syzbot+ce750e124675d4599449@syzkaller.appspotmail.com, Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 115/148] media: pvrusb2: fix uaf in pvr2_context_set_notify Date: Sun, 24 Mar 2024 19:49:39 -0400 Message-ID: <20240324235012.1356413-116-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Edward Adam Davis [ Upstream commit 0a0b79ea55de8514e1750884e5fec77f9fdd01ee ] [Syzbot reported] BUG: KASAN: slab-use-after-free in pvr2_context_set_notify+0x2c4/0x310 driv= ers/media/usb/pvrusb2/pvrusb2-context.c:35 Read of size 4 at addr ffff888113aeb0d8 by task kworker/1:1/26 CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 6.8.0-rc1-syzkaller-00046-gf1a= 27f081c1f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 01/25/2024 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-cont= ext.c:35 pvr2_context_notify drivers/media/usb/pvrusb2/pvrusb2-context.c:95 [inline] pvr2_context_disconnect+0x94/0xb0 drivers/media/usb/pvrusb2/pvrusb2-contex= t.c:272 Freed by task 906: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x106/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x105/0x340 mm/slub.c:4409 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:137 [inline] pvr2_context_thread_func+0x69d/0x960 drivers/media/usb/pvrusb2/pvrusb2-cont= ext.c:158 [Analyze] Task A set disconnect_flag =3D !0, which resulted in Task B's condition bei= ng met and releasing mp, leading to this issue. [Fix] Place the disconnect_flag assignment operation after all code in pvr2_conte= xt_disconnect() to avoid this issue. Reported-and-tested-by: syzbot+ce750e124675d4599449@syzkaller.appspotmail.c= om Fixes: e5be15c63804 ("V4L/DVB (7711): pvrusb2: Fix race on module unload") Signed-off-by: Edward Adam Davis Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/pvrusb2/pvrusb2-context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/us= b/pvrusb2/pvrusb2-context.c index 28a9cfef8f9f2..698b2cf65526d 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-context.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-context.c @@ -276,9 +276,9 @@ static void pvr2_context_exit(struct pvr2_context *mp) void pvr2_context_disconnect(struct pvr2_context *mp) { pvr2_hdw_disconnect(mp->hdw); - mp->disconnect_flag =3D !0; if (!pvr2_context_shutok()) pvr2_context_notify(mp); + mp->disconnect_flag =3D !0; } =20 =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C78B297D75; Sun, 24 Mar 2024 23:52:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324348; cv=none; b=SOCJROqUeY5tjGWqHxmeQT8xzslAEs1ceI5Nl3rnS/hVEL0b1z//fQT88B7A3x57+0wWUNCOcr7/0ZS8+0EsVLne4cFlZB4Gi64FA+MAGulx7BC97LnCz4wtIOCu+WZUbqCpe4ltJyS64l15zSsD2qlPbWCKwPJTzuTUDxW7EhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324348; c=relaxed/simple; bh=9hDq8AwRgk19coc1GvtDBGMHiiNIlyP+muhMLhLjsIc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uXfqpYKDn43Dua673WNA7A3P/6ZvwILL4MI8wAvZXHIQHLeSh9uWahJKAkNB7VoVmc4CMOt2uWRoq+Xjas3gTOiMtox/G/sU7zFwZehX040KBAGs0logiy+LcG3FpyUvfG1e2UCJg2rR53hclcBKhZR6uXJ+XY8rylSTOuMZ97o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hrp3nPLh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hrp3nPLh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CBAAC433F1; Sun, 24 Mar 2024 23:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324347; bh=9hDq8AwRgk19coc1GvtDBGMHiiNIlyP+muhMLhLjsIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hrp3nPLhqhnQ0olVmyjJjz0Yiwb6hiJX5Pl2CyP/4NM/0eiCl0KEi79BAt0Tsx+gC d9DzDMUfKNG3bmcA0gXxDlmW9vuPcBwHlb4t/9gLa8K6V9s5xH2PF1sO2XlFlRYHg8 /TIXpH14Yv4BfCYP9uhO16G1oqUFtMb2JQF/ND5u/ho8uPBRkte/qWbB0kd+ysbhc+ RXQGexBBZ0I/CNyt99EiE7HR4gwpIU4tuowVEKedqu0vzr6Uk9jO+hI20sN3xB3p5J teBFKJIw3UfcIAZZfXLtVApugzaaLASqkoG/ytPzO4wlOfjhENQDXLaXGMUXRasabp PhfD+FdL7+PrA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Justin Stitt , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 116/148] media: dvb-frontends: avoid stack overflow warnings with clang Date: Sun, 24 Mar 2024 19:49:40 -0400 Message-ID: <20240324235012.1356413-117-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 7a4cf27d1f0538f779bf31b8c99eda394e277119 ] A previous patch worked around a KASAN issue in stv0367, now a similar problem showed up with clang: drivers/media/dvb-frontends/stv0367.c:1222:12: error: stack frame size (362= 4) exceeds limit (2048) in 'stv0367ter_set_frontend' [-Werror,-Wframe-large= r-than] 1214 | static int stv0367ter_set_frontend(struct dvb_frontend *fe) Rework the stv0367_writereg() function to be simpler and mark both register access functions as noinline_for_stack so the temporary i2c_msg structures do not get duplicated on the stack when KASAN_STACK is enabled. Fixes: 3cd890dbe2a4 ("media: dvb-frontends: fix i2c access helpers for KASA= N") Signed-off-by: Arnd Bergmann Reviewed-by: Justin Stitt Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/dvb-frontends/stv0367.c | 34 +++++++-------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-fron= tends/stv0367.c index 49f4472f09fa8..7a5b27de725e0 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -128,50 +128,32 @@ static const s32 stv0367cab_RF_LookUp2[RF_LOOKUP_TABL= E2_SIZE][RF_LOOKUP_TABLE2_S } }; =20 -static -int stv0367_writeregs(struct stv0367_state *state, u16 reg, u8 *data, int = len) +static noinline_for_stack +int stv0367_writereg(struct stv0367_state *state, u16 reg, u8 data) { - u8 buf[MAX_XFER_SIZE]; + u8 buf[3] =3D { MSB(reg), LSB(reg), data }; struct i2c_msg msg =3D { .addr =3D state->config->demod_address, .flags =3D 0, .buf =3D buf, - .len =3D len + 2 + .len =3D 3, }; int ret; =20 - if (2 + len > sizeof(buf)) { - printk(KERN_WARNING - "%s: i2c wr reg=3D%04x: len=3D%d is too big!\n", - KBUILD_MODNAME, reg, len); - return -EINVAL; - } - - - buf[0] =3D MSB(reg); - buf[1] =3D LSB(reg); - memcpy(buf + 2, data, len); - if (i2cdebug) printk(KERN_DEBUG "%s: [%02x] %02x: %02x\n", __func__, - state->config->demod_address, reg, buf[2]); + state->config->demod_address, reg, data); =20 ret =3D i2c_transfer(state->i2c, &msg, 1); if (ret !=3D 1) printk(KERN_ERR "%s: i2c write error! ([%02x] %02x: %02x)\n", - __func__, state->config->demod_address, reg, buf[2]); + __func__, state->config->demod_address, reg, data); =20 return (ret !=3D 1) ? -EREMOTEIO : 0; } =20 -static int stv0367_writereg(struct stv0367_state *state, u16 reg, u8 data) -{ - u8 tmp =3D data; /* see gcc.gnu.org/bugzilla/show_bug.cgi?id=3D81715 */ - - return stv0367_writeregs(state, reg, &tmp, 1); -} - -static u8 stv0367_readreg(struct stv0367_state *state, u16 reg) +static noinline_for_stack +u8 stv0367_readreg(struct stv0367_state *state, u16 reg) { u8 b0[] =3D { 0, 0 }; u8 b1[] =3D { 0 }; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92F26297D69; Sun, 24 Mar 2024 23:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324349; cv=none; b=IccQt1DEp49CGgeAKSq8GenwqZYjFs/moW6Pw0cNyvh8E6UJfSmcnv3+vibmmcgmAqXjrItTVlY7L2t8n26wHlJWoS15FZQhE2j+dEhGTWxe4Z+UE1763NzTMyXME9LuIbRa8RfzsnuUtyMGBe6m46QHRg1/agKPR+PHpnugpNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324349; c=relaxed/simple; bh=yQrRVRg9O4wS1MvntWCu1dUYsbk/+L2CI1WsSOqBqYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qqYB5ETyzp7YQ30fPON3mTZtnVfxfawGAdYCbAe0CQmG91bgg6olcD+y19cNplJOCTbVBSp5lcfjRBA5LYzY14AWR0QjKrE2AJCkR4nru1RCdcxd0r/CubVFIe0v3INhHw5U5tcUu1hzgwmHLXY1n2Rvu3FrTU4qv+oU09KOCO8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T7YFjK9+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="T7YFjK9+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0A1FC43390; Sun, 24 Mar 2024 23:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324348; bh=yQrRVRg9O4wS1MvntWCu1dUYsbk/+L2CI1WsSOqBqYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7YFjK9+aMLu2WcDK6j1P0OicW2/MJ6kGnuUdtvJiN52nDciVSczrTOj96eHYw6Z/ MKHzie6vjMBZ0mxfpKbPxr4HwxBYm22jfEDsfxxAgIYPNfjs9a9OuDmCtevH0ezwBI eD56GLhl10EBCrWyUf1Tr3r8+f0S05Vr4+qaKudFCS2bMhgYqdt67WMmh+JEKpEvDD 91DuAKF3G7mMqDJ2jpQD2Ej5hqaYs3lPrH9ksDFaPcpRjQrDbSLFzFy6D3/W/ew3Or F6aYuT1K1X+kqnmhVqiFi2UVMcpXO6jub50urGnKjygvbObSBIwT1oFmO0s1D/FCUJ AAuqQ+eul5N0g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhipeng Lu , Hans Verkuil , Sasha Levin Subject: [PATCH 4.19 117/148] media: go7007: fix a memleak in go7007_load_encoder Date: Sun, 24 Mar 2024 19:49:41 -0400 Message-ID: <20240324235012.1356413-118-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhipeng Lu [ Upstream commit b9b683844b01d171a72b9c0419a2d760d946ee12 ] In go7007_load_encoder, bounce(i.e. go->boot_fw), is allocated without a deallocation thereafter. After the following call chain: saa7134_go7007_init |-> go7007_boot_encoder |-> go7007_load_encoder |-> kfree(go) go is freed and thus bounce is leaked. Fixes: 95ef39403f89 ("[media] go7007: remember boot firmware") Signed-off-by: Zhipeng Lu Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/go7007/go7007-driver.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/g= o7007/go7007-driver.c index c7b5a3321cd74..15f78d3ce3bac 100644 --- a/drivers/media/usb/go7007/go7007-driver.c +++ b/drivers/media/usb/go7007/go7007-driver.c @@ -88,7 +88,7 @@ static int go7007_load_encoder(struct go7007 *go) const struct firmware *fw_entry; char fw_name[] =3D "go7007/go7007fw.bin"; void *bounce; - int fw_len, rv =3D 0; + int fw_len; u16 intr_val, intr_data; =20 if (go->boot_fw =3D=3D NULL) { @@ -117,9 +117,11 @@ static int go7007_load_encoder(struct go7007 *go) go7007_read_interrupt(go, &intr_val, &intr_data) < 0 || (intr_val & ~0x1) !=3D 0x5a5a) { v4l2_err(go, "error transferring firmware\n"); - rv =3D -1; + kfree(go->boot_fw); + go->boot_fw =3D NULL; + return -1; } - return rv; + return 0; } =20 MODULE_FIRMWARE("go7007/go7007fw.bin"); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B60B297D7F; Sun, 24 Mar 2024 23:52:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324350; cv=none; b=K7GYzb6FWm5hW+HYrddowG1+rkYemphN8awQzyleopgDoAfFxoCIBqoiHJJZ9HkcJP5XXEdlG9EWi1BYYDwOpo1hfSh6umUwWWwhKClpQBae3nap8nl3unySBIraTV3H8qkHuQv1xuYjTlveMDDzup/ya41Iuo2v56nj08fc1x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324350; c=relaxed/simple; bh=K2LQes7JjM0UFh5ceniDTXtDQaOnZxHXjD4dPexjMAs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=miioF8IVo6JEwM0ZEbNqrk0Zj12LpZNrgtE11DBGjJseZ6vTj9OOTLQGp2BDieJR/UrSwhnc73YwhFXD3WvmJWSAm7QMaqlApnqby9dOU1Ixk5wAhnhCfIGcXgEDcNjWgJNnq0JSIzj9jF/s1/NZCsz6QRF6qrLxZycSmZ+QHyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kzRfICY2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kzRfICY2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF5CCC433C7; Sun, 24 Mar 2024 23:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324349; bh=K2LQes7JjM0UFh5ceniDTXtDQaOnZxHXjD4dPexjMAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzRfICY2h5vwuZ8hbKrnNNhupus1VeXpaKzuW12k5eiLV1bhkhCvDBEwE1fZ6SUNs /CM/IMHeaq+cRfGWoWYxDgZ4Gw2o5a1ND3URWNMNY/DqUnzwiTPybVLaf+1Zz9X8KS oyPAF5pQYa6mNwfu557y05D0ALgYCKtNezhPR4UHkGR5tSrIVV+YCF8/93WGvTuhYA pZib8oAT5gaI7f29iQuX9ETD2Ku9pD6r6SYLX0vOjKNsCmZ92fGW8eVRDFCHZU7KfR vN2Mf59OWHZy/WflMyjxM7TKTVbD3vxkv+oFsho0hJ9C2JMyan+lnk7x/uqvw09oyJ PhmXkcAq8dwQQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hsin-Yi Wang , CK Hu , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 4.19 118/148] drm/mediatek: Fix a null pointer crash in mtk_drm_crtc_finish_page_flip Date: Sun, 24 Mar 2024 19:49:42 -0400 Message-ID: <20240324235012.1356413-119-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Hsin-Yi Wang [ Upstream commit c958e86e9cc1b48cac004a6e245154dfba8e163b ] It's possible that mtk_crtc->event is NULL in mtk_drm_crtc_finish_page_flip(). pending_needs_vblank value is set by mtk_crtc->event, but in mtk_drm_crtc_atomic_flush(), it's is not guarded by the same lock in mtk_drm_finish_page_flip(), thus a race condition happens. Consider the following case: CPU1 CPU2 step 1: mtk_drm_crtc_atomic_begin() mtk_crtc->event is not null, step 1: mtk_drm_crtc_atomic_flush: mtk_drm_crtc_update_config( !!mtk_crtc->event) step 2: mtk_crtc_ddp_irq -> mtk_drm_finish_page_flip: lock mtk_crtc->event set to null, pending_needs_vblank set to false unlock pending_needs_vblank set to true, step 2: mtk_crtc_ddp_irq -> mtk_drm_finish_page_flip called again, pending_needs_vblank is still true //null pointer Instead of guarding the entire mtk_drm_crtc_atomic_flush(), it's more efficient to just check if mtk_crtc->event is null before use. Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.= ") Signed-off-by: Hsin-Yi Wang Reviewed-by: CK Hu Link: https://patchwork.kernel.org/project/dri-devel/patch/20240223212404.3= 709690-1-hsinyi@chromium.org/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/medi= atek/mtk_drm_crtc.c index eac9caf322f90..fb7262ed9b699 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -79,11 +79,13 @@ static void mtk_drm_crtc_finish_page_flip(struct mtk_dr= m_crtc *mtk_crtc) struct drm_crtc *crtc =3D &mtk_crtc->base; unsigned long flags; =20 - spin_lock_irqsave(&crtc->dev->event_lock, flags); - drm_crtc_send_vblank_event(crtc, mtk_crtc->event); - drm_crtc_vblank_put(crtc); - mtk_crtc->event =3D NULL; - spin_unlock_irqrestore(&crtc->dev->event_lock, flags); + if (mtk_crtc->event) { + spin_lock_irqsave(&crtc->dev->event_lock, flags); + drm_crtc_send_vblank_event(crtc, mtk_crtc->event); + drm_crtc_vblank_put(crtc); + mtk_crtc->event =3D NULL; + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); + } } =20 static void mtk_drm_finish_page_flip(struct mtk_drm_crtc *mtk_crtc) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CAA3184F16; Sun, 24 Mar 2024 23:52:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324351; cv=none; b=UWcmvPMcExEUMXdJBDK2c0ZKg6+sDn8zDxiCYye39h/faOwlI2U+IQNcF+fmf7Nq+Q3q5maL7rRY9QYCaPpfnlEYBrq27VVjPxosuKAhFdgeEfQDkNch6XLmegcT7jz4AO2u8b5xJmSTt4DvjU4Qm5VWErDs1iTummrjZRe7YC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324351; c=relaxed/simple; bh=xdYX57chPMnvS6qLPTAspRcpHQPWGDUFRC2Tqpzle2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ByLdEBlpepfmFCnLFPQsxnCt+/CjyO0MXW5CZy85gkagwRGbhZCgLAiqO/lg98dZjdk2ZPDQYZLP4F7tp1bJZJQ49Qp98IfZ7ChD7jQzbsMYDkUe6odXk47tPUQamHUv9i3eJLu7EDaeIcrj9ORTlTWTMEgbmypqEISh3VfpqbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r1iFPM4b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r1iFPM4b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEC6EC433F1; Sun, 24 Mar 2024 23:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324351; bh=xdYX57chPMnvS6qLPTAspRcpHQPWGDUFRC2Tqpzle2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1iFPM4baYRvbF7BqnJWJhOnQESqP9e3oDPQy7xjOcxiRpkhHo6Uq7QOiP8STbGlU QBGe1BM1MWHB9jPlJqjiS2pkg6zvkO/7xHGwZV1xB2HmwwRBUKYzr0j7ReuqFX47eT WycUa1jtTlVUqNhV+xPu2iCyMIeogmjdDNsVEgTAEVQpHZtag3mpQH5mXuDnTjVcNe 6UsyrccrLU7vOi8pTlkzTKbtVFJZVJFZLcLDuTdA/5DcuNHaD8jCLO2owwu7A/MfYz pwOMwTut8OjJTH6twbdyRF4xg9PgjGjyQgS71qY+ByE26uwBQAIOCjyfAWMdyaqw/o dSddhlO+DPFXA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kajol Jain , Akanksha J N , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 119/148] powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks Date: Sun, 24 Mar 2024 19:49:43 -0400 Message-ID: <20240324235012.1356413-120-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kajol Jain [ Upstream commit ad86d7ee43b22aa2ed60fb982ae94b285c1be671 ] Running event hv_gpci/dispatch_timebase_by_processor_processor_time_in_time= base_cycles,phys_processor_idx=3D0/ in one of the system throws below error: ---Logs--- # perf list | grep hv_gpci/dispatch_timebase_by_processor_processor_time_i= n_timebase_cycles hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,= phys_processor_idx=3D?/[Kernel PMU event] # perf stat -v -e hv_gpci/dispatch_timebase_by_processor_processor_time_in= _timebase_cycles,phys_processor_idx=3D0/ sleep 2 Using CPUID 00800200 Control descriptor is not initialized Warning: hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,ph= ys_processor_idx=3D0/ event is not supported by the kernel. failed to read counter hv_gpci/dispatch_timebase_by_processor_processor_tim= e_in_timebase_cycles,phys_processor_idx=3D0/ Performance counter stats for 'system wide': hv_gpci/dispatch_timebase_by_processor_processor_ti= me_in_timebase_cycles,phys_processor_idx=3D0/ 2.000700771 seconds time elapsed The above error is because of the hcall failure as required permission "Enable Performance Information Collection" is not set. Based on current code, single_gpci_request function did not check the error type incase hcall fails and by default returns EINVAL. But we can have other reasons for hcall failures like H_AUTHORITY/H_PARAMETER with detail_rc as GEN_BUF_TOO_SMALL, for which we need to act accordingly. Fix this issue by adding new checks in the single_gpci_request and h_gpci_event_init functions. Result after fix patch changes: # perf stat -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_ti= mebase_cycles,phys_processor_idx=3D0/ sleep 2 Error: No permission to enable hv_gpci/dispatch_timebase_by_processor_processor_ti= me_in_timebase_cycles,phys_processor_idx=3D0/ event. Fixes: 220a0c609ad1 ("powerpc/perf: Add support for the hv gpci (get perfor= mance counter info) interface") Reported-by: Akanksha J N Signed-off-by: Kajol Jain Signed-off-by: Michael Ellerman Link: https://msgid.link/20240229122847.101162-1-kjain@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/perf/hv-gpci.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c index 126409bb5626e..8ae70b5952a54 100644 --- a/arch/powerpc/perf/hv-gpci.c +++ b/arch/powerpc/perf/hv-gpci.c @@ -157,6 +157,20 @@ static unsigned long single_gpci_request(u32 req, u32 = starting_index, =20 ret =3D plpar_hcall_norets(H_GET_PERF_COUNTER_INFO, virt_to_phys(arg), HGPCI_REQ_BUFFER_SIZE); + + /* + * ret value as 'H_PARAMETER' with detail_rc as 'GEN_BUF_TOO_SMALL', + * specifies that the current buffer size cannot accommodate + * all the information and a partial buffer returned. + * Since in this function we are only accessing data for a given starting= index, + * we don't need to accommodate whole data and can get required count by + * accessing first entry data. + * Hence hcall fails only incase the ret value is other than H_SUCCESS or + * H_PARAMETER with detail_rc value as GEN_BUF_TOO_SMALL(0x1B). + */ + if (ret =3D=3D H_PARAMETER && be32_to_cpu(arg->params.detail_rc) =3D=3D 0= x1B) + ret =3D 0; + if (ret) { pr_devel("hcall failed: 0x%lx\n", ret); goto out; @@ -221,6 +235,7 @@ static int h_gpci_event_init(struct perf_event *event) { u64 count; u8 length; + unsigned long ret; =20 /* Not our event */ if (event->attr.type !=3D event->pmu->type) @@ -260,13 +275,23 @@ static int h_gpci_event_init(struct perf_event *event) } =20 /* check if the request works... */ - if (single_gpci_request(event_get_request(event), + ret =3D single_gpci_request(event_get_request(event), event_get_starting_index(event), event_get_secondary_index(event), event_get_counter_info_version(event), event_get_offset(event), length, - &count)) { + &count); + + /* + * ret value as H_AUTHORITY implies that partition is not permitted to re= trieve + * performance information, and required to set + * "Enable Performance Information Collection" option. + */ + if (ret =3D=3D H_AUTHORITY) + return -EPERM; + + if (ret) { pr_devel("gpci hcall failed\n"); return -EINVAL; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B1B9184F1E; Sun, 24 Mar 2024 23:52:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324352; cv=none; b=uJbbDu9UZg648LlS2mrxDzG2Lu9W4eHeQXbMRdVfrGG8CV2JnlbbhAbRcby4IHbJ8G0f6G4nYMRHBCZHC3ghi1nXDHUabb+cGzDOFPVjRS82t2o6C9+FTq11NnYDINRIgrL29lrWVpEQtSZSq5GEzOwhGG152RktfEUobT+AXeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324352; c=relaxed/simple; bh=IgTe3n66YGsLtCAM6MmQvEeSa0QRWAfowfES3Es53+M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nb2R+vs7+Aqnq9wcdZ3iqVqqGUysQnkli2t+jGy80tSCpN8LC3kAbSYNIrb6W/7gcZPErklygwkifhXZx1iFDwbzmB/jXXu5egsMKBF1rPX/V/UplIC8jXqi4xcFy+rFmcg8OIVn81PT6BJmvknRYu86CkMy31BwWoJOw7yqLZ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pV/YlrOM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pV/YlrOM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75869C43394; Sun, 24 Mar 2024 23:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324352; bh=IgTe3n66YGsLtCAM6MmQvEeSa0QRWAfowfES3Es53+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pV/YlrOMfifLRCUTfL4UgWGdQGtkRuugNxfI21Kf4942NSjRxic0BIrCpNPWAZu7R 7d+2tWrgMNv9zhD6ftSz6joeYPAPRWlo8ZT5DfKQpVw4WU1Ey93a40o2eOjOfLO1wK 7M9HBDExvq0wBWY9RVDt/fQpTLvNZFO4Hn6owxXEgwHakEQrQBSQtfdI2cSnc8HFFi s5QsilBDIJTZ+90EyGRBin0FcdR0nsnxrSZBFf/mohmErRGYcAKVDKcxKsbDgSLRNc RMd4hNqnSei48XsZzoheTm/B1wsX69PlSAWo2cN1qpA+ADhhqTpbjGEVZJAOaYW9sd n0hXZIfYBvaBw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 120/148] powerpc/embedded6xx: Fix no previous prototype for avr_uart_send() etc. Date: Sun, 24 Mar 2024 19:49:44 -0400 Message-ID: <20240324235012.1356413-121-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Michael Ellerman [ Upstream commit 20933531be0577cdd782216858c26150dbc7936f ] Move the prototypes into mpc10x.h which is included by all the relevant C files, fixes: arch/powerpc/platforms/embedded6xx/ls_uart.c:59:6: error: no previous pro= totype for 'avr_uart_configure' arch/powerpc/platforms/embedded6xx/ls_uart.c:82:6: error: no previous pro= totype for 'avr_uart_send' Signed-off-by: Michael Ellerman Link: https://msgid.link/20240305123410.3306253-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/platforms/embedded6xx/linkstation.c | 3 --- arch/powerpc/platforms/embedded6xx/mpc10x.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerp= c/platforms/embedded6xx/linkstation.c index f514d5d28cd4f..3f3821eb4c36b 100644 --- a/arch/powerpc/platforms/embedded6xx/linkstation.c +++ b/arch/powerpc/platforms/embedded6xx/linkstation.c @@ -97,9 +97,6 @@ static void __init linkstation_init_IRQ(void) mpic_init(mpic); } =20 -extern void avr_uart_configure(void); -extern void avr_uart_send(const char); - static void __noreturn linkstation_restart(char *cmd) { local_irq_disable(); diff --git a/arch/powerpc/platforms/embedded6xx/mpc10x.h b/arch/powerpc/pla= tforms/embedded6xx/mpc10x.h index 5ad12023e5628..ebc258fa4858d 100644 --- a/arch/powerpc/platforms/embedded6xx/mpc10x.h +++ b/arch/powerpc/platforms/embedded6xx/mpc10x.h @@ -156,4 +156,7 @@ int mpc10x_disable_store_gathering(struct pci_controlle= r *hose); /* For MPC107 boards that use the built-in openpic */ void mpc10x_set_openpic(void); =20 +void avr_uart_configure(void); +void avr_uart_send(const char c); + #endif /* __PPC_KERNEL_MPC10X_H */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 639721856B1; Sun, 24 Mar 2024 23:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324354; cv=none; b=IUezCdFeuhaPdpg7gQr98BIqzZmDZqk6zsgvFyxykWaq8FYgOwI9NaZA0bLToKofUZvIzD28acsHO6Er8sPFBKL/KS/6wh1E6xD8BeAqUk/F+X6i+xsgMg2LlS2kU7WP+/Jx4c/NpSZ7dW3+ZF8uEeDjJ/UP2ASgUe5wAjlTzJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324354; c=relaxed/simple; bh=jmRt95aAvbdTkwPTFzoMRF6qwJaIm36qxy69NxlNjl8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FrhgOq/1r+IwB0Dp8kf6LZZBSxmfWwTleIvam8skgjy76Ey+385lJLxVZdoSFjcY52+znh9hyP4d7O0W21MOorewzxt4EqLx5XdLYyx80zwn6fsdoEL4RsAhgaH5uW+mE9XpVpq5xWuFIfQgOB/GLyiQjuuL0s3jjZthfiHago0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y9SJDf2E; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y9SJDf2E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BCB1C433C7; Sun, 24 Mar 2024 23:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324353; bh=jmRt95aAvbdTkwPTFzoMRF6qwJaIm36qxy69NxlNjl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9SJDf2ER2DQdQDfLdramuO6j+Q8fMVFvwoHCLk4UpoHwPT24o9JDLe7nFs4mFwhA ZNYKFq+RpgNfngZAh1kz8X/IKYHLvHApOqwtdFakXv+R0wgDaOR6PGu+E3H9eBGEpE hZunZ0mPw/Wf409WxuvsTmN57L9bWAceNYKWKFWHBE/e1HN496J4YuzqgQPlPzLtcj U1NCfl81yDfiG6c0v23i2A9y5bpLxMkEXd8QCWFf9pKzPASkjyAEuYJCsbq8o1fcTe dd8oL2eIcqP05l7VEQh3iNLkANgiB2xaE3jEcbRgSUZdljxZ70ER6Ef//p8p5BIcuo tnrJqZQc3XwfA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Luca Weiss , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 4.19 121/148] backlight: lm3630a: Initialize backlight_properties on init Date: Sun, 24 Mar 2024 19:49:45 -0400 Message-ID: <20240324235012.1356413-122-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Luca Weiss [ Upstream commit ad9aeb0e3aa90ebdad5fabf9c21783740eb95907 ] The backlight_properties struct should be initialized to zero before using, otherwise there will be some random values in the struct. Fixes: 0c2a665a648e ("backlight: add Backlight driver for lm3630 chip") Signed-off-by: Luca Weiss Reviewed-by: Daniel Thompson Link: https://lore.kernel.org/r/20240220-lm3630a-fixups-v1-1-9ca62f7e4a33@z= 3ntu.xyz Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/lm3630a_bl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight= /lm3630a_bl.c index f17e5a8860fa7..70f5ea5f210cc 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -332,6 +332,7 @@ static int lm3630a_backlight_register(struct lm3630a_ch= ip *pchip) struct backlight_properties props; struct lm3630a_platform_data *pdata =3D pchip->pdata; =20 + memset(&props, 0, sizeof(struct backlight_properties)); props.type =3D BACKLIGHT_RAW; if (pdata->leda_ctrl !=3D LM3630A_LEDA_DISABLE) { props.brightness =3D pdata->leda_init_brt; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2ED8E2987A1; Sun, 24 Mar 2024 23:52:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324356; cv=none; b=V65F03TQN+WTZVmDHpNuWN81rtq9PI5uI6iFWND6O79lPawJZzRQpuLopm7kW68X3o1cdXN77LCeUXXvcrld8dOYaKZrsDDlzF2/EzSEAKkHbCLwDPejqizJBDj3p1aeV+Nfc1Clva1IPKTgfzqX9zNf7JosWl6aHEhp3RRXpsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324356; c=relaxed/simple; bh=mdotRbRW3+D/0FDAKISCwVBK6CS6MfBHluslxDPlEfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PnaF83anlnPllf5KVNkSdMnE0XP8/IQB99UytOvNARJmWGlK/Pm66b9+K1dT+NbQgEtSiuRBN0Iq+N6K2OA+z9zMPOIoWU9x15sPTf6o6B6RMmsp957DzIqQN9bK/dUVq57unzMojXE+ZTuqoDaj8qfYFy6F/27r5V5FYhhPnBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OcFs2qBG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OcFs2qBG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9705C43399; Sun, 24 Mar 2024 23:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324354; bh=mdotRbRW3+D/0FDAKISCwVBK6CS6MfBHluslxDPlEfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OcFs2qBGUXqCsxzMsNd+EFtaGwNOpa9lRSqrwBk6qdCsiwACEhiF0DQF911wNxnSt FoKzmGnAoArZYILlaSAQ3ZnlsJzVra4xrUidCslfq9vUA3VHRQXFcUUD69OV4WxxbT NtgwFFxzQel07s1U8ximqCnrL/68vQzVeFBrp1GXIsaXARWsioAWgloUE+F3OPDLgm KAZrdfW/EvqUJ7r+8Byud+qM9rFb80HJacnN0o5uJ3+V3eh/b4FVZg7nbTnMKiBw+m iVftqw+KjkIAQUAalO6MQmMsyPfkr7MzRYdUgg4w9a9bhfdUGQXMhb7m4Nk9aqTGeH j9LckluphYyFw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Luca Weiss , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 4.19 122/148] backlight: lm3630a: Don't set bl->props.brightness in get_brightness Date: Sun, 24 Mar 2024 19:49:46 -0400 Message-ID: <20240324235012.1356413-123-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Luca Weiss [ Upstream commit 4bf7ddd2d2f0f8826f25f74c7eba4e2c323a1446 ] There's no need to set bl->props.brightness, the get_brightness function is just supposed to return the current brightness and not touch the struct. With that done we can also remove the 'goto out' and just return the value. Fixes: 0c2a665a648e ("backlight: add Backlight driver for lm3630 chip") Signed-off-by: Luca Weiss Reviewed-by: Daniel Thompson Link: https://lore.kernel.org/r/20240220-lm3630a-fixups-v1-2-9ca62f7e4a33@z= 3ntu.xyz Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/lm3630a_bl.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight= /lm3630a_bl.c index 70f5ea5f210cc..874040c465f20 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -223,7 +223,7 @@ static int lm3630a_bank_a_get_brightness(struct backlig= ht_device *bl) if (rval < 0) goto out_i2c_err; brightness |=3D rval; - goto out; + return brightness; } =20 /* disable sleep */ @@ -234,11 +234,8 @@ static int lm3630a_bank_a_get_brightness(struct backli= ght_device *bl) rval =3D lm3630a_read(pchip, REG_BRT_A); if (rval < 0) goto out_i2c_err; - brightness =3D rval; + return rval; =20 -out: - bl->props.brightness =3D brightness; - return bl->props.brightness; out_i2c_err: dev_err(pchip->dev, "i2c failed to access register\n"); return 0; @@ -300,7 +297,7 @@ static int lm3630a_bank_b_get_brightness(struct backlig= ht_device *bl) if (rval < 0) goto out_i2c_err; brightness |=3D rval; - goto out; + return brightness; } =20 /* disable sleep */ @@ -311,11 +308,8 @@ static int lm3630a_bank_b_get_brightness(struct backli= ght_device *bl) rval =3D lm3630a_read(pchip, REG_BRT_B); if (rval < 0) goto out_i2c_err; - brightness =3D rval; + return rval; =20 -out: - bl->props.brightness =3D brightness; - return bl->props.brightness; out_i2c_err: dev_err(pchip->dev, "i2c failed to access register\n"); return 0; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 026C32987A3; Sun, 24 Mar 2024 23:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324357; cv=none; b=kPD1067vGItL8NxWUb8adLr2QBTlAIa7okvf5Y2WJohMK72ML3zYDIW0h1XGPICfKNWrXChI4rh7eSp2tArBzMxRMFw4AQbQeLIwAkKTxAx+md28U6Fc3MdbpO4tIY9aHAE/xc5jCUempiR7cL9qDH+IawG9vH7ZZc+9Cw45oN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324357; c=relaxed/simple; bh=0RYRcER2L99FYnTEc7JLAZOU2F2QK6UDRlV34NIjQKc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=opbm7vUQRD41DQQj9ofN3G9gYt4NPvDtwlxHg2pFEKEO2DhyD41JZoZIrJlSzZ6Th7HXdNf5HKIKNovOqcA3sw3/EumvyvLoSSDzDCJWbA5POLRBm+rC2kFRP9wYk023jIxwlfZ5Gm8Kdsza5skrZmc74mF50/N4iZEvWfRA4qo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H8gNrxcV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H8gNrxcV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0435C433C7; Sun, 24 Mar 2024 23:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324355; bh=0RYRcER2L99FYnTEc7JLAZOU2F2QK6UDRlV34NIjQKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8gNrxcVL3WIx4NVIQ4G3PgG3eB5ZzCvL6Ekd9k6NF6lzyOEmBJfFGQfTH8Ihn/Es fW4p+a/u97Ja/gut0Gjhh88ZbqAgZrSd59WWexKssCT0klSWGMufesTjJdG5H/PjvD QOVo9duA/5rnfDQ+SbK0dckRbpi1E99D0Kv+FY70AOeHA5EVX09gUQMiTmbnezn6nU 0wG5LpGpwNMt72qSoA6pOudSQd5G6QKNlKZ3Yx0C7e6h6+yMX45MscDdyHhyDlX5RP e1w9g4245VhHCH+35o1MBWMi5ywoNqyRFpXC8wdwRoe9KKt6xczpjvKeQ/EwQM84Sa uIlhROvLhL+nA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 4.19 123/148] backlight: da9052: Fully initialize backlight_properties during probe Date: Sun, 24 Mar 2024 19:49:47 -0400 Message-ID: <20240324235012.1356413-124-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Daniel Thompson [ Upstream commit 0285e9efaee8276305db5c52a59baf84e9731556 ] props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)! Fixes: 6ede3d832aaa ("backlight: add driver for DA9052/53 PMIC v1") Signed-off-by: Daniel Thompson Link: https://lore.kernel.org/r/20240220153532.76613-2-daniel.thompson@lina= ro.org Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/da9052_bl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/= da9052_bl.c index 49035c12739a1..d48513eb3bc5f 100644 --- a/drivers/video/backlight/da9052_bl.c +++ b/drivers/video/backlight/da9052_bl.c @@ -122,6 +122,7 @@ static int da9052_backlight_probe(struct platform_devic= e *pdev) wleds->led_reg =3D platform_get_device_id(pdev)->driver_data; wleds->state =3D DA9052_WLEDS_OFF; =20 + memset(&props, 0, sizeof(struct backlight_properties)); props.type =3D BACKLIGHT_RAW; props.max_brightness =3D DA9052_MAX_BRIGHTNESS; =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B83442987AD; Sun, 24 Mar 2024 23:52:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324357; cv=none; b=Y5QMrENMdsLrWBllmcHZo3YtnTHH494btFLTu7rIpU3ZRo4MfZqV92HPjI2xhtDciRcxLtYYjpPmEnKA60zBCSuWO5a+OrtHy3ByM0s7HzqCYJnETJ2WUTR1z3hqIiBM8SE+BkJJPaeEtDjCPK+RsVl/1QC1mKh/zeY6j2hOHO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324357; c=relaxed/simple; bh=6rOZkmZagTxGbIEmQSiU6HaHcxpk7MeTr4EpEyA+xUE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y4kSVvfhmo1muvP54wm15J5um1jiGHOF7WQpnY0MNmcPbt4EJENwPDMOepeGcT8kC9WkkzfM4OE3zj0ZE9GtbPjJGs/Rkljudq102zgKqZwJXqpECzwYxmYunpvSq2aYEnLHQIlRTE0+7DRULVslQwcKihTwqdO9BFenIG/8Q6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UArEJsp8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UArEJsp8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEBB4C43390; Sun, 24 Mar 2024 23:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324356; bh=6rOZkmZagTxGbIEmQSiU6HaHcxpk7MeTr4EpEyA+xUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UArEJsp8Zm7H/U9Btu2YMIrDMZ57iKlrOUeifnww+5vGgk4VWBCSkkFQfTHinPibN Rq7E3IhzfPwuqJVzu8OYhq9hqUscMUwGMVnNBqsjcp4cTB7DrTddgziOaPKK6OFSWh Y+bWfOcl+nCdAH2CPe44O8pJj9iyE/aUQtDh0G+dCYmh4nfTfOlTQX+YReJDpuba7R NmsJznjD59peiTqCRsFtwiaXmZQrHucWs0hjqTN1g5p0ODBDXrSmcSg5qffqpKzM5J xEw22YC9xOgbhtKgrqaHQlN5bZSJHtCe5tEsD51U+Le8At+UhkSFa0EUr8WZzzSVNE yIFFqFajWB1ig== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 4.19 124/148] backlight: lm3639: Fully initialize backlight_properties during probe Date: Sun, 24 Mar 2024 19:49:48 -0400 Message-ID: <20240324235012.1356413-125-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Daniel Thompson [ Upstream commit abb5a5d951fbea3feb5c4ba179b89bb96a1d3462 ] props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)! Fixes: 0f59858d5119 ("backlight: add new lm3639 backlight driver") Signed-off-by: Daniel Thompson Link: https://lore.kernel.org/r/20240220153532.76613-3-daniel.thompson@lina= ro.org Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/lm3639_bl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/= lm3639_bl.c index 086611c7bc03c..a1ef6f23156db 100644 --- a/drivers/video/backlight/lm3639_bl.c +++ b/drivers/video/backlight/lm3639_bl.c @@ -343,6 +343,7 @@ static int lm3639_probe(struct i2c_client *client, } =20 /* backlight */ + memset(&props, 0, sizeof(struct backlight_properties)); props.type =3D BACKLIGHT_RAW; props.brightness =3D pdata->init_brt_led; props.max_brightness =3D pdata->max_brt_led; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADD292987B5; Sun, 24 Mar 2024 23:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324358; cv=none; b=PB8pW5U+x+kqdM7mp5v46jDkAihlJND5G8u4/Yu34zERxy0IyswY9htObYKB5bd1DB9lzyjuVAJ8DZSFIylSy/CqW18grN7Rv/WduKLIrUMxNedfdqf6Udv3GP1/xGz6jeGU3o+oYLlYnALL8s8x+gSuR2UsLsV+w2yv44irpCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324358; c=relaxed/simple; bh=rhiYJP/xlTwzaguLze3wKiFu10IAp5Eb8qurPQwlfeI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SuPDhd463sJf95bVNB6SRwgY2L3vGw08uJZS8k2Qej5cPVGmO5dJDi/5l8gjWW2zKMdqPg6XVP4YpitnLDysOeaK4kC4xllIl6BoXsJ+OQijN0/ZS1v5C/ihCZKyN0QnHcONOMjnqiRZ2Ko23luFgIqV75sfWyah9p6430V59JI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JrDZPuNt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JrDZPuNt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDDDAC43399; Sun, 24 Mar 2024 23:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324357; bh=rhiYJP/xlTwzaguLze3wKiFu10IAp5Eb8qurPQwlfeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JrDZPuNtaQFUDIbSjDg4znz7opOUq4GvIGIHQegi6p4+W8I0OFV18nT+Jy5jIvSGL YycwIKbXI7ghGoiYBwYYGBmthG651nG8dIUqb8ONPehSLv1EizEuH101czJIfzL9yf /T+WMxe2S6+M6sIIiJBiy8Nl2TvqS3nLrc0mrqyf7C6zLoc3UVAj/RWtSlTcm1t4Jv d2BWFPUkbLvKrgUt7vlDHKZQCzIlz/DonwxOTOePHL+dhkKDJ4F7IBginA52hJ//Wg P0g64X9b5FUJ0JB3Y/WHi0IsJ1dNnE5Ty0+T86wc+lTrFmFsWM+cdwFCy6mVw7KXkt 9IhNATjUUmX8g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 4.19 125/148] backlight: lp8788: Fully initialize backlight_properties during probe Date: Sun, 24 Mar 2024 19:49:49 -0400 Message-ID: <20240324235012.1356413-126-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Daniel Thompson [ Upstream commit 392346827fbe8a7fd573dfb145170d7949f639a6 ] props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)! Fixes: c5a51053cf3b ("backlight: add new lp8788 backlight driver") Signed-off-by: Daniel Thompson Link: https://lore.kernel.org/r/20240220153532.76613-4-daniel.thompson@lina= ro.org Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/lp8788_bl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/= lp8788_bl.c index cf869ec90cce8..a324423f30474 100644 --- a/drivers/video/backlight/lp8788_bl.c +++ b/drivers/video/backlight/lp8788_bl.c @@ -195,6 +195,7 @@ static int lp8788_backlight_register(struct lp8788_bl *= bl) int init_brt; char *name; =20 + memset(&props, 0, sizeof(struct backlight_properties)); props.type =3D BACKLIGHT_PLATFORM; props.max_brightness =3D MAX_BRIGHTNESS; =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB2242987BF; Sun, 24 Mar 2024 23:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324359; cv=none; b=suz6THGIAoXoFACgtJuNWEdKPhShRgdL6lU66++QYLBt3dvrG7GQy/gEgjG0whp1huY2ZfpCZ1YIPjxpqLBd9wZkYizQN1NXf9If9A1rNP7NbQgl50aSl8SxSc6J2HvNlb5GcPIeDE2abm3oSipdLlyGBKVoLhxC6+dGPlY1/TA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324359; c=relaxed/simple; bh=pqyp1rLzShpKc3h8gFSRMG675w0hHlyHiwuFd+JlXfE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZG0grstI3xJhCS6AP6vCYDdSXtm/ZellzsF0B+agWCXbgAN8jQ7ExhVdITUenm2V1L/qrySQ72oe/5apPvk0L6tH0RYmaGTcoy80qYQR5sxcPEwV8Aj5gyAnyC7zQ4rZjuHXTS6UdN7bxEDxpk3S86vw406j999rfZzLWabG2MA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fGLToHXB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fGLToHXB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1E91C433B1; Sun, 24 Mar 2024 23:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324358; bh=pqyp1rLzShpKc3h8gFSRMG675w0hHlyHiwuFd+JlXfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGLToHXBj3OtmUelwRyz2YNH9KWLMpzz8bD8AqTKT7383lXsUvKTusZjAL+KqZrlq WbGnincBbSvuQ/r6nHZI2VOcErAC3MNepF9QommLPuB4XxE+v8ca93yP1PYWMYYMko Fw7Ovqy+hFtr8Jixf8ou6hU0BcBI9LrcZ3bHQ1JKVs8R0hgN+o8piIbIb+PJdDvt/n ViXCBlPJ+l7lAC5eMjc0aV0d6sA3FdrbeAnx0D2H0ZsDGdkUz+xv2cWcjou/yytDry o4Dmgz3Qsi1wa8EpgkB+tXasTHun6KNrnzALqMnywK3vJtFuCIp/O+7vY+kDj4l/1V N6wr5L6hsch3Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thomas Zimmermann , Jani Nikula , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 126/148] arch/powerpc: Remove from backlight code Date: Sun, 24 Mar 2024 19:49:50 -0400 Message-ID: <20240324235012.1356413-127-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Zimmermann [ Upstream commit 838f865802b9f26135ea7df4e30f89ac2f50c23e ] Replace with a forward declaration in to resolve an unnecessary dependency. Remove pmac_backlight_curve_lookup() and struct fb_info from source and header files. The function and the framebuffer struct are unused. No functional changes. v3: * Add Fixes tag (Christophe) * fix typos in commit message (Jani) Signed-off-by: Thomas Zimmermann Fixes: d565dd3b0824 ("[PATCH] powerpc: More via-pmu backlight fixes") Reviewed-by: Jani Nikula Acked-by: Michael Ellerman # (powerpc) Link: https://patchwork.freedesktop.org/patch/msgid/20240306122935.10626-4-= tzimmermann@suse.de Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/backlight.h | 5 ++-- arch/powerpc/platforms/powermac/backlight.c | 26 --------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/include/asm/backlight.h b/arch/powerpc/include/as= m/backlight.h index 1b5eab62ed047..061a910d74929 100644 --- a/arch/powerpc/include/asm/backlight.h +++ b/arch/powerpc/include/asm/backlight.h @@ -10,15 +10,14 @@ #define __ASM_POWERPC_BACKLIGHT_H #ifdef __KERNEL__ =20 -#include #include =20 +struct backlight_device; + /* For locking instructions, see the implementation file */ extern struct backlight_device *pmac_backlight; extern struct mutex pmac_backlight_mutex; =20 -extern int pmac_backlight_curve_lookup(struct fb_info *info, int value); - extern int pmac_has_backlight_type(const char *type); =20 extern void pmac_backlight_key(int direction); diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/pla= tforms/powermac/backlight.c index 6b5dcccae1d30..8fae9a7d3d47c 100644 --- a/arch/powerpc/platforms/powermac/backlight.c +++ b/arch/powerpc/platforms/powermac/backlight.c @@ -8,7 +8,6 @@ */ =20 #include -#include #include #include #include @@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type) return 0; } =20 -int pmac_backlight_curve_lookup(struct fb_info *info, int value) -{ - int level =3D (FB_BACKLIGHT_LEVELS - 1); - - if (info && info->bl_dev) { - int i, max =3D 0; - - /* Look for biggest value */ - for (i =3D 0; i < FB_BACKLIGHT_LEVELS; i++) - max =3D max((int)info->bl_curve[i], max); - - /* Look for nearest value */ - for (i =3D 0; i < FB_BACKLIGHT_LEVELS; i++) { - int diff =3D abs(info->bl_curve[i] - value); - if (diff < max) { - max =3D diff; - level =3D i; - } - } - - } - - return level; -} - static void pmac_backlight_key_worker(struct work_struct *work) { if (atomic_read(&kernel_backlight_disabled)) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C76FF2987B4; Sun, 24 Mar 2024 23:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324360; cv=none; b=OTZXIjCgp1m0SEoCR/yfBpcglYyyWovRGFSc84WWdOUcPWAM1Ynu7ZrZYC7LAjO1xn/nOCBth7ogkXXk5X+3wI6dj4H5NbYMLtZi7g+tJRbPR6AQs+Y4aFPVjLMktcDMOXQW3fGzgwTOID3iGLr0gsIojdMu2cag+bdEM+i0KS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324360; c=relaxed/simple; bh=qUsKLSR4/2S+QJrOFojeB/hmcUgRxhpYTpV7hOoNmWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j5QtsI4DHI9O8tUa2eNbwB1D1QZhOahKSWjHK1nY7YhjLMQ0hr3a0Jqo931bVMEibOg9i7+HVJdSYJcIVAZguDACISIpgGI5vxhfyjbkh4cJRvZX0BHpmYcf2gBUf1J8pgeqXLKRo/EbUPVBxx9vNoidja0wSyUTwKF1ZVG6vzw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VryHTXQz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VryHTXQz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D75D5C43394; Sun, 24 Mar 2024 23:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324359; bh=qUsKLSR4/2S+QJrOFojeB/hmcUgRxhpYTpV7hOoNmWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VryHTXQzyrUtBA4lIgQ00TIZIENk0Ll3mbshnXvU2ZfC4rPpoksC3q5CrQoTwPr69 2xIhlEIJfxsrwwTv8/DNTsgTxqsurXDWvzcmSFD6iegtUzF3uANJH/fs4eSzbkNWcL 07ZJTXLoOod6gqGgXJNQ5JQ6UEkDwGnroYd9M8NrCue8iUhRDnbzII5PR77XleT4Fd F8DNlmJw3mcZudKfHYSlDcwaqCrjMoHGtT90BsmtmokRwAKXfDDXMzsgnQHbNGTrjd U3G9n26senFY4OIXn46qwyKofcocjn14R/5K2NIA2r3lkEgMmEw3yqvdggfrs1eS6N bzKvNVlq2sNiA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sam Ravnborg , "David S. Miller" , Andreas Larsson , Randy Dunlap , Sasha Levin Subject: [PATCH 4.19 127/148] sparc32: Fix section mismatch in leon_pci_grpci Date: Sun, 24 Mar 2024 19:49:51 -0400 Message-ID: <20240324235012.1356413-128-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sam Ravnborg [ Upstream commit 24338a6ae13cb743ced77da1b3a12c83f08a0c96 ] Passing a datastructre marked _initconst to platform_driver_register() is wrong. Drop the __initconst notation. This fixes the following warnings: WARNING: modpost: vmlinux: section mismatch in reference: grpci1_of_driver+= 0x30 (section: .data) -> grpci1_of_match (section: .init.rodata) WARNING: modpost: vmlinux: section mismatch in reference: grpci2_of_driver+= 0x30 (section: .data) -> grpci2_of_match (section: .init.rodata) Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Andreas Larsson Fixes: 4154bb821f0b ("sparc: leon: grpci1: constify of_device_id") Fixes: 03949b1cb9f1 ("sparc: leon: grpci2: constify of_device_id") Tested-by: Randy Dunlap # build-tested Reviewed-by: Andreas Larsson Tested-by: Andreas Larsson Signed-off-by: Andreas Larsson Link: https://lore.kernel.org/r/20240224-sam-fix-sparc32-all-builds-v2-7-1f= 186603c5c4@ravnborg.org Signed-off-by: Sasha Levin --- arch/sparc/kernel/leon_pci_grpci1.c | 2 +- arch/sparc/kernel/leon_pci_grpci2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_p= ci_grpci1.c index e6935d0ac1ec9..c32590bdd3120 100644 --- a/arch/sparc/kernel/leon_pci_grpci1.c +++ b/arch/sparc/kernel/leon_pci_grpci1.c @@ -696,7 +696,7 @@ static int grpci1_of_probe(struct platform_device *ofde= v) return err; } =20 -static const struct of_device_id grpci1_of_match[] __initconst =3D { +static const struct of_device_id grpci1_of_match[] =3D { { .name =3D "GAISLER_PCIFBRG", }, diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_p= ci_grpci2.c index ca22f93d90454..dd06abc61657f 100644 --- a/arch/sparc/kernel/leon_pci_grpci2.c +++ b/arch/sparc/kernel/leon_pci_grpci2.c @@ -887,7 +887,7 @@ static int grpci2_of_probe(struct platform_device *ofde= v) return err; } =20 -static const struct of_device_id grpci2_of_match[] __initconst =3D { +static const struct of_device_id grpci2_of_match[] =3D { { .name =3D "GAISLER_GRPCI2", }, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6E2B2987BE; Sun, 24 Mar 2024 23:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324361; cv=none; b=pfUE349QVSsG66wxm5DaeLl8vsmi/tgu7hWCEyVSrKTR8LdaxXnq06kxkUiLjUv0/Z7hDWp4ppxX9vvkUY9BZd88WhnrSXBNk8zYLlsBS9M2aU3kM3ic2j4zK8A92bzu0tWbqT/P2JRh+AvFuI9dgXWm3l3kBFknaNYW3rMAWyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324361; c=relaxed/simple; bh=fsol7G2VQdcWBezi229DI5jXveSllbDp0hy5//iZjkA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XBCm4iXTLT3YusWIMgtK3AVuZ6Vud8Mub8PvP5wN8fgAWJ0yUZtsNpr1MG52JB7x+cCXkkeEzxkko51UEQx8pWOo0M0gIdLOPn5ZQoQ8gimaqWWSKp/H/sJGYAjDp47fl5V/a2Y3CD2UW35Kg2+h4bbEBxVSekRy+5s3JgXf0C0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rrcgboyo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Rrcgboyo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC38DC433C7; Sun, 24 Mar 2024 23:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324360; bh=fsol7G2VQdcWBezi229DI5jXveSllbDp0hy5//iZjkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RrcgboyoKoMFfpU+MaS5kMtwPHkEVPXD3Jjz8RKIAe1DUgQfeWxn+h+DUBNDz8mGo GeDa9e5qyX5KBj/UpPGhBMv8yT9pPb4088FFVYpeJXJ98RN1a6ckwPzNA6Tg0Tisjr 7WzPZJD+Ok2BchbkrzRyBnLCBrNZc53LOxEnhvujEETue+J19OrjAtQqlDhDLkd3If jCA3dqUJKnPXDLZ6GbUIgO++TV1K2zLoymfY/vuOMqt3O3uY/DZcoEnK1IcoDnYx5K ovgAGJ1aYi6Ah11pIPXA+6dD3rv60Oe2zDR7bxMXpO8iVbN/NyuaiSqAu31u90HOHE fYQ8heGDBIUcg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johan Carlsson , Takashi Iwai , Sasha Levin Subject: [PATCH 4.19 128/148] ALSA: usb-audio: Stop parsing channels bits when all channels are found. Date: Sun, 24 Mar 2024 19:49:52 -0400 Message-ID: <20240324235012.1356413-129-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Johan Carlsson [ Upstream commit a39d51ff1f52cd0b6fe7d379ac93bd8b4237d1b7 ] If a usb audio device sets more bits than the amount of channels it could write outside of the map array. Signed-off-by: Johan Carlsson Fixes: 04324ccc75f9 ("ALSA: usb-audio: add channel map support") Message-ID: <20240313081509.9801-1-johan.carlsson@teenage.engineering> Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 1cfb30465df7d..3f20438a1b56e 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -306,9 +306,12 @@ static struct snd_pcm_chmap_elem *convert_chmap(int ch= annels, unsigned int bits, c =3D 0; =20 if (bits) { - for (; bits && *maps; maps++, bits >>=3D 1) + for (; bits && *maps; maps++, bits >>=3D 1) { if (bits & 1) chmap->map[c++] =3D *maps; + if (c =3D=3D chmap->channels) + break; + } } else { /* If we're missing wChannelConfig, then guess something to make sure the channel map is not skipped entirely */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 147BC2987D3; Sun, 24 Mar 2024 23:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324363; cv=none; b=Z2PIOWbIt01oICXaMOaivEWHZ9MTdKRUQ/+Ov4YUui3s3JuCWIY9qZVM3h5XlktTlUeLc4+h8UWK/IEPMh+alBgBWRMY/xEp6rI8FMFHao46Oj6u+/asyU5Sy+S6T39paMu0eg1xVnTsl77gjMSN43pK3xocrEcgnmOgXmsYfOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324363; c=relaxed/simple; bh=uVrNHrQbG48tlepRvvnPkOqOGzG/mveUSwCDgzNolHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=izxcHzn/4rUYraB+hPE3RecGTLa58vTWT5YsOkw83wU7Dr20E2wzXVJzzpXUIHR3XBBmwvODdH29f2Sm4ZWBzzHUirYhLnTRy56r4RgjDhrMoEG8pWKUrAnMu1/Gn5H57hiij9jw6xC6OYAoVdysB176bJDjjm5VcpXZiJnDadY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VRvhSirz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VRvhSirz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 364D3C43394; Sun, 24 Mar 2024 23:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324361; bh=uVrNHrQbG48tlepRvvnPkOqOGzG/mveUSwCDgzNolHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VRvhSirzHsf2VpWx3VPOwkX2dho90ArskvX5WM9DMxuTfsIaTAItKeVd+DUXu5LFI s1BRJ81plD2KrbfSJ5CcKTCBKWATNB/uTB/FiK2q50f3tbqsyYKP2WI0JoIJvT3Rp3 8gJ83wUot7CHrmxkeDo7dW//YV7YZtN05ZJzhmQq4t+zSCmqEhRe8d12kzHZTSCT+A 4i2zIw0KA+TwhtcFF/tfNXRRUAa6b74jjbcbprtDnz0jnAQ6Xcl9ND2YsACuFhPryv UKBv51ZNXYxLSH6ie0yCJ6tmK+M6jzsTDJIa0/FVCfBsDTKo76nFIxGpxuUvNv8aba mgMUXfdl29EqQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , "Martin K . Petersen" , Sasha Levin Subject: [PATCH 4.19 129/148] scsi: csiostor: Avoid function pointer casts Date: Sun, 24 Mar 2024 19:49:53 -0400 Message-ID: <20240324235012.1356413-130-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 9f3dbcb5632d6876226031d552ef6163bb3ad215 ] csiostor uses function pointer casts to keep the csio_ln_ev state machine hidden, but this causes warnings about control flow integrity (KCFI) violations in clang-16 and higher: drivers/scsi/csiostor/csio_lnode.c:1098:33: error: cast from 'void (*)(stru= ct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void= *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-= function-type-strict] 1098 | return (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_ln= s_ready)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~ drivers/scsi/csiostor/csio_lnode.c:1369:29: error: cast from 'void (*)(stru= ct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void= *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-= function-type-strict] 1369 | if (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_lns_un= init)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/csiostor/csio_lnode.c:1373:29: error: cast from 'void (*)(stru= ct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void= *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-= function-type-strict] 1373 | if (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_lns_re= ady)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/csiostor/csio_lnode.c:1377:29: error: cast from 'void (*)(stru= ct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void= *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-= function-type-strict] 1377 | if (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_lns_of= fline)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Move the enum into a shared header so the correct types can be used without the need for casts. Fixes: a3667aaed569 ("[SCSI] csiostor: Chelsio FCoE offload driver") Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20240213100518.457623-1-arnd@kernel.org Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/csiostor/csio_defs.h | 18 ++++++++++++++++-- drivers/scsi/csiostor/csio_lnode.c | 8 ++++---- drivers/scsi/csiostor/csio_lnode.h | 13 ------------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/csiostor/csio_defs.h b/drivers/scsi/csiostor/csio= _defs.h index c38017b4af982..e50e93e7fe5a1 100644 --- a/drivers/scsi/csiostor/csio_defs.h +++ b/drivers/scsi/csiostor/csio_defs.h @@ -73,7 +73,21 @@ csio_list_deleted(struct list_head *list) #define csio_list_prev(elem) (((struct list_head *)(elem))->prev) =20 /* State machine */ -typedef void (*csio_sm_state_t)(void *, uint32_t); +struct csio_lnode; + +/* State machine evets */ +enum csio_ln_ev { + CSIO_LNE_NONE =3D (uint32_t)0, + CSIO_LNE_LINKUP, + CSIO_LNE_FAB_INIT_DONE, + CSIO_LNE_LINK_DOWN, + CSIO_LNE_DOWN_LINK, + CSIO_LNE_LOGO, + CSIO_LNE_CLOSE, + CSIO_LNE_MAX_EVENT, +}; + +typedef void (*csio_sm_state_t)(struct csio_lnode *ln, enum csio_ln_ev evt= ); =20 struct csio_sm { struct list_head sm_list; @@ -83,7 +97,7 @@ struct csio_sm { static inline void csio_set_state(void *smp, void *state) { - ((struct csio_sm *)smp)->sm_state =3D (csio_sm_state_t)state; + ((struct csio_sm *)smp)->sm_state =3D state; } =20 static inline void diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csi= o_lnode.c index 98944fb3f0b85..1c4e1c86c1d2f 100644 --- a/drivers/scsi/csiostor/csio_lnode.c +++ b/drivers/scsi/csiostor/csio_lnode.c @@ -1095,7 +1095,7 @@ csio_handle_link_down(struct csio_hw *hw, uint8_t por= tid, uint32_t fcfi, int csio_is_lnode_ready(struct csio_lnode *ln) { - return (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_lns_ready)); + return (csio_get_state(ln) =3D=3D csio_lns_ready); } =20 /*************************************************************************= ****/ @@ -1367,15 +1367,15 @@ csio_free_fcfinfo(struct kref *kref) void csio_lnode_state_to_str(struct csio_lnode *ln, int8_t *str) { - if (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_lns_uninit)) { + if (csio_get_state(ln) =3D=3D csio_lns_uninit) { strcpy(str, "UNINIT"); return; } - if (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_lns_ready)) { + if (csio_get_state(ln) =3D=3D csio_lns_ready) { strcpy(str, "READY"); return; } - if (csio_get_state(ln) =3D=3D ((csio_sm_state_t)csio_lns_offline)) { + if (csio_get_state(ln) =3D=3D csio_lns_offline) { strcpy(str, "OFFLINE"); return; } diff --git a/drivers/scsi/csiostor/csio_lnode.h b/drivers/scsi/csiostor/csi= o_lnode.h index 372a67d122d38..607698a0f0631 100644 --- a/drivers/scsi/csiostor/csio_lnode.h +++ b/drivers/scsi/csiostor/csio_lnode.h @@ -53,19 +53,6 @@ extern int csio_fcoe_rnodes; extern int csio_fdmi_enable; =20 -/* State machine evets */ -enum csio_ln_ev { - CSIO_LNE_NONE =3D (uint32_t)0, - CSIO_LNE_LINKUP, - CSIO_LNE_FAB_INIT_DONE, - CSIO_LNE_LINK_DOWN, - CSIO_LNE_DOWN_LINK, - CSIO_LNE_LOGO, - CSIO_LNE_CLOSE, - CSIO_LNE_MAX_EVENT, -}; - - struct csio_fcf_info { struct list_head list; uint8_t priority; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8259B1856BD; Sun, 24 Mar 2024 23:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324364; cv=none; b=dzOMwXG151LXA3M/i4pSGvcN8X6Qfky55fk0v+I7a4HyeVWOvzBhHEVrh/5OEDdf1A0IYUEvDC4e1eR2/mCWGM4be4FQDKOSXaSxfiiJ4ipIhbfcwcZXqRZXu0Iyi8GEdtagyMa6SN7hdqpy/GmrquUPTfmBpiIAWhnXLIN15Gc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324364; c=relaxed/simple; bh=+eTRH49ETbASta4m11gcODFGG9ygmxuCFVXBDFrnhoY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SfS4kEQRhZgKk13Y5a9TFHv31B8X7cSek56ENgWyc45OivqhscB4h91eRc7IW6+fPQTXJXiuo+vP1sR09pnC8GR7bjW1RwsOY2VBQgQJ8AtN+0BOfNMZfHZpjw9aIqoleKbwSGHN7RG3k1GtTaitbE6fpb8hsca2rhZnGcVw57I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jpwwHCz/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jpwwHCz/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39A65C433C7; Sun, 24 Mar 2024 23:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324363; bh=+eTRH49ETbASta4m11gcODFGG9ygmxuCFVXBDFrnhoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpwwHCz/mFXz8eLHnyNiijXYH+Hm0s6iAKVxT8w3n9OHnCgpPuq8fOac53QnY0CAm 0AFdaUt/SZWX9t65PC8fycR2Q2C9q4aI8aN9FJ6n6I6j2FZyhqDGl0FMQY9XEpIhvo Nc0zQo22PB9dIVLroZXJLO7fekhemr3w/etvf4JcHYgmWFESn4rDwq+AheHyju/evx MJg7hvXmf093XTNo2DBzWWn/sfX3kSKUHpPAVdA1f7qGD2F+6kCK3Ty4+FKdPf6ni3 susWdu6fPUMDZx6EgOLaN+6xY2OZze5/WvN9Mh6WGq06myzeez62hAveVmdEDImjWG AI96XrZxZcb9w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Kees Cook , "Martin K . Petersen" , Sasha Levin Subject: [PATCH 4.19 130/148] scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn Date: Sun, 24 Mar 2024 19:49:54 -0400 Message-ID: <20240324235012.1356413-131-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit b69600231f751304db914c63b937f7098ed2895c ] Some callback functions used here take a boolean argument, others take a status argument. This breaks KCFI type checking, so clang now warns about the function pointer cast: drivers/scsi/bfa/bfad_bsg.c:2138:29: error: cast from 'void (*)(void *, enu= m bfa_status)' to 'bfa_cb_cbfn_t' (aka 'void (*)(void *, enum bfa_boolean)'= ) converts to incompatible function type [-Werror,-Wcast-function-type-stri= ct] Assuming the code is actually correct here and the callers always match the argument types of the callee, rework this to replace the explicit cast with a union of the two pointer types. This does not change the behavior of the code, so if something is actually broken here, a larger rework may be necessary. Fixes: 37ea0558b87a ("[SCSI] bfa: Added support to collect and reset fcport= stats") Fixes: 3ec4f2c8bff2 ("[SCSI] bfa: Added support to configure QOS and collec= t stats.") Reviewed-by: Kees Cook Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20240222124433.2046570-1-arnd@kernel.org Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/bfa/bfa.h | 9 ++++++++- drivers/scsi/bfa/bfa_core.c | 4 +--- drivers/scsi/bfa/bfa_ioc.h | 8 ++++++-- drivers/scsi/bfa/bfad_bsg.c | 11 ++++------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h index 0e119d838e1b6..f312c356ffc4b 100644 --- a/drivers/scsi/bfa/bfa.h +++ b/drivers/scsi/bfa/bfa.h @@ -28,7 +28,6 @@ struct bfa_s; =20 typedef void (*bfa_isr_func_t) (struct bfa_s *bfa, struct bfi_msg_s *m); -typedef void (*bfa_cb_cbfn_status_t) (void *cbarg, bfa_status_t status); =20 /* * Interrupt message handlers @@ -446,4 +445,12 @@ struct bfa_cb_pending_q_s { (__qe)->data =3D (__data); \ } while (0) =20 +#define bfa_pending_q_init_status(__qe, __cbfn, __cbarg, __data) do { \ + bfa_q_qe_init(&((__qe)->hcb_qe.qe)); \ + (__qe)->hcb_qe.cbfn_status =3D (__cbfn); \ + (__qe)->hcb_qe.cbarg =3D (__cbarg); \ + (__qe)->hcb_qe.pre_rmv =3D BFA_TRUE; \ + (__qe)->data =3D (__data); \ +} while (0) + #endif /* __BFA_H__ */ diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 10a63be925441..ada30a5cacc85 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c @@ -1915,15 +1915,13 @@ bfa_comp_process(struct bfa_s *bfa, struct list_hea= d *comp_q) struct list_head *qe; struct list_head *qen; struct bfa_cb_qe_s *hcb_qe; - bfa_cb_cbfn_status_t cbfn; =20 list_for_each_safe(qe, qen, comp_q) { hcb_qe =3D (struct bfa_cb_qe_s *) qe; if (hcb_qe->pre_rmv) { /* qe is invalid after return, dequeue before cbfn() */ list_del(qe); - cbfn =3D (bfa_cb_cbfn_status_t)(hcb_qe->cbfn); - cbfn(hcb_qe->cbarg, hcb_qe->fw_status); + hcb_qe->cbfn_status(hcb_qe->cbarg, hcb_qe->fw_status); } else hcb_qe->cbfn(hcb_qe->cbarg, BFA_TRUE); } diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 0f9fab770339a..179dd0416979d 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h @@ -369,14 +369,18 @@ struct bfa_reqq_wait_s { void *cbarg; }; =20 -typedef void (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_status_t) (void *cbarg, bfa_status_t status); =20 /* * Generic BFA callback element. */ struct bfa_cb_qe_s { struct list_head qe; - bfa_cb_cbfn_t cbfn; + union { + bfa_cb_cbfn_status_t cbfn_status; + bfa_cb_cbfn_t cbfn; + }; bfa_boolean_t once; bfa_boolean_t pre_rmv; /* set for stack based qe(s) */ bfa_status_t fw_status; /* to access fw status in comp proc */ diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 5d163ca1b3666..6735f61df191a 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -2143,8 +2143,7 @@ bfad_iocmd_fcport_get_stats(struct bfad_s *bfad, void= *cmd) struct bfa_cb_pending_q_s cb_qe; =20 init_completion(&fcomp.comp); - bfa_pending_q_init(&cb_qe, (bfa_cb_cbfn_t)bfad_hcb_comp, - &fcomp, &iocmd->stats); + bfa_pending_q_init_status(&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats); spin_lock_irqsave(&bfad->bfad_lock, flags); iocmd->status =3D bfa_fcport_get_stats(&bfad->bfa, &cb_qe); spin_unlock_irqrestore(&bfad->bfad_lock, flags); @@ -2167,7 +2166,7 @@ bfad_iocmd_fcport_reset_stats(struct bfad_s *bfad, vo= id *cmd) struct bfa_cb_pending_q_s cb_qe; =20 init_completion(&fcomp.comp); - bfa_pending_q_init(&cb_qe, (bfa_cb_cbfn_t)bfad_hcb_comp, &fcomp, NULL); + bfa_pending_q_init_status(&cb_qe, bfad_hcb_comp, &fcomp, NULL); =20 spin_lock_irqsave(&bfad->bfad_lock, flags); iocmd->status =3D bfa_fcport_clear_stats(&bfad->bfa, &cb_qe); @@ -2451,8 +2450,7 @@ bfad_iocmd_qos_get_stats(struct bfad_s *bfad, void *c= md) struct bfa_fcport_s *fcport =3D BFA_FCPORT_MOD(&bfad->bfa); =20 init_completion(&fcomp.comp); - bfa_pending_q_init(&cb_qe, (bfa_cb_cbfn_t)bfad_hcb_comp, - &fcomp, &iocmd->stats); + bfa_pending_q_init_status(&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats); =20 spin_lock_irqsave(&bfad->bfad_lock, flags); WARN_ON(!bfa_ioc_get_fcmode(&bfad->bfa.ioc)); @@ -2482,8 +2480,7 @@ bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void = *cmd) struct bfa_fcport_s *fcport =3D BFA_FCPORT_MOD(&bfad->bfa); =20 init_completion(&fcomp.comp); - bfa_pending_q_init(&cb_qe, (bfa_cb_cbfn_t)bfad_hcb_comp, - &fcomp, NULL); + bfa_pending_q_init_status(&cb_qe, bfad_hcb_comp, &fcomp, NULL); =20 spin_lock_irqsave(&bfad->bfad_lock, flags); WARN_ON(!bfa_ioc_get_fcmode(&bfad->bfa.ioc)); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 817A81856AD; Sun, 24 Mar 2024 23:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324364; cv=none; b=V5t2y965+xZP7u3a59/MhN1QGYWQd1hHeLqSdml6YEDxeIsN3RP/OS32BKOwWrPbW+i2TyslYo+Ol+DphqLgWw+xs+U+bcuHduc3fiztEWVeXZa1E8TVNK05Qgm4KCQvC+u2FLzxY6ejBEW0wDgkE/QnuOSiy9EF1U5T37iVwCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324364; c=relaxed/simple; bh=JheoSwJSnHfF0q6NRf7tt3Cg5P8qwcOVNT8AoQjQpRY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SDbeNuQIHEA4oKQCyiluL6mP46s3AgxBYuF10LXLTQN3nt88IYs50LAoOKEfmSuD/H5TfSBUYn3l0uS1aXXahdNrGUZuAweSXwqkes/9zkKKlWz8Gg1bT+cSgI5VB4YkZTxczqMoU4kiqxK86SY6BbVd0oGQhO8/cwsjerPFOCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ckDdUes2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ckDdUes2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7260C43394; Sun, 24 Mar 2024 23:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324364; bh=JheoSwJSnHfF0q6NRf7tt3Cg5P8qwcOVNT8AoQjQpRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ckDdUes2CNTnT5WBSHLf9gDEmhIrMDa8ROkY+h/VwY2zwqlckUYcjn0bM1c8KNs3C gDZSKtQz0GoW67BiD5uskQUgJAyHaaJug7jl5/YRIeAChzEku2T5QxyI6//889Frpe +Xfdul9e9wSEi1cmUcpaBygELH/kxjqL2za4sRyDdXwMYlgPk+3WxuPvTCMTpvXpOw 0x2vBKZh0eLhRzfoEEDD3fv3bBFY1Nf9xg/pCcOiyCAFKzyYzxgwhxjiVPgrJS9jZL QMyFLj6LuoHkNKxMSbCvZQTSCUa85AhQjp7s6HGKcBzp9buUXnIeZdQW0vYpKTPPOw 1gXJy+/uZJIug== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Benjamin Coddington , Trond Myklebust , Sasha Levin Subject: [PATCH 4.19 131/148] net: sunrpc: Fix an off by one in rpc_sockaddr2uaddr() Date: Sun, 24 Mar 2024 19:49:55 -0400 Message-ID: <20240324235012.1356413-132-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit d6f4de70f73a106986ee315d7d512539f2f3303a ] The intent is to check if the strings' are truncated or not. So, >=3D should be used instead of >, because strlcat() and snprintf() return the length of the output, excluding the trailing NULL. Fixes: a02d69261134 ("SUNRPC: Provide functions for managing universal addr= esses") Signed-off-by: Christophe JAILLET Reviewed-by: Benjamin Coddington Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- net/sunrpc/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c index 7404f02702a1c..eba3b6f4d4ace 100644 --- a/net/sunrpc/addr.c +++ b/net/sunrpc/addr.c @@ -287,10 +287,10 @@ char *rpc_sockaddr2uaddr(const struct sockaddr *sap, = gfp_t gfp_flags) } =20 if (snprintf(portbuf, sizeof(portbuf), - ".%u.%u", port >> 8, port & 0xff) > (int)sizeof(portbuf)) + ".%u.%u", port >> 8, port & 0xff) >=3D (int)sizeof(portbuf)) return NULL; =20 - if (strlcat(addrbuf, portbuf, sizeof(addrbuf)) > sizeof(addrbuf)) + if (strlcat(addrbuf, portbuf, sizeof(addrbuf)) >=3D sizeof(addrbuf)) return NULL; =20 return kstrdup(addrbuf, gfp_flags); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86BF11856CB; Sun, 24 Mar 2024 23:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324366; cv=none; b=bFyohi9RYFBJEndk8I3zGJdXeZkrmA+vtSFtiwzeqwLEbwlCZTtr41FjLMzoNk/2TQsgjkmQyEHUnowUBhahXbFWKHtV6d1O4IonLMAnx6oKlqG24OwTYyu9c7xPuB10ENUzn+rono/BGzzRpUOSGnqq4Zpzg1PLBiAHgT6h4Lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324366; c=relaxed/simple; bh=G1pmVYTlKYB2evp2UH26aRIMP5vTOXvwujH5BaIMyP8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nbccl3RcwdNBPl5nkPHpbZZHldEuU2T6JA1SLDJQvWrXisqAWj9LQS047dts223akEWh9HsJgLiD9qMDO2rtLfHnZktsbpaG6yVx4ZwYse3DUwiUslHmZlvFWf7n6+BItRgkMrQGMacg0JzBEDJsXHEDQWagjhayGwxOf++iyC4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hT7gB9VE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hT7gB9VE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA484C433F1; Sun, 24 Mar 2024 23:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324365; bh=G1pmVYTlKYB2evp2UH26aRIMP5vTOXvwujH5BaIMyP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hT7gB9VEbQwVzmndwUwOG/ttJ6JtC96xlfCv2BoQn7sVJ8HHd1AXazpBPChZ0ZSMN 4HeL5YEu+WXgxisU7t988cAlatXBPgqZKAMHKGwijiCinnwouhhA0Y/GX5gLRQYIlY QGRD/nC/mq/Y8QUajONaMU3+uWRAgXRoWXuuZHEWGW3cpFqOoN2ppKNtnhzI0rUBnV mhNdVs8dVDBAkMvtzloBVNYtB7sgyjj0LKjlv2kpK3b0hnT4JWyyYTEUcGF9xvk4DO GQT1F8BYnEIE0NTdCVBfAtNaGhUW8uyzfpmiwra5J89CGR/+v+2HrIPSGP07f7YRVf wlM/GfBLDym8A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Benjamin Coddington , Trond Myklebust , Sasha Levin Subject: [PATCH 4.19 132/148] NFS: Fix an off by one in root_nfs_cat() Date: Sun, 24 Mar 2024 19:49:56 -0400 Message-ID: <20240324235012.1356413-133-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 698ad1a538da0b6bf969cfee630b4e3a026afb87 ] The intent is to check if 'dest' is truncated or not. So, >=3D should be used instead of >, because strlcat() returns the length of 'dest' and 'src' excluding the trailing NULL. Fixes: 56463e50d1fc ("NFS: Use super.c for NFSROOT mount option parsing") Signed-off-by: Christophe JAILLET Reviewed-by: Benjamin Coddington Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfsroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c index effaa4247b912..c0f2e1751c33e 100644 --- a/fs/nfs/nfsroot.c +++ b/fs/nfs/nfsroot.c @@ -169,10 +169,10 @@ static int __init root_nfs_cat(char *dest, const char= *src, size_t len =3D strlen(dest); =20 if (len && dest[len - 1] !=3D ',') - if (strlcat(dest, ",", destlen) > destlen) + if (strlcat(dest, ",", destlen) >=3D destlen) return -1; =20 - if (strlcat(dest, src, destlen) > destlen) + if (strlcat(dest, src, destlen) >=3D destlen) return -1; return 0; } --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5C6E1856D5; Sun, 24 Mar 2024 23:52:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324367; cv=none; b=VdfgEodc8szRgzYtc9tlQDCxyHtoiZDEwvCZOIydzmSs1npK4ZLdLHli6Q6W8t7NiQnU67RTbcUagcfxu28ETd7Oj9ZNNZko/mODsKKnbAAy6LksVCBVecoQERsEMgzHAWS6g9yf3+6MTLAn7gOc8djft58D+ETuAuJK3IEBmTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324367; c=relaxed/simple; bh=9MZHMgR8QlDiSQ81BInBmmb7tp3DJW0f2NAZceSm0qk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rlgzvIAYBg7PFbUr7FTqpLmZ+3BT16toVhGq7cry6SZdWG0gmorsazgUMOV2CCxle3yM8Omnhno0Hfaw6Dz/8KKwcUmEu2weB1expojTm7jDNlCAh4BM3x4TH/UxLmg1nrWtvKQXxLUmFMMItnNh57NJb6/gIIeubP50WSZAG4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lvKsXw0v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lvKsXw0v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF3E3C43394; Sun, 24 Mar 2024 23:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324366; bh=9MZHMgR8QlDiSQ81BInBmmb7tp3DJW0f2NAZceSm0qk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lvKsXw0vFiuZlWNTkkZUzDCC6FH0a7wk+6G0pMohOpNLhpEHRmse5tA395BuObXiX OXRAgnaB9Sa4m6O2+qWvEcG1I5fAzyU+juMAszq4dHJs6kQhkAcTfpgb78OMyYoE0z VAKgXfGbTX7qas8EPpB1aRtU1oeg/iHIyVuLs0JpfxsAu4/QFOXRaEUUS/Zh6l/NFz xAus/PVDTBzrt8s25K1pNk8L2hpgaMmbx16ypta4BhibqT1Yr+xb3OtZPP7GpLgXuI KuXb604OsxljFwgrtHgw6jR9iiPqlulFLbieXSn+6fZLRaoRuf9q9vYssG5MXhok0X Zd9kqJWyeVZog== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Taniya Das , Bjorn Andersson , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 133/148] clk: qcom: gdsc: Add support to update GDSC transition delay Date: Sun, 24 Mar 2024 19:49:57 -0400 Message-ID: <20240324235012.1356413-134-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Taniya Das [ Upstream commit 4e7c4d3652f96f41179aab3ff53025c7a550d689 ] GDSCs have multiple transition delays which are used for the GDSC FSM states. Older targets/designs required these values to be updated from gdsc code to certain default values for the FSM state to work as expected. But on the newer targets/designs the values updated from the GDSC driver can hamper the FSM state to not work as expected. On SC7180 we observe black screens because the gdsc is being enabled/disabled very rapidly and the GDSC FSM state does not work as expected. This is due to the fact that the GDSC reset value is being updated from SW. Thus add support to update the transition delay from the clock controller gdscs as required. Fixes: 45dd0e55317cc ("clk: qcom: Add support for GDSCs) Signed-off-by: Taniya Das Link: https://lore.kernel.org/r/20220223185606.3941-1-tdas@codeaurora.org Reviewed-by: Bjorn Andersson Signed-off-by: Stephen Boyd Stable-dep-of: 117e7dc697c2 ("clk: qcom: dispcc-sdm845: Adjust internal GDS= C wait times") Signed-off-by: Sasha Levin --- drivers/clk/qcom/gdsc.c | 26 +++++++++++++++++++++----- drivers/clk/qcom/gdsc.h | 8 +++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index a077133c7ce38..83541e9d50701 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017-2018, The Linux Foundation. All rights reserve= d. + * Copyright (c) 2015, 2017-2018, 2022, The Linux Foundation. All rights r= eserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -39,9 +39,14 @@ #define CFG_GDSCR_OFFSET 0x4 =20 /* Wait 2^n CXO cycles between all states. Here, n=3D2 (4 cycles). */ -#define EN_REST_WAIT_VAL (0x2 << 20) -#define EN_FEW_WAIT_VAL (0x8 << 16) -#define CLK_DIS_WAIT_VAL (0x2 << 12) +#define EN_REST_WAIT_VAL 0x2 +#define EN_FEW_WAIT_VAL 0x8 +#define CLK_DIS_WAIT_VAL 0x2 + +/* Transition delay shifts */ +#define EN_REST_WAIT_SHIFT 20 +#define EN_FEW_WAIT_SHIFT 16 +#define CLK_DIS_WAIT_SHIFT 12 =20 #define RETAIN_MEM BIT(14) #define RETAIN_PERIPH BIT(13) @@ -314,7 +319,18 @@ static int gdsc_init(struct gdsc *sc) */ mask =3D HW_CONTROL_MASK | SW_OVERRIDE_MASK | EN_REST_WAIT_MASK | EN_FEW_WAIT_MASK | CLK_DIS_WAIT_MASK; - val =3D EN_REST_WAIT_VAL | EN_FEW_WAIT_VAL | CLK_DIS_WAIT_VAL; + + if (!sc->en_rest_wait_val) + sc->en_rest_wait_val =3D EN_REST_WAIT_VAL; + if (!sc->en_few_wait_val) + sc->en_few_wait_val =3D EN_FEW_WAIT_VAL; + if (!sc->clk_dis_wait_val) + sc->clk_dis_wait_val =3D CLK_DIS_WAIT_VAL; + + val =3D sc->en_rest_wait_val << EN_REST_WAIT_SHIFT | + sc->en_few_wait_val << EN_FEW_WAIT_SHIFT | + sc->clk_dis_wait_val << CLK_DIS_WAIT_SHIFT; + ret =3D regmap_update_bits(sc->regmap, sc->gdscr, mask, val); if (ret) return ret; diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h index bd1f2c780d0af..a31d3dc36f2f2 100644 --- a/drivers/clk/qcom/gdsc.h +++ b/drivers/clk/qcom/gdsc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017-2018, The Linux Foundation. All rights reserve= d. + * Copyright (c) 2015, 2017-2018, 2022, The Linux Foundation. All rights r= eserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -29,6 +29,9 @@ struct reset_controller_dev; * @cxcs: offsets of branch registers to toggle mem/periph bits in * @cxc_count: number of @cxcs * @pwrsts: Possible powerdomain power states + * @en_rest_wait_val: transition delay value for receiving enr ack signal + * @en_few_wait_val: transition delay value for receiving enf ack signal + * @clk_dis_wait_val: transition delay value for halting clock * @resets: ids of resets associated with this gdsc * @reset_count: number of @resets * @rcdev: reset controller @@ -42,6 +45,9 @@ struct gdsc { unsigned int clamp_io_ctrl; unsigned int *cxcs; unsigned int cxc_count; + unsigned int en_rest_wait_val; + unsigned int en_few_wait_val; + unsigned int clk_dis_wait_val; const u8 pwrsts; /* Powerdomain allowable state bitfields */ #define PWRSTS_OFF BIT(0) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBB9A1856D9; Sun, 24 Mar 2024 23:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324368; cv=none; b=NYbxvLg9nX3gzaB+y8FEeUqLgPhAdMCuXuQjlW5hT+Vjt06fUNvHDsYYmpXX5jgjW3WHw4l7lwM2HdlGaPCJ3IYfSBqM4ceWGHVbDgg79EcKRDjyxzmmVm6WdoL4B5EFdi2EimgGMoPxQwstIH0ZhJ0VxrADUkAV1cVc0TwYJ/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324368; c=relaxed/simple; bh=nKQoc1DwiUrnUcoKk605gJP8MdHJHIWy+wH2tgP474o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z/mTGMxkSvEbu+P/0+ssd5vxBeH5Q2QXNRwCJ7bQh8DB6IXW84DweaEzDr1aT7xDJUtIc4Mkl8cE8ho6BZWA4oC/av3gJMA2mcuAO1KmZUf3GojMl0PcMnNm6fB1UpYsFFYy3Pu02lSTxQHu6nxR84R0AiXO5CDm5/uGfv12qrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JxDniNk9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JxDniNk9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9CBC433F1; Sun, 24 Mar 2024 23:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324367; bh=nKQoc1DwiUrnUcoKk605gJP8MdHJHIWy+wH2tgP474o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JxDniNk9JZDTBIyaAu2ezjBLnglSRHnyrFoVrwOwgsLC7zLc2wQzQ9ZEF+lX131x3 +BPmtrD2X3zZDG450mLhVXKMhXQ7CxpJjdSS83KxgGo0hu0XbSMiOJgHwGMqHegj4g 9YLbiBMD48RMMXQBVSJCNME3mNHaDg7pqcECeaVj7DlHiQ6pcs+PRAGboMlOruEXRE pFB415D6xdqmVcr6MAS8EV/BPBc6XmB3ilUF1ClusdiR9SWXmpD0p3yWHe5tDQBIy/ fBe4Z2GgYO94nZmM15ndXGxvNTLThBqJ3idW+Keucs4olLGc+6hAcrOd/ek0hHxjml 3lioDmmD98Zow== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sean Anderson , stable , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.19 134/148] usb: phy: generic: Get the vbus supply Date: Sun, 24 Mar 2024 19:49:58 -0400 Message-ID: <20240324235012.1356413-135-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sean Anderson [ Upstream commit 03e607cbb2931374db1825f371e9c7f28526d3f4 ] While support for working with a vbus was added, the regulator was never actually gotten (despite what was documented). Fix this by actually getting the supply from the device tree. Fixes: 7acc9973e3c4 ("usb: phy: generic: add vbus support") Cc: stable Signed-off-by: Sean Anderson Link: https://lore.kernel.org/r/20220425171412.1188485-3-sean.anderson@seco= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/phy/phy-generic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index a53b89be53248..8a04b157f19f3 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -283,6 +283,13 @@ int usb_phy_gen_create_phy(struct device *dev, struct = usb_phy_generic *nop, return -EPROBE_DEFER; } =20 + nop->vbus_draw =3D devm_regulator_get_exclusive(dev, "vbus"); + if (PTR_ERR(nop->vbus_draw) =3D=3D -ENODEV) + nop->vbus_draw =3D NULL; + if (IS_ERR(nop->vbus_draw)) + return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), + "could not get vbus regulator\n"); + nop->dev =3D dev; nop->phy.dev =3D nop->dev; nop->phy.label =3D "nop-xceiv"; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE2BC1FD5A3; Sun, 24 Mar 2024 23:52:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324369; cv=none; b=kt3UBAZ/zCy9LVfgtCnLEyowfpAqCEO+8pF46FrcfpRH6LWILXe0wHbZVtkIdqomXQajOVqyA4M7MPMzN4Mw1SfuoGTY+1koaE1TFsXiTcUPhP6PDAcSdQXoUU8S/lzviPvvuVzOuw/wTGZunkKcAIOzwOvjifdokd/I4PgoY4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324369; c=relaxed/simple; bh=VFG8uoOm1/L9ANDqRLELcegRMZpFjjikqvQRLkeqTg8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ArURvk+7El4BOFRm2YUYpNwuHsN7QL1hwFIYStQe2X3jZjKWj3YY5S07he8pPuQ/n3DEk2tDb3R15qdxGD7phzMY3YAsAXKW+f3vv4VNU1qUSLHDAtMgXMz+slRZHr2RGxTQl9btC3BTBF5SMztijwbI/wrNy7BWX6v21x4M8XM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LyZNPJET; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LyZNPJET" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF2E3C43394; Sun, 24 Mar 2024 23:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324368; bh=VFG8uoOm1/L9ANDqRLELcegRMZpFjjikqvQRLkeqTg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LyZNPJETD/nxXVi/uyprZYVdJqoXt7gWxiVIOUaS+VIhhg/qf3yjozBpuM6Q6Y1G3 n2EiaQU4v5iWEjJMV7peIuQbyunvmvHJW17vwKlyFukPnWpZQ9Mvk+jcW/y7Mbwiv5 GQuDwSZnBogUy6xU8D77t5QdFuVVfDOlQTfALd9vBUbpaCYktxZscu4Xv5SnCiVzr2 ysCqpymSAA8/tCUi/rB48XsyY+lpqYkCH0pO/bWzOnvBiCLhUtgJ6I0tOcVu8zCRoQ pZwDowVwwCoYN5gjjsSNvmu8lQGNBm+neP6u0rSTkM3aWU+tISHLDPnpdRKpmnejAM imBETBmYxoJXQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hugo Villeneuve , Andy Shevchenko , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.19 135/148] serial: max310x: fix syntax error in IRQ error message Date: Sun, 24 Mar 2024 19:49:59 -0400 Message-ID: <20240324235012.1356413-136-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve [ Upstream commit 8ede8c6f474255b2213cccd7997b993272a8e2f9 ] Replace g with q. Helpful when grepping thru source code or logs for "request" keyword. Fixes: f65444187a66 ("serial: New serial driver MAX310X") Reviewed-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve Link: https://lore.kernel.org/r/20240118152213.2644269-6-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/max310x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index e68dbd13110ba..1c8fd06befec4 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1363,7 +1363,7 @@ static int max310x_probe(struct device *dev, struct m= ax310x_devtype *devtype, if (!ret) return 0; =20 - dev_err(dev, "Unable to reguest IRQ %i\n", irq); + dev_err(dev, "Unable to request IRQ %i\n", irq); =20 out_uart: for (i =3D 0; i < devtype->nr; i++) { --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEBB71FD5C5; Sun, 24 Mar 2024 23:52:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324369; cv=none; b=Sn6NrSPYJrQ49vvaksbCEiJj0q0f11QIW/kNSeu4wUdNoQSBNFRPNRIz6Lnke+HF2NijDv814nAKYlN4E72VjxKGj7agcQcn2Pz4apxTVL9zB9XV3jTapMEJ5Sq//a7mASKMpGnveZNzxglZ1SFy5mFhgx+tYV574Z5Bn8lrLAA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324369; c=relaxed/simple; bh=06xuqTypK2d+lu+sZouf0JkP/CjeANELuavDeS4nOX8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NTLZ6WgUK1GL16X6RiqDtM37IKd87DyCH8SpV45zTr5DzC4VQYltA+wbhNuRILc0IVgwU7CBMgJcRDtr+2sbYf3pvHnX4Yw2YLR1tjj1460471dUnRzCW/1xQ3crZRHNe0I3KLBIoYEqm6gxKGovA94YR2jV29lYzU6LVQFjvxE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M0nVSGV9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M0nVSGV9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E415DC433C7; Sun, 24 Mar 2024 23:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324369; bh=06xuqTypK2d+lu+sZouf0JkP/CjeANELuavDeS4nOX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M0nVSGV9DT26Kfn6OZ3R9g5qKJcagoOzQJrufx70nMxRUc7+ugckzjZYylgbmf+Kj h0kQh6F24ovfKb0Y2qtzIJxp7qD2qkSPZ3rc2bPKFE3rGaOaludjTbIErPrdL6lK/w ENcB+MJLjjDkH7VzhA1/g5K5lATe5/OXOgBlJGZ2j2MaRniKcWLUwXz+zJWgUp/XCc GZ9fY/x3KBKiFXU1NmaIqt+Y0ecX5Z3FCHu3h51o5riIQZAAyaVPZTFWGn/3agk+B2 HtcWvIrRT+XsA6KpPB4iT9NvFHAfaAiPlHynqlYEMXfgFfGSzuGAQvba/hakcX+DtH HHrWbfE7Hzz7g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tudor Ambarus , Sam Protsenko , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.19 136/148] tty: serial: samsung: fix tx_empty() to return TIOCSER_TEMT Date: Sun, 24 Mar 2024 19:50:00 -0400 Message-ID: <20240324235012.1356413-137-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Tudor Ambarus [ Upstream commit 314c2b399288f0058a8c5b6683292cbde5f1531b ] The core expects for tx_empty() either TIOCSER_TEMT when the tx is empty or 0 otherwise. s3c24xx_serial_txempty_nofifo() might return 0x4, and at least uart_get_lsr_info() tries to clear exactly TIOCSER_TEMT (BIT(1)). Fix tx_empty() to return TIOCSER_TEMT. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Tudor Ambarus Reviewed-by: Sam Protsenko Link: https://lore.kernel.org/r/20240119104526.1221243-2-tudor.ambarus@lina= ro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/samsung.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 5f1f52cc63951..c76bf1c11e6fd 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -800,11 +800,10 @@ static unsigned int s3c24xx_serial_tx_empty(struct ua= rt_port *port) if ((ufstat & info->tx_fifomask) !=3D 0 || (ufstat & info->tx_fifofull)) return 0; - - return 1; + return TIOCSER_TEMT; } =20 - return s3c24xx_serial_txempty_nofifo(port); + return s3c24xx_serial_txempty_nofifo(port) ? TIOCSER_TEMT : 0; } =20 /* no modem control lines */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98CEB22F4ED; Sun, 24 Mar 2024 23:52:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324371; cv=none; b=J21CZLaG0fb4kXK1SfYu0u1rEC+JslDoIS0NC5IfO4KANoV1UOV/zTdx24CIIWuc3Sq/bP9CraSyRovXpByvNtzrVmJc5rSt/p5i/EQWweZa8hE+9AfxrdD2goZBbC2q7nlzeY5A0/lSK4teRNF4QuImfp+STGVfagUfXa1jLug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324371; c=relaxed/simple; bh=QUGCoymRcEaCqGNz+5TWFFGBLJK+0XjjHAOkdaWp5gM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fb+ooUT2+b/jy8wU6du1YqDYup9vtChISfNokG+x3Uh2QhZg/PQtbdl1UH7ECyWKgdFIsk1mXAM88+bwCC784be1/UtDWcIqDPlDkQwraz4/7wm8oJXa781SxYujalukvjMyY+VPkmNz9vG+8YDv7oHvjfFqcX1yanvLR+qzU8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a4CmaObg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a4CmaObg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6A42C43390; Sun, 24 Mar 2024 23:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324370; bh=QUGCoymRcEaCqGNz+5TWFFGBLJK+0XjjHAOkdaWp5gM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4CmaObgl2LSyn4hfglew4zgo4rnyfsgPUul/JezWfIsUecEMnpvLWsgzTYFkcxTW hf59F3MwrpfYzCwkwOkZXBEO5XKALIokvTwIdeP07L8yxzg0Yt5rlFm3KQJBzFox1L 7+AJQBg1c87nzdzzGd3P3b0W+cwcP2fFQAnBPeqSY1ytK4s7xU7FVIO/Dz1dQlW3YR UMco5XzAn2UHMQpX8kDvSlRj7N0NMnphKG6pSaAByqY2Ixe27j2DVwjp3NgwCp/b12 72GiQHgO9xUGRYoCMk/Sw4+BNixghDwiTw+WDuWjhRh3RlEL5v/eNCI/h+ZkR9++wE +A2oyDVsQHwkg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Masahiro Yamada , Sasha Levin Subject: [PATCH 4.19 137/148] kconfig: fix infinite loop when expanding a macro at the end of file Date: Sun, 24 Mar 2024 19:50:01 -0400 Message-ID: <20240324235012.1356413-138-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada [ Upstream commit af8bbce92044dc58e4cc039ab94ee5d470a621f5 ] A macro placed at the end of a file with no newline causes an infinite loop. [Test Kconfig] $(info,hello) \ No newline at end of file I realized that flex-provided input() returns 0 instead of EOF when it reaches the end of a file. Fixes: 104daea149c4 ("kconfig: reference environment variables directly and= remove 'option env=3D'") Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/kconfig/zconf.l | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index c2f577d719647..2a47ce9b219a0 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -292,8 +292,11 @@ static char *expand_token(const char *in, size_t n) new_string(); append_string(in, n); =20 - /* get the whole line because we do not know the end of token. */ - while ((c =3D input()) !=3D EOF) { + /* + * get the whole line because we do not know the end of token. + * input() returns 0 (not EOF!) when it reachs the end of file. + */ + while ((c =3D input()) !=3D 0) { if (c =3D=3D '\n') { unput(c); break; --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD98A22F4F4; Sun, 24 Mar 2024 23:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324372; cv=none; b=mYPCGqGoYd8fonViOLcvrm1AsHfw7jMbnZMeb3TMgGRlgTjtnJ6EJaPMBdpgjkF3hQn9ZWmh/PcWtBIfRim0ZlvtttTFMyBBlmMaOncQQwnb/G1zAnU4/+9xDUrl4VTJGVRGWESNZ/ms9PftC/YaGouxo47fVMlINVI++SA/4qM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324372; c=relaxed/simple; bh=jhQcHsM9X+UJssCBHLAu+ithg8EyBjUhqhmuoeH74BI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SaNV17eb0yv866zSqPMh9eFzVaGNAPxpOBfC7OzF7XSsV9pHsCe1kEZ7PnCmyD9CCzkSlxcPWSIXuSU7MMYLkb686pn60R93PTRJ9KPuPCagUi7Yd9o4lBztOcg5Hy38r6/eq4SoPnqzvw0wIjWzgnaJLeYY0VGBfJGUcddWaCI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oqV+wOtY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oqV+wOtY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C051CC43394; Sun, 24 Mar 2024 23:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324372; bh=jhQcHsM9X+UJssCBHLAu+ithg8EyBjUhqhmuoeH74BI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oqV+wOtYRbfSXUKF3XwUhPj8a37YwiEMs0jHPSRrHdVz/GzKmRg/Uw57pAvv0F/5j 4OhAc9BoMp+ZfFJ0AjhbtbYlB0r4TqINdHeMLNTUtNqEow1v/+dfd617HXFC8ByVg+ VH8jpfzUNGzmgh7Q5renlNRz+J/iKP3N2QpRwuaPgUdAW+jjrHuj5yY0SZGM+fNaxN X1MTCvqcdV/BZGoOZjEkOaGuxMs70PjZzYs6VoigYtC+26CyckEupre/5JNymQnoFt sjANFqz0E8ZbJq7AhOX1TRWoWXS5D6FLk+o7bOioHMaYkUF+eYYgiAp2o/lh7y5/Jz LE0/yEadCxitQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , Eddie Huang , Sean Wang , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org, Marc Zyngier , Philipp Zabel , Peter Rosin , AngeloGioacchino Del Regno , Sasha Levin Subject: [PATCH 4.19 138/148] rtc: mt6397: select IRQ_DOMAIN instead of depending on it Date: Sun, 24 Mar 2024 19:50:02 -0400 Message-ID: <20240324235012.1356413-139-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 544c42f798e1651dcb04fb0395219bf0f1c2607e ] IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set it directly thru "make *config", so drivers should select it instead of depending on it if they need it. Relying on it being set for a dependency is risky. Consistently using "select" or "depends on" can also help reduce Kconfig circular dependency issues. Therefore, change the use of "depends on" for IRQ_DOMAIN to "select" for RTC_DRV_MT6397. Fixes: 04d3ba70a3c9 ("rtc: mt6397: add IRQ domain dependency") Cc: Arnd Bergmann Cc: Eddie Huang Cc: Sean Wang Cc: Matthias Brugger Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Cc: Alessandro Zummo Cc: Alexandre Belloni Cc: linux-rtc@vger.kernel.org Cc: Marc Zyngier Cc: Philipp Zabel Cc: Peter Rosin Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Randy Dunlap Link: https://lore.kernel.org/r/20240213050258.6167-1-rdunlap@infradead.org Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin --- drivers/rtc/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index b5845f16a3a26..199cc39459198 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1719,7 +1719,8 @@ config RTC_DRV_MOXART =20 config RTC_DRV_MT6397 tristate "MediaTek PMIC based RTC" - depends on MFD_MT6397 || (COMPILE_TEST && IRQ_DOMAIN) + depends on MFD_MT6397 || COMPILE_TEST + select IRQ_DOMAIN help This selects the MediaTek(R) RTC driver. RTC is part of MediaTek MT6397 PMIC. You should enable MT6397 PMIC MFD before select --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9237122F500; Sun, 24 Mar 2024 23:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324374; cv=none; b=cqizvOu/Ejw1NO2wo3ssKqNDtvw3Xsjyr/ievLKVPIGl1QmIwzDYfhjs9lejnAymv7vzZIOKKMUYYctK6MiKQxFazysFNIemR8ytS2NMVdjiGonnnMgfRKLURxuAmnIWvxdWq1X7sx4K98+agRq7Xg7nW7jPHfQvnWYLLikZzCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324374; c=relaxed/simple; bh=wzcLOFErmxgbR3bL6+t3Pc8OhoA272ipSkVOSgI3vBc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XaEjE4dfIldJK1BH0APA0D5+AIdK1JYYz9iGF//IWX8jo3IJv+CnSs/Po53aRfDI8p8Tv4dBZ+1uaYBxzrQ1cI4Dtb5eQlSmWoAeRKCqyhO4xwRnTmcdHcpaeIhtZx5RcChciMSHhSnccAfv6lsma3XVtdzQXKqqDsMBFO6tMsc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZbF28nGh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZbF28nGh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D06E8C43390; Sun, 24 Mar 2024 23:52:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324373; bh=wzcLOFErmxgbR3bL6+t3Pc8OhoA272ipSkVOSgI3vBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZbF28nGhCuR3MY2+7xLBYV7jhjWPcvJbuKMuQD4TULYie8RYZMJMxF4IiFRLI+wTm CjjKnbEFgbu4kZJfHbxpVgt6yVd9Z8eFwlyeyxmJpLd3SJFX5WZlp4E2UQCnm8pteE c1CxsWU1s4UD9gwTd/ofnKO9j3dGHXwOdwaQEmzmepLqxtvVo+sUbDVjhqBdHQAbh2 HSeY1cVantcGmU2KZM7LKicvUAp1mali/6SM7ZyjEFbz/iouqZtWkZzMEOiMCIeYdf /ZsRbPnOMy8ahjtzhroJeEQtoKJmX4tL3u5U6ijaYXntjH32MuvJoENJfD1d+SV1Rx WUCKe4lLa5C5w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andy Shevchenko , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.19 139/148] serial: 8250_exar: Don't remove GPIO device on suspend Date: Sun, 24 Mar 2024 19:50:03 -0400 Message-ID: <20240324235012.1356413-140-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit 73b5a5c00be39e23b194bad10e1ea8bb73eee176 ] It seems a copy&paste mistake that suspend callback removes the GPIO device. There is no counterpart of this action, means once suspended there is no more GPIO device available untile full unbind-bind cycle is performed. Remove suspicious GPIO device removal in suspend. Fixes: d0aeaa83f0b0 ("serial: exar: split out the exar code from 8250_pci") Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20240219150627.2101198-2-andriy.shevchenko@= linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_exar.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/= 8250_exar.c index 195f58c5b477f..319737919381d 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -553,6 +553,7 @@ static void exar_pci_remove(struct pci_dev *pcidev) for (i =3D 0; i < priv->nr; i++) serial8250_unregister_port(priv->line[i]); =20 + /* Ensure that every init quirk is properly torn down */ if (priv->board->exit) priv->board->exit(pcidev); } @@ -567,10 +568,6 @@ static int __maybe_unused exar_suspend(struct device *= dev) if (priv->line[i] >=3D 0) serial8250_suspend_port(priv->line[i]); =20 - /* Ensure that every init quirk is properly torn down */ - if (priv->board->exit) - priv->board->exit(pcidev); - return 0; } =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB2C322F502; Sun, 24 Mar 2024 23:52:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324374; cv=none; b=J4h4OnLrEK4kWds6xi5P4YWg3RWyIq5IBMq1JHylm+LlkeCsvr96C1Fvgr4zcsoQlglhI8xJ0gPYmRFDwNu/qlOaE1P3kdVAuk6DNGD6zc9JJf4CubhK72/DevP8wZgqZ1ocaCfudY6uLFHLNpaNTQsA3/WBdf40BPG5+y3NuuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324374; c=relaxed/simple; bh=stj3yIGL6BZHpi7EgfUVHmgxD/4JfLOOJXM7o+vgo1o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XYjfL4M1oh7AJJqQwT6y971M+uMSi4ek1MU+W2axfKKPVM7JBU60z4efTT0/Ku7QoRpcRvEv79MCLwnCqmudnR5EGLbUi+f97Akxpa6GWnzxauOzJdvCh3bZlNznxFXPUl5w5O9qMSzN0iNyu8nOvziIjsNUZgU5Bw1vyipLJ0g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HKVN2H6F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HKVN2H6F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B57B0C43394; Sun, 24 Mar 2024 23:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324374; bh=stj3yIGL6BZHpi7EgfUVHmgxD/4JfLOOJXM7o+vgo1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HKVN2H6Fx18jHIaVERBsk7EewKIEOoQNjDPjgZ2kzTwDGix7Xhm7CgB0SW0i3YeMa 2bopDt2urelxwacumf113aa2Z/4ngWtj6uMbLp8ubsSClaPsCmuyXyozqs4jB6JwzQ q1GJq2C4qej+DQWHWQTcSjWEEqrG6CQRPixR7f8l8iBBMiOYmoDJToOcPelkalfBx0 FTa70Y2OLr5fZiZxukSOFzOWVtg1azRnuTP5szCDckf8j2DWA8blQNnsbm1oziWZmh lvbLqZv8c3srAih1LfKiQN84jqMDLn5fv/9Bfb27YL1ca8DU+tFjAMrnxfmrP7n/sp af7dp09EQz0qQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dan Carpenter , Rui Miguel Silva , Alex Elder , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.19 140/148] staging: greybus: fix get_channel_from_mode() failure path Date: Sun, 24 Mar 2024 19:50:04 -0400 Message-ID: <20240324235012.1356413-141-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 34164202a5827f60a203ca9acaf2d9f7d432aac8 ] The get_channel_from_mode() function is supposed to return the channel which matches the mode. But it has a bug where if it doesn't find a matching channel then it returns the last channel. It should return NULL instead. Also remove an unnecessary NULL check on "channel". Fixes: 2870b52bae4c ("greybus: lights: add lights implementation") Signed-off-by: Dan Carpenter Reviewed-by: Rui Miguel Silva Reviewed-by: Alex Elder Link: https://lore.kernel.org/r/379c0cb4-39e0-4293-8a18-c7b1298e5420@moroto= .mountain Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/greybus/light.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/ligh= t.c index db06cd544af58..8c5819d1e1abe 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -102,15 +102,15 @@ static struct led_classdev *get_channel_cdev(struct g= b_channel *channel) static struct gb_channel *get_channel_from_mode(struct gb_light *light, u32 mode) { - struct gb_channel *channel =3D NULL; + struct gb_channel *channel; int i; =20 for (i =3D 0; i < light->channels_count; i++) { channel =3D &light->channels[i]; - if (channel && channel->mode =3D=3D mode) - break; + if (channel->mode =3D=3D mode) + return channel; } - return channel; + return NULL; } =20 static int __gb_lights_flash_intensity_set(struct gb_channel *channel, --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B113822F4FD; Sun, 24 Mar 2024 23:52:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324375; cv=none; b=GKA1LZtD/6LHQ2OVnanfbd1oxiuUjVW8wNxJnRdrD5YSQjptTvFKNttyM/2n3MArKhEkTq18La6j8o1LfXqnnfjcdX1Q8+Etatbtd6ZnF+cxhpsIYJaoJmhyQdIFwH526mQiiBuoVEDsNrTFYIsuo5Rw0MproTxVgpHZe/3+OHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324375; c=relaxed/simple; bh=enmPEvNCBlIwV8Fl86Ev3ooXw4ze2iMs+fMseQtNmSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iMy3ULkgjyIXJ/LRZGkceQsU78n5jHFFo08V6YxmFiQ5H/+QSGuU+nLMzdGr6zZjh7Ar3s5Ytk9lV6/w97Qx6CvGZlu2+0hM/ypl0FitJ51A62YqLFFGKOs3Dd910l1UKjgpfaFqLDZbJ3mytQV0bQytZehQCZSeXsroDMVkqds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pXloHjDe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pXloHjDe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC244C43390; Sun, 24 Mar 2024 23:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324375; bh=enmPEvNCBlIwV8Fl86Ev3ooXw4ze2iMs+fMseQtNmSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXloHjDeXIHhLvqQjLmoFvYVjbYX6WIN5GAGZNyGdJH/lMG7Ct2i/up+AfueZhEvm dARxtr9/zY25Qnzn2y97Hm19IAA8Chf+Mxx7UVTEKDX8mk+H2HEAYp3SmH/fw973bw VDqFLd8WSU41lrrFOmoyueo5KNTkWuTKkaGyOK1E0kz8v6BdukrLhl2AYMYd4MLci3 JdiZuj71M/gNV+IiEPaMMXXCQwrh96JNdZkj0uNgE/z9TIRkpxIR2xIPhltmX8FSYk v9kbVj/EXJpBd3aw/740Bm5NZvrOLf/SdZ9/4/7Aoy5IlLqJsR3To+3XSEeu6NrUnR 0Gs6dLWeHAtbQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Colin Ian King , Alan Stern , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.19 141/148] usb: gadget: net2272: Use irqflags in the call to net2272_probe_fin Date: Sun, 24 Mar 2024 19:50:05 -0400 Message-ID: <20240324235012.1356413-142-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable From: Colin Ian King [ Upstream commit 600556809f04eb3bbccd05218215dcd7b285a9a9 ] Currently the variable irqflags is being set but is not being used, it appears it should be used in the call to net2272_probe_fin rather than IRQF_TRIGGER_LOW being used. Kudos to Uwe Kleine-K=C3=B6nig for suggesting the fix. Cleans up clang scan build warning: drivers/usb/gadget/udc/net2272.c:2610:15: warning: variable 'irqflags' set but not used [-Wunused-but-set-variable] Fixes: ceb80363b2ec ("USB: net2272: driver for PLX NET2272 USB device contr= oller") Signed-off-by: Colin Ian King Acked-by: Alan Stern Link: https://lore.kernel.org/r/20240307181734.2034407-1-colin.i.king@gmail= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/net2272.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2= 272.c index 077fa9304618d..2004442d791cf 100644 --- a/drivers/usb/gadget/udc/net2272.c +++ b/drivers/usb/gadget/udc/net2272.c @@ -2638,7 +2638,7 @@ net2272_plat_probe(struct platform_device *pdev) goto err_req; } =20 - ret =3D net2272_probe_fin(dev, IRQF_TRIGGER_LOW); + ret =3D net2272_probe_fin(dev, irqflags); if (ret) goto err_io; =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9089822F510; Sun, 24 Mar 2024 23:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324376; cv=none; b=Bvd7tWXlFcAm7fkOD0RBNj4j7/Ddgr74fhpbTtg5HjRrLSuzLMqyieOJQlEZQ7jY0cGs9WZ5tKOgG8mEwizaCGkBYXhNkTWzf9+TzyzfuHJcIkB+YHEtbVRAWyqnLxmF2OOEcNaP+riEy3PfUEhTQtoJl3nVRsyP1x0skjh5FDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324376; c=relaxed/simple; bh=tCYwIpLCrAOSE6XXUPJqeVGUo8QLA62vXiD5B6NkFHc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C7jKxCb5UFjnk/b8e4EHnEn7Ml0CyBsP8+pyHM+0FeIyXTWMhLOrnTlLWY87xDlD+hjncPXjqQIQOs3wD4ZynY2Or0MNS34WAIv0Cemi7jgxjTJew8xmsI4ncY9LNqBvY4vl7P9U3/TWD7Cx5ZD4U5qQXH1A3jLh95/ZdOT6HQU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BRahk9yG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BRahk9yG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEAB8C433C7; Sun, 24 Mar 2024 23:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324376; bh=tCYwIpLCrAOSE6XXUPJqeVGUo8QLA62vXiD5B6NkFHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRahk9yG5soAKJUdIV8iKjBMgnNJz02zUHfjob7dnqTgAKIEwBM5qQ5r3ssUUm2wp 2dWJa5IZrl69YQwEyCNJK2XhId+i8odp7rre9uT7OR03FRpbbXlMxFZuW+SsCeu9rj ijWhX0n3ayGn4APAU/WF4JlPc6lI3P0Ffn49/2RPAfE0/meCl1sh0a0TpGbtF7V6FP e/hoFvqO8W+eXJzfNBxzv6ORv0kKHVQGRdyxqfqzYq2kjytaWsR7ABm/WjFRzSZWwa 6C0qMyTWGEtb+BBKab2OdllyvP4kGqRyWQjmAhOi/SfqNNsByUaquStyn8X2cFS0i4 OH+esdxTOYpZg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Murali Karicheri , "David S . Miller" , Sasha Levin Subject: [PATCH 4.19 142/148] net: hsr: fix placement of logical operator in a multi-line statement Date: Sun, 24 Mar 2024 19:50:06 -0400 Message-ID: <20240324235012.1356413-143-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Murali Karicheri [ Upstream commit 059477830022e1886f55a9641702461c249fa864 ] In a multi-line statement exceeding 80 characters, logical operator should be at the end of a line instead of being at the start. This is seen when ran checkpatch.pl -f on files under net/hsr. The change is per suggestion from checkpatch. Signed-off-by: Murali Karicheri Signed-off-by: David S. Miller Stable-dep-of: ddbec99f5857 ("hsr: Fix uninit-value access in hsr_get_node(= )") Signed-off-by: Sasha Levin --- net/hsr/hsr_forward.c | 8 ++++---- net/hsr/hsr_framereg.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index adfb497606785..886fad5922b3c 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -63,8 +63,8 @@ static bool is_supervision_frame(struct hsr_priv *hsr, st= ruct sk_buff *skb) return false; =20 /* Correct ether type?. */ - if (!(ethHdr->h_proto =3D=3D htons(ETH_P_PRP) - || ethHdr->h_proto =3D=3D htons(ETH_P_HSR))) + if (!(ethHdr->h_proto =3D=3D htons(ETH_P_PRP) || + ethHdr->h_proto =3D=3D htons(ETH_P_HSR))) return false; =20 /* Get the supervision header from correct location. */ @@ -336,8 +336,8 @@ static int hsr_fill_frame_info(struct hsr_frame_info *f= rame, /* FIXME: */ WARN_ONCE(1, "HSR: VLAN not yet supported"); } - if (ethhdr->h_proto =3D=3D htons(ETH_P_PRP) - || ethhdr->h_proto =3D=3D htons(ETH_P_HSR)) { + if (ethhdr->h_proto =3D=3D htons(ETH_P_PRP) || + ethhdr->h_proto =3D=3D htons(ETH_P_HSR)) { frame->skb_std =3D NULL; frame->skb_hsr =3D skb; frame->sequence_nr =3D hsr_get_skb_sequence_nr(skb); diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 37795502bb511..9c5a423f0f7a3 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -192,8 +192,8 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, st= ruct sk_buff *skb, =20 /* Everyone may create a node entry, connected node to a HSR device. */ =20 - if (ethhdr->h_proto =3D=3D htons(ETH_P_PRP) - || ethhdr->h_proto =3D=3D htons(ETH_P_HSR)) { + if (ethhdr->h_proto =3D=3D htons(ETH_P_PRP) || + ethhdr->h_proto =3D=3D htons(ETH_P_HSR)) { /* Use the existing sequence_nr from the tag as starting point * for filtering duplicate frames. */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92B4C13C9A5; Sun, 24 Mar 2024 23:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324378; cv=none; b=kHxzvt5ZY8mk7JjOdtepUP817JvrslSWfOmZoJjvL9p2Ci2Bj6shHUFwvxpxfoPwojFVoMQedJ3/KyhELPIYKzgvJEosLQ7J7AequxTidAjwDhf8J1kdH4nzXzlUXEgvMlMl7pFzNx4iXGwa3L2GhzXyFFmxWzpLOFtD3CMfGS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324378; c=relaxed/simple; bh=sBgRmurGHqS1LjRxCbgBfqoRh4FFHPj5irYNMbYk3p4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l/dkbu7/+J8Z4A527vpLBsII2Zbxv5aT59rWtz2XKH5Nc0Un4g878EhajU/Itn4WwPawhzPDCiDaY8HIUMaBGHrnuUAJaGpD1Bgx3uAWTv41LAjlH6zHgpxyXJVj4eWgWRi//QReB3jScd+iC+UFRd26baBqeqXWwBvNI9Ka2Xk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=He3pfzo/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="He3pfzo/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8F98C43390; Sun, 24 Mar 2024 23:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324377; bh=sBgRmurGHqS1LjRxCbgBfqoRh4FFHPj5irYNMbYk3p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=He3pfzo/LWgi4hPd8Xqs3wq8r5Y4JW3drGntIkuJzBU2ihJL3rsFdewMqPdggS3bN 5nrvvJcSaOoGvVlxiCCfMb7Q22l2Ee4/EM4hvytn3/edq6I/sLsXw2/lFSfra0fE/p qrsZq9nrLm8b+Vsre4JC24BUJD7CiLkyFCwg6TYiboRuYHQygeGaeFUFA1D0Q1oYjr +k/Qyk5RnGwehDzZbg+QpskTUUVDrvUZ0Iym8Nmy0ATYliut5E97wH252O2GaLpvvi XYTnC/ITwUJqhE1aB1PhKQeAZJ177mrznOG+JM3l2R31IZL4Iv67SQz5TxPuR6B/nT EgeVejl4TnOug== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shigeru Yoshida , syzbot+2ef3a8ce8e91b5a50098@syzkaller.appspotmail.com, Paolo Abeni , Sasha Levin Subject: [PATCH 4.19 143/148] hsr: Fix uninit-value access in hsr_get_node() Date: Sun, 24 Mar 2024 19:50:07 -0400 Message-ID: <20240324235012.1356413-144-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shigeru Yoshida [ Upstream commit ddbec99f58571301679addbc022256970ca3eac6 ] KMSAN reported the following uninit-value access issue [1]: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D BUG: KMSAN: uninit-value in hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c= :246 hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c:246 fill_frame_info net/hsr/hsr_forward.c:577 [inline] hsr_forward_skb+0xe12/0x30e0 net/hsr/hsr_forward.c:615 hsr_dev_xmit+0x1a1/0x270 net/hsr/hsr_device.c:223 __netdev_start_xmit include/linux/netdevice.h:4940 [inline] netdev_start_xmit include/linux/netdevice.h:4954 [inline] xmit_one net/core/dev.c:3548 [inline] dev_hard_start_xmit+0x247/0xa10 net/core/dev.c:3564 __dev_queue_xmit+0x33b8/0x5130 net/core/dev.c:4349 dev_queue_xmit include/linux/netdevice.h:3134 [inline] packet_xmit+0x9c/0x6b0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3087 [inline] packet_sendmsg+0x8b1d/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b Uninit was created at: slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560 __alloc_skb+0x318/0x740 net/core/skbuff.c:651 alloc_skb include/linux/skbuff.h:1286 [inline] alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2787 packet_alloc_skb net/packet/af_packet.c:2936 [inline] packet_snd net/packet/af_packet.c:3030 [inline] packet_sendmsg+0x70e8/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b CPU: 1 PID: 5033 Comm: syz-executor334 Not tainted 6.7.0-syzkaller-00562-g9= f8413c4a66f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 11/17/2023 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D If the packet type ID field in the Ethernet header is either ETH_P_PRP or ETH_P_HSR, but it is not followed by an HSR tag, hsr_get_skb_sequence_nr() reads an invalid value as a sequence number. This causes the above issue. This patch fixes the issue by returning NULL if the Ethernet header is not followed by an HSR tag. Fixes: f266a683a480 ("net/hsr: Better frame dispatch") Reported-and-tested-by: syzbot+2ef3a8ce8e91b5a50098@syzkaller.appspotmail.c= om Closes: https://syzkaller.appspot.com/bug?extid=3D2ef3a8ce8e91b5a50098 [1] Signed-off-by: Shigeru Yoshida Link: https://lore.kernel.org/r/20240312152719.724530-1-syoshida@redhat.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/hsr/hsr_framereg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 9c5a423f0f7a3..e1ef9799762c9 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -194,6 +194,10 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, s= truct sk_buff *skb, =20 if (ethhdr->h_proto =3D=3D htons(ETH_P_PRP) || ethhdr->h_proto =3D=3D htons(ETH_P_HSR)) { + /* Check if skb contains hsr_ethhdr */ + if (skb->mac_len < sizeof(struct hsr_ethhdr)) + return NULL; + /* Use the existing sequence_nr from the tag as starting point * for filtering duplicate frames. */ --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E54213C9B2; Sun, 24 Mar 2024 23:52:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324379; cv=none; b=jswZEn8cbZ64KhIzPJFvysfUUextnwlfaqth8pCrdQCntDEY9JfDQ2TcDYWv6j0aOd9O81sPtvfplMRz68X3s7aGR2ckJvEJpxcegqYmaOivSbeuePfrPlsvAWOEyzOu8VB/2H9H9cce5iQg3FlWjNaeZAlm/pp1b1SQPnBfa3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324379; c=relaxed/simple; bh=NXGz5zQ1cIN41gQxmUZc+/iBhIw/1/8LD1rvp3eyCDw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ghff4G1VxEJvI2dvcZdrzOm0b7kMAYxdEZ7Bc5n2uFQGG4xkx3LdRqQUN1tXFpfq17iXT/ApJfJIXY7TCK9FChSsUAfkViMFFOPPeGKV4FnTktaXb4S4fd679CLdAcNFhbX7Fi8MLDvQF6mKQhTmTaS596yx5QczbJRc43baed4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MJFOu9Nm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MJFOu9Nm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6485C43394; Sun, 24 Mar 2024 23:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324378; bh=NXGz5zQ1cIN41gQxmUZc+/iBhIw/1/8LD1rvp3eyCDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJFOu9Nm0ibwdsdirFQ1nIUpVmAl0ixAcNz6gx2HVdAZNAfZliEfihoy4w74rB3c6 UWpjRNAqB3//uYczw3cYeUe2PV2BniTZ4hKJTbr1OJu2HevzIsgcCpwMKg0Akc99PQ ygy+aiP66+lBkN51shnPlsSW1jmhRpiS+N9z4Og0Go5dV3TeF6AHTPXbJxBOnRqvIX gV++jXNf+CSarVp2gZ+93uE8xv3rMLONjDAGa+ptkc4Xz16B6J9ucmaq80mCVvyxWq pKydGmC/VDQcL7z06cKdoVxZk6uicbmizwH+0gUiGybItLNU9Wb+9OP8sboOAz6T1q 7Hn9hCB60fB8w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yewon Choi , Michal Kubiak , Paolo Abeni , Sasha Levin Subject: [PATCH 4.19 144/148] rds: introduce acquire/release ordering in acquire/release_in_xmit() Date: Sun, 24 Mar 2024 19:50:08 -0400 Message-ID: <20240324235012.1356413-145-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yewon Choi [ Upstream commit 1422f28826d2a0c11e5240b3e951c9e214d8656e ] acquire/release_in_xmit() work as bit lock in rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, following smp_mb__after_atomic() does not guarantee release ordering (memory barrier actually should be placed before clear_bit()). Instead, we use clear_bit_unlock/test_and_set_bit_lock() here. Fixes: 0f4b1c7e89e6 ("rds: fix rds_send_xmit() serialization") Fixes: 1f9ecd7eacfd ("RDS: Pass rds_conn_path to rds_send_xmit()") Signed-off-by: Yewon Choi Reviewed-by: Michal Kubiak Link: https://lore.kernel.org/r/ZfQUxnNTO9AJmzwc@libra05 Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/rds/send.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/rds/send.c b/net/rds/send.c index c856e6c963af9..dcb338339b717 100644 --- a/net/rds/send.c +++ b/net/rds/send.c @@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset); =20 static int acquire_in_xmit(struct rds_conn_path *cp) { - return test_and_set_bit(RDS_IN_XMIT, &cp->cp_flags) =3D=3D 0; + return test_and_set_bit_lock(RDS_IN_XMIT, &cp->cp_flags) =3D=3D 0; } =20 static void release_in_xmit(struct rds_conn_path *cp) { - clear_bit(RDS_IN_XMIT, &cp->cp_flags); - smp_mb__after_atomic(); + clear_bit_unlock(RDS_IN_XMIT, &cp->cp_flags); /* * We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 296ED13C9B4; Sun, 24 Mar 2024 23:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324380; cv=none; b=ixYw1K4Gq9gYct4YmV8DoxpoV76Xhdv3Y1YB9a/r+4PqWd9WriabquOYe/3w6+ggtEC6X8vToc+Z2qJkZMP8EGe7kaLFtt+OEdX+bdiXsP/i3FT7xOj3oTb13HOYJ7YbD1Txv+2v5eQ1H8DaL+HF0qBM+85OO/icB3Uq9cg+m8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324380; c=relaxed/simple; bh=Q87wpKdOQl0hrcVlZqfLflnVZ+hc8gAvqiG16jNGA8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gNeuGAKAhJ9DkhiVpacqS+D31eC261Cvxe/dsPZ+KiHOpDAyqRU8pyYiOmScl9getjrxFbi6R5+CAbX43UxlPpIgekzW+QE7c/YH8Sq/17pe98jtoSAdu3Roex3quLtMq8oIN8XcrZTjVo6urL5yyDPiC2Qc/LOTjemJkyx7Fo8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FSDVvC80; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FSDVvC80" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0747C43399; Sun, 24 Mar 2024 23:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324380; bh=Q87wpKdOQl0hrcVlZqfLflnVZ+hc8gAvqiG16jNGA8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FSDVvC80wX6z8CGSaLF4wYyLreJEK4J7bpvZvht1qsJtDrF2VFVVaaWMChIrOUDX+ OaCWiuFY9SMo8TeR0sQGUftK/Qy2vVNWRI8r0ro1IdX35gYUgrvWScJnRQBnc/Xpfq IvzqFs7T6ogdp6hBDV6iyorcT5GUVZYCprvTsSu5l29PMR7uXhsptYMrV/6KRiv5Wa SDRsfX6ZqNYgUJLLrvAko5UZYj8NM201aNKIINd99HAZ4WESnnjsZjYbypkK3XdVEu EIC7L7LXGxzIJ64aL5omj3BSGKLRGMEH/Vi/XWLyrS4356v9Ad8j3FZykGQIsYUJLL j7N06lCSm8qDQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Felix Maurer , Shigeru Yoshida , Breno Leitao , Paolo Abeni , Sasha Levin Subject: [PATCH 4.19 145/148] hsr: Handle failures in module init Date: Sun, 24 Mar 2024 19:50:09 -0400 Message-ID: <20240324235012.1356413-146-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Felix Maurer [ Upstream commit 3cf28cd492308e5f63ed00b29ea03ca016264376 ] A failure during registration of the netdev notifier was not handled at all. A failure during netlink initialization did not unregister the netdev notifier. Handle failures of netdev notifier registration and netlink initialization. Both functions should only return negative values on failure and thereby lead to the hsr module not being loaded. Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamle= ss Redundancy protocol (HSRv0)") Signed-off-by: Felix Maurer Reviewed-by: Shigeru Yoshida Reviewed-by: Breno Leitao Link: https://lore.kernel.org/r/3ce097c15e3f7ace98fc7fd9bcbf299f092e63d1.17= 10504184.git.fmaurer@redhat.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/hsr/hsr_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/net/hsr/hsr_main.c b/net/hsr/hsr_main.c index cd37d0011b424..c22013ff44795 100644 --- a/net/hsr/hsr_main.c +++ b/net/hsr/hsr_main.c @@ -115,14 +115,21 @@ static struct notifier_block hsr_nb =3D { =20 static int __init hsr_init(void) { - int res; + int err; =20 BUILD_BUG_ON(sizeof(struct hsr_tag) !=3D HSR_HLEN); =20 - register_netdevice_notifier(&hsr_nb); - res =3D hsr_netlink_init(); + err =3D register_netdevice_notifier(&hsr_nb); + if (err) + return err; + + err =3D hsr_netlink_init(); + if (err) { + unregister_netdevice_notifier(&hsr_nb); + return err; + } =20 - return res; + return 0; } =20 static void __exit hsr_exit(void) --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 333F3185F08; Sun, 24 Mar 2024 23:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324382; cv=none; b=FVKtIyos9r3WK59oGb56rhaSVW0Dl45bxmmarQo35SfA1k0PUF6oZp0ROgxTM9t9ah5MjWSNF80U8FqQ8uw8f/FoG4TPFwjr2lZHKcGWcwwAt8tKaxgXwq4n+drONPDlNY9cz1NeKUvxksdaI/v0Z3VXwAk570QJgUuIEJpZq1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324382; c=relaxed/simple; bh=i4JmSMxH5OlnL+XOfQJWj9C2cgHjqyhvb5Orgg/tQzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qCyOtXj7oT5UM7VG3qatKB3cAJyRzRyQO4xvwvH/cZ7l/4kSLyZXduETma87ZLut8nYsfq57Lq3fP6KEwIOi3wwVP8Q82OI1we5unSVN8jmndzYTBtwfYQvze7FuPVAvWUODKqyURzco5iaulLsvH5Y3vzfOX73dtzxha0wIrac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W9noazb3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W9noazb3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52DACC43390; Sun, 24 Mar 2024 23:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324381; bh=i4JmSMxH5OlnL+XOfQJWj9C2cgHjqyhvb5Orgg/tQzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9noazb3JZ/Qqaqni3htUUUX7lyPCz/T4wq6a24DxuTVkgI+qhl31gxMroJmzAcuP jlSZHKyVX75QgeoiqXpVswVUgjdJ02FVZvYQlj5T+FTeRKUXCIJ5caivCycgZu7ixD bj7jCUmOMWJFq3KWuvpqSfLPA8GyUKdCy4e1NrR1H05mdxQLuZGkaNPpiWH2InBfhz /wQ5B3TKbCPzPNeTZM3PBFNeXt/1hoiT3sR53EEYS5YW6YfK/HRspP0wu/kRIpoeew hQI8t++qqntb2ML3h2REoAvZ6P2PhGlR5omOFVrjNmh4syIrAcXBsRH7XYp43tjvWm r5Hh78EsT6qPw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thinh Tran , Jiri Pirko , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 146/148] net/bnx2x: Prevent access to a freed page in page_pool Date: Sun, 24 Mar 2024 19:50:10 -0400 Message-ID: <20240324235012.1356413-147-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thinh Tran [ Upstream commit d27e2da94a42655861ca4baea30c8cd65546f25d ] Fix race condition leading to system crash during EEH error handling During EEH error recovery, the bnx2x driver's transmit timeout logic could cause a race condition when handling reset tasks. The bnx2x_tx_timeout() schedules reset tasks via bnx2x_sp_rtnl_task(), which ultimately leads to bnx2x_nic_unload(). In bnx2x_nic_unload() SGEs are freed using bnx2x_free_rx_sge_range(). However, this could overlap with the EEH driver's attempt to reset the device using bnx2x_io_slot_reset(), which also tries to free SGEs. This race condition can result in system crashes due to accessing freed memory locations in bnx2x_free_rx_sge() 799 static inline void bnx2x_free_rx_sge(struct bnx2x *bp, 800 struct bnx2x_fastpath *fp, u16 index) 801 { 802 struct sw_rx_page *sw_buf =3D &fp->rx_page_ring[index]; 803 struct page *page =3D sw_buf->page; .... where sw_buf was set to NULL after the call to dma_unmap_page() by the preceding thread. EEH: Beginning: 'slot_reset' PCI 0011:01:00.0#10000: EEH: Invoking bnx2x->slot_reset() bnx2x: [bnx2x_io_slot_reset:14228(eth1)]IO slot reset initializing... bnx2x 0011:01:00.0: enabling device (0140 -> 0142) bnx2x: [bnx2x_io_slot_reset:14244(eth1)]IO slot reset --> driver unload Kernel attempted to read user page (0) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x00000000 Faulting instruction address: 0xc0080000025065fc Oops: Kernel access of bad area, sig: 11 [#1] ..... Call Trace: [c000000003c67a20] [c00800000250658c] bnx2x_io_slot_reset+0x204/0x610 [= bnx2x] (unreliable) [c000000003c67af0] [c0000000000518a8] eeh_report_reset+0xb8/0xf0 [c000000003c67b60] [c000000000052130] eeh_pe_report+0x180/0x550 [c000000003c67c70] [c00000000005318c] eeh_handle_normal_event+0x84c/0xa= 60 [c000000003c67d50] [c000000000053a84] eeh_event_handler+0xf4/0x170 [c000000003c67da0] [c000000000194c58] kthread+0x1c8/0x1d0 [c000000003c67e10] [c00000000000cf64] ret_from_kernel_thread+0x5c/0x64 To solve this issue, we need to verify page pool allocations before freeing. Fixes: 4cace675d687 ("bnx2x: Alloc 4k fragment for each rx ring buffer elem= ent") Signed-off-by: Thinh Tran Reviewed-by: Jiri Pirko Link: https://lore.kernel.org/r/20240315205535.1321-1-thinhtr@linux.ibm.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/= ethernet/broadcom/bnx2x/bnx2x_cmn.h index df5e8c2e8eafe..844195849ae76 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h @@ -1008,9 +1008,6 @@ static inline void bnx2x_set_fw_mac_addr(__le16 *fw_h= i, __le16 *fw_mid, static inline void bnx2x_free_rx_mem_pool(struct bnx2x *bp, struct bnx2x_alloc_pool *pool) { - if (!pool->page) - return; - put_page(pool->page); =20 pool->page =3D NULL; @@ -1021,6 +1018,9 @@ static inline void bnx2x_free_rx_sge_range(struct bnx= 2x *bp, { int i; =20 + if (!fp->page_pool.page) + return; + if (fp->mode =3D=3D TPA_MODE_DISABLED) return; =20 --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F958185F10; Sun, 24 Mar 2024 23:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324383; cv=none; b=Pmg0melOPeG6DzoHY3qctiAD3sRloqts0dQP0C2p9H5WNX+zNVPhj1NFmhLmJkw/lR59684cw66CgAw3gm0OryH+oJ00hF1DvP7lsqJ0DUtJLhGO6GO4FXhbHJTqTvFMmA9Rgf6fvFslFluIzUTra4YdKkp/V26fM7iVeegNE0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324383; c=relaxed/simple; bh=gBjRgf2c4ckdFBsCgqHjXuNR2hYxP1M+DsSB92YDHhc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qANxfTb+QB1zzK6UAhyVzZHBc2wpOgunfPbiIqqoMN77/oJujOT3oxKsjRCJ/EmtnvjyfGM25QCQRdxFgGcLR51cLdLN7quX8p+6BdR5jKUR4UXkWDLC3zS1iDIVFNGgZBkq1zZHnh1DW21vyGYn09F8e4k8t3MxFe+fSWFhDpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RJu2Wiic; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RJu2Wiic" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55F0DC433C7; Sun, 24 Mar 2024 23:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324382; bh=gBjRgf2c4ckdFBsCgqHjXuNR2hYxP1M+DsSB92YDHhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJu2Wiic0cbWEUrP1Hb3hGpHlLAFX1OEEmVpRr9KtKxS2BsZQRl9wdgZ4vM3N0QGn ayZSer3rA30jCFWwn+3TsAtUevLWhB1vDeo1q4x0Utsi+Z7tqrBnKM+XLUoL1+rMt/ vH4HMWa+BZCxvUzi8MQhG/O/2saQQSATi5/uD2zavrgIMAtAc246hWzAr2iYa2nJtD oZqhCitNL3YP9aHJYqLDUD2Yhd0/hnw+M93KHmhAldEj8Jq6+GBmlXGV9SWweIvzHm hqAcAy+V8ILDhadxTrDIVTSgA0S9Iol+ltL/x9QGib5W36sN2qNDp8TieIO96rXRB3 zYNQEbdVj5iww== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fei Shao , AngeloGioacchino Del Regno , Mark Brown , Sasha Levin Subject: [PATCH 4.19 147/148] spi: spi-mt65xx: Fix NULL pointer access in interrupt handler Date: Sun, 24 Mar 2024 19:50:11 -0400 Message-ID: <20240324235012.1356413-148-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Fei Shao [ Upstream commit a20ad45008a7c82f1184dc6dee280096009ece55 ] The TX buffer in spi_transfer can be a NULL pointer, so the interrupt handler may end up writing to the invalid memory and cause crashes. Add a check to trans->tx_buf before using it. Fixes: 1ce24864bff4 ("spi: mediatek: Only do dma for 4-byte aligned buffers= ") Signed-off-by: Fei Shao Reviewed-by: AngeloGioacchino Del Regno Link: https://msgid.link/r/20240321070942.1587146-2-fshao@chromium.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-mt65xx.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index faca2ab758992..89ec119215371 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -524,17 +524,19 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *d= ev_id) mdata->xfer_len =3D min(MTK_SPI_MAX_FIFO_SIZE, len); mtk_spi_setup_packet(master); =20 - cnt =3D mdata->xfer_len / 4; - iowrite32_rep(mdata->base + SPI_TX_DATA_REG, - trans->tx_buf + mdata->num_xfered, cnt); + if (trans->tx_buf) { + cnt =3D mdata->xfer_len / 4; + iowrite32_rep(mdata->base + SPI_TX_DATA_REG, + trans->tx_buf + mdata->num_xfered, cnt); =20 - remainder =3D mdata->xfer_len % 4; - if (remainder > 0) { - reg_val =3D 0; - memcpy(®_val, - trans->tx_buf + (cnt * 4) + mdata->num_xfered, - remainder); - writel(reg_val, mdata->base + SPI_TX_DATA_REG); + remainder =3D mdata->xfer_len % 4; + if (remainder > 0) { + reg_val =3D 0; + memcpy(®_val, + trans->tx_buf + (cnt * 4) + mdata->num_xfered, + remainder); + writel(reg_val, mdata->base + SPI_TX_DATA_REG); + } } =20 mtk_spi_enable_transfer(master); --=20 2.43.0 From nobody Fri Dec 19 20:12:01 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CC7E185F0F; Sun, 24 Mar 2024 23:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324383; cv=none; b=gzH/HV6I1Sw0tZMHTZEIQJBQW4Mv6qEwDwqoDd7K9aDPyYU2zGc8EJ56BHuG75i9afBEELQZRgzT9urnJOaslayydRixPhYxTJR2bSC3TIof9of/fEUIQVOB9lJJRHNB8g4gEmKNd9A+9l1sg4k/6UEZeTJDxvSzgE0Pn0NCpHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324383; c=relaxed/simple; bh=YXHz/LDJi9Lq/bWF7mF1aEuybGMh23jcPOzyOV1E314=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ehiZQPi0QCp/r8FdicLRsTQKSq0Q6ERZVNAwGaTtkT6hjlgq/Ju5q1mC22P21BDPOcOKPppkKfEZqCogVhIZBlIZm7fLoSGTRuZf/jq8bWJMxaX2squ2RpW0MUpqqoL/jWiHNkZWo4VZInfFB+SrbgaU+VZf/Hdwv/YZASy9ynA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C6+T3Pw8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C6+T3Pw8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 549ECC43390; Sun, 24 Mar 2024 23:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324382; bh=YXHz/LDJi9Lq/bWF7mF1aEuybGMh23jcPOzyOV1E314=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6+T3Pw8ggEjit/bgK60qzalMe4l6aIuSppLzCJbQ/nuhR8xB0SDE/sTTI+ortAjn H644tU32D93w60wVKdvf4gHK/C1+h3v4HF1l/69l/uEcnk+I5uicft5Yn2f/VZOsxJ ad29iOtZi/oVNuxWjjSo6qqo4sS3lOn6ARjWqVoUpJidgQcol5z1bu/koO6wrlBlOL W7+Z+tBmnZYCQ5C/mkkRrj8stBteZOvQ/jv0RiEg9wwY9o1+XZIH2Bl76F9x/08Kqo YTnETHRCA+UMBhPFFx4uvd/dUvAPMbWV/ourQT1tjM8ErWwDmVrlGuRVt47olDGNPY LBUPHZmLtbpXg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sasha Levin Subject: [PATCH 4.19 148/148] Linux 4.19.311-rc1 Date: Sun, 24 Mar 2024 19:50:12 -0400 Message-ID: <20240324235012.1356413-149-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Sasha Levin --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 96be210bd42b9..ee1f1c3c00e4c 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION =3D 4 PATCHLEVEL =3D 19 -SUBLEVEL =3D 310 -EXTRAVERSION =3D +SUBLEVEL =3D 311 +EXTRAVERSION =3D -rc1 NAME =3D "People's Front" =20 # *DOCUMENTATION* --=20 2.43.0