Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp148637pxb; Wed, 18 Nov 2020 00:18:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYM4/SAgAO2FdycqCISEROJM0SMnauyoVTpvlPYwvepUwLEb5c8GYb5mb+5GpJnawtugYG X-Received: by 2002:aa7:d3c3:: with SMTP id o3mr25698866edr.319.1605687513753; Wed, 18 Nov 2020 00:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605687513; cv=none; d=google.com; s=arc-20160816; b=TKncu4D89W6Mj0JufMEd3qiy4RL+d9xlIM02p+6m9H40N8Nh2OnSH4fvtqRFkNjKQ2 ZNleHS0nSYRUCqi8qTjyMa79g5kPIoxDMWp+6jVAoMRiSDdyQcSjbbzMwGir5/36m6Ux R6gCM79b3G7xvVLdpPqKpJM0NUKLqr54il04MgDrxD2ZMopupuckDXlKCwvMVspHCUkE abw4gK+HgH/rvqZcDY1eY6Dm92/WwnnASA3wIzZJAbJR+qy7SgK0baE3F8yLAHGGKZ+R PDHqj2smNWdC1JbpW+/X1CxvX3UdACJnE+e4ub7y4eXlPqGwy7FcxS49KetBzoR6HXS2 tkag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5Vsg+73CqQ/MybTstE6bqr5nVh25l89HVHpr6319EwI=; b=ZrRqwS4/sThmiMa08Zzj4/274xTd8HKvksLYwEGIePKygyu7jOaaMcUGwUaqPJJzmn 5uzsvFkhSL0lfWFzEEQiusKOwpwmdBI8idZEZJtcZLwN+a1kSJYoNg++LtGuUzHjD8nZ Hm08bBj/ObV8eIVm9VMnoGURI7i6aRq/CdQMYHPngG/ZIIs/eTja6xzW0WpXYv+N+6Hr o5C2lnCouWWGzsVhLG0hDwkdD7aZk0ayU3Qe6KWB9bGtGLEEoBnzNJPhl9dV06dRrrAJ lkYMEvt4T6i1LtBdP/hgKv0PQMfA5zr7NwvVG5Bh1dySjgK7nYO7+doruoFE2m6euBbX 6oEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cHMJGI8v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp30si11565797ejc.505.2020.11.18.00.18.09; Wed, 18 Nov 2020 00:18:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cHMJGI8v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726658AbgKRIOl (ORCPT + 99 others); Wed, 18 Nov 2020 03:14:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:41862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbgKRIOl (ORCPT ); Wed, 18 Nov 2020 03:14:41 -0500 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 36174241A5; 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-f49.google.com with SMTP id n89so953047otn.3; Wed, 18 Nov 2020 00:14:40 -0800 (PST) X-Gm-Message-State: AOAM531/YNxV2WtUBkV77nraD/8ATVwNtKwRvzUAN38V5OOBedmfCHAb tpT7QYLU/THV3EtEWsooWoZgchQ1Cx9b/U6tTfs= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: