Received: by 10.213.65.68 with SMTP id h4csp1716644imn; Mon, 19 Mar 2018 11:17:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELvQS86R4n1FburUdctDxKlr7EIm71GbBDlF45yx6X6BzsFGY9Q2v6I/qs96eNiybo06Sm7l X-Received: by 2002:a17:902:a516:: with SMTP id s22-v6mr13155400plq.191.1521483450162; Mon, 19 Mar 2018 11:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521483450; cv=none; d=google.com; s=arc-20160816; b=bMruNIwyn7b7aYM3TVvHGRKeJ2yG6IrE3zB3AjXz70h8IC7/vypfDHUjAKvUtSyJM7 YEmjz1/jWWQSIhC3VSFE73P/yU/OH2fro0rRXibIxfqpo0cj1QVImFYII2Vl4eOghY+a 3cMdHK4nZtaoZmaO4lsmegkkaYSz5uWoJx0ax4qu3GcSht9V9Iuxpm83e917lTmN6Gr3 u8Q/gM3CTqEjhCbU445CK9exPIrjidtncCywa8+pzzMtpXVZHxLBSjPaFV6l1dex1g54 EdAIu2tg2jOEEq9gTJuHcUXLLtqSUL6T6Urn9BvlqkqgozfPEul3BuuDDlKS0jXhMr/h 8GDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+0prhnoKR1LBgL/9pBJmYbcPRE5MDybbdFhLO/oX38o=; b=NS0OmDVmWxNl+MdaRtZ0yZKyJZRLE9vE3FIdfvQ7VffcsEqsNykecS13TzTbP91V+e FL+oNcFRzbGILP6QEyGvXqq5tEcHX5+esBAgwJMdJwkf+pZPE6Z6UOGIJoayPLL/ngB5 U10UfAA4HB7cW0ZBMQsggW5hu1RW9ORXkXg4eX1DgCIJHAGb7dwbZodDUJQa+Eu8CPgr 4GviJxGjBQ9SoBfDHoaI4rzO/9CJ88nH3V1lD0DRlK+6VBEScGBZyuKOY1LCe92x+CRl RpiJg7t86qcJaGG3Zui8Oew3WzfJQ4ibLjYJCzuEzdG52bpRc3KefKw4VrFiZCMh/10P GbFg== ARC-Authentication-Results: i=1; mx.google.com; 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 80si311286pfj.22.2018.03.19.11.17.16; Mon, 19 Mar 2018 11:17:30 -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; 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 S1030609AbeCSSQM (ORCPT + 99 others); Mon, 19 Mar 2018 14:16:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44880 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968907AbeCSSQG (ORCPT ); Mon, 19 Mar 2018 14:16:06 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A1D9B11A0; Mon, 19 Mar 2018 18:16:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Christoph Hellwig , Hannes Reinecke , Johannes Thumshirn , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.4 097/134] scsi: core: scsi_get_device_flags_keyed(): Always return device flags Date: Mon, 19 Mar 2018 19:06:20 +0100 Message-Id: <20180319171903.260705907@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche [ Upstream commit a44c9d36509c83cf64f33b93f6ab2e63822c01eb ] Since scsi_get_device_flags_keyed() callers do not check whether or not the returned value is an error code, change that function such that it returns a flags value even if the 'key' argument is invalid. Note: since commit 28a0bc4120d3 ("scsi: sd: Implement blacklist option for WRITE SAME w/ UNMAP") bit 31 is a valid device information flag so checking whether bit 31 is set in the return value is not sufficient to tell the difference between an error code and a flags value. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/scsi_devinfo.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c @@ -589,17 +589,12 @@ int scsi_get_device_flags_keyed(struct s int key) { struct scsi_dev_info_list *devinfo; - int err; devinfo = scsi_dev_info_list_find(vendor, model, key); if (!IS_ERR(devinfo)) return devinfo->flags; - err = PTR_ERR(devinfo); - if (err != -ENOENT) - return err; - - /* nothing found, return nothing */ + /* key or device not found: return nothing */ if (key != SCSI_DEVINFO_GLOBAL) return 0;