Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4458687ioa; Wed, 27 Apr 2022 04:27:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXSHWmfH6wrqfmXFoXKZZlvGo5a2PwknEp5BgksjO44Dc0v8GNx8ctT8Bez8sVWPDSGgs3 X-Received: by 2002:a17:902:9307:b0:154:78ba:ed40 with SMTP id bc7-20020a170902930700b0015478baed40mr28576079plb.92.1651058852900; Wed, 27 Apr 2022 04:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651058852; cv=none; d=google.com; s=arc-20160816; b=ULJX0P2o0DBGPobUwKVssNWXlC6mu4qvFq5OxOG6gtToArVJP/aauuAcUW9gOCz9d7 Q9fknKh3xGSLlP1dIMUelatsAM+p6N2wsLaaO3jwQKe0kYM/9BLfHJgJNamruacm0PsF tIMCLYWOIKLBEOuXgL428h+0M3cMDetnrMh/857ffejAzYDyf5+ExbVZcspodbW/7JY0 LRoY2TtW3KMXw7fxrOYT5NmJvUeKBFSPW01IKTzfm3r0Vuv5i/OvWeI075K4JWd9EXsq sTDAZG0OJFr13+M2B8KAOgRm61udG8ncw/pRkdIcd6nwEAHYExgbBawt7mOW6d36jDiF 3+wg== 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=iNP5TEbOxj4Aarm73iRha6LDX+Hpcgy/j3sEFPbxYzQ=; b=Ml0doFbOkJM3rzzTvGdDpL/TVStqMBqzEODEJGE4U+01Qnz80tHJY2JujpovxUMAvh ZWpL62t7GVZ0wxSuym7zP35JR0shCPZ/hfdB/NXQXuLzCbunbbMt6LolEIlJRupBL3TE J2z239AueQ/JNfqT68svO7ijXVA+pj7V/6C3r4TvqzybysXceOCR1o4pgkgCh3z8/92x rzKkyvEyNqlvPkdvONNHo4/d4RBxR3UwWxOKgioDRkY7BFOOiSfQ3g5ZKUTipp+mnu2c I2/Cu7DiCG/VieHLi3b9HPuQ8wOBAdHkw9oO2/QigOHmNDsTuRbLtqn/ZpjtMly7N/88 yDQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pH6YIEB/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f10-20020a63f10a000000b003a27ebd2526si1235308pgi.306.2022.04.27.04.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pH6YIEB/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 56306496D71; Wed, 27 Apr 2022 03:24:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347466AbiDZJ26 (ORCPT + 99 others); Tue, 26 Apr 2022 05:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347414AbiDZJFe (ORCPT ); Tue, 26 Apr 2022 05:05:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7DFD11C986; Tue, 26 Apr 2022 01:44:38 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 411D260A56; Tue, 26 Apr 2022 08:44:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43847C385B4; Tue, 26 Apr 2022 08:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962677; bh=Zef/20gInlPkxqalUsDjt0UXGQLCnsEk4RHQO/Fp1XU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pH6YIEB/xFJh6xVcxGr0LOD9N5IV3bDlGiZ9ld2lsoVR6BX29kyErW6t2WqhzA0rM oc0n4vogDDhc65V1KVpbrP4bRRo8+lZ9iV8uuNhJLKg2S8YUsGdiLJ7oxTn/jKlymp GHTmFhMZ44xwkP6gVQJSMXuchWL+wSnfSAoW1c7U= 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.17 051/146] dmaengine: idxd: add RO check for wq max_transfer_size write Date: Tue, 26 Apr 2022 10:20:46 +0200 Message-Id: <20220426081751.505301430@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081750.051179617@linuxfoundation.org> References: <20220426081750.051179617@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=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 6c41d429bd89..dfd549685c46 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -905,6 +905,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