Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3517167pxf; Mon, 15 Mar 2021 11:17:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVCrXKPAVaTp95B15bVK91s+HPKI0PBMrs7on7cSiiFwabhf42aOObn1KCnuEhJOYQCAXZ X-Received: by 2002:a17:906:cecc:: with SMTP id si12mr25157696ejb.461.1615832268235; Mon, 15 Mar 2021 11:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832268; cv=none; d=google.com; s=arc-20160816; b=zen72ZI/8wEeVVh0M41YzneSBdxWwDyhiKb2IA6AKolgbUr/b7VzeezADeT+P3MuvT mK2I06B4cdlDTZUBOtD8I9ctlHVuvIPUpFBHr9CiI9kPMppC2oXE64vlQYlyzyhkd0ek 5QX1/EDTjSQpvJp1cxB0Nl8l7iCVgb6n1vANWlH986lgWwmnAR5xU7VHmvoXn1MKDUOR eQFKV/2/TUx9kWMBSvn4VYTru3HlMWPJ+EGJiM3zpv4GG/BCt9jtFxDxzXqVT3nLRljJ C5SiOAGhnCFXY7w5TxJvpYbDU71V7wy+cOHnkyiQIzt0wjwWifWqL1pJFqJqz0SO+Ec/ fMdg== 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=d8Pt+K9hSyxUUyM4OEFuP2st/p1SrXJ6zf0ZGhCijCw=; b=JcL5gjmYrAV5UKjPXDyma/4wRhrqyh+aO9q8BGtxNScRotDvgl4SWTmZPZpEAd4ilb +dPazlZ2xDrrkJnz+ndk1yPuPrHhZI6GCmUOesEt6HRF20mga99EOmX6mNZwvXmeMgdJ rtvJ3Xh2quUeJxQvPCfRRLviJPY26teheE1GlniBWQRYwxbcrUautwxPjpsmoZZEuZQt nnYpcTDCOuHefL3kO06RwXzEkW6YpNeLGCoJcyqqxeoLwqe9e+9f/Mqg5zrT0qn/UNBD A4fbKZyXgNf129tZPnyQagLIYOdIkhi5XBoVqtOtEucGtsKwbwCCh8CdM5EOFLqx7nhA pBrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h/bT+Bjz"; 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 ot6si12074034ejb.337.2021.03.15.11.17.25; Mon, 15 Mar 2021 11:17:48 -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="h/bT+Bjz"; 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 S236744AbhCOOPP (ORCPT + 99 others); Mon, 15 Mar 2021 10:15:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:36788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232513AbhCON7A (ORCPT ); Mon, 15 Mar 2021 09:59:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1AF1161477; Mon, 15 Mar 2021 13:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816723; bh=RyHO8vk/auTufqgBgtIrhPcvbNBy1A4A84KX4ZInkWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/bT+BjzqxBMBnOyb7LjJ2HqonWRSQdUASaSeyWlSvkfJC/wTAIYydgMPc1y0Pupr UFzzfLmmtlrQNYsqDTJsyxKUeE5Cx5DNASBDz5vazAow0gpPvOu/N49zAvhxaI7RIw Zhk8T0VhtaUY/uPLAeL9NU+6z2X8kO/gdz+hMku0= 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 4.19 028/120] net: qrtr: fix error return code of qrtr_sendmsg() Date: Mon, 15 Mar 2021 14:56:19 +0100 Message-Id: <20210315135720.914230813@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -797,8 +797,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);