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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FD13C433FE for ; Fri, 18 Mar 2022 16:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239113AbiCRQaB (ORCPT ); Fri, 18 Mar 2022 12:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239242AbiCRQ2E (ORCPT ); Fri, 18 Mar 2022 12:28:04 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBFD218EE8A; Fri, 18 Mar 2022 09:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647620805; x=1679156805; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=dDLLHCtUYDvBeiYbbGUjNuufSA+5n9Dp9C2i70UwuFA=; b=I1r3vVn7dCo/q3W8iBKQNxUWuGXq0/OiiAO8KJWEthjFLNzFmHVJYEqg CD1xgUnEo9VaKVweIvyYpW8jYJAsPbBW3TyVqtHCgugCs5uIVvovVoArO 1wLdsg4l3Jx1s6zKcLkdcv+v/gLm0z469m24OUBnhmChowG4ybfC3q9Jj juntF6z6EErZ6Bx+EHZAIIuTgA7eknR/wLBp1Dm6hdTWUqhTa7/ZTq/7x iyYWxd54rCCMKRtvOLF/zzXFXxlkFJtXA93bMQAH+kPrOyU/Q5+fiwcCJ 52PglRQGeB8hsAZzJbMFYKwFkjrX7MeV2aPfI7PjdbRYThHEvf5dweRxJ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10290"; a="257356584" X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="257356584" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2022 09:26:45 -0700 X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="550797917" Received: from smile.fi.intel.com ([10.237.72.59]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2022 09:26:40 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nVFQP-002K9d-3x; Fri, 18 Mar 2022 18:26:01 +0200 Date: Fri, 18 Mar 2022 18:26:00 +0200 From: Andy Shevchenko To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= Cc: Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "'Rafael J . Wysocki '" , Wolfram Sang , Peter Rosin , Russell King , Andrew Lunn , Heiner Kallweit , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Hans de Goede , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 1/6] property: add fwnode_property_read_string_index() Message-ID: References: <20220318160059.328208-1-clement.leger@bootlin.com> <20220318160059.328208-2-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220318160059.328208-2-clement.leger@bootlin.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 18, 2022 at 05:00:47PM +0100, Clément Léger wrote: > Add fwnode_property_read_string_index() function which allows to > retrieve a string from an array by its index. This function is the > equivalent of of_property_read_string_index() but for fwnode support. ... > + values = kcalloc(nval, sizeof(*values), GFP_KERNEL); > + if (!values) > + return -ENOMEM; > + > + ret = fwnode_property_read_string_array(fwnode, propname, values, nval); > + if (ret < 0) > + goto out; > + > + *string = values[index]; > +out: > + kfree(values); Here is UAF (use after free). How is it supposed to work? -- With Best Regards, Andy Shevchenko