[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190729185133.GD569612@devbig004.ftw2.facebook.com>
Date: Mon, 29 Jul 2019 11:51:33 -0700
From: Tejun Heo <tj@...nel.org>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: kernfs: Fix possible null-pointer dereferences in
kernfs_path_from_node_locked()
On Wed, Jul 24, 2019 at 10:22:42AM +0800, Jia-Ju Bai wrote:
> In kernfs_path_from_node_locked(), there is an if statement on line 147
> to check whether buf is NULL:
> if (buf)
>
> When buf is NULL, it is used on line 151:
> len += strlcpy(buf + len, parent_str, ...)
> and line 158:
> len += strlcpy(buf + len, "/", ...)
> and line 160:
> len += strlcpy(buf + len, kn->name, ...)
>
> Thus, possible null-pointer dereferences may occur.
>
> To fix these possible bugs, buf is checked before being used.
> If it is NULL, -EINVAL is returned.
>
> These bugs are found by a static analysis tool STCheck written by us.
Can we just get rid of the NULL testing?
Thanks.
--
tejun
Powered by blists - more mailing lists