Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3550141imm; Thu, 17 May 2018 10:28:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpIJABiZhWZEtW8F039kw3ecH4r5KLW1JGTYx/1p0Yt7tfbj+wYSB2nWTU6WgGWP4YtDOze X-Received: by 2002:a63:4044:: with SMTP id n65-v6mr619929pga.116.1526578096873; Thu, 17 May 2018 10:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526578096; cv=none; d=google.com; s=arc-20160816; b=HXbnalNTJJn4zrEv4xULg3eLSnNFSaDYBTKqpMgaToCjmETSneog1pWycEBAE4rEjq bOCSEhnt94YzX+dsruAr9yvnrVVoiqiNQ4YE58qJHKuLdNG5lrOeHUcxh322qUGTVsdz 8BPRE1l2CGBOCZeczKZJVAF4p4Sd59cYZTSLWk5IwNMDfb9HuCuo9in2YqX0c+cQaDqy ug06Tv4hkz8xBtZeRIp2OKMr5Eb73A2YJkxEcu3KFoewWDcr5sKnMHPtMcitny0+n8YK kmre/KmNobot3gTx7i3Ie3+5qVs2mCuKguVSqMYxMLfoXFC0j6g6yWytQc+mAcajUS1T 8Viw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=+HoZ4f3rPWrKmBzAwTkzaqhxUF8X8YsYtbc4W4buOLw=; b=UIKFOYlFAzU4Zeear/o4kxwMvEHbtyDjBiu5xrROiYWlSdIsl5qEg4NK8DPVGyamwU zT9+B8G+NNzTRCGDH6M9HEmvI0RysHcIdCL5oGCAUa7BNMmE/PDLTR0BBcxjgEdcujrB n0twR/o2HHcWCgVYrH4Wk5C4AT1o02sWwfpCwQnyrJxFTPTzNHn7kpORFY5YU0OKCwfP BhLDwCBNnsBsfPl00C+WuODZ2RvTxlEmNflZDO0cfCsVJUrm3In11kcZqwSyBnekqizN jfIfASyCn2hE83c1iMd3r4VKhjrxwDEcsHoGlqdDuzKk2HCCQfCFiFOjqPCS5ZQFZBWA 2ylw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cRRjQ2Lf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k63-v6si4142631pgc.401.2018.05.17.10.28.01; Thu, 17 May 2018 10:28:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cRRjQ2Lf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752089AbeEQR0j (ORCPT + 99 others); Thu, 17 May 2018 13:26:39 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:40199 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750825AbeEQR0h (ORCPT ); Thu, 17 May 2018 13:26:37 -0400 Received: by mail-io0-f193.google.com with SMTP id g14-v6so2938718ioc.7; Thu, 17 May 2018 10:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+HoZ4f3rPWrKmBzAwTkzaqhxUF8X8YsYtbc4W4buOLw=; b=cRRjQ2Lfd1EVb86OE4TevshmjfjRh+NI9H8AiuBxj4e0Fu86QuLY9IGBmIOOKc4RcU x7vqLyT8HJor0RnlNi/8CkkzLIBb86nYsby2YsHhAN4vgosoz5cpbIaxq5sSuE1gs6tU bCH0mmeWX7RSFwvN7CoEJlCFQuBVWwSAggc70jGF0WoZblOjDtQfKvPqcHf2v0BfsLdv jQCGpluz1HGsLFUD0bqkKFS3t7+s7dC8o8+ipoOywSgqtEvBwFMgSNNjSz7SqpcMEWtg /bjbUgZpaaH7ReoHrEkclc68CJ3/63wLOxoYdYh8dtdjBxN+9US2ZZwMjAvULyrtLMe1 gvZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+HoZ4f3rPWrKmBzAwTkzaqhxUF8X8YsYtbc4W4buOLw=; b=NNPaG9EtPLu3x4Lk0lSJq8H0IX3CF829mc27bSAlCBUD37kVS6bBdISi0tjN/4OXs5 KKL4jLDmkAEhnrYSGV+7IxAUKT5oIJ4hFC3FkDYuLMIh4TDq32XrZXEZm/mzLc9yGTHE 7SA/ZSMgz5WLREztpv2c6VIgLXVwbQXg3xjudk7JomB8u+5/OOa2bGmThLXNowd8zK3y pEI3LVAv09V/Qq0zkqp8H4x2cySMVdccL98bgMFjZsFlAloywlTfXR0CdQ776kvdF0Iq TExfQJ6HpeRGtPr0lBziyIsWKR8t/+hcNMC1aNYgC0lhlrfPAFx6w5DNz2jlCXa6rSH0 ABkA== X-Gm-Message-State: ALKqPwexvDFbvKZ1EKYEuZiH80H53Ys48JHw9eMh8gBFD37ahiRHBEwT w4NC2YMBDyIizLlEvTjsNi3bVblM X-Received: by 2002:a6b:afe4:: with SMTP id p97-v6mr2819352ioo.257.1526577997154; Thu, 17 May 2018 10:26:37 -0700 (PDT) Received: from [192.168.86.24] ([184.63.162.180]) by smtp.gmail.com with ESMTPSA id m137-v6sm3277473itg.14.2018.05.17.10.26.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 10:26:36 -0700 (PDT) Subject: Re: [PATCH 2/2] bpf: sockmap, fix double-free To: "Gustavo A. R. Silva" , Alexei Starovoitov , Daniel Borkmann Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <96e7f5e59eacddc5e32abb72b7686c3e9163a410.1526565461.git.gustavo@embeddedor.com> From: John Fastabend Message-ID: <0a882ea0-9a08-eb1b-4a01-ff1ed8858243@gmail.com> Date: Thu, 17 May 2018 10:26:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <96e7f5e59eacddc5e32abb72b7686c3e9163a410.1526565461.git.gustavo@embeddedor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/17/2018 07:11 AM, Gustavo A. R. Silva wrote: > `e' is being freed twice. > > Fix this by removing one of the kfree() calls. > > Addresses-Coverity-ID: 1468983 ("Double free") > Fixes: 81110384441a ("bpf: sockmap, add hash map support") > Signed-off-by: Gustavo A. R. Silva > --- > kernel/bpf/sockmap.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c > index 41b41fc..c682669 100644 > --- a/kernel/bpf/sockmap.c > +++ b/kernel/bpf/sockmap.c > @@ -1823,7 +1823,6 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map, > write_unlock_bh(&sock->sk_callback_lock); > return err; > out_free: > - kfree(e); > smap_release_sock(psock, sock); > out_progs: > if (verdict) > Thanks. This can happen when a user tries to add a kTLS socket to a sockmap. We need to add some tests for kTLS + sockmap cases. Acked-by: John Fastabend