From patchwork Tue Apr 16 12:34:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Albershteyn X-Patchwork-Id: 13631779 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AAEA1D530 for ; Tue, 16 Apr 2024 12:35:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270935; cv=none; b=NgQHeebuEU/tNjCIfNtmQWe54fyzUFk2JiyjFjlHrcqbrzE2XlcIqNJHvz2b/TJe8Oq9+hFLqBu+EYiExg3W1hNBf0zibyJogz9hSWe7XDMOmSwj3+hXCQxZFiXyODFfOT/VsAhaor23CeED1NurNWUz0LRnudWPjoiov7pdZVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270935; c=relaxed/simple; bh=3ascfFz0yJ9DW3L4FpFS11QKO1uIcAFtys3gVzj85VM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j8wHh7sHr7F9urEENh296IbUc81c1Nt0qTPhCwZc3ACdswcXNRZ7s85at8acYWivKq2R1/pxKVVHaYjHnTqor/P9OZltgks7QJJ1wk372/I153QU4kq1VeP0b2jQOXBid0z1dYNC7OGQNS6Ah9TMkQBd7rnWAlJyecZzDpT6u1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gBo3H6Dc; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gBo3H6Dc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713270933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x6zJZ26n/NMVKGNdDpKks9wqLSHav9BWg6+5RJ8ZRMg=; b=gBo3H6DcgLrLwSsJosvw8LKnw/ymH8CcK2/2lH9XTDGirweIcJFd3h4wMW440pFz7zXTu6 Ki/KjVjiRqSDTIFssoNvMI+H3tDNMSlD6WFPKxpnOxgMFI+9BNFgoHxUfaA3xHMF+gr348 q2NlPkceUH6688AKyXA6kVyiHbclqKo= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-312-VivcClWzPkqFHP8CI77wQA-1; Tue, 16 Apr 2024 08:35:31 -0400 X-MC-Unique: VivcClWzPkqFHP8CI77wQA-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-56e4827e584so4418454a12.1 for ; Tue, 16 Apr 2024 05:35:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713270930; x=1713875730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x6zJZ26n/NMVKGNdDpKks9wqLSHav9BWg6+5RJ8ZRMg=; b=TbLJlu3GC8pGIkK94nAMu3plS6uy2uQVdQELe2ddYeQ+5LBPwyWyPhTRS6UltSO5Bb pnbb3fp5P3bjqGwYM/xl+BhTDH4cwaFTxMUWlomX3kjYETq92ZlpsbKBzQeFomcMQ6A+ lgmLnouSqauG97EgEH0w2ZMJKafow8vHguN1XCudeyErnDQs77+67tyRKsPDv1M4I+2E JTQXVPWyaiFg5NIk4s3GgRSAR/aHiWUTspa2LQHrImhi2n26KuRWWhYJhTmOz6xMQNn9 WB55BtIUybl2fyED69ceFSKIiFXNonfaKCHNUS22c2UH1f2SdFJR9F5M4A1zDZXkeg4V 06fQ== X-Forwarded-Encrypted: i=1; AJvYcCW2vus9iPtGli2tX7H4OjHoMJD5p3Beor8qJA0Kco0c69rBnwmv9XUikQe8rc91VidjSNB6BYXaMaZOye6VK3qTYSAAlfc5muTb X-Gm-Message-State: AOJu0Yy14UAeha0UGjKXEbaXLDkdacdzZ+GZ7dNZbSGu3dqDviqFbz8j UsYEqJl1GpVbiUoIqdlZvPYY+IaN3FihBk2U5a3JIs+GJUIMQaGYf33pprkNF7O5xK8i1xzojjQ GdCE4yExtGCEvibylXI64RtPoI43aBZPaXzufnHErulDT6EANbRsLGnSv X-Received: by 2002:a50:ab08:0:b0:56e:2e77:169e with SMTP id s8-20020a50ab08000000b0056e2e77169emr1340007edc.20.1713270930128; Tue, 16 Apr 2024 05:35:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTyduBLJk/NT+mPJIRIPwqP4EVEESaW8KScHqvUZXuq8fjaRzN6BkGuHVqB7m3SETGLQHgEA== X-Received: by 2002:a50:ab08:0:b0:56e:2e77:169e with SMTP id s8-20020a50ab08000000b0056e2e77169emr1339990edc.20.1713270929635; Tue, 16 Apr 2024 05:35:29 -0700 (PDT) Received: from thinky.redhat.com ([109.183.6.197]) by smtp.gmail.com with ESMTPSA id p8-20020a05640210c800b005704825e8c3sm465584edu.27.2024.04.16.05.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:35:29 -0700 (PDT) From: Andrey Albershteyn To: cem@kernel.org, linux-xfs@vger.kernel.org Cc: Andrey Albershteyn Subject: [PATCH 1/5] xfs_db: fix leak in flist_find_ftyp() Date: Tue, 16 Apr 2024 14:34:23 +0200 Message-ID: <20240416123427.614899-2-aalbersh@redhat.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240416123427.614899-1-aalbersh@redhat.com> References: <20240416123427.614899-1-aalbersh@redhat.com> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When count is zero fl reference is lost. Fix it by freeing the list. Fixes: a0d79cb37a36 ("xfs_db: make flist_find_ftyp() to check for field existance on disk") Signed-off-by: Andrey Albershteyn Reviewed-by: Darrick J. Wong --- db/flist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/flist.c b/db/flist.c index c81d229ab99c..0a6cc5fcee43 100644 --- a/db/flist.c +++ b/db/flist.c @@ -424,8 +424,10 @@ flist_find_ftyp( if (f->ftyp == type) return fl; count = fcount(f, obj, startoff); - if (!count) + if (!count) { + flist_free(fl); continue; + } fa = &ftattrtab[f->ftyp]; if (fa->subfld) { flist_t *nfl; From patchwork Tue Apr 16 12:34:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Albershteyn X-Patchwork-Id: 13631780 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81D451292D7 for ; Tue, 16 Apr 2024 12:35:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270935; cv=none; b=LsnGzxGMI2+RfqeBmIitZU+hN/ATPfWjm9l6FzPjKSPGCP3bouJ8M8vXcJRz/Iv2pmUQIx1TC2EKSvzvqOxcqGFyGkvKuLpf+3yOpVmWqogCXqTLe5yfe1AfHNi2KfAwt+YpYUh8mjgGlJcxP1ktfYbnmGWwsG5zqtsF26+vyjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270935; c=relaxed/simple; bh=enSbR7naXFZfcdvMaREm9iZhtw5Ng0LD3gQ30+QEFuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IE8hVwB7pkjXmYhvEAK1w8FnmAwnL/O3lKDENLmECf0ec5GrV1h/IOutDaBjzaO8/yQqxb4RuI05VT8v6u4PtWqAg8PB/q18tHnpQuAsKHOIrV/1qCr0lhWvF7UkVzbrB61AoZxVGGXPhonbKCdXVjTLB+Bt3Ymac6DiBj9NFgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BZeMJVTt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BZeMJVTt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713270933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VBucZD+Hh5n3YcvOClOQFrDeYmk591h5yJuMvZn8z9U=; b=BZeMJVTtR7JcfYJATWZrEZ/kU5YH57s265F21C7vfFEDSXWo991TAehGtHd81cKfTsxY3d QT1oafYbBqig/7KMEySuQC1+C+c7oFWoqbSJijpymjFW1WXD+OQDp7LfYY16Wj5325ySjS Zz0S89ZZYXO7iCE4mnMYJHUI0V8HmyA= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-ByzMaYTLOPiWVdaD_voqYg-1; Tue, 16 Apr 2024 08:35:32 -0400 X-MC-Unique: ByzMaYTLOPiWVdaD_voqYg-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-558aafe9bf2so2997521a12.1 for ; Tue, 16 Apr 2024 05:35:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713270931; x=1713875731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VBucZD+Hh5n3YcvOClOQFrDeYmk591h5yJuMvZn8z9U=; b=C/janFIwUS/5JlfyRp4LlhfV/yvcZmYPMG8RXA0JexFa0qqdC2VES6V+o+SPhKq55c 2DEziuW1eAfH9ZuPqTHHaJxcEQ6P7uKzYSJx1T16IW7GGHj5mV/R+uGd/LfppbG+YC0U S72gM2uKGt2x2ACtikFBdyUXngM+BL++uBgOySHAlNGfXG7q0NrCZFPjWqXwE0jXobWT tI3Ngqx1g93YxLDBSVbMbiDxU4+bdPGigm7WPuZ//x2ERVY69NaqWDuDhv5GVMlEkiaO k85WsinyvPPlW56RHzF/7mdjT10X5VOCLOSkflabNV/W3xw+aoYMODz2NTc8u1vRnCLE YfgQ== X-Forwarded-Encrypted: i=1; AJvYcCWmh8LXTiZlZ1rFpPfHRwnMdMx8h9XzgZnnPRxNZar5TEBNlclC3Sw7C/j7PvZnt0CEwBD19jVYASGuhqSc0kNn7Nb4f3ela+vZ X-Gm-Message-State: AOJu0YxbvtTYW76lk4mUzi9CXvwPpsqrt8/MR11t74vra5FTnWiDxC76 d1k7mtqmYwk4PnVEeyzHCDCOKHe03AgD+bM7chFIdP3K0J5ZTjd3Zple/cFFtZldCucMWORsJ6V U/M3hwtx302nZrmedGQEdT86Y09T7fOCYaWDRgoI2pow4xZZ4mUYj0p1k X-Received: by 2002:a50:d79a:0:b0:56a:ae8a:acc0 with SMTP id w26-20020a50d79a000000b0056aae8aacc0mr8775898edi.21.1713270930671; Tue, 16 Apr 2024 05:35:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbBlIOnhC5lhXOqUlS/WueNztG6UefimASU5xxM1kcAhsak/eIZm2PSPLrqUqoWrGaPKkrSw== X-Received: by 2002:a50:d79a:0:b0:56a:ae8a:acc0 with SMTP id w26-20020a50d79a000000b0056aae8aacc0mr8775883edi.21.1713270930204; Tue, 16 Apr 2024 05:35:30 -0700 (PDT) Received: from thinky.redhat.com ([109.183.6.197]) by smtp.gmail.com with ESMTPSA id p8-20020a05640210c800b005704825e8c3sm465584edu.27.2024.04.16.05.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:35:29 -0700 (PDT) From: Andrey Albershteyn To: cem@kernel.org, linux-xfs@vger.kernel.org Cc: Andrey Albershteyn Subject: [PATCH 2/5] xfs_repair: make duration take time_t Date: Tue, 16 Apr 2024 14:34:24 +0200 Message-ID: <20240416123427.614899-3-aalbersh@redhat.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240416123427.614899-1-aalbersh@redhat.com> References: <20240416123427.614899-1-aalbersh@redhat.com> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In most of the uses of duration() takes time_t instead of int. Convert the rest to use time_t and make duration() take time_t to not truncate it to int. Signed-off-by: Andrey Albershteyn --- repair/progress.c | 4 ++-- repair/progress.h | 2 +- repair/xfs_repair.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/repair/progress.c b/repair/progress.c index f6c4d988444e..c2af1387eb14 100644 --- a/repair/progress.c +++ b/repair/progress.c @@ -273,7 +273,7 @@ progress_rpt_thread (void *p) _("\t- %02d:%02d:%02d: Phase %d: %" PRIu64 "%% done - estimated remaining time %s\n"), tmp->tm_hour, tmp->tm_min, tmp->tm_sec, current_phase, percent, - duration((int) ((*msgp->total - sum) * (elapsed)/sum), msgbuf)); + duration((time_t) ((*msgp->total - sum) * (elapsed)/sum), msgbuf)); } if (pthread_mutex_unlock(&msgp->mutex) != 0) { @@ -420,7 +420,7 @@ timestamp(int end, int phase, char *buf) } char * -duration(int length, char *buf) +duration(time_t length, char *buf) { int sum; int weeks; diff --git a/repair/progress.h b/repair/progress.h index 2c1690db1b17..9575df164aa0 100644 --- a/repair/progress.h +++ b/repair/progress.h @@ -38,7 +38,7 @@ extern void summary_report(void); extern int set_progress_msg(int report, uint64_t total); extern uint64_t print_final_rpt(void); extern char *timestamp(int end, int phase, char *buf); -extern char *duration(int val, char *buf); +extern char *duration(time_t val, char *buf); extern int do_parallel; #define PROG_RPT_INC(a,b) if (ag_stride && prog_rpt_done) (a) += (b) diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index ba9d28330d82..78a7205f0054 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -377,7 +377,7 @@ process_args(int argc, char **argv) do_prefetch = 0; break; case 't': - report_interval = (int)strtol(optarg, NULL, 0); + report_interval = (time_t)strtol(optarg, NULL, 0); break; case 'e': report_corrected = true; From patchwork Tue Apr 16 12:34:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Albershteyn X-Patchwork-Id: 13631781 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25E7212AAF4 for ; Tue, 16 Apr 2024 12:35:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270937; cv=none; b=cPbnqFe6Nw5MXZEmLa1FUcvXX4Y5X2L4bTdn5d6vnCvwEi/tCTWoK5bNif19HE3U5LSbnT8XY94lx6IWxkyXCk3s5A6orhAOhdM6yKOVClFs+TeenbL7kZ82ExdKJRy5o9aYkEmn0qBZB/eRTVhVDy+ZZPoAsn1+4FToZ9U2Y1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270937; c=relaxed/simple; bh=RR03LITUPqoryx1BJJZcJEW14NlEdQqVA4q/fuGQlYI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JX4VDLNRuA2WfaXdUd/+b4hC8wQ3Rh1L7qwoeWqBXBnT1v3gJ8BQZa48AoM+lyUmHeDpRaOcA8uhBnPnoFO1PfV5JEyYIHDqS+oAu4kJb0ECq7jj0QHCnKDFa3q6z9tVDZAgi7q2C0EySinyGenVEOowkwaXCpCURe9OBVE1zjQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fJLBpTaF; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fJLBpTaF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713270934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RJCBfl00jEWDyYXZKn1Yca77L4ubq0YMydHYXoka8VY=; b=fJLBpTaF310bUDnv7uMyGnlA9RQ9hloUewHPF1qBpWEGymdki6d7ZEyWE+DYIvRwFOecJG 9wkBTcfSV4acDUNMjEzafNSSPtEbt1DDwwN9Fd4PRqTGoJGnPZv1IH+WuD41ZZCMRnXiv9 iNuo/iQ6wMWwo/Q19tCAQYe203Zb5ro= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-xUcxVRlINHKgEDd1zSjWdg-1; Tue, 16 Apr 2024 08:35:33 -0400 X-MC-Unique: xUcxVRlINHKgEDd1zSjWdg-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5685d83ec51so2314282a12.3 for ; Tue, 16 Apr 2024 05:35:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713270932; x=1713875732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RJCBfl00jEWDyYXZKn1Yca77L4ubq0YMydHYXoka8VY=; b=AHZ5NOTppcTYJ7PT7CiNZ7bZGzWWuoc3aYRlCe3Je0WciiDPRoWG0xyL2d2I7k8B5j II5SmP/ZE9WLrbQe/tiXQ5UakOsWXZwHz71eeLnIgC4bK5g874dUMM+1M/FasCssZaRo n2Wq/w3dB23hoBcjMKccF/jmqTuvCHa2x5WnONervA1SKeQZ13jUodQvugPAFyBEpGVf vi9GofGj1o2Oct6X/ZVDViYN3ucBwINA+EYyydGSv+5Xt0FEolIs4Edn2IUcgb774zPC /5xsRok0J3/3UU0VE42rRWeIxMvgSBgzwvj83zDjh7Xc7FF5bW/IVGuzxD9L3oU+S2Ic 095A== X-Forwarded-Encrypted: i=1; AJvYcCUMmrgckJucTDumkN4MRgrTQMkA2bFOo6emJN7UHv/TENz7Vlzs7z9YvdWRpMHPJvpzM3G8tsItQSxXXOu4Gvp4HYOCcoGd3BEo X-Gm-Message-State: AOJu0Ywr/dstByLtlQind+KRYpg4FcF+eQrWN8nDnlwy5bm+oE+0bmxd nRG9Xc3URWi8v4T+4WqBJ79sUZTHIMn8KBmuouiFrCxsFNTkIbgqZC7NBaNczR1DSFLBtgYmC2o HAd3SysCRftRfTSomQCYBJ9nCIsC0Y0jxECGgpfqRjg6W5q+Lui9CIFaLWx2EPcGG X-Received: by 2002:a50:9317:0:b0:56e:2add:12eb with SMTP id m23-20020a509317000000b0056e2add12ebmr7790537eda.13.1713270931704; Tue, 16 Apr 2024 05:35:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUyiYrjOBWA5JG6Ijk/G+tI3FkGhxogFlaSY+e6FxKVkz022VmDooR9ixeYRLf3ieg8KitRA== X-Received: by 2002:a50:9317:0:b0:56e:2add:12eb with SMTP id m23-20020a509317000000b0056e2add12ebmr7790519eda.13.1713270931219; Tue, 16 Apr 2024 05:35:31 -0700 (PDT) Received: from thinky.redhat.com ([109.183.6.197]) by smtp.gmail.com with ESMTPSA id p8-20020a05640210c800b005704825e8c3sm465584edu.27.2024.04.16.05.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:35:30 -0700 (PDT) From: Andrey Albershteyn To: cem@kernel.org, linux-xfs@vger.kernel.org Cc: Andrey Albershteyn Subject: [PATCH 3/5] xfs_io: init count to stop loop from execution Date: Tue, 16 Apr 2024 14:34:25 +0200 Message-ID: <20240416123427.614899-4-aalbersh@redhat.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240416123427.614899-1-aalbersh@redhat.com> References: <20240416123427.614899-1-aalbersh@redhat.com> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 jdm_parentpaths() doesn't initialize count. If count happens to be non-zero, following loop can result in access overflow. Signed-off-by: Andrey Albershteyn --- io/parent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/parent.c b/io/parent.c index 8f63607ffec2..5750d98a3b75 100644 --- a/io/parent.c +++ b/io/parent.c @@ -112,7 +112,7 @@ check_parents(parent_t *parentbuf, size_t *parentbuf_size, jdm_fshandle_t *fshandlep, struct xfs_bstat *statp) { int error, i; - __u32 count; + __u32 count = 0; parent_t *entryp; do { From patchwork Tue Apr 16 12:34:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Albershteyn X-Patchwork-Id: 13631782 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CEE812AAD9 for ; Tue, 16 Apr 2024 12:35:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270937; cv=none; b=SoLSoCqWebI6pL6eymrxU2r4Sqj4WiBBzDp9/Dn1+I7WtYLnVvmpxZcsckIYfs9xi7wfKq9ntivDfTAlzwOB7hY8ZVrSxu6pQi0jzABr02Rfk8Xm/O5g7FZnBOXpGt8PourgZPU76xEsnuL8arsSVoxA6W6IP/WRCMKYN+rjJdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270937; c=relaxed/simple; bh=obms2tf5G9Su3aFrkpeWOtyVh9+9YwXfLAuAm7eTUCw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kJ4Hm+2EljlOjI7cdbAQn2rBHZeKbqCrqmMiN7EK32elA2tm08fB7E6iPDWdppIH14d7FKHjPC3bBvmfEhz3M/sMNMWfJMFtES+bB4Viz7pA6/LiDLqs575BqKwProaMhHFmQXpbR6XxaE3sEDCq4ivSxvzBgs+ROA55occO0BI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=G0NoJGaY; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="G0NoJGaY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713270935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m04wGvEXmRMGQB+gacFFhoDMjkcqIzA8DcuF4Ekeq2Y=; b=G0NoJGaY/yZPdhi4Wl6r5CVp/Vg+gpbmA0BtGIAfYjMeOm6GDiNLqv/nkddyXBxSI5yzMD hyKdNM2fX4jmbqWHyn7TvJjRlTje5QtSfT+aJk9+pDcoR6i/GgKrXRjbu8OGMZ4Xss0qXs E4BPPgSOeLMXxT5bux6x5iFN/ba1sgw= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-304-_MvlGHsKMCSZhsyrW41ugQ-1; Tue, 16 Apr 2024 08:35:33 -0400 X-MC-Unique: _MvlGHsKMCSZhsyrW41ugQ-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-56e40f82436so1746022a12.1 for ; Tue, 16 Apr 2024 05:35:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713270932; x=1713875732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m04wGvEXmRMGQB+gacFFhoDMjkcqIzA8DcuF4Ekeq2Y=; b=MaDMEYGAFqIpkmXSg67jh6VTwYU+Ynv9GMJ3qbWBf2PWc5dy6jqtWrBWhI7vgI2DHA W8klV2OPru6J552/fr6SLQkFQwW7creSNitJuInD1o672jKBXUIbRwyB/USDlh+glomF 6c9pwpPY5vHz8ikxhenpC3AktTEcNkPCip5js0xgS0hlg93eHoyYHo9ITpkqUyE0Mj9M bxzjscj+WZ3Bwvwtz25rQ8smuy9GJ72C69pJkbbBKUYMi6b1G3grL9itJWHsdfWNvTA1 5HcPR0uFR6AEsr+uKUcXK95JkGoJi2nTpV136cR8TzvNY96Z/GDi8Cuh1PmR6wX3P4TW l8zw== X-Forwarded-Encrypted: i=1; AJvYcCWJGTD7voQl+ORZ+tDv+hmoqkxcN3dRC7kuL3XK7GyqN8dO4cuQgGUfBCGG8bxPKBURUBqBfqb+9aorGrPifZ3tVYfPzjXamDbq X-Gm-Message-State: AOJu0YxPr3UsSVkHeGpiqOqI4ewVnycDZIodzc1Xkj2QyH6SojmD7GgL jFnsV10Y2JmzcEa0H959byt/2rsFs4lBqzjZSqKsafuQdNc2cisnFX6GnEm3Wzf6Xuda39vShSd ZKdvwNvpIvWaegvvQJ6kFMBU+86YFhGpKhCmSJFrpmqyV09UdQoREQJ+N X-Received: by 2002:a50:c05a:0:b0:565:f7c7:f23c with SMTP id u26-20020a50c05a000000b00565f7c7f23cmr11508213edd.3.1713270932420; Tue, 16 Apr 2024 05:35:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXTcbsr8MNsmrxBMfwtBNNLbu46ZQPaxLYhyyNLifJXpBP7mnvxngt0PusRTcF93Sd32wH0A== X-Received: by 2002:a50:c05a:0:b0:565:f7c7:f23c with SMTP id u26-20020a50c05a000000b00565f7c7f23cmr11508184edd.3.1713270931858; Tue, 16 Apr 2024 05:35:31 -0700 (PDT) Received: from thinky.redhat.com ([109.183.6.197]) by smtp.gmail.com with ESMTPSA id p8-20020a05640210c800b005704825e8c3sm465584edu.27.2024.04.16.05.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:35:31 -0700 (PDT) From: Andrey Albershteyn To: cem@kernel.org, linux-xfs@vger.kernel.org Cc: Andrey Albershteyn Subject: [PATCH 4/5] xfs_scrub: don't call phase_end if phase_rusage was not initialized Date: Tue, 16 Apr 2024 14:34:26 +0200 Message-ID: <20240416123427.614899-5-aalbersh@redhat.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240416123427.614899-1-aalbersh@redhat.com> References: <20240416123427.614899-1-aalbersh@redhat.com> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If unicrash_load() fails, all_pi can be used uninitialized in phase_end(). Fix it by going to the unload: section if unicrash_load fails and just go with unicrash_unload() (the is_service won't be initialized here). Signed-off-by: Andrey Albershteyn Reviewed-by: Darrick J. Wong --- scrub/xfs_scrub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index 752180d646ba..d226721d1dd7 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -631,7 +631,7 @@ main( fprintf(stderr, _("%s: couldn't initialize Unicode library.\n"), progname); - goto out; + goto unload; } pthread_mutex_init(&ctx.lock, NULL); @@ -828,6 +828,7 @@ out: phase_end(&all_pi, 0); if (progress_fp) fclose(progress_fp); +unload: unicrash_unload(); /* From patchwork Tue Apr 16 12:34:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Albershteyn X-Patchwork-Id: 13631783 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBA8712BE8C for ; Tue, 16 Apr 2024 12:35:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270938; cv=none; b=UPB0GU8W5aQ+hUKgXlPf5+OSBpUiD4rRDuTSlmzYfPcBydKaQXeUijMnAJ8HaK4URvLQt8l+fcgvPWg0XjCUp6Ih8DgsAbian82TvhR7AB99GCMYURV91nw/FV1FM0+AyzYdrL0Dqd2YY5kWllYMV8Q8s/r0Qva2b2hpIeXrTXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270938; c=relaxed/simple; bh=NOemmyi1Zimduf+3um1VtLLHUTHg0/WBIkeaKNQJnbo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MKgO/rOmE1XgSgN2dlJDK66s2uyT6ScuWdLIecU0uSvT+sqZpvhp73gQknGTf21HB6QWvthnMN+RH4++chQtwYl4iy4KmVu/w8zDBKAWORYfNBsJ+W/sqwGg3AMWfB2rrYyxMqBib5mk8Y3scdGVGiABeQmpzbN2akrVqRpPcrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=IW6wQppj; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IW6wQppj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713270935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QeW15D5Q9ly8ujGfc/WJrwAVLFOjE2i7KfYN8G7cFUU=; b=IW6wQppjMest5X1fagzgf9caYXxlp971NYDx/ZwdlohZ8Wpo8CZl5aDw0BnYj/qVxmw4hA lOl8KkTc8DxBfcgvZ/rjc0kSk4BSv6mdDYbKpYeaKtprQz8dsvQ1uKtKIV/VpM90Y8Urzt ZwdNNjUpaBJcaLHtvYdymmUqpc/44yE= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-509-CguG4aAyOlKWLndWFCra1w-1; Tue, 16 Apr 2024 08:35:34 -0400 X-MC-Unique: CguG4aAyOlKWLndWFCra1w-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-56fe8be5474so1445136a12.0 for ; Tue, 16 Apr 2024 05:35:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713270933; x=1713875733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QeW15D5Q9ly8ujGfc/WJrwAVLFOjE2i7KfYN8G7cFUU=; b=YqhyqW8CsQ/7YohXZ+8qliOLgynPSXpmz4PKGRla3WaBK0prKncavo4pIh0ZHmirdd f+CbXrvUyS5woHyBgqdFs7btfCdZRgYVXpvGEoZSewU2GqYhYvazroLeMny1WxkYlUc5 oenXt0k97DBA9gDIYrOQdRt5TOGYbrUnPtJje7zschtTwurJdCRKaeK+eDqUJSu0e9EA qH5f4hSNJmSbeN+fx5xTklNvanGp+xffSc/mF7tNEd4KqDMZDpQcQUTYPBh0X7oFdv/U T0gh5F+qdmAHPE/7gx7hDqHwUhbpgNtMgWjSSrhW5lXq6O4Oi8oP1O92RcZ2EyHGyuIJ I+vw== X-Forwarded-Encrypted: i=1; AJvYcCV/zYPTr/zVmk3z6GTH5y4wLS6ttY/wFqFrvSZMAGkphAmMKdpJ12nfHRAnKiBC7xMTPVAOkiyosO6el0+B1VhVAAuSfcgezP5Q X-Gm-Message-State: AOJu0Ywt6B1IcElgwAJs0Zp5jaM7A26i6b9hKXPuwPLGPgGSxbM0pEL1 FpFWiH+hsBZiuwI6qSF9uGSBVTtrMMZ4eAITKjGocwb/nZ1jCTEvZK/UXzzVld2REGBj99Wm9PS yxm5ZU24T28xg6FUYsaxdJboaauP3T17n102TZXFTSwby+Ec0b/I02RzF X-Received: by 2002:a50:8e52:0:b0:56c:4db:33f7 with SMTP id 18-20020a508e52000000b0056c04db33f7mr12110317edx.10.1713270933091; Tue, 16 Apr 2024 05:35:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiJEWa2QWkHzP25cP4FxG9kmwHjHGMjJt9Qb5+waOGNZfZ+hpABkZ4PyT5Yu/QIiwANg9YGA== X-Received: by 2002:a50:8e52:0:b0:56c:4db:33f7 with SMTP id 18-20020a508e52000000b0056c04db33f7mr12110291edx.10.1713270932459; Tue, 16 Apr 2024 05:35:32 -0700 (PDT) Received: from thinky.redhat.com ([109.183.6.197]) by smtp.gmail.com with ESMTPSA id p8-20020a05640210c800b005704825e8c3sm465584edu.27.2024.04.16.05.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:35:32 -0700 (PDT) From: Andrey Albershteyn To: cem@kernel.org, linux-xfs@vger.kernel.org Cc: Andrey Albershteyn Subject: [PATCH 5/5] xfs_fsr: convert fsrallfs to use time_t instead of int Date: Tue, 16 Apr 2024 14:34:27 +0200 Message-ID: <20240416123427.614899-6-aalbersh@redhat.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240416123427.614899-1-aalbersh@redhat.com> References: <20240416123427.614899-1-aalbersh@redhat.com> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert howlong argument to a time_t as it's truncated to int, but in practice this is not an issue as duration will never be this big. Signed-off-by: Andrey Albershteyn --- fsr/xfs_fsr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c index 3077d8f4ef46..07f3c8e23deb 100644 --- a/fsr/xfs_fsr.c +++ b/fsr/xfs_fsr.c @@ -72,7 +72,7 @@ static int packfile(char *fname, char *tname, int fd, static void fsrdir(char *dirname); static int fsrfs(char *mntdir, xfs_ino_t ino, int targetrange); static void initallfs(char *mtab); -static void fsrallfs(char *mtab, int howlong, char *leftofffile); +static void fsrallfs(char *mtab, time_t howlong, char *leftofffile); static void fsrall_cleanup(int timeout); static int getnextents(int); int xfsrtextsize(int fd); @@ -387,7 +387,7 @@ initallfs(char *mtab) } static void -fsrallfs(char *mtab, int howlong, char *leftofffile) +fsrallfs(char *mtab, time_t howlong, char *leftofffile) { int fd; int error;