Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / kernel / time / ntp.c
index f43d47c..8de4f78 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/rtc.h>
+#include <linux/audit.h>
 
 #include "ntp_internal.h"
 #include "timekeeping_internal.h"
@@ -709,7 +710,7 @@ static inline void process_adjtimex_modes(const struct __kernel_timex *txc,
  * kernel time-keeping variables. used by xntpd.
  */
 int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts,
-                 s32 *time_tai)
+                 s32 *time_tai, struct audit_ntp_data *ad)
 {
        int result;
 
@@ -720,14 +721,29 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts,
                        /* adjtime() is independent from ntp_adjtime() */
                        time_adjust = txc->offset;
                        ntp_update_frequency();
+
+                       audit_ntp_set_old(ad, AUDIT_NTP_ADJUST, save_adjust);
+                       audit_ntp_set_new(ad, AUDIT_NTP_ADJUST, time_adjust);
                }
                txc->offset = save_adjust;
        } else {
-
                /* If there are input parameters, then process them: */
-               if (txc->modes)
+               if (txc->modes) {
+                       audit_ntp_set_old(ad, AUDIT_NTP_OFFSET, time_offset);
+                       audit_ntp_set_old(ad, AUDIT_NTP_FREQ,   time_freq);
+                       audit_ntp_set_old(ad, AUDIT_NTP_STATUS, time_status);
+                       audit_ntp_set_old(ad, AUDIT_NTP_TAI,    *time_tai);
+                       audit_ntp_set_old(ad, AUDIT_NTP_TICK,   tick_usec);
+
                        process_adjtimex_modes(txc, time_tai);
 
+                       audit_ntp_set_new(ad, AUDIT_NTP_OFFSET, time_offset);
+                       audit_ntp_set_new(ad, AUDIT_NTP_FREQ,   time_freq);
+                       audit_ntp_set_new(ad, AUDIT_NTP_STATUS, time_status);
+                       audit_ntp_set_new(ad, AUDIT_NTP_TAI,    *time_tai);
+                       audit_ntp_set_new(ad, AUDIT_NTP_TICK,   tick_usec);
+               }
+
                txc->offset = shift_right(time_offset * NTP_INTERVAL_FREQ,
                                  NTP_SCALE_SHIFT);
                if (!(time_status & STA_NANO))