From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A87F27E0F6 for ; Mon, 29 Apr 2024 15:41:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714405286; cv=none; b=r3SfAC84pyd+2vgUvKZWKCwTPr7zAgKRSxDm6doyYvRjCS2HRdmRzQN0v70j9ohNitR2Qor5C+WsALMKtoaCuh5UKrH6trDau7FEYhyEl1YjTXeto6OGOnHvCHvscQbNHg8+IO9LuNmu27ivB0HxYMI21fRZXydcvK6mhuTE1cg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714405286; c=relaxed/simple; bh=s0bMMn0xw66iKofOyRvkxvyapwQg/Bdw2IRyjfyiM6A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kCmAo4OCZMdSzQ5O1++WTrGKFt0SFcdDZjul8LR8fYy/ZimMlym2V8f6OIMB3QE7nyn+67Grfrh0SfHhB2CiyqAIC4D92KU4O/twPVABu7oxpVxzv+GR7GO984GmZK2TpyTknO6X+fFeFVx2crM5LSDJqkP+ewcxQHmPcZSCtfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KMXlve6D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KMXlve6D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1204BC113CD; Mon, 29 Apr 2024 15:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714405286; bh=s0bMMn0xw66iKofOyRvkxvyapwQg/Bdw2IRyjfyiM6A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KMXlve6DMN6QzsBrb+kSuwHi1NNOVx3i80udIJ6o+Gz7OLQxQUmFcSLG2O0iRjpcB vgBhD9eo3IwwbT9RsoZ8xgwvbyVaL/Zx3uTgFAf4qhvJh87C7TMCqgrHHuEEJAKcGK Of1UY577PM3kXGDbxlDobFkS5n1BwSSODQ5jjVes= Date: Mon, 29 Apr 2024 17:41:23 +0200 From: Greg KH To: Nam Cao Cc: stable@vger.kernel.org, Eva Kurchatova , Jiri Kosina Subject: Re: [PATCH 5.15.y, 5.10.y, 5.4.y, 4.19.y] HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up Message-ID: <2024042914-asparagus-undercook-5b64@gregkh> References: <2024042952-germless-unguarded-1be2@gregkh> <20240429152514.652751-1-namcao@linutronix.de> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240429152514.652751-1-namcao@linutronix.de> On Mon, Apr 29, 2024 at 05:25:15PM +0200, Nam Cao wrote: > commit 9c0f59e47a90c54d0153f8ddc0f80d7a36207d0e upstream. > > The flag I2C_HID_READ_PENDING is used to serialize I2C operations. > However, this is not necessary, because I2C core already has its own > locking for that. > > More importantly, this flag can cause a lock-up: if the flag is set in > i2c_hid_xfer() and an interrupt happens, the interrupt handler > (i2c_hid_irq) will check this flag and return immediately without doing > anything, then the interrupt handler will be invoked again in an > infinite loop. > > Since interrupt handler is an RT task, it takes over the CPU and the > flag-clearing task never gets scheduled, thus we have a lock-up. > > Delete this unnecessary flag. > > Reported-and-tested-by: Eva Kurchatova > Closes: https://lore.kernel.org/r/CA+eeCSPUDpUg76ZO8dszSbAGn+UHjcyv8F1J-CUPVARAzEtW9w@mail.gmail.com > Fixes: 4a200c3b9a40 ("HID: i2c-hid: introduce HID over i2c specification implementation") > Cc: > Signed-off-by: Nam Cao > Signed-off-by: Jiri Kosina > [apply to v4.19 -> v5.15] > Signed-off-by: Nam Cao > --- > drivers/hid/i2c-hid/i2c-hid-core.c | 8 -------- > 1 file changed, 8 deletions(-) Now queued up, thanks. greg k-h