From: Alan Stern Date: Wed, 27 Jul 2005 18:43:46 +0000 (-0700) Subject: [PATCH] scsi_scan: check return code from scsi_sysfs_add_sdev X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b24b1033451fcc87087a692fc47ca45daebd51ac;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [PATCH] scsi_scan: check return code from scsi_sysfs_add_sdev Adds a missing check for an error return code from scsi_sysfs_add_sdev. This resolves entry #4863 in the OSDL bugzilla. Although in that bug report the failure occurred because of a confusion over scanning vs. rescanning, in general add_sdev can fail for a number of reasons (the simplest being insufficient memory) and the caller should cope properly. Signed-off-by: Alan Stern Cc: James Bottomley Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index ad3a5b14246..2d3c4ac475f 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -756,7 +756,8 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) * register it and tell the rest of the kernel * about it. */ - scsi_sysfs_add_sdev(sdev); + if (scsi_sysfs_add_sdev(sdev) != 0) + return SCSI_SCAN_NO_RESPONSE; return SCSI_SCAN_LUN_PRESENT; }