Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2961913pxb; Mon, 18 Oct 2021 05:39:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo1Ch6aHDVFwvCSK+2WuVMCHRAMLSVkTTgZ0WvQgCDvcjaxICfYGGHHnbX6gh7mUcXUWts X-Received: by 2002:a17:90b:2349:: with SMTP id ms9mr33515746pjb.45.1634560764205; Mon, 18 Oct 2021 05:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634560764; cv=none; d=google.com; s=arc-20160816; b=txPK8Ks7wB2mZiL6J5gfXMcnqyy16zMGKFXRPHPU/Tr9MVxkeA0plrcW84naT+WmCa cM5lwC3Smrbff6gGjpVxVIVqvT2MraQpHa8pldnJIrSE4ly/o14E3SfQ4hTiP4oqcr7D 9ggIYnitPRRq5aeqRDqQcohZp15I/cNmgt/908/LdKvj9Anp8g+YXKF3+4NPx5dl/8Oa Vbhg4PnW/PWFJeKKVkmwlBG44AAkbWnxFev9qvWm71sCBQkI/5Pg0ZNaUCBOWLrtIne8 7KciwTtykIqkOkdmHak+8zrmGeFAW+ffjk2IuhWwH5/5dKkTnSktV9/ZbLUwcf4h1mWR 6f9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3D7vJ2CO2XMEmMZh2MVP6JvkEYwgmfgFmLBCLmoiFCU=; b=caoiI7G58hvUft3+/O+XhasnC3DEjMCXIZqvMVP3OLMjx9kF/Uu2s7q/4e8vqeO+3F SizmSIo55r3/lHwwXHj8BmMGGc2WEFShs0U5dzhtfAH7LAAJ8NCm5NosbT9yTYG77R2A TgVobXCODs2KMW1EXh5R5hmkhDwljB3olejIhrzW44gPbUvD980PezQSAE1DbFn/Zm0K e7xauL4rWYoIWS7GEHniy0thuePjMpMjU8d/V7Em0X/Cm6HGxFop0sTdfa0UjgSUV8t9 wNvWJW8Y4028dPZZOZQGTwLoG0GWoRYEVJlSvwP0NSUA4K3E/My3tqPBUycAT6zUttvO IiOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SyS5M378; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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. [23.128.96.18]) by mx.google.com with ESMTP id z7si17290929pfg.15.2021.10.18.05.39.10; Mon, 18 Oct 2021 05:39:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SyS5M378; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 S231724AbhJRMlJ (ORCPT + 99 others); Mon, 18 Oct 2021 08:41:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbhJRMlD (ORCPT ); Mon, 18 Oct 2021 08:41:03 -0400 Received: from mail-ua1-x936.google.com (mail-ua1-x936.google.com [IPv6:2607:f8b0:4864:20::936]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26DDEC06176C; Mon, 18 Oct 2021 05:38:49 -0700 (PDT) Received: by mail-ua1-x936.google.com with SMTP id i15so4726843uap.0; Mon, 18 Oct 2021 05:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3D7vJ2CO2XMEmMZh2MVP6JvkEYwgmfgFmLBCLmoiFCU=; b=SyS5M378yS/ljDYnutUpPjvYWUz2wikfuz5/vW6GtZmZ/iLUuiTyJZE313Gk/gMmvk ZbV3KNcI9welOW2jO+dIx4okltfVVIGoDjjA0ILQXdCkUKgJGaH+r9YJUcLpUP3I7NI/ M5JBLSVPZ+7rIXDlyuMqJeYKoUA8qo32wmsLwLwj5IL1IkNpgBxmwRnbFqmgJVuiFSaO QCL4JSp0eetDd1AgwPWohbm2EhHndOxiqWQDEq92M1opfqRYPfEZ/MEAPnpGgKjSQN8E dFGcOlAOU+bSlZXjqMQDutnE5nuDH7zTLnvz9xXiMSjiagLAwJvKC7abkQP8K5Yxwq3w rq5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3D7vJ2CO2XMEmMZh2MVP6JvkEYwgmfgFmLBCLmoiFCU=; b=UDi1B038jDV2jETrNuGr3f3P5BQ0KzRvr95H8uGBf6YSS5fPU/1X1bacK8Ur+5VZRN R2MZb/TtI+irw8R+AexXXzJ+EwpKca+kkPC6UDU9gKu1q/W0mDgyH9ptRX2esg8EmSru ch1yOmYVaFfJA0ol7FVZBYoJF6K2sHTPJb1cFhAnU49UEsBNyeQ/zb6qL6cqoxGpbBSG Uy8ovbXlv0+w0z9YTMWpohAbPowG13Qg39Z8GT7bfIlmIbOdFYlfkBLVGyymaQQHjT6e hl+Cvb65Ce6cL15aWqa8RvNJp23bHep6ymW13GT4ijTd0lnwZQRZnDK82vbrrMKWFmYw gDYQ== X-Gm-Message-State: AOAM532e04vn7aOqX15rTm1HvZpTLYT6G9RUITYtKpeD38v728la1uMI ApM+dupzvF8G30L4UN3kn+dogeXLGtA= X-Received: by 2002:ab0:6e91:: with SMTP id b17mr25871332uav.117.1634560727995; Mon, 18 Oct 2021 05:38:47 -0700 (PDT) Received: from nyarly.rlyeh.local ([179.233.244.167]) by smtp.gmail.com with ESMTPSA id k1sm8585304uaq.0.2021.10.18.05.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 05:38:47 -0700 (PDT) From: Thiago Rafael Becker To: linux-nfs@vger.kernel.org Cc: Thiago Rafael Becker , Trond Myklebust , Anna Schumaker , "J . Bruce Fields" , Chuck Lever , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Thiago Rafael Becker Subject: [PATCH] sunrpc: bug on rpc_task_set_client when no client is present. Date: Mon, 18 Oct 2021 09:38:12 -0300 Message-Id: <20211018123812.71482-1-trbecker@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If we pass a NULL client to rpc_task_set_client and no client is attached to the task, then the kernel will crash later. Antecipate the crash by checking if a client is available for the task. Signed-off-by: Thiago Rafael Becker --- net/sunrpc/clnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index f056ff931444..ccbc9a9715da 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1076,7 +1076,7 @@ void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt) static void rpc_task_set_client(struct rpc_task *task, struct rpc_clnt *clnt) { - + BUG_ON(clnt == NULL && task->tk_client == NULL); if (clnt != NULL) { rpc_task_set_transport(task, clnt); task->tk_client = clnt; -- 2.31.1