From patchwork Wed Nov 16 12:15:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 21023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp110871wru; Wed, 16 Nov 2022 04:27:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5C8rohNX4DdEqVr+TEJtY69/RNihaEkTlJScTaosOT6+iMrVQQ0ugeHAwjXHePl22TRSct X-Received: by 2002:a17:902:9a01:b0:188:abb9:290 with SMTP id v1-20020a1709029a0100b00188abb90290mr8665553plp.86.1668601676537; Wed, 16 Nov 2022 04:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668601676; cv=none; d=google.com; s=arc-20160816; b=HOg/NmtLARWQxgZ6DQY3u52PBsQ0G2SxdfLfOOppUmVX5kkYGqEvDtRYFNWNrKUckI T1VjpXl5DwrqAfpRVRg0MDSYtj3OgeuzzJHBE3aY8LobhUjgCEjVDtxAdUxukZPRLKdg apBaXHNTfDUD4hK4OqeLGA06yURhfNGOs+bxNx75jd3293oozwPq9ytxzaLMOCxUfER0 wgFCaVOzRjHC/EDcvT//aAdRImN9sQxBlCoYvjgzsGop7PX8TSTy6CnZRFLiWONLZGaH GjOB5w2lU9+CHnRFWKcdnrkwnq4yJ5YWGyl/wcW/d4b1iz9mv7AwiOZv/EWXrtf1QoYF yogA== 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=091Jfoot+5+CncFxlqef/scBBtmtSvAPw23rKG0bfhZRPtRobvi7OiPVyNBpe1TQJD uia4dxaCLoeFjHXpi0aGA0jM3vorFC2ihyNeDUdrnYFonH0v39Zp9u/G3QxvPzDKl/Lu +RtfvwdGHDqNnVcPSe+kRLeBeIUoGgZE9O9FnLE3tnsE20cvs8f1GWlIG2ev3ZFDufnm r9l95Tz5v7ye7yDG5j+HmBRVMbg6ScSaQaSwFLry31+qnGFRiEyCWuRgppSFSFx9Od8Y 9HljiG+wmEZOvkO5ckNMrG7VzUQWCI81F7BU0XN7eBKnC3tLpcu+BnVI3T4vjnq0DE9m MwNw== 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-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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t185-20020a6381c2000000b00476f2af5510si662927pgd.2.2022.11.16.04.27.41; Wed, 16 Nov 2022 04:27:56 -0800 (PST) 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=@swemel.ru header.s=mail header.b=gBzlcTI6; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238109AbiKPM0q (ORCPT + 99 others); Wed, 16 Nov 2022 07:26:46 -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 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749655671324717056?= X-GMAIL-MSGID: =?utf-8?q?1749655671324717056?= 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++);