From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A970C63798 for ; Wed, 18 Nov 2020 08:14:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B370422266 for ; Wed, 18 Nov 2020 08:14:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="cHMJGI8v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B370422266 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D38FB6B0036; Wed, 18 Nov 2020 03:14:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC2436B005C; Wed, 18 Nov 2020 03:14:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8A8E6B0068; Wed, 18 Nov 2020 03:14:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 83D8E6B0036 for ; Wed, 18 Nov 2020 03:14:42 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2BB248249980 for ; Wed, 18 Nov 2020 08:14:42 +0000 (UTC) X-FDA: 77496827604.07.vase34_000b41a27338 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 171F9180269E9 for ; Wed, 18 Nov 2020 08:14:42 +0000 (UTC) X-HE-Tag: vase34_000b41a27338 X-Filterd-Recvd-Size: 4754 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Nov 2020 08:14:41 +0000 (UTC) Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A9AE2468D for ; Wed, 18 Nov 2020 08:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605687280; bh=qJ5zHy+pCbs19PJJvVJMA3zNtj6fFyQGeZR+ojf8+qg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cHMJGI8v5BPFNXRQWeJ0JKJB0knfTBwt1aDU9wi6IE+cWaFR67uysOUaFXuynNxv3 L+f2pnfDgsMsbcM8mcGho2ThKnebwEFSCxc7llCUFg9B41a/EMmjno58VG+jA58qGB L2p5pLsZR52sfdabMOrk4svM+HJ13cYEohUhYY0A= Received: by mail-ot1-f54.google.com with SMTP id o3so932314ota.8 for ; Wed, 18 Nov 2020 00:14:40 -0800 (PST) X-Gm-Message-State: AOAM531tUSjJblh1bn1KscnuFbxMRynqYwwFLDxYJne2H8NJbF0cv6US mZGV07bWc9bH+x6phxUDwstC/Yy0aEtzxix/yuc= X-Google-Smtp-Source: ABdhPJzf9aND79dMbS2oPlqGaDMX02ziUJv3AxQiefYLxvz2JZIIcPClzq5iJdToVHe28h+vHRKxV2a9AOBgyn30V3E= X-Received: by 2002:a05:6830:22d2:: with SMTP id q18mr5279342otc.305.1605687279412; Wed, 18 Nov 2020 00:14:39 -0800 (PST) MIME-Version: 1.0 References: <20201117232343.rg37fkacw43matmh@revered> In-Reply-To: <20201117232343.rg37fkacw43matmh@revered> From: Arnd Bergmann Date: Wed, 18 Nov 2020 09:14:23 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [arm] BUG: KASAN: slab-out-of-bounds in memcmp+0x30/0x5c To: Nishanth Menon Cc: Naresh Kamboju , Linux ARM , Linux-Next Mailing List , open list , linux-mm , lkft-triage@lists.linaro.org, linux-mmc , Linus Walleij , Arnd Bergmann , Andrew Morton , Steven Rostedt , Ulf Hansson , Linux-OMAP , Liam Girdwood , Mark Brown Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Nov 18, 2020 at 12:24 AM Nishanth Menon wrote: > On 16:25-20201117, Arnd Bergmann wrote: > > Yes, this was indeed a bug that has been around for some time now :( > > I tested with a variant of the above (did'nt like that > oinfo was being assigned an invalid address) > Boot log: https://pastebin.ubuntu.com/p/nZfz3HF8N6/ (with the same > config as in the report): Would you prefer to me to send the following > as a formal patch? Awesome, thanks for the new patch and testing it! Yes, please send this as a proper patch to have it picked up into the regulator tree as a bugfix. Reported-by: Naresh Kamboju Reviewed-by: Arnd Bergmann > diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c > index 3e60bff76194..9f0a4d50cead 100644 > --- a/drivers/regulator/ti-abb-regulator.c > +++ b/drivers/regulator/ti-abb-regulator.c > @@ -342,8 +342,17 @@ static int ti_abb_set_voltage_sel(struct regulator_dev *rdev, unsigned sel) > return ret; > } > > - /* If data is exactly the same, then just update index, no change */ > info = &abb->info[sel]; > + /* > + * When Linux kernel is starting up, we are'nt sure of the > + * Bias configuration that bootloader has configured. > + * So, we get to know the actual setting the first time > + * we are asked to transition. > + */ > + if (abb->current_info_idx == -EINVAL) > + goto just_set_abb; > + > + /* If data is exactly the same, then just update index, no change */ > oinfo = &abb->info[abb->current_info_idx]; > if (!memcmp(info, oinfo, sizeof(*info))) { > dev_dbg(dev, "%s: Same data new idx=%d, old idx=%d\n", __func__, > @@ -351,6 +360,7 @@ static int ti_abb_set_voltage_sel(struct regulator_dev *rdev, unsigned sel) > goto out; > } > > +just_set_abb: > ret = ti_abb_set_opp(rdev, abb, info); > > out: