From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "YoungJun.park" <her0gyugyu@gmail.com>,
David Gow <davidgow@google.com>,
Shuah Khan <skhan@linuxfoundation.org>,
Sasha Levin <sashal@kernel.org>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com
Subject: [PATCH AUTOSEL 6.1 08/10] kunit: alloc_string_stream_fragment error handling bug fix
Date: Tue, 3 Jan 2023 13:39:32 -0500 [thread overview]
Message-ID: <20230103183934.2022663-8-sashal@kernel.org> (raw)
In-Reply-To: <20230103183934.2022663-1-sashal@kernel.org>
From: "YoungJun.park" <her0gyugyu@gmail.com>
[ Upstream commit 93ef83050e597634d2c7dc838a28caf5137b9404 ]
When it fails to allocate fragment, it does not free and return error.
And check the pointer inappropriately.
Fixed merge conflicts with
commit 618887768bb7 ("kunit: update NULL vs IS_ERR() tests")
Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: YoungJun.park <her0gyugyu@gmail.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/kunit/string-stream.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/kunit/string-stream.c b/lib/kunit/string-stream.c
index a608746020a9..7aeabe1a3dc5 100644
--- a/lib/kunit/string-stream.c
+++ b/lib/kunit/string-stream.c
@@ -23,8 +23,10 @@ static struct string_stream_fragment *alloc_string_stream_fragment(
return ERR_PTR(-ENOMEM);
frag->fragment = kunit_kmalloc(test, len, gfp);
- if (!frag->fragment)
+ if (!frag->fragment) {
+ kunit_kfree(test, frag);
return ERR_PTR(-ENOMEM);
+ }
return frag;
}
--
2.35.1
next prev parent reply other threads:[~2023-01-03 18:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 18:39 [PATCH AUTOSEL 6.1 01/10] io_uring/cancel: re-grab ctx mutex after finishing wait Sasha Levin
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 02/10] nvme: fix multipath crash caused by flush request when blktrace is enabled Sasha Levin
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 03/10] ACPI: video: Allow GPU drivers to report no panels Sasha Levin
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 04/10] drm/amd/display: Report to ACPI video if no panels were found Sasha Levin
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 05/10] ACPI: video: Don't enable fallback path for creating ACPI backlight by default Sasha Levin
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 06/10] ACPI: resource: do IRQ override on XMG Core 15 Sasha Levin
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 07/10] io_uring: check for valid register opcode earlier Sasha Levin
2023-01-03 18:39 ` Sasha Levin [this message]
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 09/10] nvmet: use NVME_CMD_EFFECTS_CSUPP instead of open coding it Sasha Levin
2023-01-03 18:39 ` [PATCH AUTOSEL 6.1 10/10] nvme: also return I/O command effects from nvme_command_effects Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230103183934.2022663-8-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davidgow@google.com \
--cc=her0gyugyu@gmail.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox