Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/scsipi Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/ac3e48e50827
branches:  netbsd-9
changeset: 359943:ac3e48e50827
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 01 11:41:29 2022 +0000

description:
Pull up following revision(s) (requested by reinoud in ticket #1421):

        sys/dev/scsipi/cd.c: revision 1.351

Limit buffer size for device capabilities requests as a work-around for PR
kern/56109.

diffstat:

 sys/dev/scsipi/cd.c |  18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r 9ff55a3af6f5 -r ac3e48e50827 sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c       Tue Feb 01 11:35:45 2022 +0000
+++ b/sys/dev/scsipi/cd.c       Tue Feb 01 11:41:29 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.342.4.2 2021/02/11 12:53:28 martin Exp $      */
+/*     $NetBSD: cd.c,v 1.342.4.3 2022/02/01 11:41:29 martin 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.342.4.2 2021/02/11 12:53:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.342.4.3 2022/02/01 11:41:29 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2695,15 +2695,13 @@
        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 @@
                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 @@
                }
 
                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;



Home | Main Index | Thread Index | Old Index