From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752657AbcHKPKd (ORCPT ); Thu, 11 Aug 2016 11:10:33 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:22391 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbcHKPJo (ORCPT ); Thu, 11 Aug 2016 11:09:44 -0400 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: jejb@linux.vnet.ibm.com Subject: Re: [PATCH] SAS: use sas_rphy instead of sas_end_device to obtain address. From: James Bottomley To: Johannes Thumshirn , "Martin K . Petersen" Cc: Hannes Reinecke , Linux SCSI Mailinglist , Linux Kernel Mailinglist , stable@vger.kernel.org, #@suse.de, v4.5+@suse.de Date: Thu, 11 Aug 2016 08:09:35 -0700 In-Reply-To: <1470902352-96734-1-git-send-email-jthumshirn@suse.de> References: <1470902352-96734-1-git-send-email-jthumshirn@suse.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16081115-0040-0000-0000-0000010964C1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005577; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000181; SDB=6.00743219; UDB=6.00349945; IPR=6.00515772; BA=6.00004658; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012312; XFM=3.00000011; UTC=2016-08-11 15:09:41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16081115-0041-0000-0000-000004E3D04E Message-Id: <1470928175.2334.9.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-11_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608110196 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2016-08-11 at 09:59 +0200, Johannes Thumshirn wrote: > Since commit 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS > enclosures') ses_match_to_enclosure() is calling sas_get_address(), > which is coming from commit bcf508c13385 ('scsi_transport_sas: add > function to get SAS endpoint address'). sas_get_address() itself > calls sas_sdev_to_rdev() which BUG_ON()s if a given scsi_device's > rphy is not a SAS_END_DEVICE. Is the BUG_ON the problem? you're supposed to gate this call with is_sas_attached(). > As SAS Enclosure is a SAS expander device, This isn't necessarily true. There are several separated enclosure chips even in the SAS world (although most of the new ones are integrated). > we really shouldn't tie the lookup of a SAS address to the SAS End > Device but the sas_rphy, which holds the address information. This is conceptually wrong. A wide end device may have many rphys forming a port. In that case the end device address is likely to be only one of the rphy addresses ... how do you know this code picks the right one? > Fixes: 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS > enclosures') > Cc: stable@vger.kernel.org # v4.5+ What's the actual bug being fixed here? James