Re: [PATCH 105/190] Revert "libnvdimm/btt: Fix a kmemdup failure check"

From: Dan Williams
Date: Fri Apr 23 2021 - 16:49:54 EST


On Wed, Apr 21, 2021 at 6:08 AM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> This reverts commit 486fa92df4707b5df58d6508728bdb9321a59766.
>
> Commits from @umn.edu addresses have been found to be submitted in "bad
> faith" to try to test the kernel community's ability to review "known
> malicious" changes. The result of these submissions can be found in a
> paper published at the 42nd IEEE Symposium on Security and Privacy
> entitled, "Open Source Insecurity: Stealthily Introducing
> Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> of Minnesota) and Kangjie Lu (University of Minnesota).
>
> Because of this, all submissions from this group must be reverted from
> the kernel tree and will need to be re-reviewed again to determine if
> they actually are a valid fix. Until that work is complete, remove this
> change to ensure that no problems are being introduced into the
> codebase.
>
> Cc: Aditya Pakki <pakki001@xxxxxxx>
> Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

Upon re-review, this fix still looks good to me, revert is not necessary.

> ---
> drivers/nvdimm/btt_devs.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
> index 05feb97e11ce..995573905dfb 100644
> --- a/drivers/nvdimm/btt_devs.c
> +++ b/drivers/nvdimm/btt_devs.c
> @@ -191,15 +191,14 @@ static struct device *__nd_btt_create(struct nd_region *nd_region,
> return NULL;
>
> nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL);
> - if (nd_btt->id < 0)
> - goto out_nd_btt;
> + if (nd_btt->id < 0) {
> + kfree(nd_btt);
> + return NULL;
> + }
>
> nd_btt->lbasize = lbasize;
> - if (uuid) {
> + if (uuid)
> uuid = kmemdup(uuid, 16, GFP_KERNEL);
> - if (!uuid)
> - goto out_put_id;
> - }
> nd_btt->uuid = uuid;
> dev = &nd_btt->dev;
> dev_set_name(dev, "btt%d.%d", nd_region->id, nd_btt->id);
> @@ -213,13 +212,6 @@ static struct device *__nd_btt_create(struct nd_region *nd_region,
> return NULL;
> }
> return dev;
> -
> -out_put_id:
> - ida_simple_remove(&nd_region->btt_ida, nd_btt->id);
> -
> -out_nd_btt:
> - kfree(nd_btt);
> - return NULL;
> }
>
> struct device *nd_btt_create(struct nd_region *nd_region)
> --
> 2.31.1
>