From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>, <nathan@kernel.org>,
<ndesaulniers@google.com>, <trix@redhat.com>
Cc: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<llvm@lists.linux.dev>
Subject: Re: [PATCH] fs/ntfs3: Add check for kmemdup
Date: Mon, 26 Dec 2022 19:04:35 +0400 [thread overview]
Message-ID: <0bf7a140-1405-2b07-4d29-d593d9507c33@paragon-software.com> (raw)
In-Reply-To: <20221123084846.2703-1-jiasheng@iscas.ac.cn>
On 23.11.2022 12:48, Jiasheng Jiang wrote:
> Since the kmemdup may return NULL pointer,
> it should be better to add check for the return value
> in order to avoid NULL pointer dereference.
>
> Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> fs/ntfs3/fslog.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
> index 0d611a6c5511..eb7cf8a69607 100644
> --- a/fs/ntfs3/fslog.c
> +++ b/fs/ntfs3/fslog.c
> @@ -4277,6 +4277,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
> rec_len -= t32;
>
> attr_names = kmemdup(Add2Ptr(lrh, t32), rec_len, GFP_NOFS);
> + if (!attr_names) {
> + err = -ENOMEM;
> + goto out;
> + }
>
> lcb_put(lcb);
> lcb = NULL;
Thank you for your work, applied!
prev parent reply other threads:[~2022-12-26 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 8:48 Jiasheng Jiang
2022-12-26 15:04 ` Konstantin Komarov [this message]
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=0bf7a140-1405-2b07-4d29-d593d9507c33@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=jiasheng@iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=ntfs3@lists.linux.dev \
--cc=trix@redhat.com \
/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
all inboxes | Powered by JetHome®