Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp256838pxj; Thu, 20 May 2021 08:43:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5PbusoNxPOB8Qb/OIA8QFjjrYRzn0T1pAgo+4zKaVA4wxxZY08s+h5EjW8u7yUj8nSQvw X-Received: by 2002:a17:906:fcdc:: with SMTP id qx28mr5277185ejb.375.1621525406102; Thu, 20 May 2021 08:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621525406; cv=none; d=google.com; s=arc-20160816; b=hVv32CSSrzNPwk/bUyPD7yrcZ2onplpLGFP3eIPoQjRaEoVwbp7uDH0lw60NTh/TTb luqPjTQcsNVtdBVil5g4NHGsHPVeEQawgx8qr+r4LMIjeR2TPO93WN9rJJdMWNCcL99U 87PbH+aDfaR+e6iSWkE4Hp5gOltnpvDlZmWSGyGTCoNSuMejhDY38nRnI7q+lRke5FNK spHbZIew6zlnrdqZPKyR6SDV2VU30qBg9vwk06K9mslCxRq5TZxCLpsIzaqlvL6FhUN7 hvmiBYHKEwIzK9Z906o6XqJHf5w5DkqCswJTuQonxgWqFzFCqRRBcL/6aPDPctBztX/C VZZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1hm9ZSliv76JYMyQMyrSHyaeTo3WqosM6vP/HvZ5Uow=; b=m84YLU6ANXGm9Tz9q7YDNQ4T/c3a1EjrXcoPFJWF9NQ2un72oKvV2AZ5QIqtUDKec+ RLyIpkd0MEFH/sto+FEuxoRsEv2vS4F9r70KCDgO3Jt1MT0jw8VbAiun9p4va5k1Lvwm BHu45lwaejKmYfcsm/3WKkgEwHajkK1luEEsHBepk20a/23Sx077ENQTkHq/WmAweBZZ TfVRKK3PFv2KbT6qNajzh7m/9lyBJjOjqg6Q3hcApfdulXAHfZgi/Zx4tGgLkPbI3U2d 2wBBTA11C3m0/33eXC9asD06Fx3X5IOeyl8OT5eG0PNNKKHWA0isC5u1R7Q1TojIO24w fWlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gXOWZ+hK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si3001286ede.603.2021.05.20.08.43.01; Thu, 20 May 2021 08:43:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gXOWZ+hK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231815AbhETJhJ (ORCPT + 99 others); Thu, 20 May 2021 05:37:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:34686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbhETJev (ORCPT ); Thu, 20 May 2021 05:34:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD11461402; Thu, 20 May 2021 09:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621502960; bh=cBDFQ6T9nKMjY6cs3VgPOYNoVcPxNaiHvrAWiXC657Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gXOWZ+hKZfEyh1Gs9pP/BJ/fFKhKCWdS+9Yw1qCQ5XT0nRNFoRcdcgy9flcpIfx/E oe8/LV6GkrReWfpxW18AkPQg2o8JEPVj8qCnNVJPY+EUkRcLOV/Yl+kCWn+EEJ79IT /DW/xZoFJK6ag0bEXR64JyDQcRoOOi4aTpHtSXbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bodo Stroesser , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 23/37] scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id not found Date: Thu, 20 May 2021 11:22:44 +0200 Message-Id: <20210520092053.036261745@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092052.265851579@linuxfoundation.org> References: <20210520092052.265851579@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bodo Stroesser [ Upstream commit 9814b55cde0588b6d9bc496cee43f87316cbc6f1 ] If tcmu_handle_completions() finds an invalid cmd_id while looping over cmd responses from userspace it sets TCMU_DEV_BIT_BROKEN and breaks the loop. This means that it does further handling for the tcmu device. Skip that handling by replacing 'break' with 'return'. Additionally change tcmu_handle_completions() from unsigned int to bool, since the value used in return already is bool. Link: https://lore.kernel.org/r/20210423150123.24468-1-bostroesser@gmail.com Signed-off-by: Bodo Stroesser Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/target/target_core_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index d6634baebb47..71144e33272a 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1205,7 +1205,7 @@ static void tcmu_set_next_deadline(struct list_head *queue, del_timer(timer); } -static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) +static bool tcmu_handle_completions(struct tcmu_dev *udev) { struct tcmu_mailbox *mb; struct tcmu_cmd *cmd; @@ -1245,7 +1245,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) pr_err("cmd_id %u not found, ring is broken\n", entry->hdr.cmd_id); set_bit(TCMU_DEV_BIT_BROKEN, &udev->flags); - break; + return false; } tcmu_handle_completion(cmd, entry); -- 2.30.2