From patchwork Tue Jan 7 20:53:32 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: 234388 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 46121C33C9E for ; Tue, 7 Jan 2020 21:04:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1710B214D8 for ; Tue, 7 Jan 2020 21:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431045; bh=hOngF0NIEZ911Ya5pNIzRrZOqlZ9qqWel3xdXaqnWzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=U2HoK+Q1DyYa45qZJ4cJAqB+yGM49BZb1cNVRVtTyTTpni7oxTe+LOOf4qqK8p6pi 0UAaPtqXiX5GJzTUcyZi1KzGtpoQEdqU0zxF/RXmhCGhnpUMEcPa7s7j/SdqWaRWVG U3eDq2VFVzgdIJsmLXavkIJ5pHgOhf1yYn6kD9bI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728043AbgAGVED (ORCPT ); Tue, 7 Jan 2020 16:04:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:47404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727340AbgAGVEC (ORCPT ); Tue, 7 Jan 2020 16:04:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 4D4BC214D8; Tue, 7 Jan 2020 21:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431041; bh=hOngF0NIEZ911Ya5pNIzRrZOqlZ9qqWel3xdXaqnWzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npc3g+qzp0n9DiuspG9mN+plarOIyfxUB7vJQrVAcZS4DQLbP1Ipx2GLgsMhR4HGS D4RvoJmnoOBEyEiCIRJ7VCTeW2b9DQVTszoZmTyHuRVZshm4ul1XdAHO14iHrluFcT uI/89A1ii4qehu545V9IDc+ZyAh8DxfI4YhTp9CI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , "Ewan D. Milne" , James Smart , Keith Busch , Sasha Levin Subject: [PATCH 4.19 002/115] nvme-fc: fix double-free scenarios on hw queues Date: Tue, 7 Jan 2020 21:53:32 +0100 Message-Id: <20200107205241.393386348@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: James Smart [ Upstream commit c869e494ef8b5846d9ba91f1e922c23cd444f0c1 ] If an error occurs on one of the ios used for creating an association, the creating routine has error paths that are invoked by the command failure and the error paths will free up the controller resources created to that point. But... the io was ultimately determined by an asynchronous completion routine that detected the error and which unconditionally invokes the error_recovery path which calls delete_association. Delete association deletes all outstanding io then tears down the controller resources. So the create_association thread can be running in parallel with the error_recovery thread. What was seen was the LLDD received a call to delete a queue, causing the LLDD to do a free of a resource, then the transport called the delete queue again causing the driver to repeat the free call. The second free routine corrupted the allocator. The transport shouldn't be making the duplicate call, and the delete queue is just one of the resources being freed. To fix, it is realized that the create_association path is completely serialized with one command at a time. So the failed io completion will always be seen by the create_association path and as of the failure, there are no ios to terminate and there is no reason to be manipulating queue freeze states, etc. The serialized condition stays true until the controller is transitioned to the LIVE state. Thus the fix is to change the error recovery path to check the controller state and only invoke the teardown path if not already in the CONNECTING state. Reviewed-by: Himanshu Madhani Reviewed-by: Ewan D. Milne Signed-off-by: James Smart Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index d567035571bf..1875f6b8a907 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2894,10 +2894,22 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) static void __nvme_fc_terminate_io(struct nvme_fc_ctrl *ctrl) { - nvme_stop_keep_alive(&ctrl->ctrl); + /* + * if state is connecting - the error occurred as part of a + * reconnect attempt. The create_association error paths will + * clean up any outstanding io. + * + * if it's a different state - ensure all pending io is + * terminated. Given this can delay while waiting for the + * aborted io to return, we recheck adapter state below + * before changing state. + */ + if (ctrl->ctrl.state != NVME_CTRL_CONNECTING) { + nvme_stop_keep_alive(&ctrl->ctrl); - /* will block will waiting for io to terminate */ - nvme_fc_delete_association(ctrl); + /* will block will waiting for io to terminate */ + nvme_fc_delete_association(ctrl); + } if (ctrl->ctrl.state != NVME_CTRL_CONNECTING && !nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) From patchwork Tue Jan 7 20:53:34 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: 234309 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 2624CC33C9B for ; Tue, 7 Jan 2020 21:17:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBED42080A for ; Tue, 7 Jan 2020 21:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431858; bh=0FPrfAYWfgPDqfXViR1QyGsDfKHNqmkdGpwuoIeIgPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tNma9Y+LC8SwSJASWiF8w6vzRFO/HkDKvn+HQeEBHBZLvd9aYCubCWEbn/jFmzV4/ 8R0i4IKiCHkuNvAACao9VCfmsp/zhwCdWGpuOPZSQ21O1Bgjt3uw/QYRygcrjtqR2I qJHv/pYGIfG8E4Rkjxu2van1e3644b/3lT6s1SP8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728219AbgAGVRg (ORCPT ); Tue, 7 Jan 2020 16:17:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:52760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729288AbgAGVFl (ORCPT ); Tue, 7 Jan 2020 16:05:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 942C92187F; Tue, 7 Jan 2020 21:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431141; bh=0FPrfAYWfgPDqfXViR1QyGsDfKHNqmkdGpwuoIeIgPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlEMdEeg2bpMB1SI8f2hkqlWRGEXRV7Yz/owQWaWZIqHCz6Fu5zo2pbIo+JtGZOwr KI2FPOzJmixd1SVeXwuT0oMgk84guxclNHNMyQoUn9dRj3MGuWl6uzJwKvSUpp3vso N14CCJxWmhdELmC/NCIeiFBOoRN9ELiW+S38eL6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Eric Pelloux-Prayer , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 004/115] drm/amdgpu: add cache flush workaround to gfx8 emit_fence Date: Tue, 7 Jan 2020 21:53:34 +0100 Message-Id: <20200107205243.168256216@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pierre-Eric Pelloux-Prayer [ Upstream commit bf26da927a1cd57c9deb2db29ae8cf276ba8b17b ] The same workaround is used for gfx7. Both PAL and Mesa use it for gfx8 too, so port this commit to gfx_v8_0_ring_emit_fence_gfx. Signed-off-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 5a9534a82d40..e1cb7fa89e4d 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -6405,7 +6405,23 @@ static void gfx_v8_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr, bool write64bit = flags & AMDGPU_FENCE_FLAG_64BIT; bool int_sel = flags & AMDGPU_FENCE_FLAG_INT; - /* EVENT_WRITE_EOP - flush caches, send int */ + /* Workaround for cache flush problems. First send a dummy EOP + * event down the pipe with seq one below. + */ + amdgpu_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); + amdgpu_ring_write(ring, (EOP_TCL1_ACTION_EN | + EOP_TC_ACTION_EN | + EOP_TC_WB_ACTION_EN | + EVENT_TYPE(CACHE_FLUSH_AND_INV_TS_EVENT) | + EVENT_INDEX(5))); + amdgpu_ring_write(ring, addr & 0xfffffffc); + amdgpu_ring_write(ring, (upper_32_bits(addr) & 0xffff) | + DATA_SEL(1) | INT_SEL(0)); + amdgpu_ring_write(ring, lower_32_bits(seq - 1)); + amdgpu_ring_write(ring, upper_32_bits(seq - 1)); + + /* Then send the real EOP event down the pipe: + * EVENT_WRITE_EOP - flush caches, send int */ amdgpu_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); amdgpu_ring_write(ring, (EOP_TCL1_ACTION_EN | EOP_TC_ACTION_EN | @@ -7154,7 +7170,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { 5 + /* COND_EXEC */ 7 + /* PIPELINE_SYNC */ VI_FLUSH_GPU_TLB_NUM_WREG * 5 + 9 + /* VM_FLUSH */ - 8 + /* FENCE for VM_FLUSH */ + 12 + /* FENCE for VM_FLUSH */ 20 + /* GDS switch */ 4 + /* double SWITCH_BUFFER, the first COND_EXEC jump to the place just @@ -7166,7 +7182,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { 31 + /* DE_META */ 3 + /* CNTX_CTRL */ 5 + /* HDP_INVL */ - 8 + 8 + /* FENCE x2 */ + 12 + 12 + /* FENCE x2 */ 2, /* SWITCH_BUFFER */ .emit_ib_size = 4, /* gfx_v8_0_ring_emit_ib_gfx */ .emit_ib = gfx_v8_0_ring_emit_ib_gfx, From patchwork Tue Jan 7 20:53: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: 234295 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 6F6D3C282DD for ; Tue, 7 Jan 2020 21:20:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43D022081E for ; Tue, 7 Jan 2020 21:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432044; bh=mCIsjUFYY2CU44Xl8pU6vMBNjhgSTJO5tIurYnrLIR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bjWLAHpzNgv1Bn16vuPfVmuUNiRqbqIBVNmyjtKmwYKgOJPckPQfUMnXAF1x9nelA HWsKoFh7kzNRVPLCX6GSm8Jj4Wo93mM0OgxJ/1vdtLqXOPwOa+Odouvx5vMi9TCVIi N+iLiZrXE4RCmZLxf48PcNpR/lWfynHaBIyhumXk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729021AbgAGVEK (ORCPT ); Tue, 7 Jan 2020 16:04:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:47814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729017AbgAGVEJ (ORCPT ); Tue, 7 Jan 2020 16:04:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 98D0B214D8; Tue, 7 Jan 2020 21:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431049; bh=mCIsjUFYY2CU44Xl8pU6vMBNjhgSTJO5tIurYnrLIR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UXHTxnOIusN5xaBDevXtOxTYaSlOqfLT2ifccHPn7N523ERu5vEDmJrEZNi2oJrNv 3/5zG0KNP+sm/z+6XtBaf8lVjWKKUFMCbFyhdfcl8ZdoY9TEWDFczcBcT0QfAYn6dS 3KStxHRjbbZrtO/h5nCrd0eaqJx0OYMOR7sYtanQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Galiffi , Tony Cheng , Leo Li , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 005/115] drm/amd/display: Fixed kernel panic when booting with DP-to-HDMI dongle Date: Tue, 7 Jan 2020 21:53:35 +0100 Message-Id: <20200107205243.329934126@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: David Galiffi [ Upstream commit a51d9f8fe756beac51ce26ef54195da00a260d13 ] [Why] In dc_link_is_dp_sink_present, if dal_ddc_open fails, then dal_gpio_destroy_ddc is called, destroying pin_data and pin_clock. They are created only on dc_construct, and next aux access will cause a panic. [How] Instead of calling dal_gpio_destroy_ddc, call dal_ddc_close. Signed-off-by: David Galiffi Reviewed-by: Tony Cheng Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index c6f7c1344a9b..2f42964fb9f4 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -348,7 +348,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) if (GPIO_RESULT_OK != dal_ddc_open( ddc, GPIO_MODE_INPUT, GPIO_DDC_CONFIG_TYPE_MODE_I2C)) { - dal_gpio_destroy_ddc(&ddc); + dal_ddc_close(ddc); return present; } From patchwork Tue Jan 7 20:53:36 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: 234299 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 67BE5C33C9E for ; Tue, 7 Jan 2020 21:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B9392072A for ; Tue, 7 Jan 2020 21:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432014; bh=K6qFoREykGJFoc/Aoj3Zglo1X/aJfmJ1fO2jT4Fg6RA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZmW4SXE88UQ4PFybJYWbhWjb8m9YQbVhYMXyzY2WdVyXFdfg3zC9OsKBUFfIDkPi2 xg3/HVjXTiM2AwkJ5pC2+QsRvWAnaGleAy2JKrccIL38kQppN1GGGyKbr0NSuI+G/f kgJ5sq8tUHl059NEVQEowKMV07oxVNNZLQDCUV4U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729050AbgAGVEi (ORCPT ); Tue, 7 Jan 2020 16:04:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:49140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728793AbgAGVEg (ORCPT ); Tue, 7 Jan 2020 16:04:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 25429214D8; Tue, 7 Jan 2020 21:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431075; bh=K6qFoREykGJFoc/Aoj3Zglo1X/aJfmJ1fO2jT4Fg6RA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bt58oaiLyWfAugV9fmVcQpUVPr1he6JiyIpf5+WA/bf7JjtBcACPSQpj0lZc9X9uD rweWfiB72VuHtJJch6mvXltPW4r+O8nuIHSjQUq6d2DBFldV/TrRS7XAo6c2Cxe1yK 1f+x1zxYClssWSOHMOAZZwMRV4T8cJZ2RO5Hb4F0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Jacopo Mondi , Wolfram Sang , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.19 006/115] iio: adc: max9611: Fix too short conversion time delay Date: Tue, 7 Jan 2020 21:53:36 +0100 Message-Id: <20200107205243.776152935@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 9fd229c478fbf77c41c8528aa757ef14210365f6 ] As of commit b9ddd5091160793e ("iio: adc: max9611: Fix temperature reading in probe"), max9611 initialization sometimes fails on the Salvator-X(S) development board with: max9611 4-007f: Invalid value received from ADC 0x8000: aborting max9611: probe of 4-007f failed with error -5 The max9611 driver tests communications with the chip by reading the die temperature during the probe function, which returns an invalid value. According to the datasheet, the typical ADC conversion time is 2 ms, but no minimum or maximum values are provided. Maxim Technical Support confirmed this was tested with temperature Ta=25 degreeC, and promised to inform me if a maximum/minimum value is available (they didn't get back to me, so I assume it is not). However, the driver assumes a 1 ms conversion time. Usually the usleep_range() call returns after more than 1.8 ms, hence it succeeds. When it returns earlier, the data register may be read too early, and the previous measurement value will be returned. After boot, this is the temperature POR (power-on reset) value, causing the failure above. Fix this by increasing the delay from 1000-2000 µs to 3000-3300 µs. Note that this issue has always been present, but it was exposed by the aformentioned commit. Fixes: 69780a3bbc0b1e7e ("iio: adc: Add Maxim max9611 ADC driver") Signed-off-by: Geert Uytterhoeven Reviewed-by: Jacopo Mondi Reviewed-by: Wolfram Sang Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/max9611.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c index 0884435eec68..9f1a5ef0b444 100644 --- a/drivers/iio/adc/max9611.c +++ b/drivers/iio/adc/max9611.c @@ -92,6 +92,12 @@ #define MAX9611_TEMP_SCALE_NUM 1000000 #define MAX9611_TEMP_SCALE_DIV 2083 +/* + * Conversion time is 2 ms (typically) at Ta=25 degreeC + * No maximum value is known, so play it safe. + */ +#define MAX9611_CONV_TIME_US_RANGE 3000, 3300 + struct max9611_dev { struct device *dev; struct i2c_client *i2c_client; @@ -239,11 +245,9 @@ static int max9611_read_single(struct max9611_dev *max9611, return ret; } - /* - * need a delay here to make register configuration - * stabilize. 1 msec at least, from empirical testing. - */ - usleep_range(1000, 2000); + /* need a delay here to make register configuration stabilize. */ + + usleep_range(MAX9611_CONV_TIME_US_RANGE); ret = i2c_smbus_read_word_swapped(max9611->i2c_client, reg_addr); if (ret < 0) { @@ -510,7 +514,7 @@ static int max9611_init(struct max9611_dev *max9611) MAX9611_REG_CTRL2, 0); return ret; } - usleep_range(1000, 2000); + usleep_range(MAX9611_CONV_TIME_US_RANGE); return 0; } From patchwork Tue Jan 7 20:53: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: 234304 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 065E7C33C9B for ; Tue, 7 Jan 2020 21:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7E5920880 for ; Tue, 7 Jan 2020 21:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431922; bh=mEoiRRRiyvq4fUVlCBdBtBnEX8SFrQs/gQdcwaGPweI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=v7JvuBcFf7yM9RXC0xXNmRcYX1XDcuXyDx6cYu5ElI3jaT8JkIXpCCoW7KBIeWT7f HDGPJJyLLIohKg3er67SWCJEA3EZipNDOXJ0l3Q+fnwBKXEjU5UAm4zZKhMYtev0IV q2DYqSrwBCpAkF35X6sYBOhpmj06NTzykEpfnu6w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbgAGVSk (ORCPT ); Tue, 7 Jan 2020 16:18:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:50668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728779AbgAGVFC (ORCPT ); Tue, 7 Jan 2020 16:05:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 C99612081E; Tue, 7 Jan 2020 21:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431102; bh=mEoiRRRiyvq4fUVlCBdBtBnEX8SFrQs/gQdcwaGPweI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ije/gydtrKl3RjGz6f8LarjkIGtEx6xuLNfralKq9tDxT5XygDfEPS3KwqJQ9db2P e4ki38WSmgoWT21s0k33KEP19heGV4/CEsrmScoOTlsm7kR1SeFZSAkl5l7MoQ1neg SbiCSWNbN9xWF4stgHIPfhMg6VXVSoqKUBU/S8s0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonard Crestez , Matthias Kaehlcke , Chanwoo Choi , Sasha Levin Subject: [PATCH 4.19 007/115] PM / devfreq: Fix devfreq_notifier_call returning errno Date: Tue, 7 Jan 2020 21:53:37 +0100 Message-Id: <20200107205244.929267818@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leonard Crestez [ Upstream commit e876e710ede23f670494331e062d643928e4142a ] Notifier callbacks shouldn't return negative errno but one of the NOTIFY_OK/DONE/BAD values. The OPP core will ignore return values from notifiers but returning a value that matches NOTIFY_STOP_MASK will stop the notification chain. Fix by always returning NOTIFY_OK. Signed-off-by: Leonard Crestez Reviewed-by: Matthias Kaehlcke Reviewed-by: Chanwoo Choi Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin --- drivers/devfreq/devfreq.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 61fbaa89d7b4..34e297f28fc2 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -538,26 +538,28 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type, void *devp) { struct devfreq *devfreq = container_of(nb, struct devfreq, nb); - int ret; + int err = -EINVAL; mutex_lock(&devfreq->lock); devfreq->scaling_min_freq = find_available_min_freq(devfreq); - if (!devfreq->scaling_min_freq) { - mutex_unlock(&devfreq->lock); - return -EINVAL; - } + if (!devfreq->scaling_min_freq) + goto out; devfreq->scaling_max_freq = find_available_max_freq(devfreq); - if (!devfreq->scaling_max_freq) { - mutex_unlock(&devfreq->lock); - return -EINVAL; - } + if (!devfreq->scaling_max_freq) + goto out; + + err = update_devfreq(devfreq); - ret = update_devfreq(devfreq); +out: mutex_unlock(&devfreq->lock); + if (err) + dev_err(devfreq->dev.parent, + "failed to update frequency from OPP notifier (%d)\n", + err); - return ret; + return NOTIFY_OK; } /** From patchwork Tue Jan 7 20:53: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: 234383 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 08A55C282DD for ; Tue, 7 Jan 2020 21:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFF3F2081E for ; Tue, 7 Jan 2020 21:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431131; bh=7kPznYzqtayJVQHLaku8IUSKqBs1rqufABhn1E8deZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EfM+cqCEIATPB8RzLe6aExvMrWQnTAYJjhP2Lt+fAtHEjTLo2OED2EO3QIEwuXDVw HgoEGNkBmtQV2xz8RkiGvj+YCpqOyazI53dRR7tFnbZA9vq+5/wYhXv1G3wtXqbeeX bAI02aFpjQC/tsNzt5g7NPGXYRJybws5noynV6PM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729242AbgAGVFa (ORCPT ); Tue, 7 Jan 2020 16:05:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:52060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729231AbgAGVF3 (ORCPT ); Tue, 7 Jan 2020 16:05:29 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 586AA2081E; Tue, 7 Jan 2020 21:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431128; bh=7kPznYzqtayJVQHLaku8IUSKqBs1rqufABhn1E8deZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqcwXwE6OuaQf4hpm0dubuQ+orxz2wf/QfcPfP1pgFWgBJsLVMboGhsnxQNZ/IGb3 Kl38GfRhHJGOc9G01G8wl5mok6Nra3wMiubGNwLOBPNVfA15jKFfgh5GBRNGw1K8ne M+kyC3RSNx17g9pUai851jPwfYn1bNrNryJ14tQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonard Crestez , Matthias Kaehlcke , Chanwoo Choi , Sasha Levin Subject: [PATCH 4.19 009/115] PM / devfreq: Dont fail devfreq_dev_release if not in list Date: Tue, 7 Jan 2020 21:53:39 +0100 Message-Id: <20200107205245.424260862@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leonard Crestez [ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ] Right now devfreq_dev_release will print a warning and abort the rest of the cleanup if the devfreq instance is not part of the global devfreq_list. But this is a valid scenario, for example it can happen if the governor can't be found or on any other init error that happens after device_register. Initialize devfreq->node to an empty list head in devfreq_add_device so that list_del becomes a safe noop inside devfreq_dev_release and we can continue the rest of the cleanup. Signed-off-by: Leonard Crestez Reviewed-by: Matthias Kaehlcke Reviewed-by: Chanwoo Choi Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin --- drivers/devfreq/devfreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index a47e76a62287..69bbb1e9ab23 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -575,11 +575,6 @@ static void devfreq_dev_release(struct device *dev) struct devfreq *devfreq = to_devfreq(dev); mutex_lock(&devfreq_list_lock); - if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) { - mutex_unlock(&devfreq_list_lock); - dev_warn(&devfreq->dev, "releasing devfreq which doesn't exist\n"); - return; - } list_del(&devfreq->node); mutex_unlock(&devfreq_list_lock); @@ -634,6 +629,7 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->dev.parent = dev; devfreq->dev.class = devfreq_class; devfreq->dev.release = devfreq_dev_release; + INIT_LIST_HEAD(&devfreq->node); devfreq->profile = profile; strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); devfreq->previous_freq = profile->initial_freq; From patchwork Tue Jan 7 20:53: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: 234308 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 833D2C33C9B for ; Tue, 7 Jan 2020 21:17:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54D1D2077B for ; Tue, 7 Jan 2020 21:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431874; bh=V1Q3Xuf3lHcY7QWN+8zhItJkKgV8hQvAWN7NdTrbQeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=znARRRuT9zx015X+XdXmbBBwTm4b6ztI2ztIHA/Xr6Pn/lqOQ/rrNNVr6ptZsn4e9 IHxqTISql+yrTiEAyiY2Un3Xb6W3ZnyQSdxpXcrXfJv7E1eVSWVZYQJGBR4N6ehI/J hkz12sc7bViWkc7TkLGId4+PhhVK7Comp3kvLERA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728624AbgAGVRs (ORCPT ); Tue, 7 Jan 2020 16:17:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:52460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729257AbgAGVFg (ORCPT ); Tue, 7 Jan 2020 16:05:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 8C7DB2081E; Tue, 7 Jan 2020 21:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431136; bh=V1Q3Xuf3lHcY7QWN+8zhItJkKgV8hQvAWN7NdTrbQeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C1u6ojmKIBVd1lhLhLoes5yurgXlSw7FamyNSOJsnMqSUl5Fu3O006FTRKoqOrRle 3IWaWHqz54uSuGDr+bS+Jdff9pZ3xR6PXjWhmqfPnIQZrLJp2t+0Po4oVSkczTmujU hdeI9HEf9DTfTFQD3nYED0FMRasAO8d1nA044MEo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Parav Pandit , Doug Ledford , Sasha Levin Subject: [PATCH 4.19 012/115] RDMA/cma: add missed unregister_pernet_subsys in init failure Date: Tue, 7 Jan 2020 21:53:42 +0100 Message-Id: <20200107205247.577554699@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chuhong Yuan [ Upstream commit 44a7b6759000ac51b92715579a7bba9e3f9245c2 ] The driver forgets to call unregister_pernet_subsys() in the error path of cma_init(). Add the missed call to fix it. Fixes: 4be74b42a6d0 ("IB/cma: Separate port allocation to network namespaces") Signed-off-by: Chuhong Yuan Reviewed-by: Parav Pandit Link: https://lore.kernel.org/r/20191206012426.12744-1-hslester96@gmail.com Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/core/cma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 1f373ba573b6..319bfef00a4a 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -4658,6 +4658,7 @@ static int __init cma_init(void) err: unregister_netdevice_notifier(&cma_nb); ib_sa_unregister_client(&sa_client); + unregister_pernet_subsys(&cma_pernet_operations); err_wq: destroy_workqueue(cma_wq); return ret; From patchwork Tue Jan 7 20:53:45 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: 234296 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 AD45CC33C9B for ; Tue, 7 Jan 2020 21:20:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AB752072A for ; Tue, 7 Jan 2020 21:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432038; bh=4tMV4Id3RxV0FDgukzjlM9Vz9xgkrFl0MLncXahA350=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AI2tenT76AFxgnRq0GNZ78M/JPPcEff4/vAVu/b3OX78uvR+cMV8NwIxPhaL3hZuw BGvaptkh6DOY+O2prkZ79cENOIaSkcMv0Fx3fGiY3Oob23iE7ECzc/r6s8lfpRf7K5 4DpfAvodwC7bPTHKTuf8bNLeyS93LsY+Sa8kfwsw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727709AbgAGVUd (ORCPT ); Tue, 7 Jan 2020 16:20:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:48044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729030AbgAGVEO (ORCPT ); Tue, 7 Jan 2020 16:04:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 613F92187F; Tue, 7 Jan 2020 21:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431053; bh=4tMV4Id3RxV0FDgukzjlM9Vz9xgkrFl0MLncXahA350=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZE5H35nV8ViYXQ62pJN6OKYcu6NlYwnhlQ2IlMVhjaEloG3qSyUAm9Tnac9uKeB5 9ouCT3meiG3QHzFXimwJCf/KHx8KTAKdv/dy/jqoYJplZ0D8/hs0WUVhMfP2n2lJhy pLrpYESN/nl5JRWwpzKACXdI2+G9dnmLTMCYleFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Himanshu Madhani , Hannes Reinecke , Bart Van Assche , Roman Bolshakov , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 015/115] scsi: qla2xxx: Drop superfluous INIT_WORK of del_work Date: Tue, 7 Jan 2020 21:53:45 +0100 Message-Id: <20200107205249.773080125@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roman Bolshakov [ Upstream commit 600954e6f2df695434887dfc6a99a098859990cf ] del_work is already initialized inside qla2x00_alloc_fcport, there's no need to overwrite it. Indeed, it might prevent complete traversal of workqueue list. Fixes: a01c77d2cbc45 ("scsi: qla2xxx: Move session delete to driver work queue") Cc: Quinn Tran Link: https://lore.kernel.org/r/20191125165702.1013-5-r.bolshakov@yadro.com Acked-by: Himanshu Madhani Reviewed-by: Hannes Reinecke Tested-by: Hannes Reinecke Reviewed-by: Bart Van Assche Signed-off-by: Roman Bolshakov Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_target.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 210ce294038d..8eda55e917e0 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1261,7 +1261,6 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) "Scheduling sess %p for deletion %8phC\n", sess, sess->port_name); - INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); WARN_ON(!queue_work(sess->vha->hw->wq, &sess->del_work)); } From patchwork Tue Jan 7 20:53:47 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: 234297 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 E8532C33C9B for ; Tue, 7 Jan 2020 21:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B730E2077B for ; Tue, 7 Jan 2020 21:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432031; bh=cGFjV24DcR2yn+uYs+DxSEhJh+q+tRW59ozMyCzG6W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1tT54NStKB+fzIdHwc3fP9x2lP8giSW7DzcRKx3Bc17PQzUlGoXT8tMShndMskUNQ 8sDOW08dbmV/mhtGaMaYWz+Fo55y1LNbXp8VXm9tr0NTR9NsbfWDGaWm2rVwXZ0my2 ue6pF3n+7p3lm6Jss2wjhGBBT5VFr4SVmkuJa+Vw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729007AbgAGVU1 (ORCPT ); Tue, 7 Jan 2020 16:20:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:48270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728579AbgAGVET (ORCPT ); Tue, 7 Jan 2020 16:04:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 37E2320880; Tue, 7 Jan 2020 21:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431058; bh=cGFjV24DcR2yn+uYs+DxSEhJh+q+tRW59ozMyCzG6W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FFdx/TrklTgxGWEAgNI6c2uuCbSyn+a6kixdkrIzhZUd5nPKhZQbBcUhuPoyB5gsp 5gnnKWhUkxE6a2ePH44cCaOzxRoc9UYSRs66s3m97G5WSEPV4T9I/aJqxdaf/76dUn rKHFFda7QuBDGxDfyzONkvNexoVqWgH1tW5g0mlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Himanshu Madhani , Hannes Reinecke , Roman Bolshakov , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 017/115] scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length Date: Tue, 7 Jan 2020 21:53:47 +0100 Message-Id: <20200107205250.739117298@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roman Bolshakov [ Upstream commit 0334cdea1fba36fad8bdf9516f267ce01de625f7 ] The size of the buffer is hardcoded as 0x70 or 112 bytes, while the size of ELS IOCB is 0x40 and the size of PLOGI payload returned by Get Parameters command is 0x74. Cc: Quinn Tran Link: https://lore.kernel.org/r/20191125165702.1013-9-r.bolshakov@yadro.com Acked-by: Himanshu Madhani Reviewed-by: Hannes Reinecke Tested-by: Hannes Reinecke Signed-off-by: Roman Bolshakov Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_iocb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index c699bbb8485b..7e47321e003c 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2537,7 +2537,8 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3073, "PLOGI ELS IOCB:\n"); ql_dump_buffer(ql_log_info, vha, 0x0109, - (uint8_t *)els_iocb, 0x70); + (uint8_t *)els_iocb, + sizeof(*els_iocb)); } else { els_iocb->tx_byte_count = sizeof(struct els_logo_payload); els_iocb->tx_address[0] = @@ -2703,7 +2704,8 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3073, "PLOGI buffer:\n"); ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x0109, - (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, 0x70); + (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, + sizeof(*elsio->u.els_plogi.els_plogi_pyld)); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { From patchwork Tue Jan 7 20:53:49 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: 234387 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 78C0EC282DD for ; Tue, 7 Jan 2020 21:04:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D255214D8 for ; Tue, 7 Jan 2020 21:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431065; bh=uC+QLzBMiSo2zy/Qp/KYlZZxIGvBdlhLhbjUGsv0+uY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=R/i1Ao7oKxHIb+10pk1D0qRrUKA3GAT4Lnofm7SDeAt6W8/g7BLNogfevRG98hcbZ D+BTuKsoWHv84kA8s3YwKlxklLUJ+FWpQQmoi7fG2dstb/3yGnyN6gHxvy3vBS4tqL l4rnnsEBdPvLLGJlzJHHXwn3mKfVySVuWgxx+Spo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728850AbgAGVEY (ORCPT ); Tue, 7 Jan 2020 16:04:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:48534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728569AbgAGVEX (ORCPT ); Tue, 7 Jan 2020 16:04:23 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 04AE820880; Tue, 7 Jan 2020 21:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431063; bh=uC+QLzBMiSo2zy/Qp/KYlZZxIGvBdlhLhbjUGsv0+uY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wn2zMSV0k8JXjqyUGB3yQYdZOspqo7NnFCOjhvi3YkZMXtXRIg+BTN0jT/wq62H5T DKkJ11Lf9YY80lMCsZL7NzM1gtYH8c/40LO6pSZwh1mcxiKZKy8G3JCbRmlbQiHMbt xDlJtI0oWYpVYaZKEo9bBIoRFWz5puZ75VcELeh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krishna Kant , Alexei Potashnik , Quinn Tran , Himanshu Madhani , Hannes Reinecke , Roman Bolshakov , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 019/115] scsi: qla2xxx: Send Notify ACK after N2N PLOGI Date: Tue, 7 Jan 2020 21:53:49 +0100 Message-Id: <20200107205253.870588539@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roman Bolshakov [ Upstream commit 5e6b01d84b9d20bcd77fc7c4733a2a4149bf220a ] qlt_handle_login schedules session for deletion even if a login is in progress. That causes login bouncing, i.e. a few logins are made before it settles down. Complete the first login by sending Notify Acknowledge IOCB via qlt_plogi_ack_unref if the session is pending login completion. Fixes: 9cd883f07a54 ("scsi: qla2xxx: Fix session cleanup for N2N") Cc: Krishna Kant Cc: Alexei Potashnik Link: https://lore.kernel.org/r/20191125165702.1013-11-r.bolshakov@yadro.com Acked-by: Quinn Tran Acked-by: Himanshu Madhani Reviewed-by: Hannes Reinecke Tested-by: Hannes Reinecke Signed-off-by: Roman Bolshakov Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_target.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 8eda55e917e0..e9545411ec5a 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -4779,6 +4779,7 @@ static int qlt_handle_login(struct scsi_qla_host *vha, switch (sess->disc_state) { case DSC_DELETED: + case DSC_LOGIN_PEND: qlt_plogi_ack_unref(vha, pla); break; From patchwork Tue Jan 7 20:53:50 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: 234298 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 962A0C33C9B for ; Tue, 7 Jan 2020 21:20:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 684642077B for ; Tue, 7 Jan 2020 21:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432021; bh=2fEuL8DFvNY9pTqPEb9r5kTK2censwIs22wtuyMPziw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aY+7iW0bEIhuOsa/vCM4vFYS0WijyIV7rYbqnBdYhOvC5XQyCYg0my/CZirOizLtn SJDg9mWowZPkqSuuPO3J5EtJfPfyGwORRbMf+i1s2O3I6Zm/yj4PS+fTlziHRTDAfR kmrG5phg29KB6vF5CVqMRGQ1Ct4YGSQhcQACe77U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbgAGVE0 (ORCPT ); Tue, 7 Jan 2020 16:04:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:48666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728691AbgAGVE0 (ORCPT ); Tue, 7 Jan 2020 16:04:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 6B26924676; Tue, 7 Jan 2020 21:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431065; bh=2fEuL8DFvNY9pTqPEb9r5kTK2censwIs22wtuyMPziw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qVUICVKMGWXgHT8yHQ5EF13qwh7vzgeay2OeFVZhRorMe0ovdOPbWHD6OUrrOz5IC oElC6CoS172udfYqs2D30cWn5RbAElhna0Ra9DREt3o8dHKW8fZVBII2aQexidmdwC PPkCVLXoEfevTAdcC1n1y6fuC5PZUJEOekzrQx5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Himanshu Madhani , Hannes Reinecke , Roman Bolshakov , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 020/115] scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI Date: Tue, 7 Jan 2020 21:53:50 +0100 Message-Id: <20200107205254.170962810@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roman Bolshakov [ Upstream commit af22f0c7b052c5c203207f1e5ebd6aa65f87c538 ] PORT UPDATE asynchronous event is generated on the host that issues PLOGI ELS (in the case of higher WWPN). In that case, the event shouldn't be handled as it sets unwanted DPC flags (i.e. LOOP_RESYNC_NEEDED) that trigger link flap. Ignore the event if the host has higher WWPN, but handle otherwise. Cc: Quinn Tran Link: https://lore.kernel.org/r/20191125165702.1013-13-r.bolshakov@yadro.com Acked-by: Himanshu Madhani Reviewed-by: Hannes Reinecke Tested-by: Hannes Reinecke Signed-off-by: Roman Bolshakov Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_mbx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index b01f69dd4b28..abef3b29fa10 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3871,6 +3871,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, vha->d_id.b24 = 0; vha->d_id.b.al_pa = 1; ha->flags.n2n_bigger = 1; + ha->flags.n2n_ae = 0; id.b.al_pa = 2; ql_dbg(ql_dbg_async, vha, 0x5075, @@ -3881,6 +3882,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, "Format 1: Remote login - Waiting for WWPN %8phC.\n", rptid_entry->u.f1.port_name); ha->flags.n2n_bigger = 0; + ha->flags.n2n_ae = 1; } qla24xx_post_newsess_work(vha, &id, rptid_entry->u.f1.port_name, @@ -3892,7 +3894,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, /* if our portname is higher then initiate N2N login */ set_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags); - ha->flags.n2n_ae = 1; return; break; case TOPO_FL: From patchwork Tue Jan 7 20:53:53 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: 234300 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 36BB4C33C9B for ; Tue, 7 Jan 2020 21:20:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0693F2072A for ; Tue, 7 Jan 2020 21:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432010; bh=KK+5yYKzMqfExUm1Q7OA2DXas8OiqEY0Rb4BgmOYD/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=S61JL0IDz0zbqJTxb1t9Twjq86A0JMXGBVLQM2zwITiRZamlnCuw86F7EU7S6rkPE ph30GI/7Pfc0wbT/ZxTK80pFEV50N8SHdNomkKaHUh/p22+lAQ3ifJ8QligbtQlEAA 9SWgK+4LdSKNALholjIMZJ3uOtDfzn1eOXZukl58= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729058AbgAGVEi (ORCPT ); Tue, 7 Jan 2020 16:04:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:48994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729049AbgAGVEe (ORCPT ); Tue, 7 Jan 2020 16:04:34 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 AE2C82081E; Tue, 7 Jan 2020 21:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431073; bh=KK+5yYKzMqfExUm1Q7OA2DXas8OiqEY0Rb4BgmOYD/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gWhNbH/KGzRNnUF4YOmpt/HjDBURs2W6rM4qLyb37fGZyjL0lWiG5PTWT+oUJ4VRn LqFKhl8Aor4mQorD8B3oOBVXI/aZgg4vMILe/qv+NwW4M7lQdKBvHzElqbD9CxOwcZ TYHKJBkFfxi9kwIPK71fJDmJZfdX2Oaf1wrX8Iu8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Lyude Paul , Ben Skeggs , Sasha Levin Subject: [PATCH 4.19 023/115] drm/nouveau: Move the declaration of struct nouveau_conn_atom up a bit Date: Tue, 7 Jan 2020 21:53:53 +0100 Message-Id: <20200107205255.976508438@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hans de Goede [ Upstream commit 37a68eab4cd92b507c9e8afd760fdc18e4fecac6 ] Place the declaration of struct nouveau_conn_atom above that of struct nouveau_connector. This commit makes no changes to the moved block what so ever, it just moves it up a bit. This is a preparation patch to fix some issues with connector handling on pre nv50 displays (which do not use atomic modesetting). Signed-off-by: Hans de Goede Reviewed-by: Lyude Paul Signed-off-by: Ben Skeggs Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_connector.h | 110 ++++++++++---------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h index dc7454e7f19a..b46e99f7641e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.h +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h @@ -29,6 +29,7 @@ #include +#include #include #include #include @@ -37,6 +38,60 @@ struct nvkm_i2c_port; +#define nouveau_conn_atom(p) \ + container_of((p), struct nouveau_conn_atom, state) + +struct nouveau_conn_atom { + struct drm_connector_state state; + + struct { + /* The enum values specifically defined here match nv50/gf119 + * hw values, and the code relies on this. + */ + enum { + DITHERING_MODE_OFF = 0x00, + DITHERING_MODE_ON = 0x01, + DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, + DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, + DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, + DITHERING_MODE_AUTO + } mode; + enum { + DITHERING_DEPTH_6BPC = 0x00, + DITHERING_DEPTH_8BPC = 0x02, + DITHERING_DEPTH_AUTO + } depth; + } dither; + + struct { + int mode; /* DRM_MODE_SCALE_* */ + struct { + enum { + UNDERSCAN_OFF, + UNDERSCAN_ON, + UNDERSCAN_AUTO, + } mode; + u32 hborder; + u32 vborder; + } underscan; + bool full; + } scaler; + + struct { + int color_vibrance; + int vibrant_hue; + } procamp; + + union { + struct { + bool dither:1; + bool scaler:1; + bool procamp:1; + }; + u8 mask; + } set; +}; + struct nouveau_connector { struct drm_connector base; enum dcb_connector_type type; @@ -111,61 +166,6 @@ extern int nouveau_ignorelid; extern int nouveau_duallink; extern int nouveau_hdmimhz; -#include -#define nouveau_conn_atom(p) \ - container_of((p), struct nouveau_conn_atom, state) - -struct nouveau_conn_atom { - struct drm_connector_state state; - - struct { - /* The enum values specifically defined here match nv50/gf119 - * hw values, and the code relies on this. - */ - enum { - DITHERING_MODE_OFF = 0x00, - DITHERING_MODE_ON = 0x01, - DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, - DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, - DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, - DITHERING_MODE_AUTO - } mode; - enum { - DITHERING_DEPTH_6BPC = 0x00, - DITHERING_DEPTH_8BPC = 0x02, - DITHERING_DEPTH_AUTO - } depth; - } dither; - - struct { - int mode; /* DRM_MODE_SCALE_* */ - struct { - enum { - UNDERSCAN_OFF, - UNDERSCAN_ON, - UNDERSCAN_AUTO, - } mode; - u32 hborder; - u32 vborder; - } underscan; - bool full; - } scaler; - - struct { - int color_vibrance; - int vibrant_hue; - } procamp; - - union { - struct { - bool dither:1; - bool scaler:1; - bool procamp:1; - }; - u8 mask; - } set; -}; - void nouveau_conn_attach_properties(struct drm_connector *); void nouveau_conn_reset(struct drm_connector *); struct drm_connector_state * From patchwork Tue Jan 7 20:53:56 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: 234301 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 DD98EC33C9B for ; Tue, 7 Jan 2020 21:20:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A58B02072A for ; Tue, 7 Jan 2020 21:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432004; bh=yvSUdJhR7bHfZSJeyF6n2xh+oZ3xjRsEN5JHfOLFMfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nxJwjXdyrUYs0ghM4X7mgLWyZnmUMwdd8Kq0Rr/U22bvkJvV+lP+GR6trKWgEbQeV HwOg2xwjfhR4UKEnQGoiPGD8u4AXEHk6zIsMOrsRACJLcLYI+ttsc48LKMKXUBX6Mp URJZCHKIiJY1MCUoZIYnq2NzrUyeE0+23CzrGXM8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729065AbgAGVEn (ORCPT ); Tue, 7 Jan 2020 16:04:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:49554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729079AbgAGVEn (ORCPT ); Tue, 7 Jan 2020 16:04:43 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 687CF20678; Tue, 7 Jan 2020 21:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431082; bh=yvSUdJhR7bHfZSJeyF6n2xh+oZ3xjRsEN5JHfOLFMfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QgsJ1A/f/ZY9gdICzS8cx3OdJER0eUM9GmyxrbKJPmszBqMh2rZCPfGv1/QmhYujx GCq/QgnKgYx+o0i5XErXdf5GK8M3X7akPhDuEJc7eqmZA6AtVnXEHr1Cmes68reifr gNKWHLuhiZqfHijsbQAYBISIcXkR4g89Jg4S/o6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Marc Dionne , Jonathan Billings , Sasha Levin Subject: [PATCH 4.19 026/115] afs: Fix creation calls in the dynamic root to fail with EOPNOTSUPP Date: Tue, 7 Jan 2020 21:53:56 +0100 Message-Id: <20200107205259.109355598@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: David Howells [ Upstream commit 1da4bd9f9d187f53618890d7b66b9628bbec3c70 ] Fix the lookup method on the dynamic root directory such that creation calls, such as mkdir, open(O_CREAT), symlink, etc. fail with EOPNOTSUPP rather than failing with some odd error (such as EEXIST). lookup() itself tries to create automount directories when it is invoked. These are cached locally in RAM and not committed to storage. Signed-off-by: David Howells Reviewed-by: Marc Dionne Tested-by: Jonathan Billings Signed-off-by: Sasha Levin --- fs/afs/dynroot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c index f29c6dade7f6..069273a2483f 100644 --- a/fs/afs/dynroot.c +++ b/fs/afs/dynroot.c @@ -145,6 +145,9 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr ASSERTCMP(d_inode(dentry), ==, NULL); + if (flags & LOOKUP_CREATE) + return ERR_PTR(-EOPNOTSUPP); + if (dentry->d_name.len >= AFSNAMEMAX) { _leave(" = -ENAMETOOLONG"); return ERR_PTR(-ENAMETOOLONG); From patchwork Tue Jan 7 20:53: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: 234302 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 83BC7C3F68F for ; Tue, 7 Jan 2020 21:19:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 571E02072A for ; Tue, 7 Jan 2020 21:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431987; bh=hNWhhKLpEyLjW7HqyBgu6SklEZFnQ74DzmvMpjq06+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Z60yIivDzlk9Kj548urYcyBd8/S7jJ7hGfuTpEd9ZMBdMP7n5LP3s7uaASGJpHRXe K0Ak+3X4sOCLRGp0z+Q5mc/PbM+bQGxjyelacesUzJ8+tj5Dj9m5FTTA37aSUczIpp Qc3O2d9fU7uxdTty1djJkiNNOGSYK2PsU0S3EMY4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729103AbgAGVEt (ORCPT ); Tue, 7 Jan 2020 16:04:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:49860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729094AbgAGVEs (ORCPT ); Tue, 7 Jan 2020 16:04:48 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 459AB208C4; Tue, 7 Jan 2020 21:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431087; bh=hNWhhKLpEyLjW7HqyBgu6SklEZFnQ74DzmvMpjq06+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZjJsg5rGXB1y5rDmXzIo88rWTfrG/UwM3e69VdffQt/U5VwKf3Xmkzy3LTuAfZ4C VZF1lRt5vowIr7w1FvyC/XP0JH4tsQEmY0T1LQMDPYal2wGJS65O4HgLoO+Yq95Mde NLmeJQJxo+VKYLgpMKsMySXu9sPqTJKQ1nxTnCqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Richter , Vasily Gorbik , Sasha Levin Subject: [PATCH 4.19 028/115] s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits Date: Tue, 7 Jan 2020 21:53:58 +0100 Message-Id: <20200107205300.877535070@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Thomas Richter [ Upstream commit 39d4a501a9ef55c57b51e3ef07fc2aeed7f30b3b ] Function perf_event_ever_overflow() and perf_event_account_interrupt() are called every time samples are processed by the interrupt handler. However function perf_event_account_interrupt() has checks to avoid being flooded with interrupts (more then 1000 samples are received per task_tick). Samples are then dropped and a PERF_RECORD_THROTTLED is added to the perf data. The perf subsystem limit calculation is: maximum sample frequency := 100000 --> 1 samples per 10 us task_tick = 10ms = 10000us --> 1000 samples per task_tick The work flow is measurement_alert() uses SDBT head and each SBDT points to 511 SDB pages, each with 126 sample entries. After processing 8 SBDs and for each valid sample calling: perf_event_overflow() perf_event_account_interrupts() there is a considerable amount of samples being dropped, especially when the sample frequency is very high and near the 100000 limit. To avoid the high amount of samples being dropped near the end of a task_tick time frame, increment the sampling interval in case of dropped events. The CPU Measurement sampling facility on the s390 supports only intervals, specifiing how many CPU cycles have to be executed before a sample is generated. Increase the interval when the samples being generated hit the task_tick limit. Signed-off-by: Thomas Richter Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/perf_cpum_sf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 5c3fd9032b74..0f4957ac81b6 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1273,6 +1273,22 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) if (sampl_overflow) OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) + sampl_overflow, 1 + num_sdb); + + /* Perf_event_overflow() and perf_event_account_interrupt() limit + * the interrupt rate to an upper limit. Roughly 1000 samples per + * task tick. + * Hitting this limit results in a large number + * of throttled REF_REPORT_THROTTLE entries and the samples + * are dropped. + * Slightly increase the interval to avoid hitting this limit. + */ + if (event_overflow) { + SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10); + debug_sprintf_event(sfdbg, 1, "%s: rate adjustment %ld\n", + __func__, + DIV_ROUND_UP(SAMPL_RATE(hwc), 10)); + } + if (sampl_overflow || event_overflow) debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " "overflow stats: sample=%llu event=%llu\n", From patchwork Tue Jan 7 20:54:00 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: 234386 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 F1026C33C9B for ; Tue, 7 Jan 2020 21:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2E6F2081E for ; Tue, 7 Jan 2020 21:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431093; bh=lEY/zFf0tyWfGy/nxIHf5jfmXXYqHFoUkKhKAbPKaZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ur+/1qS+yEVx8r7+5KDRcy7SmD/RXxI0KQyMSSAKak9slsjA5VeNzLzsfvauaPAbF thQD0TJHSIL25Lz/9C1pww2bwuSgOHLJOwkVTw7fbmPBQvrOjwXDQFrD2tFyr7/Lt1 O6DrN3EpFr3acvrrIqSGukuVKrJzeN2k/aJ2CNs4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729130AbgAGVEx (ORCPT ); Tue, 7 Jan 2020 16:04:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:50116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729127AbgAGVEx (ORCPT ); Tue, 7 Jan 2020 16:04:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 22524214D8; Tue, 7 Jan 2020 21:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431092; bh=lEY/zFf0tyWfGy/nxIHf5jfmXXYqHFoUkKhKAbPKaZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eCVKnuExa+0qclsvjjcPuQHCZYAMbAYch5Ju52+FzNhhyHDfMoo/I9xaHNjAj2yfL aSL86NkrOOspzWQII3cIlniv5HuhshKkGYtHEupVauTImNgFvTTAali7Hrd3ivvEkw 2AgAagO1FSHuZBGa9rq1eMFAOuZ9ekonl0Wb9tIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parav Pandit , Maor Gottlieb , Leon Romanovsky , Doug Ledford , Sasha Levin Subject: [PATCH 4.19 030/115] IB/mlx4: Follow mirror sequence of device add during device removal Date: Tue, 7 Jan 2020 21:54:00 +0100 Message-Id: <20200107205301.127959222@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Parav Pandit [ Upstream commit 89f988d93c62384758b19323c886db917a80c371 ] Current code device add sequence is: ib_register_device() ib_mad_init() init_sriov_init() register_netdev_notifier() Therefore, the remove sequence should be, unregister_netdev_notifier() close_sriov() mad_cleanup() ib_unregister_device() However it is not above. Hence, make do above remove sequence. Fixes: fa417f7b520ee ("IB/mlx4: Add support for IBoE") Signed-off-by: Parav Pandit Reviewed-by: Maor Gottlieb Signed-off-by: Leon Romanovsky Link: https://lore.kernel.org/r/20191212091214.315005-3-leon@kernel.org Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx4/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 0bbeaaae47e0..9386bb57b3d7 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -3069,16 +3069,17 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) ibdev->ib_active = false; flush_workqueue(wq); - mlx4_ib_close_sriov(ibdev); - mlx4_ib_mad_cleanup(ibdev); - ib_unregister_device(&ibdev->ib_dev); - mlx4_ib_diag_cleanup(ibdev); if (ibdev->iboe.nb.notifier_call) { if (unregister_netdevice_notifier(&ibdev->iboe.nb)) pr_warn("failure unregistering notifier\n"); ibdev->iboe.nb.notifier_call = NULL; } + mlx4_ib_close_sriov(ibdev); + mlx4_ib_mad_cleanup(ibdev); + ib_unregister_device(&ibdev->ib_dev); + mlx4_ib_diag_cleanup(ibdev); + mlx4_qp_release_range(dev, ibdev->steer_qpn_base, ibdev->steer_qpn_count); kfree(ibdev->ib_uc_qpns_bitmap); From patchwork Tue Jan 7 20:54:01 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: 234303 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 86DD5C33C9B for ; Tue, 7 Jan 2020 21:19:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56E592077B for ; Tue, 7 Jan 2020 21:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431949; bh=vDVEt7Mf+XY6mEu0glb5xopxIm6eAglJTX3TunM2s5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=z4uPJ2X0HuK7UEUitBpY6Hfp85+J+OTXT/9lziZH4M3EO3bNycs2zGzJ2HBkPD6yP 8jL9D3Q9lb2hHfEjS5op03dk3aYcZZmsB03vNLkd0sllko+of3mWycjBGLhafKG/gf HHwhyM0rufl3lZt+qnH3msD3/uwihblVe/WQubEw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728986AbgAGVTF (ORCPT ); Tue, 7 Jan 2020 16:19:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:50244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729146AbgAGVEz (ORCPT ); Tue, 7 Jan 2020 16:04:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 893202081E; Tue, 7 Jan 2020 21:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431095; bh=vDVEt7Mf+XY6mEu0glb5xopxIm6eAglJTX3TunM2s5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QxbrAnFTUN/Px6I+JXnO2flw39AB0kHOXH3HQz8lnWPoyjUIbseZ/x33Y77fMlKn2 Manwsw3t12GkaIpeqp3gd/D0rHtXgXYPXUeHZM/do5eooS+x6VenihMdXo+809ZdPc FAHOvz9Kl9XNn0PCbP30ZlP5dt3fkBJLElEMt3go= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Gottlieb , Raed Salem , Leon Romanovsky , Doug Ledford , Sasha Levin Subject: [PATCH 4.19 031/115] IB/mlx5: Fix steering rule of drop and count Date: Tue, 7 Jan 2020 21:54:01 +0100 Message-Id: <20200107205301.187172110@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Maor Gottlieb [ Upstream commit ed9085fed9d95d5921582e3c8474f3736c5d2782 ] There are two flow rule destinations: QP and packet. While users are setting DROP packet rule, the QP should not be set as a destination. Fixes: 3b3233fbf02e ("IB/mlx5: Add flow counters binding support") Signed-off-by: Maor Gottlieb Reviewed-by: Raed Salem Signed-off-by: Leon Romanovsky Link: https://lore.kernel.org/r/20191212091214.315005-4-leon@kernel.org Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index f4ffdc588ea0..df5be462dd28 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -3286,10 +3286,6 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, } INIT_LIST_HEAD(&handler->list); - if (dst) { - memcpy(&dest_arr[0], dst, sizeof(*dst)); - dest_num++; - } for (spec_index = 0; spec_index < flow_attr->num_of_specs; spec_index++) { err = parse_flow_attr(dev->mdev, spec->match_criteria, @@ -3303,6 +3299,11 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, ib_flow += ((union ib_flow_spec *)ib_flow)->size; } + if (dst && !(flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DROP)) { + memcpy(&dest_arr[0], dst, sizeof(*dst)); + dest_num++; + } + if (!flow_is_multicast_only(flow_attr)) set_underlay_qp(dev, spec, underlay_qpn); @@ -3340,10 +3341,8 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, } if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DROP) { - if (!(flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT)) { + if (!dest_num) rule_dst = NULL; - dest_num = 0; - } } else { if (is_egress) flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_ALLOW; From patchwork Tue Jan 7 20:54:05 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: 234305 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 62E5BC33C9E for ; Tue, 7 Jan 2020 21:18:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3562E2077B for ; Tue, 7 Jan 2020 21:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431908; bh=JSQJpSpeWdGOn3za1FT2blqLBIwU4lLAhJ3G6jHouxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=F6Hw2NhaxrWwKsJ+2988/DVzZQRCbz+G/zLvcX5J5vNGARBDv0BF8FOji+c4FE27Q FIo4D8G2JXV9YElFLrhn31psdf+pyslebJAwmNINfKJ22ILDsOk1P31OP2jYD61I98 jVSWz6/uEoyV0BucoTQPvgMs8Eu9vaNL7ZANZOXo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728228AbgAGVSX (ORCPT ); Tue, 7 Jan 2020 16:18:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:50922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728999AbgAGVFH (ORCPT ); Tue, 7 Jan 2020 16:05:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 CBC8C2081E; Tue, 7 Jan 2020 21:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431107; bh=JSQJpSpeWdGOn3za1FT2blqLBIwU4lLAhJ3G6jHouxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DtBOWMDoi5ovsba8cvby+5RH+ayY2wClTFpSlL+GiYJcmulXNAlZThFBxhtG3aJhW 6ewVv2tnOQLD48HE5cHAb3q5tCnZbSXdVNc2gD0duDMBcmcWmb8JscKzzNlmcb9I6U Rc5bmIYXmBZTdJgMkXIjb9Q004QGpa7DtsHUUUww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kailang Yang , Takashi Iwai , Sasha Levin Subject: [PATCH 4.19 035/115] ALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker Date: Tue, 7 Jan 2020 21:54:05 +0100 Message-Id: <20200107205301.441928404@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kailang Yang [ Upstream commit e79c22695abd3b75a6aecf4ea4b9607e8d82c49c ] Dell has new platform which has dual speaker connecting. They want dual speaker which use same dac for output. Signed-off-by: Kailang Yang Cc: Link: https://lore.kernel.org/r/229c7efa2b474a16b7d8a916cd096b68@realtek.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_realtek.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 019dee96dbaa..9cd0cef9ec27 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -5705,6 +5705,8 @@ enum { ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC, ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, ALC294_FIXUP_ASUS_INTSPK_GPIO, + ALC289_FIXUP_DELL_SPK2, + ALC289_FIXUP_DUAL_SPK, }; static const struct hda_fixup alc269_fixups[] = { @@ -6775,6 +6777,21 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC }, + [ALC289_FIXUP_DELL_SPK2] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { + { 0x17, 0x90170130 }, /* bass spk */ + { } + }, + .chained = true, + .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE + }, + [ALC289_FIXUP_DUAL_SPK] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_speaker2_to_dac1, + .chained = true, + .chain_id = ALC289_FIXUP_DELL_SPK2 + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = { @@ -6847,6 +6864,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), + SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK), + SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), From patchwork Tue Jan 7 20:54: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: 234306 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 0DB65C33C9B for ; Tue, 7 Jan 2020 21:18:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D59742081E for ; Tue, 7 Jan 2020 21:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431895; bh=LnwZKsj4CYzajLpK42obidHIGwv2vatJZs/O0Wv9bWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SoCULsvx6SCPSvCIBwVytOToh0D/TlmjLxQr4nHrEsRf8Y9SoXn2WtE2DI2awRFW3 +MfKlXjNwUtg0d8yL2rRRCuzjYrnUSMlvgN6Dk+enpviUSKxlpyF1y2LCY5fAbTeW8 zBtYjJbLqylQ7QbsHkv2IC3rGS6JUjgFDnU7E4Hs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729219AbgAGVFN (ORCPT ); Tue, 7 Jan 2020 16:05:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:51194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729214AbgAGVFN (ORCPT ); Tue, 7 Jan 2020 16:05:13 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 9DC042077B; Tue, 7 Jan 2020 21:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431112; bh=LnwZKsj4CYzajLpK42obidHIGwv2vatJZs/O0Wv9bWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kGEB2fPN2//3tCEGQ+HeeHjx+Z88xam1vwILdE2dVFjD3KR014iOGpQBnFn0btuQO Vb7XMlN/3S5d6r0ZKWjC/mwNl1IEGj/pJWwi8nEGoMZ8wnVVmYWw6idLrVnOCnq4zs tkS+vi6JDNY2JHHuI/1CDBi/r4u6mV5MhyIgRIRw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , Sasha Levin Subject: [PATCH 4.19 037/115] ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen Date: Tue, 7 Jan 2020 21:54:07 +0100 Message-Id: <20200107205301.586610438@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaroslav Kysela [ Upstream commit d2cd795c4ece1a24fda170c35eeb4f17d9826cbb ] The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop). Signed-off-by: Jaroslav Kysela Link: https://lore.kernel.org/r/20191129144027.14765-1-perex@perex.cz Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0c007d14588a..bf42b6f7fb5c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -5441,6 +5441,16 @@ static void alc295_fixup_disable_dac3(struct hda_codec *codec, } } +/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */ +static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + hda_nid_t conn[1] = { 0x02 }; + snd_hda_override_conn_list(codec, 0x17, 1, conn); + } +} + /* Hook to update amp GPIO4 for automute */ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, struct hda_jack_callback *jack) @@ -5661,6 +5671,7 @@ enum { ALC225_FIXUP_DISABLE_MIC_VREF, ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, ALC295_FIXUP_DISABLE_DAC3, + ALC285_FIXUP_SPEAKER2_TO_DAC1, ALC280_FIXUP_HP_HEADSET_MIC, ALC221_FIXUP_HP_FRONT_MIC, ALC292_FIXUP_TPT460, @@ -6444,6 +6455,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc295_fixup_disable_dac3, }, + [ALC285_FIXUP_SPEAKER2_TO_DAC1] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_speaker2_to_dac1, + }, [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) { @@ -7023,6 +7038,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), @@ -7206,6 +7222,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"}, {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"}, {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"}, + {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"}, {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"}, {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"}, {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"}, From patchwork Tue Jan 7 20:54:10 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: 234307 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 16FF2C282DD for ; Tue, 7 Jan 2020 21:18:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D87462077B for ; Tue, 7 Jan 2020 21:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431886; bh=U9lMCLFW3Qzr90gPJad9aP/+wLzkKDUNDwbbADjCt/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zsBmSA9/OaenZ1ykBzdMgnZ0ogTES4Vrh1AdrOt9bI04WkPrquB5bRPJMF3n33ypq 0dtp7mKQ9XiPcs7pfGkDEYBiWmUyOwbqfR+4ufm49JYLMhQa4+riQLwDcEyGf1F/8i Zszi6oMX4O1a29Lh1FvSs6WI0feS18d3Lh5DoHXU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729163AbgAGVSA (ORCPT ); Tue, 7 Jan 2020 16:18:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:51580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729007AbgAGVFU (ORCPT ); Tue, 7 Jan 2020 16:05:20 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 B37822081E; Tue, 7 Jan 2020 21:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431119; bh=U9lMCLFW3Qzr90gPJad9aP/+wLzkKDUNDwbbADjCt/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tQnenis3FGLAKoJNwKkZvO8BHvMBq/rGh/bJdzzHRm+RnZ7ZpHvTfzMA7OtJ9IzEd zcfN3hsTRbOx5p2WWVOZznshwkqRr1u6pmZlB4slRvssKVcIZMwC5qq8N5s6okb3C5 M2dHI8Wev8Z2E2364C5v9JBG+6ucFFuSYp1Igy6E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , syzbot+fb77e97ebf0612ee6914@syzkaller.appspotmail.com, Kees Cook , Alexander Viro , Stephen Rothwell , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.19 040/115] drm: limit to INT_MAX in create_blob ioctl Date: Tue, 7 Jan 2020 21:54:10 +0100 Message-Id: <20200107205301.771918206@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniel Vetter [ Upstream commit 5bf8bec3f4ce044a223c40cbce92590d938f0e9c ] The hardened usercpy code is too paranoid ever since commit 6a30afa8c1fb ("uaccess: disallow > INT_MAX copy sizes") Code itself should have been fine as-is. Link: http://lkml.kernel.org/r/20191106164755.31478-1-daniel.vetter@ffwll.ch Signed-off-by: Daniel Vetter Reported-by: syzbot+fb77e97ebf0612ee6914@syzkaller.appspotmail.com Fixes: 6a30afa8c1fb ("uaccess: disallow > INT_MAX copy sizes") Cc: Kees Cook Cc: Alexander Viro Cc: Stephen Rothwell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index cdb10f885a4f..69dfed57c2f8 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -556,7 +556,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, struct drm_property_blob *blob; int ret; - if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob)) + if (!length || length > INT_MAX - sizeof(struct drm_property_blob)) return ERR_PTR(-EINVAL); blob = kvzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); From patchwork Tue Jan 7 20:54:11 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: 234385 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 52DCDC282DD for ; Tue, 7 Jan 2020 21:05:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 203AE2081E for ; Tue, 7 Jan 2020 21:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431127; bh=X/6xvICbw8hI0o2RYXjRcQM+iteqfLO9+pizoBcrLNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=r9Ml+HsNe49Xr1da0MUIvGtvJbSuiXvk6xt4F1ozx3ag+U+2gScYeZxntCL3EVOf7 HLbZ+8xmAlqg1Teapluljeh4GiGlnN1FGYOrzMOQYQV7EDNiYyeUWL2Vsh6gIuvQMH MnUksCJOQtfihoqOjFbZtXT/Ae3Mk/zwTYElIQC0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728228AbgAGVFX (ORCPT ); Tue, 7 Jan 2020 16:05:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:51714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728530AbgAGVFW (ORCPT ); Tue, 7 Jan 2020 16:05:22 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 2A3A620678; Tue, 7 Jan 2020 21:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431121; bh=X/6xvICbw8hI0o2RYXjRcQM+iteqfLO9+pizoBcrLNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nemj3vooMIMPc6gVkWJBurGwAg8sHzbyPxHAVRx8hilTotuss1FWOzuD55d1I0lVJ ubPBJG4WiPssHKaWP4zKvJk9arUVD3apkSDumlCK3pcnwLN4nTDhD7oeyS+6y0IpLn t4OYja0T/QJzDqXPMIiMBBX2o/FSmRkRdyLE28l0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Sutter , Florian Westphal , =?utf-8?b?TcOhdMOpIEVja2w=?= , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.19 041/115] netfilter: nft_tproxy: Fix port selector on Big Endian Date: Tue, 7 Jan 2020 21:54:11 +0100 Message-Id: <20200107205301.834289203@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Phil Sutter [ Upstream commit 8cb4ec44de42b99b92399b4d1daf3dc430ed0186 ] On Big Endian architectures, u16 port value was extracted from the wrong parts of u32 sreg_port, just like commit 10596608c4d62 ("netfilter: nf_tables: fix mismatch in big-endian system") describes. Fixes: 4ed8eb6570a49 ("netfilter: nf_tables: Add native tproxy support") Signed-off-by: Phil Sutter Acked-by: Florian Westphal Acked-by: Máté Eckl Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nft_tproxy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nft_tproxy.c b/net/netfilter/nft_tproxy.c index f92a82c73880..95980154ef02 100644 --- a/net/netfilter/nft_tproxy.c +++ b/net/netfilter/nft_tproxy.c @@ -50,7 +50,7 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr, taddr = nf_tproxy_laddr4(skb, taddr, iph->daddr); if (priv->sreg_port) - tport = regs->data[priv->sreg_port]; + tport = nft_reg_load16(®s->data[priv->sreg_port]); if (!tport) tport = hp->dest; @@ -117,7 +117,7 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr, taddr = *nf_tproxy_laddr6(skb, &taddr, &iph->daddr); if (priv->sreg_port) - tport = regs->data[priv->sreg_port]; + tport = nft_reg_load16(®s->data[priv->sreg_port]); if (!tport) tport = hp->dest; From patchwork Tue Jan 7 20:54: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: 234384 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 B185AC33C9B for ; Tue, 7 Jan 2020 21:05:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 844C920880 for ; Tue, 7 Jan 2020 21:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431127; bh=MABIAo/8O2n9vUpWI2QDXB80LRbXfp1lWRL4aI2t6Dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OpMdaR6GJ3kyCHxFugo0oL3coLOKWhyGeZIKsqggNIP0skjnwbPl/f7av8xQCthgN V8aEYfHTgORoPLx8vzA12lGUtISg0S0Az9bDMkFU69Qw8Bz/UvplaQURmjMzYU0BG+ UebQit92C+ujKzLy8UJn664n8IGdG0eR/TaATZhE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728645AbgAGVF0 (ORCPT ); Tue, 7 Jan 2020 16:05:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:51816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728852AbgAGVFY (ORCPT ); Tue, 7 Jan 2020 16:05:24 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 8B4A020880; Tue, 7 Jan 2020 21:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431124; bh=MABIAo/8O2n9vUpWI2QDXB80LRbXfp1lWRL4aI2t6Dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMFZn38/YTkVDJ+KXWM57XomtNb6NVqSs5NDTUsJ/x1hmxEB/E3mWpAwCEKVoJuy3 85+GSjWD2VsGzx/9Jqv1v8okmS/iS6kl7aklAxWMF7gj11huHy+wM78ScYF8nY/ROw NyZusGeTLHffRjecH5lqL6lWj+NvE7F++AUSr1CI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai , Takashi Iwai Subject: [PATCH 4.19 042/115] ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code Date: Tue, 7 Jan 2020 21:54:12 +0100 Message-Id: <20200107205301.906593272@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Takashi Iwai commit 0aec96f5897ac16ad9945f531b4bef9a2edd2ebd upstream. Jia-Ju Bai reported a possible sleep-in-atomic scenario in the ice1724 driver with Infrasonic Quartet support code: namely, ice->set_rate callback gets called inside ice->reg_lock spinlock, while the callback in quartet.c holds ice->gpio_mutex. This patch fixes the invalid call: it simply moves the calls of ice->set_rate and ice->set_mclk callbacks outside the spinlock. Reported-by: Jia-Ju Bai Cc: Link: https://lore.kernel.org/r/5d43135e-73b9-a46a-2155-9e91d0dcdf83@gmail.com Link: https://lore.kernel.org/r/20191218192606.12866-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/ice1712/ice1724.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -661,6 +661,7 @@ static int snd_vt1724_set_pro_rate(struc unsigned long flags; unsigned char mclk_change; unsigned int i, old_rate; + bool call_set_rate = false; if (rate > ice->hw_rates->list[ice->hw_rates->count - 1]) return -EINVAL; @@ -684,7 +685,7 @@ static int snd_vt1724_set_pro_rate(struc * setting clock rate for internal clock mode */ old_rate = ice->get_rate(ice); if (force || (old_rate != rate)) - ice->set_rate(ice, rate); + call_set_rate = true; else if (rate == ice->cur_rate) { spin_unlock_irqrestore(&ice->reg_lock, flags); return 0; @@ -692,12 +693,14 @@ static int snd_vt1724_set_pro_rate(struc } ice->cur_rate = rate; + spin_unlock_irqrestore(&ice->reg_lock, flags); + + if (call_set_rate) + ice->set_rate(ice, rate); /* setting master clock */ mclk_change = ice->set_mclk(ice, rate); - spin_unlock_irqrestore(&ice->reg_lock, flags); - if (mclk_change && ice->gpio.i2s_mclk_changed) ice->gpio.i2s_mclk_changed(ice); if (ice->gpio.set_pro_rate) From patchwork Tue Jan 7 20:54:14 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: 234382 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 5B96FC282DD for ; Tue, 7 Jan 2020 21:05:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C2852081E for ; Tue, 7 Jan 2020 21:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431146; bh=E+EQLAk6PsgNrY6xQceMY5eimhfrpN7qa8vd0HS/aQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lfSgdq2l8AvA/VkeH0qEk8iyVuWYuo9Mkeqv++P7aUy/PShYGn5Q9h/ZP6dECgySA H2KbOeIgtTsGOpkV+6ZeRNCSnONZ9b/WXbAmvO8/p566MV9I3M5gpIIQQziZgT9cId vgTVG/LNV7RctFG51Kv1Tk7CfFy8S25z+2QqwIGM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbgAGVFp (ORCPT ); Tue, 7 Jan 2020 16:05:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:52890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729048AbgAGVFp (ORCPT ); Tue, 7 Jan 2020 16:05:45 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 03D2C2081E; Tue, 7 Jan 2020 21:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431143; bh=E+EQLAk6PsgNrY6xQceMY5eimhfrpN7qa8vd0HS/aQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFz4nae+YI1LJ4kF7tQi1ppiwLldv+mutGiJEkOqYcHH2PxXNVSQPecDXRx/+21sZ dyqwhojxcD0Ko7LfeQSBkO68mGsThOIuHWu2QTCWmgzIIOX1zRUS5z1V5Q2+Z9XGSF t4r0q2qycrwZU7Wo5oHQ1U+Zm0F4RkQ2CjTML/mE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hui Wang , Takashi Iwai Subject: [PATCH 4.19 044/115] ALSA: usb-audio: set the interface format after resume on Dell WD19 Date: Tue, 7 Jan 2020 21:54:14 +0100 Message-Id: <20200107205302.031798906@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hui Wang commit 92adc96f8eecd9522a907c197cc3d62e405539fe upstream. Recently we found the headset-mic on the Dell Dock WD19 doesn't work anymore after s3 (s2i or deep), this problem could be workarounded by closing (pcm_close) the app and then reopening (pcm_open) the app, so this bug is not easy to be detected by users. When problem happens, retire_capture_urb() could still be called periodically, but the size of captured data is always 0, it could be a firmware bug on the dock. Anyway I found after resuming, the snd_usb_pcm_prepare() will be called, and if we forcibly run set_format() to set the interface and its endpoint, the capture size will be normal again. This problem and workaound also apply to playback. To fix it in the kernel, add a quirk to let set_format() run forcibly once after resume. Signed-off-by: Hui Wang Cc: Link: https://lore.kernel.org/r/20191218132650.6303-1-hui.wang@canonical.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/card.h | 1 + sound/usb/pcm.c | 21 +++++++++++++++++++-- sound/usb/quirks-table.h | 3 ++- sound/usb/quirks.c | 11 +++++++++++ sound/usb/usbaudio.h | 3 ++- 5 files changed, 35 insertions(+), 4 deletions(-) --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -142,6 +142,7 @@ struct snd_usb_substream { struct snd_usb_endpoint *sync_endpoint; unsigned long flags; bool need_setup_ep; /* (re)configure EP at prepare? */ + bool need_setup_fmt; /* (re)configure fmt after resume? */ unsigned int speed; /* USB_SPEED_XXX */ u64 formats; /* format bitmasks (all or'ed) */ --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -517,11 +517,11 @@ static int set_format(struct snd_usb_sub return -EINVAL; altsd = get_iface_desc(alts); - if (fmt == subs->cur_audiofmt) + if (fmt == subs->cur_audiofmt && !subs->need_setup_fmt) return 0; /* close the old interface */ - if (subs->interface >= 0 && subs->interface != fmt->iface) { + if (subs->interface >= 0 && (subs->interface != fmt->iface || subs->need_setup_fmt)) { if (!subs->stream->chip->keep_iface) { err = usb_set_interface(subs->dev, subs->interface, 0); if (err < 0) { @@ -535,6 +535,9 @@ static int set_format(struct snd_usb_sub subs->altset_idx = 0; } + if (subs->need_setup_fmt) + subs->need_setup_fmt = false; + /* set interface */ if (iface->cur_altsetting != alts) { err = snd_usb_select_mode_quirk(subs, fmt); @@ -1722,6 +1725,13 @@ static int snd_usb_substream_playback_tr subs->data_endpoint->retire_data_urb = retire_playback_urb; subs->running = 0; return 0; + case SNDRV_PCM_TRIGGER_SUSPEND: + if (subs->stream->chip->setup_fmt_after_resume_quirk) { + stop_endpoints(subs, true); + subs->need_setup_fmt = true; + return 0; + } + break; } return -EINVAL; @@ -1754,6 +1764,13 @@ static int snd_usb_substream_capture_tri subs->data_endpoint->retire_data_urb = retire_capture_urb; subs->running = 1; return 0; + case SNDRV_PCM_TRIGGER_SUSPEND: + if (subs->stream->chip->setup_fmt_after_resume_quirk) { + stop_endpoints(subs, true); + subs->need_setup_fmt = true; + return 0; + } + break; } return -EINVAL; --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -3400,7 +3400,8 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge .vendor_name = "Dell", .product_name = "WD19 Dock", .profile_name = "Dell-WD15-Dock", - .ifnum = QUIRK_NO_INTERFACE + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_SETUP_FMT_AFTER_RESUME } }, --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -519,6 +519,16 @@ static int create_standard_mixer_quirk(s return snd_usb_create_mixer(chip, quirk->ifnum, 0); } + +static int setup_fmt_after_resume_quirk(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver, + const struct snd_usb_audio_quirk *quirk) +{ + chip->setup_fmt_after_resume_quirk = 1; + return 1; /* Continue with creating streams and mixer */ +} + /* * audio-interface quirks * @@ -557,6 +567,7 @@ int snd_usb_create_quirk(struct snd_usb_ [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, + [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk, }; if (quirk->type < QUIRK_TYPE_COUNT) { --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -44,7 +44,7 @@ struct snd_usb_audio { wait_queue_head_t shutdown_wait; unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ unsigned int tx_length_quirk:1; /* Put length specifier in transfers */ - + unsigned int setup_fmt_after_resume_quirk:1; /* setup the format to interface after resume */ int num_interfaces; int num_suspended_intf; int sample_rate_read_error; @@ -107,6 +107,7 @@ enum quirk_type { QUIRK_AUDIO_EDIROL_UAXX, QUIRK_AUDIO_ALIGN_TRANSFER, QUIRK_AUDIO_STANDARD_MIXER, + QUIRK_SETUP_FMT_AFTER_RESUME, QUIRK_TYPE_COUNT }; From patchwork Tue Jan 7 20:54: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: 234313 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 8AD11C282DD for ; Tue, 7 Jan 2020 21:17:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55B8C2080A for ; Tue, 7 Jan 2020 21:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431833; bh=s4dJlHfvG3lTvGvTHMdUwLLQc2nWQ+zsBKgEgl7p50k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2gPPTxPa8cMa05dAMhOH48XtyxKhV2C24Y/bdnml36ljfxqFPx5zUzGbIWzK/DA84 3KH0t+XOeehETFzX2lCEJ9nYHk0bcpNVS9bVcemYDVSxv546nVwNZ18yb1TC43OYa8 1bXDw7zgZ+nYPLy18OnM5cI1eGkH+6ajiTwOCfbA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbgAGVGL (ORCPT ); Tue, 7 Jan 2020 16:06:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:54584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729352AbgAGVGK (ORCPT ); Tue, 7 Jan 2020 16:06:10 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 DA9FE20678; Tue, 7 Jan 2020 21:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431170; bh=s4dJlHfvG3lTvGvTHMdUwLLQc2nWQ+zsBKgEgl7p50k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KdemxxQi2IskTBrceczBOPeik8wVEsqdWtqf8Vj8HhqpoTDVyJ+449ZmhERbaBXwE flMsc1GcbRvSNgRImzs6N7xrlwqwW2c8H2YYrUzOez1zpPqH/VORUb88smkKmxsK65 Xl5Jstdx51ovcc3929yZJikGIlpQMOLUKgdktUIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kailang Yang , Takashi Iwai Subject: [PATCH 4.19 045/115] ALSA: hda/realtek - Add headset Mic no shutup for ALC283 Date: Tue, 7 Jan 2020 21:54:15 +0100 Message-Id: <20200107205302.088634775@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kailang Yang commit 66c5d718e5a6f80153b5e8d6ad8ba8e9c3320839 upstream. Chrome machine had humming noise from external speaker plugin at codec D3 state. Signed-off-by: Kailang Yang Cc: Link: https://lore.kernel.org/r/2692449396954c6c968f5b75e2660358@realtek.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -513,6 +513,7 @@ static void alc_shutup_pins(struct hda_c struct alc_spec *spec = codec->spec; switch (codec->core.vendor_id) { + case 0x10ec0283: case 0x10ec0286: case 0x10ec0288: case 0x10ec0298: From patchwork Tue Jan 7 20:54:16 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: 234315 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 C4235C33C9B for ; Tue, 7 Jan 2020 21:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8FCD02072A for ; Tue, 7 Jan 2020 21:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431821; bh=X1olxmeGS+hSOKkAH1nvOlnj9Bz0S9uKNKI8lnj2Mjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=unpAKTqk8gF1RTvMwVb3f82fbfgGVBaNVI9uYeeFp9fRy2xeSRghhs/sYOGJWCecS xkNv08McrZdfBGMp3JkwdoVoMbuAWWKlSBPeHsC+RfnZemfYd9Yp6D4lSI4pCd2k86 kPFYyYqmgnDg2seYkuKNKAHlmMw2h4uaMb7Zt6k0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728973AbgAGVGi (ORCPT ); Tue, 7 Jan 2020 16:06:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:56138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728181AbgAGVGh (ORCPT ); Tue, 7 Jan 2020 16:06:37 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 ECC33222D9; Tue, 7 Jan 2020 21:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431197; bh=X1olxmeGS+hSOKkAH1nvOlnj9Bz0S9uKNKI8lnj2Mjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTqVLKGVBFaz6G9idHhEes+Cpgdmgv4ajkG2RsB7V1oBMwRgH0OEuXHEnsSeKtPOw Mzw+xGmOz+x1foFzkUdPpcvfbhlgPmJlQjTGyUzniWtSplOwaUUCSvffsfITZ+XNs9 5tVZKY1kqmJjbB2vOWoPWpUWu64k3R1fHUzApk0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Mavrodiev , Maxime Ripard Subject: [PATCH 4.19 046/115] drm/sun4i: hdmi: Remove duplicate cleanup calls Date: Tue, 7 Jan 2020 21:54:16 +0100 Message-Id: <20200107205302.184939895@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stefan Mavrodiev commit 57177d214ee0816c4436c23d6c933ccb32c571f1 upstream. When the HDMI unbinds drm_connector_cleanup() and drm_encoder_cleanup() are called. This also happens when the connector and the encoder are destroyed. This double call triggers a NULL pointer exception. The patch fixes this by removing the cleanup calls in the unbind function. Cc: Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") Signed-off-by: Stefan Mavrodiev Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20191217124632.20820-1-stefan@olimex.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -651,8 +651,6 @@ static void sun4i_hdmi_unbind(struct dev struct sun4i_hdmi *hdmi = dev_get_drvdata(dev); cec_unregister_adapter(hdmi->cec_adap); - drm_connector_cleanup(&hdmi->connector); - drm_encoder_cleanup(&hdmi->encoder); i2c_del_adapter(hdmi->i2c); clk_disable_unprepare(hdmi->mod_clk); clk_disable_unprepare(hdmi->bus_clk); From patchwork Tue Jan 7 20:54:18 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: 234319 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 5AF6AC33C9B for ; Tue, 7 Jan 2020 21:16:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A31A2077B for ; Tue, 7 Jan 2020 21:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431804; bh=FvAHbcoWqATo0vcYGrp4Vf8OlzqnBzekWMoDdjm14cU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uQw8CDLL/PyhJjsWQXKHErw1sTjx0vQyKyxrfRqPeI90bVOEqqHHzBc7TRWGH0K7O TvqNvzgM514wtLAsAmDxPc40PZWdYmytPGDkhrvQwwHPLHHv+TUb9iizCIS9Y+lss+ 2X8580ZxKK7w0dBmSSW672XErLcU1E13oYo4ApYI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729391AbgAGVHC (ORCPT ); Tue, 7 Jan 2020 16:07:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:57088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729462AbgAGVHC (ORCPT ); Tue, 7 Jan 2020 16:07:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3282C20678; Tue, 7 Jan 2020 21:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431221; bh=FvAHbcoWqATo0vcYGrp4Vf8OlzqnBzekWMoDdjm14cU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yb9MdwkbExQ6zNde+g/nIbuKczyE7p9NIi3ipz+d2/L/GSBrTH1RSdUNY5XB4p8qI 56pGql4VdcxIPSjsJ9k6HTOZZQ2u2BgwT/FetzNi/MUmvTq1Sjl+/Hw/eO/a9VBnzc XKwhYv9dSSdACnohmJlrC9wxLvAVX68EtmvY9gd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.19 048/115] media: pulse8-cec: fix lost cec_transmit_attempt_done() call Date: Tue, 7 Jan 2020 21:54:18 +0100 Message-Id: <20200107205302.324393223@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hans Verkuil commit e5a52a1d15c79bb48a430fb263852263ec1d3f11 upstream. The periodic PING command could interfere with the result of a CEC transmit, causing a lost cec_transmit_attempt_done() call. Signed-off-by: Hans Verkuil Cc: # for v4.10 and up Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/pulse8-cec/pulse8-cec.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- a/drivers/media/usb/pulse8-cec/pulse8-cec.c +++ b/drivers/media/usb/pulse8-cec/pulse8-cec.c @@ -121,6 +121,7 @@ struct pulse8 { unsigned int vers; struct completion cmd_done; struct work_struct work; + u8 work_result; struct delayed_work ping_eeprom_work; struct cec_msg rx_msg; u8 data[DATA_SIZE]; @@ -142,8 +143,10 @@ static void pulse8_irq_work_handler(stru { struct pulse8 *pulse8 = container_of(work, struct pulse8, work); + u8 result = pulse8->work_result; - switch (pulse8->data[0] & 0x3f) { + pulse8->work_result = 0; + switch (result & 0x3f) { case MSGCODE_FRAME_DATA: cec_received_msg(pulse8->adap, &pulse8->rx_msg); break; @@ -177,12 +180,12 @@ static irqreturn_t pulse8_interrupt(stru pulse8->escape = false; } else if (data == MSGEND) { struct cec_msg *msg = &pulse8->rx_msg; + u8 msgcode = pulse8->buf[0]; if (debug) dev_info(pulse8->dev, "received: %*ph\n", pulse8->idx, pulse8->buf); - pulse8->data[0] = pulse8->buf[0]; - switch (pulse8->buf[0] & 0x3f) { + switch (msgcode & 0x3f) { case MSGCODE_FRAME_START: msg->len = 1; msg->msg[0] = pulse8->buf[1]; @@ -191,14 +194,20 @@ static irqreturn_t pulse8_interrupt(stru if (msg->len == CEC_MAX_MSG_SIZE) break; msg->msg[msg->len++] = pulse8->buf[1]; - if (pulse8->buf[0] & MSGCODE_FRAME_EOM) + if (msgcode & MSGCODE_FRAME_EOM) { + WARN_ON(pulse8->work_result); + pulse8->work_result = msgcode; schedule_work(&pulse8->work); + break; + } break; case MSGCODE_TRANSMIT_SUCCEEDED: case MSGCODE_TRANSMIT_FAILED_LINE: case MSGCODE_TRANSMIT_FAILED_ACK: case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: + WARN_ON(pulse8->work_result); + pulse8->work_result = msgcode; schedule_work(&pulse8->work); break; case MSGCODE_HIGH_ERROR: From patchwork Tue Jan 7 20:54: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: 234375 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 1F7D6C33C9B for ; Tue, 7 Jan 2020 21:07:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3D8024656 for ; Tue, 7 Jan 2020 21:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431231; bh=108ARGMymmmXQl2feId0lFuMKZ3iOMgH138/9+MjxAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hn8BeorItnaMugPX4eCXqntYe9Psy3BzP9RAhCuIMn9R/zEjunZZupG6RAoqxFvvG AzXUo+52qBTZTFkIGZ41SfUmjTs7zXw85pFGiqCAdQn4BWj41WMXkII4efEqO1ovI8 QMTEfCNnuKQ1wwPXmzS6c+P4qAL7fuA//usw9Ro8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729485AbgAGVHH (ORCPT ); Tue, 7 Jan 2020 16:07:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:57262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729482AbgAGVHH (ORCPT ); Tue, 7 Jan 2020 16:07:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 0300C208C4; Tue, 7 Jan 2020 21:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431226; bh=108ARGMymmmXQl2feId0lFuMKZ3iOMgH138/9+MjxAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6zXMfTP4VwGNDjnptmMzfTTiGtbTbqFzExa1GHDPhgtNGm9DTlOwPRodjWFnCFZN 2mzeYTtf/bpXvLxPX9MZz2d2CLl1yf2d1dAAOj+wm2HidJgr9aK7aNkBwESyB5B+Ss YRFDDGvzgzC6rhNg8Pla3SAklNKc1kT7gDCcCrJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.19 050/115] media: cec: avoid decrementing transmit_queue_sz if it is 0 Date: Tue, 7 Jan 2020 21:54:20 +0100 Message-Id: <20200107205302.473698043@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hans Verkuil commit 95c29d46ab2a517e4c26d0a07300edca6768db17 upstream. WARN if transmit_queue_sz is 0 but do not decrement it. The CEC adapter will become unresponsive if it goes below 0 since then it thinks there are 4 billion messages in the queue. Obviously this should not happen, but a driver bug could cause this. Signed-off-by: Hans Verkuil Cc: # for v4.12 and up Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/cec/cec-adap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c @@ -365,7 +365,8 @@ static void cec_data_cancel(struct cec_d } else { list_del_init(&data->list); if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) - data->adap->transmit_queue_sz--; + if (!WARN_ON(!data->adap->transmit_queue_sz)) + data->adap->transmit_queue_sz--; } if (data->msg.tx_status & CEC_TX_STATUS_OK) { @@ -417,6 +418,14 @@ static void cec_flush(struct cec_adapter * need to do anything special in that case. */ } + /* + * If something went wrong and this counter isn't what it should + * be, then this will reset it back to 0. Warn if it is not 0, + * since it indicates a bug, either in this framework or in a + * CEC driver. + */ + if (WARN_ON(adap->transmit_queue_sz)) + adap->transmit_queue_sz = 0; } /* @@ -507,7 +516,8 @@ int cec_thread_func(void *_adap) data = list_first_entry(&adap->transmit_queue, struct cec_data, list); list_del_init(&data->list); - adap->transmit_queue_sz--; + if (!WARN_ON(!data->adap->transmit_queue_sz)) + adap->transmit_queue_sz--; /* Make this the current transmitting message */ adap->transmitting = data; From patchwork Tue Jan 7 20:54:22 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: 234320 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 E59E4C282DD for ; Tue, 7 Jan 2020 21:16:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA0412081E for ; Tue, 7 Jan 2020 21:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431795; bh=yVSMHHClpJzlndkHCGKLUUq2inE9hgWKi9DMbgYa214=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t0crjZrQVFZ9UbcLEMshd2jN1dq9yA90u7R2bUiXus0KBtZTLXMkRy8SDnBJbgklT Z92DpaVUv+ajgmF3Qrz15IEei/S3qkXJHXJ02tPaCTp4HktAtLzGEjlBOnNhQcVTSj SJvVzN2yokWYpAaVcQe8K49hQSl8g3T11PvrIzfM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728911AbgAGVQ3 (ORCPT ); Tue, 7 Jan 2020 16:16:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:57490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729329AbgAGVHL (ORCPT ); Tue, 7 Jan 2020 16:07:11 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 C83192072A; Tue, 7 Jan 2020 21:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431231; bh=yVSMHHClpJzlndkHCGKLUUq2inE9hgWKi9DMbgYa214=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dL7Asim48SLqw/Vb3Er6jAheQXp0lfHg1cbck8VsnSAxlI+ectj6qsdgOyHSCPzJt 260VHUerX6vlbHFvEouUUg34ti89PovYJeIoTaC98u8+cwpbBqJ4SB9bwRNVxWoTKq jbFrBnsIQs9BEDQkaH6/aIvU0cg5lRQVMKHyCvNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Min , Jinsuk Choi , Sergey Senozhatsky , Minchan Kim , Andrew Morton , Linus Torvalds Subject: [PATCH 4.19 052/115] mm/zsmalloc.c: fix the migrated zspage statistics. Date: Tue, 7 Jan 2020 21:54:22 +0100 Message-Id: <20200107205302.628401027@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chanho Min commit ac8f05da5174c560de122c499ce5dfb5d0dfbee5 upstream. When zspage is migrated to the other zone, the zone page state should be updated as well, otherwise the NR_ZSPAGE for each zone shows wrong counts including proc/zoneinfo in practice. Link: http://lkml.kernel.org/r/1575434841-48009-1-git-send-email-chanho.min@lge.com Fixes: 91537fee0013 ("mm: add NR_ZSMALLOC to vmstat") Signed-off-by: Chanho Min Signed-off-by: Jinsuk Choi Reviewed-by: Sergey Senozhatsky Acked-by: Minchan Kim Cc: [4.9+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/zsmalloc.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -2092,6 +2092,11 @@ static int zs_page_migrate(struct addres zs_pool_dec_isolated(pool); } + if (page_zone(newpage) != page_zone(page)) { + dec_zone_page_state(page, NR_ZSPAGES); + inc_zone_page_state(newpage, NR_ZSPAGES); + } + reset_page(page); put_page(page); page = newpage; From patchwork Tue Jan 7 20:54:25 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: 234310 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 ED9EFC33CA1 for ; Tue, 7 Jan 2020 21:17:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B59362081E for ; Tue, 7 Jan 2020 21:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431846; bh=T5q8XmvfkrOeq1v43/KZZja5ORt8vWv1s+v4WUe0hjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IwUxWTr36Fu2DDMVi+bqjO3w22d+npxz3AlvbH+gM4gEmWBViN7tCNq+BtfstB5r5 PoKZ8WtA4zsgsbQ2w5a1e0L17jRiYHXfVtRw8kbRfDQI5Rq41KxgpC7Vk9mC/rYv7R A2uhNyhfRcTPtQRpKhfjQCl+DMEGeGsyq28LLG4U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728606AbgAGVRZ (ORCPT ); Tue, 7 Jan 2020 16:17:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:53408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729302AbgAGVFv (ORCPT ); Tue, 7 Jan 2020 16:05:51 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 22C402087F; Tue, 7 Jan 2020 21:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431150; bh=T5q8XmvfkrOeq1v43/KZZja5ORt8vWv1s+v4WUe0hjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rytqw2IjzGNyr4LkzuVMoqNRdLkuX3wPTWgY1SZzocJuFiclMPdQgazt+b727bjra 85R6oJtqaKm8uTAXYHLCQ/jaoKLg5eMA1kOv8QSPhzxh7f/goit/hrO5lXkYjPBp1p VySOHqww4oTdZQOAjY/oilBmpXyTgRUprnmFx2Hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksandr Yashkin , Nikolay Merinov , Ariel Gilman , Kees Cook Subject: [PATCH 4.19 055/115] pstore/ram: Write new dumps to start of recycled zones Date: Tue, 7 Jan 2020 21:54:25 +0100 Message-Id: <20200107205302.839255144@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Aleksandr Yashkin commit 9e5f1c19800b808a37fb9815a26d382132c26c3d upstream. The ram_core.c routines treat przs as circular buffers. When writing a new crash dump, the old buffer needs to be cleared so that the new dump doesn't end up in the wrong place (i.e. at the end). The solution to this problem is to reset the circular buffer state before writing a new Oops dump. Signed-off-by: Aleksandr Yashkin Signed-off-by: Nikolay Merinov Signed-off-by: Ariel Gilman Link: https://lore.kernel.org/r/20191223133816.28155-1-n.merinov@inango-systems.com Fixes: 896fc1f0c4c6 ("pstore/ram: Switch to persistent_ram routines") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- fs/pstore/ram.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -437,6 +437,17 @@ static int notrace ramoops_pstore_write( prz = cxt->dprzs[cxt->dump_write_cnt]; + /* + * Since this is a new crash dump, we need to reset the buffer in + * case it still has an old dump present. Without this, the new dump + * will get appended, which would seriously confuse anything trying + * to check dump file contents. Specifically, ramoops_read_kmsg_hdr() + * expects to find a dump header in the beginning of buffer data, so + * we must to reset the buffer values, in order to ensure that the + * header will be written to the beginning of the buffer. + */ + persistent_ram_zap(prz); + /* Build header and append record contents. */ hlen = ramoops_write_kmsg_hdr(prz, record); size = record->size; From patchwork Tue Jan 7 20:54: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: 234311 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 2CE1EC282DD for ; Tue, 7 Jan 2020 21:17:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3D512087F for ; Tue, 7 Jan 2020 21:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431842; bh=Puf4cjTzQ89dCmtslBrHrCifQTnzFDr6sMafzpFF7P8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eesmumW/RA6cRHBJtmKPiC2vBsdzE3xO5OWVMgB2vylGgWr7Zf5xqgqdZKauni6oS omIKi9SoYoAf3u4cPRfBiiU0HV4QQMF3IB/Lmgvyx3ekPQbsOfdkLy6Qx5kZ+E5iep NwDVLbmhEs4ei7oUKPNjA1Gx9RXxTERpu9FaS8cA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729312AbgAGVF4 (ORCPT ); Tue, 7 Jan 2020 16:05:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:53674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729309AbgAGVFz (ORCPT ); Tue, 7 Jan 2020 16:05:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E41BE2077B; Tue, 7 Jan 2020 21:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431155; bh=Puf4cjTzQ89dCmtslBrHrCifQTnzFDr6sMafzpFF7P8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZd3lR51T6wc3Sbvs6xRia3qH3fbsWD2UHIYNuMVK+wXK7M7aSY2aLvd+LITHox/q f3HODi7WwmHT1U5f02md7t4iBEMIU6mBgF9tMaadGCVhOsalUdu/898NYyIMflfY1t Hdrraba9skC72a2EAv3EVgRn7NGrbMYCHXn2cQeQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kbuild test robot , Lukas Wunner , Vinod Koul Subject: [PATCH 4.19 057/115] dmaengine: Fix access to uninitialized dma_slave_caps Date: Tue, 7 Jan 2020 21:54:27 +0100 Message-Id: <20200107205302.962415588@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lukas Wunner commit 53a256a9b925b47c7e67fc1f16ca41561a7b877c upstream. dmaengine_desc_set_reuse() allocates a struct dma_slave_caps on the stack, populates it using dma_get_slave_caps() and then accesses one of its members. However dma_get_slave_caps() may fail and this isn't accounted for, leading to a legitimate warning of gcc-4.9 (but not newer versions): In file included from drivers/spi/spi-bcm2835.c:19:0: drivers/spi/spi-bcm2835.c: In function 'dmaengine_desc_set_reuse': >> include/linux/dmaengine.h:1370:10: warning: 'caps.descriptor_reuse' is used uninitialized in this function [-Wuninitialized] if (caps.descriptor_reuse) { Fix it, thereby also silencing the gcc-4.9 warning. The issue has been present for 4 years but surfaces only now that the first caller of dmaengine_desc_set_reuse() has been added in spi-bcm2835.c. Another user of reusable DMA descriptors has existed for a while in pxa_camera.c, but it sets the DMA_CTRL_REUSE flag directly instead of calling dmaengine_desc_set_reuse(). Nevertheless, tag this commit for stable in case there are out-of-tree users. Fixes: 272420214d26 ("dmaengine: Add DMA_CTRL_REUSE") Reported-by: kbuild test robot Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org # v4.3+ Link: https://lore.kernel.org/r/ca92998ccc054b4f2bfd60ef3adbab2913171eac.1575546234.git.lukas@wunner.de Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- include/linux/dmaengine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1373,8 +1373,11 @@ static inline int dma_get_slave_caps(str static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx) { struct dma_slave_caps caps; + int ret; - dma_get_slave_caps(tx->chan, &caps); + ret = dma_get_slave_caps(tx->chan, &caps); + if (ret) + return ret; if (caps.descriptor_reuse) { tx->flags |= DMA_CTRL_REUSE; From patchwork Tue Jan 7 20:54: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: 234381 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 41A70C282DD for ; Tue, 7 Jan 2020 21:06:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 137982080A for ; Tue, 7 Jan 2020 21:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431165; bh=xfY0Bi9UHxCB8JaSZ+qYTGH4RoqOvqbb5ZXpEwB30YU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XsF5zYIO2j89ypIGZQOzurHnEHO1JQIv1HY/E1eASqu03fwQMo1TSWUr6Rxh8YLkj UVivN3tPvKuIFqiaifB1ddMtFvBvIbbLmbPm+QsVciULEWiQPhAyObn1wqAXGHtltw lq9Nwoy43kExoNwANOpLjEGQ8h+myR12WUjkeHWo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729167AbgAGVGE (ORCPT ); Tue, 7 Jan 2020 16:06:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:53966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729326AbgAGVGA (ORCPT ); Tue, 7 Jan 2020 16:06:00 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BBEE12077B; Tue, 7 Jan 2020 21:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431160; bh=xfY0Bi9UHxCB8JaSZ+qYTGH4RoqOvqbb5ZXpEwB30YU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LGBNjyYeyP6/oEGgC6JTwe/nKSgmeyhgsoljBjzTEWZX0NZm7OUTGFFu1frQjPP7M FrHqRnbTkBcWBZqTKuoLtNBMVcqnBL/0/Hmw/uRtK51Ak9VWAZG6Vf/adhO2H7E7lB TxuKvcL+7tOiIcnOA4Rz5YNRNLU47iIzmcUhmhFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damien Le Moal , Arnd Bergmann , Jens Axboe Subject: [PATCH 4.19 059/115] compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE Date: Tue, 7 Jan 2020 21:54:29 +0100 Message-Id: <20200107205303.155584151@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 673bdf8ce0a387ef585c13b69a2676096c6edfe9 upstream. These were added to blkdev_ioctl() but not blkdev_compat_ioctl, so add them now. Cc: # v4.10+ Fixes: 3ed05a987e0f ("blk-zoned: implement ioctls") Reviewed-by: Damien Le Moal Signed-off-by: Arnd Bergmann Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/compat_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c @@ -355,6 +355,8 @@ long compat_blkdev_ioctl(struct file *fi * but we call blkdev_ioctl, which gets the lock for us */ case BLKRRPART: + case BLKREPORTZONE: + case BLKRESETZONE: return blkdev_ioctl(bdev, mode, cmd, (unsigned long)compat_ptr(arg)); case BLKBSZSET_32: From patchwork Tue Jan 7 20:54: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: 234312 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 7BD4DC33C9B for ; Tue, 7 Jan 2020 21:17:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 502422087F for ; Tue, 7 Jan 2020 21:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431839; bh=3YajkWlGnlVSLlsI8KWCB4f2UnTJCeARHNTYQIc7B3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=y2MXJLIfaJDfr/3hSfxWuUYkAwrI+4EiWhEy1h1G3IcHG3CpNX6WLtpCLxOuaHq37 xZZPy0stY2KCl5qGqXcSyd7hZ1YSqpwKvktbpEazDGjECIUYMN9CsX65W+o6iUBGRU uQry53yqsqGN0jiyklTAgZrYvzUdSQLY9uyl44pM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728798AbgAGVGE (ORCPT ); Tue, 7 Jan 2020 16:06:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:54142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729163AbgAGVGD (ORCPT ); Tue, 7 Jan 2020 16:06:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 99F362077B; Tue, 7 Jan 2020 21:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431163; bh=3YajkWlGnlVSLlsI8KWCB4f2UnTJCeARHNTYQIc7B3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Va9ksbbgY0PnNbBSNGCcuTIsO3HAOqUiswXW8kn0HcTf4s4D0/rlHgLPm1aee1DQo Nq6Al3g0eEhaHWy5Cj5FB6AdJKoa6fKHJqgXURRXaBB8NVdCxwourAbyDmgqUZ4zy3 oik5Xk+aLSj1b9Wbsoh+RgdWLdIMNitM5NfFwkP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Florian Fainelli , Jens Axboe Subject: [PATCH 4.19 060/115] ata: libahci_platform: Export again ahci_platform_able_phys() Date: Tue, 7 Jan 2020 21:54:30 +0100 Message-Id: <20200107205303.221949031@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Fainelli commit 84b032dbfdf1c139cd2b864e43959510646975f8 upstream. This reverts commit 6bb86fefa086faba7b60bb452300b76a47cde1a5 ("libahci_platform: Staticize ahci_platform_able_phys()") we are going to need ahci_platform_{enable,disable}_phys() in a subsequent commit for ahci_brcm.c in order to properly control the PHY initialization order. Also make sure the function prototypes are declared in include/linux/ahci_platform.h as a result. Cc: stable@vger.kernel.org Reviewed-by: Hans de Goede Signed-off-by: Florian Fainelli Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/ata/libahci_platform.c | 6 ++++-- include/linux/ahci_platform.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -47,7 +47,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops); * RETURNS: * 0 on success otherwise a negative error code */ -static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) { int rc, i; @@ -72,6 +72,7 @@ disable_phys: } return rc; } +EXPORT_SYMBOL_GPL(ahci_platform_enable_phys); /** * ahci_platform_disable_phys - Disable PHYs @@ -79,7 +80,7 @@ disable_phys: * * This function disables all PHYs found in hpriv->phys. */ -static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) +void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) { int i; @@ -88,6 +89,7 @@ static void ahci_platform_disable_phys(s phy_exit(hpriv->phys[i]); } } +EXPORT_SYMBOL_GPL(ahci_platform_disable_phys); /** * ahci_platform_enable_clks - Enable platform clocks --- a/include/linux/ahci_platform.h +++ b/include/linux/ahci_platform.h @@ -23,6 +23,8 @@ struct ahci_host_priv; struct platform_device; struct scsi_host_template; +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv); +void ahci_platform_disable_phys(struct ahci_host_priv *hpriv); int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv); From patchwork Tue Jan 7 20:54: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: 234314 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 5F9B4C282DD for ; Tue, 7 Jan 2020 21:17:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2713C2080A for ; Tue, 7 Jan 2020 21:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431827; bh=Gp/vD1HcvuFOrxXK0RGDEN6nK/NDqbHsH7zaBdF7heY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gc5kBqOzOzuxUFJQYW0a/tdPqFmAcyPIT22dLMXdAkwsDr2a5gzlUtqMg00FmaqFW U63n6QMtBcADqX149iO93ghtSYVqhUF/U3CE/SIk1QJt7KSddrXAyELsh3oCSle1ID 0fnJ7LtPaTnv0XjdedcvPOj9VZGwVpxDO34uqy4c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728947AbgAGVGP (ORCPT ); Tue, 7 Jan 2020 16:06:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:54732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729363AbgAGVGN (ORCPT ); Tue, 7 Jan 2020 16:06:13 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 530332077B; Tue, 7 Jan 2020 21:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431172; bh=Gp/vD1HcvuFOrxXK0RGDEN6nK/NDqbHsH7zaBdF7heY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+fsEd3MyDe356BcZCNDcZ0JLI3VDgPrLy92wMnqPKRfxteqj7u2Dd4c2Vdk7Ppr9 F6kaC0FaMvMQx5RykH530MResWCNqItQewDonEL4Rmi7nSk+MLrWjzlIz3q++XMub8 UhDnz2BsnHf7qvP3ZIIzg5V09Ziukj5EJBpciaVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Florian Fainelli , Jens Axboe Subject: [PATCH 4.19 063/115] ata: ahci_brcm: Add missing clock management during recovery Date: Tue, 7 Jan 2020 21:54:33 +0100 Message-Id: <20200107205303.419870315@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Fainelli commit bf0e5013bc2dcac205417e1252205dca39dfc005 upstream. The downstream implementation of ahci_brcm.c did contain clock management recovery, but until recently, did that outside of the libahci_platform helpers and this was unintentionally stripped out while forward porting the patch upstream. Add the missing clock management during recovery and sleep for 10 milliseconds per the design team recommendations to ensure the SATA PHY controller and AFE have been fully quiesced. Fixes: eb73390ae241 ("ata: ahci_brcm: Recover from failures to identify devices") Cc: stable@vger.kernel.org Reviewed-by: Hans de Goede Signed-off-by: Florian Fainelli Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/ata/ahci_brcm.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/ata/ahci_brcm.c +++ b/drivers/ata/ahci_brcm.c @@ -284,6 +284,13 @@ static unsigned int brcm_ahci_read_id(st /* Perform the SATA PHY reset sequence */ brcm_sata_phy_disable(priv, ap->port_no); + /* Reset the SATA clock */ + ahci_platform_disable_clks(hpriv); + msleep(10); + + ahci_platform_enable_clks(hpriv); + msleep(10); + /* Bring the PHY back on */ brcm_sata_phy_enable(priv, ap->port_no); From patchwork Tue Jan 7 20:54:34 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: 234380 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 88563C33C9E for ; Tue, 7 Jan 2020 21:06:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 559B42087F for ; Tue, 7 Jan 2020 21:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431183; bh=ODaS0pUMvjg30ZrtkNVo/mmVLmEz7wvq9VU7G821wqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zr0zeWM69LcCHxZ1Jmwhjg10ZEcr/99zP4CLP6oyIaB5H9H2vb1bwbRh0x8xh+vSy jXjBUhYQY57lR20GANP5MFQXADEmi5JfU8MBP+rZrmYFZ4Frhkybaft829iIoCVrmU Ec2FB039QBQ/YYHYPqxnl/EAM770OIM6c17VfhBM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728869AbgAGVGS (ORCPT ); Tue, 7 Jan 2020 16:06:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:54888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728994AbgAGVGQ (ORCPT ); Tue, 7 Jan 2020 16:06:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BF8862077B; Tue, 7 Jan 2020 21:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431175; bh=ODaS0pUMvjg30ZrtkNVo/mmVLmEz7wvq9VU7G821wqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2g941414OvRQahCw6WghxnZ24eUwJed28fZYboEJl3EehCG+s+A5ktj1SmCKuKitN De7FWJ04XNGCdUaM4oJoog5b7cyAwxlu5lzn9pXvKLDirDQh02OxjVE9wZ8W0s+8rX suHMrEO7/BbcEA1I9JNDXCSpih4Elkh3B8G8ew4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Florian Fainelli , Jens Axboe Subject: [PATCH 4.19 064/115] ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE Date: Tue, 7 Jan 2020 21:54:34 +0100 Message-Id: <20200107205303.502134943@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Fainelli commit 1a3d78cb6e20779a19388315bd8efefbd8d4a656 upstream. Set AHCI_HFLAG_DELAY_ENGINE for the BCM7425 AHCI controller thus making it conforming to the 'strict' AHCI implementation which this controller is based on. This solves long link establishment with specific hard drives (e.g.: Seagate ST1000VM002-9ZL1 SC12) that would otherwise have to complete the error recovery handling before finally establishing a succesful SATA link at the desired speed. We re-order the hpriv->flags assignment to also remove the NONCQ quirk since we can set the flag directly. Fixes: 9586114cf1e9 ("ata: ahci_brcmstb: add support MIPS-based platforms") Fixes: 423be77daabe ("ata: ahci_brcmstb: add quirk for broken ncq") Cc: stable@vger.kernel.org Reviewed-by: Hans de Goede Signed-off-by: Florian Fainelli Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/ata/ahci_brcm.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) --- a/drivers/ata/ahci_brcm.c +++ b/drivers/ata/ahci_brcm.c @@ -85,8 +85,7 @@ enum brcm_ahci_version { }; enum brcm_ahci_quirks { - BRCM_AHCI_QUIRK_NO_NCQ = BIT(0), - BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(1), + BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(0), }; struct brcm_ahci_priv { @@ -447,18 +446,27 @@ static int brcm_ahci_probe(struct platfo if (!IS_ERR_OR_NULL(priv->rcdev)) reset_control_deassert(priv->rcdev); - if ((priv->version == BRCM_SATA_BCM7425) || - (priv->version == BRCM_SATA_NSP)) { - priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ; - priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE; - } - hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) { ret = PTR_ERR(hpriv); goto out_reset; } + hpriv->plat_data = priv; + hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP | AHCI_HFLAG_NO_WRITE_TO_RO; + + switch (priv->version) { + case BRCM_SATA_BCM7425: + hpriv->flags |= AHCI_HFLAG_DELAY_ENGINE; + /* fall through */ + case BRCM_SATA_NSP: + hpriv->flags |= AHCI_HFLAG_NO_NCQ; + priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE; + break; + default: + break; + } + ret = ahci_platform_enable_clks(hpriv); if (ret) goto out_reset; @@ -478,15 +486,8 @@ static int brcm_ahci_probe(struct platfo /* Must be done before ahci_platform_enable_phys() */ brcm_sata_phys_enable(priv); - hpriv->plat_data = priv; - hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP; - brcm_sata_alpm_init(hpriv); - if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ) - hpriv->flags |= AHCI_HFLAG_NO_NCQ; - hpriv->flags |= AHCI_HFLAG_NO_WRITE_TO_RO; - ret = ahci_platform_enable_phys(hpriv); if (ret) goto out_disable_phys; From patchwork Tue Jan 7 20:54: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: 234379 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 00177C33C9B for ; Tue, 7 Jan 2020 21:06:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8A88214D8 for ; Tue, 7 Jan 2020 21:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431187; bh=cqmuP6+aWyyH4B13fvBC7PZfi6hpHU/Y2FNOvIebqFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kAY2/Pe2M5RysTxVXSUmNDxafNl7FqLbUroU7IMzD0tiDRrKKXAJEGbNMf6ZQ6+nE QC02GFMwOf4dgo8IELD1TWre6Af1YsXUcpw6tUnKUZ2BjDMT7SqZgr9aZgnkoGgPRx QHtMRLLq5nkX9Z36o8ot1m0FsW1KhT3GDwwSQoZA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728606AbgAGVG0 (ORCPT ); Tue, 7 Jan 2020 16:06:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:55330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728631AbgAGVGX (ORCPT ); Tue, 7 Jan 2020 16:06:23 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 36F052077B; Tue, 7 Jan 2020 21:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431182; bh=cqmuP6+aWyyH4B13fvBC7PZfi6hpHU/Y2FNOvIebqFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ji6oG3zQS2mN2Qh47fxo/T3AvCT+81QFvrl81ZzHKL1wRO6HnLak9JUx7HeHzWtKV xopzaU39DwKoWOa6baSqObf5nzCqP5juEO6VD5nnf7wrwd5DwB6C3JEfLGZXE7YUgq q1WqhP84ueNcgzC71Q2w+/nD6cV9PzMMM2W3oKmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zong Li , "Steven Rostedt (VMware)" , Paul Walmsley Subject: [PATCH 4.19 067/115] riscv: ftrace: correct the condition logic in function graph tracer Date: Tue, 7 Jan 2020 21:54:37 +0100 Message-Id: <20200107205303.691218306@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zong Li commit 1d8f65798240b6577d8c44d20c8ea8f1d429e495 upstream. The condition should be logical NOT to assign the hook address to parent address. Because the return value 0 of function_graph_enter upon success. Fixes: e949b6db51dc (riscv/function_graph: Simplify with function_graph_enter()) Signed-off-by: Zong Li Reviewed-by: Steven Rostedt (VMware) Cc: stable@vger.kernel.org Signed-off-by: Paul Walmsley Signed-off-by: Greg Kroah-Hartman --- arch/riscv/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/riscv/kernel/ftrace.c +++ b/arch/riscv/kernel/ftrace.c @@ -142,7 +142,7 @@ void prepare_ftrace_return(unsigned long */ old = *parent; - if (function_graph_enter(old, self_addr, frame_pointer, parent)) + if (!function_graph_enter(old, self_addr, frame_pointer, parent)) *parent = return_hooker; } From patchwork Tue Jan 7 20:54: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: 234316 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 5435CC33C9E for ; Tue, 7 Jan 2020 21:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F6252077B for ; Tue, 7 Jan 2020 21:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431821; bh=d0LqO0vrL2w/6NnlUQCVD3jiBBsm4uHXS+n2zv8EHXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OhWY4qz011ippWAhNdSw5/lUqBRIAnQQIIPv5ikyqkuT2DP4fkKT69xOXYqzH/fRy ifyImCH8pGJRIe2j63c17Q1z86QFPYeeuLw/YQmhyMJWVM35Bp2GW0yI4pq/e/KAHD EISB9uZI1+i4tE2+j27Pt2v8znjSw1LmTSEOu5B4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729059AbgAGVGj (ORCPT ); Tue, 7 Jan 2020 16:06:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:55746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729391AbgAGVGa (ORCPT ); Tue, 7 Jan 2020 16:06:30 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 60816208C4; Tue, 7 Jan 2020 21:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431189; bh=d0LqO0vrL2w/6NnlUQCVD3jiBBsm4uHXS+n2zv8EHXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2HglTne0C6tNsDPOSMQQpXODSKUbF3DMLJyAGyz8FO1o7swVkZS+jMWQI6Q0/tHBX v7P6o7JQY3A1g7v6ms7Vh6BBNS8mSTSUOkPlx5S9djKsprMBgrPMvHz3/W0HlRzE7K pZvjKQPl9qlIZ7kT/9DxEGUYyOB6SL+v2iyd4DwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Keita Suzuki , "Steven Rostedt (VMware)" Subject: [PATCH 4.19 070/115] tracing: Avoid memory leak in process_system_preds() Date: Tue, 7 Jan 2020 21:54:40 +0100 Message-Id: <20200107205303.879912341@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Keita Suzuki commit 79e65c27f09683fbb50c33acab395d0ddf5302d2 upstream. When failing in the allocation of filter_item, process_system_preds() goes to fail_mem, where the allocated filter is freed. However, this leads to memory leak of filter->filter_string and filter->prog, which is allocated before and in process_preds(). This bug has been detected by kmemleak as well. Fix this by changing kfree to __free_fiter. unreferenced object 0xffff8880658007c0 (size 32): comm "bash", pid 579, jiffies 4295096372 (age 17.752s) hex dump (first 32 bytes): 63 6f 6d 6d 6f 6e 5f 70 69 64 20 20 3e 20 31 30 common_pid > 10 00 00 00 00 00 00 00 00 65 73 00 00 00 00 00 00 ........es...... backtrace: [<0000000067441602>] kstrdup+0x2d/0x60 [<00000000141cf7b7>] apply_subsystem_event_filter+0x378/0x932 [<000000009ca32334>] subsystem_filter_write+0x5a/0x90 [<0000000072da2bee>] vfs_write+0xe1/0x240 [<000000004f14f473>] ksys_write+0xb4/0x150 [<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0 [<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 unreferenced object 0xffff888060c22d00 (size 64): comm "bash", pid 579, jiffies 4295096372 (age 17.752s) hex dump (first 32 bytes): 01 00 00 00 00 00 00 00 00 e8 d7 41 80 88 ff ff ...........A.... 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000b8c1b109>] process_preds+0x243/0x1820 [<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932 [<000000009ca32334>] subsystem_filter_write+0x5a/0x90 [<0000000072da2bee>] vfs_write+0xe1/0x240 [<000000004f14f473>] ksys_write+0xb4/0x150 [<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0 [<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 unreferenced object 0xffff888041d7e800 (size 512): comm "bash", pid 579, jiffies 4295096372 (age 17.752s) hex dump (first 32 bytes): 70 bc 85 97 ff ff ff ff 0a 00 00 00 00 00 00 00 p............... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<000000001e04af34>] process_preds+0x71a/0x1820 [<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932 [<000000009ca32334>] subsystem_filter_write+0x5a/0x90 [<0000000072da2bee>] vfs_write+0xe1/0x240 [<000000004f14f473>] ksys_write+0xb4/0x150 [<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0 [<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Link: http://lkml.kernel.org/r/20191211091258.11310-1-keitasuzuki.park@sslab.ics.keio.ac.jp Cc: Ingo Molnar Cc: stable@vger.kernel.org Fixes: 404a3add43c9c ("tracing: Only add filter list when needed") Signed-off-by: Keita Suzuki Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_events_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -1642,7 +1642,7 @@ static int process_system_preds(struct t parse_error(pe, FILT_ERR_BAD_SUBSYS_FILTER, 0); return -EINVAL; fail_mem: - kfree(filter); + __free_filter(filter); /* If any call succeeded, we still need to sync */ if (!fail) tracepoint_synchronize_unregister(); From patchwork Tue Jan 7 20:54: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: 234378 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 4C542C33C9E for ; Tue, 7 Jan 2020 21:06:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2066B2467A for ; Tue, 7 Jan 2020 21:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431199; bh=33Bi1yVAAsVNi7Ev68V72KZgAWblLjCh7fQukOoLmBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=v2U75TIbu0GAPh0fSvn8+C40UK67frQQLmNyG+6XJ0w9ck7C8KxdBp1Q3XjfbSMWj +XoYtNOnVnpH3zV5DQ3n1ykGV/4yCl6NB4Lm8k+kqmOoUDENu7wO53lxuFZXihHrhD PGFPVihCBMKkQQktR7fSASG7W0fO9nDOumAbC58o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729393AbgAGVGd (ORCPT ); Tue, 7 Jan 2020 16:06:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:55918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728973AbgAGVGd (ORCPT ); Tue, 7 Jan 2020 16:06:33 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BE8AE214D8; Tue, 7 Jan 2020 21:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431192; bh=33Bi1yVAAsVNi7Ev68V72KZgAWblLjCh7fQukOoLmBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcFKYwP5KR7UdVUSU5b0VLL2yY+ZDwLv7JyCGgSL+dqVsKdDfaEi7uKS8o0CeR7Cg 91+INRUuscksuO8ju7seBxNaegi7k+h5l0LReidSzWPo48C9BRFaGJ4A3sWQawLXgb Uezn2VOjvjhoIgI3APN3GZS/Pu2qCshRM/QG22vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Zanussi , Sven Schnelle , "Steven Rostedt (VMware)" Subject: [PATCH 4.19 071/115] tracing: Have the histogram compare functions convert to u64 first Date: Tue, 7 Jan 2020 21:54:41 +0100 Message-Id: <20200107205303.954455199@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Steven Rostedt (VMware) commit 106f41f5a302cb1f36c7543fae6a05de12e96fa4 upstream. The compare functions of the histogram code would be specific for the size of the value being compared (byte, short, int, long long). It would reference the value from the array via the type of the compare, but the value was stored in a 64 bit number. This is fine for little endian machines, but for big endian machines, it would end up comparing zeros or all ones (depending on the sign) for anything but 64 bit numbers. To fix this, first derference the value as a u64 then convert it to the type being compared. Link: http://lkml.kernel.org/r/20191211103557.7bed6928@gandalf.local.home Cc: stable@vger.kernel.org Fixes: 08d43a5fa063e ("tracing: Add lock-free tracing_map") Acked-by: Tom Zanussi Reported-by: Sven Schnelle Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/tracing_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/trace/tracing_map.c +++ b/kernel/trace/tracing_map.c @@ -148,8 +148,8 @@ static int tracing_map_cmp_atomic64(void #define DEFINE_TRACING_MAP_CMP_FN(type) \ static int tracing_map_cmp_##type(void *val_a, void *val_b) \ { \ - type a = *(type *)val_a; \ - type b = *(type *)val_b; \ + type a = (type)(*(u64 *)val_a); \ + type b = (type)(*(u64 *)val_b); \ \ return (a > b) ? 1 : ((a < b) ? -1 : 0); \ } From patchwork Tue Jan 7 20:54:45 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: 234377 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 7E9B3C33C9B for ; Tue, 7 Jan 2020 21:06:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5264D222D9 for ; Tue, 7 Jan 2020 21:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431207; bh=ph6v+dxkH+6pOv03d36Rmw/AD0TnMJ56W7K/cGga170=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fMcEpdIG62U12FCstVSD3naP7GK5LxX1tM2PwNqUxQvp4gMAE70N7RFnCNiVNIlOJ 3hPbMlO4+ZQLpCcovY87kBqIVqVYdv+XkN+sfYgcNVStfLM79f/J8hRt6HSKgkHth6 JxraNoIisZUHrP4lz2nXy02Btpw8tQTUmscg2bWw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729397AbgAGVGp (ORCPT ); Tue, 7 Jan 2020 16:06:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:56472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728899AbgAGVGp (ORCPT ); Tue, 7 Jan 2020 16:06:45 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 35EA3222D9; Tue, 7 Jan 2020 21:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431204; bh=ph6v+dxkH+6pOv03d36Rmw/AD0TnMJ56W7K/cGga170=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nkMBpoTt4oEdrB4qrJxHBbz3DqZlymnrd25NS7Jb0unPtVI1l6iirDCXgn2BvPBPe rt5FDiwMEQuM8v8MN4Rrf2T+iihrOtWNEByWryHMIwi1lRru88bPtpBjB4TK5XvO3y qNFMJg+RoG4pzSt4RkWuL6qWVqh9XbJnA+nAs1L8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Sakamoto , Takashi Iwai Subject: [PATCH 4.19 075/115] ALSA: firewire-motu: Correct a typo in the clock proc string Date: Tue, 7 Jan 2020 21:54:45 +0100 Message-Id: <20200107205304.215091599@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Takashi Iwai commit 0929249e3be3bb82ee6cfec0025f4dde952210b3 upstream. Just fix a typo of "S/PDIF" in the clock name string. Fixes: 4638ec6ede08 ("ALSA: firewire-motu: add proc node to show current statuc of clock and packet formats") Acked-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20191030100921.3826-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/motu/motu-proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/firewire/motu/motu-proc.c +++ b/sound/firewire/motu/motu-proc.c @@ -17,7 +17,7 @@ static const char *const clock_names[] = [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT] = "S/PDIF on optical interface", [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_A] = "S/PDIF on optical interface A", [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_B] = "S/PDIF on optical interface B", - [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PCIF on coaxial interface", + [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PDIF on coaxial interface", [SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR] = "AESEBU on XLR interface", [SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC] = "Word clock on BNC interface", }; From patchwork Tue Jan 7 20:54:47 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: 234376 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 96703C33C9B for ; Tue, 7 Jan 2020 21:06:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65E882077B for ; Tue, 7 Jan 2020 21:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431211; bh=PTs5QMs0572kcdLCWpDmAD7aVu0QZWYGL1aqF7MPrUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Wr3erThg5WPwfEqcX5+cLd4lF+g3IJCgxdCUPZwmCe5q0jIHCJJZn3QuIt+N1otvm wHlkf2WE5fGzQWF12yfjsA9V9kcWH2NATLlRWRzcOxTDrQn7TL5ftoMbZdIFzSaPcU KLTWp5t9VrdaXiMIlBx8qHFsKI5B9u7SwqipHDJc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729285AbgAGVGu (ORCPT ); Tue, 7 Jan 2020 16:06:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:56670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729391AbgAGVGu (ORCPT ); Tue, 7 Jan 2020 16:06:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 04D5120678; Tue, 7 Jan 2020 21:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431209; bh=PTs5QMs0572kcdLCWpDmAD7aVu0QZWYGL1aqF7MPrUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ta13xoE/UzYQWGO//TMLj2RAz62VZsvL/cieooD+nU8jQCeGQnDwQU3jOiHc5dnaG taQ+E9J6w1YKggBea+77GSvxPtOchRc5s1GVdIYUGyMBiJJWIW8n7s8WaL2i0JF9cw lhTMQ+CnwtmGO68rMeGaIB03QuZKhTrPa6jzVriM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Catalin Marinas , Linus Torvalds Subject: [PATCH 4.19 077/115] arm64: Revert support for execute-only user mappings Date: Tue, 7 Jan 2020 21:54:47 +0100 Message-Id: <20200107205304.355803475@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Catalin Marinas commit 24cecc37746393432d994c0dbc251fb9ac7c5d72 upstream. The ARMv8 64-bit architecture supports execute-only user permissions by clearing the PTE_USER and PTE_UXN bits, practically making it a mostly privileged mapping but from which user running at EL0 can still execute. The downside, however, is that the kernel at EL1 inadvertently reading such mapping would not trip over the PAN (privileged access never) protection. Revert the relevant bits from commit cab15ce604e5 ("arm64: Introduce execute-only page access permissions") so that PROT_EXEC implies PROT_READ (and therefore PTE_USER) until the architecture gains proper support for execute-only user mappings. Fixes: cab15ce604e5 ("arm64: Introduce execute-only page access permissions") Cc: # 4.9.x- Acked-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/pgtable-prot.h | 5 ++--- arch/arm64/include/asm/pgtable.h | 10 +++------- arch/arm64/mm/fault.c | 2 +- mm/mmap.c | 6 ------ 4 files changed, 6 insertions(+), 17 deletions(-) --- a/arch/arm64/include/asm/pgtable-prot.h +++ b/arch/arm64/include/asm/pgtable-prot.h @@ -96,13 +96,12 @@ #define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE) #define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN) #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN) -#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN) #define __P000 PAGE_NONE #define __P001 PAGE_READONLY #define __P010 PAGE_READONLY #define __P011 PAGE_READONLY -#define __P100 PAGE_EXECONLY +#define __P100 PAGE_READONLY_EXEC #define __P101 PAGE_READONLY_EXEC #define __P110 PAGE_READONLY_EXEC #define __P111 PAGE_READONLY_EXEC @@ -111,7 +110,7 @@ #define __S001 PAGE_READONLY #define __S010 PAGE_SHARED #define __S011 PAGE_SHARED -#define __S100 PAGE_EXECONLY +#define __S100 PAGE_READONLY_EXEC #define __S101 PAGE_READONLY_EXEC #define __S110 PAGE_SHARED_EXEC #define __S111 PAGE_SHARED_EXEC --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -105,12 +105,8 @@ extern unsigned long empty_zero_page[PAG #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte)) #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) -/* - * Execute-only user mappings do not have the PTE_USER bit set. All valid - * kernel mappings have the PTE_UXN bit set. - */ #define pte_valid_not_user(pte) \ - ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN)) + ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) #define pte_valid_young(pte) \ ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) #define pte_valid_user(pte) \ @@ -126,8 +122,8 @@ extern unsigned long empty_zero_page[PAG /* * p??_access_permitted() is true for valid user mappings (subject to the - * write permission check) other than user execute-only which do not have the - * PTE_USER bit set. PROT_NONE mappings do not have the PTE_VALID bit set. + * write permission check). PROT_NONE mappings do not have the PTE_VALID bit + * set. */ #define pte_access_permitted(pte, write) \ (pte_valid_user(pte) && (!(write) || pte_write(pte))) --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -428,7 +428,7 @@ static int __kprobes do_page_fault(unsig struct mm_struct *mm; struct siginfo si; vm_fault_t fault, major = 0; - unsigned long vm_flags = VM_READ | VM_WRITE; + unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC; unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; if (notify_page_fault(regs, esr)) --- a/mm/mmap.c +++ b/mm/mmap.c @@ -89,12 +89,6 @@ static void unmap_region(struct mm_struc * MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes * w: (no) no w: (no) no w: (copy) copy w: (no) no * x: (no) no x: (no) yes x: (no) yes x: (yes) yes - * - * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and - * MAP_PRIVATE: - * r: (no) no - * w: (no) no - * x: (yes) yes */ pgprot_t protection_map[16] __ro_after_init = { __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, From patchwork Tue Jan 7 20:54:48 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: 234317 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 24596C282DD for ; Tue, 7 Jan 2020 21:16:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E02BF2072A for ; Tue, 7 Jan 2020 21:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431816; bh=oODlMwsWmP0uvjxAg9CsM/Q88SZXX7bpWTVuq85UzJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bbGAwmujD9usPT4QB2IEL6z67KLPWHjaUpeAQUGCZSJYp0N/ZF9yPDeKt6piKiw6R b8G+yz0MSA76h4/TqdIigzt7W2eljyEX2ZL+w3VEyrtrozCcKA48Yzc9n0SBk3wGHm AY5ZslLE5PJt/NbJRaj43t4BU8i9ZK+/h6O59AmE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727981AbgAGVQv (ORCPT ); Tue, 7 Jan 2020 16:16:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:56766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729429AbgAGVGw (ORCPT ); Tue, 7 Jan 2020 16:06:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 668FB20880; Tue, 7 Jan 2020 21:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431211; bh=oODlMwsWmP0uvjxAg9CsM/Q88SZXX7bpWTVuq85UzJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1JcwhTLbA8OKec+iIEmYs9dx2GCckkQGE7SjH9Cn9CUH4O2jYPc8IFeWPbWdxq48S 7aGshdCT7NO0Q6cgqGmPfEbGStOk9xwfjKhfMAwi/Zjx1we+L7MWNSISHYC2oxbuzy EcsIatVSwQBVdyT5uCmQJIDqYjlBKC2TKRjoFYac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Yang , "Steven Rostedt (VMware)" Subject: [PATCH 4.19 078/115] ftrace: Avoid potential division by zero in function profiler Date: Tue, 7 Jan 2020 21:54:48 +0100 Message-Id: <20200107205304.479906634@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wen Yang commit e31f7939c1c27faa5d0e3f14519eaf7c89e8a69d upstream. The ftrace_profile->counter is unsigned long and do_div truncates it to 32 bits, which means it can test non-zero and be truncated to zero for division. Fix this issue by using div64_ul() instead. Link: http://lkml.kernel.org/r/20200103030248.14516-1-wenyang@linux.alibaba.com Cc: stable@vger.kernel.org Fixes: e330b3bcd8319 ("tracing: Show sample std dev in function profiling") Fixes: 34886c8bc590f ("tracing: add average time in function to function profiler") Signed-off-by: Wen Yang Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -554,8 +554,7 @@ static int function_stat_show(struct seq } #ifdef CONFIG_FUNCTION_GRAPH_TRACER - avg = rec->time; - do_div(avg, rec->counter); + avg = div64_ul(rec->time, rec->counter); if (tracing_thresh && (avg < tracing_thresh)) goto out; #endif @@ -581,7 +580,8 @@ static int function_stat_show(struct seq * Divide only 1000 for ns^2 -> us^2 conversion. * trace_print_graph_duration will divide 1000 again. */ - do_div(stddev, rec->counter * (rec->counter - 1) * 1000); + stddev = div64_ul(stddev, + rec->counter * (rec->counter - 1) * 1000); } trace_seq_init(&s); From patchwork Tue Jan 7 20:54:50 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: 234318 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 092E0C282DD for ; Tue, 7 Jan 2020 21:16:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1A812072A for ; Tue, 7 Jan 2020 21:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431807; bh=Q8FFZzskH42W+dZJS5N+XgnIUV7Y6jfVYJgYcjiKedE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wYWic4Py26MSXg4qq3FYkdUawy0ie/m+SrOvt7qwJgxcDq5xd6h//6TujU8WpVaOg +YxrYywXKSiKP3FhXEAqyCL58w7ER7RohWpE/b8zPpianiuuTjIIXWxoYYZ2YKhtpZ QngpgysDbbo18HTjn9c2vGWrbow+aEzoQiGaeAUc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729448AbgAGVG6 (ORCPT ); Tue, 7 Jan 2020 16:06:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:56894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729069AbgAGVG5 (ORCPT ); Tue, 7 Jan 2020 16:06:57 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 535B520678; Tue, 7 Jan 2020 21:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431216; bh=Q8FFZzskH42W+dZJS5N+XgnIUV7Y6jfVYJgYcjiKedE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2SZCanrzix3MHRxUjjvd2ezZ7K3UPzWZnMxDQE/cD80b0C4KfKtU8bqEG8scBBel dd4BFqwuY7yiGLxmawEDpMVuP2U44DTxnX546UXcAnG+9q2KKwFIyx0gzxJFYiQrxV Ob/C5Wa7QIXDAf6K+TRxt+mkzZS+exHS69thlJEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonard Crestez , Matthias Kaehlcke , Chanwoo Choi Subject: [PATCH 4.19 080/115] PM / devfreq: Check NULL governor in available_governors_show Date: Tue, 7 Jan 2020 21:54:50 +0100 Message-Id: <20200107205304.594285302@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leonard Crestez commit d68adc8f85cd757bd33c8d7b2660ad6f16f7f3dc upstream. The governor is initialized after sysfs attributes become visible so in theory the governor field can be NULL here. Fixes: bcf23c79c4e46 ("PM / devfreq: Fix available_governor sysfs") Signed-off-by: Leonard Crestez Reviewed-by: Matthias Kaehlcke Reviewed-by: Chanwoo Choi Signed-off-by: Chanwoo Choi Signed-off-by: Greg Kroah-Hartman --- drivers/devfreq/devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1086,7 +1086,7 @@ static ssize_t available_governors_show( * The devfreq with immutable governor (e.g., passive) shows * only own governor. */ - if (df->governor->immutable) { + if (df->governor && df->governor->immutable) { count = scnprintf(&buf[count], DEVFREQ_NAME_LEN, "%s ", df->governor_name); /* From patchwork Tue Jan 7 20:54:51 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: 234367 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 A051AC282DD for ; Tue, 7 Jan 2020 21:08:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62AB220678 for ; Tue, 7 Jan 2020 21:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431322; bh=uVBvV2Nb/uTe5XdSsCAhOEwc3wM/BVjBR7QlHHVPaRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XJnzFH5z/akIHud5IiZGhWi8DLwVTh+LPDk/dcZF6kmUE871HvQXXaEVRyX/DfpaF DQdrttQ0IAWPMkK70Az9DuL7w/Ay26rd3/UIt61YAlWz4RVEjLG3bfcTrO/lTthpwa KK9DHJjaGoFYvOGQadBtHYy9snSG20jT+FnEgCE4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729546AbgAGVIl (ORCPT ); Tue, 7 Jan 2020 16:08:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:33174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729722AbgAGVIj (ORCPT ); Tue, 7 Jan 2020 16:08:39 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3ADE920678; Tue, 7 Jan 2020 21:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431318; bh=uVBvV2Nb/uTe5XdSsCAhOEwc3wM/BVjBR7QlHHVPaRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkzHk+8PXiPM5S5tkNz4dMJnWfncJ0u39XmT01/qXu8p1K7Wf9w9zXQyj5sPOa99I o6us/7DsMrYp2pxGd+Tjqq7WD6PPiVy+LrkmlkuwNxOfhIyhvo77qX2/TQyDW0fLH9 WwZQ0bzlEliYWu6IFWXdkrnj0mZdLWc1ER8ArKHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Mayhew , "J. Bruce Fields" Subject: [PATCH 4.19 081/115] nfsd4: fix up replay_matches_cache() Date: Tue, 7 Jan 2020 21:54:51 +0100 Message-Id: <20200107205304.751841084@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Scott Mayhew commit 6e73e92b155c868ff7fce9d108839668caf1d9be upstream. When running an nfs stress test, I see quite a few cached replies that don't match up with the actual request. The first comment in replay_matches_cache() makes sense, but the code doesn't seem to match... fix it. This isn't exactly a bugfix, as the server isn't required to catch every case of a false retry. So, we may as well do this, but if this is fixing a problem then that suggests there's a client bug. Fixes: 53da6a53e1d4 ("nfsd4: catch some false session retries") Signed-off-by: Scott Mayhew Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4state.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3072,12 +3072,17 @@ static bool replay_matches_cache(struct (bool)seq->cachethis) return false; /* - * If there's an error than the reply can have fewer ops than - * the call. But if we cached a reply with *more* ops than the - * call you're sending us now, then this new call is clearly not - * really a replay of the old one: + * If there's an error then the reply can have fewer ops than + * the call. */ - if (slot->sl_opcnt < argp->opcnt) + if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) + return false; + /* + * But if we cached a reply with *more* ops than the call you're + * sending us now, then this new call is clearly not really a + * replay of the old one: + */ + if (slot->sl_opcnt > argp->opcnt) return false; /* This is the only check explicitly called by spec: */ if (!same_creds(&rqstp->rq_cred, &slot->sl_cred)) From patchwork Tue Jan 7 20:54:52 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: 234321 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 E8331C282DD for ; Tue, 7 Jan 2020 21:16:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF4382080A for ; Tue, 7 Jan 2020 21:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431783; bh=kHWeVqFe+m0kkb4VihQ/ZQA4wtRTqA+ReUP+mQlbl0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uvxObyozhXN+wChva3ZbP0WPil8M6nS7ofGulXMzWDUziL5KeDZeoHbDorUr1QuCj FRRaoGPXQAP2tyAV6Xr8IVrWa+7mnqbJ+ewV+K2xSIAFwfuhmM9HuLQXjRi2hscULn HxzUMmZn3P19T2oy2vsJcKSnASyfRbUk+KiA4MKQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbgAGVQW (ORCPT ); Tue, 7 Jan 2020 16:16:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:57698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729501AbgAGVHQ (ORCPT ); Tue, 7 Jan 2020 16:07:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 9D65A20678; Tue, 7 Jan 2020 21:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431236; bh=kHWeVqFe+m0kkb4VihQ/ZQA4wtRTqA+ReUP+mQlbl0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PFfDfLWzNN+yw+L3+t4utARzaihDboTm6Y8bAHjHffBttSwhK/8n2SkUoVYJ07Y5R YVfBxGcJ7yOLJxYGCgK3pjQySPOvfFwCSPA2kDUmF+3Y+8Yx/48KEJP8LKC/xtNa9f Eiq2d+64gReBXu1gNzuaGn60FGNUj8e1RrxDDL/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Jiri Kosina Subject: [PATCH 4.19 082/115] HID: i2c-hid: Reset ALPS touchpads on resume Date: Tue, 7 Jan 2020 21:54:52 +0100 Message-Id: <20200107205305.171742306@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kai-Heng Feng commit fd70466d37bf3fe0118d18c56ddde85b428f86cf upstream. Commit 52cf93e63ee6 ("HID: i2c-hid: Don't reset device upon system resume") fixes many touchpads and touchscreens, however ALPS touchpads start to trigger IRQ storm after system resume. Since it's total silence from ALPS, let's bring the old behavior back to ALPS touchpads. Fixes: 52cf93e63ee6 ("HID: i2c-hid: Don't reset device upon system resume") Signed-off-by: Kai-Heng Feng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/i2c-hid/i2c-hid-core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -51,6 +51,7 @@ #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2) #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) /* flags */ #define I2C_HID_STARTED 0 @@ -182,6 +183,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_RUNTIME_PM }, { USB_VENDOR_ID_ELAN, HID_ANY_ID, I2C_HID_QUIRK_BOGUS_IRQ }, + { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, + I2C_HID_QUIRK_RESET_ON_RESUME }, { 0, 0 } }; @@ -1290,8 +1293,15 @@ static int i2c_hid_resume(struct device * solves "incomplete reports" on Raydium devices 2386:3118 and * 2386:4B33 and fixes various SIS touchscreens no longer sending * data after a suspend/resume. + * + * However some ALPS touchpads generate IRQ storm without reset, so + * let's still reset them here. */ - ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); + if (ihid->quirks & I2C_HID_QUIRK_RESET_ON_RESUME) + ret = i2c_hid_hwreset(client); + else + ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); + if (ret) return ret; From patchwork Tue Jan 7 20:54:56 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: 234368 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 DD7FAC33C9B for ; Tue, 7 Jan 2020 21:08:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0F7E2077B for ; Tue, 7 Jan 2020 21:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431312; bh=0CCvKei3nHFFJwXyo+dF672ro9QzS7d5NDIs9AzPEq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Y8UVOztVLwpIerwat3beLOhQ/mokk3aNPuRm+Vtv5Eq4SzpDx+MpRevA9/0MC1Yox GgW5jCTzOV6ckBuyyY92c9I9GZ39N/vcHZ7AlcpXsebx6HAjSSybr5gprvPlGgGfv0 SvlMDine+50rk2lJYS+Xna1ogMx7fG5sXXJkcjWE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728626AbgAGVI1 (ORCPT ); Tue, 7 Jan 2020 16:08:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:60816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729691AbgAGVI1 (ORCPT ); Tue, 7 Jan 2020 16:08:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 14699222D9; Tue, 7 Jan 2020 21:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431306; bh=0CCvKei3nHFFJwXyo+dF672ro9QzS7d5NDIs9AzPEq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpPF2im5phnlmcuhBKddYQU9eVNIl60ajVSrRuTQi4j/6prTmZvhYKHpcjUv0iS6O eU5meTTmIRtvw5bg62eJutnXKEo0dpfxw4k7WVpiYMxvjrw9n4f3lc4Glu6tuYe37Y +LFvLMD+HtPbELOgBVOoB3flF4iX0LIiJ0iySXgo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Marcel Holtmann Subject: [PATCH 4.19 086/115] Bluetooth: btusb: fix PM leak in error case of setup Date: Tue, 7 Jan 2020 21:54:56 +0100 Message-Id: <20200107205306.230937692@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Oliver Neukum commit 3d44a6fd0775e6215e836423e27f8eedf8c871ea upstream. If setup() fails a reference for runtime PM has already been taken. Proper use of the error handling in btusb_open()is needed. You cannot just return. Fixes: ace31982585a3 ("Bluetooth: btusb: Add setup callback for chip init on USB") Signed-off-by: Oliver Neukum Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/btusb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1138,7 +1138,7 @@ static int btusb_open(struct hci_dev *hd if (data->setup_on_usb) { err = data->setup_on_usb(hdev); if (err < 0) - return err; + goto setup_fail; } data->intf->needs_remote_wakeup = 1; @@ -1170,6 +1170,7 @@ done: failed: clear_bit(BTUSB_INTR_RUNNING, &data->flags); +setup_fail: usb_autopm_put_interface(data->intf); return err; } From patchwork Tue Jan 7 20:54:57 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: 234329 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 BE5B2C33C9B for ; Tue, 7 Jan 2020 21:15:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 840662077B for ; Tue, 7 Jan 2020 21:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431713; bh=y4u0GGqzvmPD1hulz4bMt4c5qg6Q6An5RCpTRMXvP6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sYFBPrt27ju0jW8CpnaNV8Bd5hE5e4W2n8xNhuWJvdwk5wYIiijXivCzZLbviMBxE glJwg22wR9yvRHE/3MO6fWDyqDZy3d8VLHz7XIiASkCZ+im5aweRkDFWKrdeSYVtQG ZsLyFwDWqfrnUDOMsiNvxUUOhaOuu4dgd1+mKTRg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729701AbgAGVIc (ORCPT ); Tue, 7 Jan 2020 16:08:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:60920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729695AbgAGVI3 (ORCPT ); Tue, 7 Jan 2020 16:08:29 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7DEDB2077B; Tue, 7 Jan 2020 21:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431308; bh=y4u0GGqzvmPD1hulz4bMt4c5qg6Q6An5RCpTRMXvP6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pPcZxWHWCqB7/yLacZllyWghk1fz81o3ZXaHDRcu+FGn/NPdLAwFVyG0Z8MZRoCeV S1T8k68KNKU/TVhzJJfaOlznyxMOsiKs8qbYbdfKg3nxlLSXUElMSkiQ90ZKf0KxCj XVQWf2sxMTgsN95e7oTANOHMPOlTrwzSRzortK8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Marcel Holtmann Subject: [PATCH 4.19 087/115] Bluetooth: delete a stray unlock Date: Tue, 7 Jan 2020 21:54:57 +0100 Message-Id: <20200107205306.387840643@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Carpenter commit df66499a1fab340c167250a5743931dc50d5f0fa upstream. We used to take a lock in amp_physical_cfm() but then we moved it to the caller function. Unfortunately the unlock on this error path was overlooked so it leads to a double unlock. Fixes: a514b17fab51 ("Bluetooth: Refactor locking in amp_physical_cfm") Signed-off-by: Dan Carpenter Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/l2cap_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4918,10 +4918,8 @@ void __l2cap_physical_cfm(struct l2cap_c BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d", chan, result, local_amp_id, remote_amp_id); - if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) { - l2cap_chan_unlock(chan); + if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) return; - } if (chan->state != BT_CONNECTED) { l2cap_do_create(chan, result, local_amp_id, remote_amp_id); From patchwork Tue Jan 7 20:54: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: 234330 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 3E396C33C9E for ; Tue, 7 Jan 2020 21:15:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 119F32072A for ; Tue, 7 Jan 2020 21:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431711; bh=hH3BpXvUSthOpywz1EXtWem4Tr0fToBTO+LJZEemSFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=snA9E9PdYv00YrPNvhMW4DM5Antrn7kKJg0QD3Lq5+jdLFRSdiLDj3LweK1w4WWs5 KWuHRts0U2ltRctBf1oLYtrfXRKzg0h1AZKFUzzS3+ba8/DkMlVcpgyE3PrnV4fcSP vd40euIR48kcfRaEaM+cS1ih0BEcVgdumGkU3Cpc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728124AbgAGVPG (ORCPT ); Tue, 7 Jan 2020 16:15:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:32926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729379AbgAGVIe (ORCPT ); Tue, 7 Jan 2020 16:08:34 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 50C1E2077B; Tue, 7 Jan 2020 21:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431313; bh=hH3BpXvUSthOpywz1EXtWem4Tr0fToBTO+LJZEemSFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UCB4Ts3bhoBrrXBftsekZZywwAkWAvStq01OtX6XO6A0XjIiRsVzbCUUG0yveJHlx Sq203F65BuuWFx5UjLjWikg17n30EexzoJwFMxsde+lFFNSwHia3btsXgrsgxsnIeI FegNptjgoOeJ8p2vM44nZFf8OnZx7QkmdCy//6Bg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Sean Young , Mauro Carvalho Chehab Subject: [PATCH 4.19 089/115] media: flexcop-usb: ensure -EIO is returned on error condition Date: Tue, 7 Jan 2020 21:54:59 +0100 Message-Id: <20200107205306.668297634@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Colin Ian King commit 74a96b51a36de4d86660fbc56b05d86668162d6b upstream. An earlier commit hard coded a return 0 to function flexcop_usb_i2c_req even though the an -EIO was intended to be returned in the case where ret != buflen. Fix this by replacing the return 0 with the return of ret to return the error return code. Addresses-Coverity: ("Unused value") Fixes: b430eaba0be5 ("[media] flexcop-usb: don't use stack for DMA") Signed-off-by: Colin Ian King Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/b2c2/flexcop-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -294,7 +294,7 @@ static int flexcop_usb_i2c_req(struct fl mutex_unlock(&fc_usb->data_mutex); - return 0; + return ret; } /* actual bus specific access functions, From patchwork Tue Jan 7 20:55: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: 234322 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 34E20C282DD for ; Tue, 7 Jan 2020 21:16:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0788E2081E for ; Tue, 7 Jan 2020 21:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431780; bh=MuIb+sqGhjVYAmssrn+7TlscdFUuD8dmFEMaZbKcdMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aU5gceH+mOr04h5PcwSZcXStEn/HI/Xi8vYxUimwWUHGVxwIjUtAmPmWP9F3ue7jK gca+gy7SP6tD+SRJqbZRHOXZESzn8+VrQhfGki2UxkIyit2vvDbc5nrGdkS1cSSJRK /OXiZNHWC8jrW4LVSaTrz1C9noM1ldvtb9SCKiUA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729180AbgAGVHW (ORCPT ); Tue, 7 Jan 2020 16:07:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:57972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729517AbgAGVHV (ORCPT ); Tue, 7 Jan 2020 16:07:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7D296208C4; Tue, 7 Jan 2020 21:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431240; bh=MuIb+sqGhjVYAmssrn+7TlscdFUuD8dmFEMaZbKcdMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=toNsWI6bj148UelajbQ/17b9/feUH7Rdjt4u2cLmHzQlK2Hq+ljDri02T92oKXCQu 5AwWKEkVWf/WV70lGY8LyUFOjQMQI82aDlpci/tUaVU5Npj17SxtTOC+FIf+rfhMjG QK8qBi/gABQ9+M+Oh0QO2b/1mK86FNAL7q6HZStA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Yoshihiro Shimoda , Rob Herring Subject: [PATCH 4.19 092/115] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix typo in example Date: Tue, 7 Jan 2020 21:55:02 +0100 Message-Id: <20200107205306.862249723@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Geert Uytterhoeven commit 830dbce7c76ea529decac7d23b808c1e7da3d891 upstream. The documented compatible value for R-Car H3 is "renesas,r8a7795-rcar-usb2-clock-sel", not "renesas,r8a77950-rcar-usb2-clock-sel". Fixes: 311accb64570db45 ("clk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY") Signed-off-by: Geert Uytterhoeven Reviewed-by: Yoshihiro Shimoda Acked-by: Rob Herring Link: https://lore.kernel.org/r/20191016145650.30003-1-geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman --- Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt +++ b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt @@ -46,7 +46,7 @@ Required properties: Example (R-Car H3): usb2_clksel: clock-controller@e6590630 { - compatible = "renesas,r8a77950-rcar-usb2-clock-sel", + compatible = "renesas,r8a7795-rcar-usb2-clock-sel", "renesas,rcar-gen3-usb2-clock-sel"; reg = <0 0xe6590630 0 0x02>; clocks = <&cpg CPG_MOD 703>, <&usb_extal>, <&usb_xtal>; From patchwork Tue Jan 7 20:55:05 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: 234323 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 4A6ECC33CA1 for ; Tue, 7 Jan 2020 21:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1375C20678 for ; Tue, 7 Jan 2020 21:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431758; bh=zUoUxVZ4HMU1GfpgdVvtlZA8DUP4zKyLlTEL+8c6ZzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZFEdTJeYYohN5hYaPSSeghomQitr8TysGyiwoXvltsDJbBFczO5wPMtUTdA5O0pXQ +5bSl/dW6RKHByX44Ft+LdlEaPnmnzNgYkBHGUu+rFXECZQ7G1Oy/cLGgFhEIwXUsn GYdqWXtVz1+eEE4Q/furwPI4SVtkHkwOo5etqQwI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729765AbgAGVP4 (ORCPT ); Tue, 7 Jan 2020 16:15:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:58336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729542AbgAGVH2 (ORCPT ); Tue, 7 Jan 2020 16:07:28 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E0FAC2087F; Tue, 7 Jan 2020 21:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431248; bh=zUoUxVZ4HMU1GfpgdVvtlZA8DUP4zKyLlTEL+8c6ZzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUd10dWNtIpwXUqfx28c1wdkdRN0vBmo5Jo0JDVaLi81OkCaIx1X6vc4XdwtqMwPn cOPAH5gW+mCPeXNfJIV/5rFc2W4c8LHg2PJl2CG00Fh8tMeF3Eh7SwYepHMZUrpWIu HQsQYd48JKMuzD5xJPYjuQz722pUQCRBqrJVYv04= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Arnd Bergmann Subject: [PATCH 4.19 095/115] fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP Date: Tue, 7 Jan 2020 21:55:05 +0100 Message-Id: <20200107205307.097213619@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Al Viro commit 6b2daec19094a90435abe67d16fb43b1a5527254 upstream. Unlike FICLONE, all of those take a pointer argument; they do need compat_ptr() applied to arg. Fixes: d79bdd52d8be ("vfs: wire up compat ioctl for CLONE/CLONE_RANGE") Fixes: 54dbc1517237 ("vfs: hoist the btrfs deduplication ioctl to the vfs") Fixes: ceac204e1da9 ("fs: make fiemap work from compat_ioctl") Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- fs/compat_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1401,10 +1401,11 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned i #endif case FICLONE: + goto do_ioctl; case FICLONERANGE: case FIDEDUPERANGE: case FS_IOC_FIEMAP: - goto do_ioctl; + goto found_handler; case FIBMAP: case FIGETBSZ: From patchwork Tue Jan 7 20:55:06 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: 234325 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 5CBF3C282DD for ; Tue, 7 Jan 2020 21:15:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 279332080A for ; Tue, 7 Jan 2020 21:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431748; bh=aOZ5Zd1lbSAteEr5LJ2AOgThOLfNS16FyuGXJpkXz6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VCbAl8OO6Clfx3A/ZmO+pyM4OAgTX+0vmXfcO0OuGUNW0TmE/+8L/YarAJKoJ6vbz GOac/9XAeqPBtY4J2mhhmeTdISumstYpYFpG2ftiVOfWC6tgRp6TAWv1ZV4HGTAOSh 8W9sWEX326p0Q3XB5Ad5YvyixwB2X73a0q5/geEM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729552AbgAGVHe (ORCPT ); Tue, 7 Jan 2020 16:07:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:58440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729546AbgAGVHb (ORCPT ); Tue, 7 Jan 2020 16:07:31 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 4D68D208C4; Tue, 7 Jan 2020 21:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431250; bh=aOZ5Zd1lbSAteEr5LJ2AOgThOLfNS16FyuGXJpkXz6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=md+26HfRvq8CsbtDpz3HbhjlcXho2JxisgRsefTKBMm2GQtugInZkrtjTnvOFF6JJ /8QQrvXLl+6KtmuW81V5QbAxkVn7eFtgfe6s/gE2+YGdbp0DXemuFL0YEqgG6LibSu Od9539C3/4HSf6LQuE8+bHR024SIZPuNlriVbAns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Jens Axboe Subject: [PATCH 4.19 096/115] bdev: Factor out bdev revalidation into a common helper Date: Tue, 7 Jan 2020 21:55:06 +0100 Message-Id: <20200107205307.270373105@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jan Kara commit 731dc4868311ee097757b8746eaa1b4f8b2b4f1c upstream. Factor out code handling revalidation of bdev on disk change into a common helper. Signed-off-by: Jan Kara Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/block_dev.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1430,6 +1430,14 @@ EXPORT_SYMBOL(bd_set_size); static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part); +static void bdev_disk_changed(struct block_device *bdev, bool invalidate) +{ + if (invalidate) + invalidate_partitions(bdev->bd_disk, bdev); + else + rescan_partitions(bdev->bd_disk, bdev); +} + /* * bd_mutex locking: * @@ -1512,12 +1520,9 @@ static int __blkdev_get(struct block_dev * The latter is necessary to prevent ghost * partitions on a removed medium. */ - if (bdev->bd_invalidated) { - if (!ret) - rescan_partitions(disk, bdev); - else if (ret == -ENOMEDIUM) - invalidate_partitions(disk, bdev); - } + if (bdev->bd_invalidated && + (!ret || ret == -ENOMEDIUM)) + bdev_disk_changed(bdev, ret == -ENOMEDIUM); if (ret) goto out_clear; @@ -1550,12 +1555,9 @@ static int __blkdev_get(struct block_dev if (bdev->bd_disk->fops->open) ret = bdev->bd_disk->fops->open(bdev, mode); /* the same as first opener case, read comment there */ - if (bdev->bd_invalidated) { - if (!ret) - rescan_partitions(bdev->bd_disk, bdev); - else if (ret == -ENOMEDIUM) - invalidate_partitions(bdev->bd_disk, bdev); - } + if (bdev->bd_invalidated && + (!ret || ret == -ENOMEDIUM)) + bdev_disk_changed(bdev, ret == -ENOMEDIUM); if (ret) goto out_unlock_bdev; } From patchwork Tue Jan 7 20:55: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: 234324 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 936F5C33C9E for ; Tue, 7 Jan 2020 21:15:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C4E42072A for ; Tue, 7 Jan 2020 21:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431753; bh=1NcdiNwnH7To/Iqx5SZD2vBXi3MHmzy7tb1EB9E8u9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fTrXz8vRFPuLDeFxONlGO+9wjTORoaaD55J2RM1omHWJVFazZNlCznm25ST1aaCXA 6phwurEZVh62mSrmXMB9DobtwUyHAorDGOwocbM3l2XERuKbwMBtXoiB0yDo87Gmua 2pKaDCBEQtUCfBcdWuQ0rqLQusxSPnXO6tjO0P7Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729263AbgAGVPw (ORCPT ); Tue, 7 Jan 2020 16:15:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:58552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729514AbgAGVHd (ORCPT ); Tue, 7 Jan 2020 16:07:33 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BCA5B2077B; Tue, 7 Jan 2020 21:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431253; bh=1NcdiNwnH7To/Iqx5SZD2vBXi3MHmzy7tb1EB9E8u9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdJoLCkWZqNtBMiqhQtxZR8ZO7golz9ZH7rNB/2H0mOhOCf09wLKRXWwVXcr4/vju DoYOJDXW3bd6Jdujd51yyvOYtRtfqALn+LPIL5S+YLh/3iQjx8SbN23KD9JWr8Psv5 34eNf/FUZND9Ht+s1eSddNugKdBpZX+YC/j3wRHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Jens Axboe Subject: [PATCH 4.19 097/115] bdev: Refresh bdev size for disks without partitioning Date: Tue, 7 Jan 2020 21:55:07 +0100 Message-Id: <20200107205307.375255965@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jan Kara commit cba22d86e0a10b7070d2e6a7379dbea51aa0883c upstream. Currently, block device size in not updated on second and further open for block devices where partition scan is disabled. This is particularly annoying for example for DVD drives as that means block device size does not get updated once the media is inserted into a drive if the device is already open when inserting the media. This is actually always the case for example when pktcdvd is in use. Fix the problem by revalidating block device size on every open even for devices with partition scan disabled. Signed-off-by: Jan Kara Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/block_dev.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1328,11 +1328,7 @@ static void flush_disk(struct block_devi "resized disk %s\n", bdev->bd_disk ? bdev->bd_disk->disk_name : ""); } - - if (!bdev->bd_disk) - return; - if (disk_part_scan_enabled(bdev->bd_disk)) - bdev->bd_invalidated = 1; + bdev->bd_invalidated = 1; } /** @@ -1432,10 +1428,15 @@ static void __blkdev_put(struct block_de static void bdev_disk_changed(struct block_device *bdev, bool invalidate) { - if (invalidate) - invalidate_partitions(bdev->bd_disk, bdev); - else - rescan_partitions(bdev->bd_disk, bdev); + if (disk_part_scan_enabled(bdev->bd_disk)) { + if (invalidate) + invalidate_partitions(bdev->bd_disk, bdev); + else + rescan_partitions(bdev->bd_disk, bdev); + } else { + check_disk_size_change(bdev->bd_disk, bdev, !invalidate); + bdev->bd_invalidated = 0; + } } /* From patchwork Tue Jan 7 20:55:10 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: 234374 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 69E34C33C9B for ; Tue, 7 Jan 2020 21:07:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F4832077B for ; Tue, 7 Jan 2020 21:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431263; bh=0y7q3eKZ31rdwoO7MlSiyPnTfKXIsMYBH5vomT503Yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Rkh5GaIk9fp96E6PlSVzCYLQNQRzcnZ4BH9Hmxq62eBexSxhC/2WmFxSt1tm2K0D2 5uvVizI51AM3wHMiO70N+HxcxDA7HczwCzArpu6T2F4RTit8hCxdHb5f8CzabprfSq +uHeVHdW3JxLq1a73ob3bpXjG5klYqK/abfYq/3M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729234AbgAGVHl (ORCPT ); Tue, 7 Jan 2020 16:07:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:58910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729562AbgAGVHl (ORCPT ); Tue, 7 Jan 2020 16:07:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 F3C6A2077B; Tue, 7 Jan 2020 21:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431260; bh=0y7q3eKZ31rdwoO7MlSiyPnTfKXIsMYBH5vomT503Yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqA4ub2TBiRi2+1TDoxhh1Awsd3IGdn6AxZPaySSkvUlXxsFltXjzoBcutUfijPO7 6tBWB3PiVRmhM7rnUwWIJ5QyBoLcgw+TWEM2/UIjg1w2We6NhYLPsnOJOYkDLpqcdB 0tSHZika379XOixYsWc/AOjnq3muaZySmu+oQLik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Axtens , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 100/115] powerpc/pseries/hvconsole: Fix stack overread via udbg Date: Tue, 7 Jan 2020 21:55:10 +0100 Message-Id: <20200107205307.901226814@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniel Axtens [ Upstream commit 934bda59f286d0221f1a3ebab7f5156a996cc37d ] While developing KASAN for 64-bit book3s, I hit the following stack over-read. It occurs because the hypercall to put characters onto the terminal takes 2 longs (128 bits/16 bytes) of characters at a time, and so hvc_put_chars() would unconditionally copy 16 bytes from the argument buffer, regardless of supplied length. However, udbg_hvc_putc() can call hvc_put_chars() with a single-byte buffer, leading to the error. ================================================================== BUG: KASAN: stack-out-of-bounds in hvc_put_chars+0xdc/0x110 Read of size 8 at addr c0000000023e7a90 by task swapper/0 CPU: 0 PID: 0 Comm: swapper Not tainted 5.2.0-rc2-next-20190528-02824-g048a6ab4835b #113 Call Trace: dump_stack+0x104/0x154 (unreliable) print_address_description+0xa0/0x30c __kasan_report+0x20c/0x224 kasan_report+0x18/0x30 __asan_report_load8_noabort+0x24/0x40 hvc_put_chars+0xdc/0x110 hvterm_raw_put_chars+0x9c/0x110 udbg_hvc_putc+0x154/0x200 udbg_write+0xf0/0x240 console_unlock+0x868/0xd30 register_console+0x970/0xe90 register_early_udbg_console+0xf8/0x114 setup_arch+0x108/0x790 start_kernel+0x104/0x784 start_here_common+0x1c/0x534 Memory state around the buggy address: c0000000023e7980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0000000023e7a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 >c0000000023e7a80: f1 f1 01 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 ^ c0000000023e7b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0000000023e7b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== Document that a 16-byte buffer is requred, and provide it in udbg. Signed-off-by: Daniel Axtens Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/hvconsole.c | 2 +- drivers/tty/hvc/hvc_vio.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c index 74da18de853a..73ec15cd2708 100644 --- a/arch/powerpc/platforms/pseries/hvconsole.c +++ b/arch/powerpc/platforms/pseries/hvconsole.c @@ -62,7 +62,7 @@ EXPORT_SYMBOL(hvc_get_chars); * @vtermno: The vtermno or unit_address of the adapter from which the data * originated. * @buf: The character buffer that contains the character data to send to - * firmware. + * firmware. Must be at least 16 bytes, even if count is less than 16. * @count: Send this number of characters. */ int hvc_put_chars(uint32_t vtermno, const char *buf, int count) diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c index 59eaa620bf13..80fd06fbd712 100644 --- a/drivers/tty/hvc/hvc_vio.c +++ b/drivers/tty/hvc/hvc_vio.c @@ -107,6 +107,14 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count) return got; } +/** + * hvterm_raw_put_chars: send characters to firmware for given vterm adapter + * @vtermno: The virtual terminal number. + * @buf: The characters to send. Because of the underlying hypercall in + * hvc_put_chars(), this buffer must be at least 16 bytes long, even if + * you are sending fewer chars. + * @count: number of chars to send. + */ static int hvterm_raw_put_chars(uint32_t vtermno, const char *buf, int count) { struct hvterm_priv *pv = hvterm_privs[vtermno]; @@ -219,6 +227,7 @@ static const struct hv_ops hvterm_hvsi_ops = { static void udbg_hvc_putc(char c) { int count = -1; + unsigned char bounce_buffer[16]; if (!hvterm_privs[0]) return; @@ -229,7 +238,12 @@ static void udbg_hvc_putc(char c) do { switch(hvterm_privs[0]->proto) { case HV_PROTOCOL_RAW: - count = hvterm_raw_put_chars(0, &c, 1); + /* + * hvterm_raw_put_chars requires at least a 16-byte + * buffer, so go via the bounce buffer + */ + bounce_buffer[0] = c; + count = hvterm_raw_put_chars(0, bounce_buffer, 1); break; case HV_PROTOCOL_HVSI: count = hvterm_hvsi_put_chars(0, &c, 1); From patchwork Tue Jan 7 20:55:11 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: 234326 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 36605C282DD for ; Tue, 7 Jan 2020 21:15:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06A012080A for ; Tue, 7 Jan 2020 21:15:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431745; bh=MM79NCL25bbH0nHMP9HiLQXuyGVNFpLsvMEYvLn9qm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PUAvEjZe1M3uGSR5MsWEexKfaqBH0Y68dXt3fopqfATwCFOscgrL2/YznSzQ8FRg6 n/0oQTPYnP24MzEji7SPbl2TLYVVTLdXmWdh7lpQYs/rs6nXAmzXEEPabUC4ySOWCb 2NXSVrWFn5huFQRFnq73T097ip5OrjGcqiYtgJvs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729574AbgAGVHq (ORCPT ); Tue, 7 Jan 2020 16:07:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:59124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729572AbgAGVHp (ORCPT ); Tue, 7 Jan 2020 16:07:45 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 C27462077B; Tue, 7 Jan 2020 21:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431265; bh=MM79NCL25bbH0nHMP9HiLQXuyGVNFpLsvMEYvLn9qm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bm+NgRDDRj4IGBFqIkAbe4ua6MHJF5YJHa9AwmqAy0RVB2aTzPoimsKQJ1K4+vocz +AeNRimWgxDH0yn+Vyrp3OTYe8cJFPGA7+jys9aCyUUmYZd0QgD15JUB4lrdm3tMOx LCUQda2img5Q655uMI47RAGhxNVV3Rbv2VnRnhgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 101/115] selftests: rtnetlink: add addresses with fixed life time Date: Tue, 7 Jan 2020 21:55:11 +0100 Message-Id: <20200107205308.139779209@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Westphal [ Upstream commit 3cfa148826e3c666da1cc2a43fbe8689e2650636 ] This exercises kernel code path that deal with addresses that have a limited lifetime. Without previous fix, this triggers following crash on net-next: BUG: KASAN: null-ptr-deref in check_lifetime+0x403/0x670 Read of size 8 at addr 0000000000000010 by task kworker [..] Signed-off-by: Florian Westphal Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- tools/testing/selftests/net/rtnetlink.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index e101af52d1d6..ff665de788ef 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -234,6 +234,26 @@ kci_test_route_get() echo "PASS: route get" } +kci_test_addrlft() +{ + for i in $(seq 10 100) ;do + lft=$(((RANDOM%3) + 1)) + ip addr add 10.23.11.$i/32 dev "$devdummy" preferred_lft $lft valid_lft $((lft+1)) + check_err $? + done + + sleep 5 + + ip addr show dev "$devdummy" | grep "10.23.11." + if [ $? -eq 0 ]; then + echo "FAIL: preferred_lft addresses remaining" + check_err 1 + return + fi + + echo "PASS: preferred_lft addresses have expired" +} + kci_test_addrlabel() { ret=0 @@ -965,6 +985,7 @@ kci_test_rtnl() kci_test_polrouting kci_test_route_get + kci_test_addrlft kci_test_tc kci_test_gre kci_test_gretap From patchwork Tue Jan 7 20:55: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: 234373 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 0F002C33CA1 for ; Tue, 7 Jan 2020 21:07:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D723C24677 for ; Tue, 7 Jan 2020 21:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431272; bh=f/6kfKLPcBUw+uiHX1o2P2f3T3SXkYuPKKqkc7kl0c4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UQrLsWFCZxGNZ437N9/ZKRlfrHYkZnBzSaSWImz17Ot5I4xxosTYCpvHI+Torvq0E SaCxR6k3d6aC7Zz7dphFcyPWIthtHNbFcs2ITWQtKRBz5GWg6vBDD0ZXa4eBk8j0nD znx2RSU8Ll5zX+vcqlHp0bSFUE25ltyFvOsNUsKw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728397AbgAGVHw (ORCPT ); Tue, 7 Jan 2020 16:07:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:59234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbgAGVHs (ORCPT ); Tue, 7 Jan 2020 16:07:48 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 35BE22087F; Tue, 7 Jan 2020 21:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431267; bh=f/6kfKLPcBUw+uiHX1o2P2f3T3SXkYuPKKqkc7kl0c4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0QF7qTQwv1XmHTtePx84VXyrM7h7aLiq7hHH1ApIrogwlV1A00uO2iVLnsTASPmL n0Q2QP27fOWvfV2yJb5ICSckIEKaHDSkUgiwszBN2ewJnroRxZMaUXh1pGWuf0r246 jVtIidXtNltrc/LNvXZILpmncXTVg32lLUMppvYw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Suzuki K Poulose , Sasha Levin Subject: [PATCH 4.19 102/115] coresight: tmc-etf: Do not call smp_processor_id from preemptible Date: Tue, 7 Jan 2020 21:55:12 +0100 Message-Id: <20200107205308.269793829@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Suzuki K Poulose [ Upstream commit 024c1fd9dbcc1d8a847f1311f999d35783921b7f ] During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 caller is tmc_alloc_etf_buffer+0x5c/0x60 CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etf_buffer+0x5c/0x60 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 2e499bbc1a929ac ("coresight: tmc: implementing TMC-ETF AUX space API") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Cc: stable # 4.7+ Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20190620221237.3536-4-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index e31061308e19..4644ac5582cf 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -304,9 +304,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu, int node; struct cs_buffers *buf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); /* Allocate memory structure for interaction with Perf */ buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); From patchwork Tue Jan 7 20:55: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: 234372 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 1D14FC33C9B for ; Tue, 7 Jan 2020 21:07:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E133924679 for ; Tue, 7 Jan 2020 21:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431278; bh=ofr8e3gfatCCmd/bki2vXdSQ7vRODtS1BFvDJDueerU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UfZdYTaNrUbW1SNsVmeKfo3YqdhoqXrHM4pEzYJ49qDYuLXmmWc0jbDYns1KLcwu0 590ivcHbJaP3R0lWPz9okD1y0Kc0IopU1P2cdOe5ptGkc5CtCwfNdiOhX5nixXsLAO 62X2cY5vRrrlzRXgf+j+G1840PFosSX/Z0JZ4iNw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729597AbgAGVH4 (ORCPT ); Tue, 7 Jan 2020 16:07:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:59574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729305AbgAGVHz (ORCPT ); Tue, 7 Jan 2020 16:07:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 762482087F; Tue, 7 Jan 2020 21:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431274; bh=ofr8e3gfatCCmd/bki2vXdSQ7vRODtS1BFvDJDueerU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p1IZtWRXqJqgbP56wMzVK9ZGiiD9KPAWJb4Y7MdVxBr6ElUgza/nBeRhMkWSS/AHq MCrZ//UlnKqUCRHudYcO93ZM99EgQdr46N7W7ApG+hLUbm+KRMqPcX5xOpS+b4XIRU X7/l+k7w3yXNU3EOpMNsKLzWW4qFKahcXt8pZ31I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+611164843bd48cc2190c@syzkaller.appspotmail.com, David Howells , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 105/115] rxrpc: Fix possible NULL pointer access in ICMP handling Date: Tue, 7 Jan 2020 21:55:15 +0100 Message-Id: <20200107205308.781757705@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: David Howells [ Upstream commit f0308fb0708078d6c1d8a4d533941a7a191af634 ] If an ICMP packet comes in on the UDP socket backing an AF_RXRPC socket as the UDP socket is being shut down, rxrpc_error_report() may get called to deal with it after sk_user_data on the UDP socket has been cleared, leading to a NULL pointer access when this local endpoint record gets accessed. Fix this by just returning immediately if sk_user_data was NULL. The oops looks like the following: #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page ... RIP: 0010:rxrpc_error_report+0x1bd/0x6a9 ... Call Trace: ? sock_queue_err_skb+0xbd/0xde ? __udp4_lib_err+0x313/0x34d __udp4_lib_err+0x313/0x34d icmp_unreach+0x1ee/0x207 icmp_rcv+0x25b/0x28f ip_protocol_deliver_rcu+0x95/0x10e ip_local_deliver+0xe9/0x148 __netif_receive_skb_one_core+0x52/0x6e process_backlog+0xdc/0x177 net_rx_action+0xf9/0x270 __do_softirq+0x1b6/0x39a ? smpboot_register_percpu_thread+0xce/0xce run_ksoftirqd+0x1d/0x42 smpboot_thread_fn+0x19e/0x1b3 kthread+0xf1/0xf6 ? kthread_delayed_work_timer_fn+0x83/0x83 ret_from_fork+0x24/0x30 Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both") Reported-by: syzbot+611164843bd48cc2190c@syzkaller.appspotmail.com Signed-off-by: David Howells Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rxrpc/peer_event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c index dc7fdaf20445..42582a9ff81d 100644 --- a/net/rxrpc/peer_event.c +++ b/net/rxrpc/peer_event.c @@ -153,6 +153,9 @@ void rxrpc_error_report(struct sock *sk) struct rxrpc_peer *peer; struct sk_buff *skb; + if (unlikely(!local)) + return; + _enter("%p{%d}", sk, local->debug_id); skb = sock_dequeue_err_skb(sk); From patchwork Tue Jan 7 20:55:18 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: 234327 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 7431BC33C9E for ; Tue, 7 Jan 2020 21:15:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43B1B208C4 for ; Tue, 7 Jan 2020 21:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431736; bh=cHe9SCBf2/64VelU+oDMeWRNqTLDK6Y5/aXciAJSRdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xEMAGYtBKG0/zhVYgPr3W+q9qxoInr0n/i1VI3y3wI7xBKoPY5lh5QzClbUK0dCPY um3YyJKGefvccRo8QP/WvsWzuct8iXT8LfhbESoU4oHAmMBVJMRuP39lzJIRD8vOF0 2sOvF+KL7tPRV6DAppaM88GzdFuYEjlcXQm/KYT8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbgAGVPc (ORCPT ); Tue, 7 Jan 2020 16:15:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:59826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729618AbgAGVIC (ORCPT ); Tue, 7 Jan 2020 16:08:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 ADBDA2072A; Tue, 7 Jan 2020 21:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431282; bh=cHe9SCBf2/64VelU+oDMeWRNqTLDK6Y5/aXciAJSRdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ylUSMcrKZv3tHnALlls+EfuWPmtGT4fuu4XbUB0sWWI299cIqTCiVKR47TuOO1GcW CuSvCKz4o+Cf6Haeti5c0FK8/ho52y5mrEiBpWJO5X/ZW07toCj3XGcAhPeYwQM5uO 0C+wqDhiS6izOQCfy3e/TlMRehyi4JWn9hUv8bxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masashi Honma , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 108/115] ath9k_htc: Modify byte order for an error message Date: Tue, 7 Jan 2020 21:55:18 +0100 Message-Id: <20200107205309.314026822@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masashi Honma [ Upstream commit e01fddc19d215f6ad397894ec2a851d99bf154e2 ] rs_datalen is be16 so we need to convert it before printing. Signed-off-by: Masashi Honma Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 799010ed04e0..baacbd11eb43 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -986,7 +986,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) { ath_err(common, "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n", - rxstatus->rs_datalen, skb->len); + be16_to_cpu(rxstatus->rs_datalen), skb->len); goto rx_next; } From patchwork Tue Jan 7 20:55: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: 234371 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 9D2F3C33C9E for ; Tue, 7 Jan 2020 21:08:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66F2F214D8 for ; Tue, 7 Jan 2020 21:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431287; bh=kQ+stVW+RZUX7+jj/wl1c4/c/pQ7UdeqlaKbJVcIxkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XhcDN4D3V6ZpJ9g9fVjDuhdAtCOM0xGMjrrbP9ZfC6HH/AgrJtAn03+nU8N7OfHRT dThU1CHvOolVHXZDK/JRd5wBJJdVqFk0c/Q1bqpqg26Q9wvJlNpeISu02gU/nh9GFK xXbK82lHjQm4N3Gf5e64gHPOdbZOfHku6efprwUs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729615AbgAGVIG (ORCPT ); Tue, 7 Jan 2020 16:08:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:59940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729324AbgAGVIF (ORCPT ); Tue, 7 Jan 2020 16:08:05 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 440DA2072A; Tue, 7 Jan 2020 21:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431284; bh=kQ+stVW+RZUX7+jj/wl1c4/c/pQ7UdeqlaKbJVcIxkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTb5US5EhKgv0Hmgb1IydJ15XS1jLdHpQF0/ioVHaA463ZNP9n5UlvAgSXcWurFRA gkcG/Y7HOi8MlJziBg6pNeVgfmg7m2HmYAhPwumGxxeC9ApgGw7twHOF8VSZ2qiv5M +Lh0Ejihn7jBa8t2ctAcr19wNcAY5Era+oIUsL7s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masashi Honma , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 109/115] ath9k_htc: Discard undersized packets Date: Tue, 7 Jan 2020 21:55:19 +0100 Message-Id: <20200107205309.387693386@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masashi Honma [ Upstream commit cd486e627e67ee9ab66914d36d3127ef057cc010 ] Sometimes the hardware will push small packets that trigger a WARN_ON in mac80211. Discard them early to avoid this issue. This patch ports 2 patches from ath9k to ath9k_htc. commit 3c0efb745a172bfe96459e20cbd37b0c945d5f8d "ath9k: discard undersized packets". commit df5c4150501ee7e86383be88f6490d970adcf157 "ath9k: correctly handle short radar pulses". [ 112.835889] ------------[ cut here ]------------ [ 112.835971] WARNING: CPU: 5 PID: 0 at net/mac80211/rx.c:804 ieee80211_rx_napi+0xaac/0xb40 [mac80211] [ 112.835973] Modules linked in: ath9k_htc ath9k_common ath9k_hw ath mac80211 cfg80211 libarc4 nouveau snd_hda_codec_hdmi intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_hda_codec video snd_hda_core ttm snd_hwdep drm_kms_helper snd_pcm crct10dif_pclmul snd_seq_midi drm snd_seq_midi_event crc32_pclmul snd_rawmidi ghash_clmulni_intel snd_seq aesni_intel aes_x86_64 crypto_simd cryptd snd_seq_device glue_helper snd_timer sch_fq_codel i2c_algo_bit fb_sys_fops snd input_leds syscopyarea sysfillrect sysimgblt intel_cstate mei_me intel_rapl_perf soundcore mxm_wmi lpc_ich mei kvm_intel kvm mac_hid irqbypass parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid hid raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear e1000e ahci libahci wmi [ 112.836022] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.3.0-wt #1 [ 112.836023] Hardware name: MouseComputer Co.,Ltd. X99-S01/X99-S01, BIOS 1.0C-W7 04/01/2015 [ 112.836056] RIP: 0010:ieee80211_rx_napi+0xaac/0xb40 [mac80211] [ 112.836059] Code: 00 00 66 41 89 86 b0 00 00 00 e9 c8 fa ff ff 4c 89 b5 40 ff ff ff 49 89 c6 e9 c9 fa ff ff 48 c7 c7 e0 a2 a5 c0 e8 47 41 b0 e9 <0f> 0b 48 89 df e8 5a 94 2d ea e9 02 f9 ff ff 41 39 c1 44 89 85 60 [ 112.836060] RSP: 0018:ffffaa6180220da8 EFLAGS: 00010286 [ 112.836062] RAX: 0000000000000024 RBX: ffff909a20eeda00 RCX: 0000000000000000 [ 112.836064] RDX: 0000000000000000 RSI: ffff909a2f957448 RDI: ffff909a2f957448 [ 112.836065] RBP: ffffaa6180220e78 R08: 00000000000006e9 R09: 0000000000000004 [ 112.836066] R10: 000000000000000a R11: 0000000000000001 R12: 0000000000000000 [ 112.836068] R13: ffff909a261a47a0 R14: 0000000000000000 R15: 0000000000000004 [ 112.836070] FS: 0000000000000000(0000) GS:ffff909a2f940000(0000) knlGS:0000000000000000 [ 112.836071] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 112.836073] CR2: 00007f4e3ffffa08 CR3: 00000001afc0a006 CR4: 00000000001606e0 [ 112.836074] Call Trace: [ 112.836076] [ 112.836083] ? finish_td+0xb3/0xf0 [ 112.836092] ? ath9k_rx_prepare.isra.11+0x22f/0x2a0 [ath9k_htc] [ 112.836099] ath9k_rx_tasklet+0x10b/0x1d0 [ath9k_htc] [ 112.836105] tasklet_action_common.isra.22+0x63/0x110 [ 112.836108] tasklet_action+0x22/0x30 [ 112.836115] __do_softirq+0xe4/0x2da [ 112.836118] irq_exit+0xae/0xb0 [ 112.836121] do_IRQ+0x86/0xe0 [ 112.836125] common_interrupt+0xf/0xf [ 112.836126] [ 112.836130] RIP: 0010:cpuidle_enter_state+0xa9/0x440 [ 112.836133] Code: 3d bc 20 38 55 e8 f7 1d 84 ff 49 89 c7 0f 1f 44 00 00 31 ff e8 28 29 84 ff 80 7d d3 00 0f 85 e6 01 00 00 fb 66 0f 1f 44 00 00 <45> 85 ed 0f 89 ff 01 00 00 41 c7 44 24 10 00 00 00 00 48 83 c4 18 [ 112.836134] RSP: 0018:ffffaa61800e3e48 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde [ 112.836136] RAX: ffff909a2f96b340 RBX: ffffffffabb58200 RCX: 000000000000001f [ 112.836137] RDX: 0000001a458adc5d RSI: 0000000026c9b581 RDI: 0000000000000000 [ 112.836139] RBP: ffffaa61800e3e88 R08: 0000000000000002 R09: 000000000002abc0 [ 112.836140] R10: ffffaa61800e3e18 R11: 000000000000002d R12: ffffca617fb40b00 [ 112.836141] R13: 0000000000000002 R14: ffffffffabb582d8 R15: 0000001a458adc5d [ 112.836145] ? cpuidle_enter_state+0x98/0x440 [ 112.836149] ? menu_select+0x370/0x600 [ 112.836151] cpuidle_enter+0x2e/0x40 [ 112.836154] call_cpuidle+0x23/0x40 [ 112.836156] do_idle+0x204/0x280 [ 112.836159] cpu_startup_entry+0x1d/0x20 [ 112.836164] start_secondary+0x167/0x1c0 [ 112.836169] secondary_startup_64+0xa4/0xb0 [ 112.836173] ---[ end trace 9f4cd18479cc5ae5 ]--- Signed-off-by: Masashi Honma Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index baacbd11eb43..b5d7ef4da17f 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -973,6 +973,8 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, struct ath_htc_rx_status *rxstatus; struct ath_rx_status rx_stats; bool decrypt_error = false; + __be16 rs_datalen; + bool is_phyerr; if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", @@ -982,11 +984,24 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, rxstatus = (struct ath_htc_rx_status *)skb->data; - if (be16_to_cpu(rxstatus->rs_datalen) - - (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) { + rs_datalen = be16_to_cpu(rxstatus->rs_datalen); + if (unlikely(rs_datalen - + (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0)) { ath_err(common, "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n", - be16_to_cpu(rxstatus->rs_datalen), skb->len); + rs_datalen, skb->len); + goto rx_next; + } + + is_phyerr = rxstatus->rs_status & ATH9K_RXERR_PHY; + /* + * Discard zero-length packets and packets smaller than an ACK + * which are not PHY_ERROR (short radar pulses have a length of 3) + */ + if (unlikely(!rs_datalen || (rs_datalen < 10 && !is_phyerr))) { + ath_warn(common, + "Short RX data len, dropping (dlen: %d)\n", + rs_datalen); goto rx_next; } @@ -1011,7 +1026,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, * Process PHY errors and return so that the packet * can be dropped. */ - if (rx_stats.rs_status & ATH9K_RXERR_PHY) { + if (unlikely(is_phyerr)) { /* TODO: Not using DFS processing now. */ if (ath_cmn_process_fft(&priv->spec_priv, hdr, &rx_stats, rx_status->mactime)) { From patchwork Tue Jan 7 20:55:21 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: 234370 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 8A577C33C9E for ; Tue, 7 Jan 2020 21:08:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51126214D8 for ; Tue, 7 Jan 2020 21:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431294; bh=d1qpflQK46k/4iySWlyG7VTcPhhMCixsO4uhdBHj1/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bTMC8th2L5NXpJW4DRIbIu7LPrst+02h65O4HxGMt0Gi5EOUKUB66ozf6WEP8PhRw SJg3aAWjTAsIZ/P3a1kau3hQtPpvWLh6WwhHRGS88KGv61NdFZamDuZJOPQwiUJli9 XDkgS8ioKH1Z7ReiLlhtvUsAAJo8NpzVjOIkNRIA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729360AbgAGVIN (ORCPT ); Tue, 7 Jan 2020 16:08:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:60196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729478AbgAGVIM (ORCPT ); Tue, 7 Jan 2020 16:08:12 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7999924672; Tue, 7 Jan 2020 21:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431291; bh=d1qpflQK46k/4iySWlyG7VTcPhhMCixsO4uhdBHj1/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RZOBBRW3N+yYjhV3TCP2cDjWLSS3NaG4I8R1s71v7CEUsqMkZf4aE/VKLKikstwBY rSmpHhZO8VtJSY0LZBbpCOtm93caAGwIvcYDtjtu0HtdxxRAQVw4anN/qeULtjjui8 0n/Rx0HDXpzygQVVAxNHdICm+bQCFvk7YXkI91Rw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 111/115] net: add annotations on hh->hh_len lockless accesses Date: Tue, 7 Jan 2020 21:55:21 +0100 Message-Id: <20200107205309.837348332@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet [ Upstream commit c305c6ae79e2ce20c22660ceda94f0d86d639a82 ] KCSAN reported a data-race [1] While we can use READ_ONCE() on the read sides, we need to make sure hh->hh_len is written last. [1] BUG: KCSAN: data-race in eth_header_cache / neigh_resolve_output write to 0xffff8880b9dedcb8 of 4 bytes by task 29760 on cpu 0: eth_header_cache+0xa9/0xd0 net/ethernet/eth.c:247 neigh_hh_init net/core/neighbour.c:1463 [inline] neigh_resolve_output net/core/neighbour.c:1480 [inline] neigh_resolve_output+0x415/0x470 net/core/neighbour.c:1470 neigh_output include/net/neighbour.h:511 [inline] ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] NF_HOOK include/linux/netfilter.h:305 [inline] ndisc_send_skb+0x459/0x5f0 net/ipv6/ndisc.c:505 ndisc_send_ns+0x207/0x430 net/ipv6/ndisc.c:647 rt6_probe_deferred+0x98/0xf0 net/ipv6/route.c:615 process_one_work+0x3d4/0x890 kernel/workqueue.c:2269 worker_thread+0xa0/0x800 kernel/workqueue.c:2415 kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352 read to 0xffff8880b9dedcb8 of 4 bytes by task 29572 on cpu 1: neigh_resolve_output net/core/neighbour.c:1479 [inline] neigh_resolve_output+0x113/0x470 net/core/neighbour.c:1470 neigh_output include/net/neighbour.h:511 [inline] ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] NF_HOOK include/linux/netfilter.h:305 [inline] ndisc_send_skb+0x459/0x5f0 net/ipv6/ndisc.c:505 ndisc_send_ns+0x207/0x430 net/ipv6/ndisc.c:647 rt6_probe_deferred+0x98/0xf0 net/ipv6/route.c:615 process_one_work+0x3d4/0x890 kernel/workqueue.c:2269 worker_thread+0xa0/0x800 kernel/workqueue.c:2415 kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352 Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 29572 Comm: kworker/1:4 Not tainted 5.4.0-rc6+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events rt6_probe_deferred Signed-off-by: Eric Dumazet Reported-by: syzbot Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/firewire/net.c | 6 +++++- include/net/neighbour.h | 2 +- net/core/neighbour.c | 4 ++-- net/ethernet/eth.c | 7 ++++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 82ba110d9d1a..bbabfca812bb 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -249,7 +249,11 @@ static int fwnet_header_cache(const struct neighbour *neigh, h = (struct fwnet_header *)((u8 *)hh->hh_data + HH_DATA_OFF(sizeof(*h))); h->h_proto = type; memcpy(h->h_dest, neigh->ha, net->addr_len); - hh->hh_len = FWNET_HLEN; + + /* Pairs with the READ_ONCE() in neigh_resolve_output(), + * neigh_hh_output() and neigh_update_hhs(). + */ + smp_store_release(&hh->hh_len, FWNET_HLEN); return 0; } diff --git a/include/net/neighbour.h b/include/net/neighbour.h index c84807c1c5bd..5ce035984a4d 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -459,7 +459,7 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb do { seq = read_seqbegin(&hh->hh_lock); - hh_len = hh->hh_len; + hh_len = READ_ONCE(hh->hh_len); if (likely(hh_len <= HH_DATA_MOD)) { hh_alen = HH_DATA_MOD; diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 7597afee7068..e260d44ebdca 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1097,7 +1097,7 @@ static void neigh_update_hhs(struct neighbour *neigh) if (update) { hh = &neigh->hh; - if (hh->hh_len) { + if (READ_ONCE(hh->hh_len)) { write_seqlock_bh(&hh->hh_lock); update(hh, neigh->dev, neigh->ha); write_sequnlock_bh(&hh->hh_lock); @@ -1360,7 +1360,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb) struct net_device *dev = neigh->dev; unsigned int seq; - if (dev->header_ops->cache && !neigh->hh.hh_len) + if (dev->header_ops->cache && !READ_ONCE(neigh->hh.hh_len)) neigh_hh_init(neigh); do { diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index fd8faa0dfa61..ca06e9a53d15 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -239,7 +239,12 @@ int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 eth->h_proto = type; memcpy(eth->h_source, dev->dev_addr, ETH_ALEN); memcpy(eth->h_dest, neigh->ha, ETH_ALEN); - hh->hh_len = ETH_HLEN; + + /* Pairs with READ_ONCE() in neigh_resolve_output(), + * neigh_hh_output() and neigh_update_hhs(). + */ + smp_store_release(&hh->hh_len, ETH_HLEN); + return 0; } EXPORT_SYMBOL(eth_header_cache); From patchwork Tue Jan 7 20:55:22 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: 234328 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 BED6AC282DD for ; Tue, 7 Jan 2020 21:15:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 890272077B for ; Tue, 7 Jan 2020 21:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431722; bh=fXjGtSfV8QP65VDuktsocMkzXUFmWK/vAVxuE/HBZLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aLDsXDfWp7DAKzk5Nqr+GdVBn5u3qgx8TaPlBLruRO/l2d2OzvUScXucqRb0HEqR2 Y/VxSAnmRWqnv+FDT9dehbfvgKGR8NMsNAkFCgTCeHs2A93XbI8j5lvyb+VDxvrBsr TXfgC3ugaka7+JtRgHS6IK7gUVVnBV+AQ9RS3WiQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729665AbgAGVIP (ORCPT ); Tue, 7 Jan 2020 16:08:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:60308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbgAGVIO (ORCPT ); Tue, 7 Jan 2020 16:08:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 DC3012072A; Tue, 7 Jan 2020 21:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431294; bh=fXjGtSfV8QP65VDuktsocMkzXUFmWK/vAVxuE/HBZLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m75l9ijrQWAB2LgAn43qpnA9Y9W8R5zDAl9O8niY/Y/zPhc8BeYVjRq9PfrNYJkqj r473BWzU3ej0gfA8EEyQD5DQBWFTlhR7jOC69+pnHbKMCp3ZA4XrH+D3ybhbG2ppSp B+JxPRIVzoE074567x104yaAs/T6aLMCXkyyHR5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Richard Weinberger , Sasha Levin Subject: [PATCH 4.19 112/115] ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps Date: Tue, 7 Jan 2020 21:55:22 +0100 Message-Id: <20200107205310.309945803@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhihao Cheng [ Upstream commit 6abf57262166b4f4294667fb5206ae7ba1ba96f5 ] Running stress-test test_2 in mtd-utils on ubi device, sometimes we can get following oops message: BUG: unable to handle page fault for address: ffffffff00000140 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 280a067 P4D 280a067 PUD 0 Oops: 0000 [#1] SMP CPU: 0 PID: 60 Comm: kworker/u16:1 Kdump: loaded Not tainted 5.2.0 #13 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0 -0-ga698c8995f-prebuilt.qemu.org 04/01/2014 Workqueue: writeback wb_workfn (flush-ubifs_0_0) RIP: 0010:rb_next_postorder+0x2e/0xb0 Code: 80 db 03 01 48 85 ff 0f 84 97 00 00 00 48 8b 17 48 83 05 bc 80 db 03 01 48 83 e2 fc 0f 84 82 00 00 00 48 83 05 b2 80 db 03 01 <48> 3b 7a 10 48 89 d0 74 02 f3 c3 48 8b 52 08 48 83 05 a3 80 db 03 RSP: 0018:ffffc90000887758 EFLAGS: 00010202 RAX: ffff888129ae4700 RBX: ffff888138b08400 RCX: 0000000080800001 RDX: ffffffff00000130 RSI: 0000000080800024 RDI: ffff888138b08400 RBP: ffff888138b08400 R08: ffffea0004a6b920 R09: 0000000000000000 R10: ffffc90000887740 R11: 0000000000000001 R12: ffff888128d48000 R13: 0000000000000800 R14: 000000000000011e R15: 00000000000007c8 FS: 0000000000000000(0000) GS:ffff88813ba00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffff00000140 CR3: 000000013789d000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: destroy_old_idx+0x5d/0xa0 [ubifs] ubifs_tnc_start_commit+0x4fe/0x1380 [ubifs] do_commit+0x3eb/0x830 [ubifs] ubifs_run_commit+0xdc/0x1c0 [ubifs] Above Oops are due to the slab-out-of-bounds happened in do-while of function layout_in_gaps indirectly called by ubifs_tnc_start_commit. In function layout_in_gaps, there is a do-while loop placing index nodes into the gaps created by obsolete index nodes in non-empty index LEBs until rest index nodes can totally be placed into pre-allocated empty LEBs. @c->gap_lebs points to a memory area(integer array) which records LEB numbers used by 'in-the-gaps' method. Whenever a fitable index LEB is found, corresponding lnum will be incrementally written into the memory area pointed by @c->gap_lebs. The size ((@c->lst.idx_lebs + 1) * sizeof(int)) of memory area is allocated before do-while loop and can not be changed in the loop. But @c->lst.idx_lebs could be increased by function ubifs_change_lp (called by layout_leb_in_gaps->ubifs_find_dirty_idx_leb->get_idx_gc_leb) during the loop. So, sometimes oob happens when number of cycles in do-while loop exceeds the original value of @c->lst.idx_lebs. See detail in https://bugzilla.kernel.org/show_bug.cgi?id=204229. This patch fixes oob in layout_in_gaps. Signed-off-by: Zhihao Cheng Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- fs/ubifs/tnc_commit.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index dba87d09b989..95630f9f40dd 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c @@ -219,7 +219,7 @@ static int is_idx_node_in_use(struct ubifs_info *c, union ubifs_key *key, /** * layout_leb_in_gaps - layout index nodes using in-the-gaps method. * @c: UBIFS file-system description object - * @p: return LEB number here + * @p: return LEB number in @c->gap_lebs[p] * * This function lays out new index nodes for dirty znodes using in-the-gaps * method of TNC commit. @@ -228,7 +228,7 @@ static int is_idx_node_in_use(struct ubifs_info *c, union ubifs_key *key, * This function returns the number of index nodes written into the gaps, or a * negative error code on failure. */ -static int layout_leb_in_gaps(struct ubifs_info *c, int *p) +static int layout_leb_in_gaps(struct ubifs_info *c, int p) { struct ubifs_scan_leb *sleb; struct ubifs_scan_node *snod; @@ -243,7 +243,7 @@ static int layout_leb_in_gaps(struct ubifs_info *c, int *p) * filled, however we do not check there at present. */ return lnum; /* Error code */ - *p = lnum; + c->gap_lebs[p] = lnum; dbg_gc("LEB %d", lnum); /* * Scan the index LEB. We use the generic scan for this even though @@ -362,7 +362,7 @@ static int get_leb_cnt(struct ubifs_info *c, int cnt) */ static int layout_in_gaps(struct ubifs_info *c, int cnt) { - int err, leb_needed_cnt, written, *p; + int err, leb_needed_cnt, written, p = 0, old_idx_lebs, *gap_lebs; dbg_gc("%d znodes to write", cnt); @@ -371,9 +371,9 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) if (!c->gap_lebs) return -ENOMEM; - p = c->gap_lebs; + old_idx_lebs = c->lst.idx_lebs; do { - ubifs_assert(c, p < c->gap_lebs + c->lst.idx_lebs); + ubifs_assert(c, p < c->lst.idx_lebs); written = layout_leb_in_gaps(c, p); if (written < 0) { err = written; @@ -399,9 +399,29 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) leb_needed_cnt = get_leb_cnt(c, cnt); dbg_gc("%d znodes remaining, need %d LEBs, have %d", cnt, leb_needed_cnt, c->ileb_cnt); + /* + * Dynamically change the size of @c->gap_lebs to prevent + * oob, because @c->lst.idx_lebs could be increased by + * function @get_idx_gc_leb (called by layout_leb_in_gaps-> + * ubifs_find_dirty_idx_leb) during loop. Only enlarge + * @c->gap_lebs when needed. + * + */ + if (leb_needed_cnt > c->ileb_cnt && p >= old_idx_lebs && + old_idx_lebs < c->lst.idx_lebs) { + old_idx_lebs = c->lst.idx_lebs; + gap_lebs = krealloc(c->gap_lebs, sizeof(int) * + (old_idx_lebs + 1), GFP_NOFS); + if (!gap_lebs) { + kfree(c->gap_lebs); + c->gap_lebs = NULL; + return -ENOMEM; + } + c->gap_lebs = gap_lebs; + } } while (leb_needed_cnt > c->ileb_cnt); - *p = -1; + c->gap_lebs[p] = -1; return 0; } From patchwork Tue Jan 7 20:55:25 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: 234369 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=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 40C89C282DD for ; Tue, 7 Jan 2020 21:08:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1544C214D8 for ; Tue, 7 Jan 2020 21:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431305; bh=scddgpvllI85i/98LWMYBVIE/Q5evmoMzZcNLa0aPZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nfFRx3LG2IU0sm4OR99oSJYZtSEYZdTBfJeMCwYQ6iguhkTsS7cBCyFBOTFAXQ/2N B2wsgFKXJllYNH7Lryqndc8Q873+P4Mdz/ioLOWggCb9qkqRdvmxMvIjeqAFZ4Cg8b P0tPPQIDYNTNDwT2q8HDqribk7sl7waQNkY4xNiM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729368AbgAGVIX (ORCPT ); Tue, 7 Jan 2020 16:08:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:60574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729673AbgAGVIW (ORCPT ); Tue, 7 Jan 2020 16:08:22 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 2D5FE20880; Tue, 7 Jan 2020 21:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431301; bh=scddgpvllI85i/98LWMYBVIE/Q5evmoMzZcNLa0aPZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qmelnMm213luoFgx4fBPKu4uQTMsKhVR1HYeVha2pe+sD74mt8HULfm3OT3HOkhJo LECq9Bt9mteLRc8Pkj/FLFGzPsvb8pox3/DwUM/e4bKCt7oiuUJFPozp3yQttRb0N2 gwNxkk+ccGYg5vIcDmfm3qS9oQh3opeB53dsQT6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Shishkin , "Peter Zijlstra (Intel)" , Jiri Olsa , Vince Weaver , Ingo Molnar , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.19 115/115] perf/x86/intel/bts: Fix the use of page_private() Date: Tue, 7 Jan 2020 21:55:25 +0100 Message-Id: <20200107205311.271071706@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander Shishkin [ Upstream commit ff61541cc6c1962957758ba433c574b76f588d23 ] Commit 8062382c8dbe2 ("perf/x86/intel/bts: Add BTS PMU driver") brought in a warning with the BTS buffer initialization that is easily tripped with (assuming KPTI is disabled): instantly throwing: > ------------[ cut here ]------------ > WARNING: CPU: 2 PID: 326 at arch/x86/events/intel/bts.c:86 bts_buffer_setup_aux+0x117/0x3d0 > Modules linked in: > CPU: 2 PID: 326 Comm: perf Not tainted 5.4.0-rc8-00291-gceb9e77324fa #904 > RIP: 0010:bts_buffer_setup_aux+0x117/0x3d0 > Call Trace: > rb_alloc_aux+0x339/0x550 > perf_mmap+0x607/0xc70 > mmap_region+0x76b/0xbd0 ... It appears to assume (for lost raisins) that PagePrivate() is set, while later it actually tests for PagePrivate() before using page_private(). Make it consistent and always check PagePrivate() before using page_private(). Fixes: 8062382c8dbe2 ("perf/x86/intel/bts: Add BTS PMU driver") Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Cc: Jiri Olsa Cc: Vince Weaver Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Link: https://lkml.kernel.org/r/20191205142853.28894-2-alexander.shishkin@linux.intel.com Signed-off-by: Sasha Levin --- arch/x86/events/intel/bts.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c index 7139f6bf27ad..510f9461407e 100644 --- a/arch/x86/events/intel/bts.c +++ b/arch/x86/events/intel/bts.c @@ -71,9 +71,17 @@ struct bts_buffer { static struct pmu bts_pmu; +static int buf_nr_pages(struct page *page) +{ + if (!PagePrivate(page)) + return 1; + + return 1 << page_private(page); +} + static size_t buf_size(struct page *page) { - return 1 << (PAGE_SHIFT + page_private(page)); + return buf_nr_pages(page) * PAGE_SIZE; } static void * @@ -91,9 +99,7 @@ bts_buffer_setup_aux(struct perf_event *event, void **pages, /* count all the high order buffers */ for (pg = 0, nbuf = 0; pg < nr_pages;) { page = virt_to_page(pages[pg]); - if (WARN_ON_ONCE(!PagePrivate(page) && nr_pages > 1)) - return NULL; - pg += 1 << page_private(page); + pg += buf_nr_pages(page); nbuf++; } @@ -117,7 +123,7 @@ bts_buffer_setup_aux(struct perf_event *event, void **pages, unsigned int __nr_pages; page = virt_to_page(pages[pg]); - __nr_pages = PagePrivate(page) ? 1 << page_private(page) : 1; + __nr_pages = buf_nr_pages(page); buf->buf[nbuf].page = page; buf->buf[nbuf].offset = offset; buf->buf[nbuf].displacement = (pad ? BTS_RECORD_SIZE - pad : 0);