From nobody Fri Jul 08 03:50:45 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3089217FBC27; Fri, 8 Jul 2022 03:50:46 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LfK7V10jRz3Jxd; Fri, 8 Jul 2022 03:50:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657252246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kYhggjuTr1OI2lMm4DnQKBUuJlIOANrTfSmWtqi7yG8=; b=UvCi04cq4oN7KGSedMX7hinGtuYpqTvs/HFRgZLqfEmMxuvGqvN3+xV27tjwZi14Bqt1uN GjGBnheUF6soaeGUdfTQ09O9sPRlWLqDH8KfXhBJWaGxVfBX07Sv50MFFyMpMBHeltnJ3Z aWWuyCQbHZzEsEgXbpSADoXELcU7D37blEsZYgwgLhDIMMrfoGLymR+5MVonr1G1dWFhaH jGS2nYkyLg3L7QKcD23PxeyPUVTETcjsL+yrXbLyvENwiWvTOECqz1m6EN4dvim/oFKKKW RbV8aau2uDyCwjhl232/MtdJNftVvKwL4N2K3jXn/lKKe4rklhqYCbxZZWhq9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LfK7V05f2z17Rh; Fri, 8 Jul 2022 03:50:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2683ojnw032183; Fri, 8 Jul 2022 03:50:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2683ojeH032182; Fri, 8 Jul 2022 03:50:45 GMT (envelope-from git) Date: Fri, 8 Jul 2022 03:50:45 GMT Message-Id: <202207080350.2683ojeH032182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: c4995b69db93 - main - ipmi: fix a use-after-free bug in error handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4995b69db93fdab5fe375eae129aeff1cbca1bb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657252246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kYhggjuTr1OI2lMm4DnQKBUuJlIOANrTfSmWtqi7yG8=; b=nirwlCNl1kVk+/pavqjsQBtehQ4IrTfc6VTpLoB5QZ7dSwn6sH/HrsbVTguhb6bjzmXhbo I6vKE8oZ1HsDxbdI8n3me/obXQ2GWQvbva665WV4B2aqQZypAa9e5WJwrMgaXTQCcFW5j1 /gS6sS2WppJmFPsZmwt00l8iFSKg87IpPUbtFBCT4HuxVXz66sLJ2KZkFNDvF+1KZgiXX8 /sE1g4BbyGBAre6tVxcAIPxz0MM8z4NMIpeDr/xAOmwPB+pFLn2WlyLGspoBgAkJnF50Kd +oHwEdZDtz5JWYDdZP6toYYG+9NG98XDP+SGQBIWeAIGhjt3t8ONsp8ybKyO+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657252246; a=rsa-sha256; cv=none; b=utxQ5Fh8xU/wUgIeJCwF8W/1OcRXPiFRsBvY2Y8Lhvd4+d93qtVtOkShqOFE2GU5jpdnLf o/94bhqK9BncMwzI3YhEj9RNXW0hqIKYcawvg4Y9TkVYRAYD0vuUinWwRN4nbviyCLvqzb zD7ikQJ2A3F6FlCEdWY2ArsAspJwSb/7P4LAKGQZ7d3IrKCCFxvi+fRsfwwleYbMPXe9bU ELts+rB4UbZ0qu8QLPOMiNQ2CbZnTEbGGlzLIXNpvwPzI3LVQ+91gLJN00ZreTYmfDHCQb p+Jj6LAdUhrxIjXJa8QDkOpRCw7vJTwnnb4s0tcIoFKMIvDQEQvnwug8iYLywg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=c4995b69db93fdab5fe375eae129aeff1cbca1bb commit c4995b69db93fdab5fe375eae129aeff1cbca1bb Author: Philip Paeps AuthorDate: 2022-07-08 03:49:54 +0000 Commit: Philip Paeps CommitDate: 2022-07-08 03:49:54 +0000 ipmi: fix a use-after-free bug in error handling 18db96dbfd4a09063a0abcefd51fa8d2aeb115d6 introduced a use-after-free bug in the error handling of the IPMICTL_RECEIVE_MSG ioctl. Reported by: Coverity (CID 1490456) (via vangyzen) Differential Revision: https://reviews.freebsd.org/D35605 --- sys/dev/ipmi/ipmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index 7afafa492b6f..fd264dfc4c27 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -388,12 +388,13 @@ ipmi_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, return (EAGAIN); } if (kreq->ir_error != 0) { + error = kreq->ir_error; TAILQ_REMOVE(&dev->ipmi_completed_requests, kreq, ir_link); dev->ipmi_requests--; IPMI_UNLOCK(sc); ipmi_free_request(kreq); - return (kreq->ir_error); + return (error); } recv->recv_type = IPMI_RESPONSE_RECV_TYPE;