Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6250690imu; Mon, 21 Jan 2019 05:51:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7lbYhECWvrDDeRZjS+9J8K/zTXh5qg+k7ouEVSRScQyLHoSFOIbpuBqb8NLMyRS8yYBtvu X-Received: by 2002:a17:902:b093:: with SMTP id p19mr30145666plr.135.1548078695599; Mon, 21 Jan 2019 05:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078695; cv=none; d=google.com; s=arc-20160816; b=Eac/nTjpNRl0S5oCZeOMj6wtnyLbznIDkh2pLccY8QbpGEuiN79YuEzEQvFm3u5upv VRnWHRbXxThd6L5fzbkEKedyCCODetU7N21dJ2oK3m7Ev5Z/cVlyzWmS8/Nfvyhgvesb X8lSdwNhI7ZTOPP20JDK7lo9fYJffxBbCfq7n1Jg0tcZjh++iTRIjolHh8EOKckX7a/b tdAbeNyPW4L+zhmQKLswOIMWC8T+T5+uYZGxnz2Na0T6kcPESxcWwRfoGINsWXKXehJ0 0ijeeCJs61xLKR12pRnA0K+tmuEYOvxTKBiHUwNPKlvbFF5cQKdwssH2yPKST1qQlRhc UZqA== 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=Kn6OzWukW68sXuaHz8QNTtiUR0w9mEHRSIYp5BRG37E=; b=u0qKF3bxnG+Xv6H0iQIdsPmGdmcpFvJ44sZgAEmIzbTDrkJS1KLmQR9aeIJ6vL0kbr 6t+4+GuamIHj2dqrFhiU2ct+gGJQWl2PVDPTDaf+afFE14RLt0f5i6A/HbV8no0k4BNf mG82/84P3i3rDhGFNHy7+c8l4u435vJRo5MDhpHNCi+OmwyIdl06Zb9w/l8BQy1q972D +UXZPHVuDmJBkMbzX3n1+AX1zyxdPZ2xNTqEl3fXP1mGyPafY/mYFkTWh0J7nsDQaB5/ dRLSQZJ8tirHbJ+GR++b0TKCBiZ4R+GJOiF50cI/Cs+dbjZqpCPITw2DRlEca8iSYr/Y I8oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kbM6WTZ7; 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 j186si12592932pfb.174.2019.01.21.05.51.18; Mon, 21 Jan 2019 05:51: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=kbM6WTZ7; 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 S1730318AbfAUNtk (ORCPT + 99 others); Mon, 21 Jan 2019 08:49:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:60284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730294AbfAUNtg (ORCPT ); Mon, 21 Jan 2019 08:49:36 -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 710052063F; Mon, 21 Jan 2019 13:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078575; bh=p43Xl9zZVgflAsYzopspiSbP7wFH1jtrdkZAX1eLFTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kbM6WTZ7Z9R7duaMBz2DdFZq3K6OFWVGwO0zSOZn3o5HvSFjhNZfVRtppcfxgTZyi 2LU2YZpXidbEUQeu9pnmGCp3/39aJWfFJwvJPOOjRTfGqox4STEBzwmAvzOrOoUTiU FSN7bi87z+F5QOaeDKs29ePI+7JUlZciujIn8FN4= 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.20 079/111] sunrpc: handle ENOMEM in rpcb_getport_async Date: Mon, 21 Jan 2019 14:43:13 +0100 Message-Id: <20190121122505.061347362@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@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.20-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: