{"id":2224792,"url":"http://patchwork.ozlabs.org/api/covers/2224792/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/cover/20260418172844.1333378-1-charsyam@gmail.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260418172844.1333378-1-charsyam@gmail.com>","list_archive_url":null,"date":"2026-04-18T17:28:42","name":"[0/2] ksmbd: connection accounting and session teardown fixes","submitter":{"id":93166,"url":"http://patchwork.ozlabs.org/api/people/93166/?format=json","name":"DaeMyung Kang","email":"charsyam@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/cover/20260418172844.1333378-1-charsyam@gmail.com/mbox/","series":[{"id":500457,"url":"http://patchwork.ozlabs.org/api/series/500457/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=500457","date":"2026-04-18T17:28:42","name":"ksmbd: connection accounting and session teardown fixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/500457/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2224792/comments/","headers":{"Return-Path":"\n <linux-cifs+bounces-10899-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=VEfXjr5D;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10899-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"VEfXjr5D\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.169","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fydyh0C4Fz1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 03:28:59 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 8D7913034EEA\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 17:28:57 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 58E31330B3B;\n\tSat, 18 Apr 2026 17:28:53 +0000 (UTC)","from mail-pl1-f169.google.com (mail-pl1-f169.google.com\n [209.85.214.169])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D1B2F329E49\n\tfor <linux-cifs@vger.kernel.org>; Sat, 18 Apr 2026 17:28:50 +0000 (UTC)","by mail-pl1-f169.google.com with SMTP id\n d9443c01a7336-2a9633ef0d6so1547955ad.0\n        for <linux-cifs@vger.kernel.org>;\n Sat, 18 Apr 2026 10:28:50 -0700 (PDT)","from ser8.. ([221.156.231.192])\n        by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b5fa9ff3bfsm69694965ad.7.2026.04.18.10.28.47\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sat, 18 Apr 2026 10:28:49 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776533333; cv=none;\n b=sCxI4wnsrBACuy2FoOEjVH5EfuKPpvI0ApEDBOqVqLav/RGYbEY46iAy6jcTJSTPTtPpuO5H5Tdwf8cfg4vgLhDz6OATcFWp0MMHoaVzGKZ8CnBb8hZGrKCH6QuH1zWMuBfd7hRGP1fBT2ujAQMTdXvc7/AP07wbfpbLRJWR/a8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776533333; c=relaxed/simple;\n\tbh=oodzrY0vvZIZe8xiTS/m05LLTN+vBoFyUaBlwdynK+g=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=cRPqS6W2bZmvQT1SvLkoPJ8gUPHOq2t/QLwlrBCYhB67/zZB5rkC6ObaqI9n/r81UY8jTFKsB1Qnd0Z8BUyI9Ti78QkUlkgUkh9DgwFQKPopGW46RrJ4ff88WmCeNYh5zKfyPOTfaEfUdrSnTcYk+tvgp4Vv8rS1qgvHUkUpsOA=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=VEfXjr5D; arc=none smtp.client-ip=209.85.214.169","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1776533330; x=1777138130;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=UKnYTxLMq3it/33zgMBz+MbkLOEWdzF/N2ceulBhKMs=;\n        b=VEfXjr5DAq8PV7JdtFABrctkWQfBW7dDQJQv5sKcht44MjxFJoJOfw1CZPtePDYTvn\n         msJ8yAkoNBpdnyvAKnJz86PbmhrNzLsLLQzi17x6lWVUWMPWYpSMaleA/1ucO2OKMw87\n         2dtvA13sOv2IrCm5OXx0hM2JBU5JXT05fi7r4LQLWmtmozLSLQrXVuCRU3YCvo8FXjuN\n         ao1cbQnjCEgTFX46jzvZEYRUS8d2ITLEwPX6sw2E7iJFcfFwDm3Rcwllw6bzcGs+ydAz\n         NVZ0SAB62I9kfyjoDSqwHAgBcQvs1nfEmMrB61qecAFu9sUqs8gwMPWVOwpAxofK7vCD\n         CssA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776533330; x=1777138130;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=UKnYTxLMq3it/33zgMBz+MbkLOEWdzF/N2ceulBhKMs=;\n        b=lbMi5122JODZilwxvZvvNvts0jCT7L9asFSWo7gJk7fLqEi+oGSBi+ggtT/f1DV6/O\n         FqwF3ekS41ze3lvbbHPyG4scONiBpCtOZ9qrSQH2N14TvQJXFUoUu4587cYGh5Ix1ZQd\n         Z08OiJds9PuTPawWsuuM26IUg3uhO0xqg5SsNCmbRcHgfJ29VXcbXHI+FnG+SlvU9i/t\n         talJKOLKphzS9nJLDdfg5eW6UEAOarqz2/Tgm+df+UX3Cd6CSUyCQ3e2e+Z950UmN1A+\n         tdTfa57rLWeKHCRDoVzUkZtf0xCJLPa0sNTgfUmJc4CdAgxFT50v87DhlzXPdzD+UFMm\n         wLSA==","X-Forwarded-Encrypted":"i=1;\n AFNElJ90CQTnm8mafFCfNFQwhMA3rvXLLkZ053O8bCpjLfdxv7Gfhugvd/lfdAEzB/15HYinnLq2uao3wUVH@vger.kernel.org","X-Gm-Message-State":"AOJu0Yzz8Mk5eMPpfWCLiONwsjT3cY6yP8J+wW43/wxhBj2ptMjS/nHG\n\t5vBOMBmyRF4xC4RH0ih4wfkB0NY2jL0MVrH7wlQIbhoqfR7P9Aeb2roe","X-Gm-Gg":"AeBDievVp/MuA3q7FY9PlUrOYVR00UJ8JgI/ROZqI4++GWFfSsbExsWa4JJ8dzFMpdt\n\txC9FMQxKBO67XZnEoBOPTCSkhwvK7viryiPk3Ai5eMhEm5LX3FhH2AqRRjPySC8ZELl6pV/ALg7\n\tVkYvk0JCmUZkeoEX54rCFaW/Iv+Qsf6qjxblRUOBuDtqLIyqBUpzzteiTwgsvHONRgCikMYCTCY\n\tEpypBSHBZOO12QaEDRL9iONergX+sm4LJIg/EIq1yYDpGG0Cmoa+2C6zKaLxQ5xU8PdJzXVukda\n\te8Ak8fKOiiVQD/QMWghw6mMJK7liUl5zOSFlZ9d/f1paMp1m+zhiWl8/OOhXqQDRrdwVkZMojQu\n\t3HraHVYvfeQWTisKorruX1gr0dJduMmbLabVC4+nzUbu4clpDfwA1uaosp722IUNN9hZdaZqDRQ\n\tA3SnJIyv3mdumgCwRmaCBYBbfY4o8=","X-Received":"by 2002:a17:903:110c:b0:2b2:4194:952a with SMTP id\n d9443c01a7336-2b5f9f816femr39399565ad.6.1776533329786;\n        Sat, 18 Apr 2026 10:28:49 -0700 (PDT)","From":"DaeMyung Kang <charsyam@gmail.com>","To":"linkinjeon@kernel.org,\n\tsmfrench@gmail.com","Cc":"senozhatsky@chromium.org,\n\ttom@talpey.com,\n\tlinux-cifs@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tstable@vger.kernel.org,\n\tHenrique Carvalho <henrique.carvalho@suse.com>,\n\tDaeMyung Kang <charsyam@gmail.com>","Subject":"[PATCH 0/2] ksmbd: connection accounting and session teardown fixes","Date":"Sun, 19 Apr 2026 02:28:42 +0900","Message-ID":"<20260418172844.1333378-1-charsyam@gmail.com>","X-Mailer":"git-send-email 2.43.0","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"Two independent correctness fixes in the ksmbd server.\n\n 1/2 ksmbd_tcp_new_connection() does not decrement active_num_conn on\n     the alloc_transport() failure path, so repeated allocation\n     failures monotonically inflate the counter until max_connections\n     is reached and new clients are refused indefinitely.  This is\n     the remaining half of the same family of accounting bugs\n     addressed by 77ffbcac4e56 (\"smb: server: fix leak of\n     active_num_conn in ksmbd_tcp_new_connection()\"), which only\n     closed the kthread_run() failure path.  Reproduced under a debug\n     build that forces alloc_transport() to return NULL for a bounded\n     number of calls; details in the commit log.\n\n 2/2 ksmbd_conn_wait_idle_sess_id() stores its per-connection\n     threshold (rcount) in cross-iteration state, so whether a given\n     sibling connection is compared against the loose (< 2) or the\n     strict (< 1) threshold is decided by hash iteration order\n     relative to curr_conn.  Connections visited after curr_conn can\n     slip through the idle check while still processing requests\n     against the same session, reopening the teardown race\n     destroy_previous_session() was meant to close.  This is a\n     code-inspection fix; the iteration-order dependency makes a\n     targeted reproducer impractical.\n\nThe two patches are independent; the series order is not significant.\n\nDaeMyung Kang (2):\n  ksmbd: fix active_num_conn leak when alloc_transport() fails\n  ksmbd: reset rcount per connection in ksmbd_conn_wait_idle_sess_id()\n\n fs/smb/server/connection.c    | 5 ++---\n fs/smb/server/transport_tcp.c | 2 ++\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\n--\n2.43.0"}