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 498F2C001E0 for ; Sat, 21 Oct 2023 21:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232160AbjJUVFs (ORCPT ); Sat, 21 Oct 2023 17:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjJUVFq (ORCPT ); Sat, 21 Oct 2023 17:05:46 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B1ADF for ; Sat, 21 Oct 2023 14:05:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E425C433C7; Sat, 21 Oct 2023 21:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697922340; bh=6tDhkJV/1dxHks+LaIBNG4NH9CyTsMSrunsmv5chuqY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vg4HgFZN0kVe0H7ch5aiKo/paS/Ev4GctwCZ1kiZI1g8apL6iVD5YHfudtPEM8zLV RwoeutkzqNh29fE7vMMgJ/wNDwKefWEqrbtGzQFGVe7WkKj5ld5OyA7NAXnIvCNUfH fjzyL8iwhtr/ECEECM8f9M+mcv/N36DBKnm4OPS8= Date: Sat, 21 Oct 2023 23:05:38 +0200 From: Greg Kroah-Hartman To: Tomas Winkler Cc: Alexander Usyskin , Vitaly Lubart , linux-kernel@vger.kernel.org Subject: Re: [char-misc-next 1/2] mei: add check for offline bit in every register access Message-ID: <2023102137-chooser-canyon-06ff@gregkh> References: <20231018101024.271437-1-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231018101024.271437-1-tomas.winkler@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 18, 2023 at 01:10:23PM +0300, Tomas Winkler wrote: > From: Vitaly Lubart > > Added check for offline in every register access function. > When offline bit is set the driver should not access any mei hw. > > Signed-off-by: Vitaly Lubart > Signed-off-by: Tomas Winkler > --- > drivers/misc/mei/hw-me.c | 154 +++++++++++++++++++++++++++++++++++++-- > 1 file changed, 146 insertions(+), 8 deletions(-) > > diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c > index d11a0740b47c96c33591e69a..565da19bb980c845bc2cf3ed 100644 > --- a/drivers/misc/mei/hw-me.c > +++ b/drivers/misc/mei/hw-me.c > @@ -58,6 +58,9 @@ static inline void mei_me_reg_write(const struct mei_me_hw *hw, > */ > static inline u32 mei_me_mecbrw_read(const struct mei_device *dev) > { > + if (dev->dev->offline) > + return 0; > + What prevents this bit from being set right after you check for it? Same for all of the checks in this patch, this feels like you are trying to paper over a removal without proper locking and error handling. thanks, greg k-h