Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752671AbdHJPH7 (ORCPT ); Thu, 10 Aug 2017 11:07:59 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44306 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbdHJPH5 (ORCPT ); Thu, 10 Aug 2017 11:07:57 -0400 Date: Thu, 10 Aug 2017 08:07:55 -0700 From: Greg KH To: Anton Volkov Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org, Alexey Khoroshilov Subject: Re: Question about apds990x.ko Message-ID: <20170810150755.GB8851@kroah.com> References: <6bd7a5d0-97ef-4e04-6914-9e287c7be767@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6bd7a5d0-97ef-4e04-6914-9e287c7be767@ispras.ru> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1339 Lines: 30 On Thu, Aug 10, 2017 at 05:57:30PM +0300, Anton Volkov wrote: > Hello. > > While searching for races in the Linux kernel I've come across > "drivers/misc/apds990x.ko" module. Here are questions that I came up with > while analyzing results. Lines are given using the info from Linux v4.12. > > Consider the following case: > > Thread 1: Thread 2: > apds990x_suspend > apds990x_resume apds990x_irq > -> apds990x_chip_on if (!pm_runtime_suspended > (chip->client->dev)){ > -> apds990x_configure if (status & APDS990X_ST_AINT) { > chip->again_meas = 1 chip->again_meas = chip->again_next > (apds990x.c: line 571) (apds990x.c: line 505) > } > } > > First question. Is this race feasible from your point of view? > Second question. The check for the device suspension status > (pm_runtime_suspended()) is present in the interrupt handler, but the > functions pm_runtime_set_suspended / pm_runtime_set_active are not used in > apds990x_suspend / apds990x_resume respectively. Do you know about any other > method being used to make the modification of suspension status? No idea, sorry. Maybe the driver authors know? greg k-h