Received: by 10.223.164.200 with SMTP id h8csp640695wrb; Sun, 5 Nov 2017 17:28:28 -0800 (PST) X-Google-Smtp-Source: ABhQp+SnJr8ezklQQJNDm4TzYmFJ4TfISOfOhsOiYxhdwxEgVxvK/FVCL5it0n9TU2Ujuo/DzQH2 X-Received: by 10.159.235.137 with SMTP id f9mr6272388plr.89.1509931708832; Sun, 05 Nov 2017 17:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509931708; cv=none; d=google.com; s=arc-20160816; b=YmAtk+3spaDJuzEsThKdPgd9LeoC9Li+asWO7NyOZ0bobaK8vDecWU1485SXgmnwZR mKp3Q1d2X/KKprBtuKDsSO2cTHB+rhG99cxUJf3+SzKeGXn1mOilPpODFcBddaGzVn8l TD47xSdSmYFVVxG9Qk5XqrIjqng627IQKZsVtX9HGO2wIm+byMrsSk7WsNvyQv93lnyL DcM8oceevj2a+Pd6HwiAQNUndv9AsN+ot4bf5QFVR5KEmG/IaKmlYrP8z9B8m6L6ERdn sByvr6jYsxixa9U1yF1bCNdf6k3eeCgNbfmsrj6jwunQy9T0L8Jyd8SmQvr5juY1g6pJ iCHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TjRcVonzNvraOJK6A+7r8MlSSbwN2fRv9o7f+Sz45bA=; b=blCao2kj3T2D2imCZzs2TtnaxPoVcmlLwQV8/4309adbm4NIVyZvy/pT3tPk8m/sEW lnt4JyArqPWR/Wm3t5Gbf/Goey5Hfpozepp2RL2CBD2mgTX7o8C4TH3Eq+k/KqKJYpPN I3kqaqjnqj1wm8G63XXWWXWD45NDKWHSkc45iiiEL4GFXm8HiH1uoyLVpOwo8DH4GRpp 3yKt+It9z8L20KdoOeeUhjGK3bBIY9cNHnU0vbvM4C8d85U86uLphZoVEOzuReunPhjy kwAOe0oyZsweSHuRHaJ8gywnJSFJWTyeOoMqcnGy+ibgfidtRJZXYXk2S69WCTHu2B2s L0JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=cvZWzvJW; 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 ay5si8981103plb.695.2017.11.05.17.28.15; Sun, 05 Nov 2017 17:28:28 -0800 (PST) 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=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=cvZWzvJW; 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 S1751754AbdKFB1E (ORCPT + 96 others); Sun, 5 Nov 2017 20:27:04 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53592 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751185AbdKFB0N (ORCPT ); Sun, 5 Nov 2017 20:26:13 -0500 Received: by mail-wm0-f67.google.com with SMTP id r196so11078153wmf.2 for ; Sun, 05 Nov 2017 17:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TjRcVonzNvraOJK6A+7r8MlSSbwN2fRv9o7f+Sz45bA=; b=cvZWzvJWLq1baSD6k3DQwlKsT7IPsWbxHI56Yh5vN2LJW8+sobZulB33YTWvoEvw8t 6b6TwnnVkuWxOyKbVVkwi88ZelFLm1qViJ/QOGqlFZeoAX5p4lcnsjlQXG9ez8KswZZP 3T4EvYxNltOofcQT4MK0glgbUjPIUBQclGa5FxIarQQvvOj9bnZIc85BYr+6ZWENVMYb yij8mJJboVrqCglAWLEcOIw7wCZIgc2s6U6u8mGmN+Uo4hBo7RHpKp0FIOZSiWIqnFx5 kcQ+py2z2DY6Bnqdt2AHbtFB5rfUQvvs+ylXn3XkcIl9oHX8Ekis/IaVrgM9FuAk/GcA ejCA== 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:in-reply-to :references; bh=TjRcVonzNvraOJK6A+7r8MlSSbwN2fRv9o7f+Sz45bA=; b=okc6yiXW7DqJWpeogoV1nfYd88hQTAmeortfvfcmQ1pyXJ5sctFhPc2XuYfX7+a+ju dzbV36INyQ6qjEej1C0ocqg1jBmk/0vEQB+OBFFHqx8Y9sgCJSeFf0gQaJ9suN4suL3/ qLwKH/HZyqfn007ZokRStbNKjvMOR7LluVNwYVXMwSb2dxBEKdWHjYq/sTtdTnlFrHIa jMjYsxtBaLxu+fnixCjuRSqxVJb2ItmEYdHRrzasrq5dogi0Whsz9g65BoxBeMhuh4dB Nfc1pt5X6J70Fumcj3EfLeO7kxP0kmtQc6MaQoqIYvxWMbW8gfDqn/KC57ySXJRHVtqP GQwA== X-Gm-Message-State: AMCzsaUNUOXFzPkHHXaZkAK8Nt42U5iYwwgUDiKuf967ty+utBwF/ldY Q7M8YbBYC87XFhkgwqJWntqczQ== X-Received: by 10.80.184.106 with SMTP id k39mr18450914ede.276.1509931572889; Sun, 05 Nov 2017 17:26:12 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id c32sm10258015eda.57.2017.11.05.17.26.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Nov 2017 17:26:12 -0800 (PST) From: Bryan O'Donoghue To: johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, keescook@chromium.org, linux-kernel@vger.kernel.org Cc: Bryan O'Donoghue , Mitch Tasman , greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.or Subject: [PATCH v2 1/4] staging: greybus: loopback: Hold per-connection mutex across operations Date: Mon, 6 Nov 2017 01:26:08 +0000 Message-Id: <1509931571-24621-2-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509931571-24621-1-git-send-email-pure.logic@nexus-software.ie> References: <1509931571-24621-1-git-send-email-pure.logic@nexus-software.ie> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit d9fb3754ecf8 ("greybus: loopback: Relax locking during loopback operations") changes the holding of the per-connection mutex to be less restrictive because at the time of that commit per-connection mutexes were encapsulated by a per-driver level gb_dev.mutex. Commit 8e1d6c336d74 ("greybus: loopback: drop bus aggregate calculation") on the other hand subtracts the driver level gb_dev.mutex but neglects to move the mutex back to the place it was prior to commit d9fb3754ecf8 ("greybus: loopback: Relax locking during loopback operations"), as a result several members of the per connection struct gb_loopback are racy. The solution is restoring the old location of mutex_unlock(&gb->mutex) as it was in commit d9fb3754ecf8 ("greybus: loopback: Relax locking during loopback operations"). Fixes: 8e1d6c336d74 ("greybus: loopback: drop bus aggregate calculation") Signed-off-by: Bryan O'Donoghue Cc: Johan Hovold Cc: Alex Elder Cc: Greg Kroah-Hartman Cc: Mitch Tasman Cc: greybus-dev@lists.linaro.org Cc: devel@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.or --- drivers/staging/greybus/loopback.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 3d92638..20d1b45 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -605,7 +605,6 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, op_async->ts = ktime_get(); op_async->pending = true; atomic_inc(&gb->outstanding_operations); - mutex_lock(&gb->mutex); ret = gb_operation_request_send(operation, gb_loopback_async_operation_callback, 0, @@ -622,7 +621,6 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, error: gb_loopback_async_operation_put(op_async); done: - mutex_unlock(&gb->mutex); return ret; } @@ -1013,7 +1011,6 @@ static int gb_loopback_fn(void *data) type = gb->type; if (ktime_to_ns(gb->ts) == 0) gb->ts = ktime_get(); - mutex_unlock(&gb->mutex); /* Else operations to perform */ if (gb->async) { @@ -1041,6 +1038,7 @@ static int gb_loopback_fn(void *data) gb_loopback_calculate_stats(gb, !!error); } gb->send_count++; + mutex_unlock(&gb->mutex); if (us_wait) { if (us_wait < 20000) -- 2.7.4 From 1583303689946424735@xxx Mon Nov 06 08:14:24 +0000 2017 X-GM-THRID: 1583032862773128812 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread