Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8067881ybi; Thu, 6 Jun 2019 06:14:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqytoFoxQYtND8FRiJCGNprUzsWnsnHvhGdR6BREImggTHNXpK6ZFi0tQO85e/IENOEarnqY X-Received: by 2002:a62:82c2:: with SMTP id w185mr31622037pfd.202.1559826871617; Thu, 06 Jun 2019 06:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559826871; cv=none; d=google.com; s=arc-20160816; b=Hp430iqYRd0s9wJJWem9Nt80VyW27hEvpbgykUsdaUGqWlBJG4Am5m3FRELVxj4rzX ZeeC+VeI/rqmCFUA2RefSXo7bS7b0RjqSycbb7AFqj5H7UCuzaaDxAdPPx31skANUyT5 kyUwn87zNNHadMe3b0TV5xVNJkpqkjt5NcVO11Kirlm6+ARz7SQ/spPs4vmznsYHkqqW 1/YmiQfCRpik4zI322q7d3Wb653Z/nLIZoTLCRkzp1uxqqxDicujzE/TWKOc3oiYPs4e vrq5JS0i3+Uek/amqup21FHH1qkoSXrhdz6QnOw/1NwRSawVV14ZNuMCCD0YDi0BmA78 Cx+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=YhRbeh2/ahl+dMhYvIhRMIdy9x0y17qehrDPCX8oLms=; b=ca2XS7NFn/dYA6orbGkiMm3m7k0wBlAAmQqazwvkvdu6ZcEKEzbK9+J8sRO1Z8DnnF b6wzarPqP7NDpR3WIAS49tKFCHD/i3PO9FZKbsZauS2l9XmlK68fCQnlXQU4Hll2tqAz +G4yuSoFfTtGjHb3bbUhxznh4uFZw79I4lq0/l62YJUe2mM9VtaWZ3oZY5SL+OCgTqOy QZxsBG6V4liO5a5OO49j7PCUcXKbLpsorS0TKnQQRALFRXQm7P7qbFicZlbaP3UOtBHc NhbE24PQ17cRKiUIZedq5NIaAgsLlSEThgY7RUXc9iLlWARGZ+KKZRZFbI/VYXgk1zs6 YEcA== ARC-Authentication-Results: i=1; mx.google.com; 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 a17si1932423pfa.108.2019.06.06.06.14.14; Thu, 06 Jun 2019 06:14:31 -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; 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 S1726922AbfFFNND (ORCPT + 99 others); Thu, 6 Jun 2019 09:13:03 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:50643 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfFFNND (ORCPT ); Thu, 6 Jun 2019 09:13:03 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id B3EDB80271; Thu, 6 Jun 2019 15:12:50 +0200 (CEST) Date: Thu, 6 Jun 2019 15:13:00 +0200 From: Pavel Machek To: pavel@ucw.cz Cc: linux-kernel@vger.kernel.org, Justin Chen , Jonathan Cameron , Sasha Levin Subject: Re: [PATCH 4.19 189/276] iio: adc: ti-ads7950: Fix improper use of mlock Message-ID: <20190606131300.GE27432@amd> References: <20190530030523.133519668@linuxfoundation.org> <20190530030537.017297326@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="orO6xySwJI16pVnm" Content-Disposition: inline In-Reply-To: <20190530030537.017297326@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --orO6xySwJI16pVnm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (stable removed from cc list) > Indio->mlock is used for protecting the different iio device modes. > It is currently not being used in this way. Replace the lock with > an internal lock specifically used for protecting the SPI transfer > buffer. >=20 > Signed-off-by: Justin Chen > Signed-off-by: Jonathan Cameron > Signed-off-by: Sasha Levin > --- > drivers/iio/adc/ti-ads7950.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) >=20 > @@ -277,6 +280,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq= , void *p) > struct ti_ads7950_state *st =3D iio_priv(indio_dev); > int ret; > =20 > + mutex_lock(&st->slock); > ret =3D spi_sync(st->spi, &st->ring_msg); > if (ret < 0) > goto out; > @@ -285,6 +289,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq= , void *p) > iio_get_time_ns(indio_dev)); > =20 > out: > + mutex_unlock(&st->slock); > iio_trigger_notify_done(indio_dev->trig); > =20 > return IRQ_HANDLED; Does trigger_handler run from interrupt context? Prototype suggests so... If so, it can not really take mutexes... Best regards, Pavel =09 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --orO6xySwJI16pVnm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlz5EVwACgkQMOfwapXb+vJCHACdFbGlNmouCwE8ij5J2hpfSJCC sisAn12ujluwRRJcjLn/IZ9asP/L6yc4 =jHLo -----END PGP SIGNATURE----- --orO6xySwJI16pVnm--