Received: by 10.213.65.68 with SMTP id h4csp1752481imn; Mon, 19 Mar 2018 12:17:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELtCaox/ewZTIVFgwbBLL1VBkbAJ+1J643tUJerdTHES6BHNOHnbvFhnjTdIk0p3j2/8hsTJ X-Received: by 2002:a17:902:228:: with SMTP id 37-v6mr13677388plc.141.1521487037789; Mon, 19 Mar 2018 12:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521487037; cv=none; d=google.com; s=arc-20160816; b=IsanrDbZR8yE7kW+A7LEF96SKgX0voStBkb/Bnrkxyv5Peh3/BKkKdx6Wzn2HuHdjC eUgkbZeN2s86+yYlmAKE+TjlMin8hBfUlCW/5VKosr2IgElHuvfolbMy2ogq3exbE+u7 XWpNEjyoPkbA7PrPPJB9FND+2I/zjWM0bvsudc1E0lEX0lacBi10o2Uik0F9M+bZK7pD aNXEtPBIUT3jGfXqUWpUsgvjwwev4pcJy9GiAYFXbDPL7RFSI2MTcNtjt+brwDoomkzf DjSJKDRo5p2d129eRLmOfBa3RmVfMH6jtHK+zUgyUFkyA48sx9o71hlzkJ80EO/gjaJC Ogrg== 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=H5hoqJdcTQBvWPbdQC234Ur74fz9ltLD6ZXCr34hAdU=; b=YuduBz6IBsmBNcRejzMJvnzo8j9ZEmk4IAG0GLmzULYcYw+va6ZnZG4ITU9vkk44Dw +mCLhxHXxKrgiW8FhRtlFqiQvS9XsbSsWz6G6METrm5CpLI5Xrm08Ouch/n+9SD2NHij vt8aVpBWqfR7hkDR7NrOrZTxlo7p+ZUyqpE+JQOfPU6e4pQYB/Pxm6beQdujjm0aENk9 +U1n5edav8Mbk9aIVNYL30yYn2RlIqzgRz+vgKwJbvY1bmEMtOx2FbbB5D+Zy9JEnABh vwUdFq9cCpSyqqSNlM/i+jtSaPHTltNMk73McCcGOsmfm/vZwKQymUpesNp26bZ8k59S H31w== 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 j62si369551pge.747.2018.03.19.12.17.03; Mon, 19 Mar 2018 12:17:17 -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 S970901AbeCSTPh (ORCPT + 99 others); Mon, 19 Mar 2018 15:15:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50850 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031647AbeCSS0f (ORCPT ); Mon, 19 Mar 2018 14:26:35 -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 28C7611AF; Mon, 19 Mar 2018 18:26:35 +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.9 194/241] scsi: core: scsi_get_device_flags_keyed(): Always return device flags Date: Mon, 19 Mar 2018 19:07:39 +0100 Message-Id: <20180319180759.187711196@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@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.9-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 @@ -596,17 +596,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;