Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp912560pxt; Thu, 5 Aug 2021 15:05:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4DtoUMFC7XOxPvyNupLWCER8Qys2n3mLTQC+IZBMmntfnQWzO4A8KI9DQmOHjmiPp4a5n X-Received: by 2002:a17:906:b094:: with SMTP id x20mr6764429ejy.257.1628201111427; Thu, 05 Aug 2021 15:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628201111; cv=none; d=google.com; s=arc-20160816; b=mKWwkNzcinCqaLv05RyuR/slOEpzjd8EGHTIYpqguNw5s5RAgga70/2/NUh4ICv8JD R7TND8/JyxFEfW7q1zEYKKNorRJ3BX8wESrMu7sWpihxiPfWf8LGIQ7cE+k0EtxxpYhc 1Ci3dGQ4u3+nE415LLahhoHHTN/v0CU0BWfPmPK4Q8y//MttDH0cUmq9XUGTJQ96mYcG ubrUHQ4tawj+q0779dQp0Dn7RWCVFHl9RfLkpU431gsyokchtY2ZpbHpnLVimYW3ISVo 9cSHPtgZ0O9Gec6JVaOmijBYkiBdMXmGTewaTL1TOvHOUhQtY6EsjxYqlEyjO7djKzGM lZUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=QtEJXxNyae++bRJM1hzeM+1SuYlXAKk7u5fhGYxdyoE=; b=DxXeSl5oSBspehjNW7OB2V7SANF8GmpwSdfSi37QAVlAl9WYZS0csOu9aZuDRtAUrq HRB1CQBQZppeyAUHPY6SMUmD+VltV/BUzPoRRlwzN5OOTQDDSUWM6hvsnUrwT8uB2WMd RT6chEQBciy+UZrlIku3SD3Ffr9sAbEgUouaptHGXYyuu3u4CbmHL+CUZ5JEN7NNRsvy TtcfT9B5LPUO9Ie2NWB6Ulj3SNGGcdHuxJ9schej8n04Ti7FoJA5vDYuxdmIGjQrlzbX HCMHyuAR/DyS7vUAPTra7C6Sd68qFSwyH+XMX4yS2yXt8VIQmBaC9gqqKuD8aeGLSP2g ch6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sIJ09dbq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si7139444ejp.458.2021.08.05.15.04.46; Thu, 05 Aug 2021 15:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=sIJ09dbq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235709AbhHEV7r (ORCPT + 99 others); Thu, 5 Aug 2021 17:59:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:52578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbhHEV7q (ORCPT ); Thu, 5 Aug 2021 17:59:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F21AF61157; Thu, 5 Aug 2021 21:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628200772; bh=MeLnT3CMobnAZ0zp49eYFHn5nhm9lSY2nSjIl9/FEaA=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=sIJ09dbqA6QWegRxG83cdvb2iyJ5XozAN4pFGeilJSAtq2xF7N4l+BJ5lYvNrj9J+ +8UO3YH+QcAqRYnR/A6Ybg9g76+Z4zCp/O++V9gsUpHOJ5OgILfFJx08H2sCJbV74N 7evD+xE5ACYmX7GRUWKEx5/UGG4MGU+hrqET9lHwcfj4TaMdFNY9hEyjyVrf7JHvOx YFYmViW1UJVGVmGY95ZvVD2rNLPOSvgK68+Dss8JJJtk2tRaeHEIpqUqDl4IBCmO8o f+1T6cF8oNP4fp8HO04e5jZzBeRnp8yqF2GYnbBI5XBes8zxx93EpLRENHEW1PFOCd +RjdQHFyi1/uw== Received: by mail-oo1-f54.google.com with SMTP id o17-20020a4a64110000b0290263e1ba7ff9so1722373ooc.2; Thu, 05 Aug 2021 14:59:31 -0700 (PDT) X-Gm-Message-State: AOAM533dSa8UMPHicpsT9AkrwclIZ17CGaZMaAcvIprldUEiXtY7ygKG OUzExqOBOywVKDlH6IFZOTJl/xYF+ZpHo8oQw38= X-Received: by 2002:a4a:e382:: with SMTP id l2mr4836128oov.85.1628200771299; Thu, 05 Aug 2021 14:59:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:7203:0:0:0:0:0 with HTTP; Thu, 5 Aug 2021 14:59:30 -0700 (PDT) In-Reply-To: <20210805110219.GJ22532@kadam> References: <20210805060546.3268-1-namjae.jeon@samsung.com> <20210805060546.3268-9-namjae.jeon@samsung.com> <20210805110219.GJ22532@kadam> From: Namjae Jeon Date: Fri, 6 Aug 2021 06:59:30 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Linux-cifsd-devel] [PATCH v7 08/13] ksmbd: add smb3 engine part 1 To: Dan Carpenter Cc: Namjae Jeon , linux-cifs@vger.kernel.org, aurelien.aptel@gmail.com, linux-cifsd-devel@lists.sourceforge.net, sandeen@sandeen.net, linux-kernel@vger.kernel.org, willy@infradead.org, hch@infradead.org, senozhatsky@chromium.org, viro@zeniv.linux.org.uk, ronniesahlberg@gmail.com, linux-fsdevel@vger.kernel.org, Steve French , hch@lst.de, christian@brauner.io Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dan, 2021-08-05 20:02 GMT+09:00, Dan Carpenter : > On Thu, Aug 05, 2021 at 03:05:41PM +0900, Namjae Jeon wrote: >> +/** >> + * check_session_id() - check for valid session id in smb header >> + * @conn: connection instance >> + * @id: session id from smb header >> + * >> + * Return: 1 if valid session id, otherwise 0 >> + */ >> +static inline int check_session_id(struct ksmbd_conn *conn, u64 id) > > Make this bool. Same for all the is_* functions. Okay, I will fix it on next version. > >> +{ >> + struct ksmbd_session *sess; >> + >> + if (id == 0 || id == -1) >> + return 0; >> + >> + sess = ksmbd_session_lookup_all(conn, id); >> + if (sess) >> + return 1; >> + pr_err("Invalid user session id: %llu\n", id); >> + return 0; >> +} >> + >> +struct channel *lookup_chann_list(struct ksmbd_session *sess, struct >> ksmbd_conn *conn) >> +{ >> + struct channel *chann; >> + >> + list_for_each_entry(chann, &sess->ksmbd_chann_list, chann_list) { >> + if (chann->conn == conn) >> + return chann; >> + } >> + >> + return NULL; >> +} >> + >> +/** >> + * smb2_get_ksmbd_tcon() - get tree connection information for a tree id >> + * @work: smb work >> + * >> + * Return: matching tree connection on success, otherwise error > > This documentation seems out of date. Okay. > >> + */ >> +int smb2_get_ksmbd_tcon(struct ksmbd_work *work) >> +{ >> + struct smb2_hdr *req_hdr = work->request_buf; >> + int tree_id; >> + >> + work->tcon = NULL; >> + if (work->conn->ops->get_cmd_val(work) == SMB2_TREE_CONNECT_HE || >> + work->conn->ops->get_cmd_val(work) == SMB2_CANCEL_HE || >> + work->conn->ops->get_cmd_val(work) == SMB2_LOGOFF_HE) { >> + ksmbd_debug(SMB, "skip to check tree connect request\n"); >> + return 0; >> + } >> + >> + if (xa_empty(&work->sess->tree_conns)) { >> + ksmbd_debug(SMB, "NO tree connected\n"); >> + return -1; > > Better to return -EINVAL. Okay, Will fix it. Thanks for your review! > >> + } >> + >> + tree_id = le32_to_cpu(req_hdr->Id.SyncId.TreeId); >> + work->tcon = ksmbd_tree_conn_lookup(work->sess, tree_id); >> + if (!work->tcon) { >> + pr_err("Invalid tid %d\n", tree_id); >> + return -1; >> + } >> + >> + return 1; >> +} > > regards, > dan carpenter > > > _______________________________________________ > Linux-cifsd-devel mailing list > Linux-cifsd-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-cifsd-devel >