Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1676438pxu; Sun, 6 Dec 2020 03:42:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpPG1hYQNnEdQKjxd9k5eL7Jlbv41Ncze0iKgxMWeuFI6eyWZf2I9e/g6BIuYCNU1ELoVi X-Received: by 2002:a05:6402:687:: with SMTP id f7mr5228064edy.314.1607254951552; Sun, 06 Dec 2020 03:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607254951; cv=none; d=google.com; s=arc-20160816; b=oKEYhznJinqNwMLvNDxlHlHEIpZcx1xVOckbEr06vazCyfw40ck/ABPmmnRKf1p3Pj AmUqqdlsCHF04csHipcvFUuT2nUdBvC7JPJU7UBmMAZJK1cFNN3RJG3ciFIzyXK7h/xR VwTrAIRecGqEppflywlsbEL6yz421ClYJbmIQOb5g1HTXH1PRyh6VkqTYvjaaylkb+Gi yGebB908WFk/ri1Kq50/wLX1bpG4cijAkPmMRmPIr1PD19L+Utetb4hUrI7KplBQxBmh JxypZ73rzpfvSYP9XMVGUrAPEW464McXdtEn3vKGZLP5sVBM9lkrTvaM02l19QPfKmil dRKA== 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=s2koyQtBJIFsC8tyOCmPV9ffox8b0x0t848rK2VBhoU=; b=U79TNgeM2lCMJzMGs1mIh187mZ8izhBMS7iMmCllSIJMxA2I2vB4dKYvqXT6DXQvEV 5hI80S8zrZrk3lUJd+F+M3PFL6tGPav2snoApFp88GJNvR/Fpi+aRlH1wCYlMqMGsg83 Of4FHmuOapdwZt9gnVKMKyBjaI24dRkEXTBuZgB53COWclcjJpPnQKsQCuIFnCs2tiXC VJPBauLN/dJE0yYIaJ/4b65WAe+AxDFsLsiwiu3WIjfNI0Vm+YT7NeWPQFF1BDhsvK3M R1C7QlIvDMe3W1ujAg8hI7wCKwLOEsKZRKgSpIDNPOfHF5v5OgC+qXphw7oWY2UI+LnD qZ8w== 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 w17si442483edv.64.2020.12.06.03.42.09; Sun, 06 Dec 2020 03:42:31 -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 S1727702AbgLFLif (ORCPT + 99 others); Sun, 6 Dec 2020 06:38:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:35444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726746AbgLFLif (ORCPT ); Sun, 6 Dec 2020 06:38:35 -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 4.14 03/20] sock: set sk_err to ee_errno on dequeue from errq Date: Sun, 6 Dec 2020 12:17:06 +0100 Message-Id: <20201206111555.726079130@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111555.569713359@linuxfoundation.org> References: <20201206111555.569713359@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 @@ -4239,7 +4239,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);