Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7151734rwb; Tue, 6 Dec 2022 01:45:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf6jPws/T6RHWoyhJLe/cm5yjThgMyXWpbCrUdlIwnGPsZ01lxs5XB3WYu1IfBGS9ihTxwGA X-Received: by 2002:a05:6402:1655:b0:46a:80cc:d5bd with SMTP id s21-20020a056402165500b0046a80ccd5bdmr49936206edx.210.1670319905258; Tue, 06 Dec 2022 01:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670319905; cv=none; d=google.com; s=arc-20160816; b=kwER+tnkNBv1QLuDZgqfyaiZQxGR17J1ANLiJ4RQIT9EdYFIlquhAKLP1+KrZKLLFS 7xx4mXkkwyopIYh46DsuZ/FHdRibXJGUfc3vUZPp0YxKJWdzVHVI8iSbWplLNAdOxx4T 6cvhRWtJNENpYQXMMdr6Uhn+fRBfI5Os3QZmq9s5crgUwLqleoWdV8thUP/bknOH2331 +VyRw+GI644cNlpdzOnGWlQArFjy42Gg+rGyW/kEKfqGbSsVUP8tSAaAXnlTq2Mncz5t 3DBTgQKPfsdB6U35HVO6dfC9cZ0pgTAiLHfmAjfXxRD5bevNDLfr/oyqgvV/OB9f7c6B Ag2A== 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=GQ5tuvxuaku+oRqOnUAdTMLIinkFOESZc64xFDHrfqahbfJjoecmYFpV8oavCmwhWF XRF1ENLDLscA4TpxFTIwc7mhUAnQSFGF14uXgwuk5AZramv2Oxp6jVAlX8z2rjTMbh/+ BxlUgWXI7kTH5y4JWCRWZrZdDK9cCRQNEsAjjdbcBgEW/dHrXOamqCUJrUfNxDtgRASD D0bJn/a/NbQxvg+EcUe2WVV69ohNCh9DMAnVcclEaMd5u7NKbfMpEZcdMh3UgzBYPz4C zHvwrUHn33dkflwMgT4RYPEJjuR1erTQKlE+hR9wWwaa2Y1JyApNEYzbMEIGPXQ2ZH/p 6hCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=VXgmNDMW; 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 l19-20020a170906795300b007ada2ec1a28si15040002ejo.165.2022.12.06.01.44.30; Tue, 06 Dec 2022 01:45:05 -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=VXgmNDMW; 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 S229724AbiLFJ1O (ORCPT + 99 others); Tue, 6 Dec 2022 04:27:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235034AbiLFJ1B (ORCPT ); Tue, 6 Dec 2022 04:27:01 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88698120; Tue, 6 Dec 2022 01:27:00 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1670318813; 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=VXgmNDMWuOmrgj7jvL9Yj+s68mG6Zp92jAfTI2AE1eO34LAvR/yCWdKh4Z5eS5eIef7CXR 2Sn+zO/E917BXdMdlRhQ8OdEMoujy5Pylwn4PScPLnrkmKH9eGlLLOZ+4Cp7VXKeqijfE1 RhP5gwJwLw2pRAnmUzKtVheeD6lWbt8= To: Trond Myklebust Cc: Anna Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, trufanov@swemel.ru, vfh@swemel.ru Subject: [PATCH] fs: nfs: Added pointer check Date: Tue, 6 Dec 2022 12:26:53 +0300 Message-Id: <20221206092653.28911-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