Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3513457pxf; Mon, 15 Mar 2021 11:12:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3TVdXsi4GE/yfF4XgRRdqlKyOjk95J3LE1lQjk98ZvQifBq1+LBs4L4/qB0/JeMh8FS3v X-Received: by 2002:a05:6402:2d0:: with SMTP id b16mr31840857edx.194.1615831958321; Mon, 15 Mar 2021 11:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831958; cv=none; d=google.com; s=arc-20160816; b=KFoshJo4ak+TYaE1x4XHcbpc9Jp/DXK4O8fw9v9HxTFMfLHpaEjpo59cy/uMuZEDrc MtKQSgJo2Ex/8MiJN+6K6j7dxHGW7w0BFuF0UqKQPl7LRBdgLc1OnAOYD3HAUbxfr5Zl Qau4BIN8UAezmvtsB3cWDYcGJwsb9lOva67EFp36rjqOsd1KNbz3O0+Rxz6lN2Oh6Z1Q 6lZiuuw48Bgw5aTAqeoz7lK0alA+RZrHW5bTiNIswoAXe/fRZyuyhwH5yXBkjrWJrVRv WEH15cL18rayz+xMACo334/eAhha42KO0VALJPlwkH9LOo5XbVnWV0TOPBVDMhz7JhDb UDMQ== 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=GwzbKNd92fC5/rcJyVDXcJ9HYsz8qlVXT0peT64o6ac=; b=aQxotvpbgTUQYZEkI86/q03UpJjh+xxGZwfmbTf6EXgHFJCtx3lxr/2gUStJL8TcMP D3QJXaPM7Y9El/8QmoeU0uubtBx6JS8IDyPMHEwC23jlrQx9Ykyrz0LYN88A1w3h45GJ dW0UH32kxoqjiGnD/AtGwCHQGJ7cmvCsbW/WJzkn5XkG/wArPNl997E9YS7vGJqVjPNS BULWtgnrpI9LKH20KJmYysu1O4mUVVYHCrl4g21vHEGV7lHNg3v9beePd1ju0vu4waYO glmtg+Tsfi4CYjobEFA2ht7/ie2ftdf0YtTvuQIoE5EgQdPQbgfcF0yxXz+vMYnwk/D3 G4dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fgj8L6zv; 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 y101si11591014ede.101.2021.03.15.11.12.15; Mon, 15 Mar 2021 11:12:38 -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=Fgj8L6zv; 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 S231154AbhCOOK7 (ORCPT + 99 others); Mon, 15 Mar 2021 10:10:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232201AbhCON6O (ORCPT ); Mon, 15 Mar 2021 09:58:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E5F064F46; Mon, 15 Mar 2021 13:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816694; bh=XU+v2L1wVNBSdOB3bGSv6EpvnmCmIUCV7MkuJoLY/zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fgj8L6zvBWdJrOknd7ML4q3cHxValdzPjCz3R/7/D1/DWyp+xGdnqUQ98Lqlirsh7 SlHtgCOH1E6n0aMOOlzdD+C+jp5sXxbRHSuKl2lEQn4XVny7oYO/RiJoZwRjo4t0VI AVOlwvjKYIcj+g1yjsXu5KRJshQDk0OfzSSVv6Uk= 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.10 060/290] net: qrtr: fix error return code of qrtr_sendmsg() Date: Mon, 15 Mar 2021 14:52:33 +0100 Message-Id: <20210315135543.949798821@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 @@ -935,8 +935,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);