lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c691d9bd-9596-373e-0abe-2e776eb0d54b@kernel.org>
Date:   Fri, 2 Jun 2023 08:18:58 +0900
From:   Damien Le Moal <dlemoal@...nel.org>
To:     Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
        lpieralisi@...nel.org, kw@...ux.com
Cc:     kishon@...nel.org, bhelgaas@...gle.com, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH v5 4/9] PCI: endpoint: Warn and return if EPC is
 started/stopped multiple times

On 6/1/23 23:57, Manivannan Sadhasivam wrote:
> When the EPC is started or stopped multiple times from configfs, just emit
> a once time warning and return. There is no need to call the EPC start/stop
> functions in those cases.
> 
> Reviewed-by: Kishon Vijay Abraham I <kishon@...nel.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> ---
>  drivers/pci/endpoint/pci-ep-cfs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
> index 4b8ac0ac84d5..62c8e09c59f4 100644
> --- a/drivers/pci/endpoint/pci-ep-cfs.c
> +++ b/drivers/pci/endpoint/pci-ep-cfs.c
> @@ -178,6 +178,9 @@ static ssize_t pci_epc_start_store(struct config_item *item, const char *page,
>  	if (kstrtobool(page, &start) < 0)
>  		return -EINVAL;
>  
> +	if (WARN_ON_ONCE(start == epc_group->start))
> +		return 0;

WARN will dump a backtrace which is fairly scary for the user. This case is
simply a bad user manipulation of the device, so why not simply add a pr_err()
(optional) and return -EALREADY ?

> +
>  	if (!start) {
>  		pci_epc_stop(epc);
>  		epc_group->start = 0;

-- 
Damien Le Moal
Western Digital Research

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ