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=-15.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 4439CC56202 for ; Mon, 23 Nov 2020 16:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1C9620756 for ; Mon, 23 Nov 2020 16:38:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="IWpb9+t2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390135AbgKWQhm (ORCPT ); Mon, 23 Nov 2020 11:37:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390138AbgKWQhk (ORCPT ); Mon, 23 Nov 2020 11:37:40 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A195C061A4F for ; Mon, 23 Nov 2020 08:37:38 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id p6so6727906plr.7 for ; Mon, 23 Nov 2020 08:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=NPDzcaiioinbI0xutHnN4ITCAksvO7VM/A7YfnKL3t8=; b=IWpb9+t2hLMs3fQI31fe2Fh2XpE6OdjGahRcNeGWK1DgJW8519oFS2F3XMpFF8Ss+b n4hivcJix+7wt7lMfwfQRU23sddw6DmCK5J0ywMiEdvF/tUD+iWYsHWGJeqJRTKoVrUe yRBKbdZLCvj55JXALrX8zd66EdyXLdcFn1h6WGpy+dveqIni2Sk4VAjm6X33y9oV5axh elmG5Ek7a1hP5S/5Bh/aSH7q7z02o/6gKmT3pQWou8EznyZYsQnL/mcFl4TvS5rGsGyp TvEEpVSzA3wp7AyKGqB7bLn2fYjX+q20+hDTOcAM23jti1baTGOqOQ4N7/wrpAyHiE/p pqCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=NPDzcaiioinbI0xutHnN4ITCAksvO7VM/A7YfnKL3t8=; b=MLx1U/GT1uCrlTeJ1Udpa/cs/XN9LS3N80dG4k9qxFV5V21RYhIJijgJzltqbtXhO4 ENFeMSsXLnn8+c0oJInmLqG5cKbDpBm5OHfTHzsLz6+J+vfmjX8P7H3bFyGcGTLZMukS 2W/6h/Ym0s8Zrps9ZXlpq9izAfs2RhfEbgMyYKzFxrXMkbwYCorhA12M+WxeamC1HMSO /U6K0JuQOE9nIb35wITxdUnqmbRA3rKLgJEf/ZseZpHozjDTwAAaZtfI3Yc3V0dxmTnR RJ3Y47DcqoJNy7RMrwNBJJFbbgAXNHAPepjQPYzZ5kMvNLBfLF++0EReHJvrx5/xsbkV zClw== X-Gm-Message-State: AOAM530KmB0keMdjN0eQ3xjBCfJkNYIRCjTyt2hBKpQCXQMDlhRirvhX yfD+Vn1X5wvuYpgh2jbfy1salg== X-Google-Smtp-Source: ABdhPJx3ImtYlkkbvp/jmFrOIcNG+vTvqV/MgveRUGMO+vUIm16Ij5kjths7BenX7cWWt8ifPFF1QA== X-Received: by 2002:a17:902:bc8c:b029:d8:efb7:ae74 with SMTP id bb12-20020a170902bc8cb02900d8efb7ae74mr306721plb.10.1606149457725; Mon, 23 Nov 2020 08:37:37 -0800 (PST) Received: from [192.168.1.134] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id u6sm5647015pjn.56.2020.11.23.08.37.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Nov 2020 08:37:36 -0800 (PST) Subject: Re: inconsistent lock state in io_file_data_ref_zero To: syzbot , davem@davemloft.net, io-uring@vger.kernel.org, johannes.berg@intel.com, johannes@sipsolutions.net, kuba@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk References: <000000000000f3332805b4c330c3@google.com> From: Jens Axboe Message-ID: <948d2d3b-5f36-034d-28e6-7490343a5b59@kernel.dk> Date: Mon, 23 Nov 2020 09:37:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <000000000000f3332805b4c330c3@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On 11/23/20 2:55 AM, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit: 27bba9c5 Merge tag 'scsi-fixes' of git://git.kernel.org/pu.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=11041f1e500000 > kernel config: https://syzkaller.appspot.com/x/.config?x=330f3436df12fd44 > dashboard link: https://syzkaller.appspot.com/bug?extid=1f4ba1e5520762c523c6 > compiler: gcc (GCC) 10.1.0-syz 20200507 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17d9b775500000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=157e4f75500000 > > The issue was bisected to: > > commit dcd479e10a0510522a5d88b29b8f79ea3467d501 > Author: Johannes Berg > Date: Fri Oct 9 12:17:11 2020 +0000 > > mac80211: always wind down STA state Not sure what is going on with the syzbot bisects recently, they are way off into the weeds... Anyway, I think the below should fix it. diff --git a/fs/io_uring.c b/fs/io_uring.c index 489ec7272b3e..0f2abbff7eec 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7194,9 +7181,9 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) if (!data) return -ENXIO; - spin_lock(&data->lock); + spin_lock_bh(&data->lock); ref_node = data->node; - spin_unlock(&data->lock); + spin_unlock_bh(&data->lock); if (ref_node) percpu_ref_kill(&ref_node->refs); @@ -7578,7 +7565,7 @@ static void io_file_data_ref_zero(struct percpu_ref *ref) data = ref_node->file_data; ctx = data->ctx; - spin_lock(&data->lock); + spin_lock_bh(&data->lock); ref_node->done = true; while (!list_empty(&data->ref_list)) { @@ -7590,7 +7577,7 @@ static void io_file_data_ref_zero(struct percpu_ref *ref) list_del(&ref_node->node); first_add |= llist_add(&ref_node->llist, &ctx->file_put_llist); } - spin_unlock(&data->lock); + spin_unlock_bh(&data->lock); if (percpu_ref_is_dying(&data->refs)) delay = 0; @@ -7713,9 +7700,9 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, } file_data->node = ref_node; - spin_lock(&file_data->lock); + spin_lock_bh(&file_data->lock); list_add_tail(&ref_node->node, &file_data->ref_list); - spin_unlock(&file_data->lock); + spin_unlock_bh(&file_data->lock); percpu_ref_get(&file_data->refs); return ret; out_fput: @@ -7872,10 +7859,10 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, if (needs_switch) { percpu_ref_kill(&data->node->refs); - spin_lock(&data->lock); + spin_lock_bh(&data->lock); list_add_tail(&ref_node->node, &data->ref_list); data->node = ref_node; - spin_unlock(&data->lock); + spin_unlock_bh(&data->lock); percpu_ref_get(&ctx->file_data->refs); } else destroy_fixed_file_ref_node(ref_node); -- Jens Axboe