Merge 5.15.91 into android14-5.15
Changes in 5.15.91 memory: tegra: Remove clients SID override programming memory: atmel-sdramc: Fix missing clk_disable_unprepare in atmel_ramc_probe() memory: mvebu-devbus: Fix missing clk_disable_unprepare in mvebu_devbus_probe() dmaengine: ti: k3-udma: Do conditional decrement of UDMA_CHAN_RT_PEER_BCNT_REG arm64: dts: imx8mp-phycore-som: Remove invalid PMIC property ARM: dts: imx6ul-pico-dwarf: Use 'clock-frequency' ARM: dts: imx7d-pico: Use 'clock-frequency' ARM: dts: imx6qdl-gw560x: Remove incorrect 'uart-has-rtscts' arm64: dts: imx8mm-beacon: Fix ecspi2 pinmux ARM: imx: add missing of_node_put() HID: intel_ish-hid: Add check for ishtp_dma_tx_map arm64: dts: imx8mm-venice-gw7901: fix USB2 controller OC polarity soc: imx8m: Fix incorrect check for of_clk_get_by_name() reset: uniphier-glue: Use reset_control_bulk API reset: uniphier-glue: Fix possible null-ptr-deref EDAC/highbank: Fix memory leak in highbank_mc_probe() firmware: arm_scmi: Harden shared memory access in fetch_response firmware: arm_scmi: Harden shared memory access in fetch_notification tomoyo: fix broken dependency on *.conf.default RDMA/core: Fix ib block iterator counter overflow IB/hfi1: Reject a zero-length user expected buffer IB/hfi1: Reserve user expected TIDs IB/hfi1: Fix expected receive setup error exit issues IB/hfi1: Immediately remove invalid memory from hardware IB/hfi1: Remove user expected buffer invalidate race affs: initialize fsdata in affs_truncate() PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe() arm64: dts: qcom: msm8992: Don't use sfpb mutex arm64: dts: qcom: msm8992-libra: Add CPU regulators arm64: dts: qcom: msm8992-libra: Fix the memory map phy: ti: fix Kconfig warning and operator precedence NFSD: fix use-after-free in nfsd4_ssc_setup_dul() ARM: dts: at91: sam9x60: fix the ddr clock for sam9x60 amd-xgbe: TX Flow Ctrl Registers are h/w ver dependent amd-xgbe: Delay AN timeout during KR training bpf: Fix pointer-leak due to insufficient speculative store bypass mitigation phy: rockchip-inno-usb2: Fix missing clk_disable_unprepare() in rockchip_usb2phy_power_on() net: nfc: Fix use-after-free in local_cleanup() net: wan: Add checks for NULL for utdm in undo_uhdlc_init and unmap_si_regs net: enetc: avoid deadlock in enetc_tx_onestep_tstamp() sch_htb: Avoid grafting on htb_destroy_class_offload when destroying htb gpio: use raw spinlock for gpio chip shadowed data gpio: mxc: Protect GPIO irqchip RMW with bgpio spinlock gpio: mxc: Always set GPIOs used as interrupt source to INPUT mode wifi: rndis_wlan: Prevent buffer overflow in rndis_query_oid pinctrl/rockchip: Use temporary variable for struct device pinctrl/rockchip: add error handling for pull/drive register getters pinctrl: rockchip: fix reading pull type on rk3568 net: stmmac: Fix queue statistics reading net/sched: sch_taprio: fix possible use-after-free l2tp: Serialize access to sk_user_data with sk_callback_lock l2tp: Don't sleep and disable BH under writer-side sk_callback_lock l2tp: convert l2tp_tunnel_list to idr l2tp: close all race conditions in l2tp_tunnel_register() octeontx2-pf: Avoid use of GFP_KERNEL in atomic context net: usb: sr9700: Handle negative len net: mdio: validate parameter addr in mdiobus_get_phy() HID: check empty report_list in hid_validate_values() HID: check empty report_list in bigben_probe() net: stmmac: fix invalid call to mdiobus_get_phy() pinctrl: rockchip: fix mux route data for rk3568 HID: revert CHERRY_MOUSE_000C quirk usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait usb: gadget: f_fs: Ensure ep0req is dequeued before free_request Bluetooth: Fix possible deadlock in rfcomm_sk_state_change net: ipa: disable ipa interrupt during suspend net/mlx5: E-switch, Fix setting of reserved fields on MODIFY_SCHEDULING_ELEMENT net: mlx5: eliminate anonymous module_init & module_exit drm/panfrost: fix GENERIC_ATOMIC64 dependency dmaengine: Fix double increment of client_count in dma_chan_get() net: macb: fix PTP TX timestamp failure due to packet padding virtio-net: correctly enable callback during start_xmit l2tp: prevent lockdep issue in l2tp_tunnel_register() HID: betop: check shape of output reports cifs: fix potential deadlock in cache_refresh_path() dmaengine: xilinx_dma: call of_node_put() when breaking out of for_each_child_of_node() phy: phy-can-transceiver: Skip warning if no "max-bitrate" drm/amd/display: fix issues with driver unload nvme-pci: fix timeout request state check tcp: avoid the lookup process failing to get sk in ehash table octeontx2-pf: Fix the use of GFP_KERNEL in atomic context on rt ptdma: pt_core_execute_cmd() should use spinlock device property: fix of node refcount leak in fwnode_graph_get_next_endpoint() w1: fix deadloop in __w1_remove_master_device() w1: fix WARNING after calling w1_process() driver core: Fix test_async_probe_init saves device in wrong array selftests/net: toeplitz: fix race on tpacket_v3 block close net: dsa: microchip: ksz9477: port map correction in ALU table entry register thermal/core: Remove duplicate information when an error occurs thermal/core: Rename 'trips' to 'num_trips' thermal: Validate new state in cur_state_store() thermal/core: fix error code in __thermal_cooling_device_register() thermal: core: call put_device() only after device_register() fails net: stmmac: enable all safety features by default tcp: fix rate_app_limited to default to 1 scsi: iscsi: Fix multiple iSCSI session unbind events sent to userspace cpufreq: Add Tegra234 to cpufreq-dt-platdev blocklist kcsan: test: don't put the expect array on the stack cpufreq: Add SM6375 to cpufreq-dt-platdev blocklist ASoC: fsl_micfil: Correct the number of steps on SX controls net: usb: cdc_ether: add support for Thales Cinterion PLS62-W modem drm: Add orientation quirk for Lenovo ideapad D330-10IGL s390/debug: add _ASM_S390_ prefix to header guard s390: expicitly align _edata and _end symbols on page boundary perf/x86/msr: Add Emerald Rapids perf/x86/intel/uncore: Add Emerald Rapids cpufreq: armada-37xx: stop using 0 as NULL pointer ASoC: fsl_ssi: Rename AC'97 streams to avoid collisions with AC'97 CODEC ASoC: fsl-asoc-card: Fix naming of AC'97 CODEC widgets spi: spidev: remove debug messages that access spidev->spi without locking KVM: s390: interrupt: use READ_ONCE() before cmpxchg() scsi: hisi_sas: Set a port invalid only if there are no devices attached when refreshing port id r8152: add vendor/device ID pair for Microsoft Devkit platform/x86: touchscreen_dmi: Add info for the CSL Panther Tab HD platform/x86: asus-nb-wmi: Add alternate mapping for KEY_SCREENLOCK lockref: stop doing cpu_relax in the cmpxchg loop firmware: coreboot: Check size of table entry and use flex-array drm/i915: Allow switching away via vga-switcheroo if uninitialized Revert "selftests/bpf: check null propagation only neither reg is PTR_TO_BTF_ID" drm/i915: Remove unused variable x86: ACPI: cstate: Optimize C3 entry on AMD CPUs fs: reiserfs: remove useless new_opts in reiserfs_remount sysctl: add a new register_sysctl_init() interface kernel/panic: move panic sysctls to its own file panic: unset panic_on_warn inside panic() ubsan: no need to unset panic_on_warn in ubsan_epilogue() kasan: no need to unset panic_on_warn in end_report() exit: Add and use make_task_dead. objtool: Add a missing comma to avoid string concatenation hexagon: Fix function name in die() h8300: Fix build errors from do_exit() to make_task_dead() transition csky: Fix function name in csky_alignment() and die() ia64: make IA64_MCA_RECOVERY bool instead of tristate panic: Separate sysctl logic from CONFIG_SMP exit: Put an upper limit on how often we can oops exit: Expose "oops_count" to sysfs exit: Allow oops_limit to be disabled panic: Consolidate open-coded panic_on_warn checks panic: Introduce warn_limit panic: Expose "warn_count" to sysfs docs: Fix path paste-o for /sys/kernel/warn_count exit: Use READ_ONCE() for all oops/warn limit reads Bluetooth: hci_sync: cancel cmd_timer if hci_open failed drm/amdgpu: complete gfxoff allow signal during suspend without delay scsi: hpsa: Fix allocation size for scsi_host_alloc() KVM: SVM: fix tsc scaling cache logic module: Don't wait for GOING modules tracing: Make sure trace_printk() can output as soon as it can be used trace_events_hist: add check for return value of 'create_hist_field' ftrace/scripts: Update the instructions for ftrace-bisect.sh cifs: Fix oops due to uncleared server->smbd_conn in reconnect i2c: mv64xxx: Remove shutdown method from driver i2c: mv64xxx: Add atomic_xfer method to driver ksmbd: add smbd max io size parameter ksmbd: add max connections parameter ksmbd: do not sign response to session request for guest login ksmbd: downgrade ndr version error message to debug ksmbd: limit pdu length size according to connection status ovl: fail on invalid uid/gid mapping at copy up KVM: x86/vmx: Do not skip segment attributes if unusable bit is set KVM: arm64: GICv4.1: Fix race with doorbell on VPE activation/deactivation thermal: intel: int340x: Protect trip temperature from concurrent updates ipv6: fix reachability confirmation with proxy_ndp ARM: 9280/1: mm: fix warning on phys_addr_t to void pointer assignment EDAC/device: Respect any driver-supplied workqueue polling value EDAC/qcom: Do not pass llcc_driv_data as edac_device_ctl_info's pvt_info net: mana: Fix IRQ name - add PCI and queue number scsi: ufs: core: Fix devfreq deadlocks i2c: designware: use casting of u64 in clock multiplication to avoid overflow netlink: prevent potential spectre v1 gadgets net: fix UaF in netns ops registration error path drm/i915/selftest: fix intel_selftest_modify_policy argument types netfilter: nft_set_rbtree: Switch to node list walk for overlap detection netfilter: nft_set_rbtree: skip elements in transaction from garbage collection netlink: annotate data races around nlk->portid netlink: annotate data races around dst_portid and dst_group netlink: annotate data races around sk_state ipv4: prevent potential spectre v1 gadget in ip_metrics_convert() ipv4: prevent potential spectre v1 gadget in fib_metrics_match() netfilter: conntrack: fix vtag checks for ABORT/SHUTDOWN_COMPLETE netrom: Fix use-after-free of a listening socket. net/sched: sch_taprio: do not schedule in taprio_reset() sctp: fail if no bound addresses can be used for a given scope riscv/kprobe: Fix instruction simulation of JALR nvme: fix passthrough csi check gpio: mxc: Unlock on error path in mxc_flip_edge() ravb: Rename "no_ptp_cfg_active" and "ptp_cfg_active" variables net: ravb: Fix lack of register setting after system resumed for Gen3 net: ravb: Fix possible hang if RIS2_QFF1 happen net: mctp: mark socks as dead on unhash, prevent re-add thermal: intel: int340x: Add locking to int340x_thermal_get_trip_type() net/tg3: resolve deadlock in tg3_reset_task() during EEH net: mdio-mux-meson-g12a: force internal PHY off on mux switch treewide: fix up files incorrectly marked executable tools: gpio: fix -c option of gpio-event-mon Revert "Input: synaptics - switch touchpad on HP Laptop 15-da3001TU to RMI mode" cpufreq: Move to_gov_attr_set() to cpufreq.h cpufreq: governor: Use kobject release() method to free dbs_data kbuild: Allow kernel installation packaging to override pkg-config block: fix and cleanup bio_check_ro x86/i8259: Mark legacy PIC interrupts with IRQ_LEVEL netfilter: conntrack: unify established states for SCTP paths perf/x86/amd: fix potential integer overflow on shift of a int Linux 5.15.91 Change-Id: I3349d802533097ac86e5c680fbd40c00c9719ec7 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -881,7 +881,7 @@ affs_truncate(struct inode *inode)
|
||||
if (inode->i_size > AFFS_I(inode)->mmu_private) {
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
struct page *page;
|
||||
void *fsdata;
|
||||
void *fsdata = NULL;
|
||||
loff_t isize = inode->i_size;
|
||||
int res;
|
||||
|
||||
|
||||
@@ -792,26 +792,27 @@ static int get_dfs_referral(const unsigned int xid, struct cifs_ses *ses, const
|
||||
*/
|
||||
static int cache_refresh_path(const unsigned int xid, struct cifs_ses *ses, const char *path)
|
||||
{
|
||||
int rc;
|
||||
struct cache_entry *ce;
|
||||
struct dfs_info3_param *refs = NULL;
|
||||
struct cache_entry *ce;
|
||||
int numrefs = 0;
|
||||
bool newent = false;
|
||||
int rc;
|
||||
|
||||
cifs_dbg(FYI, "%s: search path: %s\n", __func__, path);
|
||||
|
||||
down_write(&htable_rw_lock);
|
||||
down_read(&htable_rw_lock);
|
||||
|
||||
ce = lookup_cache_entry(path);
|
||||
if (!IS_ERR(ce)) {
|
||||
if (!cache_entry_expired(ce)) {
|
||||
dump_ce(ce);
|
||||
up_write(&htable_rw_lock);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
newent = true;
|
||||
if (!IS_ERR(ce) && !cache_entry_expired(ce)) {
|
||||
up_read(&htable_rw_lock);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Unlock shared access as we don't want to hold any locks while getting
|
||||
* a new referral. The @ses used for performing the I/O could be
|
||||
* reconnecting and it acquires @htable_rw_lock to look up the dfs cache
|
||||
* in order to failover -- if necessary.
|
||||
*/
|
||||
up_read(&htable_rw_lock);
|
||||
|
||||
/*
|
||||
* Either the entry was not found, or it is expired.
|
||||
@@ -819,19 +820,22 @@ static int cache_refresh_path(const unsigned int xid, struct cifs_ses *ses, cons
|
||||
*/
|
||||
rc = get_dfs_referral(xid, ses, path, &refs, &numrefs);
|
||||
if (rc)
|
||||
goto out_unlock;
|
||||
goto out;
|
||||
|
||||
dump_refs(refs, numrefs);
|
||||
|
||||
if (!newent) {
|
||||
rc = update_cache_entry_locked(ce, refs, numrefs);
|
||||
goto out_unlock;
|
||||
down_write(&htable_rw_lock);
|
||||
/* Re-check as another task might have it added or refreshed already */
|
||||
ce = lookup_cache_entry(path);
|
||||
if (!IS_ERR(ce)) {
|
||||
if (cache_entry_expired(ce))
|
||||
rc = update_cache_entry_locked(ce, refs, numrefs);
|
||||
} else {
|
||||
rc = add_cache_entry_locked(refs, numrefs);
|
||||
}
|
||||
|
||||
rc = add_cache_entry_locked(refs, numrefs);
|
||||
|
||||
out_unlock:
|
||||
up_write(&htable_rw_lock);
|
||||
out:
|
||||
free_dfs_info_array(refs, numrefs);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1405,6 +1405,7 @@ void smbd_destroy(struct TCP_Server_Info *server)
|
||||
destroy_workqueue(info->workqueue);
|
||||
log_rdma_event(INFO, "rdma session destroyed\n");
|
||||
kfree(info);
|
||||
server->smbd_conn = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -274,7 +274,7 @@ int ksmbd_conn_handler_loop(void *p)
|
||||
{
|
||||
struct ksmbd_conn *conn = (struct ksmbd_conn *)p;
|
||||
struct ksmbd_transport *t = conn->transport;
|
||||
unsigned int pdu_size;
|
||||
unsigned int pdu_size, max_allowed_pdu_size;
|
||||
char hdr_buf[4] = {0,};
|
||||
int size;
|
||||
|
||||
@@ -299,13 +299,26 @@ int ksmbd_conn_handler_loop(void *p)
|
||||
pdu_size = get_rfc1002_len(hdr_buf);
|
||||
ksmbd_debug(CONN, "RFC1002 header %u bytes\n", pdu_size);
|
||||
|
||||
if (conn->status == KSMBD_SESS_GOOD)
|
||||
max_allowed_pdu_size =
|
||||
SMB3_MAX_MSGSIZE + conn->vals->max_write_size;
|
||||
else
|
||||
max_allowed_pdu_size = SMB3_MAX_MSGSIZE;
|
||||
|
||||
if (pdu_size > max_allowed_pdu_size) {
|
||||
pr_err_ratelimited("PDU length(%u) excceed maximum allowed pdu size(%u) on connection(%d)\n",
|
||||
pdu_size, max_allowed_pdu_size,
|
||||
conn->status);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if pdu size is valid (min : smb header size,
|
||||
* max : 0x00FFFFFF).
|
||||
*/
|
||||
if (pdu_size < __SMB2_HEADER_STRUCTURE_SIZE ||
|
||||
pdu_size > MAX_STREAM_PROT_LEN) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
/* 4 for rfc1002 length field */
|
||||
|
||||
@@ -104,7 +104,9 @@ struct ksmbd_startup_request {
|
||||
*/
|
||||
__u32 sub_auth[3]; /* Subauth value for Security ID */
|
||||
__u32 smb2_max_credits; /* MAX credits */
|
||||
__u32 reserved[128]; /* Reserved room */
|
||||
__u32 smbd_max_io_size; /* smbd read write size */
|
||||
__u32 max_connections; /* Number of maximum simultaneous connections */
|
||||
__u32 reserved[126]; /* Reserved room */
|
||||
__u32 ifc_list_sz; /* interfaces list size */
|
||||
__s8 ____payload[];
|
||||
};
|
||||
|
||||
@@ -242,7 +242,7 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
|
||||
return ret;
|
||||
|
||||
if (da->version != 3 && da->version != 4) {
|
||||
pr_err("v%d version is not supported\n", da->version);
|
||||
ksmbd_debug(VFS, "v%d version is not supported\n", da->version);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
|
||||
return ret;
|
||||
|
||||
if (da->version != version2) {
|
||||
pr_err("ndr version mismatched(version: %d, version2: %d)\n",
|
||||
ksmbd_debug(VFS, "ndr version mismatched(version: %d, version2: %d)\n",
|
||||
da->version, version2);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -453,7 +453,7 @@ int ndr_decode_v4_ntacl(struct ndr *n, struct xattr_ntacl *acl)
|
||||
if (ret)
|
||||
return ret;
|
||||
if (acl->version != 4) {
|
||||
pr_err("v%d version is not supported\n", acl->version);
|
||||
ksmbd_debug(VFS, "v%d version is not supported\n", acl->version);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ int ndr_decode_v4_ntacl(struct ndr *n, struct xattr_ntacl *acl)
|
||||
if (ret)
|
||||
return ret;
|
||||
if (acl->version != version2) {
|
||||
pr_err("ndr version mismatched(version: %d, version2: %d)\n",
|
||||
ksmbd_debug(VFS, "ndr version mismatched(version: %d, version2: %d)\n",
|
||||
acl->version, version2);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ struct ksmbd_server_config {
|
||||
unsigned int share_fake_fscaps;
|
||||
struct smb_sid domain_sid;
|
||||
unsigned int auth_mechs;
|
||||
unsigned int max_connections;
|
||||
|
||||
char *conf[SERVER_CONF_WORK_GROUP + 1];
|
||||
};
|
||||
|
||||
@@ -8613,6 +8613,7 @@ int smb3_decrypt_req(struct ksmbd_work *work)
|
||||
bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work)
|
||||
{
|
||||
struct ksmbd_conn *conn = work->conn;
|
||||
struct ksmbd_session *sess = work->sess;
|
||||
struct smb2_hdr *rsp = work->response_buf;
|
||||
|
||||
if (conn->dialect < SMB30_PROT_ID)
|
||||
@@ -8622,6 +8623,7 @@ bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work)
|
||||
rsp = ksmbd_resp_buf_next(work);
|
||||
|
||||
if (le16_to_cpu(rsp->Command) == SMB2_SESSION_SETUP_HE &&
|
||||
sess->user && !user_guest(sess->user) &&
|
||||
rsp->Status == STATUS_SUCCESS)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -113,8 +113,9 @@
|
||||
#define SMB21_DEFAULT_IOSIZE (1024 * 1024)
|
||||
#define SMB3_DEFAULT_IOSIZE (4 * 1024 * 1024)
|
||||
#define SMB3_DEFAULT_TRANS_SIZE (1024 * 1024)
|
||||
#define SMB3_MIN_IOSIZE (64 * 1024)
|
||||
#define SMB3_MAX_IOSIZE (8 * 1024 * 1024)
|
||||
#define SMB3_MIN_IOSIZE (64 * 1024)
|
||||
#define SMB3_MAX_IOSIZE (8 * 1024 * 1024)
|
||||
#define SMB3_MAX_MSGSIZE (4 * 4096)
|
||||
|
||||
/*
|
||||
* SMB2 Header Definition
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "mgmt/ksmbd_ida.h"
|
||||
#include "connection.h"
|
||||
#include "transport_tcp.h"
|
||||
#include "transport_rdma.h"
|
||||
|
||||
#define IPC_WAIT_TIMEOUT (2 * HZ)
|
||||
|
||||
@@ -303,6 +304,11 @@ static int ipc_server_config_on_startup(struct ksmbd_startup_request *req)
|
||||
init_smb2_max_trans_size(req->smb2_max_trans);
|
||||
if (req->smb2_max_credits)
|
||||
init_smb2_max_credits(req->smb2_max_credits);
|
||||
if (req->smbd_max_io_size)
|
||||
init_smbd_max_io_size(req->smbd_max_io_size);
|
||||
|
||||
if (req->max_connections)
|
||||
server_conf.max_connections = req->max_connections;
|
||||
|
||||
ret = ksmbd_set_netbios_name(req->netbios_name);
|
||||
ret |= ksmbd_set_server_string(req->server_string);
|
||||
|
||||
@@ -75,7 +75,7 @@ static int smb_direct_max_fragmented_recv_size = 1024 * 1024;
|
||||
/* The maximum single-message size which can be received */
|
||||
static int smb_direct_max_receive_size = 8192;
|
||||
|
||||
static int smb_direct_max_read_write_size = 1024 * 1024;
|
||||
static int smb_direct_max_read_write_size = SMBD_DEFAULT_IOSIZE;
|
||||
|
||||
static int smb_direct_max_outstanding_rw_ops = 8;
|
||||
|
||||
@@ -201,6 +201,12 @@ struct smb_direct_rdma_rw_msg {
|
||||
struct scatterlist sg_list[0];
|
||||
};
|
||||
|
||||
void init_smbd_max_io_size(unsigned int sz)
|
||||
{
|
||||
sz = clamp_val(sz, SMBD_MIN_IOSIZE, SMBD_MAX_IOSIZE);
|
||||
smb_direct_max_read_write_size = sz;
|
||||
}
|
||||
|
||||
static inline int get_buf_page_count(void *buf, int size)
|
||||
{
|
||||
return DIV_ROUND_UP((uintptr_t)buf + size, PAGE_SIZE) -
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#define SMB_DIRECT_PORT 5445
|
||||
|
||||
#define SMBD_DEFAULT_IOSIZE (8 * 1024 * 1024)
|
||||
#define SMBD_MIN_IOSIZE (512 * 1024)
|
||||
#define SMBD_MAX_IOSIZE (16 * 1024 * 1024)
|
||||
|
||||
/* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */
|
||||
struct smb_direct_negotiate_req {
|
||||
__le16 min_version;
|
||||
@@ -54,10 +58,12 @@ struct smb_direct_data_transfer {
|
||||
int ksmbd_rdma_init(void);
|
||||
int ksmbd_rdma_destroy(void);
|
||||
bool ksmbd_rdma_capable_netdev(struct net_device *netdev);
|
||||
void init_smbd_max_io_size(unsigned int sz);
|
||||
#else
|
||||
static inline int ksmbd_rdma_init(void) { return 0; }
|
||||
static inline int ksmbd_rdma_destroy(void) { return 0; }
|
||||
static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; }
|
||||
static inline void init_smbd_max_io_size(unsigned int sz) { }
|
||||
#endif
|
||||
|
||||
#endif /* __KSMBD_TRANSPORT_RDMA_H__ */
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#define IFACE_STATE_DOWN BIT(0)
|
||||
#define IFACE_STATE_CONFIGURED BIT(1)
|
||||
|
||||
static atomic_t active_num_conn;
|
||||
|
||||
struct interface {
|
||||
struct task_struct *ksmbd_kthread;
|
||||
struct socket *ksmbd_socket;
|
||||
@@ -185,8 +187,10 @@ static int ksmbd_tcp_new_connection(struct socket *client_sk)
|
||||
struct tcp_transport *t;
|
||||
|
||||
t = alloc_transport(client_sk);
|
||||
if (!t)
|
||||
if (!t) {
|
||||
sock_release(client_sk);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
csin = KSMBD_TCP_PEER_SOCKADDR(KSMBD_TRANS(t)->conn);
|
||||
if (kernel_getpeername(client_sk, csin) < 0) {
|
||||
@@ -239,6 +243,15 @@ static int ksmbd_kthread_fn(void *p)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (server_conf.max_connections &&
|
||||
atomic_inc_return(&active_num_conn) >= server_conf.max_connections) {
|
||||
pr_info_ratelimited("Limit the maximum number of connections(%u)\n",
|
||||
atomic_read(&active_num_conn));
|
||||
atomic_dec(&active_num_conn);
|
||||
sock_release(client_sk);
|
||||
continue;
|
||||
}
|
||||
|
||||
ksmbd_debug(CONN, "connect success: accepted new connection\n");
|
||||
client_sk->sk->sk_rcvtimeo = KSMBD_TCP_RECV_TIMEOUT;
|
||||
client_sk->sk->sk_sndtimeo = KSMBD_TCP_SEND_TIMEOUT;
|
||||
@@ -368,6 +381,8 @@ static int ksmbd_tcp_writev(struct ksmbd_transport *t, struct kvec *iov,
|
||||
static void ksmbd_tcp_disconnect(struct ksmbd_transport *t)
|
||||
{
|
||||
free_transport(TCP_TRANS(t));
|
||||
if (server_conf.max_connections)
|
||||
atomic_dec(&active_num_conn);
|
||||
}
|
||||
|
||||
static void tcp_destroy_socket(struct socket *ksmbd_socket)
|
||||
|
||||
@@ -1205,6 +1205,7 @@ try_again:
|
||||
/* allow 20secs for mount/unmount for now - revisit */
|
||||
if (signal_pending(current) ||
|
||||
(schedule_timeout(20*HZ) == 0)) {
|
||||
finish_wait(&nn->nfsd_ssc_waitq, &wait);
|
||||
kfree(work);
|
||||
return nfserr_eagain;
|
||||
}
|
||||
|
||||
@@ -960,6 +960,10 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!kuid_has_mapping(current_user_ns(), ctx.stat.uid) ||
|
||||
!kgid_has_mapping(current_user_ns(), ctx.stat.gid))
|
||||
return -EOVERFLOW;
|
||||
|
||||
ctx.metacopy = ovl_need_meta_copy_up(dentry, ctx.stat.mode, flags);
|
||||
|
||||
if (parent) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/bpf-cgroup.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/kmemleak.h>
|
||||
#include "internal.h"
|
||||
|
||||
static const struct dentry_operations proc_sys_dentry_operations;
|
||||
@@ -1384,6 +1385,38 @@ struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *tab
|
||||
}
|
||||
EXPORT_SYMBOL(register_sysctl);
|
||||
|
||||
/**
|
||||
* __register_sysctl_init() - register sysctl table to path
|
||||
* @path: path name for sysctl base
|
||||
* @table: This is the sysctl table that needs to be registered to the path
|
||||
* @table_name: The name of sysctl table, only used for log printing when
|
||||
* registration fails
|
||||
*
|
||||
* The sysctl interface is used by userspace to query or modify at runtime
|
||||
* a predefined value set on a variable. These variables however have default
|
||||
* values pre-set. Code which depends on these variables will always work even
|
||||
* if register_sysctl() fails. If register_sysctl() fails you'd just loose the
|
||||
* ability to query or modify the sysctls dynamically at run time. Chances of
|
||||
* register_sysctl() failing on init are extremely low, and so for both reasons
|
||||
* this function does not return any error as it is used by initialization code.
|
||||
*
|
||||
* Context: Can only be called after your respective sysctl base path has been
|
||||
* registered. So for instance, most base directories are registered early on
|
||||
* init before init levels are processed through proc_sys_init() and
|
||||
* sysctl_init().
|
||||
*/
|
||||
void __init __register_sysctl_init(const char *path, struct ctl_table *table,
|
||||
const char *table_name)
|
||||
{
|
||||
struct ctl_table_header *hdr = register_sysctl(path, table);
|
||||
|
||||
if (unlikely(!hdr)) {
|
||||
pr_err("failed when register_sysctl %s to %s\n", table_name, path);
|
||||
return;
|
||||
}
|
||||
kmemleak_not_leak(hdr);
|
||||
}
|
||||
|
||||
static char *append_path(const char *path, char *pos, const char *name)
|
||||
{
|
||||
int namelen;
|
||||
|
||||
@@ -1437,7 +1437,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
|
||||
unsigned long safe_mask = 0;
|
||||
unsigned int commit_max_age = (unsigned int)-1;
|
||||
struct reiserfs_journal *journal = SB_JOURNAL(s);
|
||||
char *new_opts;
|
||||
int err;
|
||||
char *qf_names[REISERFS_MAXQUOTAS];
|
||||
unsigned int qfmt = 0;
|
||||
@@ -1445,10 +1444,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
|
||||
int i;
|
||||
#endif
|
||||
|
||||
new_opts = kstrdup(arg, GFP_KERNEL);
|
||||
if (arg && !new_opts)
|
||||
return -ENOMEM;
|
||||
|
||||
sync_filesystem(s);
|
||||
reiserfs_write_lock(s);
|
||||
|
||||
@@ -1599,7 +1594,6 @@ out_ok_unlocked:
|
||||
out_err_unlock:
|
||||
reiserfs_write_unlock(s);
|
||||
out_err:
|
||||
kfree(new_opts);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user