Received: by 10.192.165.148 with SMTP id m20csp3820956imm; Mon, 7 May 2018 20:43:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpuRGcNdSTTgbOp7VnsCvDPD3WoDDNbaAuZd4JsLv7k/AJ5j9V7sPMHYNW3lskofHs0zbDo X-Received: by 2002:a63:90c4:: with SMTP id a187-v6mr31222606pge.189.1525750988659; Mon, 07 May 2018 20:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525750988; cv=none; d=google.com; s=arc-20160816; b=VwDbXC8L4p2kVZTIggoco8ofJeNKiiXrFajD+cymEH/cRFBl4LqP0G5C5q2zvRLAa7 vrKBmulLB4cGxsb8+p2TTysn7WJjdBhSGSYmtKDR0gKJO0RMgXBSVwI2d50/3TSsiYCb xpmcyC3DmjYLT98TQXCa2sPwgOfT+HaUgxLod7NumCJasjhVDJEkYlbiW6cOo/WY9Tul jJoXAjUTTbjdftV9kwKmxLsrHSAfsCvhP7O7bOdX/QnL8jCfwAViCnKnCh59VTTgoNw7 ie4YcRSwD3aYjUP79ZFctexGtLubRYzbnTPfLf73YuAJESdQVt7yuvd5VT+tumCuF8xB AP5A== 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:dkim-signature :arc-authentication-results; bh=Mw3D/Zmx3HzW0T7pxEsmTOTQB2xbpBQ1BudYrcRmed8=; b=JsrPXEWxl7l7btNvAI67vyv+k1ww1LHeswN1UAH6SVK5A2586H/jwpdDIlxp8ecGqy 625XLJe1wlGhL1lco1JNdrf8rdepRHsQxW8Y9TVeEARvKz/deylSdXtL6L46wNG0m1uh j12Tv0Ol49Kt2YpjMZ8FEDBAxdckCv20XJOM8l8Sz2VdtEVrV0U18vs1XBcbU1p/nMvT tlxyff/5H2P1TK7xX6wIbMUt0KysEPSM6LwqnZQPJ5s7PLemopZlY2V0lqO7REy//l3U QejBILXGefBMUPlR6p0D96IoiYoNHo1Mu0yCWafaQHePY2DoX1YXGMkWW2msPDPHKiH8 Tc8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ECaWajzZ; 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 f59-v6si23708928plf.38.2018.05.07.20.42.54; Mon, 07 May 2018 20:43:08 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ECaWajzZ; 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 S1754211AbeEHDmI (ORCPT + 99 others); Mon, 7 May 2018 23:42:08 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36458 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753510AbeEHDmH (ORCPT ); Mon, 7 May 2018 23:42:07 -0400 Received: by mail-pg0-f67.google.com with SMTP id z70-v6so348860pgz.3; Mon, 07 May 2018 20:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Mw3D/Zmx3HzW0T7pxEsmTOTQB2xbpBQ1BudYrcRmed8=; b=ECaWajzZMVW1qARqmXJ1hO3OQR4PuJYauU/EYjCdRkZe+Uqb+kAJEbzgYbu5oghaGG zTDXdNTIRNfQJlDusepeDv950rW02doVXv9thsLbbmSVNBG4POdJ6i9W/1ouf50KLq1y fG0X7i9FX1CFta8LIt/Qzy6rPqqpOl9BoMG1k7BajEo3aYXQ7oK6pu+1HxWLZA5BLpei 4cdRIqax2VyQcJhwNCErkiYiObYSKLHMOkcBrw0vVrrx5LQDcAcMaipxRtEUTgyN2I0+ o7QSz5Yi/dZsPP580eIFJfE0a5LPmL/5AnsHK20iJVX8erpzx04aON1WTrPWyFGveyhx pF8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Mw3D/Zmx3HzW0T7pxEsmTOTQB2xbpBQ1BudYrcRmed8=; b=sbxcFyjBBK9nZKyxbRhAu5H1DtKmNP9djbYYmWnSMx7bmx8+dThfW+61/luCIQE01N 850K/3wSHRidZ+Ix7J7dTnBDmUogLvROmcpdHD00gg0qXeR98c+y3XmexBgODhaenj75 VkCryjt5Z9WJ9uAS4Q6PNsbAY82+ZSD1fx38HPMrFlpWFUdp7FlQNnbjrCcZxptlfSbD zSEZ6cq3bKLiYXmYM0yxIzBtgXK6f14tG36aS/ZyW2fbFzpYUrv5xtFXeHiG19g2xnJZ 6g1Up1jHSKeOaxXFlYToDJURH6fYzbzFZ0J+aSmY/TYZTn2fQd0ssvdwCAtsDvjds/U3 M0sg== X-Gm-Message-State: ALQs6tACMTkVIMf2Xi8EArQ3Sj5kOrJk60RjsBWqd4v+e2ctRAmSWXH3 7RbvCcV2h8i5riI1flaLUaWbJA== X-Received: by 2002:a65:508c:: with SMTP id r12-v6mr31083858pgp.185.1525750926314; Mon, 07 May 2018 20:42:06 -0700 (PDT) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id s189-v6sm38493263pgc.39.2018.05.07.20.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 20:42:05 -0700 (PDT) Subject: Re: [PATCH] watchdog: mena21_wdt: Fix a possible data race in a21_wdt_set_timeout To: Jia-Ju Bai , morbidrsa@gmail.com, wim@linux-watchdog.org Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180508031825.12525-1-baijiaju1990@gmail.com> <64e08944-0578-ac4c-8dea-e1e704685e77@roeck-us.net> <26fde8a3-fb78-e12f-2f0f-c9b5bb2158e0@gmail.com> From: Guenter Roeck Message-ID: Date: Mon, 7 May 2018 20:42:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <26fde8a3-fb78-e12f-2f0f-c9b5bb2158e0@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/07/2018 08:32 PM, Jia-Ju Bai wrote: > > > On 2018/5/8 11:28, Guenter Roeck wrote: >> On 05/07/2018 08:18 PM, Jia-Ju Bai wrote: >>> The write operation to "wdt->timeout" is protected by >>> the lock on line 118, but the read operation to >>> this data on line 105 is not protected by the lock. >>> Thus, there may exist a data race for "wdt->timeout". >>> >>> To fix this data race, the read operation to "wdt->timeout" >>> should be also protected by the lock. >>> >> >> There is no race. There is already a mutex in the watchdog core which serializes >> calls to the various API functions. It would make more sense to drop drv->lock >> from the driver. >> > > Thanks for your reply :) > Need I submit a patch of dropping all calls to "drv->lock"? > You don't _need_ to, but I would happily give it my Reviewed-by: tag if you do. Guenter