All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] imsm: Fix possible segfault in check_no_platform()
@ 2023-07-05 14:34 Mateusz Grzonka
  2023-08-07 21:02 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Grzonka @ 2023-07-05 14:34 UTC (permalink / raw)
  To: linux-raid; +Cc: jes

conf_line() may return NULL, which is not handled and might cause
segfault.

Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com>
---
 super-intel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/super-intel.c b/super-intel.c
index ae0f4a8c..4ef33d31 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -650,6 +650,11 @@ static int check_no_platform(void)
 		char *l = conf_line(fp);
 		char *w = l;
 
+		if (l == NULL) {
+			fclose(fp);
+			return 0;
+		}
+
 		do {
 			if (strcmp(w, search) == 0)
 				no_platform = 1;
-- 
2.26.2


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

* Re: [PATCH] imsm: Fix possible segfault in check_no_platform()
  2023-07-05 14:34 [PATCH] imsm: Fix possible segfault in check_no_platform() Mateusz Grzonka
@ 2023-08-07 21:02 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2023-08-07 21:02 UTC (permalink / raw)
  To: Mateusz Grzonka, linux-raid

On 7/5/23 10:34, Mateusz Grzonka wrote:
> conf_line() may return NULL, which is not handled and might cause
> segfault.
> 
> Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com>
> ---
>  super-intel.c | 5 +++++
>  1 file changed, 5 insertions(+)

Applied!

Thanks,
Jes



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

end of thread, other threads:[~2023-08-07 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 14:34 [PATCH] imsm: Fix possible segfault in check_no_platform() Mateusz Grzonka
2023-08-07 21:02 ` Jes Sorensen

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.