Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1820169rwr; Fri, 5 May 2023 22:52:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HTOEM9GOeocD9TeXvzRJ9vNJPi0U0oySf0sm9aGYre8VyUAHq+cTQi02RW8wqNAevcLwu X-Received: by 2002:a05:6a20:100c:b0:f3:d577:9b4f with SMTP id gs12-20020a056a20100c00b000f3d5779b4fmr4024233pzc.36.1683352342980; Fri, 05 May 2023 22:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683352342; cv=none; d=google.com; s=arc-20160816; b=zMcf9bdhmH+oOjNv/6oPPZeHHMcrCUNUybh/1jrYuTuwfmUs28H6h1zzFcFRjpaSLX giXI6ba7kIhk9tL4wd3c6qXkjWrDiAUUyGI1rLGbIgyf1Xkk3NNMUmupzXDL3YyReLvT a8Gl/1J1bSrFKeusy2CiejxBZ8lkTCSJwCpiaZyxYHm+sBHCRe+jF0T6bM/Yhf6OHH2Q GTGUk2FYB+cg7yzoqzppzp5UsCbauuldF3U8EOyuCZu8yaQG0RTpmKfZN47qXw6VRzrJ YRklkSSnTcRYykgRj7ODRDsKArzfAGCnfXVozJvsvSrMATDmT64/tY4VylpANJoeFR52 pj7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=EbjwvM2OaBaohhU9JUjAJejyPZP9w5xqO4zcedVi68Q=; b=tkYWrz1+qp6+22u/zOJtnWU3Dk62KT07iOCev/7FAmlOWSJwxywA3xMzkdTFigvLsn R4+ewsCeuklXeZqpxZxHBEgKiV/Tg3Ztcwcw/gYyuLNA9Ld9kJePe0uVLK4UIPEVGbnm 9+hYpz0SljlY7mZdNWzHomFRNBJoZ9qgJ3pYFaDl5DAIKapV0nI04EjVGhUOP96XarkM oVzqViJFJT4ewrFK77dCoWEca0oUKbwque+RTtT11aAxKGtVkKicM5DeNgeJHjcM5x3k zU56NpgS6qDzE3Gau/Jq6AdNRwlJRp+zIy5GsxS52j4HeKOwJAkyK4wxpVYnee82IPMe 7Xcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EO5Un2rU; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p125-20020a622983000000b0063b7790fde1si3542624pfp.284.2023.05.05.22.52.13; Fri, 05 May 2023 22:52:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EO5Un2rU; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229845AbjEFFvJ (ORCPT + 60 others); Sat, 6 May 2023 01:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjEFFvG (ORCPT ); Sat, 6 May 2023 01:51:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 404F57DA5 for ; Fri, 5 May 2023 22:51:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1681608D3 for ; Sat, 6 May 2023 05:51:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C36DC433EF; Sat, 6 May 2023 05:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683352265; bh=cJNlq7s4/qMCZuG3GeMtE0cdpmLxxkHIwVlStqs9/+w=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=EO5Un2rUn02SD6ouy0+UQ2GFDcQmNhBaxbZ/RAg4XRgOw6B1kSVjHH70U6uXKaVrI z9GDJsy4nWPuQuZtA3ms+X1AUE8jvNGIVgCxWLl42sya4mFwYzC6srLnbT74D5b4UQ MKpl1Lo7/Fvqv++1Mwdv3ORGT8v8Imj79sIJQm54mbfibxyfEeL9YRXUneARO3Q9vb 5z5qLYDfaP2+assuh6k7n9Nkrd6BPcik7OYEbWmh2gTmqk3bPeLYqpdLrsdHdPzkSq 012q2aoj2+5X1lwZ3T90XIvcRhXaHfedoB6eq8woWXGjs3HzkfdHm++KcuBkEjN2j9 YaChhh+Jlk+kA== From: Kalle Valo To: Cc: , , , Subject: Re: [PATCH] wifi: wilc1000: fix kernel oops during interface down during background scan References: <20230404012010.15261-1-ajay.kathat@microchip.com> <87wn1mok5g.fsf@kernel.org> Date: Sat, 06 May 2023 08:50:58 +0300 In-Reply-To: (Ajay Kathat's message of "Fri, 5 May 2023 20:53:12 +0000") Message-ID: <87sfcanh31.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org writes: >>> @@ -781,13 +776,15 @@ static int wilc_mac_close(struct net_device *ndev) >>> if (vif->ndev) { >>> netif_stop_queue(vif->ndev); >>> >>> + if (wl->open_ifcs == 0) >>> + wl->close = 1; >>> + >> >> wl-close is an int, I wonder if it's racy to int as a flag like this? In >> cases like this I usually use set_bit() & co because those guarantee >> atomicity, though don't know if that's overkill. >> > > I think it's a good idea to use an atomic operation but I am not sure if > using atomic for 'wl->close' will have much impact. For instance, if any > new work gets added to the workqueue before the 'wl->close=1' is fully > completed, then that work would get executed as normal. Sure, this is most likely a small race condition. But still a race. > However, I feel it's safe to define 'wl->close' as atomic_t type. I will > prepare the conversion patch and will try to include it along with the > updated version of this patch. Why atomic_t? You only use values 0 and 1 so test_bit() and set_bit() sounds more approriate to me. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches