Received: by 10.223.164.200 with SMTP id h8csp645006wrb; Sun, 5 Nov 2017 17:35:25 -0800 (PST) X-Google-Smtp-Source: ABhQp+Sv7RAFPBe3Emo1LCk+s43OUEh8nc6HDeNU2Y/CnMBRc3xPtQAtoouXlqyZRRy6V5cs7RDq X-Received: by 10.84.237.9 with SMTP id s9mr12996400plk.417.1509932125508; Sun, 05 Nov 2017 17:35:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509932125; cv=none; d=google.com; s=arc-20160816; b=otZxQTl2X4bDiJFTV5zpB3b8Q1LazplAqEUpSjIncjSHYDieNtMk3YtVMiOiqHg/V0 aieLIkxbpSnfeNhbKdcfuY3E+RTWNnf7KZz71dHuV58YdbR6LXhBUMMhH0woi9ZtlAq2 d+VtvlFX3gxQMEMDzWXFQm58IWKNdAFKO/aKTzcp6SYDX1l9mTccaB3SyXdRhfCfxc9b 4WzfVE+LhGtv7leSPyRNJCuO416tKXtFIXx/xyShz7TtvUukf2nzl1cCBw4VD+iBACrx tDdqghHiSp9vsiT1icgBM0MkQAyu8RZTecPAS5RTnvwd4sXqYlunPD0fFOibmksrFUVh LZLQ== 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=PIwwvdFPi+Zwjdf5Ir2kIoqpAfyosiIukRPBdTXrF5A=; b=IumL6oykw3kIrCmaGkSqH9LHDlYuc+81PX7BnqHGdEd36hmN2KtKlVItqQWaubM0f5 PNkswZIIEJsDVhgHT5x3ydavIExJtCkSILgj3xgL0vwMV4VJs1YoNA1iiDzXprkdLMpi jJ8iT3MW41rGq+wHD7H3K1HbQU+hsPNHV2w2KoPcBy0iu0oHjahu5F8lUcgjva65lQCh 3+q4PaZN8mPgrKGwyPN8/dLstxlVqUxBmlgSsQLeeVckWNFVTdg2a7Da7o8H9fy8vNan pvqO7mHCcHUQUtUnfRliZBCtsA6bW40HgbI3QxGWFxfGjLEcmxJJMvqTVvv3rh6o9lHQ Rr+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=VmkcYhea; 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 d8si11548434pfj.158.2017.11.05.17.35.12; Sun, 05 Nov 2017 17:35:25 -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=VmkcYhea; 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 S1751897AbdKFBdG (ORCPT + 96 others); Sun, 5 Nov 2017 20:33:06 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:50741 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbdKFBcZ (ORCPT ); Sun, 5 Nov 2017 20:32:25 -0500 Received: by mail-wm0-f68.google.com with SMTP id s66so10685278wmf.5 for ; Sun, 05 Nov 2017 17:32:25 -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=PIwwvdFPi+Zwjdf5Ir2kIoqpAfyosiIukRPBdTXrF5A=; b=VmkcYhea1MoFAKdPeZHZlLB1TQZqNYYcKbtdO74zjYjUbuh5FU/NVD0BekeD8dZkLg Xqlme98ppA1oXdrJPlifF+2jLOFXv1+riFlDdhmL9vot4DmtmePtRV39FhjlIqPWoP5d Eg1/dGrT1+9e2HWo3Ysf2c+CwextqMk74j2gpoWnsterptxNpicWB1h9gWZ+Deewa/SO Muw2fGV7ImCUvwLIhkAH2Qcw2UeEXppEwbFkmJ8i5q5kuHNe7sIxjFBk7cJquPJ0Glyw ACHlk7Mt3eOLkqn12l7Osk9XFwg4nLf8yewiFupsF1cqrKQ7UdmVkOKh86/CR6Ah5iOw WveQ== 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=PIwwvdFPi+Zwjdf5Ir2kIoqpAfyosiIukRPBdTXrF5A=; b=j78iEDhxiNt71rruQJcWzRMGAQoGGCbD7qh5JQaSwG9mc/24Qnpw9Cls9pd9wrRFD2 iXFmCHR6czM8iZplEWt4t8LIX1TEqHYKuH89rTE6qtc+k/lZ7Bl4Yg12/S7asF8CHcqJ 81L6UNEhfSRPfOp0vw/cGtkEQbI+v9I8RA+VU6LgjtIvRan0YkF7KFKl5oQwEZQE4hWZ WdVnS8ZHi7KFgcWxxRAc3SeuTz8kKD1YAwrVMuZDAgPDqoerUUxEQrJdeISzYBfrrCjN A+ns5GSL9aTCPvlWL84RhKFN5WD8J43CGH05Kb1xU5JIBiE8MUubDjDvdG+G8Gy4Aeay XGQA== X-Gm-Message-State: AMCzsaVBA7rQfP+CYppVgVV7OFqiqMQyyINuYV11mI/l3UZ/xv45KWN0 BAM12B0RxU20gRNTomKQRKqCWA== X-Received: by 10.80.209.210 with SMTP id i18mr18465606edg.213.1509931944788; Sun, 05 Nov 2017 17:32:24 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id c7sm10603213edc.26.2017.11.05.17.32.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Nov 2017 17:32:24 -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 Subject: [PATCH v3 1/4] staging: greybus: loopback: Hold per-connection mutex across operations Date: Mon, 6 Nov 2017 01:32:19 +0000 Message-Id: <1509931942-25712-2-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509931942-25712-1-git-send-email-pure.logic@nexus-software.ie> References: <1509931942-25712-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.org --- 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 1583278151262820801@xxx Mon Nov 06 01:28:28 +0000 2017 X-GM-THRID: 1583278151262820801 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread