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 0B0B2C433F5 for ; Tue, 26 Apr 2022 13:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350817AbiDZNVV (ORCPT ); Tue, 26 Apr 2022 09:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350813AbiDZNVR (ORCPT ); Tue, 26 Apr 2022 09:21:17 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7E94DCE3D for ; Tue, 26 Apr 2022 06:18:09 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6400,9594,10328"; a="265380300" X-IronPort-AV: E=Sophos;i="5.90,290,1643702400"; d="scan'208";a="265380300" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 06:18:09 -0700 X-IronPort-AV: E=Sophos;i="5.90,290,1643702400"; d="scan'208";a="595758011" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 06:18:07 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1njL4u-008KxI-2Y; Tue, 26 Apr 2022 16:18:04 +0300 Date: Tue, 26 Apr 2022 16:18:03 +0300 From: Andy Shevchenko To: Mikulas Patocka Cc: Linus Torvalds , Andy Shevchenko , Mimi Zohar , device-mapper development , Linux Kernel Mailing List , Mike Snitzer , Milan Broz Subject: Re: [PATCH v2] hex2bin: fix access beyond string end Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 26, 2022 at 08:07:44AM -0400, Mikulas Patocka wrote: > On Tue, 26 Apr 2022, Andy Shevchenko wrote: > > On Sun, Apr 24, 2022 at 10:48 PM Mikulas Patocka wrote: > > > > > > If we pass too short string to "hex2bin" (and the string size without the > > > terminating NUL character is even), "hex2bin" reads one byte after the > > > terminating NUL character. This patch fixes it. > > > > > > Signed-off-by: Mikulas Patocka > > > Cc: stable@vger.kernel.org > > > > You need to provide a Fixes tag. > > OK. Here I resend it with the "Fixes" tag. > > > And on top of that it would be nice to understand if we need to > > support half-bytes, but in any case it's not a scope of the patch > > right now. > > Do you think that there are any users who need this? If my memory doesn't do any tricks with me, I have seen the patterns like hex2bin() + hex_to_bin() in some places in the kernel. -- With Best Regards, Andy Shevchenko