From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.8 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796410991; b=lQ94c3uow1/Myw4c8EqOIIgUFUOzBVwvOIh3/LAWU24MnYeOGjylueEWnx8yQuUxqwwZ PLgTJ605F0VKX7u5+jd8eKfQx47pqxpUt2BClyi7uMbt+5yVBmYwuLYxihxxxR60JUhpy 0qrC0WnHzloSzTeClT0gC1oMGBwUEZGQkpTD1cjrt4HWf7hII7DL0A+rR5Q+jbJhGQnzV /OdbJtOtK+4I88wV3Vxy1/71Hp/BotQMWUjIoAGSHvMfTAKRNmyVUZqhYP8B0XRnbppRe Gp9rjyKMmj9p10dCv31gMMnTSBXlOTFbxB15PgmT2Vfdc248O2HWL9BxbftGlJJWevQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796410991; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Subject: From:To:Cc:Date:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:User-Agent:MIME-Version; bh=Wb7n/T7IVmfWqnkDCNBZzHCY9YWolhdZQp24bdkOUPU=; b=n3BvOrzZdyxHe5kEblsfHiMmpABeo/KwfWVrIZ/WKUf4kHQ6jUSW0QFLDGF13gNAUg/c 4ofaL7lhjYueAo7M0N8y+Wrtlz2XEoWruJaFuHkLW6gHHRYvoYUmb31MlJkK4Xj8BiTFt WLsapwZCQ7R1ZmCsQepSevihXrp8kRNNOl7r7+ysHYBoSvNF8aizwnyp1rFyCnnNdSpjU pZgPbRE1EjD6rEBZXsRF/KiLbqgG6F8TBTfE4Nb7UBUiNP457CqR0gIxtgyFFCO+C8EwI DQjESfsKfOvpUDC5prjJ69rjcik1ML/Mot4+92TiaAopxOWon4QomD8189KfuIC94cQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="K/UIkLBI"; arc=none smtp.remote-ip=192.198.163.8 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 387AC606A32C for ; Fri, 4 Dec 2026 19:03:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 387AC606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=K/UIkLBI DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796410990; x=1827946990; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=Wb7n/T7IVmfWqnkDCNBZzHCY9YWolhdZQp24bdkOUPU=; b=K/UIkLBIU79J3W/SlfVYipD13KV0Zq9uLVnRDc/s3n73Tg0euNWZxmEB EJb9ZlDH1ANUxcXJpwpEkxvsQHOqdnEidosHGUiPCSjMIOwSxN0qqG0+f cm9P1C/T5F/amCOWq76Xakx/xEb0NtYMz6kupz+9U2Pf0GWCKwzR1g4TF WolTGLoV0CoOU5cJ2SDXlbMAJQXidgzFWfTJllUy3SiKi+MpfADL4ydT9 zv/cwSR88hGRAPG6E0PlUUUz5XPDhCfNI/EszpAumxPQIaH/83HWoUccX goTVs4Mvwyg4+NYWY6bIvJCtPLuwhI1ZDsujv/KEgEpJrBTRCJ0IZ3wgu w==; X-CSE-ConnectionGUID: P1v2WN/8TNu4Ih0IDR9Xyg== X-CSE-MsgGUID: UD9BWZFWR/Kwp4vn2xej2A== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5287145" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5287145" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 11:02:18 -0800 X-CSE-ConnectionGUID: 4HxUhbsyTbifmeWNzuQXIw== X-CSE-MsgGUID: DkZDLf9zRHqZjGTddes/VA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="14443709" Received: from spandruv-mobl5.amr.corp.intel.com (HELO [10.124.220.13]) ([10.124.220.13]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 11:02:17 -0800 Message-ID: <677463758ef7c94752edff0cb1740943cf2bbeb7.camel@linux.intel.com> Subject: Re: [PATCH v2 1/2] HID: intel-ish-hid: Reallocate the descriptor buffers for a longer response From: Srinivas Pandruvada To: Zhang Lixu , Maoyi Xie Cc: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org Date: Fri, 04 Dec 2026 11:02:16 -0800 In-Reply-To: References: <20261125090633.1385386-1-maoyixie.tju@gmail.com> <20261125090633.1385386-2-maoyixie.tju@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-3.fc44) X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Fri, 2026-12-04 at 13:52 +0800, Zhang Lixu wrote: > On Wed, Nov 25, 2026 at 05:06:32PM +0800, Maoyi Xie wrote: > > process_recv() allocates hid_descr[i] and report_descr[i] only when > > they > > are NULL. It then copies each response into them with the length of > > that response. After an ISH reset, a longer descriptor for the same > > index can overflow the buffer allocated for the first response. A > > second, longer response to one request does the same. > >=20 > > Size the buffer to the received length with devm_krealloc() before > > the > > copy. Ignore a response whose done flag is already set. > > ishtp_hid_parse() may be reading the report descriptor at that > > point. > >=20 > > Found with a CodeQL-based static analysis tool that we are > > developing. > > Reproduced in a userspace harness under AddressSanitizer. Not > > tested on > > hardware. > >=20 > > Fixes: 0b28cb4bcb17 ("HID: intel-ish-hid: ISH HID client driver") > > Cc: stable@vger.kernel.org > > Signed-off-by: Maoyi Xie >=20 > Looks good to me. Tested on Intel PTL ISH hardware across repeated > firmware resets, module reload. >=20 > Reviewed-by: Zhang Lixu > Tested-by: Zhang Lixu >=20 Acked-by: Srinivas Pandruvada > > --- > > v2: > > - Ignore a response whose done flag is already set (Sashiko > > review). > > - Shorten the commit message. > > v1: > > https://lore.kernel.org/linux-input/20261123092816.2200718-2-maoyixie.t= ju@gmail.com/