Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3539250ioa; Tue, 26 Apr 2022 05:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsAfWGjhhC+bcI+rHWa1uhonyim6mdm27A4/YkQLytD9Lmv5ME+WQqgdfge1CEVU+OC6ra X-Received: by 2002:a17:907:6d11:b0:6f3:66a9:b57b with SMTP id sa17-20020a1709076d1100b006f366a9b57bmr14882770ejc.374.1650976974551; Tue, 26 Apr 2022 05:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650976974; cv=none; d=google.com; s=arc-20160816; b=uOC+531PCMrxk/TYSCsbyRjS0c7j5/YX1oIKgdWe33Fy3iN+qjSlZkduveHzXNTDG7 wAdVE2yL0tmHmMEcDegoOWVTDAsGwUMY5756gYHD17ybcSjz5Vf/D1G/CmdINqHYXvg5 4Fir4+6Tq6tSZeOzZ8KfhOKvy+FUGKZtloL6BSgxlT4AGcyECQJFOJL3Bkg5LYz7XmNt iX7cZZrRk5ZjL9z/yifCHQYwKAAp5JGVnB1vMt1xYhdd7ALo9kOWwaZ3mrm3nGRreuMY uaxmzKN/iiNpAEp1LP+QXvWjcAFIJ4Ew+3E4ZRK7LccT9YN5Z0XcibtOfPjJnUhgMAU7 MAeQ== 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=RlorxdKwYMXznYDK+Gq5qttnoUVzCqrzFc+XkCLR9yY=; b=0X2HbCfTwe9M8Uposa3uTWsVU6eXEOA47szLY7KaEYw4HHt8+/rXeEGKdVb5K87iEd 7FJdTseTY8Ms8AE3Q9/mi2Ger+L9+GOgnPjPhsU37YLwQKAtC5Ia+2W3e9bLb+eSlRyQ x2uOhVMjDQ4/t37ili0Op7VnMP1La7uOsT8vX2FPSMIFRrP6ZRshxZsIg7dnNuTAem6G FtiKzZzkIxz823maZsZ5isIrxjF/KyyaAlaimVfrByfoHeOL3LXukdWb3I+ngyyKmZKs Gm7qs5vSju1ame6a43laYIjqv5Jmc3uzD9KYQgWNyLfWIW/vq2pjgS2C478HgTQ5tbzL eb6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m0Al9Dmb; 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 o6-20020a170906768600b006df76385b8csi15946692ejm.44.2022.04.26.05.42.31; Tue, 26 Apr 2022 05:42:54 -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=m0Al9Dmb; 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 S1346891AbiDZJJ0 (ORCPT + 99 others); Tue, 26 Apr 2022 05:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346465AbiDZIuF (ORCPT ); Tue, 26 Apr 2022 04:50:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59EA21399B9; Tue, 26 Apr 2022 01:38:16 -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 53B1CB81CF2; Tue, 26 Apr 2022 08:38:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7EFC385A0; Tue, 26 Apr 2022 08:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962294; bh=0AMYWBbfpUL//+F2tIsTAni2SaYlp5EIBR+OQERkZTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m0Al9Dmb1JcxCykmVLVsXCNYi7uCNKeUObwyMSjH9ujvdsif5qDuXwGJtq55HaS39 o/lScZUQkamczqXCEnNYip1FS4Ram/YCRxMUentrLNzdJv2W5hxnzoUsC98XQox79D YXzfO2NhvuqsK+E4cbr0G5aXeZ0ZF4EhWJEX1DWY= 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 049/124] dmaengine: idxd: add RO check for wq max_transfer_size write Date: Tue, 26 Apr 2022 10:20:50 +0200 Message-Id: <20220426081748.695278023@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 505a2d1032ae656b0a8c736be110255503941cde ] Block wq_max_transfer_size_store() when the device is configured as read-only and not configurable. Fixes: d7aad5550eca ("dmaengine: idxd: add support for configurable max wq xfer size") Reported-by: Bernice Zhang Tested-by: Bernice Zhang Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/164971488154.2200913.10706665404118545941.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 f7ab5c077a2b..33d94c67fedb 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -842,6 +842,9 @@ static ssize_t wq_max_transfer_size_store(struct device *dev, struct device_attr u64 xfer_size; int rc; + if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) + return -EPERM; + if (wq->state != IDXD_WQ_DISABLED) return -EPERM; -- 2.35.1