Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4779577ybp; Mon, 7 Oct 2019 13:55:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqygxnXnziR4lhXYvkSdT7W8vukYrF5J9oIH8Lyoqsx2jBidULE6VexdCxmMqhPPGSMacM7d X-Received: by 2002:a17:906:6888:: with SMTP id n8mr6963338ejr.201.1570481716991; Mon, 07 Oct 2019 13:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570481716; cv=none; d=google.com; s=arc-20160816; b=dQEMMcOn63zmJMagNnj5zpfUIvGjK8k298gslPF97YvxXibk8+5ff45lX+BXDdK9Uc k3gJJuGjgM9DDFl0gaQmeNYBPYttHCmwEthKe+mzn7lbtYNQJeWEyzqDQdAKDumchSol k0AoTCNAjX3+RzfOQ99o0K7d6Diwn2E7N1HjPKIoKDgMh/Z8qSDP3u0loN8jXLIk0u/l wBezM2GahitLapnMLMiAwL/Tme47KDfyB+T5jbQLNN68xR4M66NXa8mNjjFU8D5e4it0 kYkO+131lw2f1Ohzg4XENoCiMxBy9MAhu3m23mdMefqI6dwETxB2nrAakcQR2bVmjZ3p TBtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:to:from:subject:message-id; bh=hRz9awH7gq6biyaX6o8c3EBVHxvMKpEaJOF9dyhctgY=; b=A/MAOOyj7RZib3j1hDT7zg8B5bii0ilmj1oi8CGupJ9+Zk8UkCAgsuRoo2pPjcfc84 /nGPba4nR58OFiy4n14Hg6V6tU/rJAXqTR2kwOjolV51lBvzbunPm+lZWFKEtqJeFlDc Dc0GUIv0iJlIEGTdaemYAjMlkuFs8X/nhlsAbpYf1ukAt/otK3q7zI+PIAytXyftzQ1/ AOuUrO9QwXYRfhx57BBGZ8pBIEJKedtnqQjONDD8U5C10DFwJmbp4nTXwtIQuxwBM6+K Pid/bHWeXAyboQGKvKt0jL6WfJbwpiYybXHuC1OATdY7dRfro34wF3aTzjP0AxBqDc6v CPog== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si7814708eju.333.2019.10.07.13.54.53; Mon, 07 Oct 2019 13:55:16 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728937AbfJGUyh (ORCPT + 99 others); Mon, 7 Oct 2019 16:54:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40950 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728273AbfJGUyh (ORCPT ); Mon, 7 Oct 2019 16:54:37 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x97KqPrs035748; Mon, 7 Oct 2019 16:54:30 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 2vgc9013v0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Oct 2019 16:54:30 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x97KnURr016023; Mon, 7 Oct 2019 20:54:29 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma05wdc.us.ibm.com with ESMTP id 2vejt740hr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Oct 2019 20:54:29 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x97KsSis47317368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Oct 2019 20:54:28 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8196AC05B; Mon, 7 Oct 2019 20:54:28 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD35CAC059; Mon, 7 Oct 2019 20:54:27 +0000 (GMT) Received: from jarvis.ext.hansenpartnership.com (unknown [9.85.184.117]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 7 Oct 2019 20:54:27 +0000 (GMT) Message-ID: <1570481667.4242.4.camel@linux.ibm.com> Subject: Re: Potential NULL pointer deference in scsi: scsi_transport_spi From: James Bottomley To: Yizhuo Zhai , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Chengyu Song , Zhiyun Qian Date: Mon, 07 Oct 2019 13:54:27 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-07_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=921 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910070184 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-10-07 at 13:30 -0700, Yizhuo Zhai wrote: > Hi All: > > drivers/scsi/scsi_transport_spi.c: > > Inside function store_spi_transport_period(), dev_to_shost() > could return NULL No, it can't. The device model ensures that a SCSI target or device must be parented to a host. James > , however, the return value shost is not > checked and get used. This could potentially be unsafe. >