From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 251F0C282C0 for ; Wed, 23 Jan 2019 23:42:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2A7721019 for ; Wed, 23 Jan 2019 23:42:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D3MIxTxB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726300AbfAWXmp (ORCPT ); Wed, 23 Jan 2019 18:42:45 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33276 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfAWXmo (ORCPT ); Wed, 23 Jan 2019 18:42:44 -0500 Received: by mail-pf1-f195.google.com with SMTP id c123so2005015pfb.0 for ; Wed, 23 Jan 2019 15:42:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1qc+s90dPjyM6Wv8kv+4BVq62EibO4gTW61dcaAcmzk=; b=D3MIxTxBfXyFQbpZ2GNU/n0IrsMHby/dTr4TA58t8jaKoaeafl+KWEw8oEl5qV41vA foSeGlXvAWqRY1C8xForOchAd1TpmeTmOhaRU5iPbYx/VFPxNnl4wROc/n0fep007zy2 k0qGrsGHw3eUJ+wmp683zxz7XTK9yI7JErXa7v//6Qdn4MWQqjZ0LQg+jLJ+TKJC4/pA 9Ie+7NYA/AMiDmnzHJVQf5VkrYB+f5AXZhlx+t4/mgAEj+YM7iDA/n1wnMEK+ntpMfwP TN+L1tqcvp55GUaR25YmLmCeIuk2Qe0FbUFvMLkPmqB5VZgj83DDSRW6L66PU+Ik2+3s +p+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1qc+s90dPjyM6Wv8kv+4BVq62EibO4gTW61dcaAcmzk=; b=W4cowUV5C6+tldA85bB7SdG/C1TVu/lurWXcEbita+3qWflp4JJqMdw8BOMqlQIKF+ DXYkHel4XeHzz46qTmDWCraMc8wBHgOYJ6KRRzaAmZj8vrB44JTsXQI/jV/O8KrCWohV v+EBdceb9kFvya/eRaqn1jMss2iXLu4v7+IbLJh4/Acoxnku6lNcOQWmD7AMwAywUx7R fzh08EzR7e1yHiDnbJAtjEqBmWo4WrIEFmjhjNWopnsl2Mm75Xc82HNCVCwOUbKCrbNQ UUlx4iNyWj+tVHuQUWyRnDvvleZvoAE9HB4hNejvwFcxSvX6ivPCQC3zE0ctxAwI2K+v /49g== X-Gm-Message-State: AJcUukfzKC2r4/mb0njfI04yL1xY2YHVlUPHSicT0gcCG4vJCPaRM0gd 02OH+sSsl10c9Bk2HCbkBss= X-Google-Smtp-Source: ALg8bN6q2rcytHy26MiOOK1fqrzO3gAUg9cmqI/J3jHvrhHFC+X9o6/8LJUDD4i/qshqvgH3hcvt3A== X-Received: by 2002:a65:6392:: with SMTP id h18mr3886928pgv.107.1548286963780; Wed, 23 Jan 2019 15:42:43 -0800 (PST) Received: from ?IPv6:2620:15c:2c1:200:55c7:81e6:c7d8:94b? ([2620:15c:2c1:200:55c7:81e6:c7d8:94b]) by smtp.gmail.com with ESMTPSA id d3sm23249928pgl.64.2019.01.23.15.42.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 15:42:42 -0800 (PST) Subject: Re: [PATCH net] ax25: fix possible use-after-free To: Cong Wang , Eric Dumazet Cc: "David S . Miller" , netdev , Ralf Baechle , syzbot References: <20190122184059.220252-1-edumazet@google.com> From: Eric Dumazet Message-ID: <0dd7561b-533c-5054-816c-38fa8e9fae5f@gmail.com> Date: Wed, 23 Jan 2019 15:42:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 01/23/2019 03:25 PM, Cong Wang wrote: > On Tue, Jan 22, 2019 at 10:41 AM 'Eric Dumazet' via syzkaller > wrote: >> >> syzbot found that ax25 routes where not properly protected >> against concurrent use [1]. >> >> In this particular report the bug happened while >> copying ax25->digipeat. >> >> Fix this problem by making sure we call ax25_get_route() >> while ax25_route_lock is held, so that no modification >> could happen while using the route. > > ax25_route_lock_use() is a read lock, so two ax25_rt_autobind() > could still enter the same critical section? > Not sure I understand your concern. The two ax25_rt_autobind() would only read the route contents, so that should be fine ? > >> >> The current two ax25_get_route() callers do not sleep, >> so this change should be fine. >> >> Once we do that, ax25_get_route() no longer needs to >> grab a reference on the found route. > . > > After your patch, ax25_hold_route() has no callers while > ax25_put_route() still does. Is ->refcount always 1? Yes, the plan is to remove this refcount in net-next.