From patchwork Sat Oct 31 11:34:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C9CBC388F7 for ; Sat, 31 Oct 2020 11:39:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A3B420731 for ; Sat, 31 Oct 2020 11:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144355; bh=rweIGlG+ZbtlwpDdeVwPAUBqIuux5pYn8QHPnRHFzyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CfoO5lruZVGe3nDODC6Toq5GQVZ+u2j2zf3RNPXcQE+kOYamAFbkhHyfrP7WY/DuR Y1Y9aFQjzJjFc++xzgoJa2UOIb1TBMvNK2tPoNd+2bukv23y5f52qNTg9ZxiEY0Qd5 FRviwgmTAYyW14Gpq3w6xzF4R3xI773dc/a29bAs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727057AbgJaLfl (ORCPT ); Sat, 31 Oct 2020 07:35:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:33448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727052AbgJaLfk (ORCPT ); Sat, 31 Oct 2020 07:35:40 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0EC5220739; Sat, 31 Oct 2020 11:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144139; bh=rweIGlG+ZbtlwpDdeVwPAUBqIuux5pYn8QHPnRHFzyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lY50UJeGMGJ+T2NqRA+xTV33DLw/RaOYSQkzg4aqmmjcu5gEhUEwM9LL1v1t7TVPw esUr6tSDVt80j+ov62Lt1kKo3Fm4cMY7y+bzczvF1BEPm6n+fTqac6IUXYkk1CIpAA 5VdQKkrLlQ+j6ilGY4OoZ5b0ceesk+H8Eqvsg1i8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Eggers , Willem de Bruijn , Deepa Dinamani , Jakub Kicinski Subject: [PATCH 5.4 02/49] socket: dont clear SOCK_TSTAMP_NEW when SO_TIMESTAMPNS is disabled Date: Sat, 31 Oct 2020 12:34:58 +0100 Message-Id: <20201031113455.565850615@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian Eggers commit 4e3bbb33e6f36e4b05be1b1b9b02e3dd5aaa3e69 upstream. SOCK_TSTAMP_NEW (timespec64 instead of timespec) is also used for hardware time stamps (configured via SO_TIMESTAMPING_NEW). User space (ptp4l) first configures hardware time stamping via SO_TIMESTAMPING_NEW which sets SOCK_TSTAMP_NEW. In the next step, ptp4l disables SO_TIMESTAMPNS(_NEW) (software time stamps), but this must not switch hardware time stamps back to "32 bit mode". This problem happens on 32 bit platforms were the libc has already switched to struct timespec64 (from SO_TIMExxx_OLD to SO_TIMExxx_NEW socket options). ptp4l complains with "missing timestamp on transmitted peer delay request" because the wrong format is received (and discarded). Fixes: 887feae36aee ("socket: Add SO_TIMESTAMP[NS]_NEW") Fixes: 783da70e8396 ("net: add sock_enable_timestamps") Signed-off-by: Christian Eggers Acked-by: Willem de Bruijn Acked-by: Deepa Dinamani Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/sock.c | 1 - 1 file changed, 1 deletion(-) --- a/net/core/sock.c +++ b/net/core/sock.c @@ -923,7 +923,6 @@ set_rcvbuf: } else { sock_reset_flag(sk, SOCK_RCVTSTAMP); sock_reset_flag(sk, SOCK_RCVTSTAMPNS); - sock_reset_flag(sk, SOCK_TSTAMP_NEW); } break; From patchwork Sat Oct 31 11:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2139C388F7 for ; Sat, 31 Oct 2020 11:39:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6EF7C20731 for ; Sat, 31 Oct 2020 11:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144346; bh=Fc5d6HqYu1fwZuvx7GQkTaMz4kjMw5wdzWjqvAXE6nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0tpYwmUy089UsxgMRlLB5eb8MvN8awhzycz6QgZ/glF1+fBvvsj2/LBPAj+2abbW/ TNd3+sUqVZW5SWd6u+9/ZvmJZ5tESCn2N+J6YngheKkBJ1IcC+ft+6YfvoTPBEnGbK hGlAmtTIZwfoN3qCnIGvFH5Korcqma3xplO6EstA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727052AbgJaLiy (ORCPT ); Sat, 31 Oct 2020 07:38:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:33792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727118AbgJaLf4 (ORCPT ); Sat, 31 Oct 2020 07:35:56 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 341072074F; Sat, 31 Oct 2020 11:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144154; bh=Fc5d6HqYu1fwZuvx7GQkTaMz4kjMw5wdzWjqvAXE6nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ba9nYFkBlb8zxeHUYowgqInlfaDMRZQrSMVyTAKUJ/P4ewFvh41RSg51kj/Tl1Xbj Pc3xYRke7DhRMfGFWMgU+1EwfUNKaf0bZFgEadM8p9hzRhefIRoApDsh4JzKeaQZoy 4dDzpQUM/eU+XZ9z66UzX475XXjtfKcxZSH045XI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Golovin , Josh Poimboeuf , Borislav Petkov , Nathan Chancellor , Miroslav Benes , "Peter Zijlstra (Intel)" , Nick Desaulniers Subject: [PATCH 5.4 03/49] objtool: Support Clang non-section symbols in ORC generation Date: Sat, 31 Oct 2020 12:34:59 +0100 Message-Id: <20201031113455.615829187@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Josh Poimboeuf commit e81e0724432542af8d8c702c31e9d82f57b1ff31 upstream. When compiling the kernel with AS=clang, objtool produces a lot of warnings: warning: objtool: missing symbol for section .text warning: objtool: missing symbol for section .init.text warning: objtool: missing symbol for section .ref.text It then fails to generate the ORC table. The problem is that objtool assumes text section symbols always exist. But the Clang assembler is aggressive about removing them. When generating relocations for the ORC table, objtool always tries to reference instructions by their section symbol offset. If the section symbol doesn't exist, it bails. Do a fallback: when a section symbol isn't available, reference a function symbol instead. Reported-by: Dmitry Golovin Signed-off-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Tested-by: Nathan Chancellor Reviewed-by: Miroslav Benes Acked-by: Peter Zijlstra (Intel) Link: https://github.com/ClangBuiltLinux/linux/issues/669 Link: https://lkml.kernel.org/r/9a9cae7fcf628843aabe5a086b1a3c5bf50f42e8.1585761021.git.jpoimboe@redhat.com Cc: Nick Desaulniers Signed-off-by: Greg Kroah-Hartman --- tools/objtool/orc_gen.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) --- a/tools/objtool/orc_gen.c +++ b/tools/objtool/orc_gen.c @@ -88,11 +88,6 @@ static int create_orc_entry(struct secti struct orc_entry *orc; struct rela *rela; - if (!insn_sec->sym) { - WARN("missing symbol for section %s", insn_sec->name); - return -1; - } - /* populate ORC data */ orc = (struct orc_entry *)u_sec->data->d_buf + idx; memcpy(orc, o, sizeof(*orc)); @@ -105,8 +100,32 @@ static int create_orc_entry(struct secti } memset(rela, 0, sizeof(*rela)); - rela->sym = insn_sec->sym; - rela->addend = insn_off; + if (insn_sec->sym) { + rela->sym = insn_sec->sym; + rela->addend = insn_off; + } else { + /* + * The Clang assembler doesn't produce section symbols, so we + * have to reference the function symbol instead: + */ + rela->sym = find_symbol_containing(insn_sec, insn_off); + if (!rela->sym) { + /* + * Hack alert. This happens when we need to reference + * the NOP pad insn immediately after the function. + */ + rela->sym = find_symbol_containing(insn_sec, + insn_off - 1); + } + if (!rela->sym) { + WARN("missing symbol for insn at offset 0x%lx\n", + insn_off); + return -1; + } + + rela->addend = insn_off - rela->sym->offset; + } + rela->type = R_X86_64_PC32; rela->offset = idx * sizeof(int); From patchwork Sat Oct 31 11:35:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 383D2C388F9 for ; Sat, 31 Oct 2020 11:38:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3B4320731 for ; Sat, 31 Oct 2020 11:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144324; bh=NYE5j1Z3BSi1jVFY5WUzr0792wkNuSZhgzk6hR+tAlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ShfMQcR5xhP4P4DcpH/cLjtxt3o86KI/pTkZnbLKUrnrroEnKRm6frypCUm9g0Vyw sxEZsVCMhhySEDBK3OLGxIdNYMINCLf0b08k/v36d6EK1hNy71vy8+4mRDudIbZltf e8K6MEuXCT+SmZXqNMzrbNZHDz8dy+PVWH5zkFD8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbgJaLim (ORCPT ); Sat, 31 Oct 2020 07:38:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:33916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbgJaLgD (ORCPT ); Sat, 31 Oct 2020 07:36:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE0A420853; Sat, 31 Oct 2020 11:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144162; bh=NYE5j1Z3BSi1jVFY5WUzr0792wkNuSZhgzk6hR+tAlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zR1IanhGd3siiBnYle+TuQevMCtS8RsOvTdFTCLOQAI1v84D4Q0Y3iTIyulC9LByk +y/8+QAHcwHPoSHuSTc2FUgbnoKZUhoe6MDsWaBqW8sWoo+/hNW4rpA6OMXox+fWxf q6HTuP0q9bkZRSd6wAq2hiwQZ8iJP0W891+pQpII= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suzuki K Poulose , Marc Zyngier , Will Deacon Subject: [PATCH 5.4 06/49] arm64: Run ARCH_WORKAROUND_2 enabling code on all CPUs Date: Sat, 31 Oct 2020 12:35:02 +0100 Message-Id: <20201031113455.758690185@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier commit 39533e12063be7f55e3d6ae21ffe067799d542a4 upstream. Commit 606f8e7b27bf ("arm64: capabilities: Use linear array for detection and verification") changed the way we deal with per-CPU errata by only calling the .matches() callback until one CPU is found to be affected. At this point, .matches() stop being called, and .cpu_enable() will be called on all CPUs. This breaks the ARCH_WORKAROUND_2 handling, as only a single CPU will be mitigated. In order to address this, forcefully call the .matches() callback from a .cpu_enable() callback, which brings us back to the original behaviour. Fixes: 606f8e7b27bf ("arm64: capabilities: Use linear array for detection and verification") Cc: Reviewed-by: Suzuki K Poulose Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpu_errata.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -492,6 +492,12 @@ out_printmsg: return required; } +static void cpu_enable_ssbd_mitigation(const struct arm64_cpu_capabilities *cap) +{ + if (ssbd_state != ARM64_SSBD_FORCE_DISABLE) + cap->matches(cap, SCOPE_LOCAL_CPU); +} + /* known invulnerable cores */ static const struct midr_range arm64_ssb_cpus[] = { MIDR_ALL_VERSIONS(MIDR_CORTEX_A35), @@ -918,6 +924,7 @@ const struct arm64_cpu_capabilities arm6 .capability = ARM64_SSBD, .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, .matches = has_ssbd_mitigation, + .cpu_enable = cpu_enable_ssbd_mitigation, .midr_range_list = arm64_ssb_cpus, }, #ifdef CONFIG_ARM64_ERRATUM_1418040 From patchwork Sat Oct 31 11:35:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 320054 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp2186337ilc; Sat, 31 Oct 2020 04:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrn20fLXNIZG2PLLq6MaHPfeiU6XIlorsaZHHcSwYkOBjMoDU+AEr1pvszSf7vaHyLRKDh X-Received: by 2002:a17:906:512:: with SMTP id j18mr6991186eja.370.1604144321082; Sat, 31 Oct 2020 04:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604144321; cv=none; d=google.com; s=arc-20160816; b=GvF1xY3VgFSxEidJmlGL56DOdlOYbvtik7LVMhllgvF7cnQ1CM05jhfh4iLQW4wGCT xDo54g2NfJ3pimOjX03luJVKMIVIAcOQ5BUty8RYnLGYNZcv+KDMU/8XH/7L1VBucN/z UhwinQ3fBST/JEceFpoko53OS+VHwt78KfGgmaeGSwgkgMcv9l4I+FIQ/rmv5V39V4mh QrqbLyN7JWbwQdJij3443NkKuTP4ko4UJ4fnju6sTySxhT2+PwOUB/6aPdv/R5aqRjJJ 0SbrcZ6RdYnXIDQiTomWwBCIVMUqH+DX5sNeQ0tZXAoCpJDJIBt1/2+JNJ83zxjxLBN4 4TfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jXYoQ8mnWDfwHyIYRtmfO6A6Md+NSi5qzIMIt/pdlAg=; b=TB1549TDXtr5OpuYgrz26uBQS29LB8WElY0TlEkNiL9DkXabFGcfGhv+djCVQsLN6L ZGX91yi/FVfnCSO9DYEF2vDjFLjO1NWAzLMKXh7biJTQNSy2LVNbrqg2ZHukZn++qaFo RoQPTaWrrzusObM7wZABNnjUNT9v9pAIWo++z0/D9Yk/pgvn3V5ITIHTMDUAIr8bjH4M PoPkqMz/vGEHALwyr+a+nI/8ZyyO3IV2xzp0xagMV7gKLCGc1vI5EDJt0Uis2IRIO5Eq Pge3EqABY2/QKhADvZ0OrCnrccrZ2E2FwhVTlNh8AyHxg1o9zgRq2X2b5/NEO9bECqrr /gIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YTD5e57v; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si369608edi.177.2020.10.31.04.38.40; Sat, 31 Oct 2020 04:38:41 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YTD5e57v; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727100AbgJaLid (ORCPT + 15 others); Sat, 31 Oct 2020 07:38:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:33952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbgJaLgF (ORCPT ); Sat, 31 Oct 2020 07:36:05 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9FC552087D; Sat, 31 Oct 2020 11:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144165; bh=dAckfZUvuQTzjuGDQr/NoLlGwNVuu2+sA3yLjksJmoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTD5e57vWul6tz2SgKOTKK2I22Q7f0+rQEDg+HUnUe8ITwavadZVZGR2uaW6bj5+p ZDBkYGjgM3NN6R8/igtZ7R+Xoi90PlqRKpcZWZoJ9nv+KbpwKYJeZtshBLW4/EgEfA yZXjKqS7Q5Nr8WHqiirdiAGglRQgfSRIH3FSuxL0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Will Deacon Subject: [PATCH 5.4 07/49] arm64: link with -z norelro regardless of CONFIG_RELOCATABLE Date: Sat, 31 Oct 2020 12:35:03 +0100 Message-Id: <20201031113455.801329619@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nick Desaulniers commit 3b92fa7485eba16b05166fddf38ab42f2ff6ab95 upstream. With CONFIG_EXPERT=y, CONFIG_KASAN=y, CONFIG_RANDOMIZE_BASE=n, CONFIG_RELOCATABLE=n, we observe the following failure when trying to link the kernel image with LD=ld.lld: error: section: .exit.data is not contiguous with other relro sections ld.lld defaults to -z relro while ld.bfd defaults to -z norelro. This was previously fixed, but only for CONFIG_RELOCATABLE=y. Fixes: 3bbd3db86470 ("arm64: relocatable: fix inconsistencies in linker script and options") Signed-off-by: Nick Desaulniers Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20201016175339.2429280-1-ndesaulniers@google.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -10,7 +10,7 @@ # # Copyright (C) 1995-2001 by Russell King -LDFLAGS_vmlinux :=--no-undefined -X +LDFLAGS_vmlinux :=--no-undefined -X -z norelro CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) GZFLAGS :=-9 @@ -18,7 +18,7 @@ ifeq ($(CONFIG_RELOCATABLE), y) # Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour # for relative relocs, since this leads to better Image compression # with the relocation offsets always being zero. -LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro \ +LDFLAGS_vmlinux += -shared -Bsymbolic -z notext \ $(call ld-option, --no-apply-dynamic-relocs) endif From patchwork Sat Oct 31 11:35:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 430D4C388F9 for ; Sat, 31 Oct 2020 11:38:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07CD820731 for ; Sat, 31 Oct 2020 11:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144314; bh=ETpU0BXfRtZxD2EQRg6oathVavk99g4z1nxhq8Anb7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qfIsa9/VUjYq97nbmIEj59FByr/yXzSp6s7jJhNtDLwn6SBn1rkAht9Z/J6QY1YSb nb3+sYI2xlDoHjxVHbE3sEJPZqbTPPSFdBtIkR499zRU1/MalI+lSJ1FQYtLsrxGGj /imNqI230z49VHT2Ezd9fbOKzyAgOhNBXy9q+4Qo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727086AbgJaLid (ORCPT ); Sat, 31 Oct 2020 07:38:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbgJaLgI (ORCPT ); Sat, 31 Oct 2020 07:36:08 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2638B20739; Sat, 31 Oct 2020 11:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144167; bh=ETpU0BXfRtZxD2EQRg6oathVavk99g4z1nxhq8Anb7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YbekUnRRs+bAZ4OZ7onNLf7MEhZ3389rAe4czctEN1vHzNev2DzaVFNwJOT5bWEo1 Y2P44fKEyoGFIY7wfozfQCYfPz4/ZdXv8UCvmN95RjQZ1GZUZ/mTqTGhDvKUsl9SQC rS/7RpACilkAenBLV4JLzhLDsHecbhft+jJOSbM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Bjorn Helgaas , Andy Shevchenko , Jesse Barnes , Thomas Gleixner , Jacob Pan , Len Brown , Arjan van de Ven Subject: [PATCH 5.4 08/49] x86/PCI: Fix intel_mid_pci.c build error when ACPI is not enabled Date: Sat, 31 Oct 2020 12:35:04 +0100 Message-Id: <20201031113455.847749218@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Randy Dunlap commit 035fff1f7aab43e420e0098f0854470a5286fb83 upstream. Fix build error when CONFIG_ACPI is not set/enabled by adding the header file which contains a stub for the function in the build error. ../arch/x86/pci/intel_mid_pci.c: In function ‘intel_mid_pci_init’: ../arch/x86/pci/intel_mid_pci.c:303:2: error: implicit declaration of function ‘acpi_noirq_set’; did you mean ‘acpi_irq_get’? [-Werror=implicit-function-declaration] acpi_noirq_set(); Fixes: a912a7584ec3 ("x86/platform/intel-mid: Move PCI initialization to arch_init()") Link: https://lore.kernel.org/r/ea903917-e51b-4cc9-2680-bc1e36efa026@infradead.org Signed-off-by: Randy Dunlap Signed-off-by: Bjorn Helgaas Reviewed-by: Andy Shevchenko Reviewed-by: Jesse Barnes Acked-by: Thomas Gleixner Cc: stable@vger.kernel.org # v4.16+ Cc: Jacob Pan Cc: Len Brown Cc: Jesse Barnes Cc: Arjan van de Ven Signed-off-by: Greg Kroah-Hartman --- arch/x86/pci/intel_mid_pci.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/pci/intel_mid_pci.c +++ b/arch/x86/pci/intel_mid_pci.c @@ -33,6 +33,7 @@ #include #include #include +#include #define PCIE_CAP_OFFSET 0x100 From patchwork Sat Oct 31 11:35:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317436 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03121C388F9 for ; Sat, 31 Oct 2020 11:35:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0B6920791 for ; Sat, 31 Oct 2020 11:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144122; bh=HgU7niy+267yUMM8AzmdA2zEi95wlPSbB0d5YyXXaKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=U1LiLxx/TQpeqv9k+aB+rBFeotAjdHZHr4b+6Bf6thVT5LWNhbOoVz6cuBCt5+4BC 5cc3T18SYFfIJgweHex2tvJx2MhjnyrIa+1J1SbkEdqIn+09+oiCEUaR032OskCqeQ dcr8+7G/9ZEisHoHBaVUK4mAruHFIChLYQjmV4yQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726815AbgJaLfR (ORCPT ); Sat, 31 Oct 2020 07:35:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:33012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbgJaLfQ (ORCPT ); Sat, 31 Oct 2020 07:35:16 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C10DF20739; Sat, 31 Oct 2020 11:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144115; bh=HgU7niy+267yUMM8AzmdA2zEi95wlPSbB0d5YyXXaKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lIbyWBw8c0r8LRfqEZMlN3jMKNBN9WTuNjkH5roLASUhPM5Nw7cuhtaeZ05lCmbhW HPX6dR080EdLa4CcctOyU8DLdED3x8ChP2BALEWmdPipMdNx/7Tk+8eXwNoLdoCppu FRl5Ee1wR/PDhWbrwVpZW9ysj1BzhS+bCmPqlQFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Edwin Peer , Vasundhara Volam , Michael Chan , Jakub Kicinski Subject: [PATCH 5.4 11/49] bnxt_en: Send HWRM_FUNC_RESET fw command unconditionally. Date: Sat, 31 Oct 2020 12:35:07 +0100 Message-Id: <20201031113455.990845878@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vasundhara Volam [ Upstream commit 825741b071722f1c8ad692cead562c4b5f5eaa93 ] In the AER or firmware reset flow, if we are in fatal error state or if pci_channel_offline() is true, we don't send any commands to the firmware because the commands will likely not reach the firmware and most commands don't matter much because the firmware is likely to be reset imminently. However, the HWRM_FUNC_RESET command is different and we should always attempt to send it. In the AER flow for example, the .slot_reset() call will trigger this fw command and we need to try to send it to effect the proper reset. Fixes: b340dc680ed4 ("bnxt_en: Avoid sending firmware messages when AER error is detected.") Reviewed-by: Edwin Peer Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4204,7 +4204,8 @@ static int bnxt_hwrm_do_send_msg(struct u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM; u16 dst = BNXT_HWRM_CHNL_CHIMP; - if (BNXT_NO_FW_ACCESS(bp)) + if (BNXT_NO_FW_ACCESS(bp) && + le16_to_cpu(req->req_type) != HWRM_FUNC_RESET) return -EBUSY; if (msg_len > BNXT_HWRM_MAX_REQ_LEN) { From patchwork Sat Oct 31 11:35:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47237C388F9 for ; Sat, 31 Oct 2020 11:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EF9C20791 for ; Sat, 31 Oct 2020 11:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144127; bh=lk+aom44p1s80bW5o2VH/1ICaQna5Tu+MlPWunGiXbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uOUBoNeKsoQ9TiLw9Coe6Qx1zdBI6EbLQrdKs2hIf1UeDsievDEBsgO7MRCHZDz9k nRiHfZu4hEWWpkVHRggHY1SoPpXt7Eor2wq7hyCLJ89rIgJx+6V7D4LuBUGSE2QByQ OpQaObPl06oR2BB8L2WsTkuwO2pwA9qytnnTs8bI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726977AbgJaLfY (ORCPT ); Sat, 31 Oct 2020 07:35:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:33118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726997AbgJaLfW (ORCPT ); Sat, 31 Oct 2020 07:35:22 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3CA9820739; Sat, 31 Oct 2020 11:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144121; bh=lk+aom44p1s80bW5o2VH/1ICaQna5Tu+MlPWunGiXbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XeCkvTmC1znmukIgoiZzzaMmZQ9UWV1PAeLt7qOq1iPjfqMgejwSWmqqbSxeALEue 7Gc6qbrmFOS08U3NH+VFPEk9id+1cS+Oi9m126iIRaKuvYrYUKxEA8+Jfg7XX8DiBY Kwpybb/ZYtEbvS5n6fiXrt5psWP8EVOLnTXDN8HM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vinay Kumar Yadav , Jakub Kicinski Subject: [PATCH 5.4 13/49] chelsio/chtls: fix memory leaks in CPL handlers Date: Sat, 31 Oct 2020 12:35:09 +0100 Message-Id: <20201031113456.089186499@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vinay Kumar Yadav [ Upstream commit 6daa1da4e262b0cd52ef0acc1989ff22b5540264 ] CPL handler functions chtls_pass_open_rpl() and chtls_close_listsrv_rpl() should return CPL_RET_BUF_DONE so that caller function will do skb free to avoid leak. Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition") Signed-off-by: Vinay Kumar Yadav Link: https://lore.kernel.org/r/20201025194228.31271-1-vinay.yadav@chelsio.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_cm.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -692,14 +692,13 @@ static int chtls_pass_open_rpl(struct ch if (rpl->status != CPL_ERR_NONE) { pr_info("Unexpected PASS_OPEN_RPL status %u for STID %u\n", rpl->status, stid); - return CPL_RET_BUF_DONE; + } else { + cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family); + sock_put(listen_ctx->lsk); + kfree(listen_ctx); + module_put(THIS_MODULE); } - cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family); - sock_put(listen_ctx->lsk); - kfree(listen_ctx); - module_put(THIS_MODULE); - - return 0; + return CPL_RET_BUF_DONE; } static int chtls_close_listsrv_rpl(struct chtls_dev *cdev, struct sk_buff *skb) @@ -716,15 +715,13 @@ static int chtls_close_listsrv_rpl(struc if (rpl->status != CPL_ERR_NONE) { pr_info("Unexpected CLOSE_LISTSRV_RPL status %u for STID %u\n", rpl->status, stid); - return CPL_RET_BUF_DONE; + } else { + cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family); + sock_put(listen_ctx->lsk); + kfree(listen_ctx); + module_put(THIS_MODULE); } - - cxgb4_free_stid(cdev->tids, stid, listen_ctx->lsk->sk_family); - sock_put(listen_ctx->lsk); - kfree(listen_ctx); - module_put(THIS_MODULE); - - return 0; + return CPL_RET_BUF_DONE; } static void chtls_purge_wr_queue(struct sock *sk) From patchwork Sat Oct 31 11:35:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5569CC4742C for ; Sat, 31 Oct 2020 11:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A6C020739 for ; Sat, 31 Oct 2020 11:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144369; bh=xwM64GQzTCAI0uFNMIB8AGN4Z0EtKBRMvZIDNQA4AHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VioID+yhx88nlOlfFUgmImWFGACW2oRPEf5kTqR8bV6Dq4o68io6Pd3rlc2sLuA96 ihZ7gIwfz36nHsy4TWSXus8j+HaFfdKI32FP3kpIQntkVhbmqRASrVQS2olzPsfHSu HnY1KbNinlXqNyZYUzNKOkNyEUrPDkJ2suywJE2o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbgJaLfb (ORCPT ); Sat, 31 Oct 2020 07:35:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:33286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727022AbgJaLfa (ORCPT ); Sat, 31 Oct 2020 07:35:30 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E256120739; Sat, 31 Oct 2020 11:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144129; bh=xwM64GQzTCAI0uFNMIB8AGN4Z0EtKBRMvZIDNQA4AHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kboD9l4EHxum62TskhyAHy9HqvJeG4VWQV5bB9JndAb3lF49Y9A21NpjOZKB9cqNs y9W7uYOpcXahMUZFPm7qgksCTpgrf/HYknONW9blC5hVQ/dXvLsW9dPD2vX8oWxKgI mWsYaY0T1SA1uprGrBGnoP/TxM0YZ4lPBHrIRZBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Fujiwara , Jakub Kicinski Subject: [PATCH 5.4 16/49] gtp: fix an use-before-init in gtp_newlink() Date: Sat, 31 Oct 2020 12:35:12 +0100 Message-Id: <20201031113456.231051332@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Fujiwara [ Upstream commit 51467431200b91682b89d31317e35dcbca1469ce ] *_pdp_find() from gtp_encap_recv() would trigger a crash when a peer sends GTP packets while creating new GTP device. RIP: 0010:gtp1_pdp_find.isra.0+0x68/0x90 [gtp] Call Trace: gtp_encap_recv+0xc2/0x2e0 [gtp] ? gtp1_pdp_find.isra.0+0x90/0x90 [gtp] udp_queue_rcv_one_skb+0x1fe/0x530 udp_queue_rcv_skb+0x40/0x1b0 udp_unicast_rcv_skb.isra.0+0x78/0x90 __udp4_lib_rcv+0x5af/0xc70 udp_rcv+0x1a/0x20 ip_protocol_deliver_rcu+0xc5/0x1b0 ip_local_deliver_finish+0x48/0x50 ip_local_deliver+0xe5/0xf0 ? ip_protocol_deliver_rcu+0x1b0/0x1b0 gtp_encap_enable() should be called after gtp_hastable_new() otherwise *_pdp_find() will access the uninitialized hash table. Fixes: 1e3a3abd8b28 ("gtp: make GTP sockets in gtp_newlink optional") Signed-off-by: Masahiro Fujiwara Link: https://lore.kernel.org/r/20201027114846.3924-1-fujiwara.masahiro@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/gtp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -663,10 +663,6 @@ static int gtp_newlink(struct net *src_n gtp = netdev_priv(dev); - err = gtp_encap_enable(gtp, data); - if (err < 0) - return err; - if (!data[IFLA_GTP_PDP_HASHSIZE]) { hashsize = 1024; } else { @@ -677,12 +673,16 @@ static int gtp_newlink(struct net *src_n err = gtp_hashtable_new(gtp, hashsize); if (err < 0) - goto out_encap; + return err; + + err = gtp_encap_enable(gtp, data); + if (err < 0) + goto out_hashtable; err = register_netdevice(dev); if (err < 0) { netdev_dbg(dev, "failed to register new netdev %d\n", err); - goto out_hashtable; + goto out_encap; } gn = net_generic(dev_net(dev), gtp_net_id); @@ -693,11 +693,11 @@ static int gtp_newlink(struct net *src_n return 0; +out_encap: + gtp_encap_disable(gtp); out_hashtable: kfree(gtp->addr_hash); kfree(gtp->tid_hash); -out_encap: - gtp_encap_disable(gtp); return err; } From patchwork Sat Oct 31 11:35:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C63F1C4742C for ; Sat, 31 Oct 2020 11:35:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84E8120791 for ; Sat, 31 Oct 2020 11:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144140; bh=QHwXpG47XfDbtamJzkp8qGbSqk72OGM8Sm0HWrGPTW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DupkbOVKpWZcdiO5Dd0w8ZMhsHf3aXU+teJy3daGWS6TpXXU0P6mAAeVPVaNThrTF Z1A40q/JyxyPlaKEAV/ZT6uLJkaN/beLOgf6yfyDr4dOIPiMYMKQBTF8M5lQXW96Oe J3vEpf3LJDG/3G3jAG/djispuLIO0bbuO1V7f1Hs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbgJaLfj (ORCPT ); Sat, 31 Oct 2020 07:35:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:33362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727039AbgJaLfe (ORCPT ); Sat, 31 Oct 2020 07:35:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3DC9620739; Sat, 31 Oct 2020 11:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144131; bh=QHwXpG47XfDbtamJzkp8qGbSqk72OGM8Sm0HWrGPTW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yaRxLYgLVHUN8jxiLSXXPn5fdnWO/3DZmO3PxO4egSQLQXEVGxUuiROOj222p2hbB awW9aW08oLjed7+FxKYUPlqIW6GG0x0BFm5dVz5cUoTRLv3EGzWjHodOeGQro8DxuR 1izCkaSvXNKntH1nB+C35oXqe4+zDXGs73Xi/ypE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lijun Pan , Jakub Kicinski Subject: [PATCH 5.4 17/49] ibmvnic: fix ibmvnic_set_mac Date: Sat, 31 Oct 2020 12:35:13 +0100 Message-Id: <20201031113456.279111953@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lijun Pan [ Upstream commit 8fc3672a8ad3e782bac80e979bc2a2c10960cbe9 ] Jakub Kicinski brought up a concern in ibmvnic_set_mac(). ibmvnic_set_mac() does this: ether_addr_copy(adapter->mac_addr, addr->sa_data); if (adapter->state != VNIC_PROBED) rc = __ibmvnic_set_mac(netdev, addr->sa_data); So if state == VNIC_PROBED, the user can assign an invalid address to adapter->mac_addr, and ibmvnic_set_mac() will still return 0. The fix is to validate ethernet address at the beginning of ibmvnic_set_mac(), and move the ether_addr_copy to the case of "adapter->state != VNIC_PROBED". Fixes: c26eba03e407 ("ibmvnic: Update reset infrastructure to support tunable parameters") Signed-off-by: Lijun Pan Link: https://lore.kernel.org/r/20201027220456.71450-1-ljp@linux.ibm.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1735,9 +1735,13 @@ static int ibmvnic_set_mac(struct net_de int rc; rc = 0; - ether_addr_copy(adapter->mac_addr, addr->sa_data); - if (adapter->state != VNIC_PROBED) + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + + if (adapter->state != VNIC_PROBED) { + ether_addr_copy(adapter->mac_addr, addr->sa_data); rc = __ibmvnic_set_mac(netdev, addr->sa_data); + } return rc; } From patchwork Sat Oct 31 11:35:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 946DFC388F9 for ; Sat, 31 Oct 2020 11:39:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65D6C20731 for ; Sat, 31 Oct 2020 11:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144364; bh=vfy2sWIyXsStIzgal4RoOaUGPPRHIy+IWfKZyaltyRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wON6IXb8uGS7U0kjpt3TyG1mWDdSSqNW2gIijlaISBUDCHrsG/81fkKOZoWv3R6Qj SWsgwydlm4yxnb87Vs6OL3DHlpnuEQzGFirh35flvqzrRuHmSXtrY/ugSk8m1K0zBP c6EA/MKFCUC5vD0oLSjYKi5Hxe+tBk9RU8/Jbfe4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727041AbgJaLjT (ORCPT ); Sat, 31 Oct 2020 07:39:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:33410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727020AbgJaLfh (ORCPT ); Sat, 31 Oct 2020 07:35:37 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 613C120791; Sat, 31 Oct 2020 11:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144137; bh=vfy2sWIyXsStIzgal4RoOaUGPPRHIy+IWfKZyaltyRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npQwueOlh23US+1SkFRhwsOfPvBorbZnSuimQ2ipmu/ITuBNqW5n/cKYXt0DyILlj IqrM1Ohg+/LF8zDn6MYp5Ao44mz3N//JNtnLzMu95I/5EBXrZMYz3126+Ew1JYZopO xX0MKolkgsskFZjl2nYiKCdswMjhIGNk3Mckx+8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksandr Nogikh , syzbot+ec762a6342ad0d3c0d8f@syzkaller.appspotmail.com, Stephen Hemminger , Jakub Kicinski Subject: [PATCH 5.4 19/49] netem: fix zero division in tabledist Date: Sat, 31 Oct 2020 12:35:15 +0100 Message-Id: <20201031113456.373604861@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Aleksandr Nogikh [ Upstream commit eadd1befdd778a1eca57fad058782bd22b4db804 ] Currently it is possible to craft a special netlink RTM_NEWQDISC command that can result in jitter being equal to 0x80000000. It is enough to set the 32 bit jitter to 0x02000000 (it will later be multiplied by 2^6) or just set the 64 bit jitter via TCA_NETEM_JITTER64. This causes an overflow during the generation of uniformly distributed numbers in tabledist(), which in turn leads to division by zero (sigma != 0, but sigma * 2 is 0). The related fragment of code needs 32-bit division - see commit 9b0ed89 ("netem: remove unnecessary 64 bit modulus"), so switching to 64 bit is not an option. Fix the issue by keeping the value of jitter within the range that can be adequately handled by tabledist() - [0;INT_MAX]. As negative std deviation makes no sense, take the absolute value of the passed value and cap it at INT_MAX. Inside tabledist(), switch to unsigned 32 bit arithmetic in order to prevent overflows. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Aleksandr Nogikh Reported-by: syzbot+ec762a6342ad0d3c0d8f@syzkaller.appspotmail.com Acked-by: Stephen Hemminger Link: https://lore.kernel.org/r/20201028170731.1383332-1-aleksandrnogikh@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_netem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -330,7 +330,7 @@ static s64 tabledist(s64 mu, s32 sigma, /* default uniform distribution */ if (dist == NULL) - return ((rnd % (2 * sigma)) + mu) - sigma; + return ((rnd % (2 * (u32)sigma)) + mu) - sigma; t = dist->table[rnd % dist->size]; x = (sigma % NETEM_DIST_SCALE) * t; @@ -812,6 +812,10 @@ static void get_slot(struct netem_sched_ q->slot_config.max_packets = INT_MAX; if (q->slot_config.max_bytes == 0) q->slot_config.max_bytes = INT_MAX; + + /* capping dist_jitter to the range acceptable by tabledist() */ + q->slot_config.dist_jitter = min_t(__s64, INT_MAX, abs(q->slot_config.dist_jitter)); + q->slot.packets_left = q->slot_config.max_packets; q->slot.bytes_left = q->slot_config.max_bytes; if (q->slot_config.min_delay | q->slot_config.max_delay | @@ -1037,6 +1041,9 @@ static int netem_change(struct Qdisc *sc if (tb[TCA_NETEM_SLOT]) get_slot(q, tb[TCA_NETEM_SLOT]); + /* capping jitter to the range acceptable by tabledist() */ + q->jitter = min_t(s64, abs(q->jitter), INT_MAX); + return ret; get_table_failure: From patchwork Sat Oct 31 11:35:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC8BBC388F7 for ; Sat, 31 Oct 2020 11:36:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 770462087D for ; Sat, 31 Oct 2020 11:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144160; bh=24Z/K7X6dVToT0UoNvTTvqd2i60MODxc6HAE700638E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HVvokt4zTyARlUSRpmwnO2HscsnSJeukukpJiieA2EnmSrRpglGHIbvjcS4PZnfiT 0htkvwEUjHXpf7Z/1hwF0xOBYfwuIjBH3vCryykBNmCSN3RE6rXlMa3GKLrdd1VsHs Llb9aYIiwvchw+qYQI7TJec4tS2BShkn92LQAT3M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbgJaLfz (ORCPT ); Sat, 31 Oct 2020 07:35:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:33662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbgJaLfv (ORCPT ); Sat, 31 Oct 2020 07:35:51 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5395A20739; Sat, 31 Oct 2020 11:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144149; bh=24Z/K7X6dVToT0UoNvTTvqd2i60MODxc6HAE700638E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MtXYl1r/yydOPFjVXw0bosvb3uwbEdREnKVbSLAuM9tBwaANx0U5vEKaG/e/YC3Qa dXV50UFNL3FnOAfCJLnSsHm50q4qn7FqXvhQzatfXSCTivoJTADn0doYxTznse0rho rG145eY2X79kCx4wihr/HzwkUZZ8udo9BCVmO+so= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arjun Roy , Soheil Hassas Yeganeh , Neal Cardwell , Eric Dumazet , Jakub Kicinski Subject: [PATCH 5.4 23/49] tcp: Prevent low rmem stalls with SO_RCVLOWAT. Date: Sat, 31 Oct 2020 12:35:19 +0100 Message-Id: <20201031113456.564495411@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arjun Roy [ Upstream commit 435ccfa894e35e3d4a1799e6ac030e48a7b69ef5 ] With SO_RCVLOWAT, under memory pressure, it is possible to enter a state where: 1. We have not received enough bytes to satisfy SO_RCVLOWAT. 2. We have not entered buffer pressure (see tcp_rmem_pressure()). 3. But, we do not have enough buffer space to accept more packets. In this case, we advertise 0 rwnd (due to #3) but the application does not drain the receive queue (no wakeup because of #1 and #2) so the flow stalls. Modify the heuristic for SO_RCVLOWAT so that, if we are advertising rwnd<=rcv_mss, force a wakeup to prevent a stall. Without this patch, setting tcp_rmem to 6143 and disabling TCP autotune causes a stalled flow. With this patch, no stall occurs. This is with RPC-style traffic with large messages. Fixes: 03f45c883c6f ("tcp: avoid extra wakeups for SO_RCVLOWAT users") Signed-off-by: Arjun Roy Acked-by: Soheil Hassas Yeganeh Acked-by: Neal Cardwell Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20201023184709.217614-1-arjunroy.kdev@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp.c | 2 ++ net/ipv4/tcp_input.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -484,6 +484,8 @@ static inline bool tcp_stream_is_readabl return true; if (tcp_rmem_pressure(sk)) return true; + if (tcp_receive_window(tp) <= inet_csk(sk)->icsk_ack.rcv_mss) + return true; } if (sk->sk_prot->stream_memory_read) return sk->sk_prot->stream_memory_read(sk); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4774,7 +4774,8 @@ void tcp_data_ready(struct sock *sk) int avail = tp->rcv_nxt - tp->copied_seq; if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) && - !sock_flag(sk, SOCK_DONE)) + !sock_flag(sk, SOCK_DONE) && + tcp_receive_window(tp) > inet_csk(sk)->icsk_ack.rcv_mss) return; sk->sk_data_ready(sk); From patchwork Sat Oct 31 11:35:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E73ACC5517A for ; Sat, 31 Oct 2020 11:39:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFCBF20719 for ; Sat, 31 Oct 2020 11:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144349; bh=JLcEgLdL/kL4nRVPKC9wWdDIZP3QmaLJDeSXO5Gt35Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=T7T5n1IhUbyrKb+yJFXEXrP2J0yp8QRfSK0cFqY6r6zAS/H0Nqczkjd1rv+/E7Idb ECu/jmKc2ZQmQHAeY8SPWjsCvYwA2h3yV/2HDX9vUBlMGuQlKsNnZUAumN3PGcVGl2 LPdmP9SUaa+q8rU+ubARApGiVDYTi/43sPgj7Qpw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727039AbgJaLfz (ORCPT ); Sat, 31 Oct 2020 07:35:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:33750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727104AbgJaLfw (ORCPT ); Sat, 31 Oct 2020 07:35:52 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B726920853; Sat, 31 Oct 2020 11:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144152; bh=JLcEgLdL/kL4nRVPKC9wWdDIZP3QmaLJDeSXO5Gt35Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npwcH06qIuO1Dhm9pinOXsauATc+OeynGvpSNYDHbcXWIStfHdZBYKKJMYWnXIT4F E2b/Pg3SH127RCId3vxZlFS414unSp6YuxRmBi9lifikXLRk7PTmW4zWwUAUIemRYA YNFRXyvyni+jP86zN740H/SANJgQ4Ji72iqFAuao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Maloy , Thang Hoang Ngo , Tung Nguyen , Xin Long , Cong Wang , Jakub Kicinski Subject: [PATCH 5.4 24/49] tipc: fix memory leak caused by tipc_buf_append() Date: Sat, 31 Oct 2020 12:35:20 +0100 Message-Id: <20201031113456.609447092@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tung Nguyen [ Upstream commit ceb1eb2fb609c88363e06618b8d4bbf7815a4e03 ] Commit ed42989eab57 ("tipc: fix the skb_unshare() in tipc_buf_append()") replaced skb_unshare() with skb_copy() to not reduce the data reference counter of the original skb intentionally. This is not the correct way to handle the cloned skb because it causes memory leak in 2 following cases: 1/ Sending multicast messages via broadcast link The original skb list is cloned to the local skb list for local destination. After that, the data reference counter of each skb in the original list has the value of 2. This causes each skb not to be freed after receiving ACK: tipc_link_advance_transmq() { ... /* release skb */ __skb_unlink(skb, &l->transmq); kfree_skb(skb); <-- memory exists after being freed } 2/ Sending multicast messages via replicast link Similar to the above case, each skb cannot be freed after purging the skb list: tipc_mcast_xmit() { ... __skb_queue_purge(pkts); <-- memory exists after being freed } This commit fixes this issue by using skb_unshare() instead. Besides, to avoid use-after-free error reported by KASAN, the pointer to the fragment is set to NULL before calling skb_unshare() to make sure that the original skb is not freed after freeing the fragment 2 times in case skb_unshare() returns NULL. Fixes: ed42989eab57 ("tipc: fix the skb_unshare() in tipc_buf_append()") Acked-by: Jon Maloy Reported-by: Thang Hoang Ngo Signed-off-by: Tung Nguyen Reviewed-by: Xin Long Acked-by: Cong Wang Link: https://lore.kernel.org/r/20201027032403.1823-1-tung.q.nguyen@dektech.com.au Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/tipc/msg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/net/tipc/msg.c +++ b/net/tipc/msg.c @@ -140,12 +140,11 @@ int tipc_buf_append(struct sk_buff **hea if (fragid == FIRST_FRAGMENT) { if (unlikely(head)) goto err; - if (skb_cloned(frag)) - frag = skb_copy(frag, GFP_ATOMIC); + *buf = NULL; + frag = skb_unshare(frag, GFP_ATOMIC); if (unlikely(!frag)) goto err; head = *headbuf = frag; - *buf = NULL; TIPC_SKB_CB(head)->tail = NULL; if (skb_is_nonlinear(head)) { skb_walk_frags(head, tail) { From patchwork Sat Oct 31 11:35:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E3EFC4742C for ; Sat, 31 Oct 2020 11:37:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46F1020731 for ; Sat, 31 Oct 2020 11:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144260; bh=ELnbaPvLmgekO9zPLjNiFxIvLeYzSV+8Djt2I6YDpOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=donPeYVGaJKuA5i5G37I3N/Ruw0Z9XawSrRWARqUerIOk0m+WaF6DmJAt7Peihaug 0Iz5BImAhRwfqVdU+hUF2F8VVWyryW9rNIWPHrSmAKXHiG8DyzwUowtbJ6TRuzxSvH W50J794sVq3BjlXEHNLXavJeSw9t3XORV7ttyt7Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727244AbgJaLhh (ORCPT ); Sat, 31 Oct 2020 07:37:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:35878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727310AbgJaLhD (ORCPT ); Sat, 31 Oct 2020 07:37:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6300B20791; Sat, 31 Oct 2020 11:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144223; bh=ELnbaPvLmgekO9zPLjNiFxIvLeYzSV+8Djt2I6YDpOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljsr1NxzLvPnzs1lyAUrZtP40uAU39XW1bH22+/sbj6jnl2DeiYKhc9u9I0dqjaVm bWbTy0ffoiRKrngI5BSa3u400tbKxg3DKaHBZjUWkaYpYJRFa8EuaVfq6N1Fj7Y9Tb pjLumb3bFXgU3GX5fTehYGHlAERIoWnozVrS0EJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Eranian , Kim Phillips , "Peter Zijlstra (Intel)" Subject: [PATCH 5.4 30/49] arch/x86/amd/ibs: Fix re-arming IBS Fetch Date: Sat, 31 Oct 2020 12:35:26 +0100 Message-Id: <20201031113456.894007221@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kim Phillips commit 221bfce5ebbdf72ff08b3bf2510ae81058ee568b upstream. Stephane Eranian found a bug in that IBS' current Fetch counter was not being reset when the driver would write the new value to clear it along with the enable bit set, and found that adding an MSR write that would first disable IBS Fetch would make IBS Fetch reset its current count. Indeed, the PPR for AMD Family 17h Model 31h B0 55803 Rev 0.54 - Sep 12, 2019 states "The periodic fetch counter is set to IbsFetchCnt [...] when IbsFetchEn is changed from 0 to 1." Explicitly set IbsFetchEn to 0 and then to 1 when re-enabling IBS Fetch, so the driver properly resets the internal counter to 0 and IBS Fetch starts counting again. A family 15h machine tested does not have this problem, and the extra wrmsr is also not needed on Family 19h, so only do the extra wrmsr on families 16h through 18h. Reported-by: Stephane Eranian Signed-off-by: Kim Phillips [peterz: optimized] Signed-off-by: Peter Zijlstra (Intel) Cc: stable@vger.kernel.org Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Signed-off-by: Greg Kroah-Hartman --- arch/x86/events/amd/ibs.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -89,6 +89,7 @@ struct perf_ibs { u64 max_period; unsigned long offset_mask[1]; int offset_max; + unsigned int fetch_count_reset_broken : 1; struct cpu_perf_ibs __percpu *pcpu; struct attribute **format_attrs; @@ -363,7 +364,12 @@ perf_ibs_event_update(struct perf_ibs *p static inline void perf_ibs_enable_event(struct perf_ibs *perf_ibs, struct hw_perf_event *hwc, u64 config) { - wrmsrl(hwc->config_base, hwc->config | config | perf_ibs->enable_mask); + u64 tmp = hwc->config | config; + + if (perf_ibs->fetch_count_reset_broken) + wrmsrl(hwc->config_base, tmp & ~perf_ibs->enable_mask); + + wrmsrl(hwc->config_base, tmp | perf_ibs->enable_mask); } /* @@ -733,6 +739,13 @@ static __init void perf_event_ibs_init(v { struct attribute **attr = ibs_op_format_attrs; + /* + * Some chips fail to reset the fetch count when it is written; instead + * they need a 0-1 transition of IbsFetchEn. + */ + if (boot_cpu_data.x86 >= 0x16 && boot_cpu_data.x86 <= 0x18) + perf_ibs_fetch.fetch_count_reset_broken = 1; + perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); if (ibs_caps & IBS_CAPS_OPCNT) { From patchwork Sat Oct 31 11:35:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC1EBC4742C for ; Sat, 31 Oct 2020 11:37:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 920EA20731 for ; Sat, 31 Oct 2020 11:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144256; bh=THb8s8SXPIbBfsc8yjTc00K0u3vjv6go/m8TXpARlBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jyf9lPaaSUte/160CrDkmDSB5R50BwUiB0utwATMZdPqjeCzPPL4PI+TDAQMIsWxn X3ci9tyg1PwNWSX0wGiCqzyR7IWxRZRzatMLVVfM7yQ4YkMsRwkzDGoNrE0PPGS7Sp qXcPamJOKFL+msfJ2vgmQatX8+48GCXVvQnOk2hw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727195AbgJaLhH (ORCPT ); Sat, 31 Oct 2020 07:37:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:35940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbgJaLhG (ORCPT ); Sat, 31 Oct 2020 07:37:06 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDC2D20825; Sat, 31 Oct 2020 11:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144225; bh=THb8s8SXPIbBfsc8yjTc00K0u3vjv6go/m8TXpARlBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xz0IrFtVxq0emjqO+05iif3F2wQsxtdcZHgwfFbJ/A9UR/qs44Yp+Jtxj5lEpNpaC 45A9N2gQqYEI42W2mt52VTCnhoM8h9M8V3ztr0XHCjYyc6/f5wBp5XujBpQeoa1zjI 4vffGv/KSPdoBzmn2dT91379T6ZyUpO3gQV0Oy9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Boris Ostrovsky Subject: [PATCH 5.4 31/49] x86/xen: disable Firmware First mode for correctable memory errors Date: Sat, 31 Oct 2020 12:35:27 +0100 Message-Id: <20201031113456.942054011@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Juergen Gross commit d759af38572f97321112a0852353613d18126038 upstream. When running as Xen dom0 the kernel isn't responsible for selecting the error handling mode, this should be handled by the hypervisor. So disable setting FF mode when running as Xen pv guest. Not doing so might result in boot splats like: [ 7.509696] HEST: Enabling Firmware First mode for corrected errors. [ 7.510382] mce: [Firmware Bug]: Ignoring request to disable invalid MCA bank 2. [ 7.510383] mce: [Firmware Bug]: Ignoring request to disable invalid MCA bank 3. [ 7.510384] mce: [Firmware Bug]: Ignoring request to disable invalid MCA bank 4. [ 7.510384] mce: [Firmware Bug]: Ignoring request to disable invalid MCA bank 5. [ 7.510385] mce: [Firmware Bug]: Ignoring request to disable invalid MCA bank 6. [ 7.510386] mce: [Firmware Bug]: Ignoring request to disable invalid MCA bank 7. [ 7.510386] mce: [Firmware Bug]: Ignoring request to disable invalid MCA bank 8. Reason is that the HEST ACPI table contains the real number of MCA banks, while the hypervisor is emulating only 2 banks for guests. Cc: stable@vger.kernel.org Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/r/20200925140751.31381-1-jgross@suse.com Signed-off-by: Boris Ostrovsky Signed-off-by: Greg Kroah-Hartman --- arch/x86/xen/enlighten_pv.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1382,6 +1382,15 @@ asmlinkage __visible void __init xen_sta x86_init.mpparse.get_smp_config = x86_init_uint_noop; xen_boot_params_init_edd(); + +#ifdef CONFIG_ACPI + /* + * Disable selecting "Firmware First mode" for correctable + * memory errors, as this is the duty of the hypervisor to + * decide. + */ + acpi_disable_cmcff = 1; +#endif } if (!boot_params.screen_info.orig_video_isVGA) From patchwork Sat Oct 31 11:35:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B2D2C388F7 for ; Sat, 31 Oct 2020 11:37:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BEBB20719 for ; Sat, 31 Oct 2020 11:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144234; bh=MlZzqlvhZXIzlNXZFf3Hkq3xqbJVUiR+P5qXyxr/b0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Us/xFaHLjhbKSmL9qmewGgvOqhLjTpbBye5zerDdye4LVzkfOXOaKiLoclkWkr7p7 7yf36supLyKMRgTzfrHxTit/TH/vpUOtv6MkthVn37l6PyekSmY0fdX5wPRd5NGn8K AkUAnP9/pke6sCp9YthKOEEkinNneXsyd0XwDmiM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727343AbgJaLhM (ORCPT ); Sat, 31 Oct 2020 07:37:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:36116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbgJaLhL (ORCPT ); Sat, 31 Oct 2020 07:37:11 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F97A20719; Sat, 31 Oct 2020 11:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144230; bh=MlZzqlvhZXIzlNXZFf3Hkq3xqbJVUiR+P5qXyxr/b0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aPaUMKyai52vnBn+GpL0QVPsuTaTXD89s89st7gZlzfagMV4eUAN2AynIPaRXQMjx NS63x1R75M79q2BxrxXy1MYwA9m93/3LlL/jFFnUUW92WrP0ZjLQvZ4GBwbi+jPc66 mnl9vBl6AECw1RdWbcjvaq8iwBxdwmdI0cHsY0So= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pradeep P V K , Miklos Szeredi Subject: [PATCH 5.4 33/49] fuse: fix page dereference after free Date: Sat, 31 Oct 2020 12:35:29 +0100 Message-Id: <20201031113457.039865220@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miklos Szeredi commit d78092e4937de9ce55edcb4ee4c5e3c707be0190 upstream. After unlock_request() pages from the ap->pages[] array may be put (e.g. by aborting the connection) and the pages can be freed. Prevent use after free by grabbing a reference to the page before calling unlock_request(). The original patch was created by Pradeep P V K. Reported-by: Pradeep P V K Cc: Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dev.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -786,15 +786,16 @@ static int fuse_try_move_page(struct fus struct page *newpage; struct pipe_buffer *buf = cs->pipebufs; + get_page(oldpage); err = unlock_request(cs->req); if (err) - return err; + goto out_put_old; fuse_copy_finish(cs); err = pipe_buf_confirm(cs->pipe, buf); if (err) - return err; + goto out_put_old; BUG_ON(!cs->nr_segs); cs->currbuf = buf; @@ -834,7 +835,7 @@ static int fuse_try_move_page(struct fus err = replace_page_cache_page(oldpage, newpage, GFP_KERNEL); if (err) { unlock_page(newpage); - return err; + goto out_put_old; } get_page(newpage); @@ -853,14 +854,19 @@ static int fuse_try_move_page(struct fus if (err) { unlock_page(newpage); put_page(newpage); - return err; + goto out_put_old; } unlock_page(oldpage); + /* Drop ref for ap->pages[] array */ put_page(oldpage); cs->len = 0; - return 0; + err = 0; +out_put_old: + /* Drop ref obtained in this function */ + put_page(oldpage); + return err; out_fallback_unlock: unlock_page(newpage); @@ -869,10 +875,10 @@ out_fallback: cs->offset = buf->offset; err = lock_request(cs->req); - if (err) - return err; + if (!err) + err = 1; - return 1; + goto out_put_old; } static int fuse_ref_page(struct fuse_copy_state *cs, struct page *page, @@ -884,14 +890,16 @@ static int fuse_ref_page(struct fuse_cop if (cs->nr_segs == cs->pipe->buffers) return -EIO; + get_page(page); err = unlock_request(cs->req); - if (err) + if (err) { + put_page(page); return err; + } fuse_copy_finish(cs); buf = cs->pipebufs; - get_page(page); buf->page = page; buf->offset = offset; buf->len = count; From patchwork Sat Oct 31 11:35:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 081A0C388F9 for ; Sat, 31 Oct 2020 11:37:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF17020719 for ; Sat, 31 Oct 2020 11:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144240; bh=QSgOOz8EW0QAiJ/4zYD9fBA1PX1UTHtZc2GxUPW0aH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WzQbH4N0Bd9GUPaYPrtDg7xq9/nRag0HWPpiUjahauzUSkGsbPLIIVymnfbTcrYIa UyvFxoIffNiW5ftUCnKuAwLjr6QSfoWtpYjeNLW5uMJO+YWm4bY+4SxWFNoP4QUR5d 85EBDtre39StG+jakFCqQavcXtkPhpSp/COQx1ig= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727335AbgJaLhP (ORCPT ); Sat, 31 Oct 2020 07:37:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:36198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbgJaLhN (ORCPT ); Sat, 31 Oct 2020 07:37:13 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA0A120731; Sat, 31 Oct 2020 11:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144233; bh=QSgOOz8EW0QAiJ/4zYD9fBA1PX1UTHtZc2GxUPW0aH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTizZLhbYVJkPqyM4LPKjF5b6I/kmH2imPP7utHGCthNP4xllc0inTuSnDhRhJXxk 4yLuTMfXF7T0FtCDqTTuFjOfnomho/qTzNu90LqFfXW0Ih0sRiR50SQZWKYNocaisc Pa/REsTDyEoXqIgcYK14yQ8rLeulVZ35XpXYGF/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Alexei Starovoitov Subject: [PATCH 5.4 34/49] bpf: Fix comment for helper bpf_current_task_under_cgroup() Date: Sat, 31 Oct 2020 12:35:30 +0100 Message-Id: <20201031113457.086971655@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Song Liu commit 1aef5b4391f0c75c0a1523706a7b0311846ee12f upstream. This should be "current" not "skb". Fixes: c6b5fb8690fa ("bpf: add documentation for eBPF helpers (42-50)") Signed-off-by: Song Liu Signed-off-by: Alexei Starovoitov Cc: Link: https://lore.kernel.org/bpf/20200910203314.70018-1-songliubraving@fb.com Signed-off-by: Greg Kroah-Hartman --- include/uapi/linux/bpf.h | 4 ++-- tools/include/uapi/linux/bpf.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1294,8 +1294,8 @@ union bpf_attr { * Return * The return value depends on the result of the test, and can be: * - * * 0, if the *skb* task belongs to the cgroup2. - * * 1, if the *skb* task does not belong to the cgroup2. + * * 0, if current task belongs to the cgroup2. + * * 1, if current task does not belong to the cgroup2. * * A negative error code, if an error occurred. * * int bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1294,8 +1294,8 @@ union bpf_attr { * Return * The return value depends on the result of the test, and can be: * - * * 0, if the *skb* task belongs to the cgroup2. - * * 1, if the *skb* task does not belong to the cgroup2. + * * 0, if current task belongs to the cgroup2. + * * 1, if current task does not belong to the cgroup2. * * A negative error code, if an error occurred. * * int bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) From patchwork Sat Oct 31 11:35:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 215C3C4742C for ; Sat, 31 Oct 2020 11:38:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEAEE20731 for ; Sat, 31 Oct 2020 11:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144310; bh=e2Rk9PNlPqMnrxoDg8bwy03tmY6Hby9b57Vg85fF3OE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VgxdBilyXuFq5cpOajwZ6gnBS097VXxJ9chAfib4OqBz9HribpllzOPRl7cRAPCIY wSdY0dOi636GPU51v/ZHxdwRIcNkUcSQo3GgR/7VaWi95Zop/PFAw9kk1pkvuH9vRV +FzwTg7EfdAxT1fMBsqukodA50x8LRniwdAqDRkU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726991AbgJaLiX (ORCPT ); Sat, 31 Oct 2020 07:38:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727173AbgJaLgX (ORCPT ); Sat, 31 Oct 2020 07:36:23 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C47020739; Sat, 31 Oct 2020 11:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144182; bh=e2Rk9PNlPqMnrxoDg8bwy03tmY6Hby9b57Vg85fF3OE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GM7rPycyzd+QavLY1FMq10XACCmTfD94pyLJJG5JUyeWI6oLCvsl1DoCcHOF4dmJT 72al2/9NYUAQZF0Ua93f1KeXjz/UtNqWx2zIJT3OmTJoomUhKRzn32Drni2gwgy9fA AOzGtcErbWW/SVfabQtsY8VQiffxpggZ1ZVlPLiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Barrat , Andrew Donnellan , Michael Ellerman Subject: [PATCH 5.4 37/49] cxl: Rework error message for incompatible slots Date: Sat, 31 Oct 2020 12:35:33 +0100 Message-Id: <20201031113457.231477874@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Frederic Barrat commit 40ac790d99c6dd16b367d5c2339e446a5f1b0593 upstream. Improve the error message shown if a capi adapter is plugged on a capi-incompatible slot directly under the PHB (no intermediate switch). Fixes: 5632874311db ("cxl: Add support for POWER9 DD2") Cc: stable@vger.kernel.org # 4.14+ Signed-off-by: Frederic Barrat Reviewed-by: Andrew Donnellan Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20200407115601.25453-1-fbarrat@linux.ibm.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/cxl/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c @@ -393,8 +393,8 @@ int cxl_calc_capp_routing(struct pci_dev *capp_unit_id = get_capp_unit_id(np, *phb_index); of_node_put(np); if (!*capp_unit_id) { - pr_err("cxl: invalid capp unit id (phb_index: %d)\n", - *phb_index); + pr_err("cxl: No capp unit found for PHB[%lld,%d]. Make sure the adapter is on a capi-compatible slot\n", + *chipid, *phb_index); return -ENODEV; } From patchwork Sat Oct 31 11:35:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0525C388F9 for ; Sat, 31 Oct 2020 11:36:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 819EF20853 for ; Sat, 31 Oct 2020 11:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144194; bh=ImkCi6wVJfwB6SBF9cHHXCHQVVWly6Y7DHUD+gkteAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p9Ta0Z8/py/EPJz64Q/0+9OdJCbPsM4gTGOghbErZkyHp/GyCDXaC4EugfxsjOZQ5 TU4LuQBc8oAem7ooXOU86GNVoOU/ygCSGG/fh0FYCN6IMnx02i/il86dAaSAKws213 KExhIJHsbGtesl7zSPxTRxPOFaD0atLtS835v5iU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727196AbgJaLgc (ORCPT ); Sat, 31 Oct 2020 07:36:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:34676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727188AbgJaLg2 (ORCPT ); Sat, 31 Oct 2020 07:36:28 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 791F320739; Sat, 31 Oct 2020 11:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144188; bh=ImkCi6wVJfwB6SBF9cHHXCHQVVWly6Y7DHUD+gkteAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w22zNjFbXvXt1sArIsQBqLWeZXTYmwUjh1n82kRNmX5d15VOz1EXtoOYQ+c/1Qf7t rRb2EKcC1K3QVZ2MU1+dXmua9PvOtOMkxWrl1hfiXdgzjQBHeU6kKXuAs/CyZQz1yv isCK7DZ1elyaXTtKB0C7locRtTUfglgyBriqD14k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Perches , "Gustavo A. R. Silva" , Miquel Raynal Subject: [PATCH 5.4 39/49] mtd: lpddr: Fix bad logic in print_drs_error Date: Sat, 31 Oct 2020 12:35:35 +0100 Message-Id: <20201031113457.327049114@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gustavo A. R. Silva commit 1c9c02bb22684f6949d2e7ddc0a3ff364fd5a6fc upstream. Update logic for broken test. Use a more common logging style. It appears the logic in this function is broken for the consecutive tests of if (prog_status & 0x3) ... else if (prog_status & 0x2) ... else (prog_status & 0x1) ... Likely the first test should be if ((prog_status & 0x3) == 0x3) Found by inspection of include files using printk. Fixes: eb3db27507f7 ("[MTD] LPDDR PFOW definition") Cc: stable@vger.kernel.org Reported-by: Joe Perches Signed-off-by: Gustavo A. R. Silva Acked-by: Miquel Raynal Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/3fb0e29f5b601db8be2938a01d974b00c8788501.1588016644.git.gustavo@embeddedor.com Signed-off-by: Greg Kroah-Hartman --- include/linux/mtd/pfow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/mtd/pfow.h +++ b/include/linux/mtd/pfow.h @@ -128,7 +128,7 @@ static inline void print_drs_error(unsig if (!(dsr & DSR_AVAILABLE)) printk(KERN_NOTICE"DSR.15: (0) Device not Available\n"); - if (prog_status & 0x03) + if ((prog_status & 0x03) == 0x03) printk(KERN_NOTICE"DSR.9,8: (11) Attempt to program invalid " "half with 41h command\n"); else if (prog_status & 0x02) From patchwork Sat Oct 31 11:35:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D32C388F7 for ; Sat, 31 Oct 2020 11:38:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99CB820719 for ; Sat, 31 Oct 2020 11:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144302; bh=vFKivAGTnfH8SxFCCnnszja2lgxQzHu9V9uCveD6v8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IbRk7t2j+5IEO6bfU6dYK2GkJTGP9RUcQ8lozMXlTkmskdBphGOYcu6jqemwhvMLz ZiCxxSCsAvgeCKAvHuAT5Cb4UQQyAY2YX9wZxWSd1CYJiFY9FaKPIH/BJn/hR5SPQh P6MElS/i4ggZK2NalvlsvcQZBLSXbaR0SX8KS+8E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726973AbgJaLiH (ORCPT ); Sat, 31 Oct 2020 07:38:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:34866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727199AbgJaLge (ORCPT ); Sat, 31 Oct 2020 07:36:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06C1420791; Sat, 31 Oct 2020 11:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144193; bh=vFKivAGTnfH8SxFCCnnszja2lgxQzHu9V9uCveD6v8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q77Y37nnVCOF3O5dYu1UVNpPehAp2aKCDzJkdMtVsjlfXe4x6ViAewXPUMPAlntoz b5lOhSEucvrr0YrMD/ADE4Dktmj5YNZeTDHEiz/U+OZe1wMw7iNVIorVItALjd2Yqc p3m9e9T/NaunMmWb+JrEYATJ9YTXh/2nPy3T948E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paras Sharma , Akash Asthana Subject: [PATCH 5.4 41/49] serial: qcom_geni_serial: To correct QUP Version detection logic Date: Sat, 31 Oct 2020 12:35:37 +0100 Message-Id: <20201031113457.422443341@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Paras Sharma commit c9ca43d42ed8d5fd635d327a664ed1d8579eb2af upstream. For QUP IP versions 2.5 and above the oversampling rate is halved from 32 to 16. Commit ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate") is pushed to handle this scenario. But the existing logic is failing to classify QUP Version 3.0 into the correct group ( 2.5 and above). As result Serial Engine clocks are not configured properly for baud rate and garbage data is sampled to FIFOs from the line. So, fix the logic to detect QUP with versions 2.5 and above. Fixes: ce734600545f ("tty: serial: qcom_geni_serial: Update the oversampling rate") Cc: stable Signed-off-by: Paras Sharma Reviewed-by: Akash Asthana Link: https://lore.kernel.org/r/1601445926-23673-1-git-send-email-parashar@codeaurora.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/qcom_geni_serial.c | 2 +- include/linux/qcom-geni-se.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -970,7 +970,7 @@ static void qcom_geni_serial_set_termios sampling_rate = UART_OVERSAMPLING; /* Sampling rate is halved for IP versions >= 2.5 */ ver = geni_se_get_qup_hw_version(&port->se); - if (GENI_SE_VERSION_MAJOR(ver) >= 2 && GENI_SE_VERSION_MINOR(ver) >= 5) + if (ver >= QUP_SE_VERSION_2_5) sampling_rate /= 2; clk_rate = get_clk_div_rate(baud, sampling_rate, &clk_div); --- a/include/linux/qcom-geni-se.h +++ b/include/linux/qcom-geni-se.h @@ -229,6 +229,9 @@ struct geni_se { #define GENI_SE_VERSION_MINOR(ver) ((ver & HW_VER_MINOR_MASK) >> HW_VER_MINOR_SHFT) #define GENI_SE_VERSION_STEP(ver) (ver & HW_VER_STEP_MASK) +/* QUP SE VERSION value for major number 2 and minor number 5 */ +#define QUP_SE_VERSION_2_5 0x20050000 + #if IS_ENABLED(CONFIG_QCOM_GENI_SE) u32 geni_se_get_qup_hw_version(struct geni_se *se); From patchwork Sat Oct 31 11:35:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B62D5C388F7 for ; Sat, 31 Oct 2020 11:38:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E6AA20825 for ; Sat, 31 Oct 2020 11:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144286; bh=VaJBdPvv6oADudM62GhWYNgpH+/EyjWa0c704nJQWw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=oqkyhkFuICDEV841kEY/+Jl3fqqqYXeQit4zlhwXDO1uumM9s5vHk9lq/KElZ3eDX EQ0VY/CyAz51tVN5LEdDRwI+sVJU3b4wYRmizuSmk+JGFYIuUJnVbEOeKBA0TxSEMS 2P5w9PN2EfbKki/X2oLegX9CDWJsyrAYG2j9wM9E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727222AbgJaLiA (ORCPT ); Sat, 31 Oct 2020 07:38:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:34944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727206AbgJaLgg (ORCPT ); Sat, 31 Oct 2020 07:36:36 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E06A20853; Sat, 31 Oct 2020 11:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144196; bh=VaJBdPvv6oADudM62GhWYNgpH+/EyjWa0c704nJQWw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ajMwhNXFX/489ECKgikT4BMz3cw7WUUE0Wlk5jqTdIzRav50QKeW/Foj0KpNCASc0 JYzJi0k7FyaFHr5u9oB1+ekSTCmTAoGyiU7XQCooS59EuUxTwF4CsDrHXBiVC1OYwn qDZ2fctMs+2Cyk1Vsw0srw17tNzsDaPnFXy9+bH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Jiri Slaby , Peter Zijlstra , Will Deacon Subject: [PATCH 5.4 42/49] serial: pl011: Fix lockdep splat when handling magic-sysrq interrupt Date: Sat, 31 Oct 2020 12:35:38 +0100 Message-Id: <20201031113457.471013483@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Peter Zijlstra commit 534cf755d9df99e214ddbe26b91cd4d81d2603e2 upstream. Issuing a magic-sysrq via the PL011 causes the following lockdep splat, which is easily reproducible under QEMU: | sysrq: Changing Loglevel | sysrq: Loglevel set to 9 | | ====================================================== | WARNING: possible circular locking dependency detected | 5.9.0-rc7 #1 Not tainted | ------------------------------------------------------ | systemd-journal/138 is trying to acquire lock: | ffffab133ad950c0 (console_owner){-.-.}-{0:0}, at: console_lock_spinning_enable+0x34/0x70 | | but task is already holding lock: | ffff0001fd47b098 (&port_lock_key){-.-.}-{2:2}, at: pl011_int+0x40/0x488 | | which lock already depends on the new lock. [...] | Possible unsafe locking scenario: | | CPU0 CPU1 | ---- ---- | lock(&port_lock_key); | lock(console_owner); | lock(&port_lock_key); | lock(console_owner); | | *** DEADLOCK *** The issue being that CPU0 takes 'port_lock' on the irq path in pl011_int() before taking 'console_owner' on the printk() path, whereas CPU1 takes the two locks in the opposite order on the printk() path due to setting the "console_owner" prior to calling into into the actual console driver. Fix this in the same way as the msm-serial driver by dropping 'port_lock' before handling the sysrq. Cc: # 4.19+ Cc: Russell King Cc: Greg Kroah-Hartman Cc: Jiri Slaby Link: https://lore.kernel.org/r/20200811101313.GA6970@willie-the-truck Signed-off-by: Peter Zijlstra Tested-by: Will Deacon Signed-off-by: Will Deacon Link: https://lore.kernel.org/r/20200930120432.16551-1-will@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/amba-pl011.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -313,8 +313,9 @@ static void pl011_write(unsigned int val */ static int pl011_fifo_to_tty(struct uart_amba_port *uap) { - u16 status; unsigned int ch, flag, fifotaken; + int sysrq; + u16 status; for (fifotaken = 0; fifotaken != 256; fifotaken++) { status = pl011_read(uap, REG_FR); @@ -349,10 +350,12 @@ static int pl011_fifo_to_tty(struct uart flag = TTY_FRAME; } - if (uart_handle_sysrq_char(&uap->port, ch & 255)) - continue; + spin_unlock(&uap->port.lock); + sysrq = uart_handle_sysrq_char(&uap->port, ch & 255); + spin_lock(&uap->port.lock); - uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag); + if (!sysrq) + uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag); } return fifotaken; From patchwork Sat Oct 31 11:35:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 320053 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp2185958ilc; Sat, 31 Oct 2020 04:37:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+myIkk8DEFiGBn0XFflkr7cg1qBZTZqjCQhflsYl4o2RMVBkJma3byOBPl1m1OVDu5JKo X-Received: by 2002:aa7:c948:: with SMTP id h8mr6887177edt.171.1604144279240; Sat, 31 Oct 2020 04:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604144279; cv=none; d=google.com; s=arc-20160816; b=eSi8ZqQGBvoxMPM68pX82+4qP4TBHs+VVqCfQD8qUk558LcbSih5FmWJBtysr2wD8B Lug//bg+qkpRVkY5LBDGRlkw/fxossYpTVb1nRjzY8tvdyMwpgjOyeZF8VHwB2gBxlfF M6IwJW+pccfenH/oKUP6UGnlkyxpAK3UbeYZXU2c3k09PylFE16b4yDoVWNbzBZf+A9b Lon+0cl/MA8jULdRiRxi5309csYbpIKJ7jWkEwsJAoKa2NVHybhPD6KVyY8G7WVR8djt axly/t2uDp2U/ViU1HAPSLQ/Rn8hAm++N0WW3KladLxJ7rzklad52ed2uYnFBtSFV1lm kb7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K6yeQKF66NiMsB7b+z0SPvyyFisZcrxVShefIwceAPY=; b=uVO1yMhKTnEvKX94/9NYEHw7jNKr0VwtpvxVysanejszl8OOAd3Gd+qGwMr/xq/o1t xp4Pu4fyO5HdxFzWUPXhGPfvX5fGPHf5pt2klR8ytfSSNdubcpDF75K7qYrO0XgareFm /EpE+FZvGNV7RkHuK2b4CPbJEm2MbmnjrN6NZyu5VQuOuyqEyAF/K5iL2UMNlLzjohOr 0jOtomVPfGqv8oas2gxL/OwLkQur0vm5WJ9Sp19JwVcXZfChQAdsXSh4C3R29EdZXJlm JrDO21nX29H65s+7DdOZM05487ZZ2NlepN/5c8s9Xma+uTJeTq3uMV6HmneVuubCtmbh R/+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="kWEwbW5/"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d26si5859610ejz.211.2020.10.31.04.37.59; Sat, 31 Oct 2020 04:37:59 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="kWEwbW5/"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727179AbgJaLgk (ORCPT + 15 others); Sat, 31 Oct 2020 07:36:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:35020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727212AbgJaLgj (ORCPT ); Sat, 31 Oct 2020 07:36:39 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 15BD120791; Sat, 31 Oct 2020 11:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144198; bh=r1xItn96tnp6noRlanmyu9eUicvbYli/qrwchptdiw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kWEwbW5/I8//RfJjTkw0xdaKG9Hi0Jx2MWWj2LId5QQsiMgymhILgIOHKgHBIA1ov c1+/09dXUVDrAtsxApZeb1qk/0FJTsjXZuvkq3aT2PSSBLvsswPdlEe1Jk8ArLHNI4 EcZeUVxwCzsniyjmkXOu+Nlw3sTxbNDdpZXRPqbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grygorii Strashko , Pavel Machek , Vincent Guittot , "Rafael J. Wysocki" Subject: [PATCH 5.4 43/49] PM: runtime: Fix timer_expires data type on 32-bit arches Date: Sat, 31 Oct 2020 12:35:39 +0100 Message-Id: <20201031113457.519718770@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Grygorii Strashko commit 6b61d49a55796dbbc479eeb4465e59fd656c719c upstream. Commit 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers") switched PM runtime autosuspend to use hrtimers and all related time accounting in ns, but missed to update the timer_expires data type in struct dev_pm_info to u64. This causes the timer_expires value to be truncated on 32-bit architectures when assignment is done from u64 values: rpm_suspend() |- dev->power.timer_expires = expires; Fix it by changing the timer_expires type to u64. Fixes: 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers") Signed-off-by: Grygorii Strashko Acked-by: Pavel Machek Acked-by: Vincent Guittot Cc: 5.0+ # 5.0+ [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- include/linux/pm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -598,7 +598,7 @@ struct dev_pm_info { #endif #ifdef CONFIG_PM struct hrtimer suspend_timer; - unsigned long timer_expires; + u64 timer_expires; struct work_struct work; wait_queue_head_t wait_queue; struct wake_irq *wakeirq; From patchwork Sat Oct 31 11:35:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1595C388F9 for ; Sat, 31 Oct 2020 11:37:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6EDBD20731 for ; Sat, 31 Oct 2020 11:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144277; bh=ziZaFmWCwafFO1YFugQ5nDo23sdJhf759kGyLiEUJ10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mNUS+E6ZXZ72vM3PJ3mNy8s38kSxAGQ6ghU06xI0TfzcvHHUDVOxxpbWeC96dKFkK 0nGjWBbpUPlE7dbdgt/nnE0R1IaDjzh9U1F3jFaEKIuJXaOHaZp3ndfpvM6mqsVlCt qFLKJtpj/HwJ3V+2skGbIbdDifju5zYigbqxfdpc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727228AbgJaLgo (ORCPT ); Sat, 31 Oct 2020 07:36:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727221AbgJaLgl (ORCPT ); Sat, 31 Oct 2020 07:36:41 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E4B520825; Sat, 31 Oct 2020 11:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144200; bh=ziZaFmWCwafFO1YFugQ5nDo23sdJhf759kGyLiEUJ10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DPtPichGvh9OqWSSNTJsj+7hF+BN0q1s7M0q9JpEsnfXYNN7USRJ/hd9cOTYWwcZT mSJxU0eKepOhlkiQiW+ICY5vRIxJSuULaotxtNAm1JfM+Ozj4syKKdh/xtSY53F9Pm exEMh1OC/+gDy+QXiOrzkElXFHH9VyBlNtvQa0u0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Lad Prabhakar , Yoshihiro Shimoda , Christoph Hellwig , Sergei Shtylyov , Ulf Hansson , Jens Axboe Subject: [PATCH 5.4 44/49] ata: sata_rcar: Fix DMA boundary mask Date: Sat, 31 Oct 2020 12:35:40 +0100 Message-Id: <20201031113457.568936119@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Geert Uytterhoeven commit df9c590986fdb6db9d5636d6cd93bc919c01b451 upstream. Before commit 9495b7e92f716ab2 ("driver core: platform: Initialize dma_parms for platform devices"), the R-Car SATA device didn't have DMA parameters. Hence the DMA boundary mask supplied by its driver was silently ignored, as __scsi_init_queue() doesn't check the return value of dma_set_seg_boundary(), and the default value of 0xffffffff was used. Now the device has gained DMA parameters, the driver-supplied value is used, and the following warning is printed on Salvator-XS: DMA-API: sata_rcar ee300000.sata: mapping sg segment across boundary [start=0x00000000ffffe000] [end=0x00000000ffffefff] [boundary=0x000000001ffffffe] WARNING: CPU: 5 PID: 38 at kernel/dma/debug.c:1233 debug_dma_map_sg+0x298/0x300 (the range of start/end values depend on whether IOMMU support is enabled or not) The issue here is that SATA_RCAR_DMA_BOUNDARY doesn't have bit 0 set, so any typical end value, which is odd, will trigger the check. Fix this by increasing the DMA boundary value by 1. This also fixes the following WRITE DMA EXT timeout issue: # dd if=/dev/urandom of=/mnt/de1/file1-1024M bs=1M count=1024 ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen ata1.00: failed command: WRITE DMA EXT ata1.00: cmd 35/00:00:00:e6:0c/00:0a:00:00:00/e0 tag 0 dma 1310720 out res 40/00:01:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) ata1.00: status: { DRDY } as seen by Shimoda-san since commit 429120f3df2dba2b ("block: fix splitting segments on boundary masks"). Fixes: 8bfbeed58665dbbf ("sata_rcar: correct 'sata_rcar_sht'") Fixes: 9495b7e92f716ab2 ("driver core: platform: Initialize dma_parms for platform devices") Fixes: 429120f3df2dba2b ("block: fix splitting segments on boundary masks") Signed-off-by: Geert Uytterhoeven Tested-by: Lad Prabhakar Tested-by: Yoshihiro Shimoda Reviewed-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Sergei Shtylyov Reviewed-by: Ulf Hansson Cc: stable Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/ata/sata_rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c @@ -120,7 +120,7 @@ /* Descriptor table word 0 bit (when DTA32M = 1) */ #define SATA_RCAR_DTEND BIT(0) -#define SATA_RCAR_DMA_BOUNDARY 0x1FFFFFFEUL +#define SATA_RCAR_DMA_BOUNDARY 0x1FFFFFFFUL /* Gen2 Physical Layer Control Registers */ #define RCAR_GEN2_PHY_CTL1_REG 0x1704 From patchwork Sat Oct 31 11:35:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2DC3C388F7 for ; Sat, 31 Oct 2020 11:36:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7FCD620739 for ; Sat, 31 Oct 2020 11:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144209; bh=S0QvFvUxPInt+D8MFMABSkUUKIPJWGO7tTyY4wyle4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wTTo9aJhZk0CltP1EzAkwv6uC+VJ0VBuv8YibfOONQ71SpGf1zWA44QxU0NmW3XxW 4SLaGAqPZvucRRF7rure2cAPbhADhz+cbaqfne8iIrJmiQqUk7KuDRqqixseY1OHeM 4QUv8VZ1j9tJlmyQV6Rv1ZwdICYan+ks7KRbUakM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727167AbgJaLgs (ORCPT ); Sat, 31 Oct 2020 07:36:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:35266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727243AbgJaLgq (ORCPT ); Sat, 31 Oct 2020 07:36:46 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2EC7720739; Sat, 31 Oct 2020 11:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144205; bh=S0QvFvUxPInt+D8MFMABSkUUKIPJWGO7tTyY4wyle4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtozCBmNc9AnMH2dpnu2lgtjFAPnkN9PKd65AGg6IU4i6PmU4cscH61JI8+d2DwTn iteubkTOgrwj6dukYH2XM2Ls01xmH5f6ZnZM/nbPmGSABKXU6eSFyj/D8NzOmBOG81 NXGp+Jw/cdIQx/JMXY64HWCF9dKzD+2H7THZOXvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Ostrovsky , Souptick Joarder , John Hubbard , Juergen Gross , David Vrabel Subject: [PATCH 5.4 45/49] xen/gntdev.c: Mark pages as dirty Date: Sat, 31 Oct 2020 12:35:41 +0100 Message-Id: <20201031113457.616778397@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Souptick Joarder commit 779055842da5b2e508f3ccf9a8153cb1f704f566 upstream. There seems to be a bug in the original code when gntdev_get_page() is called with writeable=true then the page needs to be marked dirty before being put. To address this, a bool writeable is added in gnt_dev_copy_batch, set it in gntdev_grant_copy_seg() (and drop `writeable` argument to gntdev_get_page()) and then, based on batch->writeable, use set_page_dirty_lock(). Fixes: a4cdb556cae0 (xen/gntdev: add ioctl for grant copy) Suggested-by: Boris Ostrovsky Signed-off-by: Souptick Joarder Cc: John Hubbard Cc: Boris Ostrovsky Cc: Juergen Gross Cc: David Vrabel Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/1599375114-32360-1-git-send-email-jrdr.linux@gmail.com Reviewed-by: Boris Ostrovsky Signed-off-by: Boris Ostrovsky Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -831,17 +831,18 @@ struct gntdev_copy_batch { s16 __user *status[GNTDEV_COPY_BATCH]; unsigned int nr_ops; unsigned int nr_pages; + bool writeable; }; static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt, - bool writeable, unsigned long *gfn) + unsigned long *gfn) { unsigned long addr = (unsigned long)virt; struct page *page; unsigned long xen_pfn; int ret; - ret = get_user_pages_fast(addr, 1, writeable ? FOLL_WRITE : 0, &page); + ret = get_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page); if (ret < 0) return ret; @@ -857,9 +858,13 @@ static void gntdev_put_pages(struct gntd { unsigned int i; - for (i = 0; i < batch->nr_pages; i++) + for (i = 0; i < batch->nr_pages; i++) { + if (batch->writeable && !PageDirty(batch->pages[i])) + set_page_dirty_lock(batch->pages[i]); put_page(batch->pages[i]); + } batch->nr_pages = 0; + batch->writeable = false; } static int gntdev_copy(struct gntdev_copy_batch *batch) @@ -948,8 +953,9 @@ static int gntdev_grant_copy_seg(struct virt = seg->source.virt + copied; off = (unsigned long)virt & ~XEN_PAGE_MASK; len = min(len, (size_t)XEN_PAGE_SIZE - off); + batch->writeable = false; - ret = gntdev_get_page(batch, virt, false, &gfn); + ret = gntdev_get_page(batch, virt, &gfn); if (ret < 0) return ret; @@ -967,8 +973,9 @@ static int gntdev_grant_copy_seg(struct virt = seg->dest.virt + copied; off = (unsigned long)virt & ~XEN_PAGE_MASK; len = min(len, (size_t)XEN_PAGE_SIZE - off); + batch->writeable = true; - ret = gntdev_get_page(batch, virt, true, &gfn); + ret = gntdev_get_page(batch, virt, &gfn); if (ret < 0) return ret; From patchwork Sat Oct 31 11:35:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A1F5C388F7 for ; Sat, 31 Oct 2020 11:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A94D20731 for ; Sat, 31 Oct 2020 11:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144274; bh=ZNmYTsr5WeuvMBDgFNeihJLom20CHDmhTDRZeEwZL10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GXnHaOLM8DcdT9acIP7IPjN24LaTuamwbIYGwR39dxi6GF1cuZggidZazo85Exgrw Nbec/DhNT0RXwD/n20RZQu8dSl5IPZNIa9aswLLH69afTqWFRh39jTafk5uiHJlhUK f2R8J15iVTisu1UT4OI7n5Ru9JhXfFKH47jOmgq8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727014AbgJaLhu (ORCPT ); Sat, 31 Oct 2020 07:37:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:35358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727257AbgJaLgs (ORCPT ); Sat, 31 Oct 2020 07:36:48 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A451620791; Sat, 31 Oct 2020 11:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144208; bh=ZNmYTsr5WeuvMBDgFNeihJLom20CHDmhTDRZeEwZL10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXaBODn4+ul91C62N2P4gYbIMaxsXO6dco97R0VcuxXkHXPRIAR64SXqUCeO/3g1l yYvQcrnk0p2y8JFK/9cr4FH6pXovcxVoV9/b8bkrJI4ikYg5b/XU5PN6RLoQMmMgIh eUpkRoGkCgmWrboWHZInHrpH9o63/UHkjiwuKZHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Nathan Chancellor , Herbert Xu , Jian Cai Subject: [PATCH 5.4 46/49] crypto: x86/crc32c - fix building with clang ias Date: Sat, 31 Oct 2020 12:35:42 +0100 Message-Id: <20201031113457.665835631@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 44623b2818f4a442726639572f44fd9b6d0ef68c upstream. The clang integrated assembler complains about movzxw: arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction mnemonic 'movzxw' It seems that movzwq is the mnemonic that it expects instead, and this is what objdump prints when disassembling the file. Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction") Signed-off-by: Arnd Bergmann Reviewed-by: Nathan Chancellor Signed-off-by: Herbert Xu [jc: Fixed conflicts due to lack of 34fdce6981b9 ("x86: Change {JMP,CALL}_NOSPEC argument")] Signed-off-by: Jian Cai Signed-off-by: Greg Kroah-Hartman --- arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S @@ -170,7 +170,7 @@ continue_block: ## branch into array lea jump_table(%rip), bufp - movzxw (bufp, %rax, 2), len + movzwq (bufp, %rax, 2), len lea crc_array(%rip), bufp lea (bufp, len, 1), bufp JMP_NOSPEC bufp From patchwork Sat Oct 31 11:35:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03D5DC388F7 for ; Sat, 31 Oct 2020 11:36:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C56702087D for ; Sat, 31 Oct 2020 11:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144218; bh=lp61+OWJbjIgZGSPK/gfon+MQDZYdOwpgU2lyciFs/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mwm8RP1ywgGpxdIsAxCpfU1GaniKCGsE8pVw9iATT9lJ394bMFQuQaz/F2BYAt99q OxSh3fbeb+GnAp2s5R2p2OXPerItDHaxDciGQqQVhOgqU1WEBUF9rUaXVS9azqe4kZ x2vhLwbC6MuAKF5pJSZ4dK5JtPMF4/tMCSsG2O1E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727281AbgJaLg5 (ORCPT ); Sat, 31 Oct 2020 07:36:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:35654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727286AbgJaLg4 (ORCPT ); Sat, 31 Oct 2020 07:36:56 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E67F120739; Sat, 31 Oct 2020 11:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144215; bh=lp61+OWJbjIgZGSPK/gfon+MQDZYdOwpgU2lyciFs/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RowJDcHvitk5TbACMKoZzRbuyOvLQRFcn8JWSE2u7hl90jTVtss01XEhviB/Rb2Y5 IYzgIqHY9/6vIxM4BBbZ96BWzru1wdDlcVmS6e9RY46jZ+Ot+uTnwBfhoxCl7YJwVs gXwcbfhK12t6nVpysSDyYnUR8uYY56xoQyPLQ3Z4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomasz Maciej Nowak , =?utf-8?q?Pali_Roh=C3=A1r?= , Lorenzo Pieralisi , Rob Herring Subject: [PATCH 5.4 49/49] phy: marvell: comphy: Convert internal SMCC firmware return codes to errno Date: Sat, 31 Oct 2020 12:35:45 +0100 Message-Id: <20201031113457.809830689@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113455.439684970@linuxfoundation.org> References: <20201031113455.439684970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pali Rohár commit ea17a0f153af2cd890e4ce517130dcccaa428c13 upstream. Driver ->power_on and ->power_off callbacks leaks internal SMCC firmware return codes to phy caller. This patch converts SMCC error codes to standard linux errno codes. Include file linux/arm-smccc.h already provides defines for SMCC error codes, so use them instead of custom driver defines. Note that return value is signed 32bit, but stored in unsigned long type with zero padding. Tested-by: Tomasz Maciej Nowak Link: https://lore.kernel.org/r/20200902144344.16684-2-pali@kernel.org Signed-off-by: Pali Rohár Signed-off-by: Lorenzo Pieralisi Reviewed-by: Rob Herring Signed-off-by: Greg Kroah-Hartman --- drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 14 +++++++++++--- drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) --- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c @@ -26,7 +26,6 @@ #define COMPHY_SIP_POWER_ON 0x82000001 #define COMPHY_SIP_POWER_OFF 0x82000002 #define COMPHY_SIP_PLL_LOCK 0x82000003 -#define COMPHY_FW_NOT_SUPPORTED (-1) #define COMPHY_FW_MODE_SATA 0x1 #define COMPHY_FW_MODE_SGMII 0x2 @@ -112,10 +111,19 @@ static int mvebu_a3700_comphy_smc(unsign unsigned long mode) { struct arm_smccc_res res; + s32 ret; arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, &res); + ret = res.a0; - return res.a0; + switch (ret) { + case SMCCC_RET_SUCCESS: + return 0; + case SMCCC_RET_NOT_SUPPORTED: + return -EOPNOTSUPP; + default: + return -EINVAL; + } } static int mvebu_a3700_comphy_get_fw_mode(int lane, int port, @@ -220,7 +228,7 @@ static int mvebu_a3700_comphy_power_on(s } ret = mvebu_a3700_comphy_smc(COMPHY_SIP_POWER_ON, lane->id, fw_param); - if (ret == COMPHY_FW_NOT_SUPPORTED) + if (ret == -EOPNOTSUPP) dev_err(lane->dev, "unsupported SMC call, try updating your firmware\n"); --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c @@ -123,7 +123,6 @@ #define COMPHY_SIP_POWER_ON 0x82000001 #define COMPHY_SIP_POWER_OFF 0x82000002 -#define COMPHY_FW_NOT_SUPPORTED (-1) /* * A lane is described by the following bitfields: @@ -273,10 +272,19 @@ static int mvebu_comphy_smc(unsigned lon unsigned long lane, unsigned long mode) { struct arm_smccc_res res; + s32 ret; arm_smccc_smc(function, phys, lane, mode, 0, 0, 0, 0, &res); + ret = res.a0; - return res.a0; + switch (ret) { + case SMCCC_RET_SUCCESS: + return 0; + case SMCCC_RET_NOT_SUPPORTED: + return -EOPNOTSUPP; + default: + return -EINVAL; + } } static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port, @@ -819,7 +827,7 @@ static int mvebu_comphy_power_on(struct if (!ret) return ret; - if (ret == COMPHY_FW_NOT_SUPPORTED) + if (ret == -EOPNOTSUPP) dev_err(priv->dev, "unsupported SMC call, try updating your firmware\n");