Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3283603imm; Sun, 10 Jun 2018 12:36:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIWodaPds6o7f2yDR1/zG3mFRQMQkNRhkcOoX5LEVx26j+dGLoRFy7AzzXmsmw49FEze3U0 X-Received: by 2002:a17:902:2702:: with SMTP id c2-v6mr15245125plb.297.1528659391218; Sun, 10 Jun 2018 12:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528659391; cv=none; d=google.com; s=arc-20160816; b=jPzLBYM43x/tjAykNwqs9ws8LmJ/kUcM63UZ1IgaUTFlqPO89U3wPVATGCi9pPrS3H 1p4noq438FprAHYMLrcSBYK3OMh4NN3B0pcAebIn5wkrbhDRxQQVSWyunJ9BBAWRmnXa tFbz/XxaAe0mvIXnCz4ZOzLZ1qxF1lARBs0EfH4417FahjLp9Tb9BkAmvw7k9uyzmeoH i5n3ACJv9j8obDcaU1XDXm7y3pUKeT53MFJh62eXv+n0QFmbMX60HKnbZH8AcPuzx9pt pN3lfSxOPaQNuB7uPgc3HfC4kAo2GKRUAgKRpE/MLkOywYHTQZ3KzcUasbmaCbciuJ1c pFKQ== 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:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=TULCKtLVe283Vh5L8OMrSbKh0VbxiQ72g7/RapjVfwQ=; b=yg6AfP6fTnDEndF7KoXM4w/DkY4TJwcpM8NZHa5I56YH8SJH+viUiGuvOOvjOswh2z 2b172SUQDkBZ4bU71ZqmIxscdlZ2zoWHT5D4nAAMSpFvqmGLKfCsmcbDEgrp840qyJhU ECGAuCTYr7HSqafZ4IscTPyJS8HAVG+4SJ5uIZh+0lbq0G2t1vv9/i/HI/TX4AOorBcU D+Uw9xrMazTzbPqo6f5HFKJvPe34AzXsavvS2UGgl0ZE/i+iTclSW0XBFDIeZtPxxvJU 7tU+/SlfOJgIAWPhKsimeJs8eKKcgkkGBitK3CnhVU0epM+Dz7iYIK9IvXpjALV54zFz xKtg== 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 m8-v6si59476271plt.29.2018.06.10.12.36.15; Sun, 10 Jun 2018 12:36:31 -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 S1753723AbeFJTfy (ORCPT + 99 others); Sun, 10 Jun 2018 15:35:54 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:41470 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbeFJTfw (ORCPT ); Sun, 10 Jun 2018 15:35:52 -0400 Received: from localhost (74-93-104-98-Washington.hfc.comcastbusiness.net [74.93.104.98]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 04CE0136AA24D; Sun, 10 Jun 2018 12:35:51 -0700 (PDT) Date: Sun, 10 Jun 2018 12:35:51 -0700 (PDT) Message-Id: <20180610.123551.885190586229525170.davem@davemloft.net> To: Vadim.Lomovtsev@caviumnetworks.com Cc: rric@kernel.org, sgoutham@cavium.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dnelson@redhat.com, Vadim.Lomovtsev@cavium.com Subject: Re: [PATCH] net: thunderx: prevent concurrent data re-writing by nicvf_set_rx_mode From: David Miller In-Reply-To: <20180608092759.28059-1-Vadim.Lomovtsev@caviumnetworks.com> References: <20180608092759.28059-1-Vadim.Lomovtsev@caviumnetworks.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 10 Jun 2018 12:35:52 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vadim Lomovtsev Date: Fri, 8 Jun 2018 02:27:59 -0700 > + /* Save message data locally to prevent them from > + * being overwritten by next ndo_set_rx_mode call(). > + */ > + spin_lock(&nic->rx_mode_wq_lock); > + mode = vf_work->mode; > + mc = vf_work->mc; > + vf_work->mc = NULL; > + spin_unlock(&nic->rx_mode_wq_lock); At the moment you drop this lock, the memory behind 'mc' can be freed up by: > + spin_lock(&nic->rx_mode_wq_lock); > + kfree(nic->rx_mode_work.mc); And you'll crash when you dereference it above via __nicvf_set_rx_mode_task().