From owner-svn-src-head@freebsd.org Tue Sep 8 05:46:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B38A3E43A3; Tue, 8 Sep 2020 05:46:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BlvJz2FGLz4HSB; Tue, 8 Sep 2020 05:46:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 318C9BACB; Tue, 8 Sep 2020 05:46:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0885kAIO006784; Tue, 8 Sep 2020 05:46:10 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0885kAgk006783; Tue, 8 Sep 2020 05:46:10 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202009080546.0885kAgk006783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 8 Sep 2020 05:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365445 - head/sys/cam/mmc X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cam/mmc X-SVN-Commit-Revision: 365445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2020 05:46:11 -0000 Author: avg Date: Tue Sep 8 05:46:10 2020 New Revision: 365445 URL: https://svnweb.freebsd.org/changeset/base/365445 Log: mmc_da: make sure that part_index is not used uninitialized in sddastart This is a fix to r334065. Without this change I once got stuck I/O with endless partition switching: (sdda0:aw_mmc_sim2:0:0:0): sddastart (sdda0:aw_mmc_sim2:0:0:0): Partition 0 -> -525703168 (sdda0:aw_mmc_sim2:0:0:0): xpt_action: func 0x91d XPT_MMC_IO (sdda0:aw_mmc_sim2:0:0:0): xpt_done: func= 0x91d XPT_MMC_IO status 0x1 (sdda0:aw_mmc_sim2:0:0:0): sddadone (sdda0:aw_mmc_sim2:0:0:0): Card status: 00000000 (sdda0:aw_mmc_sim2:0:0:0): Current state: 4 (sdda0:aw_mmc_sim2:0:0:0): Compteting partition switch to 0 Note that -525703168 (an int) is 0xe0aa6800 in binary representation. The partition indexes are actually stored as uint8_t, so that value was converted / truncated to zero. MFC after: 1 week Modified: head/sys/cam/mmc/mmc_da.c Modified: head/sys/cam/mmc/mmc_da.c ============================================================================== --- head/sys/cam/mmc/mmc_da.c Tue Sep 8 04:44:37 2020 (r365444) +++ head/sys/cam/mmc/mmc_da.c Tue Sep 8 05:46:10 2020 (r365445) @@ -1808,6 +1808,7 @@ sddastart(struct cam_periph *periph, union ccb *start_ } /* Find partition that has outstanding commands. Prefer current partition. */ + part_index = softc->part_curr; part = softc->part[softc->part_curr]; bp = bioq_first(&part->bio_queue); if (bp == NULL) {