Received: by 2002:ac8:6d01:0:b0:423:7e07:f8e4 with SMTP id o1csp6620714qtt; Mon, 18 Dec 2023 01:39:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZYD7Obi/MknClr7Mb39Pg92+13xLlm32AGjUIqxOddIYN/qiLL9qK2F8DhDUMifzpf69/ X-Received: by 2002:a05:620a:577:b0:780:f33e:d011 with SMTP id p23-20020a05620a057700b00780f33ed011mr60608qkp.81.1702892360828; Mon, 18 Dec 2023 01:39:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702892360; cv=none; d=google.com; s=arc-20160816; b=oL7wuPHoKbFccHa7IY/Qonl2YZqFZiZdYhnIdNJhZW5pSi95KZ8/ATWyfyAEO/Rb4S je8G1NJ2h5mtcU7VHWYQD7vvPWJ2PQRv0HiFTvLXF9sHOU5S+8grQs1rnSkcT4NtSRLW HYpbX8TtpZAis1IPdsvJFnjrLHcHXNhOjpEHnNUZB1EBZgzn3Kum2KgtBEdS1NuaFZ6+ ymTapRrt4cgsTkgvITjoVF95wafJqHVeU/sINKvsbgCtufb+cjowtqu37FYUNrI2IKqO yGKBJn3cW10BUQKfZY8Qop/KcgzrRNsxUAXMQ+PVMjQAsag7RARBbOB/6HUyvxLjPrtH oJPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=yRPdYcUK3bn4d/UXXQLaapxgT6fJS3k55mWLhcaaxas=; fh=wzMFJR73Nrh2T0mnQfDDYy6EqJs8gFPpUb/MuCNRfcs=; b=lj/cmKTQxYYbvxVt8Hs4w5huO+J4ThMSmRrGod3zvNosFP0FRwQHqbUg2NhxRj2JXb B/elMJgjFot9PLxQLPD0pRms0aXWWU7oAV52r2M2UM07wBGaKiKiUl/O69V5onVwtU6N NHhdS4MBzg+WSD3tAmx+CfM+c+yHN9cvxvuLaFw2GXPMwCk5nLt4tENDzAaNxg9nIeg9 pd38SKDtk7DMb/NhiGJv/jHaoGhiXST+K4duSwvsbPRMFF2u+PO6Ej/TTd0JNwAN+7dx d+iOhJWi7uiwwOlTP6jmIFn4ZRNe3Tv5zCVdtqvdIO2ukSi2zdAyVSh3YlN5yvDtMbFY PJNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o+mDdHN2; spf=pass (google.com: domain of linux-kernel+bounces-3256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e23-20020a37ac17000000b0077f0d4adc3asi22920133qkm.15.2023.12.18.01.39.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 01:39:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o+mDdHN2; spf=pass (google.com: domain of linux-kernel+bounces-3256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9BE721C227BC for ; Mon, 18 Dec 2023 09:39:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA279125CC; Mon, 18 Dec 2023 09:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="o+mDdHN2" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 507A0125AD for ; Mon, 18 Dec 2023 09:39:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a2343c31c4bso120674066b.1 for ; Mon, 18 Dec 2023 01:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702892342; x=1703497142; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=yRPdYcUK3bn4d/UXXQLaapxgT6fJS3k55mWLhcaaxas=; b=o+mDdHN2EtmgjBO6ntxWOFVioz+gL6okdo/e/cJRvzvhMNOEkL4IoyrFdatU7rI9R4 dS7cfNKaHy9Xj6m0V+EH8l2OmXhaztNbmB3swKazTqBg0Mwd1L7ujI+XwF8D+lZGqDEn ozqgB412mHq7/UZVyU/ctIAO397zLqixkbtCxL/lmLriVYtowHiW6nbWglG6xo/HabC7 h78i46ueaP6bY3tNFy3FEDCeTM/TiMi5AtrDHq3UmdC8zSJ5A118arQP8nkajAz4RqJ5 trVAqmBadYRzqzCE6IfBs/M94I+xgoncNVvehSXpST5CGZoAdw4z0jnn9e6h5sG72p3N l6Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702892342; x=1703497142; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yRPdYcUK3bn4d/UXXQLaapxgT6fJS3k55mWLhcaaxas=; b=ehrEALyzbYasWe57yl6VfPqWoMcRnh1J5u9IaWRqetn1KSxYxWn9TD/Bzu8Dmy0PlA g/7uS0ZvSysUZdlpXcn8OynpwlNTzhyjcO9rWy0rbgecIfyN3lPl8wSE1R7F8+HfMxSN UY7gmhRAElqz91XfDcniYlJ4MpCb7c3o79woZhynmzlUHd4djm6m0vvN69UVUeHDGgHC lv28/pNgu/N0LLQn6pE2W2nMp9eVC2EoMuGQ1nxgeB0Gk7EZbVgmQOpIUYmCb80AIIKN AanA8go1dK9kHKRlMa+kV1ADXmgu9FDZni8AFtZGO5OHu/YOo6CUNS+JbcRTU3pX2RYD hG1Q== X-Gm-Message-State: AOJu0Yy93SFVEiUeXd1q2usNjRho/Ze0EiTGteClQyxGNqWpQsvN2b0Z OJmKrhGe03+h372lnpj8RONSvQ== X-Received: by 2002:a17:907:9349:b0:a23:4c0c:7cb3 with SMTP id bv9-20020a170907934900b00a234c0c7cb3mr677668ejc.120.1702892342527; Mon, 18 Dec 2023 01:39:02 -0800 (PST) Received: from [192.168.1.20] ([178.197.218.27]) by smtp.gmail.com with ESMTPSA id cw10-20020a170907160a00b009bf7a4d591csm14136712ejd.11.2023.12.18.01.39.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Dec 2023 01:39:01 -0800 (PST) Message-ID: <6160aa1e-5f77-4d7d-aafd-e1ac7606bf06@linaro.org> Date: Mon, 18 Dec 2023 10:39:00 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v6 1/2] nfc: llcp_core: Hold a ref to llcp_local->dev when holding a ref to llcp_local Content-Language: en-US To: Siddh Raman Pant , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Suman Ghosh Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+bbe84a4010eeea00982d@syzkaller.appspotmail.com References: <0d812b9aae2f16691d373460b06c5f3e098ed2a6.1702816635.git.code@siddh.me> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewAR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w4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <0d812b9aae2f16691d373460b06c5f3e098ed2a6.1702816635.git.code@siddh.me> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 17/12/2023 14:11, Siddh Raman Pant wrote: > static struct nfc_llcp_sock *nfc_llcp_sock_get(struct nfc_llcp_local *local, > @@ -959,8 +974,18 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local, > } > > new_sock = nfc_llcp_sock(new_sk); > - new_sock->dev = local->dev; > + > new_sock->local = nfc_llcp_local_get(local); > + if (!new_sock->local) { > + reason = LLCP_DM_REJ; > + release_sock(&sock->sk); > + sock_put(&sock->sk); > + sock_put(&new_sock->sk); Why is this needed? Which part earlier gets the reference? > + nfc_llcp_sock_free(new_sock); This order is still wrong. Unwinding is almost always done in reversed order, for good reasons. Why do you unwind in other order? > + goto fail; > + } > + > + new_sock->dev = local->dev; > new_sock->rw = sock->rw; > new_sock->miux = sock->miux; Best regards, Krzysztof