From nobody Thu Dec 26 14:52:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1707200279; cv=none; d=zohomail.com; s=zohoarc; b=SNy7CWcp4YmpzT4gvWvnuazaPcGA0TGTPPmADUsHuMrguagiz4LoXsOQqebaI8+VolCKWssy3QSWj71Izyw5y175TeV6H+xi+/MVnKVgwgBmozWV83O5hW5jP4a3C3qmWiZPROjCLBN8/h3vywlUMOn7UedQPHkNFc4MXyitR7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707200279; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=15V5eFj2jLAbKEF5egEw/9Nn2ao4TpiAAM6VXmsstgs=; b=nAi+1227Z8YnjxjGF0xm55752uNo0PWUGHS6yXbmQ59liZa0tYuQ3rbfRLvbCuipsAonNzZGaM7wcX/rIXwd+8mzkNgbys4XYYnIUirOUcbJexf7u66ZPTvaZVVTLb6fXT5MPdtU96BUuQhi+CogI7hasM1pjy4E0OmWMBmBNVk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17072002793661012.9489124960422; Mon, 5 Feb 2024 22:17:59 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.676647.1052863 (Exim 4.92) (envelope-from ) id 1rXEm1-0004kp-Qd; Tue, 06 Feb 2024 06:17:37 +0000 Received: by outflank-mailman (output) from mailman id 676647.1052863; Tue, 06 Feb 2024 06:17:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rXEm1-0004kX-Lo; Tue, 06 Feb 2024 06:17:37 +0000 Received: by outflank-mailman (input) for mailman id 676647; Tue, 06 Feb 2024 06:17:36 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rXEm0-0004kB-98 for xen-devel@lists.xenproject.org; Tue, 06 Feb 2024 06:17:36 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 68b6be2e-c4b7-11ee-98f5-efadbce2ee36; Tue, 06 Feb 2024 07:17:32 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4972E21FC2; Tue, 6 Feb 2024 06:17:28 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1015713786; Tue, 6 Feb 2024 06:17:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id E+1kAvjOwWWmPQAAD6G6ig (envelope-from ); Tue, 06 Feb 2024 06:17:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 68b6be2e-c4b7-11ee-98f5-efadbce2ee36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1707200250; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=15V5eFj2jLAbKEF5egEw/9Nn2ao4TpiAAM6VXmsstgs=; b=MDKwijcSTZSjPiSNoI6oMeSvn1EOmCiDJVsnqHVG31lmMGrHjdBKZ/cBL4kju1aOzzQTbz TDRKzOkKQnkF9RlSs56DYGSudNprjl46yXO6bL+LKnWkeZXjcHUrxFvN5q6WgfgzD9FFtm QwtcshgFXo3TFyMJSHWFGorAgTjj0b4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1707200248; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=15V5eFj2jLAbKEF5egEw/9Nn2ao4TpiAAM6VXmsstgs=; b=reB0C4nyfUk2/9p7m4JG9ILrEUd3B7b64VcDhi6c1Yk+cLQdR05DFDZSak0mk4jJESXmf7 cSEIM/RSI/Jfskc36Nb1NXojIcmOFBocwp0y/WdhdBb12xUCS9FH7YfeqRznZ+9IEvgrpd aAa6wIF3DKH294LdUPuz7+HM7Qc6MWs= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, julien@xen.org, Juergen Gross Subject: [PATCH] Mini-OS: fix 9pfs frontend error path Date: Tue, 6 Feb 2024 07:17:21 +0100 Message-Id: <20240206061721.27297-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=reB0C4ny X-Spamd-Result: default: False [4.69 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[xen.org:email,suse.com:dkim,suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[22.69%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: 4.69 X-Rspamd-Queue-Id: 4972E21FC2 X-Spam-Level: **** X-Spam-Flag: NO X-Spamd-Bar: ++++ X-ZohoMail-DKIM: pass (identity @suse.com) (identity @suse.com) X-ZM-MESSAGEID: 1707200281186100001 Content-Type: text/plain; charset="utf-8" The early error exit in p9_stat() returns without zeroing the p9_stat buffer, resulting in free() being called with an uninitialized pointer. Fix that by doing the zeroing first. Reported-by: Julien Grall Fixes: 2d1dfccd3aa3 ("Mini-OS: add read and write support to 9pfsfront") Signed-off-by: Juergen Gross --- 9pfront.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/9pfront.c b/9pfront.c index 315089bc..33eaadce 100644 --- a/9pfront.c +++ b/9pfront.c @@ -716,10 +716,11 @@ static int p9_stat(struct dev_9pfs *dev, uint32_t fid= , struct p9_stat *stat) uint16_t total; int ret; =20 + memset(stat, 0, sizeof(*stat)); + if ( !req ) return EAGAIN; =20 - memset(stat, 0, sizeof(*stat)); req->cmd =3D P9_CMD_STAT; send_9p(dev, req, "U", fid); rcv_9p(dev, req, "uuuUQUUULSSSSSUUU", &total, &stat->size, &stat->type, --=20 2.35.3