From patchwork Wed Dec 11 15:04:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181223 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp657946ile; Wed, 11 Dec 2019 07:08:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyKL0E6n//+uzNurkCOyMikGcLWbI9c1yQWpQH6yNFeW1kRitIJZcNIPQAkZvi6ibij46nn X-Received: by 2002:a05:6830:1ed0:: with SMTP id c16mr2524015otj.21.1576076928851; Wed, 11 Dec 2019 07:08:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576076928; cv=none; d=google.com; s=arc-20160816; b=t/FGaHCss2V/7J55iurA+QOSg2V7YFLQjXfyo1bhbrEYSxHTmHFyhbgJI7fQotB2TE kA3fP4YTE029Y8piXqm/cUjMex3lC6snKlFU+QjD9D7quiqSHCtD4tSt8cgcXkrQxzdg A6f3Ib4a5cg+2kvP67wfERUvoTF1uzf/L2343sh5zMZQU69lNAGNXb52rTrvHJ1unfJB xR8TwjVjQeWXS2gQ99gR88Ix1rLqW43X/WuEwGyVjjwgCYLBLMyXhxHfunnSHdLOjzT3 T/oUPMR9um4zw52ngJDmLIJh068LjhtpxTp91sxSeFuoMjBGz1m5fBRhCgi4KlE1ZPoI e9MA== 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=ahFPof/eP5/Mbydk7UDpCMp1ABtv2fEMHVgLmyBl6KI=; b=cQmi6PewAI+NTkhRZNmaLiAuRBfESIAikKESoi+LwIcOlqnGPKOASbmV8QyZBX6sSL xXJo4NjbtO6RsUyYkB+jpAcBPebMXix6Wl8p6+1ngJteSPCidkkFOJjapzpVghc7zG7p Jf2uainOLo2Ki7uWpBlDqNNUvkdpcAiRtDjJV4AC0yvGdu32K4eLEtMPEtsSNUA8Gts/ 4oG4I4CntUs/V+XpoJb92VQpchfObHFzlVUd/tZQNWGW68P9kAozQCKehUhBoYsctQVK SYmBV7af19KkIgfqqOaFfjRWIq5jy2QLeJ/797vVuZUfBuE6lNJg+R4manvb4/mXYuA3 xvrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="tG9/eKBj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si1474783oto.91.2019.12.11.07.08.48; Wed, 11 Dec 2019 07:08:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="tG9/eKBj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730453AbfLKPIr (ORCPT + 27 others); Wed, 11 Dec 2019 10:08:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:56440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729746AbfLKPIo (ORCPT ); Wed, 11 Dec 2019 10:08:44 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 981AD2173E; Wed, 11 Dec 2019 15:08:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076924; bh=cRi5G9C0XWPPCnV+02MMDB3bXkRsVGf0Rh3K1z24W0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tG9/eKBj6q7FojlEGo8U1gZxjhoEtjErd8oJv9GsWL+3Gf6QtTiMyPvBzeCfpVd7t 5/xUolbovOx849FDi/XIuDb0zngmiI2J97yB2wNo4SKUQb0OcwCCj3W0skAwcDfFGS 3dPo9b9pljo4ghV/XOd54nvLldqHDWz4dYVP67jU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 5.4 06/92] lp: fix sparc64 LPSETTIMEOUT ioctl Date: Wed, 11 Dec 2019 16:04:57 +0100 Message-Id: <20191211150223.378611864@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 45a2d64696b11913bcf1087b041740edbade3e21 upstream. The layout of struct timeval is different on sparc64 from anything else, and the patch I did long ago failed to take this into account. Change it now to handle sparc64 user space correctly again. Quite likely nobody cares about parallel ports on sparc64, but there is no reason not to fix it. Cc: stable@vger.kernel.org Fixes: 9a450484089d ("lp: support 64-bit time_t user space") Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20191108203435.112759-7-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman --- drivers/char/lp.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -713,6 +713,10 @@ static int lp_set_timeout64(unsigned int if (copy_from_user(karg, arg, sizeof(karg))) return -EFAULT; + /* sparc64 suseconds_t is 32-bit only */ + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) + karg[1] >>= 32; + return lp_set_timeout(minor, karg[0], karg[1]); } From patchwork Wed Dec 11 15:05:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181222 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp656409ile; Wed, 11 Dec 2019 07:07:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxu7RxfzP8zkVsA46vK2ohwczmRI/HbLB5XVU8Z7itg/7a1+RmzTQcHxHAoG2ExPk7f0aYX X-Received: by 2002:aca:fdc2:: with SMTP id b185mr3236756oii.74.1576076866023; Wed, 11 Dec 2019 07:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576076866; cv=none; d=google.com; s=arc-20160816; b=pyunpYougCkyKiVh3yf9bElOuSlXJKfJH4dHCVqb9UCwmj4NSoVSOyTXEaF0OQUBl+ oohPYXkHNToQXDcNXiDA9Xd7mJwfI1Cd4T9TccfYXDSAFr6/bkWC6r8Iyk1HD5itnSZQ CcY0JZWxXn79zdV5PB4L77QXiBxLK1Mf09uCIc+ScpcvkKi/ysHlF8j0R4HfWD/+C8sQ RZ6DFri1XW0TW14AN85SsxdiKkoDmjgOXJLPw5KoThMgNaxNZJ9pxI7D2yrRJyj9Rtba n4i1T1GIHdZE12oHoOZODeeXQ9dm+BbGESDwt3zKnp14iL2IHTDLG7BIdyH36885hzS1 MvrA== 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=1t1aiJdfxbez9cPtxc/ntAE+5A93D0WfLY4AnymLx48=; b=OauC5ut2F2TYe6U7UzPot+tUDyBAZedLFIGu/Vnjk6gU7h7mXfbkEUP/TTvD0zEIwz AW28eijzdXv0uuEat30kbdgyh0+py5IAZd3EoBUrP7+EQav8gdbT0Gv5pGAu5/wjmKu8 UgexbMAaNb+tL3nOVPXlrdU3alJvd9KAuxB4wo/IHC7Nm1fzionc14WOruOkJCggtm2z ArbwWuXvakmFIMT7UbqGktN5b6g4gZtwbFajbnKS5FXkdFpEZ/3tAse0uje/OHH33UaI pMW6j2fchPs/Lv0WykHdJ57jFm6TnKUiO3HfX/oGuUjWhCWsSVJgo7HqZ67tSq14uzwa 8XmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="hBPDON/Q"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si1325246otj.99.2019.12.11.07.07.45; Wed, 11 Dec 2019 07:07:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="hBPDON/Q"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730097AbfLKPHn (ORCPT + 27 others); Wed, 11 Dec 2019 10:07:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:54882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730076AbfLKPHl (ORCPT ); Wed, 11 Dec 2019 10:07:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B34C020663; Wed, 11 Dec 2019 15:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076861; bh=2iLlGMrkETmSLochaz1pSpins8fUVRRprn5VD23TrUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hBPDON/QeMDl5YXMoN3sWsdOTNpqscPoE6+o87pq6AcX+0eCRAgcB6eaEUS1Bouch qdzrmyMRXNKOuyWN4l3WRsGX8PTwL54Qcbj9xZMPgfv3R1Ec1BdZQOGuDlGTACQ7bO y4jRlVbKsUZ52olKzg7pdoo9EXwwuOSfpDXi+mUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Kalle Valo , Ulf Hansson Subject: [PATCH 5.4 19/92] mwifiex: Re-work support for SDIO HW reset Date: Wed, 11 Dec 2019 16:05:10 +0100 Message-Id: <20191211150227.375343546@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson commit cdb2256f795e8e78cc43f32d091695b127dfb4df upstream. The SDIO HW reset procedure in mwifiex_sdio_card_reset_work() is broken, when the SDIO card is shared with another SDIO func driver. This is the case when the Bluetooth btmrvl driver is being used in combination with mwifiex. More precisely, when mwifiex_sdio_card_reset_work() runs to resets the SDIO card, the btmrvl driver doesn't get notified about it. Beyond that point, the btmrvl driver will fail to communicate with the SDIO card. This is a generic problem for SDIO func drivers sharing an SDIO card, which are about to be addressed in subsequent changes to the mmc core and the mmc_hw_reset() interface. In principle, these changes means the mmc_hw_reset() interface starts to return 1 if the are multiple drivers for the SDIO card, as to indicate to the caller that the reset needed to be scheduled asynchronously through a hotplug mechanism of the SDIO card. Let's prepare the mwifiex driver to support the upcoming new behaviour of mmc_hw_reset(), which means extending the mwifiex_sdio_card_reset_work() to support the asynchronous SDIO HW reset path. This also means, we need to allow the ->remove() callback to run, without waiting for the FW to be loaded. Additionally, during system suspend, mwifiex_sdio_suspend() may be called when a reset has been scheduled, but waiting to be executed. In this scenario let's simply return -EBUSY to abort the suspend process, as to allow the reset to be completed first. Reviewed-by: Douglas Anderson Tested-by: Douglas Anderson Cc: stable@vger.kernel.org # v5.4+ Acked-by: Kalle Valo Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/marvell/mwifiex/main.c | 5 +++- drivers/net/wireless/marvell/mwifiex/main.h | 1 drivers/net/wireless/marvell/mwifiex/sdio.c | 33 ++++++++++++++++++---------- 3 files changed, 27 insertions(+), 12 deletions(-) --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -631,6 +631,7 @@ static int _mwifiex_fw_dpc(const struct mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); mwifiex_dbg(adapter, MSG, "driver_version = %s\n", fmt); + adapter->is_up = true; goto done; err_add_intf: @@ -1469,6 +1470,7 @@ int mwifiex_shutdown_sw(struct mwifiex_a mwifiex_deauthenticate(priv, NULL); mwifiex_uninit_sw(adapter); + adapter->is_up = false; if (adapter->if_ops.down_dev) adapter->if_ops.down_dev(adapter); @@ -1730,7 +1732,8 @@ int mwifiex_remove_card(struct mwifiex_a if (!adapter) return 0; - mwifiex_uninit_sw(adapter); + if (adapter->is_up) + mwifiex_uninit_sw(adapter); if (adapter->irq_wakeup >= 0) device_init_wakeup(adapter->dev, false); --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1017,6 +1017,7 @@ struct mwifiex_adapter { /* For synchronizing FW initialization with device lifecycle. */ struct completion *fw_done; + bool is_up; bool ext_scan; u8 fw_api_ver; --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -444,6 +444,9 @@ static int mwifiex_sdio_suspend(struct d return 0; } + if (!adapter->is_up) + return -EBUSY; + mwifiex_enable_wake(adapter); /* Enable the Host Sleep */ @@ -2220,22 +2223,30 @@ static void mwifiex_sdio_card_reset_work struct sdio_func *func = card->func; int ret; + /* Prepare the adapter for the reset. */ mwifiex_shutdown_sw(adapter); + clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags); + clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags); - /* power cycle the adapter */ + /* Run a HW reset of the SDIO interface. */ sdio_claim_host(func); - mmc_hw_reset(func->card->host); + ret = mmc_hw_reset(func->card->host); sdio_release_host(func); - /* Previous save_adapter won't be valid after this. We will cancel - * pending work requests. - */ - clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags); - clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags); - - ret = mwifiex_reinit_sw(adapter); - if (ret) - dev_err(&func->dev, "reinit failed: %d\n", ret); + switch (ret) { + case 1: + dev_dbg(&func->dev, "SDIO HW reset asynchronous\n"); + complete_all(adapter->fw_done); + break; + case 0: + ret = mwifiex_reinit_sw(adapter); + if (ret) + dev_err(&func->dev, "reinit failed: %d\n", ret); + break; + default: + dev_err(&func->dev, "SDIO HW reset failed: %d\n", ret); + break; + } } /* This function read/write firmware */ From patchwork Wed Dec 11 15:05:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181225 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp659006ile; Wed, 11 Dec 2019 07:09:34 -0800 (PST) X-Google-Smtp-Source: APXvYqxWAgxa/L5jG91eClApEqO3HWarB+UAHuZ6AhIJKDW8tqor2Exhm66Dtf4QEy0ItrfGJ7ne X-Received: by 2002:a9d:175:: with SMTP id 108mr2606830otu.325.1576076973990; Wed, 11 Dec 2019 07:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576076973; cv=none; d=google.com; s=arc-20160816; b=KpSKNnfYMieIFYXazKUnlgZwlTopxkmKmZ7/aeZZQBSzOcH0EufMb8zpn/2OIYM+nY 1tpdWuBSY1KCP9drc4EYS/Yh3GOgwzXs/P5ZD89Su+mwMQj2J0ZJlepZ/FI9G+XnuXa3 T3xJ6n0Wv3Ftt0jnuZC0YeLy4pJwHpRWTLl9zUlYd3zCV5e61zR1HvSjLHItWlj2DzbE s/exM6A8Y2hEdOk5dmNUkDln8GwMI/d4yAAF1fKYpKmDOO0PG74Waw2CgIL73n8mAmt4 ADTKsY16wBvfCIgQ/3rzAqwBuPiWnRtWfD4I1JcZ6IB6Qd5s/yeSQ5xGWSE+xpZ79eOf uYYw== 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=1GCeVi0wFHUJ20MAZg8EOwin7RX10f+3oLY6JTc9rH0=; b=GTNXOmEQ8qPmq9Wqs1BK/HsWcFeEKwr0NQ4dGxWZaMOJbxZvwfXRAhMtuC9bgFeuwW Ui0Hz2yK2Ws8xi0JWmsDCsVdWn20piwjXimRXWzh1XsQxvJdqIoYU2gU78Pj2lWMUq/P shhPNQADjhehWwGD7J1DxD9hO1YoN9qocqMU+d/YawyavTlX9Vf68eb2MNl+O+5mPNip sx99YPmxFwRTJdVnvxGPlefKsa1NlZU/I1beeZNmwZaeVh9zSizBPZFAEH1a52ajYuje SDIpGH4GHl8VqGQll/PdJx4W3fMLq9BDewWy4uG/0gadgAv7Osz+BL/F5J+KwZJSlaZo TKww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vnsy1gCl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l64si1326524oih.2.2019.12.11.07.09.33; Wed, 11 Dec 2019 07:09:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vnsy1gCl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730611AbfLKPJc (ORCPT + 27 others); Wed, 11 Dec 2019 10:09:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:57454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729469AbfLKPJ1 (ORCPT ); Wed, 11 Dec 2019 10:09:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 35CCB2173E; Wed, 11 Dec 2019 15:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076966; bh=6rSHqQOKRJDP5GDgm2zXS+ZfuDLtPuPcrmNNgsXGsn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vnsy1gCllHvh9AZ8euBbrfTQUWoirv2zDaVkFCD+xZePtezJyuYOrp+/DOlkGAnA8 VGV2PXn07WfFdGT1D2cuCuKaj/zyYGbbvtWSHWPc9axWPg5qbMRg6jHeSZg+iqmRE+ NR0lD5g0fdBrmV9+3xsuiXDciKtIZ1k5gROIz/Gg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Mathieu Poirier , Mike Leach Subject: [PATCH 5.4 41/92] coresight: etm4x: Fix input validation for sysfs. Date: Wed, 11 Dec 2019 16:05:32 +0100 Message-Id: <20191211150240.186092611@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Leach commit 2fe6899e36aa174abefd017887f9cfe0cb60c43a upstream. A number of issues are fixed relating to sysfs input validation:- 1) bb_ctrl_store() - incorrect compare of bit select field to absolute value. Reworked per ETMv4 specification. 2) seq_event_store() - incorrect mask value - register has two event values. 3) cyc_threshold_store() - must mask with max before checking min otherwise wrapped values can set illegal value below min. 4) res_ctrl_store() - update to mask off all res0 bits. Reviewed-by: Leo Yan Reviewed-by: Mathieu Poirier Signed-off-by: Mike Leach Fixes: a77de2637c9eb ("coresight: etm4x: moving sysFS entries to a dedicated file") Cc: stable # 4.9+ Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20191104181251.26732-6-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -652,10 +652,13 @@ static ssize_t cyc_threshold_store(struc if (kstrtoul(buf, 16, &val)) return -EINVAL; + + /* mask off max threshold before checking min value */ + val &= ETM_CYC_THRESHOLD_MASK; if (val < drvdata->ccitmin) return -EINVAL; - config->ccctlr = val & ETM_CYC_THRESHOLD_MASK; + config->ccctlr = val; return size; } static DEVICE_ATTR_RW(cyc_threshold); @@ -686,14 +689,16 @@ static ssize_t bb_ctrl_store(struct devi return -EINVAL; if (!drvdata->nr_addr_cmp) return -EINVAL; + /* - * Bit[7:0] selects which address range comparator is used for - * branch broadcast control. + * Bit[8] controls include(1) / exclude(0), bits[0-7] select + * individual range comparators. If include then at least 1 + * range must be selected. */ - if (BMVAL(val, 0, 7) > drvdata->nr_addr_cmp) + if ((val & BIT(8)) && (BMVAL(val, 0, 7) == 0)) return -EINVAL; - config->bb_ctrl = val; + config->bb_ctrl = val & GENMASK(8, 0); return size; } static DEVICE_ATTR_RW(bb_ctrl); @@ -1324,8 +1329,8 @@ static ssize_t seq_event_store(struct de spin_lock(&drvdata->spinlock); idx = config->seq_idx; - /* RST, bits[7:0] */ - config->seq_ctrl[idx] = val & 0xFF; + /* Seq control has two masks B[15:8] F[7:0] */ + config->seq_ctrl[idx] = val & 0xFFFF; spin_unlock(&drvdata->spinlock); return size; } @@ -1580,7 +1585,7 @@ static ssize_t res_ctrl_store(struct dev if (idx % 2 != 0) /* PAIRINV, bit[21] */ val &= ~BIT(21); - config->res_ctrl[idx] = val; + config->res_ctrl[idx] = val & GENMASK(21, 0); spin_unlock(&drvdata->spinlock); return size; } From patchwork Wed Dec 11 15:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181224 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp658917ile; Wed, 11 Dec 2019 07:09:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx1BOIstzzi4t0WCGF+kwuRX9sIVgbLdyNHGlcrEHhqJET1147gH0yMk/47h4f+SKJoiBFM X-Received: by 2002:a05:6830:1b6a:: with SMTP id d10mr2739005ote.52.1576076970380; Wed, 11 Dec 2019 07:09:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576076970; cv=none; d=google.com; s=arc-20160816; b=tLa7RxbaDEQPmJ2eUBE2M1n//jcxCwOyJtuM9K1SXeSctoQnz21f5FH+9vAcsODn4Q 6qzZbMP+mQKTsSYscsJmQVuwYFZ7bWHs6tdDPV7hqhZgac+Ez3cYt+y6B43/oi0H26GL dZ75C3A1SkduJQY+u9kGyHbcWilOBOB6xonlhPfryAds2By/EpgcO5qARAqVQX+dVus9 48aTVJDAjHr/J7hLccpe2Li/rJj7d7tgkR8eoGPK8QKV6q6i7XQSaNE938/D1ei494d6 SOQihczqRCsVYFobUKolMray295P4pP1MFRtOWBJZldbWS9Ri/RJxE28P0tvNlQ+WD7d ScjQ== 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=PlxxkkhDAN06rvl5SClKVwErWF6mWZYpt+9mb1lmYIU=; b=ZOesUpn5VBRezyZBj9a92IBIrFl0PkaiMJJreklZSD+Cy3csETlfL8WdCtR3ChGFIo b8ZYhIf9DJOMDjWfpKyc0Mq/TtxVtQNQ3jKufXTduzshBecvikF966eI9frTp6QEyaxn 0jBtNu3tHltf+z9o5yyUltOqQwkq51yMZWEZ0q+teH5+H2Ch9oGOMRyeJK1L5RF4T4rW t9eyj/dOjA9Jn9wbf5WLmUWM9dNUclg97jvDmBuLA5oMMPxKMbmjffOLJpuiXkhJ+qBh L5s3S88+cmVOftuagUJSs6zJMJnWZqz7/8HPVyrT7nS6tydIgkaKd8QVns5fuVL88uAx FeIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KFHH4tGX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l64si1326524oih.2.2019.12.11.07.09.30; Wed, 11 Dec 2019 07:09:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KFHH4tGX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730145AbfLKPJ2 (ORCPT + 27 others); Wed, 11 Dec 2019 10:09:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:57318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729481AbfLKPJV (ORCPT ); Wed, 11 Dec 2019 10:09:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A3BC222C4; Wed, 11 Dec 2019 15:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076960; bh=rVwHSdF1S7JYEeKe0HR7QEXKgXHVfwcBcfN5qKNNnMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFHH4tGXt5Bhnmtn+9gPk8OmmF+a9WRnjHqNNy6CSFEgnRZlGE22ok4oiAk46l9QC WGHSd40gptVlaPjh8yGuJprdjV491FoS0V5Dtix+xzgLWBi3oGXJ7rk1q2fGvA/27Z wfuItKbdFv93kpOIO5VMd9Q1dp9Se03leHFKeXIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Evgenii Stepanov , Catalin Marinas Subject: [PATCH 5.4 57/92] arm64: Validate tagged addresses in access_ok() called from kernel threads Date: Wed, 11 Dec 2019 16:05:48 +0100 Message-Id: <20191211150247.321136840@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Catalin Marinas commit df325e05a682e9c624f471835c35bd3f870d5e8c upstream. __range_ok(), invoked from access_ok(), clears the tag of the user address only if CONFIG_ARM64_TAGGED_ADDR_ABI is enabled and the thread opted in to the relaxed ABI. The latter sets the TIF_TAGGED_ADDR thread flag. In the case of asynchronous I/O (e.g. io_submit()), the access_ok() may be called from a kernel thread. Since kernel threads don't have TIF_TAGGED_ADDR set, access_ok() will fail for valid tagged user addresses. Example from the ffs_user_copy_worker() thread: use_mm(io_data->mm); ret = ffs_copy_to_iter(io_data->buf, ret, &io_data->data); unuse_mm(io_data->mm); Relax the __range_ok() check to always untag the user address if called in the context of a kernel thread. The user pointers would have already been checked via aio_setup_rw() -> import_{single_range,iovec}() at the time of the asynchronous I/O request. Fixes: 63f0c6037965 ("arm64: Introduce prctl() options to control the tagged user addresses ABI") Cc: # 5.4.x- Cc: Will Deacon Reported-by: Evgenii Stepanov Tested-by: Evgenii Stepanov Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/uaccess.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -62,8 +62,13 @@ static inline unsigned long __range_ok(c { unsigned long ret, limit = current_thread_info()->addr_limit; + /* + * Asynchronous I/O running in a kernel thread does not have the + * TIF_TAGGED_ADDR flag of the process owning the mm, so always untag + * the user address before checking. + */ if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI) && - test_thread_flag(TIF_TAGGED_ADDR)) + (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) addr = untagged_addr(addr); __chk_user_ptr(addr); From patchwork Wed Dec 11 15:05:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181287 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp737580ile; Wed, 11 Dec 2019 08:12:33 -0800 (PST) X-Google-Smtp-Source: APXvYqyH+yk0fe1P2aQ+144cEHzMJVo9hYAGMJORkJ08oisOAVNn49nXj55mdhEfc3SeUKdcbXA4 X-Received: by 2002:a05:6830:22e2:: with SMTP id t2mr2906277otc.129.1576080752934; Wed, 11 Dec 2019 08:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080752; cv=none; d=google.com; s=arc-20160816; b=uwL7nKVJAkwmz7OZrd5M84Uqatmvs7nraTkRAlT/wgx+wXzieqXcRoMpJdVWL+k7zX zUPU/EIYB/YQuGCNxirgKKTYx3M4zal5hpKYrBDfNaqvJVaOisdrkhnKY8v/jw7omy/6 3P+l6pIyg8HyW2zsI+gr7khaqcLPSCAXm3xc57NgPPD1qW/pMRFhlPGvylLoYWXIibdB 16kbiBGzB34forBCaKqDZ/HH56XskQa0XymxPICbYdKUY+bsQo1j3a6Fu+DEHxjNyo3j 71AafrOotMEpjpVt5e8fVOUDQ1oeMynLSV2EvzM5KkKGtCCjBu7Vw40ae/zNpZPu3k7h TPzQ== 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=6P8OpsLBXVHpLA4zdv2eSAP8aKy4Kgl3aINFEeAC4L4=; b=CpUcQbvuod+BSwiOTMxxx/aoZR8Phq2owztMgpA3AdymGDtJ1oKT4Vi30+QSA2E7aR XWZp8w5jpIcM/YYnUETXffxqEM+TrfYlQz6FChHiXh3KXzejasmWcvLmsUsIFntvnoih SRB0z5g8M0U3JPJiDBkLfPeabCCOtREU+R+gAjm0PTa3LI3jQVRpQFoLGCE12GtQW0E6 uKvEhvHBIoHub1GVFXm0SRP8GKNe/xySgOMrc2loUT1CHCbodykF/Y0KH26F4Zeyyzy7 lsYHhMjhg0hV72BQAZHpOWT/g7j8mU3/coB6q1MaKs6bM/QcrlxhIucXGxQq1JYojH0S +3rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yYGsdJg4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p71si1420158oic.138.2019.12.11.08.12.32; Wed, 11 Dec 2019 08:12:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yYGsdJg4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730601AbfLKPJa (ORCPT + 27 others); Wed, 11 Dec 2019 10:09:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:57408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729994AbfLKPJZ (ORCPT ); Wed, 11 Dec 2019 10:09:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BFAAE24658; Wed, 11 Dec 2019 15:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076964; bh=ATBWun4wWF0hfWPoCuDAJUpd6PpKWorGF7fWEHv5zi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yYGsdJg4JM0LQeLp595HCLSVUt7oZzX/AfTJERpfshakCAFRk306v9Wh7dAc43bTe +S1VQ7NCFQvN7wGes7L291WitMmDuqlGZJ1Qkvf+b/WPjk1TpJjxuddwFxgX7Gt7If zM7Lb7IStYFsnEJDKa9h4ariRYvwRx7xnv6aV538= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alim Akhtar , Marek Szyprowski , Krzysztof Kozlowski Subject: [PATCH 5.4 58/92] arm64: dts: exynos: Revert "Remove unneeded address space mapping for soc node" Date: Wed, 11 Dec 2019 16:05:49 +0100 Message-Id: <20191211150247.546562289@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Szyprowski commit bed903167ae5b5532eda5d7db26de451bd232da5 upstream. Commit ef72171b3621 ("arm64: dts: exynos: Remove unneeded address space mapping for soc node") changed the address and size cells in root node from 2 to 1, but /memory nodes for the affected boards were not updated. This went unnoticed on Exynos5433-based TM2(e) boards, because they use u-boot, which updates /memory node to the correct values. On the other hand, the mentioned commit broke boot on Exynos7-based Espresso board, which bootloader doesn't touch /memory node at all. This patch reverts commit ef72171b3621 ("arm64: dts: exynos: Remove unneeded address space mapping for soc node"), so Exynos5433 and Exynos7 SoCs again matches other ARM64 platforms with 64bit mappings in root node. Reported-by: Alim Akhtar Fixes: ef72171b3621 ("arm64: dts: exynos: Remove unneeded address space mapping for soc node") Signed-off-by: Marek Szyprowski Cc: # 5.3.x: 72ddcf6aa224 arm64: dts: exynos: Move GPU under /soc node for Exynos5433 Cc: # 5.3.x: ede87c3a2bdb arm64: dts: exynos: Move GPU under /soc node for Exynos7 Cc: # 4.18.x Tested-by: Alim Akhtar Signed-off-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman --- arch/arm64/boot/dts/exynos/exynos5433.dtsi | 6 +++--- arch/arm64/boot/dts/exynos/exynos7.dtsi | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) --- a/arch/arm64/boot/dts/exynos/exynos5433.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos5433.dtsi @@ -18,8 +18,8 @@ / { compatible = "samsung,exynos5433"; - #address-cells = <1>; - #size-cells = <1>; + #address-cells = <2>; + #size-cells = <2>; interrupt-parent = <&gic>; @@ -311,7 +311,7 @@ compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; - ranges; + ranges = <0x0 0x0 0x0 0x18000000>; chipid@10000000 { compatible = "samsung,exynos4210-chipid"; --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi @@ -12,8 +12,8 @@ / { compatible = "samsung,exynos7"; interrupt-parent = <&gic>; - #address-cells = <1>; - #size-cells = <1>; + #address-cells = <2>; + #size-cells = <2>; aliases { pinctrl0 = &pinctrl_alive; @@ -98,7 +98,7 @@ compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; - ranges; + ranges = <0 0 0 0x18000000>; chipid@10000000 { compatible = "samsung,exynos4210-chipid"; From patchwork Wed Dec 11 15:06:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181286 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp736953ile; Wed, 11 Dec 2019 08:12:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxdbKsWol+2fQ5lnbJEQI4zQXdHOUi8CqjzWDU6CRlbeS3OeQi80L8htbe4jc//8Gcx+0o6 X-Received: by 2002:aca:2109:: with SMTP id 9mr3134344oiz.119.1576080730365; Wed, 11 Dec 2019 08:12:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080730; cv=none; d=google.com; s=arc-20160816; b=x8WwddJsmfiDYnMG1aZM5jqvWhbjhyRCqJXgqplXopi/lrdV2iFsZolCI53xPzu48H PdD5dlcJauHicIAB/8P/BJG/thWlyfxNaM95ROxYzl/+SyhRgxCntkdjhEfHtKmAW6Hl NiwaRfXPOhxQmYVJUaOjOyB0aYMEpT6f19oqvrewxoHvnvOdeCUW/26HmSmYWC7HZ9Ob 3nBbv/rdWFaESCm2fYqkpCPIxJN9qVmnyWJlN/rNTOfDMozbYiX6/Z45/NcmLshSQMXn W78YXUICAxxNUVpUcxnYJGKBHCbMPdBwtiFKobx8ki0dSCaTAQxHLNfNO6l07C8SyEUM +K5w== 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=J5avmDOizACNmofqYuRE17p3bdRhlNoj/rXPF0Yd520=; b=PUlqVDQkCaO5wI3R7GAAzuECMGEbxYkl7A7Apus+ywv0oDt997eei5CfjFts2sbHU3 SjMxOjUOqj5f0BozQtP2u8HkigwNCbNf66SXEkzgINdGvwG/n8K+vGW0jlT3iMaWapu0 i6jFvzPj95VeutPlFMnQMuwzQeJDESn3X8K0CFQGMgoXKt5LkipvbKobK1OpUUl3mwrD PhVaK+YB/wsS+HlR5dMj5ZPYznHBt/+rcnivmecKl4jNdOEop3hUPpgEctqXEQLG/U7R h+0LZKJOOonsbjG+UTCIt4LiKQK1T4wo56/ICmv2CxCOdsc8VnNAFeh53I1UqdtULwcG hxZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="pdG/rM1s"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25si1443143oiz.230.2019.12.11.08.12.10; Wed, 11 Dec 2019 08:12:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="pdG/rM1s"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731006AbfLKQMI (ORCPT + 27 others); Wed, 11 Dec 2019 11:12:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:58248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730688AbfLKPKE (ORCPT ); Wed, 11 Dec 2019 10:10:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D272120663; Wed, 11 Dec 2019 15:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077003; bh=KMskS2d1qc91r8quykui3HyZFlFhTsVOYc2Ir+Blyro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pdG/rM1s+Oge093Bbs+cKTwBmC7zMJ9ePFCQupYTQFNHXtdwg0EMxc5Yt2sBVDt25 SiqW8Lu/RDOZdjpSZxea95CZfpfICx2L9c4ICt7J1d4yZryEFM8lP7o4XLv0Cy3+It TZ0g64DGqpha53a/KMhzYg5IxlYgV4OJkxwEwvHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Florian Bezdeka , Herbert Xu Subject: [PATCH 5.4 71/92] crypto: geode-aes - switch to skcipher for cbc(aes) fallback Date: Wed, 11 Dec 2019 16:06:02 +0100 Message-Id: <20191211150256.526348368@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel commit 504582e8e40b90b8f8c58783e2d1e4f6a2b71a3a upstream. Commit 79c65d179a40e145 ("crypto: cbc - Convert to skcipher") updated the generic CBC template wrapper from a blkcipher to a skcipher algo, to get away from the deprecated blkcipher interface. However, as a side effect, drivers that instantiate CBC transforms using the blkcipher as a fallback no longer work, since skciphers can wrap blkciphers but not the other way around. This broke the geode-aes driver. So let's fix it by moving to the sync skcipher interface when allocating the fallback. At the same time, align with the generic API for ECB and CBC by rejecting inputs that are not a multiple of the AES block size. Fixes: 79c65d179a40e145 ("crypto: cbc - Convert to skcipher") Cc: # v4.20+ ONLY Signed-off-by: Ard Biesheuvel Signed-off-by: Florian Bezdeka Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/geode-aes.c | 57 ++++++++++++++++++++++++++------------------- drivers/crypto/geode-aes.h | 2 - 2 files changed, 34 insertions(+), 25 deletions(-) --- a/drivers/crypto/geode-aes.c +++ b/drivers/crypto/geode-aes.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -166,13 +167,15 @@ static int geode_setkey_blk(struct crypt /* * The requested key size is not supported by HW, do a fallback */ - op->fallback.blk->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; - op->fallback.blk->base.crt_flags |= (tfm->crt_flags & CRYPTO_TFM_REQ_MASK); + crypto_sync_skcipher_clear_flags(op->fallback.blk, CRYPTO_TFM_REQ_MASK); + crypto_sync_skcipher_set_flags(op->fallback.blk, + tfm->crt_flags & CRYPTO_TFM_REQ_MASK); - ret = crypto_blkcipher_setkey(op->fallback.blk, key, len); + ret = crypto_sync_skcipher_setkey(op->fallback.blk, key, len); if (ret) { tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; - tfm->crt_flags |= (op->fallback.blk->base.crt_flags & CRYPTO_TFM_RES_MASK); + tfm->crt_flags |= crypto_sync_skcipher_get_flags(op->fallback.blk) & + CRYPTO_TFM_RES_MASK; } return ret; } @@ -181,33 +184,28 @@ static int fallback_blk_dec(struct blkci struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { - unsigned int ret; - struct crypto_blkcipher *tfm; struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); + SYNC_SKCIPHER_REQUEST_ON_STACK(req, op->fallback.blk); - tfm = desc->tfm; - desc->tfm = op->fallback.blk; - - ret = crypto_blkcipher_decrypt_iv(desc, dst, src, nbytes); + skcipher_request_set_sync_tfm(req, op->fallback.blk); + skcipher_request_set_callback(req, 0, NULL, NULL); + skcipher_request_set_crypt(req, src, dst, nbytes, desc->info); - desc->tfm = tfm; - return ret; + return crypto_skcipher_decrypt(req); } + static int fallback_blk_enc(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { - unsigned int ret; - struct crypto_blkcipher *tfm; struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); + SYNC_SKCIPHER_REQUEST_ON_STACK(req, op->fallback.blk); - tfm = desc->tfm; - desc->tfm = op->fallback.blk; - - ret = crypto_blkcipher_encrypt_iv(desc, dst, src, nbytes); + skcipher_request_set_sync_tfm(req, op->fallback.blk); + skcipher_request_set_callback(req, 0, NULL, NULL); + skcipher_request_set_crypt(req, src, dst, nbytes, desc->info); - desc->tfm = tfm; - return ret; + return crypto_skcipher_encrypt(req); } static void @@ -307,6 +305,9 @@ geode_cbc_decrypt(struct blkcipher_desc struct blkcipher_walk walk; int err, ret; + if (nbytes % AES_BLOCK_SIZE) + return -EINVAL; + if (unlikely(op->keylen != AES_KEYSIZE_128)) return fallback_blk_dec(desc, dst, src, nbytes); @@ -339,6 +340,9 @@ geode_cbc_encrypt(struct blkcipher_desc struct blkcipher_walk walk; int err, ret; + if (nbytes % AES_BLOCK_SIZE) + return -EINVAL; + if (unlikely(op->keylen != AES_KEYSIZE_128)) return fallback_blk_enc(desc, dst, src, nbytes); @@ -366,9 +370,8 @@ static int fallback_init_blk(struct cryp const char *name = crypto_tfm_alg_name(tfm); struct geode_aes_op *op = crypto_tfm_ctx(tfm); - op->fallback.blk = crypto_alloc_blkcipher(name, 0, - CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); - + op->fallback.blk = crypto_alloc_sync_skcipher(name, 0, + CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(op->fallback.blk)) { printk(KERN_ERR "Error allocating fallback algo %s\n", name); return PTR_ERR(op->fallback.blk); @@ -381,7 +384,7 @@ static void fallback_exit_blk(struct cry { struct geode_aes_op *op = crypto_tfm_ctx(tfm); - crypto_free_blkcipher(op->fallback.blk); + crypto_free_sync_skcipher(op->fallback.blk); op->fallback.blk = NULL; } @@ -420,6 +423,9 @@ geode_ecb_decrypt(struct blkcipher_desc struct blkcipher_walk walk; int err, ret; + if (nbytes % AES_BLOCK_SIZE) + return -EINVAL; + if (unlikely(op->keylen != AES_KEYSIZE_128)) return fallback_blk_dec(desc, dst, src, nbytes); @@ -450,6 +456,9 @@ geode_ecb_encrypt(struct blkcipher_desc struct blkcipher_walk walk; int err, ret; + if (nbytes % AES_BLOCK_SIZE) + return -EINVAL; + if (unlikely(op->keylen != AES_KEYSIZE_128)) return fallback_blk_enc(desc, dst, src, nbytes); --- a/drivers/crypto/geode-aes.h +++ b/drivers/crypto/geode-aes.h @@ -60,7 +60,7 @@ struct geode_aes_op { u8 *iv; union { - struct crypto_blkcipher *blk; + struct crypto_sync_skcipher *blk; struct crypto_cipher *cip; } fallback; u32 keylen; From patchwork Wed Dec 11 15:06:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181227 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp659940ile; Wed, 11 Dec 2019 07:10:14 -0800 (PST) X-Google-Smtp-Source: APXvYqz57FxjvmPn+v3zn1Nj27YzBvmg1g+Re7tFRzB0WRBzj0df5A+TZdhT3gGD9HiHUYEns0vM X-Received: by 2002:aca:5588:: with SMTP id j130mr3057900oib.122.1576077014693; Wed, 11 Dec 2019 07:10:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077014; cv=none; d=google.com; s=arc-20160816; b=TrK5UDaobmDxfoXN23CUHpta6k8bys5TILnfbVEtbL6ymz6peRTdM3Q/dHlB4JkBjb 1TeGu1c3TsIZkPJ6nox6FAULC89Fw+TffhAVAP4lrPjIypZj4ZuNg0yBHhng18Aj1siR bHXZjSjYKIsc7ZKm8gCM+wvth8lKIi5oTQBq68BZJwWnsqqH5kELqF+z9awAoVhiPoHu t1+GoIJJWwE3jf7BxmPqaymR6oDMkLCenZUPbVafbBjYWxZJsVNK2piFcdu1ShkMODyE FfTO3fvdR2CDvS+vVleRq3wH5xH3jjw4Qk3RVugJ1njP87Q+0O8tr/MudukRxr53kMJw Av4Q== 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=ZWt/Cs13Rs2/7EV+5e5/rbugaTGYl1TT/NK9jH4kh/Y=; b=IY4ENqjHjpgNsCVJgdVkUZHaisOj2su5906Iss6EEVWRilqckqHDGgxbjIIrPamjz5 patDAg+o857E4SaR4djwD2tTyQgK9XWhrR/ddeV+3B1ntKd3UvrDGk8tg8XOTNgoEEHq nEYpgqjMcd6x8fV310M2SYEiU7w4JpmfYQ3Adx3PCJSi7h54uZnY5d+RHKsdd7Fm65lr yPmGdjGj4innNiJJc8Di19Ow41PGgQEOdltoUQwfKAOhw8mjju8Ydug6AkXuLmsrqZO4 SR2wmm7ltnkVYdAc4LZQB/r+faSCWTCNI+gSddXa8lYSkwVCuCKWQl95Ycg/k4wJLLhO kc2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uY5bbTU7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b18si1287476otl.202.2019.12.11.07.10.14; Wed, 11 Dec 2019 07:10:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uY5bbTU7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730716AbfLKPKM (ORCPT + 27 others); Wed, 11 Dec 2019 10:10:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:58340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730700AbfLKPKJ (ORCPT ); Wed, 11 Dec 2019 10:10:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6381F22B48; Wed, 11 Dec 2019 15:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077008; bh=wytKeplqK/AKhB4cIpXTYLqEbmNYTJ0B2BTWnB98EBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uY5bbTU7YC4c7zUYgF+8vtS3C4wEb4/XZdg1zZsy4M65WUtqeCixty0KGrefioE9E vy6fmlmzM4Y62SsPeQfsu6BtLU1io3PAQClIIk7b3rTNKars3pLFcHiN3MvVCutMcK 7UDc/2ZU0JysScYJc+/kecgGJ+HhB045IjhF5ScM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Herbert Xu Subject: [PATCH 5.4 73/92] crypto: ecdh - fix big endian bug in ECC library Date: Wed, 11 Dec 2019 16:06:04 +0100 Message-Id: <20191211150257.641511332@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel commit f398243e9fd6a3a059c1ea7b380c40628dbf0c61 upstream. The elliptic curve arithmetic library used by the EC-DH KPP implementation assumes big endian byte order, and unconditionally reverses the byte and word order of multi-limb quantities. On big endian systems, the byte reordering is not necessary, while the word ordering needs to be retained. So replace the __swab64() invocation with a call to be64_to_cpu() which should do the right thing for both little and big endian builds. Fixes: 3c4b23901a0c ("crypto: ecdh - Add ECDH software support") Cc: # v4.9+ Signed-off-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- crypto/ecc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/crypto/ecc.c +++ b/crypto/ecc.c @@ -1284,10 +1284,11 @@ EXPORT_SYMBOL(ecc_point_mult_shamir); static inline void ecc_swap_digits(const u64 *in, u64 *out, unsigned int ndigits) { + const __be64 *src = (__force __be64 *)in; int i; for (i = 0; i < ndigits; i++) - out[i] = __swab64(in[ndigits - 1 - i]); + out[i] = be64_to_cpu(src[ndigits - 1 - i]); } static int __ecc_is_key_valid(const struct ecc_curve *curve, From patchwork Wed Dec 11 15:06:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181228 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp901528och; Wed, 11 Dec 2019 07:11:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyy4kVX4Q1LiO7JzmeZp01JXg39V1xxCz8bFkwI1fVn9crx2rfonVDHugshKmxHI80MWQ+s X-Received: by 2002:a9d:7593:: with SMTP id s19mr2478625otk.219.1576077065785; Wed, 11 Dec 2019 07:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077065; cv=none; d=google.com; s=arc-20160816; b=ImdKLaw9EQD+dSLNQakun7o+zFdiXiioyU/EDpWF+TP2jUhR3otFNeFH951yq/8q13 FUci5lgyyASeILVyuhIs2CUWE44QLMnh30GI+1hNs6X9VCnWNEehOG5Vx1KsMaU6pvB5 sQygnuUwlEpfjVn+uMYOr07+SOSakYWSmouG8K7Tp/7V8N6u017J9IjCWCbROJWfScJX DOnFw+p+7+FuPcxTjy+aumRF14xmEgs3cpk15jwrjLluGmvmGyiir4tz+HPqtSXvn9b+ Dmx8ukJdHSk+ghLfLaElBC6xOjBnJe8lRT7hInQS96GM5uIsjKoD2lySKEpVQKiOdKYd sXWg== 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=UhOp/l3ujFqz6RAm/8VTdFIsvCu9tVGgETC5hzpHcUo=; b=oaQuPuEuM4v4xXhNXdiKr9L0Ac3zYg4ZTQDP6cJeRvMIzCd6l2SQjY9mJ2XHjcuhf7 S1lDjE1fF3f7IbwIrjdIDW94voA3aWl7SmUWGMqzpjtlOHkqU1ORTysQCEBNZBIx8FI9 ippumAhgwBlz/NI4adyWBoxrxYRp1RKite+ombFU5yGocp7fGhOMszBipvrAzo4Qm53Z 9JBh0q3DAfibG5O7a+4acJpUPg4l1FomI6gDJMFrqW6X1ZzQHYOfj8Mp++z/emcJ+SOK /AAl6Fpt41JEpCnmP+F/exuKnIvYFBfHlUi6ph4ihTTmNCW4feJpYjOBsKqiXwi65pmN feUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zR38MCXq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si1225337otn.216.2019.12.11.07.11.05; Wed, 11 Dec 2019 07:11:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zR38MCXq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730237AbfLKPLD (ORCPT + 27 others); Wed, 11 Dec 2019 10:11:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:59482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730862AbfLKPLB (ORCPT ); Wed, 11 Dec 2019 10:11:01 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2DE124656; Wed, 11 Dec 2019 15:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077061; bh=bMEM8CgX/6uIErmN9B5ttGlNi4wBwVVcAmuXfFf4Z8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zR38MCXqQRVg8vMJ0vx3RJB8EYorFw7AVeg9JexgvLwNLKf3vEEhANg6ZLjBH0guI dYqqs/0Xd/bnOTsoxF6PR9Cnnv+OM3x/zZ5JvoWKdg9gBG+Ke3QW+zfm5hSca1dcW6 Fqm1jYq3LV749v5s8qGJnDJLePX9Tt/eWQk1gR8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viresh Kumar , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 82/92] RDMA/qib: Validate ->show()/store() callbacks before calling them Date: Wed, 11 Dec 2019 16:06:13 +0100 Message-Id: <20191211150300.723842793@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Viresh Kumar commit 7ee23491b39259ae83899dd93b2a29ef0f22f0a7 upstream. The permissions of the read-only or write-only sysfs files can be changed (as root) and the user can then try to read a write-only file or write to a read-only file which will lead to kernel crash here. Protect against that by always validating the show/store callbacks. Link: https://lore.kernel.org/r/d45cc26361a174ae12dbb86c994ef334d257924b.1573096807.git.viresh.kumar@linaro.org Signed-off-by: Viresh Kumar Reviewed-by: Greg Kroah-Hartman Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/qib/qib_sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/infiniband/hw/qib/qib_sysfs.c +++ b/drivers/infiniband/hw/qib/qib_sysfs.c @@ -301,6 +301,9 @@ static ssize_t qib_portattr_show(struct struct qib_pportdata *ppd = container_of(kobj, struct qib_pportdata, pport_kobj); + if (!pattr->show) + return -EIO; + return pattr->show(ppd, buf); } @@ -312,6 +315,9 @@ static ssize_t qib_portattr_store(struct struct qib_pportdata *ppd = container_of(kobj, struct qib_pportdata, pport_kobj); + if (!pattr->store) + return -EIO; + return pattr->store(ppd, buf, len); }