tun: fix group permission check
Subsystems (12)
Sasha Levin
maintainerPATCH 1/12 tun: fix group permission check
From: Stas Sergeev <[email protected]>
[ Upstream commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3 ]
Currently tun checks the group permission even if the user have matched. Besides going against the usual permission semantic, this has a very interesting implication: if the tun group is not among the supplementary groups of the tun user, then effectively no one can access the tun device. CAP_SYS_ADMIN still can, but its the same as not setting the tun ownership.
This patch relaxes the group checking so that either the user match or the group match is enough. This avoids the situation when no one can access the device even though the ownership is properly set.
Also I simplified the logic by removing the redundant inversions:tun_not_capable() --> !tun_capable()
--- drivers/net/tun.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/tun.c +9 -5
@@ -586,14 +586,18 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,return ret; } -static inline bool tun_not_capable (struct tun_struct *tun) +static inline bool tun_capable (struct tun_struct *tun) {const struct cred *cred =current_cred ();struct net *net =dev_net (tun->dev); -return ((uid_valid (tun->owner) && !uid_eq (cred->euid, tun->owner)) || - (gid_valid (tun->group) && !in_egroup_p (tun->group))) && - !ns_capable (net->user_ns,CAP_NET_ADMIN ); +if (ns_capable (net->user_ns,CAP_NET_ADMIN )) +return 1 ; +if (uid_valid (tun->owner) &&uid_eq (cred->euid, tun->owner)) +return 1 ; +if (gid_valid (tun->group) &&in_egroup_p (tun->group)) +return 1 ; +return 0 ; }static void tun_set_real_num_queues (struct tun_struct *tun)
@@ -2772,7 +2776,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) !!(tun->flags & IFF_MULTI_QUEUE))return -EINVAL ; -if (tun_not_capable (tun)) +if (!tun_capable (tun))return -EPERM ; err =security_tun_dev_open (tun->security);if (err <0 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/12 mmc: core: Respect quirk_max_rate for non-UHS SDIO card
From: Shawn Lin <[email protected]>
[ Upstream commit a2a44f8da29352f76c99c6904ee652911b8dc7dd ]
The card-quirk was added to limit the clock-rate for a card with UHS-mode support, although let's respect the quirk for non-UHS mode too, to make the behaviour consistent.
Message-ID: <[email protected]>
--- drivers/mmc/core/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/core/sdio.c +2 -0
@@ -443,6 +443,8 @@ static unsigned mmc_sdio_get_max_clock(struct mmc_card *card)if (card->type ==MMC_TYPE_SD_COMBO ) max_dtr =min (max_dtr,mmc_sd_get_max_clock (card)); + max_dtr =min_not_zero (max_dtr, card->quirk_max_rate); +return max_dtr; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/12 wifi: brcmsmac: add gain range check to wlc_phy_iqcal_gainparams_nphy()
In reply to Sasha LevinFrom: Dmitry Antipov <[email protected]>
[ Upstream commit 3f4a0948c3524ae50f166dbc6572a3296b014e62 ]
In 'wlc_phy_iqcal_gainparams_nphy()', add gain range check to WARN() instead of possible out-of-bounds 'tbl_iqcal_gainparams_nphy' access. Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +3 -0
@@ -23427,6 +23427,9 @@ wlc_phy_iqcal_gainparams_nphy(struct brcms_phy *pi, u16 core_no,break ; } +if (WARN_ON (k ==NPHY_IQCAL_NUMGAINS )) +return ; + params->txgm = tbl_iqcal_gainparams_nphy[band_idx][k][1 ]; params->pga = tbl_iqcal_gainparams_nphy[band_idx][k][2 ]; params->pad = tbl_iqcal_gainparams_nphy[band_idx][k][3 ];
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/12 tomoyo: don't emit warning in tomoyo_write_control()
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 3df7546fc03b8f004eee0b9e3256369f7d096685 ]
syzbot is reporting too large allocation warning at tomoyo_write_control(), for one can write a very very long line without new line character. To fix this warning, I use __GFP_NOWARN rather than checking for KMALLOC_MAX_SIZE, for practically a valid line should be always shorter than 32KB where the "too small to fail" memory-allocation rule applies.
One might try to write a valid line that is longer than 32KB, but such request will likely fail with -ENOMEM. Therefore, I feel that separately returning -EINVAL when a line is longer than KMALLOC_MAX_SIZE is redundant. There is no need to distinguish over-32KB and over-KMALLOC_MAX_SIZE.
--- security/tomoyo/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/tomoyo/common.c +1 -1
@@ -2673,7 +2673,7 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,if (head->w.avail >= head->writebuf_size -1 ) {const int len = head->writebuf_size *2 ; -char *cp =kzalloc (len,GFP_NOFS ); +char *cp =kzalloc (len,GFP_NOFS | __GFP_NOWARN);if (!cp) { error = -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/12 mfd: lpc_ich: Add another Gemini Lake ISA bridge PCI device-id
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 1e89d21f8189d286f80b900e1b7cf57cb1f3037e ]
On N4100 / N4120 Gemini Lake SoCs the ISA bridge PCI device-id is 31e8 rather the 3197 found on e.g. the N4000 / N4020.
While at fix the existing GLK PCI-id table entry breaking the table being sorted by device-id.
--- drivers/mfd/lpc_ich.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mfd/lpc_ich.c +2 -1
@@ -687,8 +687,9 @@ static const struct pci_device_id lpc_ich_ids[] = { { PCI_VDEVICE(INTEL, 0x2917), LPC_ICH9ME}, { PCI_VDEVICE(INTEL, 0x2918), LPC_ICH9}, { PCI_VDEVICE(INTEL, 0x2919), LPC_ICH9M}, - { PCI_VDEVICE(INTEL, 0x3197), LPC_GLK}, { PCI_VDEVICE(INTEL, 0x2b9c), LPC_COUGARMOUNTAIN}, + { PCI_VDEVICE(INTEL, 0x3197), LPC_GLK}, + { PCI_VDEVICE(INTEL, 0x31e8), LPC_GLK}, { PCI_VDEVICE(INTEL, 0x3a14), LPC_ICH10DO}, { PCI_VDEVICE(INTEL, 0x3a16), LPC_ICH10R}, { PCI_VDEVICE(INTEL, 0x3a18), LPC_ICH10},
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/12 HID: Wacom: Add PCI Wacom device support
In reply to Sasha LevinFrom: Even Xu <[email protected]>
[ Upstream commit c4c123504a65583e3689b3de04a61dc5272e453a ]
Add PCI device ID of wacom device into driver support list.
--- drivers/hid/wacom_wac.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/wacom_wac.c +5 -0
@@ -4851,6 +4851,10 @@ static const struct wacom_features wacom_features_0x94 = HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ .driver_data = (kernel_ulong_t)&wacom_features_##prod +#define PCI_DEVICE_WACOM (prod) \ + HID_DEVICE(BUS_PCI, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ + .driver_data = (kernel_ulong_t)&wacom_features_##prod +#define USB_DEVICE_LENOVO (prod) \ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ .driver_data = (kernel_ulong_t)&wacom_features_##prod
@@ -5020,6 +5024,7 @@ const struct hid_device_id wacom_ids[] = { { USB_DEVICE_WACOM(HID_ANY_ID) }, { I2C_DEVICE_WACOM(HID_ANY_ID) }, + { PCI_DEVICE_WACOM(HID_ANY_ID) }, { BT_DEVICE_WACOM(HID_ANY_ID) }, { } };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/12 net/mlx5: use do_aux_work for PHC overflow checks
In reply to Sasha LevinFrom: Vadim Fedorenko <[email protected]>
[ Upstream commit e61e6c415ba9ff2b32bb6780ce1b17d1d76238f1 ]
The overflow_work is using system wq to do overflow checks and updates for PHC device timecounter, which might be overhelmed by other tasks. But there is dedicated kthread in PTP subsystem designed for such things. This patch changes the work queue to proper align with PTP subsystem and to avoid overloading system work queue.
The adjfine() function acts the same way as overflow check worker, we can postpone ptp aux worker till the next overflow period after adjfine() was called.
--- .../ethernet/mellanox/mlx5/core/lib/clock.c | 24 ++++++++++--------- include/linux/mlx5/driver.h | 1 - 2 files changed, 13 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +13 -11
@@ -150,17 +150,16 @@ static void mlx5_pps_out(struct work_struct *work) } } -static void mlx5_timestamp_overflow (struct work_struct *work) +static long mlx5_timestamp_overflow (struct ptp_clock_info *ptp_info) { -struct delayed_work *dwork =to_delayed_work (work);struct mlx5_core_dev *mdev;struct mlx5_timer *timer;struct mlx5_clock *clock;unsigned long flags; - timer = container_of(dwork, struct mlx5_timer, overflow_work); - clock = container_of(timer, struct mlx5_clock, timer); + clock = container_of(ptp_info, struct mlx5_clock, ptp_info); mdev = container_of(clock, struct mlx5_core_dev, clock); + timer = &clock->timer;if (mdev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR ) goto out;
@@ -171,7 +170,7 @@ static void mlx5_timestamp_overflow(struct work_struct *work)write_sequnlock_irqrestore (&clock->lock, flags); out: -schedule_delayed_work (&timer->overflow_work, timer->overflow_period); +return timer->overflow_period; }static int mlx5_ptp_settime (struct ptp_clock_info *ptp,const struct timespec64 *ts)
@@ -253,6 +252,7 @@ static int mlx5_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta) timer->nominal_c_mult + diff;mlx5_update_clock_info_page (mdev);write_sequnlock_irqrestore (&clock->lock, flags); +ptp_schedule_worker (clock->ptp, timer->overflow_period);return 0 ; }
@@ -467,6 +467,7 @@ static const struct ptp_clock_info mlx5_ptp_clock_info = { .settime64 = mlx5_ptp_settime, .enable = NULL, .verify = NULL, + .do_aux_work = mlx5_timestamp_overflow, }; static int mlx5_query_mtpps_pin_mode(struct mlx5_core_dev *mdev, u8 pin,
@@ -649,12 +650,11 @@ static void mlx5_init_overflow_period(struct mlx5_clock *clock)do_div (ns,NSEC_PER_SEC /HZ ); timer->overflow_period = ns; -INIT_DELAYED_WORK (&timer->overflow_work, mlx5_timestamp_overflow); -if (timer->overflow_period) -schedule_delayed_work (&timer->overflow_work,0 ); -else +if (!timer->overflow_period) { + timer->overflow_period =HZ ;mlx5_core_warn (mdev, -"invalid overflow period, overflow_work is not scheduled\n" ); +"invalid overflow period, overflow_work is scheduled once per second\n" ); + }if (clock_info) clock_info->overflow_period = timer->overflow_period;
@@ -718,6 +718,9 @@ void mlx5_init_clock(struct mlx5_core_dev *mdev)MLX5_NB_INIT (&clock->pps_nb, mlx5_pps_event,PPS_EVENT );mlx5_eq_notifier_register (mdev, &clock->pps_nb); + +if (clock->ptp) +ptp_schedule_worker (clock->ptp,0 ); }void mlx5_cleanup_clock (struct mlx5_core_dev *mdev)
@@ -734,7 +737,6 @@ void mlx5_cleanup_clock(struct mlx5_core_dev *mdev) }cancel_work_sync (&clock->pps_info.out_work); -cancel_delayed_work_sync (&clock->timer.overflow_work);if (mdev->clock_info) {free_page ((unsigned long )mdev->clock_info);
include/linux/mlx5/driver.h +0 -1
@@ -651,7 +651,6 @@ struct mlx5_timer {struct timecounter tc;u32 nominal_c_mult;unsigned long overflow_period; -struct delayed_work overflow_work; };struct mlx5_clock {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/12 i2c: Force ELAN06FA touchpad I2C bus freq to 100KHz
In reply to Sasha LevinFrom: Randolph Ha <[email protected]>
[ Upstream commit bfd74cd1fbc026f04446e67d6915c7e199c2bffd ]
When a 400KHz freq is used on this model of ELAN touchpad in Linux, excessive smoothing (similar to when the touchpad's firmware detects a noisy signal) is sometimes applied. As some devices' (e.g, Lenovo V15 G4) ACPI tables specify a 400KHz frequency for this device and some I2C busses (e.g, Designware I2C) default to a 400KHz freq, force the speed to 100KHz as a workaround.
For future investigation: This problem may be related to the default HCNT/LCNT values given by some busses' drivers, because they are not specified in the aforementioned devices' ACPI tables, and because the device works without issues on Windows at what is expected to be a 400KHz frequency. The root cause of the issue is not known.
--- drivers/i2c/i2c-core-acpi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/i2c/i2c-core-acpi.c +22 -0
@@ -299,6 +299,25 @@ static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = { {} }; +static const struct acpi_device_id i2c_acpi_force_100khz_device_ids[] = { +/* +* When a 400KHz freq is used on this model of ELAN touchpad in Linux, +* excessive smoothing (similar to when the touchpad's firmware detects +* a noisy signal) is sometimes applied. As some devices' (e.g, Lenovo +* V15 G4) ACPI tables specify a 400KHz frequency for this device and +* some I2C busses (e.g, Designware I2C) default to a 400KHz freq, +* force the speed to 100KHz as a workaround. +* +* For future investigation: This problem may be related to the default +* HCNT/LCNT values given by some busses' drivers, because they are not +* specified in the aforementioned devices' ACPI tables, and because +* the device works without issues on Windows at what is expected to be +* a 400KHz frequency. The root cause of the issue is not known. +*/ + {"ELAN06FA" ,0 }, + {} +}; +static acpi_status i2c_acpi_lookup_speed (acpi_handle handle,u32 level,void *data,void **return_value) {
@@ -320,6 +339,9 @@ static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,if (acpi_match_device_ids (adev, i2c_acpi_force_400khz_device_ids) ==0 ) lookup->force_speed =I2C_MAX_FAST_MODE_FREQ ; +if (acpi_match_device_ids (adev, i2c_acpi_force_100khz_device_ids) ==0 ) + lookup->force_speed =I2C_MAX_STANDARD_MODE_FREQ ; +return AE_OK ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/12 APEI: GHES: Have GHES honor the panic= setting
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
[ Upstream commit 5c0e00a391dd0099fe95991bb2f962848d851916 ]
The GHES driver overrides the panic= setting by force-rebooting the system after a fatal hw error has been reported. The intent being that such an error would be reported earlier.
However, this is not optimal when a hard-to-debug issue requires long time to reproduce and when that happens, the box will get rebooted after 30 seconds and thus destroy the whole hw context of when the error happened.
So rip out the default GHES panic timeout and honor the global one.
In the panic disabled (panic=0) case, the error will still be logged to dmesg for later inspection and if panic after a hw error is really required, then that can be controlled the usual way - use panic= on the cmdline or set it in the kernel .config's CONFIG_PANIC_TIMEOUT.
--- drivers/acpi/apei/ghes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/acpi/apei/ghes.c +5 -5
@@ -155,8 +155,6 @@ static unsigned long ghes_estatus_pool_size_request;static struct ghes_estatus_cache *ghes_estatus_caches[GHES_ESTATUS_CACHES_SIZE ];static atomic_t ghes_estatus_cache_alloced; -static int ghes_panic_timeout__read_mostly =30 ; -static void __iomem *ghes_map (u64 pfn,enum fixed_addresses fixmap_idx) {phys_addr_t paddr;
@@ -858,14 +856,16 @@ static void __ghes_panic(struct ghes *ghes,struct acpi_hest_generic_status *estatus, u64 buf_paddr, enum fixed_addresses fixmap_idx) { + const char *msg = GHES_PFX "Fatal hardware error"; +__ghes_print_estatus (KERN_EMERG , ghes->generic, estatus);ghes_clear_estatus (ghes, estatus, buf_paddr, fixmap_idx); -/* reboot to log the error! */ if (!panic_timeout) - panic_timeout = ghes_panic_timeout; -panic ("Fatal hardware error!" ); +pr_emerg ("%s but panic disabled\n" , msg); + +panic (msg); }static int ghes_proc (struct ghes *ghes)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/12 mmc: sdhci-msm: Correctly set the load for the regulator
In reply to Sasha LevinFrom: Yuanjie Yang <[email protected]>
[ Upstream commit 20a0c37e44063997391430c4ae09973e9cbc3911 ]
Qualcomm regulator supports two power supply modes: HPM and LPM. Currently, the sdhci-msm.c driver does not set the load to adjust the current for eMMC and SD. If the regulator dont't set correct load in LPM state, it will lead to the inability to properly initialize eMMC and SD.
Set the correct regulator current for eMMC and SD to ensure that the device can work normally even when the regulator is in LPM.
--- drivers/mmc/host/sdhci-msm.c | 53 ++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-msm.c +51 -2
@@ -131,9 +131,18 @@/* Timeout value to avoid infinite waiting for pwr_irq */ #define MSM_PWR_IRQ_TIMEOUT_MS 5000 +/* Max load for eMMC Vdd supply */ +#define MMC_VMMC_MAX_LOAD_UA 570000 +/* Max load for eMMC Vdd-io supply */ #define MMC_VQMMC_MAX_LOAD_UA 325000 +/* Max load for SD Vdd supply */ +#define SD_VMMC_MAX_LOAD_UA 800000 + +/* Max load for SD Vdd-io supply */ +#define SD_VQMMC_MAX_LOAD_UA 22000 +#define msm_host_readl (msm_host, host, offset) \ msm_host->var_ops->msm_readl_relaxed(host, offset)
@@ -1383,11 +1392,48 @@ static int sdhci_msm_set_pincfg(struct sdhci_msm_host *msm_host, bool level)return ret; } -static int sdhci_msm_set_vmmc (struct mmc_host *mmc) +static void msm_config_vmmc_regulator (struct mmc_host *mmc,bool hpm) +{ +int load; + +if (!hpm) + load =0 ; +else if (!mmc->card) + load =max (MMC_VMMC_MAX_LOAD_UA ,SD_VMMC_MAX_LOAD_UA ); +else if (mmc_card_mmc (mmc->card)) + load =MMC_VMMC_MAX_LOAD_UA ; +else if (mmc_card_sd (mmc->card)) + load =SD_VMMC_MAX_LOAD_UA ; +else +return ; + +regulator_set_load (mmc->supply.vmmc, load); +} + +static void msm_config_vqmmc_regulator (struct mmc_host *mmc,bool hpm) +{ +int load; + +if (!hpm) + load =0 ; +else if (!mmc->card) + load =max (MMC_VQMMC_MAX_LOAD_UA ,SD_VQMMC_MAX_LOAD_UA ); +else if (mmc_card_sd (mmc->card)) + load =SD_VQMMC_MAX_LOAD_UA ; +else +return ; + +regulator_set_load (mmc->supply.vqmmc, load); +} + +static int sdhci_msm_set_vmmc (struct sdhci_msm_host *msm_host, +struct mmc_host *mmc,bool hpm) {if (IS_ERR (mmc->supply.vmmc))return 0 ; +msm_config_vmmc_regulator (mmc, hpm); +return mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, mmc->ios.vdd); }
@@ -1400,6 +1446,8 @@ static int msm_toggle_vqmmc(struct sdhci_msm_host *msm_host,if (msm_host->vqmmc_enabled == level)return 0 ; +msm_config_vqmmc_regulator (mmc, level); +if (level) {/* Set the IO voltage regulator to default voltage level */ if (msm_host->caps_0 &CORE_3_0V_SUPPORT )
@@ -1622,7 +1670,8 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq) }if (pwr_state) { - ret =sdhci_msm_set_vmmc (mmc); + ret =sdhci_msm_set_vmmc (msm_host, mmc, + pwr_state &REQ_BUS_ON );if (!ret) ret =sdhci_msm_set_vqmmc (msm_host, mmc, pwr_state &REQ_BUS_ON );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/12 tipc: re-order conditions in tipc_crypto_key_rcv()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 5fe71fda89745fc3cd95f70d06e9162b595c3702 ]
On a 32bit system the "keylen + sizeof(struct tipc_aead_key)" math could have an integer wrapping issue. It doesn't matter because the "keylen" is checked on the next line, but just to make life easier for static analysis tools, let's re-order these conditions and avoid the integer overflow.
--- net/tipc/crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/tipc/crypto.c +2 -2
@@ -2297,8 +2297,8 @@ static bool tipc_crypto_key_rcv(struct tipc_crypto *rx, struct tipc_msg *hdr) keylen =ntohl (*((__be32 *)(data +TIPC_AEAD_ALG_NAME )));/* Verify the supplied size values */ -if (unlikely (size != keylen +sizeof (struct tipc_aead_key ) || - keylen >TIPC_AEAD_KEY_SIZE_MAX )) { +if (unlikely (keylen >TIPC_AEAD_KEY_SIZE_MAX || + size != keylen +sizeof (struct tipc_aead_key ))) {pr_debug ("%s: invalid MSG_CRYPTO key size\n" , rx->name); goto exit; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/12 selftests/net/ipsec: Fix Null pointer dereference in rtattr_pack()
In reply to Sasha LevinFrom: Liu Ye <[email protected]>
[ Upstream commit 3a0b7fa095212b51ed63892540c4f249991a2d74 ]
Address Null pointer dereference / undefined behavior in rtattr_pack (note that size is 0 in the bad case).
Flagged by cppcheck as:
tools/testing/selftests/net/ipsec.c:230:25: warning: Possible null pointer
dereference: payload [nullPointer]
memcpy(RTA_DATA(attr), payload, size);
^
tools/testing/selftests/net/ipsec.c:1618:54: note: Calling function 'rtattr_pack',
4th argument 'NULL' value is 0
if (rtattr_pack(&req.nh, sizeof(req), XFRMA_IF_ID, NULL, 0)) {
^
tools/testing/selftests/net/ipsec.c:230:25: note: Null pointer dereference
memcpy(RTA_DATA(attr), payload, size);
^--- tools/testing/selftests/net/ipsec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/ipsec.c +2 -1
@@ -189,7 +189,8 @@ static int rtattr_pack(struct nlmsghdr *nh, size_t req_sz, attr->rta_len =RTA_LENGTH (size); attr->rta_type = rta_type; -memcpy (RTA_DATA (attr), payload, size); +if (payload) +memcpy (RTA_DATA (attr), payload, size);return 0 ; }
Signature · 1 line
2.39.5