From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-fw-52004.amazon.com (smtp-fw-52004.amazon.com [52.119.213.154]) (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 A0B02156F44; Mon, 14 Oct 2024 21:23:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.119.213.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728941029; cv=none; b=KZo6H7+dFkRiHPIHUSse9rzar25UBEcrB7HbYLcTzK7EoBR9Uwp3UQnhUFJOTAeLUHfbEij5p/VswAtSzSoI2tO6PV1PtYFtcX/f+fuH3QMnL2IEKqtYlB5Vnc2rwsvBixZO5EAT76XkDjd1mQrh+Z4U2EhGv/trO7cHkFriRx8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728941029; c=relaxed/simple; bh=RrD7YLWDbI1Ix7CUoWvl6jCYxQHo1wupT5Xk9WpnVlg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pB5eeZw77e3tS1rDR4xLRNek/KcsCntD1/HqMBWmo23s/3SAz69CRh812T20j6EZJmlpJ1cLvPvOpXsOwiDbqSWRKMNl2kPzCpTne5BOaFvosvcjsSwY8Rrne39BljK4zDs6ZNimI9ExN4wn42irMYjbyzUMM9pqjz35UwP5LjQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.jp; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=fgQXsRZu; arc=none smtp.client-ip=52.119.213.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="fgQXsRZu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1728941028; x=1760477028; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eoicHJbZD2uYkWJ21A8ZjLWNACAThKV5bkz+HrZCq1Q=; b=fgQXsRZuqs6mYg6ugC7Mpbr0v9LKyJLCS5bXYptKJD53RLLxUVuXm5Wt 4MMPoI8sdatRqgJcQQs7v5YjN1Iv+rcaLdYiy4m+f6sy2qraYzR1YrDCK qGxXKRgS3Su5YSSl3ODxhp3XKzufID3ALex7dE/PEV3J3W7KBcGShlYDo w=; X-IronPort-AV: E=Sophos;i="6.11,203,1725321600"; d="scan'208";a="239250842" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.43.8.2]) by smtp-border-fw-52004.iad7.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2024 21:23:43 +0000 Received: from EX19MTAUWA001.ant.amazon.com [10.0.7.35:59134] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.24.95:2525] with esmtp (Farcaster) id 4eaa9cf1-d5ac-4306-a5ef-64f2fe7646f0; Mon, 14 Oct 2024 21:23:42 +0000 (UTC) X-Farcaster-Flow-ID: 4eaa9cf1-d5ac-4306-a5ef-64f2fe7646f0 Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWA001.ant.amazon.com (10.250.64.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Mon, 14 Oct 2024 21:23:40 +0000 Received: from 6c7e67c6786f.amazon.com (10.106.101.44) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.35; Mon, 14 Oct 2024 21:23:35 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH net-next v3 2/9] Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create() Date: Mon, 14 Oct 2024 14:23:28 -0700 Message-ID: <20241014212328.97507-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241014153808.51894-3-ignat@cloudflare.com> References: <20241014153808.51894-3-ignat@cloudflare.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D031UWA003.ant.amazon.com (10.13.139.47) To EX19D004ANA001.ant.amazon.com (10.37.240.138) From: Ignat Korchagin Date: Mon, 14 Oct 2024 16:38:01 +0100 > bt_sock_alloc() allocates the sk object and attaches it to the provided > sock object. On error l2cap_sock_alloc() frees the sk object, but the > dangling pointer is still attached to the sock object, which may create > use-after-free in other code. > > Signed-off-by: Ignat Korchagin Reviewed-by: Kuniyuki Iwashima Checked all bt_sock_alloc() paths and confirmed only rfcomm and l2cap need changes.