Module Name: src
Committed By: reinoud
Date: Fri Apr 16 12:58:54 UTC 2021
Modified Files:
src/sys/dev/scsipi: cd.c
Log Message:
Limit buffer size for device capabilities requests as a work-around for PR
kern/56109.
To generate a diff of this commit:
cvs rdiff -u -r1.350 -r1.351 src/sys/dev/scsipi/cd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.350 src/sys/dev/scsipi/cd.c:1.351
--- src/sys/dev/scsipi/cd.c:1.350 Wed Feb 10 16:30:01 2021
+++ src/sys/dev/scsipi/cd.c Fri Apr 16 12:58:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.350 2021/02/10 16:30:01 christos Exp $ */
+/* $NetBSD: cd.c,v 1.351 2021/04/16 12:58:54 reinoud Exp $ */
/*-
* Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.350 2021/02/10 16:30:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.351 2021/04/16 12:58:54 reinoud Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2695,15 +2695,13 @@ mmc_getdiscinfo(struct scsipi_periph *pe
struct scsipi_get_conf_feature *gcf;
struct scsipi_read_discinfo di_cmd;
struct scsipi_read_discinfo_data di __aligned(2);
- const uint32_t buffer_size = 1024;
- uint32_t feat_tbl_len, pos;
+ const uint32_t buffer_size = 0x200; /* XXX RPZ USB3 SCSI size issue */
+ uint32_t pos;
u_long last_lba = 0;
uint8_t *buffer, *fpos;
int feature, last_feature, features_len, feature_cur, feature_len;
int lsb, msb, error, flags;
- feat_tbl_len = buffer_size;
-
buffer = malloc(buffer_size, M_TEMP, M_WAITOK);
/* initialise structure */
@@ -2748,12 +2746,12 @@ mmc_getdiscinfo(struct scsipi_periph *pe
memset(&gc_cmd, 0, sizeof(gc_cmd));
gc_cmd.opcode = GET_CONFIGURATION;
_lto2b(last_feature, gc_cmd.start_at_feature);
- _lto2b(feat_tbl_len, gc_cmd.data_len);
- memset(gc, 0, feat_tbl_len);
+ _lto2b(buffer_size, gc_cmd.data_len);
+ memset(gc, 0, buffer_size);
error = scsipi_command(periph,
(void *)&gc_cmd, sizeof(gc_cmd),
- (void *) gc, feat_tbl_len,
+ (void *) gc, buffer_size,
CDRETRIES, 30000, NULL, flags);
if (error) {
/* ieeek... break out of loop... i dunno what to do */
@@ -2761,7 +2759,7 @@ mmc_getdiscinfo(struct scsipi_periph *pe
}
features_len = _4btol(gc->data_len);
- if (features_len < 4 || features_len > feat_tbl_len)
+ if (features_len < 4 || features_len > buffer_size)
break;
pos = 0;