Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp532637rwb; Wed, 16 Nov 2022 04:27:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf6lKtVsiAFYayRVaotn1w5FQf7cm9XlaO64GQBqJixE8+0ywckVwIB+/AX6YfSEpFdvAEC1 X-Received: by 2002:a17:90a:2c0a:b0:212:cd9c:b44f with SMTP id m10-20020a17090a2c0a00b00212cd9cb44fmr3492317pjd.14.1668601659856; Wed, 16 Nov 2022 04:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668601659; cv=none; d=google.com; s=arc-20160816; b=Rq9gmgzcjdMp8EwG+ozMPsk+s0fPgQ0vdiI91KhRyOqI8rkp8Pz+VxJX5haupMhw87 VQMrg3nVsQrw0/O7+v+Gvt0DFDPukOnjDBL5gmFeW9HhaBDv2+HcKveVWa0b27MLsy5g N+QWKbvVActV7zNTaDv0sZjagpJjihOVVhKckhLeHW2A7lADKtWeNCxt2kGTERRxv4CQ +04W0yrMhi5ZkSbZ5o+QHlN12lgtQxi/8AZU5yZb/BwWSBVBOcwQYRQg2UU1xzP5hZ/+ YQGFoUH1onFzh5+6A5fGs6bzk5ycp1QOTaf5hVizrXoxNtv2k8kvL9/HCTNK1wFBuX4Q k3dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=blRdAMFznuYVK4JcJGOwO8LzBNymOBAcYfVJJpwIUoM=; b=KIL0k2sdmFCFQ/tj/2wV9+D7N9Z6YOHdKPNSX9Zmt94rwUNUJw/dMkvTyq9uEWiUuh R+kgiNfzMQVd8Tdb1hMBGF3IGgqpzf+U8yxDVqeby9zuWzXfiaXi0ysQdWYhITjhMtGs MgAfjsPa2260SSSI2TkG4jW/zq8y/P29nMWzPoMKDBnAcfMeYyTHloCUj9u8lxRQ6MSy xOzb6tlZFKiqCE4pmmNqqRZmwZj8zufJx82JAXZBL1Hz/0sd2WQSK8/nzQzlMgJznXUz kVKZ1Fdg1zCbU5qGiewITTSiKxa8FZ7s48OYINgBN80ozEgMGbPwdB7eCiobjRI/RKGR p9ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=gBzlcTI6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a635747000000b00439f012ca81si15620970pgm.605.2022.11.16.04.27.19; Wed, 16 Nov 2022 04:27:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@swemel.ru header.s=mail header.b=gBzlcTI6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233874AbiKPM0n (ORCPT + 99 others); Wed, 16 Nov 2022 07:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbiKPM02 (ORCPT ); Wed, 16 Nov 2022 07:26:28 -0500 X-Greylist: delayed 406 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 16 Nov 2022 04:22:47 PST Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51982100B; Wed, 16 Nov 2022 04:22:45 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668600957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=blRdAMFznuYVK4JcJGOwO8LzBNymOBAcYfVJJpwIUoM=; b=gBzlcTI6nym7tJE9ExdbmDk6+b/hkc3Wpxh6xroiQC4/E0QRvzFYJlwulGbiQWQqe6DfOb oYx5fk/5wkXfwQUDcg6d/nF8oPgHcXtFUF2Xvr5ORQ4/Lek29rQGa1Sbl8PugFNFMk8j2P UY3Qxh5RmBn2lRjeVJ/FZM81YLns7cU= To: Trond Myklebust Cc: Anna Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, trufanov@swemel.ru, vfh@swemel.ru Subject: [PATCH] fs: nfs: Added pointer check Date: Wed, 16 Nov 2022 15:15:34 +0300 Message-Id: <20221116121556.91060-1-arefev@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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-nfs@vger.kernel.org Return value of a function 'xdr_inline_decode' is dereferenced at nfs4xdr.c:5540 without checking for null, ut it is usually checked for this function Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev --- fs/nfs/nfs4xdr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index c6dbfcae7517..571cc63ecb61 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -5533,6 +5533,8 @@ static int decode_op_map(struct xdr_stream *xdr, struct nfs4_op_map *op_map) if (bitmap_words > NFS4_OP_MAP_NUM_WORDS) return -EIO; p = xdr_inline_decode(xdr, 4 * bitmap_words); + if (!p) + return -EIO; for (i = 0; i < bitmap_words; i++) op_map->u.words[i] = be32_to_cpup(p++); -- 2.25.1