Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1680045pxu; Sun, 6 Dec 2020 03:50:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9Ny0YZQy5UfMuGBXU4inIUag42uCUFs9byRGWN3g8U9E70sTRjBtWrK4g+/2I7dvR6F02 X-Received: by 2002:a05:6402:1153:: with SMTP id g19mr15652123edw.312.1607255454651; Sun, 06 Dec 2020 03:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255454; cv=none; d=google.com; s=arc-20160816; b=NPzsjz9aWbm64THTaM+vKI+9HYmnbI+cxiFOpIHm57CjKLJAkzcm96EQv2jXNd9Wiw fKDQEZCs+8GKqroqB4pIKetjvwL7AM9N8UJKoMZVrKSUlLoxUZv7UpP3N0zFeCsEP17S /ZVrc6sl9D1Ki9oysyrBaLnNC9wWsCU/J2ZjwghAEWMOdnpKwnxTOuYwRjugoU2U0t4D isbt+1IkBSYx+8EUUNdH+QMI0zt/k/99EKEaA7QUeArl6/8Ub1boJUUrFBZJj/1+n6/B Q/AZ5zwOos0zeFG5kUj+rs3E87lq07a/UEzxctB896hn78b2ny+/4yK2B2mykAXDdTKD hILw== 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; bh=DiC2UvHSK0BoDB2+xCUzhD7NNbQz7xE1PwVEsNgQZnw=; b=gV1/mEWFmYCwB8Ep8eIjmkLjIvbSxMlT8I+9LV8ZZxQknG3eA+JQf5KH4ZCzlbN9eu BctF98QZgkC5fNw1fjWR9otYMU6NGnmchPRBRa7dXuP9cPMHW0JRpjP7ihUHLBuZxdoL 9TprZrandLbpey29lHxKtTXaCOHVpCXjMNga6qAwyMttKvUHm0gwtBuwQug5eupO1xrf qsK/8a1fw/yaftdm7I9TLyPLoG+TmFI/r0ObhDkhz1y/n3T1dE4uORSP0SsbufB/iAjy 0NmzqRZKWssU53oi3LdSxajWymmLLlpwovoCZzX4OsE9TrLrOmXRj9K+J6OcEpwaf1Tr 7phQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 j15si6031364edk.470.2020.12.06.03.50.32; Sun, 06 Dec 2020 03:50:54 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729150AbgLFLnZ (ORCPT + 99 others); Sun, 6 Dec 2020 06:43:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:42670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729127AbgLFLnV (ORCPT ); Sun, 6 Dec 2020 06:43:21 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ayush Ranjan , Willem de Bruijn , Soheil Hassas Yeganeh , Jakub Kicinski Subject: [PATCH 5.4 07/39] sock: set sk_err to ee_errno on dequeue from errq Date: Sun, 6 Dec 2020 12:17:11 +0100 Message-Id: <20201206111555.025782473@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111554.677764505@linuxfoundation.org> References: <20201206111554.677764505@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: Willem de Bruijn [ Upstream commit 985f7337421a811cb354ca93882f943c8335a6f5 ] When setting sk_err, set it to ee_errno, not ee_origin. Commit f5f99309fa74 ("sock: do not set sk_err in sock_dequeue_err_skb") disabled updating sk_err on errq dequeue, which is correct for most error types (origins): - sk->sk_err = err; Commit 38b257938ac6 ("sock: reset sk_err when the error queue is empty") reenabled the behavior for IMCP origins, which do require it: + if (icmp_next) + sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin; But read from ee_errno. Fixes: 38b257938ac6 ("sock: reset sk_err when the error queue is empty") Reported-by: Ayush Ranjan Signed-off-by: Willem de Bruijn Acked-by: Soheil Hassas Yeganeh Link: https://lore.kernel.org/r/20201126151220.2819322-1-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4452,7 +4452,7 @@ struct sk_buff *sock_dequeue_err_skb(str if (skb && (skb_next = skb_peek(q))) { icmp_next = is_icmp_err_skb(skb_next); if (icmp_next) - sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin; + sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_errno; } spin_unlock_irqrestore(&q->lock, flags);