diff options
author | James Bottomley <[email protected]> | 2020-11-28 15:27:21 -0800 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2023-02-21 17:44:06 -0500 |
commit | 3fe97ff3d94934649abb0652028dd7296170c8d0 (patch) | |
tree | 66dd5af93c610b2406bd9b360b428cf2975c19a5 | |
parent | 578797f0c8cbc2e3ec5fc0dab87087b4c7073686 (diff) |
scsi: ses: Don't attach if enclosure has no components
An enclosure with no components can't usefully be operated by the driver
(since effectively it has nothing to manage), so report the problem and
don't attach. Not attaching also fixes an oops which could occur if the
driver tries to manage a zero component enclosure.
[mkp: Switched to KERN_WARNING since this scenario is common]
Link: https://lore.kernel.org/r/[email protected]
Cc: [email protected]
Reported-by: Ding Hui <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r-- | drivers/scsi/ses.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 9d4fb09acc1e..b11a9162e73a 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -733,6 +733,12 @@ static int ses_intf_add(struct device *cdev, type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) components += type_ptr[1]; } + + if (components == 0) { + sdev_printk(KERN_WARNING, sdev, "enclosure has no enumerated components\n"); + goto err_free; + } + ses_dev->page1 = buf; ses_dev->page1_len = len; buf = NULL; |