Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1367087ybl; Wed, 28 Aug 2019 13:37:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNnmn7r7s/KXyXBuCuPo9og1PmRf4iMHIhxUAj+OULGfySh77P7ith/McrzWdXk8hMxu9+ X-Received: by 2002:aa7:957a:: with SMTP id x26mr3847692pfq.16.1567024664471; Wed, 28 Aug 2019 13:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567024664; cv=none; d=google.com; s=arc-20160816; b=nI+qfI2tUP1WVqL6iz2RArBRnRyTGoHydQxNhFCb4drJIlhXU56NGlpLI2w1oTs+1h 5gG2eEcPmeFf1rWy175Nmhvhttne5FUixORd6r8KbGM0SBpaZK9BVZdjN8eL1TSfS8Hq PLF7EVt5qiWc+/mKnNt0kxIvConIzHvpsP4Z9NKD1TPx6gqPZqmuIkXDtPVqyZmez0hB eASYYfFWdOKV2PgX7Ws3vfSPs80SBNOvqA4dCj6q1EUuqGAfuby86urVI4rQvHOegqrv ekIAoPzPpJT/9jTaJk3NEA1xrM7QeoI+Fi6pFFx6709f9MffJHp4Aft7Dbsa0erOD+pq C20A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=azRAxHr0avIn2Bp0eJAD08hfKMaVL22jDWUPUYBHm4c=; b=njcRsuAAX+3hZXXL63kAZunY/WT5dQPk29VBrDHHHKUgBh5lGsUQtCgMH/2dkm7dij HAH1D9c7d5yhh/JU2fQcaVNm+1cxIphNlri5J1rnfd/TRUzyXOBWGXTaQNX6lPgF4JSx hKsQdmKE+1H5VZHN2r4+vIKhUXVlztvhGiCEM0W4k6xgbA/3cYdcHg28dl2xIQV6606V Qo1m+iLUMtRZVek9KRaYvrJWedhWZ2ukeojX4ZE5htyh4dXugVkBXXi9q4WQO6SI3Z8b VX/1RZyuCBjFPv2z8AnDADABnjG+mlpR8yaCpyG8zIwlQxXh/YW9ArF2IcvkjRcoWAPL sWvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jtqnzLil; 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 t3si202510pfe.259.2019.08.28.13.37.28; Wed, 28 Aug 2019 13:37:44 -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=jtqnzLil; 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 S1726877AbfH1Ugc (ORCPT + 99 others); Wed, 28 Aug 2019 16:36:32 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:41336 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726658AbfH1Ugc (ORCPT ); Wed, 28 Aug 2019 16:36:32 -0400 Received: by mail-qt1-f196.google.com with SMTP id i4so1105710qtj.8 for ; Wed, 28 Aug 2019 13:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=azRAxHr0avIn2Bp0eJAD08hfKMaVL22jDWUPUYBHm4c=; b=jtqnzLil+XA7yTM3OdWgXVyNBavMUt5JAVUsgumaEP99csE94Haz1GwdZ7D5FHLeQ1 W/TyJwZSzOAGiLwwZ505ytOCNFEqMu8n43sS52YeDrGxJhTUDH6KD3Ugx7gl3sK2QQWT kiOfLynt48kYhEChLre+4SNZA7AdaFkQEyvyITludBaSkM4bDyTMqbeBUb3//krnnXqh zuOiMZGjmb3bSEp8T9aW3PF6vPg8ZGkZ6+0PhlAAmB0vgAjhZnvcoa5xJOS37HJE0gQG ON80nJniur0DL+6O+fneIuz5W0L4UxOXA90L34eVs7tkcsh2eiwQuF013q+qZgOAx5kY ljJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=azRAxHr0avIn2Bp0eJAD08hfKMaVL22jDWUPUYBHm4c=; b=AfiipGZFM/3D5BotpMDV+dOfo2dfcgVwU6wB7EM3HyV05wSMQVnaHaWqdDR5CO9a0N Kg7/umvU1PV/Llq5ceYzig28J3MdQttbO9EMJgT0qf77u4DqZNa3G/svvpzU6xyaHE7+ Ht+GDkuwjOAtOBfKmDBAcvoMBJeSuKqWwsZt0689xyzOZqu7c1nC6rIsgQTJbKOPLO1G HCBxk5Au4SEdDNrl0UZ+/JcQx1rPeq3Y9JyYSp3c+j9B0kLiPgOtfRmxUqRPVjdNeOJ3 zrrCBvR6Vj01p9ncvb7/JSdGbFjDrbDvuG7OBrVlnQp5PWddgqyCwu5lod2DDOsnIsj1 teQA== X-Gm-Message-State: APjAAAWOEIeAaPwxX452BFr3yixQ2iHmjawgbsiLuJK2tqFf+7gHmZjp jErGVtjNUsErcVYZFxp/8es= X-Received: by 2002:ac8:364a:: with SMTP id n10mr6632742qtb.148.1567024590924; Wed, 28 Aug 2019 13:36:30 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::b715]) by smtp.gmail.com with ESMTPSA id h9sm126548qto.97.2019.08.28.13.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 13:36:30 -0700 (PDT) From: Jes Sorensen X-Google-Original-From: Jes Sorensen To: minyard@acm.org Cc: linux-kernel@vger.kernel.org, openipmi-developer@lists.sourceforge.net, kernel-team@fb.com Subject: [PATCH 0/1] Fix race in ipmi timer cleanup Date: Wed, 28 Aug 2019 16:36:24 -0400 Message-Id: <20190828203625.32093-1-Jes.Sorensen@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jes Sorensen I came across this in 4.16, but I believe the bug is still present in current 5.x, even if it is less likely to trigger. Basially stop_timer_and_thread() only calls del_timer_sync() if timer_running == true. However smi_mod_timer enables the timer before setting timer_running = true. I was able to reproduce this in 4.16 running the following on a host while :; do rmmod ipmi_si ; modprobe ipmi_si; done while rebooting the BMC on it in parallel. 5.2 moves the error handling around and does it more centralized, but relying on timer_running still seems dubious to me. static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val) { if (!smi_info->timer_can_start) return; smi_info->last_timeout_jiffies = jiffies; mod_timer(&smi_info->si_timer, new_val); smi_info->timer_running = true; } static inline void stop_timer_and_thread(struct smi_info *smi_info) { if (smi_info->thread != NULL) { kthread_stop(smi_info->thread); smi_info->thread = NULL; } smi_info->timer_can_start = false; if (smi_info->timer_running) del_timer_sync(&smi_info->si_timer); } Cheers, Jes Jes Sorensen (1): ipmi_si_intf: Fix race in timer shutdown handling drivers/char/ipmi/ipmi_si_intf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.21.0