Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2110141ioo; Mon, 23 May 2022 10:15:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0SasxhqMvT6yeEMo3rANLyDUz46GKW0Q/0/WNPTZWnPtTUn11HqVQoNHnTq21BDPj0mZk X-Received: by 2002:aa7:8081:0:b0:518:26c4:ea42 with SMTP id v1-20020aa78081000000b0051826c4ea42mr18217969pff.7.1653326142037; Mon, 23 May 2022 10:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326142; cv=none; d=google.com; s=arc-20160816; b=Konzw6W5cOjIDw+rfmdOImL3hAyEgGGzJtJ1t08AcNz+kg2gQZL/7WTL38wC2R9p2i x+YwVFhx1gT88j2ZoOteUudLrqTRaCrGD1KpMKm2o2RHeLc+c+oQu2ow3otNvfBpyZ4e fMghkKUxhO3AaTtdHqvl4MPH2PHeKWdXzBGlTFRTPmVlh7TdNAuvw81kdAgHgqqQI542 +X0+OfouzBVRBsDXS2ydcM1bIN3dGBHkkzOnl2lDPN4rHTj5n8Dji//NrJgRF8XCzOLy /Rm6CXBQnozeHvvXXHfc4S1CY9NI4CFJfNyVVT2tkMy4/d7tbs2pD+ftn0sX1ahiPzAi LrpQ== 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=S86Tb2LsOUPTHz7gUxCv5NTtNaYeLhGoIyYv5VzZAJM=; b=C8wsoDyLOex2ON0mb8/h4PYiiJqV3YhUN2NPzNxrmVZefKhY4iJdNgc2s9+qoKclAP zPFd/4B92NBNj+7xfHgmJ7km0Zyd7zSqXVXJo7EhJhwbak84On4ePuTVpudEPldKjcKD uj0hmN5+p1E1NpyyRiHkcX0POey9FywBaaZVAAqmKMDfR2f0gLnHBBUXjdhvQLpoUzqI rF5L0GI699JIWdmgpR0Zw+ch1XtlhJtnEP1Lrj6Mn4dQn/gEFVMeaKJ8CRpedk+G0cfy VeMjnDLOrAqDSFElGuzELgh1LFcj65+06sso2zD6TcUlMmhMi4uLBh+g71o1UHc73/w/ F4ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=biVQD0YK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l1-20020a170903244100b00153b2d16560si11356418pls.360.2022.05.23.10.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:15:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=biVQD0YK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 370626C0CB; Mon, 23 May 2022 10:15:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239691AbiEWROZ (ORCPT + 99 others); Mon, 23 May 2022 13:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240306AbiEWRL4 (ORCPT ); Mon, 23 May 2022 13:11:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4745A1D0E9; Mon, 23 May 2022 10:11:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA043614F8; Mon, 23 May 2022 17:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADFEEC385A9; Mon, 23 May 2022 17:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325848; bh=ji1Im4iMP1zrb13n0zdNsFPRXFoeXoozTfdnd8YO1CM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biVQD0YKTm0UN0bv+cScO0tLl1KpTCwOg2FfoOqhmQl06dxvDCYe5J1zKTnLG3v/d im0YIi/FnyOp+k24PohJPz14NEEP4XYH64EItjuE3fypNDMU1LsdjhOFxwh5aHpt9y ifLtOa+LUnHEvPn2vcgthTujQpqoTZRrUfoer4ME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Steffen Klassert , Sasha Levin Subject: [PATCH 4.19 29/44] net: af_key: add check for pfkey_broadcast in function pfkey_process Date: Mon, 23 May 2022 19:05:13 +0200 Message-Id: <20220523165758.423249443@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165752.797318097@linuxfoundation.org> References: <20220523165752.797318097@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiasheng Jiang [ Upstream commit 4dc2a5a8f6754492180741facf2a8787f2c415d7 ] If skb_clone() returns null pointer, pfkey_broadcast() will return error. Therefore, it should be better to check the return value of pfkey_broadcast() and return error if fails. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jiasheng Jiang Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/key/af_key.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/key/af_key.c b/net/key/af_key.c index a416c0f90056..170960ef7e36 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -2836,8 +2836,10 @@ static int pfkey_process(struct sock *sk, struct sk_buff *skb, const struct sadb void *ext_hdrs[SADB_EXT_MAX]; int err; - pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL, - BROADCAST_PROMISC_ONLY, NULL, sock_net(sk)); + err = pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL, + BROADCAST_PROMISC_ONLY, NULL, sock_net(sk)); + if (err) + return err; memset(ext_hdrs, 0, sizeof(ext_hdrs)); err = parse_exthdrs(skb, hdr, ext_hdrs); -- 2.35.1