Received: by 10.213.65.68 with SMTP id h4csp2119186imn; Sun, 8 Apr 2018 20:10:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+YQKcR0EuJhnJjNCie9cUh0JevWLeEtU0tioeMAZXO2XL5mbyQF2vbn66+qmhm1Xg59p0x X-Received: by 10.101.96.141 with SMTP id t13mr24241936pgu.222.1523243445191; Sun, 08 Apr 2018 20:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243445; cv=none; d=google.com; s=arc-20160816; b=d+kXrw6HP7zznVakfduzIzvPWJxIi5w1xp4xsA2HQPAchr0/+rykSTGkSqoQAP2+Xf iNcOatJEsg3n/oO2J+b8hs+ml6+gJSzrd3cgljw8YPOZ8ttsPNr7nzcTa0Rp+Bx52ZnK IR8uYxZQU2LUif3NfHztFTKgsi1w8WJ884zx/Dl+auWbuBtkDdUqUrc+aB6+Au0V3kvW bYbAKsYMmLhxEofLz0+GauJN1czfETdQHsYnQnEH6P5OWHyrakRRjMJLE+pFf0oD9zCl 63z/XLfth2/2CiHqzsZdldbMPmcgOLs7s9ywcdlLV4YasF56tD8iiiijEgWkWm/ch0lp 2L7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:message-id:date:thread-index:thread-topic:subject :cc:to:from:dkim-signature:arc-authentication-results; bh=UvgjIPVvSZDR9n6osnyzeBRBG9ooLlazj9harKMuOBI=; b=JsQqaEclM4UdVGEH5VlT9EK4v8o2Lvb3qOQzRdbijb6MDLuDTEl2KCqikyt6C1PTo0 6qqySxvibjESbNSEKh+FaT9oKe1bJcAyxjtPbCW9BbO73U8dogfNpZGdqN7Mx3/mo54D V76froiHigyt5Z/W+C5oN5bFVsXYy3X6eEdJ7nVOuw9PrTtuWfZXcqGF0l9HkacO9u7p aP7ZDB7+phisB4VgxjWVm19shwJO5D7Z91Yg/h/Sn2W4ykcMoJg1RWzw6q2RBB0NQxBt fFgM5Vd8v7hoV0mImxJLAX2R189uXkbV9rXdRiq7elFQOBFfp7V/bQAKyiCgN4hTgFjp Pxmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=l7WUhQb6; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si9887110pfm.241.2018.04.08.20.10.08; Sun, 08 Apr 2018 20:10:45 -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=@microsoft.com header.s=selector1 header.b=l7WUhQb6; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933212AbeDICs7 (ORCPT + 99 others); Sun, 8 Apr 2018 22:48:59 -0400 Received: from mail-cys01nam02on0098.outbound.protection.outlook.com ([104.47.37.98]:9607 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755374AbeDIA0f (ORCPT ); Sun, 8 Apr 2018 20:26:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UvgjIPVvSZDR9n6osnyzeBRBG9ooLlazj9harKMuOBI=; b=l7WUhQb6q5OmOliDsfcbS5eDq+TD/Zwi6Rjg5HzByZAdAtqSN8QXhzs4sweAXSdwtS9rORqSMYu5xoZcN3BtaFOI508sHUHmWhWt+iSlMiVgdXPBzwJBu95h2RQ0gYuS+u7NCzwZzTHfST+1HJQk1xHyL0/ELARUTMafxKVUNno= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:26:29 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:26:29 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Takashi Iwai , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 001/293] ALSA: timer: Wrap with spinlock for queue access Thread-Topic: [PATCH AUTOSEL for 4.9 001/293] ALSA: timer: Wrap with spinlock for queue access Thread-Index: AQHTz5jh3t1Q3MFACEOq+G75iS+VtA== Date: Mon, 9 Apr 2018 00:22:45 +0000 Message-ID: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:ZKRRjx//KYAvY2mt9E8OqEWcO5iAR1ef/f1yeWwHioR6QWJsECBiTv3Jd3yCxp0WnjIcgbKpgOfXhanXd6z+mR+kKgGdpkg/aw9zpqW0Mbxhqlx4zVqeb2tEpDI27sLaPn/XjE7Y821KI4xDZaEazlF2mUvqdR8L826YHpGW2AIAFJBxxl1NiGaSUmqn0RKo8bFFUiTlrEI6t90IRbwf88lFj8qDkxS/xmWv8rhJms73HM2WYvYb5eWfNOnJuj1G;20:5Yjl+YQ8XCpygQXSOukcZKzDoFDxjKmLGqFapNQgiov7CplzHFbSRIPfe8tkaBRtbAxmm4H09shWjL3In170bdm1R6TDIxO+NWUoj7xtBy8nm+LyM3s33XY5YK/W9fTnUDrQqf9nG2AwJt0EHBi3OWc+Jgf60RqZB2ZsbX+BFWo= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 46efae9e-df78-499d-d1fe-08d59db089f8 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(211936372134217)(153496737603132); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(39380400002)(376002)(346002)(366004)(189003)(199004)(53936002)(4326008)(478600001)(72206003)(3280700002)(2616005)(14454004)(305945005)(5250100002)(3660700001)(2501003)(2900100001)(54906003)(110136005)(86362001)(1076002)(107886003)(6506007)(36756003)(68736007)(6512007)(7736002)(486006)(2906002)(5660300001)(6436002)(3846002)(86612001)(6486002)(66066001)(476003)(6666003)(59450400001)(26005)(10090500001)(316002)(22452003)(8676002)(81156014)(81166006)(6116002)(105586002)(99286004)(186003)(106356001)(25786009)(97736004)(10290500003)(102836004)(8936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: mGf44UqzcjxWT6fJQSKKkoGrlTJfpT4ZBKPm16rOK+L0LKlJWTcnSSEUIgHbfRUFn/g6VIv5GTVhduUeieqbPN8Q0EIOF2zIhsnZ1UNai4Ly5CL7aBcQ/CaPasWjIT81ZZeP2a/jLQqvlOHBt6bt5+9SrgqCOk9vZm+vJK1gfKmPUskkkecX+mtTJnIhCa+Lh5XmpXhapUdvTu7cbVUDzSnSyVM2ENF0Ub9uGWIjaKIr/Bg1zpch6KP2rmfmBKyB4I3C0ltBPMI2nlHeT5AtXagcxOQHR4qDWpEMUIZz68QhzwecyfcQbL+r1qBpY5TbgbXZTjOEJrg81MyVdeuIshNgKaFnyGNl5Z4gH37cGuY0ubP6jNS3wKYepP8c8WMd+Z6w1TyhNr2YiZrgOMP1yAFjFDecv4MGAuKWLxuQGcY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46efae9e-df78-499d-d1fe-08d59db089f8 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:22:45.8935 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai [ Upstream commit d7f910bfedd863d13ea320030fe98e42d0938ed5 ] For accessing the snd_timer_user queue indices, we take tu->qlock. But it's forgotten in a couple of places. The one in snd_timer_user_params() should be safe without the spinlock as the timer is already stopped. But it's better for consistency. The one in poll is just a read-out, so it's not inevitably needed, but it'd be good to make the result consistent, too. Tested-by: Alexander Potapenko Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/timer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/core/timer.c b/sound/core/timer.c index e5ddc475dca4..bbde1bcdd985 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1773,6 +1773,7 @@ static int snd_timer_user_params(struct file *file, } } } + spin_lock_irq(&tu->qlock); tu->qhead =3D tu->qtail =3D tu->qused =3D 0; if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { if (tu->tread) { @@ -1793,6 +1794,7 @@ static int snd_timer_user_params(struct file *file, } tu->filter =3D params.filter; tu->ticks =3D params.ticks; + spin_unlock_irq(&tu->qlock); err =3D 0; _end: if (copy_to_user(_params, ¶ms, sizeof(params))) @@ -2034,10 +2036,12 @@ static unsigned int snd_timer_user_poll(struct file= *file, poll_table * wait) poll_wait(file, &tu->qchange_sleep, wait); =20 mask =3D 0; + spin_lock_irq(&tu->qlock); if (tu->qused) mask |=3D POLLIN | POLLRDNORM; if (tu->disconnected) mask |=3D POLLERR; + spin_unlock_irq(&tu->qlock); =20 return mask; } --=20 2.15.1