Received: by 10.213.65.68 with SMTP id h4csp499989imn; Fri, 16 Mar 2018 09:37:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELsBcfS5Z5DhMNRkyrq+VvBLpcDxSSOMaH6wJpt2+sCeicMrvRvI/nd6uxRwH54AFXUx23A0 X-Received: by 2002:a17:902:67c8:: with SMTP id g8-v6mr2823934pln.106.1521218245222; Fri, 16 Mar 2018 09:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218245; cv=none; d=google.com; s=arc-20160816; b=E6cbe2LiYArqAfv3JDGKYCiBipLzzBWyfHSV9tAhYoCLhmTqKpBPtQql6OjVqe6Ph1 5g8fQQ70vkuAiFPflZ3cAA0rzpduCXg0jgqULhmcqXhUTT1NmW2MfylcIdN31kJfzXBl 45D15B0aR4oIHJQtIk3h24D/4/YIjDOD9tB9jowJ7bFFhTJnUMR7NywEMDfxVFWnNtsx rq8bR04MiGJsHbJ0Nw3WrZcAV7/yvbQNe0z0R5suAPNCiuYn4ko2fDVG4r5gMWEXVqp7 sMbrxia85ZfkteH3J2DvnIDMMnBU1Cq9h43kLF37PlX5wpo/bircNfp4WQakP56heNbR nQ3A== 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=SkWRxqovN4ALoiQCVv8HRiLpkcjt8cQTRSPaRqvgsXM=; b=rnps/LVfVVGuRI6Ypw0bKcMXo+kpEfw+gOJKBfFwjIAKvwzEHNH3aZFyJ8ARzqsqSx 2TbIU4pFuPuLoSfAZ/6uZsUfScw0lwYwnSu0JvUXsXSJH5UuRfCeldysLUG32npoaNf/ yRoljlnfizTbUEaSbPpEwJFubUjAop4iWDnRw1gZzqq/eOA5F8bdjKIoNJKJlS+pLjA6 pf1WecLCV0uslpFQUEOQdDvGbdHfij42QZsRl0oYkV+brckO1yOzbyqpRjUVd7YSsHFw OUXz+sY85FIIo4za3Z89U9BtH7j28U6sts2uemFHJofsmR5pezPP163+o37X5J/Raprt aLSA== 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 t66si5281645pgc.606.2018.03.16.09.37.11; Fri, 16 Mar 2018 09:37:25 -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 S1752965AbeCPQgB (ORCPT + 99 others); Fri, 16 Mar 2018 12:36:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41778 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934067AbeCPPhs (ORCPT ); Fri, 16 Mar 2018 11:37:48 -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 B89F1124D; Fri, 16 Mar 2018 15:37:30 +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.14 082/109] scsi: core: scsi_get_device_flags_keyed(): Always return device flags Date: Fri, 16 Mar 2018 16:23:51 +0100 Message-Id: <20180316152334.415032962@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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 @@ -595,17 +595,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;