From patchwork Tue Jun 9 17:44:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 187701 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp641648ecs; Tue, 9 Jun 2020 11:22:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOZx08JTRz2ZgB2LQS+4VuAZCt5SJe3SXFiBqVCAlWEhXL83GIFUcBnZfPdQA+I7gC7xlx X-Received: by 2002:a17:907:94c4:: with SMTP id dn4mr25750202ejc.150.1591726945641; Tue, 09 Jun 2020 11:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591726945; cv=none; d=google.com; s=arc-20160816; b=DUTwwHwZrbTxQ1829+wzoMRBz0r92A5/x9roqfo7255vu4rpibNehj+aMEp+ExeMkp XffVKWQUOu5k1RAITC14jGVZw18dTmjpzOLu0ttHdXa/I4Jo30v3ZiopKz+J7xv0j/Iq rsEnunzUfePkCw9naDrkD0oLU/1U7k8FomR29rQXXmCVC4X1zl9zZmvPRtLYkhKzgjJm sv9h2A82iWJpRTWJynHVDSWhHIgOnDI7SZvicEZfvt1bSu/TnUu0sUHIFgkcixZ8c8mm 7yJsLW7kkGwwzYPW6R9z0VB9S2fZ+YyzukMtQmR/aMKt+fd3Mi0+h5f4zrInKcZ7f2RT Kfxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uG7MvdfT3YivL9FCIxT0/41PwyiLhEGIu2AjytJqkfU=; b=FdNGimAwMjMXre9kRRE3YbJ8Tovzrr02CytF4LT7gRof5ZcOVcqJQKHlflVFJ2dndx QksVJjbhdnLYwKIypxC9Avpf39sXQJ2/xYuWaz44/D42PBFoGciYk3giMI1qIN/rDdit 2s1zIMBD97vJCN76BmOR3jDrEeviqcIZNDvbGDsFbtxfqD5gU3bYjmRyaoc4Aq/OM6lX QM5lnbL0jIZDcUSclr18T/oDqefQM/AXJBTCQeX8IKxcwhGFOgv8QSUTK6GNBPJEzzYu CDPEgTX6GLYF+eAVk3LycOAPYMOuouaOy2c8I5Gge4u9lMJMqmHV2SVJs3KAUCC0hq8S LjGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AsfEUCK2; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl21si10493719ejb.739.2020.06.09.11.22.25; Tue, 09 Jun 2020 11:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AsfEUCK2; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730612AbgFIRsX (ORCPT + 15 others); Tue, 9 Jun 2020 13:48:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:60640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732271AbgFIRsW (ORCPT ); Tue, 9 Jun 2020 13:48:22 -0400 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 4A206207ED; Tue, 9 Jun 2020 17:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724901; bh=sAKqQsYspESBgdnN+eV9couIFzpg4RDXKq4PEh5Ww5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AsfEUCK2srszFp2b2HA7OzKcseLter37K/z/FmQautaF6YT0hQDM3Q0D772LiQQs7 iAVQQMeqAT1P1fWRJbPUa9406Y7/oHfErIOqopE2iZ6AjtcpwJ/NgumNprqH6Eytkm xmvKazHlOhaiO521vkJvzfyK13Tji5QEvYsZK1f0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhen Lei , Steffen Klassert , Guenter Roeck Subject: [PATCH 4.9 03/42] esp6: fix memleak on error path in esp6_input Date: Tue, 9 Jun 2020 19:44:09 +0200 Message-Id: <20200609174015.786573756@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Zhen Lei commit 7284fdf39a912322ce97de2d30def3c6068a418c upstream. This ought to be an omission in e6194923237 ("esp: Fix memleaks on error paths."). The memleak on error path in esp6_input is similar to esp_input of esp4. Fixes: e6194923237 ("esp: Fix memleaks on error paths.") Fixes: 3f29770723f ("ipsec: check return value of skb_to_sgvec always") Signed-off-by: Zhen Lei Signed-off-by: Steffen Klassert Cc: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- net/ipv6/esp6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -426,8 +426,10 @@ static int esp6_input(struct xfrm_state sg_init_table(sg, nfrags); ret = skb_to_sgvec(skb, sg, 0, skb->len); - if (unlikely(ret < 0)) + if (unlikely(ret < 0)) { + kfree(tmp); goto out; + } aead_request_set_crypt(req, sg, sg, elen + ivlen, iv); aead_request_set_ad(req, assoclen); From patchwork Tue Jun 9 17:44: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: 187700 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp641631ecs; Tue, 9 Jun 2020 11:22:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFHqrFRKa2gOrK0U9PBX5yb3ijHB5twQi1/6X4BxNevd+iWx5ajUfECg8RSS4HubKk3ghp X-Received: by 2002:aa7:c148:: with SMTP id r8mr28442713edp.108.1591726944771; Tue, 09 Jun 2020 11:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591726944; cv=none; d=google.com; s=arc-20160816; b=CXpEK0Oy/pldG6RrzWV1gqNvdlaGMpPsIsBalg4bq6n3H1cigTXp4+4ev9Fpm1La1u uZ+m4pCEI7176oGn8sNw4rxmc/gIYpLHndKYwoNs4Fgjj19JT2vDEkGMggSZB1X3c032 HIgIpIlIYaRFlrqJ4LVU47NWaC3iZ2wdi5fIvMJ6ehS/27rSa2CJbb6O4Z8LBAXWEq/z yvk3afXVkR+zIv+EfKBXijfYfxPzmIhI0M00wukDAgdz7LC7fFJtrBZ5QRPF4dHaVbo3 iR1oerOsE4pFIDI9/61Js5PmkxsZufGOCEAXQ3M/8hWMxYUxvrugbPd0V4TTUVb42kzu IPJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q4PantsPl6xmOYF2U58QKH49f6GLiHCSxwnIkmt2VgA=; b=GlnWXS1xud+wSldWKg6XyVPp6bhlNa+PnpLNAOonX+FHQ5Tn5BhIV2u9Kcoe1CGFs9 uHpk5PsgXwaaf3VGPGmkYje0Fwqy0WJ2iA/7hVQ4uuEZ0yV1CmtoojskN19hO0P3H4H1 9a2M+ycYOf3fx59gvLXVEREdgqhscr5853TjxgKW55zlT3Z9sqNHqL7j1DBUyDXM3wOK DKaYPpJ/mfACu1ufdHDQEtLCRlhEslFfW/qg77htgmNOYGuEscNbu/qyg3KF1n0Mt7jT 1fAvtFq6EQaSegRIKD7i5Yd8EbQnDswtMXpkufKYeLqBlLhC/qyjtxfXla75wYA3fH95 cMwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fXZ8Psdq; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl21si10493719ejb.739.2020.06.09.11.22.24; Tue, 09 Jun 2020 11:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fXZ8Psdq; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732278AbgFIRsZ (ORCPT + 15 others); Tue, 9 Jun 2020 13:48:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:60736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732272AbgFIRsY (ORCPT ); Tue, 9 Jun 2020 13:48:24 -0400 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 8B3E6207F9; Tue, 9 Jun 2020 17:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724904; bh=UGCaFbEuunkpiMPLhMo9e/ZU2NqYD3MHVp2tizz5GwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXZ8PsdqT0PZeB7tPKlamm4lyFXMkV5p4mjNedtDd9r3x4hHREMk00/VU5nlxIdN7 QjNusCxNx8SZyoy6gePxJE0pNlBAAwpi1chKdWEvAj08oya3jN1vrvjV3vKnMQtw2X knKqRuRe312nNS2mhCIrCx9/AT+ccOa150wShky0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, fengsheng , Xinwei Kong , Mark Brown , Sasha Levin Subject: [PATCH 4.9 04/42] spi: dw: use "smp_mb()" to avoid sending spi data error Date: Tue, 9 Jun 2020 19:44:10 +0200 Message-Id: <20200609174015.905169211@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Xinwei Kong [ Upstream commit bfda044533b213985bc62bd7ca96f2b984d21b80 ] Because of out-of-order execution about some CPU architecture, In this debug stage we find Completing spi interrupt enable -> prodrucing TXEI interrupt -> running "interrupt_transfer" function will prior to set "dw->rx and dws->rx_end" data, so this patch add memory barrier to enable dw->rx and dw->rx_end to be visible and solve to send SPI data error. eg: it will fix to this following low possibility error in testing environment which using SPI control to connect TPM Modules kernel: tpm tpm0: Operation Timed out kernel: tpm tpm0: tpm_relinquish_locality: : error -1 Signed-off-by: fengsheng Signed-off-by: Xinwei Kong Link: https://lore.kernel.org/r/1578019930-55858-1-git-send-email-kong.kongxinwei@hisilicon.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-dw.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.25.1 diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 16f0def9df82..babf0a337e96 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -305,6 +305,9 @@ static int dw_spi_transfer_one(struct spi_master *master, dws->len = transfer->len; spin_unlock_irqrestore(&dws->buf_lock, flags); + /* Ensure dw->rx and dw->rx_end are visible */ + smp_mb(); + spi_enable_chip(dws, 0); /* Handle per transfer options for bpw and speed */ From patchwork Tue Jun 9 17:44: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: 224611 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 130BFC433E0 for ; Tue, 9 Jun 2020 18:22:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8B162068D for ; Tue, 9 Jun 2020 18:22:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726941; bh=EbX82Yzt8Q0VSvMLZGGbjmMR+0pvA1lN1B3Jn3//PhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1AspzZ/lJc0ZyQSf5ioVoq0pCGQqagbkhmx9WDgar71plRC9SSuO0ZwSKGUNWgi5/ BRuA6+0j7/eE4Tk3jRgmvjSV9R80l4jmfBUWTsbhmIZ55bEFfMvpWz2rEIDP52gGBP Mryob4nZHy6zifapcvsvhZEoj5/eqdaHY15244Jw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732318AbgFISWJ (ORCPT ); Tue, 9 Jun 2020 14:22:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:60892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732305AbgFIRs3 (ORCPT ); Tue, 9 Jun 2020 13:48:29 -0400 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 2CEB920801; Tue, 9 Jun 2020 17:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724908; bh=EbX82Yzt8Q0VSvMLZGGbjmMR+0pvA1lN1B3Jn3//PhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYyeZe3ErAaWqFmhSeXjRhv2wz55G+C8jwZW1cs3ydzVwJ1txK3ZFZCjDMpE4G7Z/ xfUxiFNFSdPc3PCcBDwmG7S9rJa7SAcDDiizXpRNrdKkuv1VyIsJP5pqp7ccp65Q76 i37flXKPhuG6xwUsoZQkshNpKbA8VKs7oliStJdI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Greco , Eugeniy Paltsev , Vineet Gupta , Sasha Levin Subject: [PATCH 4.9 06/42] ARC: Fix ICCM & DCCM runtime size checks Date: Tue, 9 Jun 2020 19:44:12 +0200 Message-Id: <20200609174016.118334953@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Eugeniy Paltsev [ Upstream commit 43900edf67d7ef3ac8909854d75b8a1fba2d570c ] As of today the ICCM and DCCM size checks are incorrectly using mismatched units (KiB checked against bytes). The CONFIG_ARC_DCCM_SZ and CONFIG_ARC_ICCM_SZ are in KiB, but the size calculated in runtime and stored in cpu->dccm.sz and cpu->iccm.sz is in bytes. Fix that. Reported-by: Paul Greco Signed-off-by: Eugeniy Paltsev Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/setup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 9f96120eee6e..82464fae7772 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -333,12 +334,12 @@ static void arc_chk_core_config(void) if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr) panic("Linux built with incorrect DCCM Base address\n"); - if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz) + if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz) panic("Linux built with incorrect DCCM Size\n"); #endif #ifdef CONFIG_ARC_HAS_ICCM - if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz) + if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz) panic("Linux built with incorrect ICCM Size\n"); #endif From patchwork Tue Jun 9 17:44: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: 224612 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CCE4C433E0 for ; Tue, 9 Jun 2020 18:22:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3529B2067B for ; Tue, 9 Jun 2020 18:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726928; bh=0l8c9k+8yFocyzIgv8IfzIQTVYUyVs5GizGv3/sGW/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ytQbQY56Qs8Zk1CYw4tJcyMOGKiRCkVY0NL+/4N3nUwNEAfPAH2c20AqFdyYvg8NP 09KdJK+fql8FqLbaRJQe2LdKCv9lPfV/soLXR4wH3D1OHdc1P67SS4hfud3HDkrNP+ gx4c8me4ZHuRjsH/SfDaUKs6x8xgE1L0FrISkgTk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732325AbgFISV7 (ORCPT ); Tue, 9 Jun 2020 14:21:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:32832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732318AbgFIRsd (ORCPT ); Tue, 9 Jun 2020 13:48:33 -0400 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 C098B20812; Tue, 9 Jun 2020 17:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724913; bh=0l8c9k+8yFocyzIgv8IfzIQTVYUyVs5GizGv3/sGW/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uG4sTfXTAxSIY0PuiBYVMdZue1VgnI/wi23U0HmpPDBwrFJ08Xn/a3MoHVzERmLpM YeSQosTEl1mEi4NlsxUdySmsvsSdzDo9+usNQqfVtQyQqRXPVqoWyvGaKwBmNF/Di1 xPiRHqa2GrfQ5QH5uo55jkc52WbDL3rD8iu4seEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Kerr , Stan Johnson , Finn Thain , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 08/42] net: bmac: Fix read of MAC address from ROM Date: Tue, 9 Jun 2020 19:44:14 +0200 Message-Id: <20200609174016.347094176@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Jeremy Kerr [ Upstream commit ef01cee2ee1b369c57a936166483d40942bcc3e3 ] In bmac_get_station_address, We're reading two bytes at a time from ROM, but we do that six times, resulting in 12 bytes of read & writes. This means we will write off the end of the six-byte destination buffer. This change fixes the for-loop to only read/write six bytes. Based on a proposed fix from Finn Thain . Signed-off-by: Jeremy Kerr Reported-by: Stan Johnson Tested-by: Stan Johnson Reported-by: Finn Thain Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/apple/bmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c index a65d7a60f116..ffa7e7e6d18d 100644 --- a/drivers/net/ethernet/apple/bmac.c +++ b/drivers/net/ethernet/apple/bmac.c @@ -1187,7 +1187,7 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea) int i; unsigned short data; - for (i = 0; i < 6; i++) + for (i = 0; i < 3; i++) { reset_and_select_srom(dev); data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits); From patchwork Tue Jun 9 17:44:17 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: 224606 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03CB5C433DF for ; Tue, 9 Jun 2020 18:23:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D83172067B for ; Tue, 9 Jun 2020 18:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726980; bh=COC5NdZRXHs8ujGC9l4QIvWlelg5pUxAoKMI83NTNzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gY8DCZmJ1tnXzp3WljtT5aHCT+nOn4P3nT9f+A4rKE2AbpfgzK3r3/Km2sE0OTqS5 AbG/PSISB01f7Wwq+RZiHSzEV0SpgWenSgViE0nCe0YnlTg0lHn0pAa6gNNqDr4vVW 0TGMKLzPKbD0fQirKdIjxA+nx6WlKB6ehafs5F+Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732175AbgFIRrw (ORCPT ); Tue, 9 Jun 2020 13:47:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:59080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732134AbgFIRrl (ORCPT ); Tue, 9 Jun 2020 13:47:41 -0400 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 4D5E420825; Tue, 9 Jun 2020 17:47:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724860; bh=COC5NdZRXHs8ujGC9l4QIvWlelg5pUxAoKMI83NTNzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TB9ToZ4Chh3xQ2HqQ05kbKNyvzDuU5wjDEuf9X25BCge8TFphGpBBCYjXvM5Vpl4b 99+Nbfk7aAnH4Z5HSEs+Y3Tkr/IfDGjfmiSr9bYLa3lyPwjQD/TVMlq07UuSZE853+ p7yqyTXsGKAN7h2/7nzl7STY2px9RfMXfO61C9j0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 11/42] net: smsc911x: Fix runtime PM imbalance on error Date: Tue, 9 Jun 2020 19:44:17 +0200 Message-Id: <20200609174016.676966234@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Dinghao Liu [ Upstream commit 539d39ad0c61b35f69565a037d7586deaf6d6166 ] Remove runtime PM usage counter decrement when the increment function has not been called to keep the counter balanced. Signed-off-by: Dinghao Liu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/smsc/smsc911x.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 4143659615e1..264136dba674 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2506,20 +2506,20 @@ static int smsc911x_drv_probe(struct platform_device *pdev) retval = smsc911x_init(dev); if (retval < 0) - goto out_disable_resources; + goto out_init_fail; netif_carrier_off(dev); retval = smsc911x_mii_init(pdev, dev); if (retval) { SMSC_WARN(pdata, probe, "Error %i initialising mii", retval); - goto out_disable_resources; + goto out_init_fail; } retval = register_netdev(dev); if (retval) { SMSC_WARN(pdata, probe, "Error %i registering device", retval); - goto out_disable_resources; + goto out_init_fail; } else { SMSC_TRACE(pdata, probe, "Network interface: \"%s\"", dev->name); @@ -2560,9 +2560,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev) return 0; -out_disable_resources: +out_init_fail: pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); +out_disable_resources: (void)smsc911x_disable_resources(pdev); out_enable_resources_fail: smsc911x_free_resources(pdev); From patchwork Tue Jun 9 17:44:18 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: 224707 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42234C433DF for ; Tue, 9 Jun 2020 17:47:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 191E120820 for ; Tue, 9 Jun 2020 17:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724868; bh=ztWBibTLyxtPC1/akqCXHZhfQhHK7+uZLcSbCXNi+kE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LK7JFpDm9n5Rsz7zzry1b5hAbSjL1fpgLnmjNIKPeq1Mg9qCg8tLwUFYWZDFotomL 0MPvpyimpnug3qnT+xk24TSXMYMfsbUVF73bVavfMGSGHzllrDDRZaYm7iNXXcU0HR RO7eF4WDortIu1TkjEuPU+oIawK3LbGe53XTJniE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732153AbgFIRrq (ORCPT ); Tue, 9 Jun 2020 13:47:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:59158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732146AbgFIRrn (ORCPT ); Tue, 9 Jun 2020 13:47:43 -0400 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 97BC820820; Tue, 9 Jun 2020 17:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724863; bh=ztWBibTLyxtPC1/akqCXHZhfQhHK7+uZLcSbCXNi+kE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZF3kUYPzDqP+mhhBDbYul29ow8c71P5591i4pNe44VhSctAj1XsXjLfyVmr74RZ2e eBxF2opo6lC6LaOHYfx3W1RZSmEpsmLQlGea1y+RX9HoGClnGU9bcFp3ZrFkOhjZ6W glC0oqKdeB5XDz7WV0KZaBR2W9X0HVVikbmC0How= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?David_Bala=C5=BEic?= , Guillaume Nault , "David S. Miller" Subject: [PATCH 4.9 12/42] pppoe: only process PADT targeted at local interfaces Date: Tue, 9 Jun 2020 19:44:18 +0200 Message-Id: <20200609174016.816264928@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Guillaume Nault We don't want to disconnect a session because of a stray PADT arriving while the interface is in promiscuous mode. Furthermore, multicast and broadcast packets make no sense here, so only PACKET_HOST is accepted. Reported-by: David Balažic Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Guillaume Nault Signed-off-by: David S. Miller --- drivers/net/ppp/pppoe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index fa8f7c40a384..804c52c35f07 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -494,6 +494,9 @@ static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev, if (!skb) goto out; + if (skb->pkt_type != PACKET_HOST) + goto abort; + if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) goto abort; From patchwork Tue Jun 9 17:44: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: 224605 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED3CC433E1 for ; Tue, 9 Jun 2020 18:23:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A837D2067B for ; Tue, 9 Jun 2020 18:23:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726983; bh=sDGANuZ7FD1nVMA1tNWPzxIt/Uk/CzGd5Gz40qhIhgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qkQYxPnT+LtnctZVeA+mE82R5B14MQHN7MNHB7w41wY8hXDT1sYgATX83Iy3F18Ro +q94deMiGV0+cpoJ5C3JXmIFBi8XWflWbrpUT7IhoZld6Qz1LgxJeztDhN1ZqaTZcx DdOnRmmzxgcX7X2Q05y+eo4GIHA8R/GwWj7NPxE0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732472AbgFISXC (ORCPT ); Tue, 9 Jun 2020 14:23:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:59446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732146AbgFIRru (ORCPT ); Tue, 9 Jun 2020 13:47:50 -0400 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 5D46320825; Tue, 9 Jun 2020 17:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724869; bh=sDGANuZ7FD1nVMA1tNWPzxIt/Uk/CzGd5Gz40qhIhgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gerFKBfyOdKrgKQqg7t+/gmCNwuxgX8bAVSnOn/Y+wvKQ63YNULRyjb93aVuId1hB juLVS2s0FyIRvcuWsXnxlVosSJAWD0nCFr3CHjIoM6r5hT5jXCW4/PT8NGHnjZVDPJ 6ZFnR+FIbQq5hFAn9ojlnO5iu+S7ZWO69HInVhRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Giuseppe Marco Randazzo , Kalle Valo , Christian Lamparter Subject: [PATCH 4.9 15/42] p54usb: add AirVasT USB stick device-id Date: Tue, 9 Jun 2020 19:44:21 +0200 Message-Id: <20200609174017.128858518@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Giuseppe Marco Randazzo commit 63e49a9fdac1b4e97ac26cb3fe953f210d83bc53 upstream. This patch adds the AirVasT USB wireless devices 124a:4026 to the list of supported devices. It's using the ISL3886 usb firmware. Without this modification, the wiki adapter is not recognized. Cc: Signed-off-by: Giuseppe Marco Randazzo Signed-off-by: Christian Lamparter [formatted, reworded] Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200405220659.45621-1-chunkeey@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/intersil/p54/p54usb.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/wireless/intersil/p54/p54usb.c +++ b/drivers/net/wireless/intersil/p54/p54usb.c @@ -64,6 +64,7 @@ static struct usb_device_id p54u_table[] {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ + {USB_DEVICE(0x124a, 0x4026)}, /* AirVasT USB wireless device */ {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */ {USB_DEVICE(0x15a9, 0x0002)}, /* Gemtek WUBI-100GW 802.11g */ {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ From patchwork Tue Jun 9 17:44: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: 224706 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6E18C433DF for ; Tue, 9 Jun 2020 17:47:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A30220814 for ; Tue, 9 Jun 2020 17:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724875; bh=uSmy0MUZExD4KLwvodL3hKiqYAcr+JzEVorki8ODvb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Cu/6l2FGKGUmMMJy6E9IrfzOK8zib1grdMz/meniWJvZ28cgzMTTw1NyQDtrmGgtU 7lvvFeyaRMRbfokYDQIp8PLKE4klL5CWSt5m9dy8+9HM4NuefbV+NWHjvhOZooO3+Q lp/mgFMAxZpAj2s1DzgMR8NWyP0YJQYYZcYMWQak= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732181AbgFIRry (ORCPT ); Tue, 9 Jun 2020 13:47:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:59524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732173AbgFIRrw (ORCPT ); Tue, 9 Jun 2020 13:47:52 -0400 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 8218020812; Tue, 9 Jun 2020 17:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724872; bh=uSmy0MUZExD4KLwvodL3hKiqYAcr+JzEVorki8ODvb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1EgZ3u9qvt2kkqOyyl7/4rNv26P5iSfS9f8kOgfrJ4+lpMB4Rk0s7reB6M2wyjjxr Ql1TA+ELoNnCcv2TcQgveYW1KJjV7dCzUllKa+iyz+P6TBaWV4Rco2/TqqnDMBAYY2 1TqLi/j3veOTiKOpk5Yzyq1jvcUACNc8Y57QnkVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+1e925b4b836afe85a1c6@syzkaller-ppc64.appspotmail.com, syzbot+587b2421926808309d21@syzkaller-ppc64.appspotmail.com, syzbot+58320b7171734bf79d26@syzkaller.appspotmail.com, syzbot+d6074fb08bdb2e010520@syzkaller.appspotmail.com, Daniel Axtens , Andrew Morton , Michael Ellerman , Andrew Donnellan , David Rientjes , Akash Goel , Guenter Roeck , Salvatore Bonaccorso , Linus Torvalds Subject: [PATCH 4.9 16/42] kernel/relay.c: handle alloc_percpu returning NULL in relay_open Date: Tue, 9 Jun 2020 19:44:22 +0200 Message-Id: <20200609174017.236710601@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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 commit 54e200ab40fc14c863bcc80a51e20b7906608fce upstream. alloc_percpu() may return NULL, which means chan->buf may be set to NULL. In that case, when we do *per_cpu_ptr(chan->buf, ...), we dereference an invalid pointer: BUG: Unable to handle kernel data access at 0x7dae0000 Faulting instruction address: 0xc0000000003f3fec ... NIP relay_open+0x29c/0x600 LR relay_open+0x270/0x600 Call Trace: relay_open+0x264/0x600 (unreliable) __blk_trace_setup+0x254/0x600 blk_trace_setup+0x68/0xa0 sg_ioctl+0x7bc/0x2e80 do_vfs_ioctl+0x13c/0x1300 ksys_ioctl+0x94/0x130 sys_ioctl+0x48/0xb0 system_call+0x5c/0x68 Check if alloc_percpu returns NULL. This was found by syzkaller both on x86 and powerpc, and the reproducer it found on powerpc is capable of hitting the issue as an unprivileged user. Fixes: 017c59c042d0 ("relay: Use per CPU constructs for the relay channel buffer pointers") Reported-by: syzbot+1e925b4b836afe85a1c6@syzkaller-ppc64.appspotmail.com Reported-by: syzbot+587b2421926808309d21@syzkaller-ppc64.appspotmail.com Reported-by: syzbot+58320b7171734bf79d26@syzkaller.appspotmail.com Reported-by: syzbot+d6074fb08bdb2e010520@syzkaller.appspotmail.com Signed-off-by: Daniel Axtens Signed-off-by: Andrew Morton Reviewed-by: Michael Ellerman Reviewed-by: Andrew Donnellan Acked-by: David Rientjes Cc: Akash Goel Cc: Andrew Donnellan Cc: Guenter Roeck Cc: Salvatore Bonaccorso Cc: [4.10+] Link: http://lkml.kernel.org/r/20191219121256.26480-1-dja@axtens.net Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/relay.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/kernel/relay.c +++ b/kernel/relay.c @@ -578,6 +578,11 @@ struct rchan *relay_open(const char *bas return NULL; chan->buf = alloc_percpu(struct rchan_buf *); + if (!chan->buf) { + kfree(chan); + return NULL; + } + chan->version = RELAYFS_CHANNEL_VERSION; chan->n_subbufs = n_subbufs; chan->subbuf_size = subbuf_size; From patchwork Tue Jun 9 17:44: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: 224705 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CB02C433E1 for ; Tue, 9 Jun 2020 17:48:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF1DB207F9 for ; Tue, 9 Jun 2020 17:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724882; bh=akhqUkT0c9xF/42feGFbgYB1eZCfR8+2RTKObv/fnaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Slpjh1+0+u1w0XKCnjWfnui6ao5Sgq5fxLKMJcjq8uZU+hownpt2pWlO9GvEUMnxw cFc0DUjns20dlnY0PCXl29cpfBupdVgorNTLCMksyWnqeLoG3cRFNKo1acPXNpw4fr K4PbkUBakJbhO9W+00z0MAc/uOnNCc5w4U53Zjxk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732201AbgFIRsA (ORCPT ); Tue, 9 Jun 2020 13:48:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729665AbgFIRr7 (ORCPT ); Tue, 9 Jun 2020 13:47:59 -0400 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 88A8520814; Tue, 9 Jun 2020 17:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724879; bh=akhqUkT0c9xF/42feGFbgYB1eZCfR8+2RTKObv/fnaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qtX/tdr09R5lTzBjKqtOKuVK+VgsxbSVd8f86+PQ6WWvn0PmHmgii5ugzS4ZrCsfY 0fc6Yu/BvMt9x0Hey/+3ly1Qrn1rJYGRqvq4fdm+76HJHswfWFb9rvoS/ytJa1jGj/ EawD710C6kbSy/PPljq4c6crnqBxztR04QlCkUf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, yangerkun , Oliver Hartkopp , "David S. Miller" , Ben Hutchings Subject: [PATCH 4.9 19/42] slip: not call free_netdev before rtnl_unlock in slip_open Date: Tue, 9 Jun 2020 19:44:25 +0200 Message-Id: <20200609174017.570647743@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: yangerkun commit f596c87005f7b1baeb7d62d9a9e25d68c3dfae10 upstream. As the description before netdev_run_todo, we cannot call free_netdev before rtnl_unlock, fix it by reorder the code. Signed-off-by: yangerkun Reviewed-by: Oliver Hartkopp Signed-off-by: David S. Miller [bwh: Backported to <4.11: free_netdev() is called through sl_free_netdev()] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/net/slip/slip.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c @@ -867,7 +867,10 @@ err_free_chan: sl->tty = NULL; tty->disc_data = NULL; clear_bit(SLF_INUSE, &sl->flags); + /* do not call free_netdev before rtnl_unlock */ + rtnl_unlock(); sl_free_netdev(sl->dev); + return err; err_exit: rtnl_unlock(); From patchwork Tue Jun 9 17:44:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 224607 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E181C433DF for ; Tue, 9 Jun 2020 18:22:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62E9F2067B for ; Tue, 9 Jun 2020 18:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726973; bh=L99taIM+omKw6xpLci/GzbwOu6gRvGvUPFTqXy6EsDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NvyonA1bMqm35xk4YBGRiO0MYHse5QiNGAlcr/JjFtIYhrN21yJqyxJfvsFs5WJS0 CHoWAobU7W6A/lfC0uXlYAwR0a8xsmxzfwEAGKSNmeUVYRh/k2eUk2XP7KlsPNf31+ sVl1BQQ0OvyDAyuMWpFRkI3DzI3/SwJTe+6QHdt0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728304AbgFISWp (ORCPT ); Tue, 9 Jun 2020 14:22:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:60004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732212AbgFIRsD (ORCPT ); Tue, 9 Jun 2020 13:48:03 -0400 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 21D5F207F9; Tue, 9 Jun 2020 17:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724883; bh=L99taIM+omKw6xpLci/GzbwOu6gRvGvUPFTqXy6EsDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=09hjy3maDUW6fBMjwjHJLi0y+SfOjlsDmm8SvCAUkAmoNtB5dd7lqABoX84vCc/51 vw0CIJKTfvZXG+tzOL8vxLgaNU+WjdwQsR/JYVYb1eABr7qm6x46j9OCeTnzamLWsS tiWpfN8Jg/SAbafr5RQ77QImqLBpf2xZlrLFf56U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bean Huo , Can Guo , "Martin K. Petersen" , Eric Biggers Subject: [PATCH 4.9 20/42] scsi: ufs: Release clock if DMA map fails Date: Tue, 9 Jun 2020 19:44:26 +0200 Message-Id: <20200609174017.670122929@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Can Guo commit 17c7d35f141ef6158076adf3338f115f64fcf760 upstream. In queuecommand path, if DMA map fails, it bails out with clock held. In this case, release the clock to keep its usage paired. [mkp: applied by hand] Link: https://lore.kernel.org/r/0101016ed3d66395-1b7e7fce-b74d-42ca-a88a-4db78b795d3b-000000@us-west-2.amazonses.com Reviewed-by: Bean Huo Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen [EB: resolved cherry-pick conflict caused by newer kernels not having the clear_bit_unlock() line] Signed-off-by: Eric Biggers Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1512,6 +1512,7 @@ static int ufshcd_queuecommand(struct Sc err = ufshcd_map_sg(hba, lrbp); if (err) { + ufshcd_release(hba); lrbp->cmd = NULL; clear_bit_unlock(tag, &hba->lrb_in_use); goto out; From patchwork Tue Jun 9 17:44: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: 224704 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90B09C433E2 for ; Tue, 9 Jun 2020 17:48:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68A692081A for ; Tue, 9 Jun 2020 17:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724888; bh=I/C5wTw0k+vOVdGvsWnZiMB/R9OHvicC4Y/1i2mXlxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UhYF5fn3hOfhM08LnTfPNBOpBzMWgLlfhpDIrpseCsb1EV32pkMQQ5B43lW0Og9lU ftDyPNcY11+lm/KRRzWeF9J0krVxxntaKITZ2OvWvnu2FyI6lj/GThwq4BTkbpjRfK +TLRCNwBt/VuVJaZhC/KLk4iESiwXsTvIPAA6zeM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732220AbgFIRsH (ORCPT ); Tue, 9 Jun 2020 13:48:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:60068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732216AbgFIRsG (ORCPT ); Tue, 9 Jun 2020 13:48:06 -0400 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 7C9AA20814; Tue, 9 Jun 2020 17:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724885; bh=I/C5wTw0k+vOVdGvsWnZiMB/R9OHvicC4Y/1i2mXlxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3waLlpvJpRt+SOuLMIrBciDiRGnf6W+0snLeF/cN0XONymjtFS3OvpHvPt6DW9ie cf9VfG4usnWVFCottqXlBrkYj4+mumefDrr/SaVvStd8VCthOyL2A4xlCuv5OLl/xa uprOj8bczj2RG92YcwNJ+gC0PQvBg566oAXLyM6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hu Jiahui , Dan Carpenter , Eric Dumazet , Kalle Valo Subject: [PATCH 4.9 21/42] airo: Fix read overflows sending packets Date: Tue, 9 Jun 2020 19:44:27 +0200 Message-Id: <20200609174017.780861051@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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 11e7a91994c29da96d847f676be023da6a2c1359 upstream. The problem is that we always copy a minimum of ETH_ZLEN (60) bytes from skb->data even when skb->len is less than ETH_ZLEN so it leads to a read overflow. The fix is to pad skb->data to at least ETH_ZLEN bytes. Cc: Reported-by: Hu Jiahui Signed-off-by: Dan Carpenter Reviewed-by: Eric Dumazet Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200527184830.GA1164846@mwanda Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/cisco/airo.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -1928,6 +1928,10 @@ static netdev_tx_t mpi_start_xmit(struct airo_print_err(dev->name, "%s: skb == NULL!",__func__); return NETDEV_TX_OK; } + if (skb_padto(skb, ETH_ZLEN)) { + dev->stats.tx_dropped++; + return NETDEV_TX_OK; + } npacks = skb_queue_len (&ai->txq); if (npacks >= MAXTXQ - 1) { @@ -2130,6 +2134,10 @@ static netdev_tx_t airo_start_xmit(struc airo_print_err(dev->name, "%s: skb == NULL!", __func__); return NETDEV_TX_OK; } + if (skb_padto(skb, ETH_ZLEN)) { + dev->stats.tx_dropped++; + return NETDEV_TX_OK; + } /* Find a vacant FID */ for( i = 0; i < MAX_FIDS / 2 && (fids[i] & 0xffff0000); i++ ); @@ -2204,6 +2212,10 @@ static netdev_tx_t airo_start_xmit11(str airo_print_err(dev->name, "%s: skb == NULL!", __func__); return NETDEV_TX_OK; } + if (skb_padto(skb, ETH_ZLEN)) { + dev->stats.tx_dropped++; + return NETDEV_TX_OK; + } /* Find a vacant FID */ for( i = MAX_FIDS / 2; i < MAX_FIDS && (fids[i] & 0xffff0000); i++ ); From patchwork Tue Jun 9 17:44:28 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: 224608 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37264C433E1 for ; Tue, 9 Jun 2020 18:22:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FD722067B for ; Tue, 9 Jun 2020 18:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726960; bh=3VhzeYCfyFo9o7fz5Vi6e9lrLzkvJTjzxHdMTZtg2QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GJynUtOHfCtGccrct+SOAfaCmCkAPgiH2L72HpgMBHK0f4vel0gs/my1jiJaMxY0H 0TN1q1z7fwGXoQ7uzO39VvU+Zq0WwZA8WARMuPEdsjMXEdqBonRt9exdt/H2ApCgV0 2tkn01MmKLxz8+ACAhEaiVP7u4pBGpFqKfk/6cSY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728995AbgFIRsL (ORCPT ); Tue, 9 Jun 2020 13:48:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732222AbgFIRsI (ORCPT ); Tue, 9 Jun 2020 13:48:08 -0400 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 A2443207F9; Tue, 9 Jun 2020 17:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724888; bh=3VhzeYCfyFo9o7fz5Vi6e9lrLzkvJTjzxHdMTZtg2QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RUif5H1sGUTxvRBpHnUJnTP7z9fNCyyI8eBbkDOWwohC44LqRoxyZ01DfMYQDRgbP Lw0UeDRYkxfX6wvdnV39omWoW6gJF7f9/cVGe6soAAAQvnG4Sq9Y8Kus5HcZwRhdHs p0cr1jIe/tOlctaewY7jyWepJIiyP4sv370FEg0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Cong Wang , "David S. Miller" Subject: [PATCH 4.9 22/42] devinet: fix memleak in inetdev_init() Date: Tue, 9 Jun 2020 19:44:28 +0200 Message-Id: <20200609174017.889143099@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Yang Yingliang [ Upstream commit 1b49cd71b52403822731dc9f283185d1da355f97 ] When devinet_sysctl_register() failed, the memory allocated in neigh_parms_alloc() should be freed. Fixes: 20e61da7ffcf ("ipv4: fail early when creating netdev named all or default") Signed-off-by: Yang Yingliang Acked-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/devinet.c | 1 + 1 file changed, 1 insertion(+) --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -262,6 +262,7 @@ static struct in_device *inetdev_init(st err = devinet_sysctl_register(in_dev); if (err) { in_dev->dead = 1; + neigh_parms_release(&arp_tbl, in_dev->arp_parms); in_dev_put(in_dev); in_dev = NULL; goto out; From patchwork Tue Jun 9 17:44:31 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: 224609 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D51D2C433DF for ; Tue, 9 Jun 2020 18:22:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AAA452068D for ; Tue, 9 Jun 2020 18:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726952; bh=YUQ3zE6gHknWLZQ8cWA+ZL/A4ox6L2Wm10Hf9XSjg5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t6OfAI1XT/UqxR5UYW+aB0KgXBmqbPmp8O8f5+IkWUmdwnPw1GVsCE+dnBcB7+m2k ZgwALqPF3I9NkT7U68Vlqqk1gpRX/2rCB4lsjWZhnBpmxEXvniXSOYMytbszrSRswG IxIbpkzvoOMiX+DEUfD+xzlAxOqGcUsSDMojadfU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730607AbgFIRsS (ORCPT ); Tue, 9 Jun 2020 13:48:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:60410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732244AbgFIRsP (ORCPT ); Tue, 9 Jun 2020 13:48:15 -0400 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 75A4B20812; Tue, 9 Jun 2020 17:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724894; bh=YUQ3zE6gHknWLZQ8cWA+ZL/A4ox6L2Wm10Hf9XSjg5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNxUHBkIGRNvBqKRc2p2B/Bo+g7jas+Ay0jTIBJtPLxww/O123NhqUbWDH6A8/RMn cAw0eWTS9TEuodPHkvfDcdNVntp0XMiVYfpvKlMP3idHq1L6c34yLEb46RVgMPh3D9 43fpIbX2tKy6Tdg3owaZLVgEsObjWZ3JwfKq8D2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , "David S. Miller" Subject: [PATCH 4.9 25/42] NFC: st21nfca: add missed kfree_skb() in an error path Date: Tue, 9 Jun 2020 19:44:31 +0200 Message-Id: <20200609174018.230484510@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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 3decabdc714ca56c944f4669b4cdec5c2c1cea23 ] st21nfca_tm_send_atr_res() misses to call kfree_skb() in an error path. Add the missed function call to fix it. Fixes: 1892bf844ea0 ("NFC: st21nfca: Adding P2P support to st21nfca in Initiator & Target mode") Signed-off-by: Chuhong Yuan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/nfc/st21nfca/dep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/nfc/st21nfca/dep.c +++ b/drivers/nfc/st21nfca/dep.c @@ -184,8 +184,10 @@ static int st21nfca_tm_send_atr_res(stru memcpy(atr_res->gbi, atr_req->gbi, gb_len); r = nfc_set_remote_general_bytes(hdev->ndev, atr_res->gbi, gb_len); - if (r < 0) + if (r < 0) { + kfree_skb(skb); return r; + } } info->dep_info.curr_nfc_dep_pni = 0; From patchwork Tue Jun 9 17:44: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: 224703 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7649BC433E0 for ; Tue, 9 Jun 2020 17:48:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49F4E20812 for ; Tue, 9 Jun 2020 17:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724925; bh=wn3XWVZZ2akmsZZ8dExHmnbVJm8QGK5HCGpsdbydC6c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fy4eEphQweFocLO1QFydS+MQmx04Q00IElIR3+4IQpqKL94WpCJ/uqGcBiB4T5wmt hhxJQCWucTLFi0c+whyIC/dE6QZMeTpMlMd16m+cpYyJ8B6pjAbTqfB5BXicx9FbSi QRMIJWzk9SZ2eKOqVdrkeZD1kR315sN6sSIsAvYA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732368AbgFIRsl (ORCPT ); Tue, 9 Jun 2020 13:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:33164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732362AbgFIRsk (ORCPT ); Tue, 9 Jun 2020 13:48:40 -0400 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 F3ACF207ED; Tue, 9 Jun 2020 17:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724920; bh=wn3XWVZZ2akmsZZ8dExHmnbVJm8QGK5HCGpsdbydC6c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xYbpMRthdrr320EmezrU0b2hbZdUZapDwsBMq+LSz4Auubkp1yiObdcYoRs/1FZaf 2lwIFej4938dY/mHRrtEcWb0bL79EomsaZYLsnQS436+ou+KirLVPklHF0j1HFhAms VW235uwBdghC8jkDCSmB3fbUd139uEDlRV/SGCnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bin Liu , Johan Hovold Subject: [PATCH 4.9 29/42] USB: serial: usb_wwan: do not resubmit rx urb on fatal errors Date: Tue, 9 Jun 2020 19:44:35 +0200 Message-Id: <20200609174018.648291117@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Bin Liu commit 986c1748c84d7727defeaeca74a73b37f7d5cce1 upstream. usb_wwan_indat_callback() shouldn't resubmit rx urb if the previous urb status is a fatal error. Or the usb controller would keep processing the new urbs then run into interrupt storm, and has no chance to recover. Fixes: 6c1ee66a0b2b ("USB-Serial: Fix error handling of usb_wwan") Cc: stable@vger.kernel.org Signed-off-by: Bin Liu Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb_wwan.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -305,6 +305,10 @@ static void usb_wwan_indat_callback(stru if (status) { dev_dbg(dev, "%s: nonzero status: %d on endpoint %02x.\n", __func__, status, endpoint); + + /* don't resubmit on fatal errors */ + if (status == -ESHUTDOWN || status == -ENOENT) + return; } else { if (urb->actual_length) { tty_insert_flip_string(&port->port, data, From patchwork Tue Jun 9 17:44: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: 224702 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D670C433E2 for ; Tue, 9 Jun 2020 17:49:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7388C20820 for ; Tue, 9 Jun 2020 17:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724947; bh=SBq97HSBScKwgsw2VpKUNlJJSPLI3KEzhD1ab8lOY+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=D9DEPAXXQ9X2UPcU9UdIioVKdixU39ne6WYrgQe8ww0itWgadRbAYL59S2ICZiQVI Gz1buNGYs+8nPIPKIma3cdJN2MSQ4654QX+SOBEN5AemTX3Q1ZVgHj4yhwecsXlC0I yJvx7zzE/Nj3tfWEYBlkfnhctsGYI2LTP11v9TyU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732438AbgFIRtD (ORCPT ); Tue, 9 Jun 2020 13:49:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732430AbgFIRtC (ORCPT ); Tue, 9 Jun 2020 13:49:02 -0400 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 C3C6D2081A; Tue, 9 Jun 2020 17:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724941; bh=SBq97HSBScKwgsw2VpKUNlJJSPLI3KEzhD1ab8lOY+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r669+xueqexj5vbT8K6ArAxj9xR2BHhqgVgyunH896q0ossUN3/Jd2ml4oYh2qGQB DgmMqrCqlpdtLLJ3JZY3SDznJOr1t9TlDVG3silzkMpGMuoJ+Ube58FGqOgmOfq2N7 ciywOQZUfQXSRS5n4xQ4uRAqioEoVwaGh7K3XEbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Raghavendra Subject: [PATCH 4.9 33/42] tty: hvc_console, fix crashes on parallel open/close Date: Tue, 9 Jun 2020 19:44:39 +0200 Message-Id: <20200609174019.120239972@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Jiri Slaby commit 24eb2377f977fe06d84fca558f891f95bc28a449 upstream. hvc_open sets tty->driver_data to NULL when open fails at some point. Typically, the failure happens in hp->ops->notifier_add(). If there is a racing process which tries to open such mangled tty, which was not closed yet, the process will crash in hvc_open as tty->driver_data is NULL. All this happens because close wants to know whether open failed or not. But ->open should not NULL this and other tty fields for ->close to be happy. ->open should call tty_port_set_initialized(true) and close should check by tty_port_initialized() instead. So do this properly in this driver. So this patch removes these from ->open: * tty_port_tty_set(&hp->port, NULL). This happens on last close. * tty->driver_data = NULL. Dtto. * tty_port_put(&hp->port). This happens in shutdown and until now, this must have been causing a reference underflow, if I am not missing something. Signed-off-by: Jiri Slaby Cc: stable Reported-and-tested-by: Raghavendra Link: https://lore.kernel.org/r/20200526145632.13879-1-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/tty/hvc/hvc_console.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -358,15 +358,14 @@ static int hvc_open(struct tty_struct *t * tty fields and return the kref reference. */ if (rc) { - tty_port_tty_set(&hp->port, NULL); - tty->driver_data = NULL; - tty_port_put(&hp->port); printk(KERN_ERR "hvc_open: request_irq failed with rc %d.\n", rc); - } else + } else { /* We are ready... raise DTR/RTS */ if (C_BAUD(tty)) if (hp->ops->dtr_rts) hp->ops->dtr_rts(hp, 1); + tty_port_set_initialized(&hp->port, true); + } /* Force wakeup of the polling thread */ hvc_kick(); @@ -376,22 +375,12 @@ static int hvc_open(struct tty_struct *t static void hvc_close(struct tty_struct *tty, struct file * filp) { - struct hvc_struct *hp; + struct hvc_struct *hp = tty->driver_data; unsigned long flags; if (tty_hung_up_p(filp)) return; - /* - * No driver_data means that this close was issued after a failed - * hvc_open by the tty layer's release_dev() function and we can just - * exit cleanly because the kref reference wasn't made. - */ - if (!tty->driver_data) - return; - - hp = tty->driver_data; - spin_lock_irqsave(&hp->port.lock, flags); if (--hp->port.count == 0) { @@ -399,6 +388,9 @@ static void hvc_close(struct tty_struct /* We are done with the tty pointer now. */ tty_port_tty_set(&hp->port, NULL); + if (!tty_port_initialized(&hp->port)) + return; + if (C_HUPCL(tty)) if (hp->ops->dtr_rts) hp->ops->dtr_rts(hp, 0); @@ -415,6 +407,7 @@ static void hvc_close(struct tty_struct * waking periodically to check chars_in_buffer(). */ tty_wait_until_sent(tty, HVC_CLOSE_WAIT); + tty_port_set_initialized(&hp->port, false); } else { if (hp->port.count < 0) printk(KERN_ERR "hvc_close %X: oops, count is %d\n", From patchwork Tue Jun 9 17:44: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: 224616 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F229CC433DF for ; Tue, 9 Jun 2020 18:20:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C63B02067B for ; Tue, 9 Jun 2020 18:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726827; bh=e9HiqkUS9AZSGsSrgo//g785d5RIDBsE9uWjLOnWiEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MmE2kwCC48UenED5T8pSqShHPYSIltRUXL1WeKcjDwvoWB1tFnxLuk/PWdBEnn1h3 k0Gp/N7hJ9DCkspkd80dpn87CKlP7d3gaXkYqPKUtsRb2bD040fQ4krmwlh8vDGF/V jJhF9Vaa+jxkbZiZaLZN0sB8JCIojQsuFi8+xxwQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388903AbgFISUY (ORCPT ); Tue, 9 Jun 2020 14:20:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:34394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732443AbgFIRtE (ORCPT ); Tue, 9 Jun 2020 13:49:04 -0400 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 2FE9F207ED; Tue, 9 Jun 2020 17:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724943; bh=e9HiqkUS9AZSGsSrgo//g785d5RIDBsE9uWjLOnWiEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HPN01z+/ijMImzECqixuAYh4G8k93haPUs6cPV8gorrNhjEYk5XcyGfZiBGTLmE5d LqTsncz9svRcryii7PhNQ/xb+diiL3ptdUJLnu412KdH+Pm5zuHyLzBGCgI/+Cp/J8 yUMfWu0nRU8S5vHuYjdfGH+EOxprxW72VGfCa8CY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pascal Terjan Subject: [PATCH 4.9 34/42] staging: rtl8712: Fix IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK Date: Tue, 9 Jun 2020 19:44:40 +0200 Message-Id: <20200609174019.249462402@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Pascal Terjan commit 15ea976a1f12b5fd76b1bd6ff3eb5132fd28047f upstream. The value in shared headers was fixed 9 years ago in commit 8d661f1e462d ("ieee80211: correct IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK macro") and while looking at using shared headers for other duplicated constants I noticed this driver uses the old value. The macros are also defined twice in this file so I am deleting the second definition. Signed-off-by: Pascal Terjan Cc: stable Link: https://lore.kernel.org/r/20200523211247.23262-1-pterjan@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/wifi.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) --- a/drivers/staging/rtl8712/wifi.h +++ b/drivers/staging/rtl8712/wifi.h @@ -471,7 +471,7 @@ static inline unsigned char *get_hdr_bss /* block-ack parameters */ #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C -#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 +#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 @@ -565,13 +565,6 @@ struct ieee80211_ht_addt_info { #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 -/* block-ack parameters */ -#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 -#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C -#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 -#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 -#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 - /* * A-PMDU buffer sizes * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) From patchwork Tue Jun 9 17:44: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: 187687 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp759374ilo; Tue, 9 Jun 2020 10:49:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0NOGyVQ54RGMIgpnoSL0SJ1asbScyoX70pDTXVfUL1axTrNr2eHfo2Xis9LrgbSMXu9XW X-Received: by 2002:a17:906:f1d5:: with SMTP id gx21mr27429816ejb.416.1591724951226; Tue, 09 Jun 2020 10:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591724951; cv=none; d=google.com; s=arc-20160816; b=mnoKP6iHqgLFvn1QMJbQDDA8hsOom3tChqEm9eYh14OyOud+/70ki3l0je1LfpH1yL 4QGe0h7erTGp2YAN7TkJU9uOcuLfgcTzDay1IrSQBdjb6kAOUQ4lsPWQVeMKIbSQADoz Y9OeHoTL0CMG+exACeeb0PQPHQWkoI7iSrBiKI69ILQTIXxOpJ5hC+Nhug4qDBOUTUlX eeCQpeNB2PoVXy7GKZcqA1jjizclISrYQrWcOFOW6Vf9N1YPOC4ByIGKOnlmTc5VFF7K l2nyZjVvDjdLLlPbhRwN/riPGJoWPBpaiA+afIPj9kEqm45Y0cDIsdp3YfWhLGVdkRAK unJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I5IX6dAhkcrSIwtC5zG8Fjogjt4Ve38olKyyJ6TFvoI=; b=MRSNcLnXkjzxFrTkC6BTcWI9G8VfKp7zIiJS4DxH9tK0ap7Wy8WZsYdNasijA1f1/o ys7sDwuW5MVYLBl3uCisDppnpliapJYe4XJwWzh6uPDNX6rD5870RcVr8d+koHCzag3R JjWXSHRNkyKvgpNDPfdRTwxPU6R7wlXkA0KjTCpXZMhig3Lv+Q99L78smoD+q//JntTc jrnGX9udzal+qwwMV7c1rD8SI5Bj6LhNI00YvJmXB+45RoSFLCtSBS2RX50h1ALCbSbj Mntddq+vMgxplTABP8lywzaGNizUYFgqwwb71msHSp+q8A14FZg7B8F9yPxKx62AJnQ4 gNfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JOUuOu2t; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si10724049eju.485.2020.06.09.10.49.11; Tue, 09 Jun 2020 10:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JOUuOu2t; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732454AbgFIRtJ (ORCPT + 15 others); Tue, 9 Jun 2020 13:49:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:34492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730382AbgFIRtG (ORCPT ); Tue, 9 Jun 2020 13:49:06 -0400 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 7BC2F207F9; Tue, 9 Jun 2020 17:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724946; bh=TRJanvAGk+cg/amw0p3z0rAv05S5ccaGxjCfm6hEoYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOUuOu2tYtIhnG9r0o/rNwsQxlAJE8Oxg9kYPVX/qnalwK0+476kwZKNPlqzXeahw 9eGIiM4spYk8gG+gWWqmHXhsMdqcPiYfObN4zbhekohMeyQs31zfqERbb1RuO/Jaod pikJgmcGfXmg4NLxY6WB8bCXezogoCdGi6cslQZ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Douglas Anderson Subject: [PATCH 4.9 35/42] nvmem: qfprom: remove incorrect write support Date: Tue, 9 Jun 2020 19:44:41 +0200 Message-Id: <20200609174019.362323066@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Srinivas Kandagatla commit 8d9eb0d6d59a5d7028c80a30831143d3e75515a7 upstream. qfprom has different address spaces for read and write. Reads are always done from corrected address space, where as writes are done on raw address space. Writing to corrected address space is invalid and ignored, so it does not make sense to have this support in the driver which only supports corrected address space regions at the moment. Fixes: 4ab11996b489 ("nvmem: qfprom: Add Qualcomm QFPROM support.") Signed-off-by: Srinivas Kandagatla Reviewed-by: Douglas Anderson Cc: stable Link: https://lore.kernel.org/r/20200522113341.7728-1-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/qfprom.c | 14 -------------- 1 file changed, 14 deletions(-) --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -30,19 +30,6 @@ static int qfprom_reg_read(void *context return 0; } -static int qfprom_reg_write(void *context, - unsigned int reg, void *_val, size_t bytes) -{ - void __iomem *base = context; - u32 *val = _val; - int i = 0, words = bytes / 4; - - while (words--) - writel(*val++, base + reg + (i++ * 4)); - - return 0; -} - static int qfprom_remove(struct platform_device *pdev) { struct nvmem_device *nvmem = platform_get_drvdata(pdev); @@ -56,7 +43,6 @@ static struct nvmem_config econfig = { .stride = 4, .word_size = 1, .reg_read = qfprom_reg_read, - .reg_write = qfprom_reg_write, }; static int qfprom_probe(struct platform_device *pdev) From patchwork Tue Jun 9 17:44: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: 224701 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44389C433E1 for ; Tue, 9 Jun 2020 17:49:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FBEB207F9 for ; Tue, 9 Jun 2020 17:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724952; bh=ikB4s8noR1CxF9dx3pGgDKnk55QCMNe+k4/d1n8xh8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=A1WsZ+rwSONfsQWA5EopkhmivQgwhDm3g14FcPMiyMKoqeAGv5w0LnP4NBkv8V60p uQmJKRYQGx4p5QUztbPISn2t+fSYyMB6+jnhWRYfxa62kQzTtQ6oRsNK+Ow96ozAMZ nKYM4E+zOIe2dAwmQ7J8+Jab/LugCd1mgZaGtDUo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732466AbgFIRtL (ORCPT ); Tue, 9 Jun 2020 13:49:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:34584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732362AbgFIRtJ (ORCPT ); Tue, 9 Jun 2020 13:49:09 -0400 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 BFE342081A; Tue, 9 Jun 2020 17:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724948; bh=ikB4s8noR1CxF9dx3pGgDKnk55QCMNe+k4/d1n8xh8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xjo4Cn0gBdGdAPA92SmgkXdJ8RLquH6CjPqPzgsK5WmwkWNxZV4eel+rbMvXUl8ua txVwzfIo0QLc7h/WyEvbsebN32U0TMbOiq7uakvR1PYqVo0AGzNeJG6xCKX4VrmuU7 jbmCdxTDHXLXsCyT6Zmr4lMMu2U4p0tCJ8iOXGWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Gross , Borislav Petkov , Thomas Gleixner , Tony Luck , Josh Poimboeuf Subject: [PATCH 4.9 36/42] x86/cpu: Add a steppings field to struct x86_cpu_id Date: Tue, 9 Jun 2020 19:44:42 +0200 Message-Id: <20200609174019.475695691@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Mark Gross commit e9d7144597b10ff13ff2264c059f7d4a7fbc89ac upstream Intel uses the same family/model for several CPUs. Sometimes the stepping must be checked to tell them apart. On x86 there can be at most 16 steppings. Add a steppings bitmask to x86_cpu_id and a X86_MATCH_VENDOR_FAMILY_MODEL_STEPPING_FEATURE macro and support for matching against family/model/stepping. [ bp: Massage. tglx: Lightweight variant for backporting ] Signed-off-by: Mark Gross Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Reviewed-by: Tony Luck Reviewed-by: Josh Poimboeuf Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/cpu_device_id.h | 27 +++++++++++++++++++++++++++ arch/x86/kernel/cpu/match.c | 7 ++++++- include/linux/mod_devicetable.h | 6 ++++++ 3 files changed, 39 insertions(+), 1 deletion(-) --- a/arch/x86/include/asm/cpu_device_id.h +++ b/arch/x86/include/asm/cpu_device_id.h @@ -8,6 +8,33 @@ #include +#define X86_STEPPINGS(mins, maxs) GENMASK(maxs, mins) + +/** + * X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE - Base macro for CPU matching + * @_vendor: The vendor name, e.g. INTEL, AMD, HYGON, ..., ANY + * The name is expanded to X86_VENDOR_@_vendor + * @_family: The family number or X86_FAMILY_ANY + * @_model: The model number, model constant or X86_MODEL_ANY + * @_steppings: Bitmask for steppings, stepping constant or X86_STEPPING_ANY + * @_feature: A X86_FEATURE bit or X86_FEATURE_ANY + * @_data: Driver specific data or NULL. The internal storage + * format is unsigned long. The supplied value, pointer + * etc. is casted to unsigned long internally. + * + * Backport version to keep the SRBDS pile consistant. No shorter variants + * required for this. + */ +#define X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE(_vendor, _family, _model, \ + _steppings, _feature, _data) { \ + .vendor = X86_VENDOR_##_vendor, \ + .family = _family, \ + .model = _model, \ + .steppings = _steppings, \ + .feature = _feature, \ + .driver_data = (unsigned long) _data \ +} + extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match); #endif --- a/arch/x86/kernel/cpu/match.c +++ b/arch/x86/kernel/cpu/match.c @@ -33,13 +33,18 @@ const struct x86_cpu_id *x86_match_cpu(c const struct x86_cpu_id *m; struct cpuinfo_x86 *c = &boot_cpu_data; - for (m = match; m->vendor | m->family | m->model | m->feature; m++) { + for (m = match; + m->vendor | m->family | m->model | m->steppings | m->feature; + m++) { if (m->vendor != X86_VENDOR_ANY && c->x86_vendor != m->vendor) continue; if (m->family != X86_FAMILY_ANY && c->x86 != m->family) continue; if (m->model != X86_MODEL_ANY && c->x86_model != m->model) continue; + if (m->steppings != X86_STEPPING_ANY && + !(BIT(c->x86_stepping) & m->steppings)) + continue; if (m->feature != X86_FEATURE_ANY && !cpu_has(c, m->feature)) continue; return m; --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -572,6 +572,10 @@ struct mips_cdmm_device_id { /* * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id. * Although gcc seems to ignore this error, clang fails without this define. + * + * Note: The ordering of the struct is different from upstream because the + * static initializers in kernels < 5.7 still use C89 style while upstream + * has been converted to proper C99 initializers. */ #define x86cpu_device_id x86_cpu_id struct x86_cpu_id { @@ -580,6 +584,7 @@ struct x86_cpu_id { __u16 model; __u16 feature; /* bit index */ kernel_ulong_t driver_data; + __u16 steppings; }; #define X86_FEATURE_MATCH(x) \ @@ -588,6 +593,7 @@ struct x86_cpu_id { #define X86_VENDOR_ANY 0xffff #define X86_FAMILY_ANY 0 #define X86_MODEL_ANY 0 +#define X86_STEPPING_ANY 0 #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ /* From patchwork Tue Jun 9 17:44: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: 224613 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8517DC433DF for ; Tue, 9 Jun 2020 18:21:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 653DE2067B for ; Tue, 9 Jun 2020 18:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726870; bh=nQ1WDh0G+xKPXzz3fq7UntKJcHjzuMBCe9VrvgHx87g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JPq1mjKh33rYUOrOzUR5KqSCwxQ2UsdpYUTojFCZeR7qRIBo485yJjKlHotCMKGdZ ojJ38t/Fjq5AYgquYc5T2PzdZ2Ie71FNSpzCayFl5fRGMQCEbpLXKxj2FpzYj7fHjz ceG0jbj3BCWleELCHlsnN4CMYfREoCIF0V9yOUVg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732334AbgFISUy (ORCPT ); Tue, 9 Jun 2020 14:20:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:33434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732378AbgFIRsq (ORCPT ); Tue, 9 Jun 2020 13:48:46 -0400 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 B585820801; Tue, 9 Jun 2020 17:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724925; bh=nQ1WDh0G+xKPXzz3fq7UntKJcHjzuMBCe9VrvgHx87g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zMHmj3cHrcTYSliR8NsVwOY3OeTy3MN4rYJ4V6awlCvk03OBbPuioQPe41LMYYKvX uaNKhqPHd8ZfG++NzoLXSQbS3HnJR9rSzt99AF1lPXMucY+2/ViO5Ed92pd72DF1Eo CDE2xpBFiCZHOqFcuTkspCkeXV1BlMUHstsO4RQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Gross , Borislav Petkov , Tony Luck , Josh Poimboeuf Subject: [PATCH 4.9 39/42] x86/speculation: Add SRBDS vulnerability and mitigation documentation Date: Tue, 9 Jun 2020 19:44:45 +0200 Message-Id: <20200609174019.842140727@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Mark Gross commit 7222a1b5b87417f22265c92deea76a6aecd0fb0f upstream Add documentation for the SRBDS vulnerability and its mitigation. [ bp: Massage. jpoimboe: sysfs table strings. ] Signed-off-by: Mark Gross Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Reviewed-by: Josh Poimboeuf Signed-off-by: Greg Kroah-Hartman --- Documentation/hw-vuln/index.rst | 3 Documentation/hw-vuln/special-register-buffer-data-sampling.rst | 148 ++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 Documentation/hw-vuln/special-register-buffer-data-sampling.rst --- a/Documentation/hw-vuln/index.rst +++ b/Documentation/hw-vuln/index.rst @@ -12,4 +12,5 @@ are configurable at compile, boot or run l1tf mds tsx_async_abort - multihit.rst + multihit + special-register-buffer-data-sampling --- /dev/null +++ b/Documentation/hw-vuln/special-register-buffer-data-sampling.rst @@ -0,0 +1,148 @@ +.. SPDX-License-Identifier: GPL-2.0 + +SRBDS - Special Register Buffer Data Sampling +============================================= + +SRBDS is a hardware vulnerability that allows MDS :doc:`mds` techniques to +infer values returned from special register accesses. Special register +accesses are accesses to off core registers. According to Intel's evaluation, +the special register reads that have a security expectation of privacy are +RDRAND, RDSEED and SGX EGETKEY. + +When RDRAND, RDSEED and EGETKEY instructions are used, the data is moved +to the core through the special register mechanism that is susceptible +to MDS attacks. + +Affected processors +-------------------- +Core models (desktop, mobile, Xeon-E3) that implement RDRAND and/or RDSEED may +be affected. + +A processor is affected by SRBDS if its Family_Model and stepping is +in the following list, with the exception of the listed processors +exporting MDS_NO while Intel TSX is available yet not enabled. The +latter class of processors are only affected when Intel TSX is enabled +by software using TSX_CTRL_MSR otherwise they are not affected. + + ============= ============ ======== + common name Family_Model Stepping + ============= ============ ======== + Haswell 06_3CH All + Haswell_L 06_45H All + Haswell_G 06_46H All + + Broadwell_G 06_47H All + Broadwell 06_3DH All + + Skylake_L 06_4EH All + Skylake 06_5EH All + + Kabylake_L 06_8EH <=0xC + + Kabylake 06_9EH <=0xD + ============= ============ ======== + +Related CVEs +------------ + +The following CVE entry is related to this SRBDS issue: + + ============== ===== ===================================== + CVE-2020-0543 SRBDS Special Register Buffer Data Sampling + ============== ===== ===================================== + +Attack scenarios +---------------- +An unprivileged user can extract values returned from RDRAND and RDSEED +executed on another core or sibling thread using MDS techniques. + + +Mitigation mechanism +------------------- +Intel will release microcode updates that modify the RDRAND, RDSEED, and +EGETKEY instructions to overwrite secret special register data in the shared +staging buffer before the secret data can be accessed by another logical +processor. + +During execution of the RDRAND, RDSEED, or EGETKEY instructions, off-core +accesses from other logical processors will be delayed until the special +register read is complete and the secret data in the shared staging buffer is +overwritten. + +This has three effects on performance: + +#. RDRAND, RDSEED, or EGETKEY instructions have higher latency. + +#. Executing RDRAND at the same time on multiple logical processors will be + serialized, resulting in an overall reduction in the maximum RDRAND + bandwidth. + +#. Executing RDRAND, RDSEED or EGETKEY will delay memory accesses from other + logical processors that miss their core caches, with an impact similar to + legacy locked cache-line-split accesses. + +The microcode updates provide an opt-out mechanism (RNGDS_MITG_DIS) to disable +the mitigation for RDRAND and RDSEED instructions executed outside of Intel +Software Guard Extensions (Intel SGX) enclaves. On logical processors that +disable the mitigation using this opt-out mechanism, RDRAND and RDSEED do not +take longer to execute and do not impact performance of sibling logical +processors memory accesses. The opt-out mechanism does not affect Intel SGX +enclaves (including execution of RDRAND or RDSEED inside an enclave, as well +as EGETKEY execution). + +IA32_MCU_OPT_CTRL MSR Definition +-------------------------------- +Along with the mitigation for this issue, Intel added a new thread-scope +IA32_MCU_OPT_CTRL MSR, (address 0x123). The presence of this MSR and +RNGDS_MITG_DIS (bit 0) is enumerated by CPUID.(EAX=07H,ECX=0).EDX[SRBDS_CTRL = +9]==1. This MSR is introduced through the microcode update. + +Setting IA32_MCU_OPT_CTRL[0] (RNGDS_MITG_DIS) to 1 for a logical processor +disables the mitigation for RDRAND and RDSEED executed outside of an Intel SGX +enclave on that logical processor. Opting out of the mitigation for a +particular logical processor does not affect the RDRAND and RDSEED mitigations +for other logical processors. + +Note that inside of an Intel SGX enclave, the mitigation is applied regardless +of the value of RNGDS_MITG_DS. + +Mitigation control on the kernel command line +--------------------------------------------- +The kernel command line allows control over the SRBDS mitigation at boot time +with the option "srbds=". The option for this is: + + ============= ============================================================= + off This option disables SRBDS mitigation for RDRAND and RDSEED on + affected platforms. + ============= ============================================================= + +SRBDS System Information +----------------------- +The Linux kernel provides vulnerability status information through sysfs. For +SRBDS this can be accessed by the following sysfs file: +/sys/devices/system/cpu/vulnerabilities/srbds + +The possible values contained in this file are: + + ============================== ============================================= + Not affected Processor not vulnerable + Vulnerable Processor vulnerable and mitigation disabled + Vulnerable: No microcode Processor vulnerable and microcode is missing + mitigation + Mitigation: Microcode Processor is vulnerable and mitigation is in + effect. + Mitigation: TSX disabled Processor is only vulnerable when TSX is + enabled while this system was booted with TSX + disabled. + Unknown: Dependent on + hypervisor status Running on virtual guest processor that is + affected but with no way to know if host + processor is mitigated or vulnerable. + ============================== ============================================= + +SRBDS Default mitigation +------------------------ +This new microcode serializes processor access during execution of RDRAND, +RDSEED ensures that the shared buffer is overwritten before it is released for +reuse. Use the "srbds=off" kernel command line to disable the mitigation for +RDRAND and RDSEED. From patchwork Tue Jun 9 17:44:46 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: 224615 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A4A8C433E0 for ; Tue, 9 Jun 2020 18:20:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00DB72067B for ; Tue, 9 Jun 2020 18:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726838; bh=L7YJy0y9nLm8blOqjElc3xEZMQQ5twDSw/fGhd5AN1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ofDtvbP0qaWvkgL0zgAMbe9Cnd70xLu0JQi93zuLSqP+icUtBilBoPqZD79bKfNtF BXc8hTKQU2iDO5LwpyxypS5SM9F9RQpx70lkQbzCqwf/0ijHwoWnzVkGgHr+rTCRWI bE8bFKPoJ1HTRG0eaq7O6dZdKnctgtbNq6T0X2Y4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732399AbgFIRsy (ORCPT ); Tue, 9 Jun 2020 13:48:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:33560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732384AbgFIRsr (ORCPT ); Tue, 9 Jun 2020 13:48:47 -0400 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 16430207F9; Tue, 9 Jun 2020 17:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724927; bh=L7YJy0y9nLm8blOqjElc3xEZMQQ5twDSw/fGhd5AN1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hs0zG06/EC+oKQuvkoz5tq4yTKaGXxPkQLSeygvUL/1/sUCV3+wtx+CtsI6hL3mHa NBl78fFqDDnW8o/AdGHgplaB5/oe+MSz/Xvi1cJ3gTKhxP5KXt+fkdgTBMTZ2Na0Ns ODjcNgO/hRS9AfROGIUZTVc/cJ43jkvaHHhnkzDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Thomas Gleixner Subject: [PATCH 4.9 40/42] x86/speculation: Add Ivy Bridge to affected list Date: Tue, 9 Jun 2020 19:44:46 +0200 Message-Id: <20200609174019.965928408@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Josh Poimboeuf commit 3798cc4d106e91382bfe016caa2edada27c2bb3f upstream Make the docs match the code. Signed-off-by: Josh Poimboeuf Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- Documentation/hw-vuln/special-register-buffer-data-sampling.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/Documentation/hw-vuln/special-register-buffer-data-sampling.rst +++ b/Documentation/hw-vuln/special-register-buffer-data-sampling.rst @@ -27,6 +27,8 @@ by software using TSX_CTRL_MSR otherwise ============= ============ ======== common name Family_Model Stepping ============= ============ ======== + IvyBridge 06_3AH All + Haswell 06_3CH All Haswell_L 06_45H All Haswell_G 06_46H All @@ -37,9 +39,8 @@ by software using TSX_CTRL_MSR otherwise Skylake_L 06_4EH All Skylake 06_5EH All - Kabylake_L 06_8EH <=0xC - - Kabylake 06_9EH <=0xD + Kabylake_L 06_8EH <= 0xC + Kabylake 06_9EH <= 0xD ============= ============ ======== Related CVEs From patchwork Tue Jun 9 17:44: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: 224614 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72F5EC433E0 for ; Tue, 9 Jun 2020 18:20:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 422452068D for ; Tue, 9 Jun 2020 18:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591726852; bh=I8e9rXkiQJBJOMniruow/r9QenuLuPUf8wI/t2e2w7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JEApfkiQg9U7cnp3Qovyt4XLHJaD8IxHmXs9HIis5wkXJDbt/kcAwudHG4B0jC73L wg8erpmcBJ4WhoePqt59Qh3zFpF8zCjuPFLnXG0ly5NPU5hTNCZ7zQ/X7xYut9fweB TSjUlkPWtpWTSrO66P6796wg3ICBJWNRY3kLmpPY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388921AbgFISUn (ORCPT ); Tue, 9 Jun 2020 14:20:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:33674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732334AbgFIRsu (ORCPT ); Tue, 9 Jun 2020 13:48:50 -0400 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 5FB9620801; Tue, 9 Jun 2020 17:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724929; bh=I8e9rXkiQJBJOMniruow/r9QenuLuPUf8wI/t2e2w7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZ4h7GifXSawG66L9AoAWj3i4CTM/hfAmNNFNlo7OEE7IpxrFyKusuEyyCSyBU4AF Z9CGz7mX2gIy1xmtMockt4iXgR+LAw1JP6DgLIE9JJmckYiyRgLzPRhOtRjaq7SNpM 8tz/a8syih/fJwodoAUs6MhOK/t7i/TCK5v+hYxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Othacehe , Stable@vger.kernel.org, Jonathan Cameron , Sasha Levin Subject: [PATCH 4.9 41/42] iio: vcnl4000: Fix i2c swapped word reading. Date: Tue, 9 Jun 2020 19:44:47 +0200 Message-Id: <20200609174020.075090473@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@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: Mathieu Othacehe [ Upstream commit 18dfb5326370991c81a6d1ed6d1aeee055cb8c05 ] The bytes returned by the i2c reading need to be swapped unconditionally. Otherwise, on be16 platforms, an incorrect value will be returned. Taking the slow path via next merge window as its been around a while and we have a patch set dependent on this which would be held up. Fixes: 62a1efb9f868 ("iio: add vcnl4000 combined ALS and proximity sensor") Signed-off-by: Mathieu Othacehe Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/light/vcnl4000.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 360b6e98137a..5a3a532937ba 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -61,7 +61,6 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, u8 rdy_mask, u8 data_reg, int *val) { int tries = 20; - __be16 buf; int ret; mutex_lock(&data->lock); @@ -88,13 +87,12 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, goto fail; } - ret = i2c_smbus_read_i2c_block_data(data->client, - data_reg, sizeof(buf), (u8 *) &buf); + ret = i2c_smbus_read_word_swapped(data->client, data_reg); if (ret < 0) goto fail; mutex_unlock(&data->lock); - *val = be16_to_cpu(buf); + *val = ret; return 0;