Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1253841yba; Tue, 2 Apr 2019 05:37:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzssjbolmUVJ1TTdBMqHGp1IAU/dL34y71BqJoNNZ+M3jwsKNHbXgz5Grl8mvxRb0pE5pB+ X-Received: by 2002:a63:2c4a:: with SMTP id s71mr27003811pgs.373.1554208671067; Tue, 02 Apr 2019 05:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554208671; cv=none; d=google.com; s=arc-20160816; b=zterUdAk/vcnViF4AeWiaD50yE/18klNIl/dm7ye43oMdyYVdvQvkdsJjGmm6Q1J4T Jxw3v3fCpRKzfmq7UIIAqoJaYykvapNdOFxETWr6wD9adGAidNlPtntTG0ALuMOCVsSz npk1XIvdLiIJpEATv9iNWdjh2IHvP68CQ/iRN0l44o/MKjz+MmeLhfU9PxVKn7bcF+c0 wyrw3hRmye8s4C6wsoVcG+JbtD62plGomY8bgBaihMW26fJEuNp0nM32tAW1jS8Egliy N6lhZaewNftOPgYwk2wGSBFohgOUYU/41LkubKYE6vDG73C0rBVs5veRKmPbniymT3L2 932g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=fOTvj2CHNnElYQjxn2p/TjiU6IwYublLyO1UnfYA5/0=; b=TBFjyNzQjrDgLpvf0ih8DeVoFnN9Uj1AmkF1DXYADHlySjfDV8Y65tpytq/C6+pB6V i3AjdvV9ru/fvdsC1+qPl6OZ7R/GAYLFi3A2JEW5FJL4WTul70s6fUChwicDDjtFepSE mIVkvWrdQdH0upFsL98+aVP+T1jCOqf+iHhcF1pvlCkRZDw7Z83mbWKnT/Wz5M/o+sKi c0Q4whZVE8hV5A23VytxtUaCMbWK/GRva4BW4rzsqEtBTZWIx3grV9DscBuNgDfCu3hj hzA6/xk5bhrUcTYdesYvYy57XapY7a+fJRU8MQQG9txQosDO53zGd1qVHHw2w4qEbh8Q pzzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J+ZluEoa; 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 e10si11024607plt.283.2019.04.02.05.37.35; Tue, 02 Apr 2019 05:37:51 -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=J+ZluEoa; 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 S1730616AbfDBMOq (ORCPT + 99 others); Tue, 2 Apr 2019 08:14:46 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37046 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726284AbfDBMOp (ORCPT ); Tue, 2 Apr 2019 08:14:45 -0400 Received: by mail-pf1-f193.google.com with SMTP id 8so6302271pfr.4 for ; Tue, 02 Apr 2019 05:14:45 -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; bh=fOTvj2CHNnElYQjxn2p/TjiU6IwYublLyO1UnfYA5/0=; b=J+ZluEoaLhaUy/COTvfTmPQZuKDuJVrnrFmCFXTsDeFFuHrN9lLl+lAlRcW4Ia1SlH 610i8XcBtmqLYAI0ckIIS9cdkoX1o61p2HGQeyiwICtNHrYOQPp0b/uHmBbvP2pz8jGZ c7KNRMat7K2IQKeZtawXosumUDdbc7dPjzuPW/UKICje7BNzdXqAmx/dF3rM9/SalSrr mk3seFijgj4Qqr7l1n/O+GzXqBu7CIwXQ7ZUvhUEuaMt92sqabHAaNT/55Dg6TVmpZLY 9LchCztu2TvpJExq7Z5zFeVy+EFTInGtZflRWs58hfqqhK6FjXg6UvGyinpceA/m8w7f 4mLA== 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; bh=fOTvj2CHNnElYQjxn2p/TjiU6IwYublLyO1UnfYA5/0=; b=fu86UQrOdra0K4xnLqlvMi3lYnqiIw/wMuljYo31IgGRkBSo89y0dbL1i4XY3qm7pJ jM/4db2n5QmmwY2u+vA28vAB3K7zOk7/mPpuFRuG9nObu4WR6GMJX6JFh0KjRTMtYw4B 8ONywQPnrSA6VWZhCCD0jiLr+jcl9gPtpORLXF6QWeh6A6eRYgz/zTRzuNxM7aaEC29b aIE8aTjo9Gmi7SInuswoRzzbOVVSOCMgE1lq09Asverz5XNdvhqQQk0yBAZbK7vAHAf6 F41Na1oIYRl9ssq3Km+LV1K+0INBldYQRxxEfZfOuqSMw1o9xHsO5k0lQd6LzAQ6aJBd 0t2w== X-Gm-Message-State: APjAAAUKsdeutiy3WoHcde+vEqd7sa55w2dtxD+fEZK9CoxgZ8/c06S7 Ov58AtXJe7qVcAXmr2n/+AwSn6Z6 X-Received: by 2002:a62:1bc7:: with SMTP id b190mr41953848pfb.29.1554207284105; Tue, 02 Apr 2019 05:14:44 -0700 (PDT) Received: from localhost.localdomain ([61.83.141.141]) by smtp.gmail.com with ESMTPSA id x8sm877391pgp.48.2019.04.02.05.14.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Apr 2019 05:14:43 -0700 (PDT) From: Sidong Yang To: Greg Kroah-Hartman Cc: Sidong Yang , Michael Straube , Hugo Lefeuvre , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: pi433: Return thread immediately when kthread_should_stop() call. Date: Tue, 2 Apr 2019 12:14:31 +0000 Message-Id: <20190402121431.8070-1-realwakka@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kthread_stop() called by removing module, running thread should return immediately. Otherwise, It is very dangerous that thread may access any released data like struct pi433_device. Signed-off-by: Sidong Yang --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index ab90d6f80931..16dc380eb176 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -736,7 +736,7 @@ pi433_tx_thread(void *data) device->free_in_fifo == FIFO_SIZE || kthread_should_stop()); if (kthread_should_stop()) - dev_dbg(device->dev, "ABORT\n"); + return 0; /* STOP_TRANSMISSION */ dev_dbg(device->dev, "thread: Packet sent. Set mode to stby."); -- 2.11.0