Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp69502pxh; Thu, 7 Apr 2022 14:14:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjzAmqzv1khJ+Ikd51l9A1PlJ0ICt6ne8DFWQbyZDD7J1YNlbA+tqreZStNNhOrKvLhwWQ X-Received: by 2002:a05:6a00:26cf:b0:4f6:fc52:7b6a with SMTP id p15-20020a056a0026cf00b004f6fc527b6amr16187176pfw.39.1649366099718; Thu, 07 Apr 2022 14:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649366099; cv=none; d=google.com; s=arc-20160816; b=K+AVoHxcndTQzuYtdGIKIy4LKZ773p1Yv3o4DqRgP5GrSpKZBeSWaQ0V8OhdwZBxpO ZlJQQSSs0qqbvFe7WVcStBmrJ5df4JMW78rZCUbX6zDw9ossfyILR9tTdV11NJ98gWSS N1GJklXCesgSZpr/lmBXax3nc2Q5HDXw1NAJbjEzot6OJhYQWltXlUaHEPdRWlvKUtJd g4/UUb5DehQHS+lpDGQIDheUSW0tkcxaqiYgHZz1hXaWC1yJ7BX8hkqGhG2vAw+KwvOE MGp/2JnbKKDLCDmVXE5XrbZ0SN+xPi/yeqI64tSHWOUFdcCsy4W9wQLq3tO2amfAQC9K 0ggA== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+Qqgrs3EQAy89mqr205h0aq+LpPYsqRoS/Yu5pbJGww=; b=Bc/SSZC6qBsHekELRLnN8o5edtxRxKgEEsnj4wQKyrylsuP1ChxhehKuN5kneON2Em 2sFrW9EX8IIIXf0fpbBJkZ95U+ALCSD5VQ22sYkLwpqFLYPCTkXX5N1fmziLSOGuWPg0 Ds+ZNDGCYMNM90BKrswnZ8a9CNuWEBLjJKWOkdgqazvqPhfewT3/i2VhNifldFRax/wR IEdLAoR8bFjk5WuaFLHnADKyqUCXxHNsMcFMa8p+13SUNJiZgOEy2BNiQSmLq4lf0yKI FLjpo0UKoGedDCNLkZ5mhyIiYHn0bQP38iub5HQkPdXSc81y8gIQ2ADenKnyHRAC9mpG /BnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gDj5D4ci; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d7-20020a170902854700b00153b2d16636si555139plo.574.2022.04.07.14.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:14:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gDj5D4ci; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 858AE410976; Thu, 7 Apr 2022 13:06:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347014AbiDGSya (ORCPT + 99 others); Thu, 7 Apr 2022 14:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347008AbiDGSy3 (ORCPT ); Thu, 7 Apr 2022 14:54:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79CF2195338 for ; Thu, 7 Apr 2022 11:52:28 -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 dfw.source.kernel.org (Postfix) with ESMTPS id F0BC661DA5 for ; Thu, 7 Apr 2022 18:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4280C385A4 for ; Thu, 7 Apr 2022 18:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649357547; bh=GaFjUOZTSMhrtwTWxNX8cUUnv05zT8jAdmJkkZCIX7o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gDj5D4ciUGGhsspMMBkszbDw54keCWacuY0m4bDwkDyUHwWIMxJfGpR2DF2DTps/F zbWhaErPlxMeeIQS2kOpiTeQGCnhLNmv1eaGYlFQnLgDgNA07ILMOjnK8erHjOYJYE PVXjXcfb7QO2Dg4jVx6j7iGALdD//nkNWxRDo5zY2KPUl5UT51AxyATDGvL70JOKEZ +Hy41DO1SZthS09g2bVsSbi4YHMtRfXuDTcIDVYvaagrrtlIKyaecPxW0gOrOWgd+C PURGfqSuSARcZu7SQOIsTRA8EzlaTTo8iLZf5zCiJyQ4T+LvaoFtdB1K9uf2BKN8eO p5hQ/Ism70LTQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v2 7/8] SUNRPC: svc_tcp_sendmsg() should handle errors from xdr_alloc_bvec() Date: Thu, 7 Apr 2022 14:46:00 -0400 Message-Id: <20220407184601.1064640-7-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407184601.1064640-6-trondmy@kernel.org> References: <20220407184601.1064640-1-trondmy@kernel.org> <20220407184601.1064640-2-trondmy@kernel.org> <20220407184601.1064640-3-trondmy@kernel.org> <20220407184601.1064640-4-trondmy@kernel.org> <20220407184601.1064640-5-trondmy@kernel.org> <20220407184601.1064640-6-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Trond Myklebust The allocation is done with GFP_KERNEL, but it could still fail in a low memory situation. Fixes: 4a85a6a3320b ("SUNRPC: Handle TCP socket sends with kernel_sendpage() again") Signed-off-by: Trond Myklebust --- net/sunrpc/svcsock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 478f857cdaed..6ea3d87e1147 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -1096,7 +1096,9 @@ static int svc_tcp_sendmsg(struct socket *sock, struct xdr_buf *xdr, int ret; *sentp = 0; - xdr_alloc_bvec(xdr, GFP_KERNEL); + ret = xdr_alloc_bvec(xdr, GFP_KERNEL); + if (ret < 0) + return ret; ret = kernel_sendmsg(sock, &msg, &rm, 1, rm.iov_len); if (ret < 0) -- 2.35.1