From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4191430B53F for ; Wed, 5 Aug 2026 18:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785955676; cv=none; b=KBWdh5+EL7xt6ClSz7jzmrQGekp+G2dgbarxBHhKIsqwLI6qe4L4QsgYUlWr548DRPmS9M2XWRo65gvViGyWAdt9p3KS51Xp3pnVcL8B/XIguPjOdHkqmt3VEBGB+tLGBZUFgh0lw7LNJXfLJosBGyq3/NDUIdQ+8C0zT14DRFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785955676; c=relaxed/simple; bh=XumjtvdYNUTjuJIkdsqEWpFTPQsUekL49pxS9GwogpM=; h=Content-Type:Date:Message-Id:Cc:Subject:From:To:In-Reply-To: References:MIME-Version; b=NY7odiAOaXeC2VmrwjXjVe3kAOJgKyBZEc7Ye4/32oRP8j53OgYMFb3Tx0sGPFyNWXuKVCNe6VCLjN0QfT/i+Zt93iEx4uKXe2NDYkjsWKqMu2a6UZGmHvafg/UI1XD3bFqRdlVTWOTgP9G/5PplbqqOv6wr0fzVWRAkJjhlVJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=O5jB32+M; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="O5jB32+M" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2cc891373e0so17427635ad.2 for ; Wed, 05 Aug 2026 11:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1785955674; x=1786560474; darn=vger.kernel.org; h=mime-version:references:in-reply-to:content-transfer-encoding:to :from:subject:cc:message-id:date:content-type:from:to:cc:subject :date:message-id:reply-to:content-type; bh=XumjtvdYNUTjuJIkdsqEWpFTPQsUekL49pxS9GwogpM=; b=O5jB32+MhEMXauPgRJRNTEDwUiqYQkPcKcNOSPAZTNPlWN+F8Eb1xmNhjHgGouZ5TU FIU9R4n+nOGpM3GzrV1nBZxmNoDmNDa2bW08+rfkyoeci1TSOVuwDDamL1AYcgmvkIiO 83BnuN75ESt7yj3wi3HVVdeCu968QwLWJOo3TaqWV4AOR0ZaeSqN6yitY3VlW5FCoLIo Y/XXEzRyX7YE193fldICA/hReZBbc21JHdo/iF1j/cp17/OtzK1WjHKxJcmw/r7T+aCq gXcFAGPHyPsPn2D+sMMnWdHWSkV3UFddeOQ7CGMPna93VFnO9QiCZjgg1PZXOEHO+KbA RlMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785955674; x=1786560474; h=mime-version:references:in-reply-to:content-transfer-encoding:to :from:subject:cc:message-id:date:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=XumjtvdYNUTjuJIkdsqEWpFTPQsUekL49pxS9GwogpM=; b=bzqnkSdcA8ijgHb2L2quBaHghf1QhewnWrhaMEpTZ9n7nRcNkLkws9ZvTGMg/iSK2Y vqPcwXIG1ORYvXws0tOufETnNyGCMdF3Dg2+/b16iMLBqQ4daB3jjxchVmpHlKS7QtpF AavhAZIqAti5Z9uXgY8mMOoEEYyf1aVvFTUiWy+CPPhNEOi7YspcMfMpK7wPl8Qemw4y Np7o/3QaReH3SzvU07rdoObnACO9yPHXrvoMi9sSB07rjXLvDQTteS8b/AlMkDOG9XQ9 A5W21ZTuh+j6BYeEce1hCz8Mkh8XxjJ6zY7x2Tq68rFzBZetHiEcBr1k3MWePZv1kxQN OhUg== X-Forwarded-Encrypted: i=1; AHgh+RoBtFzxitk5oq+vSAfqJVC3tfVIHayOdbYJcfAnSwu2IMBVg7dp08CZkakeSvBcQRFt1YE7ODqe/Va9n9Y=@vger.kernel.org X-Gm-Message-State: AOJu0YzlvCkQv7jnbA3tfd7keHjoPzb9Hks50Eb0OrZywBbKLkFa/jS4 MHRGq3l3aSuBw1DWVmaPKKTKJC/gwkf0wuGrNmwAEijc2Pfgjcx9QvhQt1VlIgxrS+tNjxbSj4/ ElSbTDLQ= X-Gm-Gg: AR+sD13pufHMF0K9/2AZUCkHwa4rZgCSd9TZL3eo6lLgQl+PqwkPRdaQGwhKiACW+JD BDwRvtL5zhVmiJ3sLjiJE+pZbs2+NWaeBZI0rdrYxO+IuMLsr1HSQZcd3rVd85BZS7iB1CFdhrK H2YAS2XZHViyso6kQoNoeVuf4ZWm/emrthbrifW/J4n/HgJB3rh734NWTnAPRO50igtr0f1Rkdz XxwL848wuRrr628541lz/4oYNMhLQjnLO6+L142K2UgnvEWwjOoLeZ+3yPseaDqbY0mUSz3Ksxz a6XDnEAUUhhJszF7A9LVkXaO670oOqLf+zgjIp+3UhlBM7alVAO65yE/qSLtIIqptjjspN3h7dp L+Y0mcF/lRTY3WvJTUtfPz2X0jadrZnt5ZeQ4H/JLEk/XGQTj/KYbSyH1HqFnZF5tYHaRqrhCSF EpsKEKCFWOea8QpBtFCz9zSozzp4LqRSJtqFggsC38aE/HFWyuKg9Q+LjthZzQHBSXJmrMDD4= X-Received: by 2002:a05:6a20:6a08:b0:3c3:a9e1:a819 with SMTP id adf61e73a8af0-3cb85f44592mr10042387637.24.1785955674588; Wed, 05 Aug 2026 11:47:54 -0700 (PDT) Received: from localhost ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315863fd2b3sm20434536eec.7.2026.08.05.11.47.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Aug 2026 11:47:54 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Date: Wed, 05 Aug 2026 11:47:53 -0700 Message-Id: Cc: , , , , Subject: Re: [PATCH v5 5/9] of/overlay: don't keep a negative id in ovcs->id on idr_alloc() failure From: "Abdurrahman Hussain" To: "Geert Uytterhoeven" Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20260722-nh-of-alias-overlay-v5-0-2abe2bb9cdbc@nexthop.ai> <20260722-nh-of-alias-overlay-v5-5-2abe2bb9cdbc@nexthop.ai> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed Aug 5, 2026 at 1:26 AM PDT, Geert Uytterhoeven wrote: > (Alternatively, free_overlay_changeset() could check for a > strict-positive id) > > However, I am wondering if this is the right fix? > > All error cases above just return an error code, without doing > any cleanup. Failing to allocate an ID doesn't add any extra state... > > > goto err_free_ovcs; > > ... so shouldn't this just be changed to "goto out_unlock" instead? ovcs itself is already allocated at that point, and out_unlock does not free it, so that would leak the kzalloc. Going through free_overlay_changeset() is intentional: it copes with a partially initialized ovcs (the cset.entries.next check, the id check, and notify_state =3D=3D OF_OVERLAY_INIT from kzalloc) and frees the struct. Your alternative is nicer though: the next revision makes free_overlay_changeset() treat only a strict-positive id as registered and drops the reset at the error site. Added your Suggested-by. Thanks, Abdurrahman