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] [day] [month] [year] [list]
Message-ID: <20250623101347.00003d7a@huawei.com>
Date: Mon, 23 Jun 2025 10:13:47 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Neeraj Kumar <s.neeraj@...sung.com>
CC: <dan.j.williams@...el.com>, <dave@...olabs.net>, <dave.jiang@...el.com>,
	<alison.schofield@...el.com>, <vishal.l.verma@...el.com>,
	<ira.weiny@...el.com>, <a.manzanares@...sung.com>, <nifan.cxl@...il.com>,
	<anisa.su@...sung.com>, <vishak.g@...sung.com>, <krish.reddy@...sung.com>,
	<arun.george@...sung.com>, <alok.rathore@...sung.com>,
	<neeraj.kernel@...il.com>, <linux-kernel@...r.kernel.org>,
	<linux-cxl@...r.kernel.org>, <nvdimm@...ts.linux.dev>,
	<gost.dev@...sung.com>, <cpgs@...sung.com>
Subject: Re: [RFC PATCH 08/20] nvdimm/label: Include region label in slot
 validation

On Tue, 17 Jun 2025 18:09:32 +0530
Neeraj Kumar <s.neeraj@...sung.com> wrote:

> slot validation routine validates label slot by calculating label
> checksum. It was only validating namespace label. This changeset also
> validates region label if present.
> 
> Also validate and calculate lsa v2.1 namespace label checksum
> 
> Signed-off-by: Neeraj Kumar <s.neeraj@...sung.com>



> diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
> index 1e5a68013735..ca8256b31472 100644
> --- a/drivers/nvdimm/nd.h
> +++ b/drivers/nvdimm/nd.h
> @@ -331,6 +331,22 @@ static inline bool nsl_region_uuid_equal(struct nd_namespace_label *ns_label,
>  	return uuid_equal(&tmp, uuid);
>  }
>  
> +static inline bool is_region_label(struct nvdimm_drvdata *ndd,
> +				   struct nd_lsa_label *nd_label)
> +{
> +	uuid_t ns_type, region_type;
> +
> +	if (ndd->cxl) {
> +		uuid_parse(CXL_REGION_UUID, &region_type);
> +		import_uuid(&ns_type, nd_label->ns_label.cxl.type);
> +		if (uuid_equal(&region_type, &ns_type))
> +			return true;
> +		else
> +			return false;

		return uuid_equal(&reg_type, &ns_type);

> +	} else
{}
for all legs if one needs it.

However, if you aren't going to add more code here later, just flip the condition
and exit early.

	if (!ndd->cxl)
		return false;

	uuid_parse...

> +		return false;
> +}
> +
>  static inline bool rgl_uuid_equal(struct cxl_region_label *rg_label,
>  				  const uuid_t *uuid)
>  {
> @@ -340,6 +356,11 @@ static inline bool rgl_uuid_equal(struct cxl_region_label *rg_label,
>  	return uuid_equal(&tmp, uuid);
>  }
>  
> +static inline u32 rgl_get_slot(struct cxl_region_label *rg_label)
> +{
> +	return __le32_to_cpu(rg_label->slot);
> +}
> +
>  static inline u64 rgl_get_checksum(struct cxl_region_label *rg_label)
>  {
>  	return __le64_to_cpu(rg_label->checksum);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ