linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function
@ 2023-11-16 12:20 Kajol Jain
  2023-11-16 12:20 ` [PATCH 2/2] powerpc/hv-gpxi: Fix access permission of hv-gpci interface files Kajol Jain
  2023-12-21 10:38 ` (subset) [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function Michael Ellerman
  0 siblings, 2 replies; 5+ messages in thread
From: Kajol Jain @ 2023-11-16 12:20 UTC (permalink / raw)
  To: mpe; +Cc: atrajeev, kjain, Disha Goel, maddy, disgoel, linuxppc-dev

To access hv-gpci kernel interface files data, the
"Enable Performance Information Collection" option has to be set
in hmc. Incase that option is not set and user try to read
the interface files, it should give error message as
operation not permitted.

Result of accessing added interface files with disabled
performance collection option:

[command]# cat processor_bus_topology
cat: processor_bus_topology: Operation not permitted

[command]# cat processor_config
cat: processor_config: Operation not permitted

[command]# cat affinity_domain_via_domain
cat: affinity_domain_via_domain: Operation not permitted

[command]# cat affinity_domain_via_virtual_processor
cat: affinity_domain_via_virtual_processor: Operation not permitted

[command]# cat affinity_domain_via_partition

Based on above result there is no error message when reading
affinity_domain_via_partition file because of missing
check for failed hcall. Fix this issue by adding
a check in the start of affinity_domain_via_partition_show
function, to return error incase hcall fails, with error type
other then H_PARAMETER.

Fixes: a15e0d6a6929 ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show affinity domain via partition information")
Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
 arch/powerpc/perf/hv-gpci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c
index 39dbe6b348df..27f18119fda1 100644
--- a/arch/powerpc/perf/hv-gpci.c
+++ b/arch/powerpc/perf/hv-gpci.c
@@ -534,6 +534,9 @@ static ssize_t affinity_domain_via_partition_show(struct device *dev, struct dev
 	if (!ret)
 		goto parse_result;
 
+	if (ret && (ret != H_PARAMETER))
+		goto out;
+
 	/*
 	 * ret value as 'H_PARAMETER' implies that the current buffer size
 	 * can't accommodate all the information, and a partial buffer
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] powerpc/hv-gpxi: Fix access permission of hv-gpci interface files
  2023-11-16 12:20 [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function Kajol Jain
@ 2023-11-16 12:20 ` Kajol Jain
  2023-11-16 22:36   ` Michael Ellerman
  2023-12-21 10:38 ` (subset) [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function Michael Ellerman
  1 sibling, 1 reply; 5+ messages in thread
From: Kajol Jain @ 2023-11-16 12:20 UTC (permalink / raw)
  To: mpe; +Cc: atrajeev, kjain, Disha Goel, maddy, disgoel, linuxppc-dev

Fix access permission of the hv-gpci topology information
interface files from 0444 to 0400 (admin read only).

Fixes: 71f1c39647d8 ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show processor bus topology information")
Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
 arch/powerpc/perf/hv-gpci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c
index 27f18119fda1..303d160319e8 100644
--- a/arch/powerpc/perf/hv-gpci.c
+++ b/arch/powerpc/perf/hv-gpci.c
@@ -890,7 +890,7 @@ static struct device_attribute *sysinfo_device_attr_create(int
 			return NULL;
 
 		sysfs_attr_init(&attr->attr);
-		attr->attr.mode = 0444;
+		attr->attr.mode = 0400;
 
 		switch (sysinfo_interface_group_index) {
 		case INTERFACE_PROCESSOR_BUS_TOPOLOGY_ATTR:
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] powerpc/hv-gpxi: Fix access permission of hv-gpci interface files
  2023-11-16 12:20 ` [PATCH 2/2] powerpc/hv-gpxi: Fix access permission of hv-gpci interface files Kajol Jain
@ 2023-11-16 22:36   ` Michael Ellerman
  2023-11-17  5:43     ` kajoljain
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2023-11-16 22:36 UTC (permalink / raw)
  To: Kajol Jain; +Cc: atrajeev, kjain, Disha Goel, maddy, disgoel, linuxppc-dev

Kajol Jain <kjain@linux.ibm.com> writes:
> Fix access permission of the hv-gpci topology information
> interface files from 0444 to 0400 (admin read only).

Please explain why they should be 0400.

Also typo in subject, "hv-gpxi".

cheers

> Fixes: 71f1c39647d8 ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show processor bus topology information")
> Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
> ---
>  arch/powerpc/perf/hv-gpci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c
> index 27f18119fda1..303d160319e8 100644
> --- a/arch/powerpc/perf/hv-gpci.c
> +++ b/arch/powerpc/perf/hv-gpci.c
> @@ -890,7 +890,7 @@ static struct device_attribute *sysinfo_device_attr_create(int
>  			return NULL;
>  
>  		sysfs_attr_init(&attr->attr);
> -		attr->attr.mode = 0444;
> +		attr->attr.mode = 0400;
>  
>  		switch (sysinfo_interface_group_index) {
>  		case INTERFACE_PROCESSOR_BUS_TOPOLOGY_ATTR:
> -- 
> 2.39.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] powerpc/hv-gpxi: Fix access permission of hv-gpci interface files
  2023-11-16 22:36   ` Michael Ellerman
@ 2023-11-17  5:43     ` kajoljain
  0 siblings, 0 replies; 5+ messages in thread
From: kajoljain @ 2023-11-17  5:43 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: disgoel, atrajeev, maddy, linuxppc-dev, Disha Goel



On 11/17/23 04:06, Michael Ellerman wrote:
> Kajol Jain <kjain@linux.ibm.com> writes:
>> Fix access permission of the hv-gpci topology information
>> interface files from 0444 to 0400 (admin read only).
> 
> Please explain why they should be 0400.
> 
> Also typo in subject, "hv-gpxi".

Hi Michael,
  Thanks for reviewing it. Will add the details in next version of the
patch.

Thanks,
Kajol Jain

> 
> cheers
> 
>> Fixes: 71f1c39647d8 ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show processor bus topology information")
>> Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
>> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
>> ---
>>  arch/powerpc/perf/hv-gpci.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c
>> index 27f18119fda1..303d160319e8 100644
>> --- a/arch/powerpc/perf/hv-gpci.c
>> +++ b/arch/powerpc/perf/hv-gpci.c
>> @@ -890,7 +890,7 @@ static struct device_attribute *sysinfo_device_attr_create(int
>>  			return NULL;
>>  
>>  		sysfs_attr_init(&attr->attr);
>> -		attr->attr.mode = 0444;
>> +		attr->attr.mode = 0400;
>>  
>>  		switch (sysinfo_interface_group_index) {
>>  		case INTERFACE_PROCESSOR_BUS_TOPOLOGY_ATTR:
>> -- 
>> 2.39.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (subset) [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function
  2023-11-16 12:20 [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function Kajol Jain
  2023-11-16 12:20 ` [PATCH 2/2] powerpc/hv-gpxi: Fix access permission of hv-gpci interface files Kajol Jain
@ 2023-12-21 10:38 ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2023-12-21 10:38 UTC (permalink / raw)
  To: Kajol Jain; +Cc: disgoel, atrajeev, linuxppc-dev, maddy, Disha Goel

On Thu, 16 Nov 2023 17:50:32 +0530, Kajol Jain wrote:
> To access hv-gpci kernel interface files data, the
> "Enable Performance Information Collection" option has to be set
> in hmc. Incase that option is not set and user try to read
> the interface files, it should give error message as
> operation not permitted.
> 
> Result of accessing added interface files with disabled
> performance collection option:
> 
> [...]

Applied to powerpc/next.

[1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function
      https://git.kernel.org/powerpc/c/070b71f428facd9130319707db854ed8bd24637a

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-21 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 12:20 [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function Kajol Jain
2023-11-16 12:20 ` [PATCH 2/2] powerpc/hv-gpxi: Fix access permission of hv-gpci interface files Kajol Jain
2023-11-16 22:36   ` Michael Ellerman
2023-11-17  5:43     ` kajoljain
2023-12-21 10:38 ` (subset) [PATCH 1/2] powerpc/hv-gpci: Add return value check in affinity_domain_via_partition_show function Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).