Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1412708imm; Thu, 5 Jul 2018 22:55:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdB2OZupGmBJs60TG4LjTkPZeDSzAYDwiA92K2BifjIVtoPw5m+rgPuE3kWOekbqDTseZhP X-Received: by 2002:a17:902:2c83:: with SMTP id n3-v6mr8913266plb.211.1530856516813; Thu, 05 Jul 2018 22:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856516; cv=none; d=google.com; s=arc-20160816; b=TZpEbmNLBiPf33BzV//4ACjLYfcZD5YO9Q0Tfic1hCHuNdZ9q9AqJbys8GuOW/SBMO ATHEVpGcOT1HsrbnSNy5JbJr4f2Qk343aLbhKnT2vjiQjEj84AJD9qyZobpeOycYHrpl 3m+iuWYkDqg3hJpWnD98gP15TqyDUB0sQGSm+o3epyg8a2v803r55xMvgGvsvRIhwg8K qpD4L8Jdq3wgJb1xW1ZSZ3A1p63KhocMylSorGjjXkm/QNeDa1rchihrV7eHXJMVPbH5 ex6nB1wNypsosv3Haikj9E4pcc6jsKQSfjZpVBBU7Z9afnV7Oy0jAeEvSeKA7HUNgXNB EDGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1/fvdgbQkk3beTOShlgEI+QT+TkPDHzCQ3CM1BylHy8=; b=lHOGLicTUX/VsZFO38a9uylW6OvCY8BfQuemir0Od81rp0JKguT3S94Z0yxtVF0qno 8L9GtoapFeBhvkewQjHU26DoP7qTEIMkQXjrhAsfdseGAnIE8UR95nszA/mmgu4E1Zjt +H5BxAQEisb6mPoGttbUPa0IURz8ohfQxnZULPWJutQ/l2hzG4nI9gBTHObdfMnxU8nK KQ3651fVqeM0iFKxFVyPKK3P5UJqMXbNzfXSVvCIVttTQ7I9cU0kEpHO5JUOEij1JE5s upNpPFUNIAOoANIszSetbvaNr/u3MPl3vHmQsOMtT2WvOSP9tD7cUNFfFLOSutLVtK5K aAbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23-v6si7347282pls.101.2018.07.05.22.55.02; Thu, 05 Jul 2018 22:55:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934511AbeGFFx6 (ORCPT + 99 others); Fri, 6 Jul 2018 01:53:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34048 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934722AbeGFFw6 (ORCPT ); Fri, 6 Jul 2018 01:52:58 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DD706BC1; Fri, 6 Jul 2018 05:52:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Daniel Borkmann , Alexander Shishkin , Namhyung Kim , Peter Zijlstra , netdev@vger.kernel.org, Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 55/61] perf bpf: Fix NULL return handling in bpf__prepare_load() Date: Fri, 6 Jul 2018 07:47:19 +0200 Message-Id: <20180706054714.441305625@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: YueHaibing [ Upstream commit ab4e32ff5aa797eaea551dbb67946e2fcb56cc7e ] bpf_object__open()/bpf_object__open_buffer can return error pointer or NULL, check the return values with IS_ERR_OR_NULL() in bpf__prepare_load and bpf__prepare_load_buffer Signed-off-by: YueHaibing Acked-by: Daniel Borkmann Cc: Alexander Shishkin Cc: Namhyung Kim Cc: Peter Zijlstra Cc: netdev@vger.kernel.org Link: https://lkml.kernel.org/n/tip-psf4xwc09n62al2cb9s33v9h@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/bpf-loader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c @@ -66,7 +66,7 @@ bpf__prepare_load_buffer(void *obj_buf, } obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, name); - if (IS_ERR(obj)) { + if (IS_ERR_OR_NULL(obj)) { pr_debug("bpf: failed to load buffer\n"); return ERR_PTR(-EINVAL); } @@ -102,14 +102,14 @@ struct bpf_object *bpf__prepare_load(con pr_debug("bpf: successfull builtin compilation\n"); obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, filename); - if (!IS_ERR(obj) && llvm_param.dump_obj) + if (!IS_ERR_OR_NULL(obj) && llvm_param.dump_obj) llvm__dump_obj(filename, obj_buf, obj_buf_sz); free(obj_buf); } else obj = bpf_object__open(filename); - if (IS_ERR(obj)) { + if (IS_ERR_OR_NULL(obj)) { pr_debug("bpf: failed to load %s\n", filename); return obj; }