From: Tadeusz Struk <hidden> Date: 2021-11-11 20:59:46
kmemdup can return a null pointer so need to check for it, otherwise
the null key will be dereferenced later in tipc_crypto_key_xmit as
can be seen in the trace [1].
Cc: Jon Maloy <jmaloy@redhat.com>
Cc: Ying Xue <redacted>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Cc: tipc-discussion@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org # 5.15, 5.14, 5.10
[1] https://syzkaller.appspot.com/bug?id=bca180abb29567b189efdbdb34cbf7ba851c2a58
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Tadeusz Struk <redacted>
---
net/tipc/crypto.c | 5 +++++
1 file changed, 5 insertions(+)
From: Tadeusz Struk <hidden> Date: 2021-11-11 21:00:03
Some functions, like tipc_crypto_start use inconsisten GFP flags
when allocating memory. The mentioned function use GFP_ATOMIC to
to alloc a crypto instance, and then calls alloc_ordered_workqueue()
which allocates memory with GFP_KERNEL. tipc_aead_init() function
even uses GFP_KERNEL and GFP_ATOMIC interchangeably.
No doc comment specifies what context a function is designed to
work in, but the flags should at least be consistent within a function.
Cc: Jon Maloy <jmaloy@redhat.com>
Cc: Ying Xue <redacted>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Cc: tipc-discussion@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tadeusz Struk <redacted>
---
net/tipc/crypto.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Jon Maloy <jmaloy@redhat.com> Date: 2021-11-12 00:04:11
On 11/11/21 15:59, Tadeusz Struk wrote:
quoted hunk
kmemdup can return a null pointer so need to check for it, otherwise
the null key will be dereferenced later in tipc_crypto_key_xmit as
can be seen in the trace [1].
Cc: Jon Maloy <jmaloy@redhat.com>
Cc: Ying Xue <redacted>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Cc: tipc-discussion@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org # 5.15, 5.14, 5.10
[1] https://syzkaller.appspot.com/bug?id=bca180abb29567b189efdbdb34cbf7ba851c2a58
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Tadeusz Struk <redacted>
---
net/tipc/crypto.c | 5 +++++
1 file changed, 5 insertions(+)
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-11-13 04:08:33
On Thu, 11 Nov 2021 12:59:15 -0800 Tadeusz Struk wrote:
kmemdup can return a null pointer so need to check for it, otherwise
the null key will be dereferenced later in tipc_crypto_key_xmit as
can be seen in the trace [1].
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Tadeusz Struk <redacted>
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-11-13 04:13:39
On Thu, 11 Nov 2021 19:06:18 -0500 Jon Maloy wrote:
On 11/11/21 15:59, Tadeusz Struk wrote:
quoted
kmemdup can return a null pointer so need to check for it, otherwise
the null key will be dereferenced later in tipc_crypto_key_xmit as
can be seen in the trace [1].
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller [off-list ref]:
On Thu, 11 Nov 2021 12:59:16 -0800 you wrote:
Some functions, like tipc_crypto_start use inconsisten GFP flags
when allocating memory. The mentioned function use GFP_ATOMIC to
to alloc a crypto instance, and then calls alloc_ordered_workqueue()
which allocates memory with GFP_KERNEL. tipc_aead_init() function
even uses GFP_KERNEL and GFP_ATOMIC interchangeably.
No doc comment specifies what context a function is designed to
work in, but the flags should at least be consistent within a function.
[...]
From: Tadeusz Struk <hidden> Date: 2021-11-16 16:40:57
On 11/15/21 05:00, patchwork-bot+netdevbpf@kernel.org wrote:
This patch was applied to netdev/net.git (master)
by David S. Miller[off-list ref]:
On Thu, 11 Nov 2021 12:59:16 -0800 you wrote:
quoted
Some functions, like tipc_crypto_start use inconsisten GFP flags
when allocating memory. The mentioned function use GFP_ATOMIC to
to alloc a crypto instance, and then calls alloc_ordered_workqueue()
which allocates memory with GFP_KERNEL. tipc_aead_init() function
even uses GFP_KERNEL and GFP_ATOMIC interchangeably.
No doc comment specifies what context a function is designed to
work in, but the flags should at least be consistent within a function.
[...]