Received: by 10.192.165.148 with SMTP id m20csp3815444imm; Mon, 7 May 2018 20:34:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqaypbhXa+U2Qs0H5TDOsbzQg9VdyJzyD1Nx4vSY8xTZ5h7E7JpOce2HSUhnKdx7QNO5tCP X-Received: by 2002:a65:4907:: with SMTP id p7-v6mr31392687pgs.139.1525750476320; Mon, 07 May 2018 20:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525750476; cv=none; d=google.com; s=arc-20160816; b=q+nTCDndOu0hUoKRjmla91JMRsA6HtqEU6zV3+x9QMSb2P3jvJ/AW+FFLieRyen87O vbLG7hHHUSEyc7anheeapmuM0zc7ZhlRjaGIrtA/n2jCTZS+XZnSlmSrj6wNMaLCuuQ2 r9OMWLkFVB90vaaBeCCQIEY/iA5wLFiyL3FlLAV0g2Xhbkha4FKrR0WLfIojH7inYznZ ELOyvlKUYzHWTSiSTBlLj3Vwzsz+1dTv6l91hy+za0mWZ7tLBWauVq4YGeisvc1+Gjbg LFQiPjRfKlXqyWyaW1/znvhWYVd1fvvlhC1FCA6xdFQNZTUHXicmFbA/BUMY+wLq8XOi BUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Q3qeoGtmCKwJx/FdIXN4AkwbSKvmtjwzyOs3+OAGdbQ=; b=v0++u3yMMcPnIQpTn7O+AT14okrowcO9o0uGwjGgICJhwxqM4OceivFNhVVcmg3dqb MGw1i8L7LsfhknTz020rUUXAwA14vxU19a4lqan+67CQGLFe/hd8V6PHoTnUKLvJo+Tt tbImApc49+wevJl7Ap5cWtZB0nO853rWV3uinOdMwK5pFy2BNJPy2968C7CsdbyKmW+Z v418PmFBLXuJJJXZU8/9LBdccK3+SWccZfV1TTbGAvIUaa9/oAhlZeKAEBXVwUt2Pm/T whPAc+riDNG3zaiGlEbe55wTV7h4pf2YV9Dpk91Km8dk84XsFith//IbcEj3neHkXEop 9a0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H1pnlxL+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16si23622311pfe.291.2018.05.07.20.34.21; Mon, 07 May 2018 20:34:36 -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=pass header.i=@gmail.com header.s=20161025 header.b=H1pnlxL+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754177AbeEHDca (ORCPT + 99 others); Mon, 7 May 2018 23:32:30 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:39431 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbeEHDc2 (ORCPT ); Mon, 7 May 2018 23:32:28 -0400 Received: by mail-pf0-f170.google.com with SMTP id a22so9173843pfn.6; Mon, 07 May 2018 20:32:28 -0700 (PDT) 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-transfer-encoding:content-language; bh=Q3qeoGtmCKwJx/FdIXN4AkwbSKvmtjwzyOs3+OAGdbQ=; b=H1pnlxL+Bf/GsLoitorhTVMh5RgJ0ii2YVdaNQozqXnDZQv4SxdNkQA/158FNQ7Bdv KhZidt3aDqfIpTivQKMSrBwmq6c+RAjOUUy89uEZR1GJS9X87TPkskzo8ilT5lgA1QYz R6vsDWzPAB/whuDXJhRh9Se/tqon+RrMT6LhxwlXwJEuzStbAUgqekBhOe6QoDQZXsPa eZaPed2f3farrnOvfgw8lm3SQjDr846uduPxAtB7E5cgRxKrgKY35IwaUJUvEdGQEnb4 XIowF3rh3SaU4O+bhp+Q9XIPpqGf47Pm6hQWW10aCIDceGo4YqOVk+nrpCpcV/LeYHYQ igBw== 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-transfer-encoding :content-language; bh=Q3qeoGtmCKwJx/FdIXN4AkwbSKvmtjwzyOs3+OAGdbQ=; b=XpCYsYmuB4YVlkB2sKkz4zBLdfbrQox+xA/KVVqFQE3n9QnqN0z6hEawvXmSdXIIFM ETX2zagooIbjzk+E2K/vBTZ4KgavPT25fVkLkdt9mTpnkZBwNENgPmw2hOvGIQSObs/S waeMxrt4Uf93h+abCZqWfx2yYwATHMaEhZB6miEAteKQgiBmfkNlLWh3s50wB1bCx6WM viTd634eb71cIl70Mri1/QChhbyP6NDnxZZ2jYUTg55qY6+dE7AoHfIJfsZ1tZd3TwlF VjGYzva7Z0tiIsrs+ZPU5+p7xY2iAZUVklfPhoq8pzh+rf7cZohPbmJLehm0u1URXGZx d9wg== X-Gm-Message-State: ALQs6tBw0U+qooAIgM063x0N0fmpxgjzpHrQ1ryafyO1T4SfAGLkjTyD SU0xzrR1gAZoNMjw4q6As89t2X3Q X-Received: by 2002:a65:5843:: with SMTP id s3-v6mr925240pgr.323.1525750348417; Mon, 07 May 2018 20:32:28 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.70.9? ([2402:f000:1:1501:200:5efe:a66f:4609]) by smtp.gmail.com with ESMTPSA id a65sm52426403pfg.40.2018.05.07.20.32.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 20:32:28 -0700 (PDT) Subject: Re: [PATCH] watchdog: mena21_wdt: Fix a possible data race in a21_wdt_set_timeout To: Guenter Roeck , 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> From: Jia-Ju Bai Message-ID: <26fde8a3-fb78-e12f-2f0f-c9b5bb2158e0@gmail.com> Date: Tue, 8 May 2018 11:32:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <64e08944-0578-ac4c-8dea-e1e704685e77@roeck-us.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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"? Best wishes, Jia-Ju Bai