Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3850435ioa; Tue, 26 Apr 2022 10:58:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXv9hPWMXoSsY0lg/iUaBVYPuAXae5kQiqPJFJDzIqLWGmOj3RvwEBLKUYFTJYgsPQEiAr X-Received: by 2002:a63:f718:0:b0:398:f14d:4915 with SMTP id x24-20020a63f718000000b00398f14d4915mr19908847pgh.9.1650995916904; Tue, 26 Apr 2022 10:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650995916; cv=none; d=google.com; s=arc-20160816; b=wtBZwJqIv4fZPVZxORc6mGaKDmTMo91XJ6UPOnOGXl+gkqiN9HBsvguL7nNNaPF7V9 V+1ZfaFc1n0VYUysrabQZHObG0D7c/X1Jyy4xAXsutY2OmidoDwQ/vMujKQvu1WsOR0d 8pdBmB5yewo7Ii8faC0XfQZuOXw0vsQrfnaZK5qfSb+ELWKbRVdh8wzy/8ni8uYyER/Z CqoNOKoSoiKkWa94Onr/SIa8j95dZLWwZ6+fvUtY6tYVSixUHS4QYKz9yv0x9cHTeePi SyQ/KTzq9WZYrO/qF1/IusszD7laapJ4dYznQU891bGL2sD8CFwzcR3I61IYK55vNZt4 G+9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BmMSnYf3E1y81juEMkl3BoaKX6N79Fdlu2q+D5Snr7I=; b=E3t4zTzmFC2w/t9oghk93x/Jz5zEgmzzk2eHxHgCTLvW7KDxb6RJgR5HLR0x4axNqI 7PgXV/R1/qmMjv9D+DEDYlRmp/OslSrs1MMv5rEELnIkpSpj5g7j6SrKM+atq9BoMxaY kv61TW/RNwntFNTFBQxVgibozf2UaJXemcYt/JJdQ1u/ksuBEKJ2obzPku6XUpnOBs3G gzpeq0n2munh99u23fzerBi85as0F+oMRdY/PwNaGkRSCquwG4vIxPS5EaXa2vAYLCEG 4EIu/KBJ+ug9FyrHzfMZFy0yZ9dw5x0sr7suEtn+tLmfHz7e9OJZ2OqhvZKLMxxz36kG TD6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eaG4ZsOF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020a170902ba9600b0015ad8a424e3si15198926pls.428.2022.04.26.10.58.19; Tue, 26 Apr 2022 10:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eaG4ZsOF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347147AbiDZJKG (ORCPT + 99 others); Tue, 26 Apr 2022 05:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346503AbiDZIuH (ORCPT ); Tue, 26 Apr 2022 04:50:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C68139771; Tue, 26 Apr 2022 01:38:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F249B81D18; Tue, 26 Apr 2022 08:38:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88FD5C385A0; Tue, 26 Apr 2022 08:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962291; bh=BUttM4dMS6czkW5l9y8+dh5aeIjVbPYhm+0ip0mHMOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eaG4ZsOFnn+EQgBT6elZSNtg/9aC4vv0tqM+XXMoiVkoLk3RyALsSVTH3v6Ash4Wm AzLtKTNBtSLMOA6r14UAhpSU+PZ6mFjkPVX7Wjht1rUM0sfIH5YwCfXouA/GLt6W3+ gfRZ2letTKNXPaCkY1J4HTLJIGpQxzNa4dcRRUiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bernice Zhang , Dave Jiang , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 048/124] dmaengine: idxd: add RO check for wq max_batch_size write Date: Tue, 26 Apr 2022 10:20:49 +0200 Message-Id: <20220426081748.667036725@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Jiang [ Upstream commit 66903461ffed0b66fc3e0200082d4e09365aacdc ] Block wq_max_batch_size_store() when the device is configured as read-only and not configurable. Fixes: e7184b159dd3 ("dmaengine: idxd: add support for configurable max wq batch size") Reported-by: Bernice Zhang Tested-by: Bernice Zhang Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/164971493551.2201159.1942042593642155209.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/idxd/sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c index 999ce13a93ad..f7ab5c077a2b 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -876,6 +876,9 @@ static ssize_t wq_max_batch_size_store(struct device *dev, struct device_attribu u64 batch_size; int rc; + if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) + return -EPERM; + if (wq->state != IDXD_WQ_DISABLED) return -EPERM; -- 2.35.1