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=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 C5C64C35E0C for ; Tue, 25 Feb 2020 17:39:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F77724653 for ; Tue, 25 Feb 2020 17:39:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="AE8Q7vZm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730708AbgBYRjo (ORCPT ); Tue, 25 Feb 2020 12:39:44 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:46239 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbgBYRjo (ORCPT ); Tue, 25 Feb 2020 12:39:44 -0500 Received: by mail-ot1-f68.google.com with SMTP id g64so250731otb.13 for ; Tue, 25 Feb 2020 09:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7OXHupn/eABYBBL7B4Fti1b+jxOPDWyjuii0bnF4epM=; b=AE8Q7vZmTYokhYjcCu+0V8M12z+lMXneKH2KNQyQURj0mJ5EYfGOBlZk9Cj3yEKaVR mm3V63hec1VXGCQ/iaLeWsOxWOxiNWDPGHTVrHpPBL5t8BR8Ajx3EPC3vmx8LRSTsWIM II5YOPb1K3dkHPTSFl0naBblR59myCgaMB4LDU0u2knaidrssXHl9JAVXDiwBbi5V7q/ AmzAfQlPoZPHMwOf9VjEunUG2SEQi3fTgeIVBJqdOv/8mIfmfU73SSC5CBxH23Lx6Jsj pfHR2UE4Nv1pT65soOHOCBjngHOnHUiMYI/dWnItqyW+iIa84DL9QblBgOt8Y8maWC1q oMiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7OXHupn/eABYBBL7B4Fti1b+jxOPDWyjuii0bnF4epM=; b=WZGUY3hOWcEcejMiCvE/I2g6jSijKu1irgR+tVAKg9Tnz/TSXHBRChcnPoQxvzbdCM H1B3D/m+gTjfL4UnInJigJ063/Q4NlGyUg0Zw8dtx9Rgmw6OlcQ9vV2yBEbz4DkL3x1g jEyM9edX69sEVJOZiAic3AmzXJL1nbGxOe/8eZqHOn648TgAxZk/cfMKK/pHf/8QNImu BQvc5SLd5/Zr8SZ91w2dF5K2QaqbWDqshyEQzDkum9szvQrze3a+WVlZASIGRJ8toEir oniuIhSXp2G0l1309CCYfpvsrebygpYmGZPp1af+s7XXUHiA/C2ThV7g98jhQBkl4cT6 9hWw== X-Gm-Message-State: APjAAAUzHNCG/P/GxWaRbpPkjsE24R9U4ix9nObNwWDVuLFivkJWMjfM BN+8w7Tk4+qZMfG81LyfckwFs7VVsmR56TDGnFSDTw== X-Google-Smtp-Source: APXvYqwFDa7c/+xdMRI4xMWHsaudTDvmWW/yQIztlU6g8VlP3tvDXsNUwuJCiAlWSGRcL/rIhw1WqGwHAKcfPLxAWTE= X-Received: by 2002:a9d:64d8:: with SMTP id n24mr42746705otl.71.1582652383462; Tue, 25 Feb 2020 09:39:43 -0800 (PST) MIME-Version: 1.0 References: <20200225161927.hvftuq7kjn547fyj@kili.mountain> In-Reply-To: <20200225161927.hvftuq7kjn547fyj@kili.mountain> From: Dan Williams Date: Tue, 25 Feb 2020 09:39:32 -0800 Message-ID: Subject: Re: [PATCH 1/2] acpi/nfit: improve bounds checking for 'func' To: Dan Carpenter Cc: Vishal Verma , Dave Jiang , Ira Weiny , "Rafael J. Wysocki" , Len Brown , linux-nvdimm , Linux ACPI , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Tue, Feb 25, 2020 at 8:20 AM Dan Carpenter wrote: > > The 'func' variable can come from the user in the __nd_ioctl(). If it's > too high then the (1 << func) shift in acpi_nfit_clear_to_send() is > undefined. In acpi_nfit_ctl() we pass 'func' to test_bit(func, &dsm_mask) > which could result in an out of bounds access. > > To fix these issues, I introduced the NVDIMM_CMD_MAX (31) define and > updated nfit_dsm_revid() to use that define as well instead of magic > numbers. > > Fixes: 11189c1089da ("acpi/nfit: Fix command-supported detection") > Signed-off-by: Dan Carpenter Reviewed-by: Dan Williams I'll apply this to my fixes branch.