From patchwork Wed May 23 02:27:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Elmously X-Patchwork-Id: 918705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rGgY44t6z9s2S; Wed, 23 May 2018 12:29:45 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fLJWz-0003D9-V9; Wed, 23 May 2018 02:29:38 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fLJWv-00038w-NY for kernel-team@lists.ubuntu.com; Wed, 23 May 2018 02:29:33 +0000 Received: from mail-io0-f199.google.com ([209.85.223.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fLJWu-0007sY-Be for kernel-team@lists.ubuntu.com; Wed, 23 May 2018 02:29:32 +0000 Received: by mail-io0-f199.google.com with SMTP id h70-v6so16503732iof.10 for ; Tue, 22 May 2018 19:29:32 -0700 (PDT) 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=c0GQ0i51FoPE8beU0yt7uVrIFxjgu4g02EcBSm+bdnI=; b=osiPfLgX3SsRwlf2H4i5vgtE8ezgZGHG/mEmaU0SKGlotXNd1RIizwbhUK84xBBviT WVL3SjHbLbQjsgfUPUvqun3dWyEbjmXpNDS9txf508mv6N2qLkv2/TIIQ9ubvS6qDNlW Ud1LexHurstwBiIqr5zXpqwNVCzrfEebQqJkksYIdCmu2ff2EgNbL4dGHgAZjxCpQkJj kvfG3cpGH7iI78JdLFz4Ahj/HRJS+0JZ3kEOiCsOk9QxVpndi+Izwc2EqchhvWOCgq/g cYcCzAiJE0qnL9q8fWoQm0qlpgxGRb+7RBvVcKwYVgsS9hs9kUX5k9NKr5dE3ojDd6yj zYGw== X-Gm-Message-State: ALKqPwe5qJXpfZ5jAsd4VORj2u/nVU0q104rj3x2P0v2w152gAPge9up hohRN+bo2jtkB+Uv/PfFAvEZYgVtpdXU4DV7ihE6qGgpW2XPfccLMfe7YqwKNHFew+QZN/g3STr 1NMTO4yPvD4Hao5gZkzjwtU61mdvPSGosLz2prNY/tA== X-Received: by 2002:a24:4e50:: with SMTP id r77-v6mr3765258ita.7.1527042571019; Tue, 22 May 2018 19:29:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpZJXKZXpYTT3B/P/wqLEGPBK6HBDQoSEFjDHjj+j5W4jQhJUWpi8Ay7HiJpUXIrY6rDcJ6VA== X-Received: by 2002:a24:4e50:: with SMTP id r77-v6mr3765249ita.7.1527042570855; Tue, 22 May 2018 19:29:30 -0700 (PDT) Received: from kbuntu.fuzzbuzz.org (198-84-180-15.cpe.teksavvy.com. [198.84.180.15]) by smtp.gmail.com with ESMTPSA id m16-v6sm9428605iob.69.2018.05.22.19.29.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 19:29:29 -0700 (PDT) From: Khalid Elmously To: kernel-team@lists.ubuntu.com Subject: [CVE-2017-18232][A][PATCH 09/11] scsi: libsas: use flush_workqueue to process disco events synchronously Date: Tue, 22 May 2018 22:27:57 -0400 Message-Id: <20180523022759.22556-10-khalid.elmously@canonical.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180523022759.22556-1-khalid.elmously@canonical.com> References: <20180523022759.22556-1-khalid.elmously@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jason Yan CVE-2017-18232 Now we are processing sas event and discover event in different workqueues. It's safe to wait the discover event done in the sas event work. Use flush_workqueue() to insure the disco and revalidate events processed synchronously so that the whole discover and revalidate process will not be interrupted by other events. Signed-off-by: Jason Yan CC: John Garry CC: Johannes Thumshirn CC: Ewan Milne CC: Christoph Hellwig CC: Tomas Henzl CC: Dan Williams Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen (cherry-picked from 517e5153d242cb2dd0a1150d2a7bd6788d501ca9 ) Signed-off-by: Khalid Elmously --- drivers/scsi/libsas/sas_port.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index 93266283f51f..64722f42b256 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c @@ -192,6 +192,7 @@ static void sas_form_port(struct asd_sas_phy *phy) si->dft->lldd_port_formed(phy); sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); + flush_workqueue(sas_ha->disco_q); } /** @@ -277,6 +278,9 @@ void sas_porte_broadcast_rcvd(struct work_struct *work) SAS_DPRINTK("broadcast received: %d\n", prim); sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); + + if (phy->port) + flush_workqueue(phy->port->ha->disco_q); } void sas_porte_link_reset_err(struct work_struct *work)