Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp445135pxb; Thu, 9 Sep 2021 04:45:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGbH2Sh99mQgA1jdmBUEe28ECZU7THYEz+d7wZmQLkX9eTD+c5toKnNGDonft0zUtCl6Eq X-Received: by 2002:a05:6e02:1d9c:: with SMTP id h28mr1972563ila.266.1631187958665; Thu, 09 Sep 2021 04:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631187958; cv=none; d=google.com; s=arc-20160816; b=yv7cWRsQmM5sUTgyYmuNppN0UMIdKq0UcRjiD6I0llInz8Q6k/MSSko3ds1MQYkSC/ NoTqA673S/vg0y37DCtlKsh5Z4FuAFGinOwcQSZCYC4bhGBF/CG8kYVDiFPz5PemiQV7 HwoOLlJSKuHfNMpA0X9t0Hr9Nu3spPzMDcQc3Bmj1Lzl6ZSxFOi8aFlNRBrA46OHzVNL Z/Qk9uo9AzwBm5ng+okhIPeVcezWePa8QWcCKKSRcIngsOAjWhW6yfr0Fsucn3Q0vDPX pnTITSf54YrjYeV3j8Du8wZtUBYuKR76I0Vo19E1eekVXht5k2Y188cg3GnBkyDoDLxh D8qg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZFVsOxAhDMI4vp3kbvd8/GOMFgDz5dqz2C/K3zebEnY=; b=Zv7GFd1ed9NdAuE65VIaO0s+mv6DeXZKA3CtCswQlkI7JI95TWyTTKSihLVSIoT92g MiqtOdeWHpFzxoZUiM2Ela/b2ukFljP1Fm4Y//w46nPxOnlxg61DEo3cf6yEFAaZTQam Lyv+GEcxYQ6loCZjvI+wYJl233RBYpGDyGy2XaDy7AyTmnwMi5uFNaJza++igq72q62/ PP444BuF4yIQKjeIsf24ePlXG53RrOheN+LB6n4YHgt9eVVDL+hF/KBqglDNEVgvt1Vo 7H+2ieFTj274tGFTCjGh4IXOkCqKfxdHrFefShQGt5Ea0+bHLbtFOL1DbbvPz284RQhZ ngKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q50aCEWh; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si1705900iln.136.2021.09.09.04.45.45; Thu, 09 Sep 2021 04:45:58 -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=@kernel.org header.s=k20201202 header.b=Q50aCEWh; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239311AbhIILoL (ORCPT + 99 others); Thu, 9 Sep 2021 07:44:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:46600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237282AbhIILmz (ORCPT ); Thu, 9 Sep 2021 07:42:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3559861186; Thu, 9 Sep 2021 11:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187706; bh=JZ9MTYb74+DaVR3kO13l/TOFbMF1Vw4Aj+rV2emckYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q50aCEWhJC1s/nzyNm8pIHKo+Zqp8c2ut4SeiUfGCCnJLJHLU5pgb0NSX1Q554JH6 JG7V9XBdJg4RJv3NWqWZ9hPEbwLU4+7bSOKxv2poR00tWeLSBwx6Vb7SqGfpHP6XC+ coYphUgJtVy7aXOZ5+ZTJ4tbJp6iOs03sjDBd37CNoIdyBeG9IiLEYJg3oQGIhvGes G+MxIJcTgwYu1bvSzu4YRORDbi7WbdGcJMoldsT2g1a2+8xtdwZAxyy9YqciBc+RO+ 6sYW+84/qFwPPJApzAoQphixZj/MWddVA5bFJZOzN50IiNFcTlpVN2c9CWLLatJ851 Iag/pPQ9c3Luw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yajun Deng , Yonghong Song , Jakub Kicinski , Sasha Levin , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 030/252] netlink: Deal with ESRCH error in nlmsg_notify() Date: Thu, 9 Sep 2021 07:37:24 -0400 Message-Id: <20210909114106.141462-30-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yajun Deng [ Upstream commit fef773fc8110d8124c73a5e6610f89e52814637d ] Yonghong Song report: The bpf selftest tc_bpf failed with latest bpf-next. The following is the command to run and the result: $ ./test_progs -n 132 [ 40.947571] bpf_testmod: loading out-of-tree module taints kernel. test_tc_bpf:PASS:test_tc_bpf__open_and_load 0 nsec test_tc_bpf:PASS:bpf_tc_hook_create(BPF_TC_INGRESS) 0 nsec test_tc_bpf:PASS:bpf_tc_hook_create invalid hook.attach_point 0 nsec test_tc_bpf_basic:PASS:bpf_obj_get_info_by_fd 0 nsec test_tc_bpf_basic:PASS:bpf_tc_attach 0 nsec test_tc_bpf_basic:PASS:handle set 0 nsec test_tc_bpf_basic:PASS:priority set 0 nsec test_tc_bpf_basic:PASS:prog_id set 0 nsec test_tc_bpf_basic:PASS:bpf_tc_attach replace mode 0 nsec test_tc_bpf_basic:PASS:bpf_tc_query 0 nsec test_tc_bpf_basic:PASS:handle set 0 nsec test_tc_bpf_basic:PASS:priority set 0 nsec test_tc_bpf_basic:PASS:prog_id set 0 nsec libbpf: Kernel error message: Failed to send filter delete notification test_tc_bpf_basic:FAIL:bpf_tc_detach unexpected error: -3 (errno 3) test_tc_bpf:FAIL:test_tc_internal ingress unexpected error: -3 (errno 3) The failure seems due to the commit cfdf0d9ae75b ("rtnetlink: use nlmsg_notify() in rtnetlink_send()") Deal with ESRCH error in nlmsg_notify() even the report variable is zero. Reported-by: Yonghong Song Signed-off-by: Yajun Deng Link: https://lore.kernel.org/r/20210719051816.11762-1-yajun.deng@linux.dev Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/netlink/af_netlink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 380f95aacdec..24b7cf447bc5 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2545,13 +2545,15 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, /* errors reported via destination sk->sk_err, but propagate * delivery errors if NETLINK_BROADCAST_ERROR flag is set */ err = nlmsg_multicast(sk, skb, exclude_portid, group, flags); + if (err == -ESRCH) + err = 0; } if (report) { int err2; err2 = nlmsg_unicast(sk, skb, portid); - if (!err || err == -ESRCH) + if (!err) err = err2; } -- 2.30.2