Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2998963rdg; Tue, 17 Oct 2023 01:02:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHeO9bpez6Ixgf3luHFu+sxtggJtLle0Bx3AnjqehExdgoHhBI6F79ZQu9N2B0OW6kdxiI X-Received: by 2002:a05:6358:9da8:b0:135:85ec:a080 with SMTP id d40-20020a0563589da800b0013585eca080mr1719680rwo.32.1697529745033; Tue, 17 Oct 2023 01:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697529744; cv=none; d=google.com; s=arc-20160816; b=x51hGQ/6BMgHW+eqTjxSc+ZmfzTpG3weLufXrI4BxZrWRCEMask5kIzD3E3tJPYOLu 8/bZsiQ9V5G0vRP7mFklZxT9t1AMWkCWzylH7nrYU7McdvdcitW/p2iuZKPfH3v9WtJB psODtOf0jt4o+5Byk/SCFSJstH/CyzSOmZnbHm+KH7L0oAgHdnS5emfJdtmwre6inFdI 1fWkyTyGan3hSBxp3MFqlEL/vL4NU0Bv3GzZjMkuzha634RuFUevIpy2Sqjl19x8IjNQ 9lBQRzkbi3mGqKtqYUubnuoeybhTJnQIwfG/M2cyMhioZgQ3dF6KLfmCNKVz0DZDda0g pnqQ== 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=/CXZJ+Abl669JbBEeAk2v55nhOvAJqTJox/5qebLek0=; fh=XsGBCMnkKdZO3MELYbFe3zPyZWs8xNKxeR7SUZXgbns=; b=vOhiqtW4zIQFDpIPrjr3qsuQtyGniBMhTikPG1SfKqRZPY4tAfot+Saca9RjXZuYs3 ZMq1ppO4Za6UHRD0BoXLMj017ioO8agoA2jNe8nsyGSA7z9xBtefioL7IM7bjwY+NiWH 0G81pUZ+QstwVYBHDiMHfcKYLPByNQmpqI+Oengv2Ni6sR2hhRe1GSg/HzP/IOdhn2iO 2PTR1bxNyy2rNGJPX79fMStj1NCPub+Y1UZ/8d1cfVPS/cIRj3XWh+YlB+vnSldPU9Eo 5TxLukBYNZHmnIurpKAu2kpBxw03I9giO26VdH46FGqlmTvoNymjQD7A9u46meYfxaOd 5GpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dKwx6j6u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id be3-20020a656e43000000b005abf640eec5si115565pgb.171.2023.10.17.01.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 01:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dKwx6j6u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BC8E68040D46; Tue, 17 Oct 2023 01:02:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234722AbjJQICR (ORCPT + 99 others); Tue, 17 Oct 2023 04:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232134AbjJQICQ (ORCPT ); Tue, 17 Oct 2023 04:02:16 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35AF595 for ; Tue, 17 Oct 2023 01:02:15 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B7FC433C8; Tue, 17 Oct 2023 08:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697529734; bh=hBRPEhQBiSI81nd4KdECGTfCnCSML4Jby3geJfist6A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dKwx6j6u/UIx6P1emJ78Stnx1hzg6hAQBKTU/o0ndP6yoyFeYSjl3lGrC4upjk8gK ng83qjzrrR1yRpmdxJEYbA/bSuxyrV9bSxfMia2GQedncXLVpylwH/Tr21pLL5K8YR taPsPmlkSmXoICL8DdIKS36l/Zpi+NKUhsrRE3u9rCeN2EQXCOlh7NzoX+ry4C59+S LQpqijokc6aOlFUuwWL02pQo6emKmcCxrIu6uhkO/nurt4SuSM802JUgCgMWOc19PL fQ+r17C+T+RtpgAEy1wBy4CH7+z/snf+GepHZTNm+zSrG/dzSyoqbNnxOj0pqh7sm+ TbUjAMMyVNVmg== Date: Tue, 17 Oct 2023 10:02:10 +0200 From: Simon Horman To: Anjali Kulkarni Cc: linux-kernel@vger.kernel.org, davem@davemloft.net, Liam.Howlett@oracle.com, netdev@vger.kernel.org, oliver.sang@intel.com, kuba@kernel.org Subject: Re: [PATCH v1] Fix NULL pointer dereference in cn_filter() Message-ID: <20231017080210.GG1751252@kernel.org> References: <20231013225619.987912-1-anjali.k.kulkarni@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231013225619.987912-1-anjali.k.kulkarni@oracle.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 17 Oct 2023 01:02:22 -0700 (PDT) On Fri, Oct 13, 2023 at 03:56:19PM -0700, Anjali Kulkarni wrote: > Check that sk_user_data is not NULL, else return from cn_filter(). Thanks, I agree that this change seems likely to address the problem at the link below. And I also think cn_filter() is a good place to fix this [1]. But I am wondering if you could add some commentary to the patch description, describing under what circumstances this problem can occur. [1] https://lore.kernel.org/all/20231013120105.GH29570@kernel.org/ > Fixes: 2aa1f7a1f47c ("connector/cn_proc: Add filtering to fix some bugs") > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-lkp/202309201456.84c19e27-oliver.sang@intel.com/ > Signed-off-by: Anjali Kulkarni > --- > drivers/connector/cn_proc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c > index 05d562e9c8b1..a8e55569e4f5 100644 > --- a/drivers/connector/cn_proc.c > +++ b/drivers/connector/cn_proc.c > @@ -54,7 +54,7 @@ static int cn_filter(struct sock *dsk, struct sk_buff *skb, void *data) > enum proc_cn_mcast_op mc_op; > uintptr_t val; > > - if (!dsk || !data) > + if (!dsk || !data || !dsk->sk_user_data) > return 0; > > ptr = (__u32 *)data; > -- > 2.42.0 >