Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2084368pxb; Mon, 12 Apr 2021 14:01:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSBtgj9UTobHZdIwJY2ygGX1aXJ5dhKoYMunDcU0Dm+GhXtDgfYAbR0fVpq55G7rBtwrSL X-Received: by 2002:a05:6402:518b:: with SMTP id q11mr30804127edd.151.1618261310370; Mon, 12 Apr 2021 14:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618261310; cv=none; d=google.com; s=arc-20160816; b=L5oLdA5f0i+1n8QdRttTWNRHBmX41CUAAli+EgIYBG5Fi0Nt0kRX7Vp9FTVsad+EwV dnlpfJsaHSI9TxYKzwf7VgV1vPCioybJR/B06Rh2X6IV5CQZakJIrVCfnoAo2X1G+uMq t5GnXpRKlUnrrFXgZ9pupGtnfVBu3QZmINKa+qP0zXPvICZhvZei6JK6BC+XZEDGVJtK pq8Z801pnOGvCcpk/M6V7bWY09ZuMMaWHA7Gik6MR7ORtvJD+VnLCmitxRuOg9TZVY43 /kpnlSiw1jvyj6pf5GKeSHwAhtqBS5EGlZW6vQth7GCJqy8kFHYiE3mUWnh+h0UK9tLx dLDQ== 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=ixlfL8YVGhcAmnukva3gezdRNZI8htDRCQjC/llnTkQ=; b=D184pxJwEHepV7g1lN4JmnsfyR7m6IxCAha96ue049mBaffll9mExnVWxVA9TdpJtg WIf0OUiC1cf50TUoIbKSk5kx2yGcC81EmeaM6eADV25QIP3v4QFGhdl55yx+UrEXQuaN xqWPO9VMLnRCbPCp+M2+qUF2ZgIpkeHey234Iv8SYTZaTWUq1aU8h98UcsSOw9DUSW3T UcXeOotpMgkIF5A9OaEhUXNVGE2o8dVK0615HfxqTt120Rr44JqEMA/TZDPM9pD6/hIJ Nsj0GxnpNR644ckDDGi0Etc4TSqrWpoZAl2eJU+Cc9g6+q7fMaDwKf4upxzWiwNl7Jdk 552Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JF7a68Jk; 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 l21si8455429edw.87.2021.04.12.14.01.27; Mon, 12 Apr 2021 14:01:50 -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=JF7a68Jk; 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 S239007AbhDLJCS (ORCPT + 99 others); Mon, 12 Apr 2021 05:02:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:45430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238519AbhDLIyL (ORCPT ); Mon, 12 Apr 2021 04:54:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3D866128B; Mon, 12 Apr 2021 08:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217532; bh=NUCp2B5pIVySg9jN5eNWEDvzzGBpF57qj5JKxu0WJpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JF7a68JkpLQIjVbne1ouy6bAPq7VR3cDxSrO9iBoMTOVPMzwLGLKOqQE8E1RZXxmf EZqgXzvHH7y/pvNGuMHFqHVxhszONKZ8GwerQUj6P3s/wYmIG6oeQd1B3MbmOKI273 VhY8ljzaslGAdTgfMIYonfoTGmWBIikmqMEH/Hx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ciara Loftus , Alexei Starovoitov , Magnus Karlsson Subject: [PATCH 5.10 048/188] libbpf: Ensure umem pointer is non-NULL before dereferencing Date: Mon, 12 Apr 2021 10:39:22 +0200 Message-Id: <20210412084015.237539884@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@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: Ciara Loftus commit df662016310aa4475d7986fd726af45c8fe4f362 upstream. Calls to xsk_socket__create dereference the umem to access the fill_save and comp_save pointers. Make sure the umem is non-NULL before doing this. Fixes: 2f6324a3937f ("libbpf: Support shared umems between queues and devices") Signed-off-by: Ciara Loftus Signed-off-by: Alexei Starovoitov Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20210331061218.1647-2-ciara.loftus@intel.com Signed-off-by: Greg Kroah-Hartman --- tools/lib/bpf/xsk.c | 3 +++ 1 file changed, 3 insertions(+) --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -870,6 +870,9 @@ int xsk_socket__create(struct xsk_socket struct xsk_ring_cons *rx, struct xsk_ring_prod *tx, const struct xsk_socket_config *usr_config) { + if (!umem) + return -EFAULT; + return xsk_socket__create_shared(xsk_ptr, ifname, queue_id, umem, rx, tx, umem->fill_save, umem->comp_save, usr_config);