Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6264227imu; Mon, 21 Jan 2019 06:04:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6xgav3CaD8ZBQfsXH6q+uCXUUpw8sUUlTqZoLBev3LXqSpbNkh+ORvjQrEu0+BLyj2q+0I X-Received: by 2002:a63:1d1d:: with SMTP id d29mr28361422pgd.49.1548079475852; Mon, 21 Jan 2019 06:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079475; cv=none; d=google.com; s=arc-20160816; b=g4/iLYxDRYy7z0FNwsAVXnKlOL5wXTHD2Lvf4q/exy7Mb9OrdXWt1wNMf99KSlx+Ll atYxty/oNRsBEYU1UhCI3mfX+StMRH3piittNtg32z+HUaukET0b7UUes/VP9iLBuOUY yJ5XOQ2/EbC/2sVar6OBNDVSqJ+Wxr3V+RQkGE6SXos8gxiv2WBWXJY2kSDRFt91erxU pjPybg4WsJvUXXmlpbkgVJZc36Y39IPcHp07+bhml0swciR5UZhMMDibO0mvP53j/sga dpzaGEbeWlNUg7b6kB01Jst0o469ID71BMD2CKVao5UM+OAyHibxdc2w/GIATAntw+yt N1sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YLhpcZdbOTntAKZl+G493rv4dmuF9UJTmwEVuRM8DRA=; b=JL0DUGkDaGkwg0LUAacEL9hod3uqnbbthq4qoAQCCqGA9XijEaLvoEtS9eFuI8wter 0J78ug6pKuuT3yZ4XHqpF1Z6MWrBXPuHhTzDYP+bON0absSfzuCoMoEV+ZjEBLJ2Bj35 xAjAtMuyDCRm5SHb+xA6e5YKW4jbow4he7lpezcekzNIaFvyeOX/sXHV+jglEOj9TGmU XXKesZ+ix/lotJu0lyS0mE/5J9RmKUGbNGdKNTVrLIzq6r9M0EDXJZzZapz6K5vx+LMp LCibo1b7tP9UkWDaAViDf4y7jqIHIj/cXb/vNNyxh8CK9P6fCa1AZM4gXQXO3yLUbAPl sb/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GH9JTi3p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si9045532plt.212.2019.01.21.06.04.10; Mon, 21 Jan 2019 06:04:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GH9JTi3p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732626AbfAUOBW (ORCPT + 99 others); Mon, 21 Jan 2019 09:01:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:48332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732618AbfAUOBT (ORCPT ); Mon, 21 Jan 2019 09:01:19 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E916217D4; Mon, 21 Jan 2019 14:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079278; bh=AJdADQgYhIcahebbaQJp5XDB+tEG37nckWQPfBr0mLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GH9JTi3pgbXkRkEOQ9H19zit9ihWQVgFKN28VLzsXhIbRIS6MVF10lr1HJRCJhfvX XgjfQE837sW5Kvc4Q5a8woKG69KngB/V3BoEQjjV81e1U6HA7k1jqOogBQJhM3CEUo L5oFC+s3T5xRlhEbrpZvPZ3JzH5qvcVOU4etlKdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+4b98281f2401ab849f4b@syzkaller.appspotmail.com, "J. Bruce Fields" , Anna Schumaker Subject: [PATCH 4.19 68/99] sunrpc: handle ENOMEM in rpcb_getport_async Date: Mon, 21 Jan 2019 14:49:00 +0100 Message-Id: <20190121134916.561998532@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: J. Bruce Fields commit 81c88b18de1f11f70c97f28ced8d642c00bb3955 upstream. If we ignore the error we'll hit a null dereference a little later. Reported-by: syzbot+4b98281f2401ab849f4b@syzkaller.appspotmail.com Signed-off-by: J. Bruce Fields Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/rpcb_clnt.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -771,6 +771,12 @@ void rpcb_getport_async(struct rpc_task case RPCBVERS_3: map->r_netid = xprt->address_strings[RPC_DISPLAY_NETID]; map->r_addr = rpc_sockaddr2uaddr(sap, GFP_ATOMIC); + if (!map->r_addr) { + status = -ENOMEM; + dprintk("RPC: %5u %s: no memory available\n", + task->tk_pid, __func__); + goto bailout_free_args; + } map->r_owner = ""; break; case RPCBVERS_2: @@ -793,6 +799,8 @@ void rpcb_getport_async(struct rpc_task rpc_put_task(child); return; +bailout_free_args: + kfree(map); bailout_release_client: rpc_release_client(rpcb_clnt); bailout_nofree: