Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp1692810rwb; Sat, 3 Sep 2022 23:36:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR4IRMuOa+XKe4PHbh5JPM5zR2loreGY6c3Pu5Yra2QcBS+x8YO23owecT99mcRfThmmJq6h X-Received: by 2002:a05:6402:40cb:b0:448:627d:90d6 with SMTP id z11-20020a05640240cb00b00448627d90d6mr27352359edb.233.1662273378254; Sat, 03 Sep 2022 23:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662273378; cv=none; d=google.com; s=arc-20160816; b=saGxSrBLpMtmu6b7hHcjZ0QT2uANWyK1Okz+g3fFpAUTAZB8f7wD2ZvsarsHoeKZEq wGj5uyhjkjQpTzAtAH27aKiTz9vNNiEZueMJ4d7g4tS1etJ1hngnZEvgtCpiHAXpjViR ZpVyDTQ8DWtPP6+TYirYFMPAkQARs10zBKgdzaRPLiZQjtNOOBiVVPzpcVHQGKh2wb9l N69Ak38NwbE0FEgbjemGFEznX6lSAo17uq9vlRrtWSOJIv/5hMS/DZXbOZhroP7JALuY BEx1NN6tdKXFzKTIXvtmZAGdufoPyaQyMo+8FJj/qBpQG8yAsB5zOWfvOAPYxl7O6rmg ubMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1c6Eca4u26XyBG4ZLRT3VPc/M8H5ZDsvVM8oyO+eS5s=; b=LjzM2AbqyQrO+QI6CeWH1+hGbiKHgrE9xgLcuRAqEW/NEpa8jYf4jX371akWzRaCHa 0T8UiQykLE0bOaY7nB//elJM8ez0SD7d/aKpcAXVS9i3HMo5eG5Cymsic6I99HFxBoFn BR8DzQaKgUKkEQHZ9rID7aigB0KgicBv8wrmOk4PNFH1EKu58oGNp83Ei9B3ayp/19W7 v/ea2EtMKZ4PL3Pdf5bjLgVV/R90ctx7G2PcHtO9FsOK+9akzxxKBW7DGKoBfT0v4c0O vAMOq7iYbJxQnyQ98q7IrmonGA4WrKRiPX9Gx6XaZ+F0OCbAe2QXMcl1qaJG2Uq/dVNy pqLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mDEctBve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp34-20020a1709071b2200b00730e5c46ed9si6206850ejc.15.2022.09.03.23.35.43; Sat, 03 Sep 2022 23:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mDEctBve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231560AbiIDGUT (ORCPT + 99 others); Sun, 4 Sep 2022 02:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbiIDGUQ (ORCPT ); Sun, 4 Sep 2022 02:20:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A95327CCF; Sat, 3 Sep 2022 23:20:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32EAFB80C0A; Sun, 4 Sep 2022 06:20:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D2B5C433D6; Sun, 4 Sep 2022 06:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662272412; bh=RE8YCa7OO1bHEGDf3RNzYclTV7vEm+CT+3ycRThtJMM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mDEctBveSUQtpguSZXKO4r7sABUOINuxfcCPeNG0nduSxARwMJgrON5vf4wMVqyuv pGM3MggMqLbxkj/UB/2BO7NklL+pMRfbJzZiZ0UAieQYjgOCPGYjx+6bK4NTdBTTn/ nKeLvxCW274XUUSDkgoPaaLF/PTnKE2/W9Lq/L4I= Date: Sun, 4 Sep 2022 08:20:09 +0200 From: Greg KH To: Li Zhong Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, jirislaby@kernel.org Subject: Re: [PATCH v3] drivers/tty/serial: check the return value of uart_port_check() Message-ID: References: <20220904004524.2281227-1-floridsleeves@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220904004524.2281227-1-floridsleeves@gmail.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 03, 2022 at 05:45:24PM -0700, Li Zhong wrote: > uart_port_check() will return NULL pointer when state->uart_port is > NULL. Check the return value before dereference it to avoid > null-pointer-dereference error because the locking does not guarantee > the return value is not NULL. Here we do not need unlock in the error > handling because the mutex_unlock() is called in callers. > > Signed-off-by: Li Zhong > --- > > v3: Add the reason why we need to check the NULL value in the commit > message. The bug is detected by static analysis. Great, then please follow the rules in Documentation/process/researcher-guidelines.rst and identify the tools you are using as well as everything else listed there. thanks, greg k-h