All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build
@ 2018-10-09 15:29 Kleber Sacilotto de Souza
  2018-10-09 15:29 ` [PATCH 1/1] powerpc/fadump: Return error when fadump registration fails Kleber Sacilotto de Souza
  2018-10-11  9:43 ` [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Kleber Sacilotto de Souza @ 2018-10-09 15:29 UTC (permalink / raw)
  To: stable; +Cc: msuchanek, mpe

Hi Greg,

The backport of upstream commit 1bd6a1c4b80a ("powerpc/fadump: handle
crash memory ranges array index overflow") introduced a ppc build failure
on 4.4-stable and 4.9-stable when CONFIG_FA_DUMP is enabled:

arch/powerpc/kernel/fadump.c: In function ‘register_fadump’:
arch/powerpc/kernel/fadump.c:1015:10: error: ‘return’ with a value, in function returning void [-Werror]
   return ret;
          ^~~
arch/powerpc/kernel/fadump.c:1000:13: note: declared here
 static void register_fadump(void)
             ^~~~~~~~~~~~~~~

I am suggesting to fix it by backporting 98b8cd7f7564 ("powerpc/fadump:
Return error when fadump registration fails"), which is an earlier
commit that (among other things) set the return of register_fadump() to
int and has little functional changes. It was applied upstream for
v4.13, so 4.14-stable and later are already fixed.

Thanks,
Kleber

Michal Suchanek (1):
  powerpc/fadump: Return error when fadump registration fails

 arch/powerpc/kernel/fadump.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

-- 
2.17.1

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

* [PATCH 1/1] powerpc/fadump: Return error when fadump registration fails
  2018-10-09 15:29 [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build Kleber Sacilotto de Souza
@ 2018-10-09 15:29 ` Kleber Sacilotto de Souza
  2018-10-11  9:43 ` [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Kleber Sacilotto de Souza @ 2018-10-09 15:29 UTC (permalink / raw)
  To: stable; +Cc: msuchanek, mpe

From: Michal Suchanek <msuchanek@suse.de>

commit 98b8cd7f75643e0a442d7a4c1cef2c9d53b7e92b upstream.

 - log an error message when registration fails and no error code listed
   in the switch is returned
 - translate the hv error code to posix error code and return it from
   fw_register
 - return the posix error code from fw_register to the process writing
   to sysfs
 - return EEXIST on re-registration
 - return success on deregistration when fadump is not registered
 - return ENODEV when no memory is reserved for fadump

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Tested-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
[mpe: Use pr_err() to shrink the error print]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
---
 arch/powerpc/kernel/fadump.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index c3c835290131..ca3ad5ebcd41 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -360,9 +360,9 @@ static int __init early_fadump_reserve_mem(char *p)
 }
 early_param("fadump_reserve_mem", early_fadump_reserve_mem);
 
-static void register_fw_dump(struct fadump_mem_struct *fdm)
+static int register_fw_dump(struct fadump_mem_struct *fdm)
 {
-	int rc;
+	int rc, err;
 	unsigned int wait_time;
 
 	pr_debug("Registering for firmware-assisted kernel dump...\n");
@@ -379,7 +379,11 @@ static void register_fw_dump(struct fadump_mem_struct *fdm)
 
 	} while (wait_time);
 
+	err = -EIO;
 	switch (rc) {
+	default:
+		pr_err("Failed to register. Unknown Error(%d).\n", rc);
+		break;
 	case -1:
 		printk(KERN_ERR "Failed to register firmware-assisted kernel"
 			" dump. Hardware Error(%d).\n", rc);
@@ -387,18 +391,22 @@ static void register_fw_dump(struct fadump_mem_struct *fdm)
 	case -3:
 		printk(KERN_ERR "Failed to register firmware-assisted kernel"
 			" dump. Parameter Error(%d).\n", rc);
+		err = -EINVAL;
 		break;
 	case -9:
 		printk(KERN_ERR "firmware-assisted kernel dump is already "
 			" registered.");
 		fw_dump.dump_registered = 1;
+		err = -EEXIST;
 		break;
 	case 0:
 		printk(KERN_INFO "firmware-assisted kernel dump registration"
 			" is successful\n");
 		fw_dump.dump_registered = 1;
+		err = 0;
 		break;
 	}
+	return err;
 }
 
 void crash_fadump(struct pt_regs *regs, const char *str)
@@ -997,7 +1005,7 @@ static unsigned long init_fadump_header(unsigned long addr)
 	return addr;
 }
 
-static void register_fadump(void)
+static int register_fadump(void)
 {
 	unsigned long addr;
 	void *vaddr;
@@ -1008,7 +1016,7 @@ static void register_fadump(void)
 	 * assisted dump.
 	 */
 	if (!fw_dump.reserve_dump_area_size)
-		return;
+		return -ENODEV;
 
 	ret = fadump_setup_crash_memory_ranges();
 	if (ret)
@@ -1023,7 +1031,7 @@ static void register_fadump(void)
 	fadump_create_elfcore_headers(vaddr);
 
 	/* register the future kernel dump with firmware. */
-	register_fw_dump(&fdm);
+	return register_fw_dump(&fdm);
 }
 
 static int fadump_unregister_dump(struct fadump_mem_struct *fdm)
@@ -1208,7 +1216,6 @@ static ssize_t fadump_register_store(struct kobject *kobj,
 	switch (buf[0]) {
 	case '0':
 		if (fw_dump.dump_registered == 0) {
-			ret = -EINVAL;
 			goto unlock_out;
 		}
 		/* Un-register Firmware-assisted dump */
@@ -1216,11 +1223,11 @@ static ssize_t fadump_register_store(struct kobject *kobj,
 		break;
 	case '1':
 		if (fw_dump.dump_registered == 1) {
-			ret = -EINVAL;
+			ret = -EEXIST;
 			goto unlock_out;
 		}
 		/* Register Firmware-assisted dump */
-		register_fadump();
+		ret = register_fadump();
 		break;
 	default:
 		ret = -EINVAL;
-- 
2.17.1

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

* Re: [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build
  2018-10-09 15:29 [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build Kleber Sacilotto de Souza
  2018-10-09 15:29 ` [PATCH 1/1] powerpc/fadump: Return error when fadump registration fails Kleber Sacilotto de Souza
@ 2018-10-11  9:43 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-10-11  9:43 UTC (permalink / raw)
  To: Kleber Sacilotto de Souza; +Cc: stable, msuchanek, mpe

On Tue, Oct 09, 2018 at 05:29:20PM +0200, Kleber Sacilotto de Souza wrote:
> Hi Greg,
> 
> The backport of upstream commit 1bd6a1c4b80a ("powerpc/fadump: handle
> crash memory ranges array index overflow") introduced a ppc build failure
> on 4.4-stable and 4.9-stable when CONFIG_FA_DUMP is enabled:
> 
> arch/powerpc/kernel/fadump.c: In function ‘register_fadump’:
> arch/powerpc/kernel/fadump.c:1015:10: error: ‘return’ with a value, in function returning void [-Werror]
>    return ret;
>           ^~~
> arch/powerpc/kernel/fadump.c:1000:13: note: declared here
>  static void register_fadump(void)
>              ^~~~~~~~~~~~~~~
> 
> I am suggesting to fix it by backporting 98b8cd7f7564 ("powerpc/fadump:
> Return error when fadump registration fails"), which is an earlier
> commit that (among other things) set the return of register_fadump() to
> int and has little functional changes. It was applied upstream for
> v4.13, so 4.14-stable and later are already fixed.

Now fixed up, thanks.

greg k-h

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

end of thread, other threads:[~2018-10-11 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 15:29 [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build Kleber Sacilotto de Souza
2018-10-09 15:29 ` [PATCH 1/1] powerpc/fadump: Return error when fadump registration fails Kleber Sacilotto de Souza
2018-10-11  9:43 ` [PATCH 0/1] Fix 4.4-stable and 4.9-stable ppc build Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.