HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage()
Subsystems (8)
Sasha Levin
maintainerPATCH 1/11 HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage()
From: Peilin Ye <[email protected]>
[ Upstream commit 25a097f5204675550afb879ee18238ca917cba7a ]
uref->usage_index is not always being properly checked, causing hiddev_ioctl_usage() to go out of bounds under some cases. Fix it.
--- drivers/hid/usbhid/hiddev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hid/usbhid/hiddev.c +4 -0
@@ -532,12 +532,16 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,switch (cmd) {case HIDIOCGUSAGE : +if (uref->usage_index >= field->report_count) + goto inval; uref->value = field->value[uref->usage_index];if (copy_to_user (user_arg, uref,sizeof (*uref))) goto fault; goto goodreturn;case HIDIOCSUSAGE : +if (uref->usage_index >= field->report_count) + goto inval; field->value[uref->usage_index] = uref->value; goto goodreturn;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/11 speakup: Fix wait_for_xmitr for ttyio case
From: Samuel Thibault <[email protected]>
[ Upstream commit 2b86d9b8ec6efb86fc5ea44f2d49b1df17f699a1 ]
This was missed while introducing the tty-based serial access.
The only remaining use of wait_for_xmitr with tty-based access is in spk_synth_is_alive_restart to check whether the synth can be restarted. With tty-based this is up to the tty layer to cope with the buffering etc. so we can just say yes.
--- drivers/staging/speakup/serialio.c | 8 +++++--- drivers/staging/speakup/spk_priv.h | 1 - drivers/staging/speakup/spk_ttyio.c | 7 +++++++ drivers/staging/speakup/spk_types.h | 1 + drivers/staging/speakup/synth.c | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-)
drivers/staging/speakup/serialio.c +5 -3
@@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned int clear);static unsigned char spk_serial_in (void );static unsigned char spk_serial_in_nowait (void );static void spk_serial_flush_buffer (void ); +static int spk_serial_wait_for_xmitr (struct spk_synth *in_synth);struct spk_io_ops spk_serial_io_ops = { .synth_out = spk_serial_out,
@@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = { .synth_in = spk_serial_in, .synth_in_nowait = spk_serial_in_nowait, .flush_buffer = spk_serial_flush_buffer, + .wait_for_xmitr = spk_serial_wait_for_xmitr, };EXPORT_SYMBOL_GPL (spk_serial_io_ops);
@@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void) }EXPORT_SYMBOL_GPL (spk_stop_serial_interrupt); -int spk_wait_for_xmitr (struct spk_synth *in_synth) +static int spk_serial_wait_for_xmitr (struct spk_synth *in_synth) {int tmout =SPK_XMITR_TIMEOUT ;
@@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)static int spk_serial_out (struct spk_synth *in_synth,const char ch) { -if (in_synth->alive &&spk_wait_for_xmitr (in_synth)) { +if (in_synth->alive &&spk_serial_wait_for_xmitr (in_synth)) {outb_p (ch, speakup_info.port_tts);return 1 ; }
@@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth *synth,while ((ch = *buff)) {if (ch =='\n' ) ch = synth->procspeech; -if (spk_wait_for_xmitr (synth)) +if (spk_serial_wait_for_xmitr (synth))outb (ch, speakup_info.port_tts);else return buff;
drivers/staging/speakup/spk_priv.h +0 -1
@@ -36,7 +36,6 @@const struct old_serial_port *spk_serial_init (int index);void spk_stop_serial_interrupt (void ); -int spk_wait_for_xmitr (struct spk_synth *in_synth);void spk_serial_release (void );void spk_ttyio_release (void );void spk_ttyio_register_ldisc (void );
drivers/staging/speakup/spk_ttyio.c +7 -0
@@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear);static unsigned char spk_ttyio_in (void );static unsigned char spk_ttyio_in_nowait (void );static void spk_ttyio_flush_buffer (void ); +static int spk_ttyio_wait_for_xmitr (struct spk_synth *in_synth);struct spk_io_ops spk_ttyio_ops = { .synth_out = spk_ttyio_out,
@@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = { .synth_in = spk_ttyio_in, .synth_in_nowait = spk_ttyio_in_nowait, .flush_buffer = spk_ttyio_flush_buffer, + .wait_for_xmitr = spk_ttyio_wait_for_xmitr, };EXPORT_SYMBOL_GPL (spk_ttyio_ops);
@@ -283,6 +285,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)mutex_unlock (&speakup_tty_mutex); } +static int spk_ttyio_wait_for_xmitr (struct spk_synth *in_synth) +{ +return 1 ; +} +static unsigned char ttyio_in (int timeout) {struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
drivers/staging/speakup/spk_types.h +1 -0
@@ -157,6 +157,7 @@ struct spk_io_ops {unsigned char (*synth_in)(void );unsigned char (*synth_in_nowait)(void );void (*flush_buffer)(void ); +int (*wait_for_xmitr)(struct spk_synth *synth); };struct spk_synth {
drivers/staging/speakup/synth.c +1 -1
@@ -159,7 +159,7 @@ int spk_synth_is_alive_restart(struct spk_synth *synth) {if (synth->alive)return 1 ; -if (spk_wait_for_xmitr (synth) >0 ) { +if (synth->io_ops->wait_for_xmitr (synth) >0 ) {/* restart */ synth->alive =1 ;synth_printf ("%s" , synth->init);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/11 tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup
In reply to Sasha LevinFrom: John Stultz <[email protected]>
[ Upstream commit 975efc66d4e654207c17f939eb737ac591ac38fe ]
When booting with heavily modularized config, the serial console may not be able to load until after init when modules that satisfy needed dependencies have time to load.
Unfortunately, as qcom_geni_console_setup is marked as __init, the function may have been freed before we get to run it, causing boot time crashes such as:
[ 6.469057] Unable to handle kernel paging request at virtual address ffffffe645d4e6cc [ 6.481623] Mem abort info: [ 6.484466] ESR = 0x86000007 [ 6.487557] EC = 0x21: IABT (current EL), IL = 32 bits [ 6.492929] SET = 0, FnV = 0g [ 6.496016] EA = 0, S1PTW = 0 [ 6.499202] swapper pgtable: 4k pages, 39-bit VAs, pgdp=000000008151e000 [ 6.501286] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2 [ 6.505977] [ffffffe645d4e6cc] pgd=000000017df9f003, p4d=000000017df9f003, pud=000000017df9f003, pmd=000000017df9c003, pte=0000000000000000 [ 6.505990] Internal error: Oops: 86000007 [#1] PREEMPT SMP [ 6.505995] Modules linked in: zl10353 zl10039 zl10036 zd1301_demod xc5000 xc4000 ves1x93 ves1820 tuner_xc2028 tuner_simple tuner_types tua9001 tua6100 1 [ 6.506152] isl6405 [ 6.518104] ufshcd-qcom 1d84000.ufshc: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0 [ 6.530549] horus3a helene fc2580 fc0013 fc0012 fc0011 ec100 e4000 dvb_pll ds3000 drxk drxd drx39xyj dib9000 dib8000 dib7000p dib7000m dib3000mc dibx003 [ 6.624271] CPU: 7 PID: 148 Comm: kworker/7:2 Tainted: G W 5.8.0-mainline-12021-g6defd37ba1cd #3455 [ 6.624273] Hardware name: Thundercomm Dragonboard 845c (DT) [ 6.624290] Workqueue: events deferred_probe_work_func [ 6.624296] pstate: 40c00005 (nZcv daif +PAN +UAO BTYPE=--) [ 6.624307] pc : qcom_geni_console_setup+0x0/0x110 [ 6.624316] lr : try_enable_new_console+0xa0/0x140 [ 6.624318] sp : ffffffc010843a30 [ 6.624320] x29: ffffffc010843a30 x28: ffffffe645c3e7d0 [ 6.624325] x27: ffffff80f8022180 x26: ffffffc010843b28 [ 6.637937] x25: 0000000000000000 x24: ffffffe6462a2000 [ 6.637941] x23: ffffffe646398000 x22: 0000000000000000 [ 6.637945] x21: 0000000000000000 x20: ffffffe6462a5ce8 [ 6.637952] x19: ffffffe646398e38 x18: ffffffffffffffff [ 6.680296] x17: 0000000000000000 x16: ffffffe64492b900 [ 6.680300] x15: ffffffe6461e9d08 x14: 69202930203d2064 [ 6.680305] x13: 7561625f65736162 x12: 202c363331203d20 [ 6.696434] x11: 0000000000000030 x10: 0101010101010101 [ 6.696438] x9 : 4d4d20746120304d x8 : 7f7f7f7f7f7f7f7f [ 6.707249] x7 : feff4c524c787373 x6 : 0000000000008080 [ 6.707253] x5 : 0000000000000000 x4 : 8080000000000000 [ 6.707257] x3 : 0000000000000000 x2 : ffffffe645d4e6cc [ 6.744223] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34) [ 6.744966] x1 : fffffffefe74e174 x0 : ffffffe6462a5ce8 [ 6.753580] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34) [ 6.761634] Call trace: [ 6.761639] qcom_geni_console_setup+0x0/0x110 [ 6.761645] register_console+0x29c/0x2f8 [ 6.767981] Bluetooth: hci0: Frame reassembly failed (-84) [ 6.775252] uart_add_one_port+0x438/0x500 [ 6.775258] qcom_geni_serial_probe+0x2c4/0x4a8 [ 6.775266] platform_drv_probe+0x58/0xa8 [ 6.855359] really_probe+0xec/0x398 [ 6.855362] driver_probe_device+0x5c/0xb8 [ 6.855367] __device_attach_driver+0x98/0xb8 [ 7.184945] bus_for_each_drv+0x74/0xd8 [ 7.188825] __device_attach+0xec/0x148 [ 7.192705] device_initial_probe+0x24/0x30 [ 7.196937] bus_probe_device+0x9c/0xa8 [ 7.200816] deferred_probe_work_func+0x7c/0xb8 [ 7.205398] process_one_work+0x20c/0x4b0 [ 7.209456] worker_thread+0x48/0x460 [ 7.213157] kthread+0x14c/0x158 [ 7.216432] ret_from_fork+0x10/0x18 [ 7.220049] Code: bad PC value [ 7.223139] ---[ end trace 73f3b21e251d5a70 ]---
Thus this patch removes the __init avoiding crash in such configs.
--- drivers/tty/serial/qcom_geni_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/qcom_geni_serial.c +1 -1
@@ -1050,7 +1050,7 @@ static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) }#ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE -static int __init qcom_geni_console_setup (struct console *co,char *options) +static int qcom_geni_console_setup (struct console *co,char *options) {struct uart_port *uport;struct qcom_geni_serial_port *port;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 4/11 drm/msm: add shutdown support for display platform_driver
In reply to Sasha LevinFrom: Krishna Manikandan <[email protected]>
[ Upstream commit 9d5cbf5fe46e350715389d89d0c350d83289a102 ]
Define shutdown callback for display drm driver, so as to disable all the CRTCS when shutdown notification is received by the driver.
This change will turn off the timing engine so that no display transactions are requested while mmu translations are getting disabled during reboot sequence.
Changes in v2:
- Remove NULL check from msm_pdev_shutdown (Stephen Boyd)
- Change commit text to reflect when this issue was uncovered (Sai Prakash Ranjan)
--- drivers/gpu/drm/msm/msm_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +8 -0
@@ -1358,6 +1358,13 @@ static int msm_pdev_remove(struct platform_device *pdev)return 0 ; } +static void msm_pdev_shutdown (struct platform_device *pdev) +{ +struct drm_device *drm =platform_get_drvdata (pdev); + +drm_atomic_helper_shutdown (drm); +} +static const struct of_device_id dt_match[] = { { .compatible ="qcom,mdp4" , .data = (void *)KMS_MDP4 }, { .compatible ="qcom,mdss" , .data = (void *)KMS_MDP5 },
@@ -1369,6 +1376,7 @@ MODULE_DEVICE_TABLE(of, dt_match);static struct platform_driver msm_platform_driver = { .probe = msm_pdev_probe, .remove = msm_pdev_remove, + .shutdown = msm_pdev_shutdown, .driver = { .name ="msm" , .of_match_table = dt_match,
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 5/11 hwmon: (applesmc) check status earlier.
In reply to Sasha LevinFrom: Tom Rix <[email protected]>
[ Upstream commit cecf7560f00a8419396a2ed0f6e5d245ccb4feac ]
clang static analysis reports this representative problem
applesmc.c:758:10: warning: 1st function call argument is an
uninitialized value
left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~buffer is filled by the earlier call
ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, ...
This problem is reported because a goto skips the status check. Other similar problems use data from applesmc_read_key before checking the status. So move the checks to before the use.
--- drivers/hwmon/applesmc.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/hwmon/applesmc.c +16 -15
@@ -760,15 +760,18 @@ static ssize_t applesmc_light_show(struct device *dev, } ret =applesmc_read_key (LIGHT_SENSOR_LEFT_KEY , buffer, data_length); +if (ret) + goto out;/* newer macbooks report a single 10-bit bigendian value */ if (data_length ==10 ) { left =be16_to_cpu (*(__be16 *)(buffer +6 )) >>2 ; goto out; } left = buffer[2 ]; + + ret =applesmc_read_key (LIGHT_SENSOR_RIGHT_KEY , buffer, data_length);if (ret) goto out; - ret =applesmc_read_key (LIGHT_SENSOR_RIGHT_KEY , buffer, data_length); right = buffer[2 ]; out:
@@ -817,12 +820,11 @@ static ssize_t applesmc_show_fan_speed(struct device *dev, to_index(attr)); ret =applesmc_read_key (newkey, buffer,2 ); - speed = ((buffer[0 ] <<8 | buffer[1 ]) >>2 ); -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%u\n" , speed); + + speed = ((buffer[0 ] <<8 | buffer[1 ]) >>2 ); +return snprintf (sysfsbuf,PAGE_SIZE ,"%u\n" , speed); } static ssize_t applesmc_store_fan_speed(struct device *dev,
@@ -858,12 +860,11 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,u8 buffer[2 ]; ret =applesmc_read_key (FANS_MANUAL , buffer,2 ); - manual = ((buffer[0 ] <<8 | buffer[1 ]) >>to_index (attr)) &0x01 ; -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , manual); + + manual = ((buffer[0 ] <<8 | buffer[1 ]) >>to_index (attr)) &0x01 ; +return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , manual); } static ssize_t applesmc_store_fan_manual(struct device *dev,
@@ -879,10 +880,11 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,return -EINVAL ; ret =applesmc_read_key (FANS_MANUAL , buffer,2 ); - val = (buffer[0 ] <<8 | buffer[1 ]);if (ret) goto out; + val = (buffer[0 ] <<8 | buffer[1 ]); +if (input) val = val | (0x01 <<to_index (attr));else
@@ -958,13 +960,12 @@ static ssize_t applesmc_key_count_show(struct device *dev,u32 count; ret =applesmc_read_key (KEY_COUNT_KEY , buffer,4 ); - count = ((u32 )buffer[0 ]<<24 ) + ((u32 )buffer[1 ]<<16 ) + - ((u32 )buffer[2 ]<<8 ) + buffer[3 ]; -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , count); + + count = ((u32 )buffer[0 ]<<24 ) + ((u32 )buffer[1 ]<<16 ) + + ((u32 )buffer[2 ]<<8 ) + buffer[3 ]; +return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , count); } static ssize_t applesmc_key_at_index_read_show(struct device *dev,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/11 nvmet: Disable keep-alive timer when kato is cleared to 0h
In reply to Sasha LevinFrom: Amit Engel <[email protected]>
[ Upstream commit 0d3b6a8d213a30387b5104b2fb25376d18636f23 ]
Based on nvme spec, when keep alive timeout is set to zero the keep-alive timer should be disabled.
--- drivers/nvme/target/core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/nvme/target/core.c +6 -0
@@ -307,6 +307,9 @@ static void nvmet_keep_alive_timer(struct work_struct *work)static void nvmet_start_keep_alive_timer (struct nvmet_ctrl *ctrl) { +if (unlikely (ctrl->kato ==0 )) +return ; +pr_debug ("ctrl %d start keep-alive timer for %d secs\n" , ctrl->cntlid, ctrl->kato);
@@ -316,6 +319,9 @@ static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)static void nvmet_stop_keep_alive_timer (struct nvmet_ctrl *ctrl) { +if (unlikely (ctrl->kato ==0 )) +return ; +pr_debug ("ctrl %d stop keep-alive\n" , ctrl->cntlid);cancel_delayed_work_sync (&ctrl->ka_work);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/11 drm/msm/a6xx: fix gmu start on newer firmware
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit f5749d6181fa7df5ae741788e5d96f593d3a60b6 ]
New Qualcomm firmware has changed a way it reports back the 'started' event. Support new register values.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +11 -1
@@ -117,12 +117,22 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu) {int ret;u32 val; +u32 mask, reset_val; + + val =gmu_read (gmu,REG_A6XX_GMU_CM3_DTCM_START +0xff8 ); +if (val <=0x20010004 ) { + mask =0xffffffff ; + reset_val =0xbabeface ; + }else { + mask =0x1ff ; + reset_val =0x100 ; + }gmu_write (gmu,REG_A6XX_GMU_CM3_SYSRESET ,1 );gmu_write (gmu,REG_A6XX_GMU_CM3_SYSRESET ,0 ); ret =gmu_poll_timeout (gmu,REG_A6XX_GMU_CM3_FW_INIT_RESULT , val, - val ==0xbabeface ,100 ,10000 ); + (val & mask) == reset_val,100 ,10000 );if (ret)dev_err (gmu->dev,"GMU firmware initialization timed out\n" );
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 8/11 ceph: don't allow setlease on cephfs
In reply to Sasha LevinFrom: Jeff Layton <[email protected]>
[ Upstream commit 496ceaf12432b3d136dcdec48424312e71359ea7 ]
Leases don't currently work correctly on kcephfs, as they are not broken when caps are revoked. They could eventually be implemented similarly to how we did them in libcephfs, but for now don't allow them.
[ idryomov: no need for simple_nosetlease() in ceph_dir_fops and
ceph_snapdir_fops ]
--- fs/ceph/file.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/file.c +1 -0
@@ -1819,6 +1819,7 @@ const struct file_operations ceph_file_fops = { .mmap = ceph_mmap, .fsync = ceph_fsync, .lock = ceph_lock, + .setlease = simple_nosetlease, .flock = ceph_flock, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/11 cpuidle: Fixup IRQ state
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 49d9c5936314e44d314c605c39cce0fd947f9c3a ]
Match the pattern elsewhere in this file.
--- drivers/cpuidle/cpuidle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpuidle/cpuidle.c +2 -1
@@ -148,7 +148,8 @@ static void enter_s2idle_proper(struct cpuidle_driver *drv,*/ stop_critical_timings (); drv->states[index].enter_s2idle (dev, drv, index); -WARN_ON (!irqs_disabled ()); +if (WARN_ON_ONCE (!irqs_disabled ())) +local_irq_disable ();/* * timekeeping_resume() that will be called by tick_unfreeze() for the * first CPU executing it calls functions containing RCU read-side
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/11 s390: don't trace preemption in percpu macros
In reply to Sasha LevinFrom: Sven Schnelle <[email protected]>
[ Upstream commit 1196f12a2c960951d02262af25af0bb1775ebcc2 ]
Since commit a21ee6055c30 ("lockdep: Change hardirq{s_enabled,_context} to per-cpu variables") the lockdep code itself uses percpu variables. This leads to recursions because the percpu macros are calling preempt_enable() which might call trace_preempt_on().
--- arch/s390/include/asm/percpu.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
arch/s390/include/asm/percpu.h +14 -14
@@ -29,7 +29,7 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ old__, new__, prev__; \pcp_op_T__ *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ prev__ = *ptr__; \ do { \
@@ -37,7 +37,7 @@ new__ = old__ op (val); \ prev__ =cmpxchg (ptr__, old__, new__); \ }while (prev__ != old__); \ -preempt_enable (); \ +preempt_enable_notrace (); \ new__; \ })
@@ -68,7 +68,7 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \if (__builtin_constant_p (val__) && \ ((szcast )val__ >-129 ) && ((szcast )val__ <128 )) { \
@@ -84,7 +84,7 @@ : [val__] "d" (val__) \ : "cc"); \ } \ -preempt_enable (); \ +preempt_enable_notrace (); \ }#define this_cpu_add_4 (pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int)
@@ -95,14 +95,14 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ asmvolatile ( \ op" %[old__],%[val__],%[ptr__]\n" \ : [old__]"=d" (old__), [ptr__]"+Q" (*ptr__) \ : [val__]"d" (val__) \ :"cc" ); \ -preempt_enable (); \ +preempt_enable_notrace (); \ old__ + val__; \ })
@@ -114,14 +114,14 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ asmvolatile ( \ op" %[old__],%[val__],%[ptr__]\n" \ : [old__]"=d" (old__), [ptr__]"+Q" (*ptr__) \ : [val__]"d" (val__) \ :"cc" ); \ -preempt_enable (); \ +preempt_enable_notrace (); \ }#define this_cpu_and_4 (pcp, val) arch_this_cpu_to_op(pcp, val, "lan")
@@ -136,10 +136,10 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ ret__; \pcp_op_T__ *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ ret__ =cmpxchg (ptr__, oval, nval); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
@@ -152,10 +152,10 @@ ({ \typeof (pcp) *ptr__; \typeof (pcp) ret__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ ret__ =xchg (ptr__, nval); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
@@ -171,11 +171,11 @@typeof (pcp1) *p1__; \typeof (pcp2) *p2__; \int ret__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ p1__ =raw_cpu_ptr (&(pcp1)); \ p2__ =raw_cpu_ptr (&(pcp2)); \ ret__ =__cmpxchg_double (p1__, p2__, o1__, o2__, n1__, n2__); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/11 xen/xenbus: Fix granting of vmalloc'd memory
In reply to Sasha LevinFrom: Simon Leiner <[email protected]>
[ Upstream commit d742db70033c745e410523e00522ee0cfe2aa416 ]
On some architectures (like ARM), virt_to_gfn cannot be used for vmalloc'd memory because of its reliance on virt_to_phys. This patch introduces a check for vmalloc'd addresses and obtains the PFN using vmalloc_to_pfn in that case.
--- drivers/xen/xenbus/xenbus_client.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/xen/xenbus/xenbus_client.c +8 -2
@@ -365,8 +365,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,int i, j;for (i =0 ; i < nr_pages; i++) { - err =gnttab_grant_foreign_access (dev->otherend_id, -virt_to_gfn (vaddr),0 ); +unsigned long gfn; + +if (is_vmalloc_addr (vaddr)) + gfn =pfn_to_gfn (vmalloc_to_pfn (vaddr)); +else + gfn =virt_to_gfn (vaddr); + + err =gnttab_grant_foreign_access (dev->otherend_id, gfn,0 );if (err <0 ) {xenbus_dev_fatal (dev, err,"granting access to ring page" );
Signature · 1 line
2.25.1