From 3c3c0375b9bef6aed63f22f290dc43e535447f0c Mon Sep 17 00:00:00 2001 From: weiyucheng123 Date: Thu, 11 Dec 2025 15:43:47 +0800 Subject: [PATCH] client fix returned error in the defer function --- ...returned-error-in-the-defer-function.patch | 56 +++++++++++++++++++ k3s-containerd.spec | 9 ++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0011-client-fix-returned-error-in-the-defer-function.patch diff --git a/0011-client-fix-returned-error-in-the-defer-function.patch b/0011-client-fix-returned-error-in-the-defer-function.patch new file mode 100644 index 0000000..1ad764f --- /dev/null +++ b/0011-client-fix-returned-error-in-the-defer-function.patch @@ -0,0 +1,56 @@ +From f7914c10c947cfbc09d649df4180b5e5fc790757 Mon Sep 17 00:00:00 2001 +From: Iceber Gu +Date: Tue, 15 Apr 2025 16:07:50 +0800 +Subject: [PATCH] client: fix returned error in the defer function + +Signed-off-by: Iceber Gu +--- + container.go | 4 ++-- + task.go | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/container.go b/container.go +index 2cf15666f..f179bf450 100644 +--- a/container.go ++++ b/container.go +@@ -207,13 +207,13 @@ func (c *container) Image(ctx context.Context) (Image, error) { + return NewImage(c.client, i), nil + } + +-func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...NewTaskOpts) (_ Task, err error) { ++func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...NewTaskOpts) (_ Task, retErr error) { + i, err := ioCreate(c.id) + if err != nil { + return nil, err + } + defer func() { +- if err != nil && i != nil { ++ if retErr != nil && i != nil { + i.Cancel() + i.Close() + } +diff --git a/task.go b/task.go +index ef8cd4494..9efdec901 100644 +--- a/task.go ++++ b/task.go +@@ -351,7 +351,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat + return &ExitStatus{code: r.ExitStatus, exitedAt: r.ExitedAt}, nil + } + +-func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate cio.Creator) (_ Process, err error) { ++func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate cio.Creator) (_ Process, retErr error) { + if id == "" { + return nil, fmt.Errorf("exec id must not be empty: %w", errdefs.ErrInvalidArgument) + } +@@ -360,7 +360,7 @@ func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreat + return nil, err + } + defer func() { +- if err != nil && i != nil { ++ if retErr != nil && i != nil { + i.Cancel() + i.Close() + } +-- +2.33.0 + diff --git a/k3s-containerd.spec b/k3s-containerd.spec index 2748a12..b458c9c 100644 --- a/k3s-containerd.spec +++ b/k3s-containerd.spec @@ -3,7 +3,7 @@ %global version_suffix k3s1 Version: 1.6.6 Name: k3s-containerd -Release: 16 +Release: 17 Summary: An industry-standard container runtime License: Apache-2.0 URL: https://github.com/k3s-io/containerd @@ -22,6 +22,7 @@ Patch0007: 0007-fix-CVE-2024-24786.patch Patch0008: 0008-fix-CVE-2024-40635.patch Patch0009: 0009-fix-CVE-2024-25621.patch Patch0010: 0010-fix-CVE-2025-64329.patch +Patch0011: 0011-client-fix-returned-error-in-the-defer-function.patch BuildRequires: golang glibc-static make btrfs-progs-devel @@ -86,6 +87,12 @@ cp -rf %{_builddir}/containerd-%{version}-%{version_suffix}/. %{buildroot}%{_lib %changelog +* Thu Dec 11 2025 weiyucheng - 1.6.6-17 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC: client fix returned error in the defer function + * Wed Dec 10 2025 weiyucheng - 1.6.6-16 - Type:bugfix - CVE:NA -- Gitee