Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp879388ybi; Fri, 12 Jul 2019 06:09:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQ4fTZuLNKzmCcg4YdbFDqPO7EZTXNin8A3Ky8U0T3AkLxVL4NpWfegPu1FJwKsH4+UFXi X-Received: by 2002:a63:4006:: with SMTP id n6mr10180606pga.403.1562936941103; Fri, 12 Jul 2019 06:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562936941; cv=none; d=google.com; s=arc-20160816; b=M1hElGEMRXG/MujnMt8Dfz327Y0OUPrAl3AEi2eDjmOtvAdcd0klxLKpHbSedjc8R7 lDENiu9wPvwqk2ZNCorMJLp9rx6Wyo0Kw6Jrzr4ph1ZsQCYPowB6zBCQv3VQw/SGoC2r q/F1yiv4blt2drnz5hf79Uhn+RPjnJ7FUHSNrBGeTVjdDvgxBPR6H/owgFIzgQB60uRN gya4BiPSpELoq7iuNcRMF6kua14Y7ZFsl+WLTuAwccHqf/1YBFw2gpjY4W3Q2VyBKFxE R/phs+00OaHnjuuYVd+/VvYGgMQECsJLAJqw6PVBylh0mtdoK5noppr0GPu15PgRp7SC Fp6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=aShe8D6ZC7BcJguUZ6Ov0/ScFNTqsaD60KwFZZKIopM=; b=joYokNNWZUFDlv+0/LFkv68Dv36ldVMbB3SonVEHObavlrYDgkAYWZPoLMkztgNPzE IkrPS7aUAnbbQRzfGvRL+sUbvTOafvKIWgc/svrrzv7rWxx2fnFXes6OzLkXMXVoAtgx Nayc/97rPDz4E5v310aTIQ/w04rRBJxyZ+cg+4eS6dOehEnzaU6EqpD+dlxU+JnXJJw2 4UHOU3+zc883NfR7sFZSZgRPytywp7XUkUzb41GBn4fOzAJT9o0IX/u770DYX2k8aDq4 8sMdR0Q2splf7E41m5EqCXsDLNNRoUC1fRLUONKE7DrWobPZ2xm4tdX9B66QvdthVQfb EQ/Q== 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 h125si8655506pfb.176.2019.07.12.06.08.46; Fri, 12 Jul 2019 06:09:01 -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 S1727691AbfGLNH4 (ORCPT + 99 others); Fri, 12 Jul 2019 09:07:56 -0400 Received: from www62.your-server.de ([213.133.104.62]:50806 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727414AbfGLNHy (ORCPT ); Fri, 12 Jul 2019 09:07:54 -0400 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1hlvHE-0005gq-0r; Fri, 12 Jul 2019 15:07:52 +0200 Received: from [2a02:1205:5069:fce0:c5f9:cd68:79d4:446d] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1hlvHD-000AsF-Om; Fri, 12 Jul 2019 15:07:51 +0200 Subject: Re: [PATCH bpf] xdp: fix potential deadlock on socket mutex To: Ilya Maximets , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, xdp-newbies@vger.kernel.org, "David S. Miller" , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Jakub Kicinski , Alexei Starovoitov References: <20190708110344.23278-1-i.maximets@samsung.com> From: Daniel Borkmann Message-ID: <93462d9f-dc37-fa5a-ae28-d5cad5aa2060@iogearbox.net> Date: Fri, 12 Jul 2019 15:07:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20190708110344.23278-1-i.maximets@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.3/25508/Fri Jul 12 10:10:04 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/08/2019 01:03 PM, Ilya Maximets wrote: > There are 2 call chains: > > a) xsk_bind --> xdp_umem_assign_dev > b) unregister_netdevice_queue --> xsk_notifier > > with the following locking order: > > a) xs->mutex --> rtnl_lock > b) rtnl_lock --> xdp.lock --> xs->mutex > > Different order of taking 'xs->mutex' and 'rtnl_lock' could produce a > deadlock here. Fix that by moving the 'rtnl_lock' before 'xs->lock' in > the bind call chain (a). > > Reported-by: syzbot+bf64ec93de836d7f4c2c@syzkaller.appspotmail.com > Fixes: 455302d1c9ae ("xdp: fix hang while unregistering device bound to xdp socket") > Signed-off-by: Ilya Maximets Applied, thanks!