From patchwork Thu Mar 7 10:35:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 1052781 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=cloudflare.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=cloudflare.com header.i=@cloudflare.com header.b="TUzk24/l"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44FRqS597Dz9sB3 for ; Thu, 7 Mar 2019 21:35:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726359AbfCGKfr (ORCPT ); Thu, 7 Mar 2019 05:35:47 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:43839 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726217AbfCGKfr (ORCPT ); Thu, 7 Mar 2019 05:35:47 -0500 Received: by mail-lj1-f195.google.com with SMTP id z20so13750110ljj.10 for ; Thu, 07 Mar 2019 02:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=from:to:cc:subject:date:message-id; bh=/4kzVeMV8jEYUvDn+wkY+I59zZYnAbiSTWhHyRuwe0I=; b=TUzk24/l03vmCheANUfDtuiM4c/YbsY+ggiQxkOW7kWDBm7M3sbnDMmk49ZuxFOV/3 Uhc38jjDUAvNQFAjpbwBjKaeNNahpewnNcN5ayuZ2fCNbytIm3zAKNDVoNRmNnMt0/aC l/UofFCSVUIYAAh2N1DyM3yjAllUo8d2GBQjA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/4kzVeMV8jEYUvDn+wkY+I59zZYnAbiSTWhHyRuwe0I=; b=E/FhwM75g9BbrKPJBDIye0ytYuGHi3AR8afQk9HWVWSIVCVvTP5Nq2CvMm9Rf+/dk2 ml8n/uYlpM2jUbiwmhz1b2mDwMJE4WdB9PmbHAarAz7zQcj5azOufMSkDsJcWX2BnKqX Cx335FH9vHd9ityNOgXVJE+96hKhPbSFoaZ6zwXA9lH6fzpq/SYruGZXinx49RRF2jsk M7u3RCg0ZB8o7ykTj5+xtVE04ZHbrOztqY1ixxsEykdRKWEr6zDrTqzUGOfcODU+5qV+ aCbGYiz+xqjYDVWUM5TGv3/K0HuTqrSnhnpAIbBdOC/5AaLJgm3uq0zfdKj2fsfqrbxS iq7Q== X-Gm-Message-State: APjAAAWuQ1XEYoLrC11R5c2zQv0a+BZlicF0nWOeAeEh9tWN5Xu5+GmW npB5D0dsrWgFnNAAAxWy1Z+9F47vAobcYA== X-Google-Smtp-Source: APXvYqyl3dANFBoq2TQZaAvx3eYuc4TXivnEvXflSrVXDtOUKvJ4Qjn3bMsyz1u/fUUSTkeiVKwLFg== X-Received: by 2002:a2e:814d:: with SMTP id t13mr5310228ljg.46.1551954944585; Thu, 07 Mar 2019 02:35:44 -0800 (PST) Received: from cloudflare.com ([176.221.114.230]) by smtp.gmail.com with ESMTPSA id x18sm763087ljc.67.2019.03.07.02.35.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Mar 2019 02:35:43 -0800 (PST) From: Jakub Sitnicki To: netdev@vger.kernel.org Cc: Daniel Borkmann , Song Liu , Marek Majkowski Subject: [PATCH bpf] bpf: Stop the psock parser before canceling its work Date: Thu, 7 Mar 2019 11:35:43 +0100 Message-Id: <20190307103543.15151-1-jakub@cloudflare.com> X-Mailer: git-send-email 2.17.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We might have never enabled (started) the psock's parser, in which case it will not get stopped when destroying the psock. This leads to a warning when trying to cancel parser's work from psock's deferred destructor: [ 405.325769] WARNING: CPU: 1 PID: 3216 at net/strparser/strparser.c:526 strp_done+0x3c/0x40 [ 405.326712] Modules linked in: [last unloaded: test_bpf] [ 405.327359] CPU: 1 PID: 3216 Comm: kworker/1:164 Tainted: G W 5.0.0 #42 [ 405.328294] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20180531_142017-buildhw-08.phx2.fedoraproject.org-1.fc28 04/01/2014 [ 405.329712] Workqueue: events sk_psock_destroy_deferred [ 405.330254] RIP: 0010:strp_done+0x3c/0x40 [ 405.330706] Code: 28 e8 b8 d5 6b ff 48 8d bb 80 00 00 00 e8 9c d5 6b ff 48 8b 7b 18 48 85 ff 74 0d e8 1e a5 e8 ff 48 c7 43 18 00 00 00 00 5b c3 <0f> 0b eb cf 66 66 66 66 90 55 89 f5 53 48 89 fb 48 83 c7 28 e8 0b [ 405.332862] RSP: 0018:ffffc900026bbe50 EFLAGS: 00010246 [ 405.333482] RAX: ffffffff819323e0 RBX: ffff88812cb83640 RCX: ffff88812cb829e8 [ 405.334228] RDX: 0000000000000001 RSI: ffff88812cb837e8 RDI: ffff88812cb83640 [ 405.335366] RBP: ffff88813fd22680 R08: 0000000000000000 R09: 000073746e657665 [ 405.336472] R10: 8080808080808080 R11: 0000000000000001 R12: ffff88812cb83600 [ 405.337760] R13: 0000000000000000 R14: ffff88811f401780 R15: ffff88812cb837e8 [ 405.338777] FS: 0000000000000000(0000) GS:ffff88813fd00000(0000) knlGS:0000000000000000 [ 405.339903] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 405.340821] CR2: 00007fb11489a6b8 CR3: 000000012d4d6000 CR4: 00000000000406e0 [ 405.341981] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 405.343131] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 405.344415] Call Trace: [ 405.344821] sk_psock_destroy_deferred+0x23/0x1b0 [ 405.345585] process_one_work+0x1ae/0x3e0 [ 405.346110] worker_thread+0x3c/0x3b0 [ 405.346576] ? pwq_unbound_release_workfn+0xd0/0xd0 [ 405.347187] kthread+0x11d/0x140 [ 405.347601] ? __kthread_parkme+0x80/0x80 [ 405.348108] ret_from_fork+0x35/0x40 [ 405.348566] ---[ end trace a4a3af4026a327d4 ]--- Stop psock's parser just before canceling its work. Fixes: 1d79895aef18 ("sk_msg: Always cancel strp work before freeing the psock") Reported-by: kernel test robot Signed-off-by: Jakub Sitnicki --- The warning can cause noise in the kernel log. I'm not aware of any other problems. Nevertheless please consider queuing it up for -stable. net/core/skmsg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 8c826603bf36..8bc0ba1ebabe 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -545,6 +545,7 @@ static void sk_psock_destroy_deferred(struct work_struct *gc) struct sk_psock *psock = container_of(gc, struct sk_psock, gc); /* No sk_callback_lock since already detached. */ + strp_stop(&psock->parser.strp); strp_done(&psock->parser.strp); cancel_work_sync(&psock->work);