Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3512103pxf; Mon, 15 Mar 2021 11:10:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqfBYqw6mVNNkHsp5xQnWcBnk9Fgf+CKVYHLHWP8QCVlZaeRybT7MDV+G3D8cW7GgENYwb X-Received: by 2002:a17:907:9808:: with SMTP id ji8mr25196656ejc.333.1615831834613; Mon, 15 Mar 2021 11:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831834; cv=none; d=google.com; s=arc-20160816; b=YexbeDdfVDY9+r7ST9EKL8UGY2CzGn9IGAOgMYGZlxsP96038bWr5phZZ0wDFjPybz K46X6W3ZjS19GqMNe978bgB6Ge1CPVPWSSYsAL1ZazGx+JKc/Q/rDM/GtNplKk1wX2Ke iprdrPHaCQ0uQ1PioXtT/4qn5hI7vK6Wl4BQpZR7TrZla0vVb5cOWbEtvytC0tsNluS4 H3kYVLBO5v2n0EMsKIAsJe3lFdjkhz7WEGak/XLM9KXq4Agx87SnAAWxnEUm/MpGRvu7 N+IVm4AAW9lY5cX0qXdlB++nX74Le19FbZEPryZ2xLKwjeccv+Y7pbL5p/q2I35Dyvyr 3MsQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8k2EVpfXGS2mzEnXSvpsmAddng7GO3EdXH4d2LRLCoE=; b=rk2ZNoqJfQW7hrw5Bh7JUF+Jia0y+Gac5wcQgs2pBBP2P5VdOuwcPFXecGOdh3t8RH 83YQ+Pzu614eF5vZ/RsFrxvYqArL5SOhC6UtVfeU6KpJk29VnK2iA7DjWtSG7le59Z8d jWj0/ZccQPVeHF8f8bhGaL2vqIALjsB3m0SiXYfbOHs7KskvHl54uUCukVzSc7uRvyhF EiZmvH4pCkKzaGORzyia8KuV+V/tTRwwLzIBjOBVlbWp1G1LdCGLyotPhwozDMzfbLOx 2wAIkDYxkeSJaNcn1zmP9VgMUn8NagHTcXec3gfoe3WSeQRZt3jdJvSqRhq8TwxYfVmf iadA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DGIvNTTn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m13si11466190edd.35.2021.03.15.11.10.06; Mon, 15 Mar 2021 11:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DGIvNTTn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235741AbhCOOKg (ORCPT + 99 others); Mon, 15 Mar 2021 10:10:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232291AbhCON6W (ORCPT ); Mon, 15 Mar 2021 09:58:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF22664F18; Mon, 15 Mar 2021 13:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816698; bh=5pqNJV/JYLDDSsb6qMPftkbdTJT+ZrpkwifHUzfAp/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGIvNTTnwE+1pPMJ0e64ofSHfXV0nvvd8PRVNizuqAp3RhKsQ1nINR0VcE9kJkxAD Ys8TtBI8gszlUHhMGelEpkOkwzMCyGONXTlk82TYDaEP0+Ac7e8Svfm/Vj3zFuPLP/ yHwETELON6Q0bKTJgzLgcJkaas0PTeZlnBhMTxj8= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Jia-Ju Bai , "David S. Miller" Subject: [PATCH 5.11 071/306] net: qrtr: fix error return code of qrtr_sendmsg() Date: Mon, 15 Mar 2021 14:52:14 +0100 Message-Id: <20210315135510.045510439@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Jia-Ju Bai commit 179d0ba0c454057a65929c46af0d6ad986754781 upstream. When sock_alloc_send_skb() returns NULL to skb, no error return code of qrtr_sendmsg() is assigned. To fix this bug, rc is assigned with -ENOMEM in this case. Fixes: 194ccc88297a ("net: qrtr: Support decoding incoming v2 packets") Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/qrtr/qrtr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -958,8 +958,10 @@ static int qrtr_sendmsg(struct socket *s plen = (len + 3) & ~3; skb = sock_alloc_send_skb(sk, plen + QRTR_HDR_MAX_SIZE, msg->msg_flags & MSG_DONTWAIT, &rc); - if (!skb) + if (!skb) { + rc = -ENOMEM; goto out_node; + } skb_reserve(skb, QRTR_HDR_MAX_SIZE);