From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.14 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796363554; b=d2BjOGTniRwRz+sQGwGHMkVMc2bjHyiUl2iPy9zurtQAYOcQAoLuqYETObXVkxVuqBnj mUWDw5E8SGBLIA3if+DA53wIrnctYFVWNnV/ZcecEX44hslUmyfT1/imKRSt/bcWcUdFy OlWYtj/QA9yy+0STSOGYitBgwkqKrtETCQnt+pabfhjhqspt6G1M3e5Bm7/Aoz1oLB/Py glb/g79SAtajtbVPSe52FFZFQK9e171dcQOu4QXTCO/mrMWf/jkMtdJp9kMWmWuIOr4uC BGDvyVR+Qqs5EdF7CofWWf1zqNMhRfm7MXAFFx4PZ4m1pGJ/r2weKYkBr39FBINgxuQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796363554; 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:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=lcBpOP1BD7CWQ5EKviuM9ab5g+n7iqJMyRg/ImAwVCM=; b=Rjo/RcIAFKe2qS1Rzlz06i3dh3AWHPIElWKcNlsvbzunkx0X/tr5+OaWtiKQ3tf+F0QZ Ui8Wh9pYynyKYDDtqJbdA+pl5LEp+KXGVIC6aC+vXtXYljRVxVUwTOcRTcmqy1S9jVArR CLe5UQ6WkweNTiTFD6N2XGD2TojBeg6iwooVdM0FRaHLl4j37odqitSgQVifxP83MQ8Am e854vubGUKDvNQa8AylndND4MNvaSy4/kr6oRJ1gO5wfDRYn7peYKOvFa1KBAXhCRAepY 89VVaiWE0nZ6oxBRRv4Q50Mr4WdpT11f2qyip+SApWHIKOCT0UQ5h+fZ5Y9BqpIGlqg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=cnMdHVVZ; arc=none smtp.remote-ip=198.175.65.14 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 25118606A32C for ; Fri, 4 Dec 2026 05:52:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 25118606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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=cnMdHVVZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796363554; x=1827899554; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=lcBpOP1BD7CWQ5EKviuM9ab5g+n7iqJMyRg/ImAwVCM=; b=cnMdHVVZw41NraWPHT0lHrR3RZ4eBgTprvMGz0roOaAfNkB4x+kU0Sg3 kKpJNcWFjVj8JIwpkATw5skmJbF0cTWRww4GbjBduSOJCGPzHpXC6AfZV k/ICkvXVICWkFWhbHNjZvbIYRYbitcNMGrlobYvN7z1f/kqmUuyaI5SoK 08g2xFR+wO27xl++2CgmJURZSJXpzwrjzybf40SjNItVB8DORT+ZxHPei m1qItHCQ0WCzNyUIhrp1JE8CZv/ccrfP6uSBQ0gS8lNIPHstLKqluqEXX MToMee3ltfWAzSLR946/kk8ib8MPvqNdwMzKjlBCJYu+R5xrQCBk/788P A==; X-CSE-ConnectionGUID: 11/FtkKUQFu9ItDE/BsZBA== X-CSE-MsgGUID: LAKA5V8xQPGqOkgo9SgyfA== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5255655" X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="5255655" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 21:52:34 -0800 X-CSE-ConnectionGUID: gHbv9xcFRgWgSKw0Sqiq8A== X-CSE-MsgGUID: 4Pvkh0UVRP6kwgJwiyypvw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="13906290" Received: from lixuzha-desk.sh.intel.com ([10.238.208.185]) by orviesa006.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 21:52:33 -0800 Date: Fri, 4 Dec 2026 13:52:29 +0800 From: Zhang Lixu To: Maoyi Xie Cc: Srinivas Pandruvada , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org Subject: Re: [PATCH v2 1/2] HID: intel-ish-hid: Reallocate the descriptor buffers for a longer response Message-ID: References: <20261125090633.1385386-1-maoyixie.tju@gmail.com> <20261125090633.1385386-2-maoyixie.tju@gmail.com> 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261125090633.1385386-2-maoyixie.tju@gmail.com> 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. > > 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. > > Found with a CodeQL-based static analysis tool that we are developing. > Reproduced in a userspace harness under AddressSanitizer. Not tested on > hardware. > > Fixes: 0b28cb4bcb17 ("HID: intel-ish-hid: ISH HID client driver") > Cc: stable@vger.kernel.org > Signed-off-by: Maoyi Xie Looks good to me. Tested on Intel PTL ISH hardware across repeated firmware resets, module reload. Reviewed-by: Zhang Lixu Tested-by: Zhang Lixu > --- > 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.tju@gmail.com/